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

Re: [PATCH 6/7] xen/arm: Implement the logic for static shared memory from Xen heap


  • To: Michal Orzel <michal.orzel@xxxxxxx>
  • From: Luca Fancellu <Luca.Fancellu@xxxxxxx>
  • Date: Fri, 10 May 2024 09:37:22 +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=arm.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=Lge1AzD5rhGXz01NwK80rM038779ps/C04JAL6lzDtc=; b=dj/Ltiesp5JN6UneCGYMlqFE5er2V+WMTdJzglncUua+Wg2JidPveLchop+gKbPqxnoaHl4/39+AoCqQWyHxe0YuXVXkVuYAxHg9bZeH4RbW37sMLXrQ9OdD9uL10dT7oCA9dT45IpxW670Q156QkM8Q6Nt2T8vFJXFB5It0Lkxy2vRu2l8EKbADi5DmasPiAjXYmxlSBEGf5D3rnU/MLmVX6TbLwBMFTm3ykqceFH4BPjSxjso0WJ14NuvmeVhA8CzZn5DIUVtGfHFDmYJKbqDRtetLlDwg2bAi4ReXeJ0EwHYNU0d6QA4q1pUetGQdzcP6fEl3xgPef95sF2OJ2w==
  • 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=Lge1AzD5rhGXz01NwK80rM038779ps/C04JAL6lzDtc=; b=koSIgZjFWGDV6hQ74V+jyQ+wqOPJkW7shC27fHj+o8R/RA1onSYqGJgG5KYWMYZgo4aqbbteeJ1jVzIiBcC+ZB+udzVMCgKGe6IDo4fL6+qvxddlMZR5VXvvcrYYa6PgHWPK13Pt4srb3eNzqrpiXwIwgQ/yhoSZeZimb7h6NDbiRS3Bdc4Gl71RDZpNm4ssQONav9EiydWkqs8qh8gjQpC75W5gmO+EGCUlldohndnI40bCKJAtCxqEdNvfVRcjPQnW1LP1v+cb8+SLq7xErQP75OtQkuhLDeGyLxzcWHmEqXphOY8EAl/nh9YtVI92VoByz6R72dOQ3oOV6bT/1g==
  • Arc-seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=Kit/bHzcEwllSfMx0RgNvhrQhguidy3OgLBVNJLKTlZzQV1S46lEBlIPMQ6UlePciX8tQ7XHRaWuFziVJfTOgw832GRRPNR/sWpz4jjRF1MBiWY4Ph5ZsIPWMNSQKEqW0WU5qMIUqk/95E5ekzdSRGza1c8hgdkOx2/CadO4L8ve0p6AkUX2Kt5/lEYGbTolInqCvi4EFmvDXAC9TaMoKqX8ZzdX813Kce7V+1zjhOOHiwxSxXOZniLmQQzQbNVCqFGSxYZFzZJTa/YnKfiDEtdU1upxpkNoHoSzN8VpmtPyULBD5q31g44nTlFZqwdGhVKzXMXYZsByuUz/lYi49Q==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Gh5KAypQsCbuxvqKESV45TZmNuvvvSux8bZfNFr1Y3v+4jk/eDFGQ5FKEbwPsY1PJwL2IXcYdMuL3TapAUy7mKNq2BTFvtSVr60wIhOiUR3HcT2pOiRHiZfdKnsyW09Q/jsq4TAC7vhafGCr+qND7qRkKHR8ai9JAOHX4OMOHBJprYL+UfmcjCg4e3RvnUBQN80hDmmdeBqGW1YiJsI5Oqm1qj+W0JyZS0RIhJJhy5BI5o5weNCAwmyjHlBwyuPLnKeWzVwew7p35/BlgT2H9PtaKFLXsNaNY+kF4v9jlq8Nf+ztpbFOQNPC7zQfj3GlzVDP+iwtXvTajdGHmIXJtw==
  • 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>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Fri, 10 May 2024 09:37:46 +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: AQHalVfty94kOt4AK0ecWyByn7T1+rGQSwuAgAACP4CAAAIGAIAAAUOA
  • Thread-topic: [PATCH 6/7] xen/arm: Implement the logic for static shared memory from Xen heap


