[lkml]   [2020]   [Jan]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH v3 12/21] KVM: X86: Implement ring-based dirty memory tracking
On 09/01/20 20:15, Peter Xu wrote:
> Regarding dropping the indices: I feel like it can be done, though we
> probably need two extra bits for each GFN entry, for example:
> - Bit 0 of the GFN address to show whether this is a valid publish
> of dirty gfn
> - Bit 1 of the GFN address to show whether this is collected by the
> user

We can use bit 62 and 63 of the GFN.

I think this can be done in a secure way. Later in the thread you say:

> We simply check fetch_index (sorry I
> meant this when I said reset_index, anyway it's the only index that we
> expose to userspace) to make sure:
> reset_index <= fetch_index <= dirty_index

So this means that KVM_RESET_DIRTY_RINGS should only test the "collected
by user" flag on dirty ring entries between reset_index and dirty_index.

Also I would make it

00b (invalid GFN) ->
01b (valid gfn published by kernel, which is dirty) ->
1*b (gfn dirty page collected by userspace) ->
00b (gfn reset by kernel, so goes back to invalid gfn)
That is 10b and 11b are equivalent. The kernel doesn't read that bit if
userspace has collected the page.


 \ /
  Last update: 2020-01-19 10:10    [W:0.118 / U:0.540 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site