From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C0C5342BCC; Mon, 29 May 2023 08:32:45 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B1D84411F3; Mon, 29 May 2023 08:32:45 +0200 (CEST) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mails.dpdk.org (Postfix) with ESMTP id 0D9A440A4B for ; Mon, 29 May 2023 08:32:43 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1685341964; x=1716877964; h=from:to:subject:date:message-id:references:in-reply-to: content-transfer-encoding:mime-version; bh=pSrX8xqvYEf/biHb8BzuyyYsFCiHBv4OWmrC+pJm7r4=; b=B9oqjmujc5eADS8DBACzkbF2IPy0zCxfI2PpwdwHnUY5bDn0XbBj7bkg 8xKwy3DYxAhA3ii02BNWI33uMeaw1PiY9SUqgK/d59+mYZZKV05uwBIf2 WWtMP6J0tnay6AsOBZijKA+GWtjmoF9jc5gwxJvt7i/G1ZQm2AuM6HLE7 H1utkbrIF7i5Fc8PrSwMpEKRW4didADMHdoMExpBZDbHtyPdQ0rHoSeMF 73xoR7uD3vi0vxK00wWszgGMm6uuUEiorFc1FFiGXfG8BzVgs9SXuwTSf l+IvY9oHFD5UXJ//9T5o3fHb6g+QYKN68nXDYbahpUFPEcIQc47odiuc6 g==; X-IronPort-AV: E=McAfee;i="6600,9927,10724"; a="334988874" X-IronPort-AV: E=Sophos;i="6.00,200,1681196400"; d="scan'208";a="334988874" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 May 2023 23:32:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10724"; a="709141463" X-IronPort-AV: E=Sophos;i="6.00,200,1681196400"; d="scan'208";a="709141463" Received: from fmsmsx603.amr.corp.intel.com ([10.18.126.83]) by fmsmga007.fm.intel.com with ESMTP; 28 May 2023 23:32:43 -0700 Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Sun, 28 May 2023 23:32:42 -0700 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx612.amr.corp.intel.com (10.18.126.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23 via Frontend Transport; Sun, 28 May 2023 23:32:42 -0700 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (104.47.55.173) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.23; Sun, 28 May 2023 23:32:41 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LIOhsBsIXu5f3clfIWsEEl4yYdRhjlzhG/n+rJN/KGPswk2zw0k5d3Grxid3Awq5BiYYu2NgDS4yi5lStQxCfeN8fwfQlkrAYvDmTiPcHITiEx8nJQSaabCShowzCKqPYlepCeWLfwC/6ZoXg1arDqCeOYjZS6CC9ul3sBfcP7GSgZ6NnMoNzExvmoGC/a5d7gDnXF0tLTYJP+usVj8ceGRVBC8QjUuc1nU33K7DjCSqACUyS/MGMlS4QrMFuy1bIFSOeteCNncuDyqSfISmdWPRrPnpkJAT0lXExsGX3YwIk9zf/CLqzlILp923L2hzxv9pFqfMXdmrUZB1AvEtBw== 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=aj/uodwiqusRk/fdkMftRGPwLlhGiqOmcUyunb4X5ho=; b=HsED7hUlbABWCogow5kcqEs3zKo51XPPVrNZJCOf4JJ4T3HtGV9d2HVJ63z+VTxD2FGnMNIr1yKYFLJ4SZs3ChyeDAYU1vEKqp3USElaDDvGjWWfGrcQ+Jv9PApEO4l6lnQRwp2Ge0H6jyc4qCw473CdXl4mvHdcKIRzdwfIe70evvEUlEfpbgcigotImhSR1r/np5rh7ezMIfbexmxR/usCQ6Ghg4PM0Su0/nGtccju0IOtJAHIQHzVjdS+azJUexuSq4BCIZ5PVFG8PAwNgEaIJEXH8GgyfFfQqShXxi5Q36EO8k0iFQ0SLgYq45PErzPk3i7ghQEMCnGlnRTi2A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Received: from SN6PR11MB3504.namprd11.prod.outlook.com (2603:10b6:805:d0::17) by SJ0PR11MB4816.namprd11.prod.outlook.com (2603:10b6:a03:2ad::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.22; Mon, 29 May 2023 06:32:38 +0000 Received: from SN6PR11MB3504.namprd11.prod.outlook.com ([fe80::e427:f0a6:8472:d0f6]) by SN6PR11MB3504.namprd11.prod.outlook.com ([fe80::e427:f0a6:8472:d0f6%7]) with mapi id 15.20.6433.020; Mon, 29 May 2023 06:32:38 +0000 From: "Xia, Chenbo" To: Maxime Coquelin , "dev@dpdk.org" , "david.marchand@redhat.com" , "mkp@redhat.com" , "fbl@redhat.com" , "jasowang@redhat.com" , "Liang, Cunming" , "Xie, Yongji" , "echaudro@redhat.com" , "eperezma@redhat.com" , "amorenoz@redhat.com" , "lulu@redhat.com" Subject: RE: [PATCH v3 09/28] vhost: add page size info to IOTLB entry Thread-Topic: [PATCH v3 09/28] vhost: add page size info to IOTLB entry Thread-Index: AQHZjyXRkd5R92dygkCPRn3cUymX6q9w0GCw Date: Mon, 29 May 2023 06:32:38 +0000 Message-ID: References: <20230525162551.70359-1-maxime.coquelin@redhat.com> <20230525162551.70359-10-maxime.coquelin@redhat.com> In-Reply-To: <20230525162551.70359-10-maxime.coquelin@redhat.com> Accept-Language: en-US, zh-CN Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: SN6PR11MB3504:EE_|SJ0PR11MB4816:EE_ x-ms-office365-filtering-correlation-id: e288ad01-2000-4141-cea8-08db600e7f4b x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 0illQcPXo352TzWDcnMY4oUyTSee9natP459w8p8jgQdhVuSXf69b9Ryrz+6R6fNk2BM5m7mPiu1r1mqhxHpjb7mYsXc8p8R4iJ5buAV6mWNXgzqtIZoscVraU0UKzlsCzhC4KPyLKa6YmS8Og3JFoqEVGf58jJfMirvkjO19z5GFPrTFiXrhCOzOQuqLFE7reG6jEbWgykdfZiAKiXYGPE5nONoxVgiDb5SdRv39nvmTEgKKuqO+424RHQDFY26ky9ARc/8ZalirKaOt9BS0sQTlzdFdtEy+J7MWBdwQllelBWHgk0SY2tPKs8lHqNl2s/fthOhtPVcQCKIRCxvuojZl9nORczJ6WbousDTkFuxUUnXFBIuxmtEmSK2hvfPejr5veYfGIuP5M6EegrTQE5ekXPwXjUe+tb8WxBVe2cOcxGQehe+wF4pW4U/a+Zw9CGqsb7K6zmIOxrHzZXGo1muvvVtl7gp1ryecOjkBVZMseM+9r//qB83mETZL22PaqOdzRTzqNUrpUb/mgBVnMxv0cTr3QM6jMM1ZXVo1Rtbvg5OGFcud4Z3+bFGVPY4sydJ7b25gKilCCUDB4HnP0a5VQt+ZwaZRQg4/CJC6YhBD0B1L+nwhERvP/s3d45betgHBNLPu1+3CqZ+pHUHXQ== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SN6PR11MB3504.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(366004)(396003)(136003)(39860400002)(346002)(376002)(451199021)(26005)(7696005)(53546011)(9686003)(71200400001)(6506007)(2906002)(316002)(33656002)(186003)(55016003)(52536014)(5660300002)(41300700001)(7416002)(8676002)(8936002)(478600001)(921005)(82960400001)(122000001)(38100700002)(86362001)(110136005)(76116006)(66946007)(38070700005)(66476007)(66556008)(83380400001)(64756008)(66446008); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?xQJMKKU7/Yl9BVnfmcdkTx2KOJJ5q0+jlnEXOUhAMDf65/vo0m6DJBG1Y+3k?= =?us-ascii?Q?C8TzXwwF7YptCyDSG0HX34NaodInr1TmnQ84uMx7qT39AQLI9KjzSbEth04W?= =?us-ascii?Q?n4jXXoDTgLehW3zCPbS/Uiy4XEosb62ZcGKIKIuCbafmdteL+C6PGKj9AxN7?= =?us-ascii?Q?2DO0CQx5Lkeka6UGO7TxtwTwU5N/MLSHQ5hYDNHarFZ7VH9KbAMchBMm0ff4?= =?us-ascii?Q?QUY5rzTxC/bWA+ahRzWbhEG3dOGwQiO5jHrY81q3b5NjePgdUvkLSa4dgEJI?= =?us-ascii?Q?iLyYVccxlRqGTT4sI0dHCR1Mo7ZGhSUahtugtRzhzOEM7WqoCMJe5CA9qEKt?= =?us-ascii?Q?8Hu8hojuU45s4uaHFZsHXeKuYCSi7+KNcpztWe6JwBA7Zl65NerDJ5H8FjFc?= =?us-ascii?Q?6aV+YdYeAec1y4sbPKn8I55qyzyIMtZ+bVTw/9XSqfb2JRbXH/XngYdqNU4E?= =?us-ascii?Q?RrFrppBgj4Cjz5bHMsDp92Z/I5giP5ayqKERhRwC0M3HSK1EjSyg4ENmxxPD?= =?us-ascii?Q?uoOtoGeroUcn9WPxgTPgZZz860U1DLN76gVNTlPFdKbvC4l67nKwL6EGyiZL?= =?us-ascii?Q?DBFZo9hrdgEpzNgd0cwXFTI7wkgRvmuFatQjyOGw6F/mlwLvqjD7eqdspS9C?= =?us-ascii?Q?13/t9naG4fwSrEN50oPHJHO6uHoP2LIO1IPvbs+fDkJuaVAgaM9806BdlJ3r?= =?us-ascii?Q?PO2eQoQk46Lfg/QaS1AcKaKUM0IBiKIxBpNFrhfwNymlbggUPsCTUUjxEAes?= =?us-ascii?Q?SyvxbPZqVPOa4IgWMgViOuPI1eRNhJ3hweBJFaJL83wFAG4PbrnoaiLy/y/T?= =?us-ascii?Q?amEfs+ROLaQ8xXu244bA4XoHRALcGfFZ7K9NtvWtZn3wybgTlVboQm6Oo7b6?= =?us-ascii?Q?wU1AEoRrVU3mywu6eno/xfB9IlcZXlU3mu8HzDa6DFz4f1SuIkC/T8AOWS21?= =?us-ascii?Q?HmqiNONvX7VqRa5u44I6yaOTKgWtC903AX0QnH9YuLlctfB5EMTn8sa40Bcr?= =?us-ascii?Q?vLGvFpo3yl1bIXQjrnjGFBqQ7Rqybiq+VtuirMpdafacjL3XmYBLzHjpM1Gh?= =?us-ascii?Q?iMZvBJzpPD7I2gh97MI5NKdehKx5IrXbSNlZobpJbv2kaC6BP91NrE36RwRG?= =?us-ascii?Q?kkcllZ/Q4JxmE/7Vp+MPlZ6mT42hewR58RMgJtFS5bYESLAfSYghur5hZJZJ?= =?us-ascii?Q?YuFFEhreYIG5xfSwE1mBrkwOJVbPRnYCj6t1S/uP+7POqwdn//dEx+4eaZLL?= =?us-ascii?Q?JMl3aRVJI+PMvZJFPLslPUQfTTnX05i03eomgJPzcTDTZo2UANVklmUYXJzm?= =?us-ascii?Q?QRJxOezSmdKKg6TT4JJtQR2WHMmCrunNF5MA8ShTDdDK09KqFBGtncpzISbL?= =?us-ascii?Q?FXsU4/VxDv/uJW4mDf8SFr5QkpQMX6MjnmYBANFeFZzUn9QDVt7Xd15DNi6k?= =?us-ascii?Q?OJf7iMjJSXINvrgpndwDt2RoyXCSFnJxiRPWHkd8gqlwDuznYLe5nQghooZT?= =?us-ascii?Q?FwGwKsxBSfS+95N7ni0N18pdmoCX3m7jeRaKJo2WO3eOqQT/Z+Qye9tqfXGB?= =?us-ascii?Q?2ToXZ0NBZ/yXcQhiJBVq16kIg1PLGWnNm0N6DF95?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: SN6PR11MB3504.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: e288ad01-2000-4141-cea8-08db600e7f4b X-MS-Exchange-CrossTenant-originalarrivaltime: 29 May 2023 06:32:38.4333 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: G+jLpLAjBYqQMH/WolVSmCFgLFRNMce62PHYwP7V7tbEScu7DoPo64aD104dAzmJZc/pgB7GmTKsYo/EBpcY0g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR11MB4816 X-OriginatorOrg: intel.com X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org > -----Original Message----- > From: Maxime Coquelin > Sent: Friday, May 26, 2023 12:26 AM > To: dev@dpdk.org; Xia, Chenbo ; > david.marchand@redhat.com; mkp@redhat.com; fbl@redhat.com; > jasowang@redhat.com; Liang, Cunming ; Xie, Yongj= i > ; echaudro@redhat.com; eperezma@redhat.com; > amorenoz@redhat.com; lulu@redhat.com > Cc: Maxime Coquelin > Subject: [PATCH v3 09/28] vhost: add page size info to IOTLB entry >=20 > VDUSE will close the file descriptor after having mapped > the shared memory, so it will not be possible to get the > page size afterwards. >=20 > This patch adds an new page_shift field to the IOTLB entry, > so that the information will be passed at IOTLB cache > insertion time. The information is stored as a bit shift > value so that IOTLB entry keeps fitting in a single > cacheline. >=20 > Signed-off-by: Maxime Coquelin > --- > lib/vhost/iotlb.c | 46 ++++++++++++++++++++---------------------- > lib/vhost/iotlb.h | 2 +- > lib/vhost/vhost.h | 1 - > lib/vhost/vhost_user.c | 8 +++++--- > 4 files changed, 28 insertions(+), 29 deletions(-) >=20 > diff --git a/lib/vhost/iotlb.c b/lib/vhost/iotlb.c > index 14d143366b..a23008909f 100644 > --- a/lib/vhost/iotlb.c > +++ b/lib/vhost/iotlb.c > @@ -19,14 +19,14 @@ struct vhost_iotlb_entry { > uint64_t uaddr; > uint64_t uoffset; > uint64_t size; > + uint8_t page_shift; > uint8_t perm; > }; >=20 > #define IOTLB_CACHE_SIZE 2048 >=20 > static bool > -vhost_user_iotlb_share_page(struct vhost_iotlb_entry *a, struct > vhost_iotlb_entry *b, > - uint64_t align) > +vhost_user_iotlb_share_page(struct vhost_iotlb_entry *a, struct > vhost_iotlb_entry *b) > { > uint64_t a_start, a_end, b_start; >=20 > @@ -38,44 +38,41 @@ vhost_user_iotlb_share_page(struct vhost_iotlb_entry > *a, struct vhost_iotlb_entr >=20 > /* Assumes entry a lower than entry b */ > RTE_ASSERT(a_start < b_start); > - a_end =3D RTE_ALIGN_CEIL(a_start + a->size, align); > - b_start =3D RTE_ALIGN_FLOOR(b_start, align); > + a_end =3D RTE_ALIGN_CEIL(a_start + a->size, RTE_BIT64(a->page_shift)); > + b_start =3D RTE_ALIGN_FLOOR(b_start, RTE_BIT64(b->page_shift)); >=20 > return a_end > b_start; > } >=20 > static void > -vhost_user_iotlb_set_dump(struct virtio_net *dev, struct > vhost_iotlb_entry *node) > +vhost_user_iotlb_set_dump(struct vhost_iotlb_entry *node) > { > - uint64_t align, start; > + uint64_t start; >=20 > start =3D node->uaddr + node->uoffset; > - align =3D hua_to_alignment(dev->mem, (void *)(uintptr_t)start); > - > - mem_set_dump((void *)(uintptr_t)start, node->size, true, align); > + mem_set_dump((void *)(uintptr_t)start, node->size, true, > RTE_BIT64(node->page_shift)); > } >=20 > static void > -vhost_user_iotlb_clear_dump(struct virtio_net *dev, struct > vhost_iotlb_entry *node, > +vhost_user_iotlb_clear_dump(struct vhost_iotlb_entry *node, > struct vhost_iotlb_entry *prev, struct vhost_iotlb_entry *next) > { > - uint64_t align, start, end; > + uint64_t start, end; >=20 > start =3D node->uaddr + node->uoffset; > end =3D start + node->size; >=20 > - align =3D hua_to_alignment(dev->mem, (void *)(uintptr_t)start); > - > /* Skip first page if shared with previous entry. */ > - if (vhost_user_iotlb_share_page(prev, node, align)) > - start =3D RTE_ALIGN_CEIL(start, align); > + if (vhost_user_iotlb_share_page(prev, node)) > + start =3D RTE_ALIGN_CEIL(start, RTE_BIT64(node->page_shift)); >=20 > /* Skip last page if shared with next entry. */ > - if (vhost_user_iotlb_share_page(node, next, align)) > - end =3D RTE_ALIGN_FLOOR(end, align); > + if (vhost_user_iotlb_share_page(node, next)) > + end =3D RTE_ALIGN_FLOOR(end, RTE_BIT64(node->page_shift)); >=20 > if (end > start) > - mem_set_dump((void *)(uintptr_t)start, end - start, false, > align); > + mem_set_dump((void *)(uintptr_t)start, end - start, false, > + RTE_BIT64(node->page_shift)); > } >=20 > static struct vhost_iotlb_entry * > @@ -198,7 +195,7 @@ vhost_user_iotlb_cache_remove_all(struct virtio_net > *dev) > vhost_user_iotlb_wr_lock_all(dev); >=20 > RTE_TAILQ_FOREACH_SAFE(node, &dev->iotlb_list, next, temp_node) { > - vhost_user_iotlb_set_dump(dev, node); > + vhost_user_iotlb_set_dump(node); >=20 > TAILQ_REMOVE(&dev->iotlb_list, node, next); > vhost_user_iotlb_pool_put(dev, node); > @@ -223,7 +220,7 @@ vhost_user_iotlb_cache_random_evict(struct virtio_net > *dev) > if (!entry_idx) { > struct vhost_iotlb_entry *next_node =3D > RTE_TAILQ_NEXT(node, next); >=20 > - vhost_user_iotlb_clear_dump(dev, node, prev_node, > next_node); > + vhost_user_iotlb_clear_dump(node, prev_node, next_node); >=20 > TAILQ_REMOVE(&dev->iotlb_list, node, next); > vhost_user_iotlb_pool_put(dev, node); > @@ -239,7 +236,7 @@ vhost_user_iotlb_cache_random_evict(struct virtio_net > *dev) >=20 > void > vhost_user_iotlb_cache_insert(struct virtio_net *dev, uint64_t iova, > uint64_t uaddr, > - uint64_t uoffset, uint64_t size, uint8_t perm) > + uint64_t uoffset, uint64_t size, uint64_t > page_size, uint8_t perm) > { > struct vhost_iotlb_entry *node, *new_node; >=20 > @@ -263,6 +260,7 @@ vhost_user_iotlb_cache_insert(struct virtio_net *dev, > uint64_t iova, uint64_t ua > new_node->uaddr =3D uaddr; > new_node->uoffset =3D uoffset; > new_node->size =3D size; > + new_node->page_shift =3D __builtin_ctzll(page_size); > new_node->perm =3D perm; >=20 > vhost_user_iotlb_wr_lock_all(dev); > @@ -276,7 +274,7 @@ vhost_user_iotlb_cache_insert(struct virtio_net *dev, > uint64_t iova, uint64_t ua > vhost_user_iotlb_pool_put(dev, new_node); > goto unlock; > } else if (node->iova > new_node->iova) { > - vhost_user_iotlb_set_dump(dev, new_node); > + vhost_user_iotlb_set_dump(new_node); >=20 > TAILQ_INSERT_BEFORE(node, new_node, next); > dev->iotlb_cache_nr++; > @@ -284,7 +282,7 @@ vhost_user_iotlb_cache_insert(struct virtio_net *dev, > uint64_t iova, uint64_t ua > } > } >=20 > - vhost_user_iotlb_set_dump(dev, new_node); > + vhost_user_iotlb_set_dump(new_node); >=20 > TAILQ_INSERT_TAIL(&dev->iotlb_list, new_node, next); > dev->iotlb_cache_nr++; > @@ -313,7 +311,7 @@ vhost_user_iotlb_cache_remove(struct virtio_net *dev, > uint64_t iova, uint64_t si > if (iova < node->iova + node->size) { > struct vhost_iotlb_entry *next_node =3D > RTE_TAILQ_NEXT(node, next); >=20 > - vhost_user_iotlb_clear_dump(dev, node, prev_node, > next_node); > + vhost_user_iotlb_clear_dump(node, prev_node, next_node); >=20 > TAILQ_REMOVE(&dev->iotlb_list, node, next); > vhost_user_iotlb_pool_put(dev, node); > diff --git a/lib/vhost/iotlb.h b/lib/vhost/iotlb.h > index bee36c5903..81ca04df21 100644 > --- a/lib/vhost/iotlb.h > +++ b/lib/vhost/iotlb.h > @@ -58,7 +58,7 @@ vhost_user_iotlb_wr_unlock_all(struct virtio_net *dev) > } >=20 > void vhost_user_iotlb_cache_insert(struct virtio_net *dev, uint64_t iova= , > uint64_t uaddr, > - uint64_t uoffset, uint64_t size, uint8_t > perm); > + uint64_t uoffset, uint64_t size, uint64_t page_size, uint8_t > perm); > void vhost_user_iotlb_cache_remove(struct virtio_net *dev, uint64_t iova= , > uint64_t size); > uint64_t vhost_user_iotlb_cache_find(struct virtio_net *dev, uint64_t > iova, > uint64_t *size, uint8_t perm); > diff --git a/lib/vhost/vhost.h b/lib/vhost/vhost.h > index 67cc4a2fdb..4ace5ab081 100644 > --- a/lib/vhost/vhost.h > +++ b/lib/vhost/vhost.h > @@ -1016,6 +1016,5 @@ mbuf_is_consumed(struct rte_mbuf *m) > return true; > } >=20 > -uint64_t hua_to_alignment(struct rte_vhost_memory *mem, void *ptr); > void mem_set_dump(void *ptr, size_t size, bool enable, uint64_t > alignment); > #endif /* _VHOST_NET_CDEV_H_ */ > diff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c > index 222ccbf819..11b265c1ba 100644 > --- a/lib/vhost/vhost_user.c > +++ b/lib/vhost/vhost_user.c > @@ -743,7 +743,7 @@ log_addr_to_gpa(struct virtio_net *dev, struct > vhost_virtqueue *vq) > return log_gpa; > } >=20 > -uint64_t > +static uint64_t > hua_to_alignment(struct rte_vhost_memory *mem, void *ptr) > { > struct rte_vhost_mem_region *r; > @@ -2632,7 +2632,7 @@ vhost_user_iotlb_msg(struct virtio_net **pdev, > struct virtio_net *dev =3D *pdev; > struct vhost_iotlb_msg *imsg =3D &ctx->msg.payload.iotlb; > uint16_t i; > - uint64_t vva, len; > + uint64_t vva, len, pg_sz; >=20 > switch (imsg->type) { > case VHOST_IOTLB_UPDATE: > @@ -2641,7 +2641,9 @@ vhost_user_iotlb_msg(struct virtio_net **pdev, > if (!vva) > return RTE_VHOST_MSG_RESULT_ERR; >=20 > - vhost_user_iotlb_cache_insert(dev, imsg->iova, vva, 0, len, > imsg->perm); > + pg_sz =3D hua_to_alignment(dev->mem, (void *)(uintptr_t)vva); > + > + vhost_user_iotlb_cache_insert(dev, imsg->iova, vva, 0, len, > pg_sz, imsg->perm); >=20 > for (i =3D 0; i < dev->nr_vring; i++) { > struct vhost_virtqueue *vq =3D dev->virtqueue[i]; > -- > 2.40.1 Reviewed-by: Chenbo Xia =20