> On 10 May 2024, at 10:32, Michal Orzel <michal.orzel@xxxxxxx> wrote:
> 
> Hi Luca,
> 
> On 10/05/2024 11:25, Luca Fancellu wrote:
>> 
>> 
>>> On 10 May 2024, at 10:17, Michal Orzel <michal.orzel@xxxxxxx> wrote:
>>> 
>>> Hi Luca,
>>> 
>>> On 23/04/2024 10:25, Luca Fancellu wrote:
>>>> 
>>>> 
>>>> This commit implements the logic to have the static shared memory banks
>>>> from the Xen heap instead of having the host physical address passed from
>>>> the user.
>>>> 
>>>> When the host physical address is not supplied, the physical memory is
>>>> taken from the Xen heap using allocate_domheap_memory, the allocation
>>>> needs to occur at the first handled DT node and the allocated banks
>>>> need to be saved somewhere, so introduce the 'shm_heap_banks' static
>>>> global variable of type 'struct meminfo' that will hold the banks
>>>> allocated from the heap, its field .shmem_extra will be used to point
>>>> to the bootinfo shared memory banks .shmem_extra space, so that there
>>>> is not further allocation of memory and every bank in shm_heap_banks
>>>> can be safely identified by the shm_id to reconstruct its traceability
>>>> and if it was allocated or not.
>>>> 
>>>> A search into 'shm_heap_banks' will reveal if the banks were allocated
>>>> or not, in case the host address is not passed, and the callback given
>>>> to allocate_domheap_memory will store the banks in the structure and
>>>> map them to the current domain, to do that, some changes to
>>>> acquire_shared_memory_bank are made to let it differentiate if the bank
>>>> is from the heap and if it is, then assign_pages is called for every
>>>> bank.
>>>> 
>>>> When the bank is already allocated, for every bank allocated with the
>>>> corresponding shm_id, handle_shared_mem_bank is called and the mapping
>>>> are done.
>>>> 
>>>> Signed-off-by: Luca Fancellu <luca.fancellu@xxxxxxx>
>>> 
>>> I tested this patch and it resulted in assertion:
>>> Assertion 's <= e' failed at common/rangeset.c:189
>>> 
>>> I checked and in find_unallocated_memory(), given that start is ~0UL (host 
>>> address not provided),
>>> start + size would overflow. Did you test this patch?
>> 
>> Hi Michal,
>> 
>> Mmm I’m testing with a dom0less setup, without dom0, I think I missed that 
>> part because my guests doesn’t have
>> the hypervisor node (enhanced), sorry about that, I’ll test using your 
>> setup, can you confirm what are you using?
> I have these Qemu tests (with and without SMMU):
> - shmem between domU1 and domU2 with/without host address provided (owner 
> domIO or domU1)

Ok, I tested this one, but without enhanced domUs

> - shmem between dom0 and domU1 with/without host address provided (owner 
> domIO or dom0)

I’m missing this one, I’ll check everywhere where bootinfo_get_shmem() is used, 
sorry for the oversight 

> 
> BTW. What was the conclusion about the issue if shmem region clashes with RAM 
> allocated for 1:1 domU e.g. dom0.
> Accidentally, I end up with a configuration where Xen allocated for dom0 a 
> region of RAM clashing with my shmem region.

So the conclusion is that we should not have this configuration, but at the 
moment there is a tech debt because to enforce the
check we should do some work around the p2m as Julien suggested, but it’s not 
trivial because seems that some hyper calls
are currently relaying on overwriting the mappings.


> 
> ~Michal


 


Rackspace

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