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

Re: [PATCH v2 13/13] xen/arm: List static shared memory regions as /memory nodes


  • To: Julien Grall <julien@xxxxxxx>, Luca Fancellu <Luca.Fancellu@xxxxxxx>
  • From: Michal Orzel <michal.orzel@xxxxxxx>
  • Date: Tue, 16 Apr 2024 10:57:50 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=xen.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=47IhZGAxV6K8jtfPatfyyJPzlu0xvtWCi4xBOL2Lckw=; b=gyLqNx5jJzTPXmaTzq5GtBR3aJHV1o4scRedOL9DzRMo0ZKgj471lWWJJpPy81MYRxW4H0zd5gpRjMe06l3WBJTKJt33BVU2IQg6gSDR2+KlJ5bCakGSdEYB95ldgtxmTBBSaX3U2MVnBacr/eDMr0MlOC3xckXoamP5LNtR1nhick0uvQ2fJmh0MSEwysRz4E9/aMeTifWjoAw6bIoxiohBOxn11TRWnwWawWCjGQj5L9Eo03Mw7SmqnOChpC1mnm717yAbg2ZI8A9DDwgqDPJvH+S0qQIZnLreRCNXhzMFXcGcnCNRXJYcj4GxP6jbQIdA5reU+gQotE7uCGiFRg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bJcfBTJ8es5HG3nJ700BdfJHo+3LFpDhp9wKNOMRqFVgW/WegxjSSnMM2x0jX38Nf6L/na2EI9LPHaY39xnDdQcipGBBbPj9rxnG72onfxcDpR1LmzLGCOcvF/QIsRoXJ4KqvQ1c4pBMpYgBdy4k7QW71BW5k7pyikOAq6N7kanLNAPY7veGyh8puv535c9m0dfchTVGh9Ax7paUn5rgQFBHNPl+e56VhzGGaGNuyddgHIz9v+dnjEJ4afzKE7dR81K4TShnGqyVRYq8MUAx9vnotwE5/Don2LYyFOn1rHmXfxIGppwicbB1AmyX2YmCoXWnzThH7l0Mi+Pq4POfsA==
  • Cc: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Tue, 16 Apr 2024 08:58:05 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Hi Julien,

On 16/04/2024 10:50, Julien Grall wrote:
> 
> 
> On 16/04/2024 07:27, Luca Fancellu wrote:
>> Hi Julien,
> 
> Hi Luca,
> 
>>
>>> On 15 Apr 2024, at 19:41, Julien Grall <julien@xxxxxxx> wrote:
>>>
>>> Hi Luca,
>>>
>>> On 09/04/2024 12:45, Luca Fancellu wrote:
>>>> Currently Xen is not exporting the static shared memory regions
>>>> to the device tree as /memory node, this commit is fixing this
>>>> issue.
>>>> The static shared memory banks can be part of the memory range
>>>> available for the domain, so if they are overlapping with the
>>>> normal memory banks, they need to be merged together in order
>>>> to produce a /memory node with non overlapping ranges in 'reg'.
>>>
>>> Before reviewing the code in more details, I would like to understand a bit 
>>> more the use case and whether it should be valid.
>>>
>>>  From my understanding, the case you are trying to prevent is the following 
>>> setup:
>>>   1. The Guest Physical region 0x0000 to 0x8000 is used for RAM
>>>   2. The Guest Physical region 0x0000 to 0x4000 is used for static memory
>>
>> So far, it was possible to map guest physical regions inside the memory 
>> range given to the guest,
>> so the above configuration was allowed and the underlying host physical 
>> regions were of course
>> different and enforced with checks. So I’m not trying to prevent this 
>> behaviour, however ...
>>
>>>
>>> The underlying Host Physical regions may be different. Xen doesn't 
>>> guarantee in which order the regions will be mapped, So whether the 
>>> overlapped region will point to the memory or the shared region is unknown 
>>> (we don't guarantee the order of the mapping). So nothing good will happen 
>>> to the guest.
>>
>> ... now here I don’t understand if this was wrong from the beginning or not, 
>> shall we enforce also that
>> guest physical regions for static shared memory are outside the memory given 
>> to the guest?
> 
> Nothing good will happen if you are trying to overwrite mappings. So I
> think this should be enforced. However, this is a more general problem.
> At the moment, this is pretty much as mess because you can overwrite any
> mapping (e.g. map MMIO on top of the RAM).
> 
> I think the easiest way to enforce is to do it in the P2M code like x86
> does for certain mappings.
> 
> Anyway, I don't think the problem should be solved here or by you (this
> is likely going to be a can of worms). For now, I would consider to
> simply drop the patches that are trying to do the merge.
> 
> Any thoughts?
I agree with your analysis. For now, let's drop this patch.
@Luca: This means I reviewed your series completely and you can send a respin.

~Michal



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.