[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>
  • From: Luca Fancellu <Luca.Fancellu@xxxxxxx>
  • Date: Tue, 16 Apr 2024 08:59:00 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com])
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
  • Arc-message-signature: i=2; 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=qWXfMaRzwGuvL5uL9AJyEQBJWRxSO5r02Ir2vMlpiqw=; b=V2jbmgwDcdzKwFe6iMKeC9vaCs55tp6/7tmwQnZ6W+Xmdgz0X7vBi1TNtaGxf/gqhfCvXdhWo8zyikAP0D1WKm5MNwfHHo4ZXkKGa2mW81pJPg0O37EA5mvi3SfD17drKiq+EDfu7xOfsPg3Ip4rGvBjNb93udljaGDpcu6Yq1NvjBUDkFHCoearJmgsoKL3iFP9S5Y56BkUqhPNMNuO6nduvUQCEMewyr3wLce55D1uKaQvPnwiqPtEZQWwOHodniekqZ0ncZo2Uk+K75uNyXfWrMLMpxzGmDHlEWA8M2f4EhLkXm9/ajpbBun9Ua1sy6beAv6gwMwfWYjwlpLPvw==
  • 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=qWXfMaRzwGuvL5uL9AJyEQBJWRxSO5r02Ir2vMlpiqw=; b=NBx8Pv9kJRBeXCFkG1RppWAO/VXo7yptRqL4ot2qtjp2bZDtFsu4d5IR8G+iHPzTn+RYQyFfHEzqiJGdMeOYwkXGS2dO4uw4Xl0jC+16cuMDlGDJdgADXPKxJLGC//L1oopi+ksMT04Mw+KjMprWDahj3zMmXg5Mk1fuxy9MW84wbJbYdZo7FDG9QC32HU4Co66zzPkQL7tAZCG5IeZMfs0C8hR7DG/IV4AwtqDP5kfOcNW5JhgE0XxVBfICst3uBhSoybK0GLZzt+9BrDxeBYocsY1nuELDT5g9eXAo6DXW50wgYvX54/RSXp8Wh8kQMxLueGJwra52eydlEsh9Xw==
  • Arc-seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=DsR6PTIaQrJret7dv9INxaJW9I90FQmssXu8iR69wirK579N/Fnz7WeukoX5c9DPxmBmyqIncW4Lo3xlkz/SMQlHP6NT+Dxkhjj+UR7qUkdRFKPlvRqrBPwzYYiBZxrQ/aZDTWYs6H9mjD5V9uWEIJd6Mmcgg24lAWBwUJQjh8oFohcUZuR8vhq8KAZLMp1osLjWpo1FbRur5bp9u5wl03LkOzc4pAcjfgCwDIln84Z1Qe2+/PXYcjxoVhGC6CahYrmr/wxV0hzEDoi8ZVH+5HI2LIeTe0udu6OGqDi+XFn6qkdJv4bxlxtvBbJpASJhZ+xBSwCXyTMlqHwRjbwDsA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=apziTZabqnSBbgroCbxD8aMLc6QkuCcpgouRQJp32m3+gtk4TqwoHWmlxvp/M7fGR/hTKL6Y1thSLWBVAznRqjLiGSY0ivcvyifh5adL83Ht7SQeeUslQsebHBmiwbgVhTEw0YMmSxy7u8sJhenWK7EoXxrcYmDS+gTxIiBTYNwZjXGdK+VXIejqqGxFJMM2O/4qn93OENwBhd2q2+RAcZNRUT/eDF/tcEyY/xStDkh4b+jTw2JTUlbWj3iAAaQDQqEKBKMBHM0FxeUTLQvgo5uNDuDF3YMRliwTWpuvH7IpP2/qOer8VItHGH3vEnCqEqw1xCFFiePbPbjrtfR7IA==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Tue, 16 Apr 2024 08:59:23 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHainSZ45I8T1wdtkSTioIgDqTSKbFptBmAgADFXACAACfggIAAAloA
  • Thread-topic: [PATCH v2 13/13] xen/arm: List static shared memory regions as /memory nodes


> On 16 Apr 2024, at 09:50, Julien Grall <julien@xxxxxxx> 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?

Yes I agree with you, I’ll drop the patch that tries to do the merge, I was 
thinking about checking that the guest phys static mem region is
inside these boundaries:

#define GUEST_RAM_BANK_BASES { GUEST_RAM0_BASE, GUEST_RAM1_BASE }
#define GUEST_RAM_BANK_SIZES { GUEST_RAM0_SIZE, GUEST_RAM1_SIZE }

and also that doesn’t overlap with (struct kernel_info).mem, does it sounds 
right to you?

So in this patch I will only populate the /memory nodes with the static shared 
memory banks.


> 
> Cheers,
> 
> -- 
> Julien Grall


 


Rackspace

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