|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH RFC 07/10] domain: map/unmap GADDR based shared guest areas
On 20.01.2023 19:15, Andrew Cooper wrote:
> On 18/01/2023 9:55 am, Jan Beulich wrote:
>> On 17.01.2023 23:04, Andrew Cooper wrote:
>>> On 19/10/2022 8:43 am, Jan Beulich wrote:
>>>> Noteworthy differences from map_vcpu_info():
>>>> - areas can be registered more than once (and de-registered),
>>> When register by GFN is available, there is never a good reason to the
>>> same area twice.
>> Why not? Why shouldn't different entities be permitted to register their
>> areas, one after the other? This at the very least requires a way to
>> de-register.
>
> Because it's useless and extra complexity. From the point of view of
> any guest, its an MMIO(ish) window that Xen happens to update the
> content of.
>
> You don't get systems where you can ask hardware for e.g. "another copy
> of the HPET at mfn $foo please".
I/O ports appear in multiple places on many systems. I think MMIO regions
can, too. And then I don't see why there couldn't be a way to actually
control this (via e.g. some chipset specific register).
>>>> RFC: By using global domain page mappings the demand on the underlying
>>>> VA range may increase significantly. I did consider to use per-
>>>> domain mappings instead, but they exist for x86 only. Of course we
>>>> could have arch_{,un}map_guest_area() aliasing global domain page
>>>> mapping functions on Arm and using per-domain mappings on x86. Yet
>>>> then again map_vcpu_info() doesn't do so either (albeit that's
>>>> likely to be converted subsequently to use map_vcpu_area() anyway).
>>> ... this by providing a bound on the amount of vmap() space can be consumed.
>> I'm afraid I don't understand. When re-registering a different area, the
>> earlier one will be unmapped. The consumption of vmap space cannot grow
>> (or else we'd have a resource leak and hence an XSA).
>
> In which case you mean "can be re-registered elsewhere". More
> specifically, the area can be moved, and isn't a singleton operation
> like map_vcpu_info was.
>
> The wording as presented firmly suggests the presence of an XSA.
You mean the "map_vcpu_info() doesn't do so either"? That talks about the
function not using per-domain mappings. There's no connection at all that
I can see to a missed unmapping, which at this point is the only thing I
can deduce you might be referring to.
>>>> RFC: In map_guest_area() I'm not checking the P2M type, instead - just
>>>> like map_vcpu_info() - solely relying on the type ref acquisition.
>>>> Checking for p2m_ram_rw alone would be wrong, as at least
>>>> p2m_ram_logdirty ought to also be okay to use here (and in similar
>>>> cases, e.g. in Argo's find_ring_mfn()). p2m_is_pageable() could be
>>>> used here (like altp2m_vcpu_enable_ve() does) as well as in
>>>> map_vcpu_info(), yet then again the P2M type is stale by the time
>>>> it is being looked at anyway without the P2M lock held.
>>> Again, another error caused by Xen not knowing the guest physical
>>> address layout. These mappings should be restricted to just RAM regions
>>> and I think we want to enforce that right from the outset.
>> Meaning what exactly in terms of action for me to take? As said, checking
>> the P2M type is pointless. So without you being more explicit, all I can
>> take your reply for is merely a comment, with no action on my part (not
>> even to remove this RFC remark).
>
> There will become a point where it will need to become prohibited to
> issue this against something which isn't p2m_type_ram. If we had a sane
> idea of the guest physmap, I'd go as far as saying E820_RAM, but that's
> clearly not feasible yet.
>
> Even now, absolutely nothing good can possibly come of e.g. trying to
> overlay it on the grant table, or a grant mapping.
>
> ram || logdirty ought to exclude most cases we care about the guest
> (not) putting the mapping.
It's still not clear to me what you want me to do: If I add the P2M type
check here including log-dirty, then this will be inconsistent with what
we do elsewhere _and_ useless code (for the time being). I hope you're
not making a scope-creeping request for me to "fix" all the other places
(I may not have found all) where such a P2M type check is either missing
of failing to include log-dirty.
Jan
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |