Re: [PATCH v7 1/1] arm/kvm: add support for MTE

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 4/28/23 18:50, Juan Quintela wrote:
Pardon my ignorance here, but to try to help with migration.  How is
this mte tag stored?
- 1 array of 8bits per page of memory
- 1 array of 64bits per page of memory
- whatever

Lets asume that it is 1 byte per page. For the explanation it don't
matter, only matters that it is an array of things that are one for each
page.

Not that it matters, as you say, but for concreteness, 1 4-bit tag per 16 bytes, packed, so 128 bytes per 4k page.

So my suggestion is just to send another array:

- 1 array of page addresses
- 1 array of page tags that correspond to the previous one
- 1 array of pages that correspond to the previous addresses

You put compatiblity marks here and there checking that you are using
mte (and the same version) in both sides and you call that a day.

Sounds reasonable.

Notice that this requires the series (still not upstream but already on
the list) that move the zero page detection to the multifd thread,
because I am assuming that zero pages also have tags (yes, it was not a
very impressive guess).

Correct.  "Proper" zero detection would include checking the tags as well.
Zero tags are what you get from the kernel on a new allocation.

Now you need to tell me if I should do this for each page, or use some
kind of scatter-gather function that allows me to receive the mte tags
from an array of pages.

That is going to depend on if KVM exposes an interface with which to bulk-set tags (STGM, "store tag multiple", is only available to kernel mode for some reason), a-la arch/arm64/mm/copypage.c (which copies the page data then the page tags separately).

For the moment, KVM believes that memcpy from userspace is sufficient, which means we'll want a custom memcpy using STGP to store 16 bytes along with its tag.

You could pass this information when we are searching for dirty pages,
but it is going to be complicated doing that (basically we only pass the
dirty page id, nothing else).

A page can be dirtied by changing nothing but a tag.
So we cannot of course send tags "early", they must come with the data.
I'm not 100% sure I understood your question here.

Another question, if you are using MTE, all pages have MTE, right?
Or there are other exceptions?

No such systems are built yet, so we won't know what corner cases the host system will have to cope with, but I believe as written so far all pages must have tags when MTE is enabled by KVM.


r~



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux