[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 10:50:58 +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=neRZvndPX0u2DeLE1jSqCQeaw2sJrkftqxSv6eqwZPQ=; b=lynN4Dcz5yrQ0QLiFG0GEKn32DJXnT2Od/fPNIWTTbSJUJINRFjk36FIxez7y/gsaoktV7w1Xgk5/g97t2wYGWY02sWoQNriuBNr6zMRKjHKq7sahu8oMxayxsV2NwakrxxNkjHIZZ7C+yfrVSN/XuedYrKossx2xhfZlb4URQGj6dVeVo7vaKlm+2GLlFXwYRo/hI+VmbnGU9SYFvpzX+WR/09K+6hq3xx+hP6YDRB/SbeWRP626GBQGXrenJsDrcqjTCxqmF0bGIXALDGBXuSETby8nzXvx8XBmCFPSM5BKzaG0fjFPBefCxeNelK/S3kkOo7s6B6wV0/Sgmiy9A==
  • 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=neRZvndPX0u2DeLE1jSqCQeaw2sJrkftqxSv6eqwZPQ=; b=UPKLFmvmC0rtxswcIqZivoC9iJjQLdkTZhzT04BACC+XnH+kxzi4CrI90W2puDeF25hHjoiCuWquCtETnUkPmNsOyVb7vtrc3NztLpXcCYmLtAkFWBG0lwaHs5rF4AAM/8s4NNCoDYQs29Cy9DAxd0BnouFpmFaoWApmEvHRch/Y//uyysWsHS7H4xvwhWVKpmrDac91Kio7FyaZpcjRGAQF+tVO2/A2pYKjtFJqkq0qA9XMIpuSwL4LZhUHg01Bu8o0aBmCohCmwiW7VZbgf7nTTb2g0St0Ko6KYh2wBfj29Q/cn3DaVqJLIVqFFX9NLW4+lHTEFJL569CqYot96A==
  • Arc-seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=Ip/L2eWKlxDc5Wnx9kXqnt/zLqGy+wwsNE0DLMWGYXRH7URXnzn8uA/okbxeAqSEHjkIe9SfPEc6QjaZGN059Ta/qsgdFgc3Yp1kBaYBx09QewIi+g3RakM4xhLc19qdlkfIQ9+zg3K1j1RHtE6FW0tiEZT8llDfC7arppwb9roDVl5VxDkNek9Oh8MYjqJaJBg0DeIDjD+eZXpLXsVxWFqaCz4oY1m/Fbul2YO2/4IenR4A59o9PK+RtiRNeM3VGKB6fVI4sDDU8xSHfUrhpkPYfi4Wk+UTYFZOZpL9poBQ2iO3krlTONWFpQtRPER8IqrRNuh+mTd8lYq9X/HffQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lL4dPCxuCk2MEYJRDkPYhDOuuAEkyRjCBW5EbGwx1x+pLUvL9k0jGNeyRqElACHSs2Dmf/OSuteTo7kn0/EVLm45txpvNYHTYHDQHAbwpJUO/4rZqp4U/UN3ZcpGPU2whmpIfUTkD0iEuXOry8VzgHxQ0RPAnWGuiNK+KGIyWgs2NyvVViiR9ajdgXKC81UHlIs7a6LUZdiej/mw8DK/BFy7W6OaVlaQJ0tjL0qmLVyW7saxRImojGJGsOp1XbnH7QufCxJ1gKAD21AJOPxecGdi7KFdsDkDopSGUv9VBiWvAGU2nNIYlzgDG6naKF4e5H3bsbp1w1u9YFa9G51Cnw==
  • 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 10:51:43 +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: AQHainSZ45I8T1wdtkSTioIgDqTSKbFptBmAgADFXACAACfggIAAAloAgAACHgCAAB0rAA==
  • Thread-topic: [PATCH v2 13/13] xen/arm: List static shared memory regions as /memory nodes


> On 16 Apr 2024, at 10:06, Julien Grall <julien@xxxxxxx> wrote:
> 
> 
> 
> On 16/04/2024 09:59, Luca Fancellu wrote:
>>> 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?
> 
> I don't fully understand what you want to do. But as I wrote before, the 
> overlaps happen with many different regions (what if you try to use the GIC 
> Distributor regions for the shared memory?).
> 
> So if we want some overlaps check, then it has to be generic.

After a chat in Matrix now I understand what you mean, thanks, I will just drop 
the patch 12 and update this one.

Cheers,
Luca


 


Rackspace

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