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

RE: [PATCH v5 1/8] xen/arm: introduce static shared memory


  • To: Julien Grall <julien@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Penny Zheng <Penny.Zheng@xxxxxxx>
  • Date: Mon, 18 Jul 2022 02:35:30 +0000
  • Accept-language: 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=IXeSAIE5D9TtN7VgfaN92kv4d7Jb6GTKGVhKjbNHNnA=; b=UkmzcbzZLenOb0S68NKqi4HPZcIujgZv707dHEN/BsIifAyYxQdhu4+l1ciC9lRnzYmPJEFGVIOojy1iGl7pBktf6W4c6g9hUjkubkJ63vAc79GgBj1rtJwuowgx7chG4w2MxLdbwoPmBUkow4cNflDtlAsid6Mq9mDEBgw3l7eDLMPMZpblDpbvGH/zdECIafo6D063XaWvt5LZ1yY626eVvWyNWSx7/a7nwpPaI4kZMf//6h1fmwgkRi3KZdTa1I+fG0N1oLXrr7MxUscGn/5uu04KejU74Y9Y76GL15v1v1/E8QvPW53vtwpRu+dlMtTjqRyJeHN7YvkFhrbKDg==
  • 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=IXeSAIE5D9TtN7VgfaN92kv4d7Jb6GTKGVhKjbNHNnA=; b=ne0VDd2jK12XziQqDxWT0L3nEXl3Keu7FDBO0D4jZ6eMFEr6KHV8QVDID69H46OvFMUPwEWXDvFYIYdoTJPy2aiJ1JslZXKjSAkvsYZ7CdFBrUY3/XZRzCWhP+LX5uXqLpCrxiW1g2VWZ5URVZCRylumvCRIHwQ51AaNSudroGPGFcpyv8uCzlT4MRXOPwUVh+JBmzG4QoxCe31ABLH7+de2bzW2TzwBGTt/FlI9wLdcFlVwDQIqo/Lq2Z+jd+zFfiXV9zIJXXcTmX1NgzwW3l9/qYgt0TIPznUOzRxXl5sEa36LBTpxZ9z014MwHpE7zp6tpOvJHeQtT8AhYPWTEw==
  • Arc-seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=X31sVj9mqYShu89wtmVBecDL+sJ/eKr97EeOkq+1dw0pM6xyXkJPLWxylnhVblsnr/FY0c5m2EsKxL0qcfwP3iVAjIrUi6ilmD8fDFJs5nIk/pqkWh5u9KY2pAKhCb9H3pjAjYdgzjY3XnBBYGfw04kitJAt+jZvBT5nT8K9wa9E3effkA6oyovUmdp//3AScn4Cy+DJlfQGR+4ABpBRAR3LpRbAyX460Y7TbL8L4JI87d9D3Nat4S3ntGsZJMRdotWdxY/I2SElkEdOv/aKHgJVHsGauS+HbGTw6zu5Jb6Wh+iJupEP3ALlZGtDIn3sQGbpdwXG9s6XcI8tv1YNCQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GIAkHR+8pU71PNi12h5WY8x9bFFOz6JhXV3/v1/dkeWh6OLVtmOI/KXlJxr7Og3cjk5PclFPAVB9Va0DDPBsnaKxIWpscA1S659SSY5/Ua8g5qjixPdXwrzmHhksvMWAc5mggpZOLNBB+S0OQ5NRKJkpPtWx4l4uCWjy0L1Iw8z8jUR3Rmr8BbKSRoANZ4NvxV3JbD9n4uGtWUZj52/lv1BIHjiRj/0ZuFD91Qij3YHKjKx+fsNLNMBXBhKPymk0pbLw1t+wmzIb+M1ThoFSmW2h81CMm7CTXV4M1mMNGIq2fsFRqz7WpHLuPV2JNdN2JGeKH9yNzq7JGl0ZNByK9Q==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: Wei Chen <Wei.Chen@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Mon, 18 Jul 2022 02:35:55 +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: AQHYhGRAIMWAAZoglEyYz3pT8Ubq/a1e3kuAgAc4ucCAGcxmgIADsJ/Q
  • Thread-topic: [PATCH v5 1/8] xen/arm: introduce static shared memory

Hi Julien

> -----Original Message-----
> From: Julien Grall <julien@xxxxxxx>
> Sent: Saturday, July 16, 2022 2:10 AM
> To: Penny Zheng <Penny.Zheng@xxxxxxx>; xen-devel@xxxxxxxxxxxxxxxxxxxx
> Cc: Wei Chen <Wei.Chen@xxxxxxx>; Stefano Stabellini
> <sstabellini@xxxxxxxxxx>; Bertrand Marquis <Bertrand.Marquis@xxxxxxx>;
> Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
> Subject: Re: [PATCH v5 1/8] xen/arm: introduce static shared memory
> 
> Hi Penny,
> 
> On 29/06/2022 09:39, Penny Zheng wrote:
> >>> +    for ( i = 0; i < mem->nr_banks; i++ )
> >>> +    {
> >>> +        /*
> >>> +         * A static shared memory region could be shared between multiple
> >>> +         * domains.
> >>> +         */
> >>> +        if ( paddr == mem->bank[i].start && size == mem->bank[i].size )
> >>> +            break;
> >
> > Maybe I need to add a check on shm-id:
> > "
> >          /*
> >           * A static shared memory region could be shared between multiple
> >           * domains.
> >           */
> >          if ( strcmp(shm_id, mem->bank[i].shm_id) == 0 )
> >          {
> >              if ( paddr == mem->bank[i].start && size == mem->bank[i].size )
> >                  break;
> >              else
> >              {
> >                  printk("Warning: xen,shm-id %s does not match for all the 
> > nodes
> using the same region.\n",
> >                         shm_id);
> >                  return -EINVAL;
> >              }
> >          }
> > "
> > Wdyt?
> 
> AFAICT, this would allow to region to overlap if they have different shm ID. I
> am not entirely sure the rest of your code would work properly in this case
> (what if the owner is different).
> 
> So I think we need the following checks:
>    1) The shm ID matches *and* the region exactly match
>    2) The shm ID doesn't match and the region doesn't overlap with an
> existing one
> 

Understood, true, the overlap shall also be checked.
"
@@ -451,6 +453,31 @@ static int __init process_shm_node(const void *fdt, int 
node,
                 return -EINVAL;
             }
         }
+        else
+        {
+            paddr_t end = paddr + size;
+            paddr_t bank_end = mem->bank[i].start + mem->bank[i].size;
+
+            if ( (paddr < mem->bank[i].start && end <= mem->bank[i].start) ||
+                 (paddr >= bank_end && end > bank_end) )
+            {
+                if ( strncmp(shm_id, mem->bank[i].shm_id,
+                             MAX_SHM_ID_LENGTH) != 0 )
+                    break;
+                else
+                {
+                    printk("fdt: different shared memory region could not 
share the same shm ID %s\n",
+                           shm_id);
+                    return -EINVAL;
+                }
+            }
+            else
+            {
+                printk("fdt: shared memory region overlap with an existing 
entry %#"PRIpaddr" - %#"PRIpaddr"\n",
+                        mem->bank[i].start, bank_end);
+                return -EINVAL;
+            }
+        }
     }

     if ( i == mem->nr_banks )
"

> Cheers,
> 
> --
> Julien Grall

 


Rackspace

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