Re: [kvm-ppc-devel] RFC/patch portability: split kvm_vm_ioctl v2

Carsten Otte
2007-10-26T12:23:57Z

Avi Kivity wrote:
> Carsten Otte wrote:
>> Avi Kivity wrote:
>>> Why aren't memory slots common too? Only their number is different,
>>> while the implementation is the same.
>> Your approach makes the meaning of memory slot somewhat useless on
>> s390, if that one may be sparse and may be result of different
>> allocations: On x86, there has to be one memory slot per allocation,
>> versus on s390 there has to be exactly one memory slot with multiple
>> allocations behind.
>
> No, a memory slot can span multiple backing stores. But it must be
> contiguous in both the host userspace and guest physical address spaces.
I was not preceise enough: I meant to state that x86 demands one
memory slot per contiguous allocation. But with your "s390 has only
one memory slot" idea, this introduces a severe restriction for us:
our "single memory slot" does not need to be contiguous, neither in
guest physical nor in host userspace. All we need, is a certain
1:1+offset relationship between guest physical and host user. Page
size, backing, sparse are all variable.
Izik's idea, at least how I understood him, makes the best of both
worlds: we keep above addressing relationship intact, and have
multiple memory slots for all architectures.

>> For userspace that means, with your approach it has to do total
>> different memory setup for different archs _if_ it wants to use
>> multiple allocations and/or sparse:
>> - on x86 it does allocations to random userspace address, and
>> registers each of them as memory slot
>> - on s390 it does allocations to a specific address layout similar to
>> the guest, and registers only one memory slot for the whole thing
>>
>> With Izik's approach however, this is transparent to userspace: it has
>> multiple memory slots, one per allocation. Regardless of the CPU
>> architecture.
>
> You can do this with the current memory slots as well. Although I'm
> feeling that I misunderstood Izik's idea. I'll go talk to him.
No we can't: because current memory slots don't have a permanent
relationship between user and guest physical addresses that we do need
on s390. We cannot guarantee that over multiple slots, and we cannot
keep the guest from addressing memory around the memory slots unless
we refuse to use more than only one slot which has to start at guest
physical zero.

so long,
Carsten