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 D420F429E7; Tue, 25 Apr 2023 08:20:19 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BFB8540ED4; Tue, 25 Apr 2023 08:20:19 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mails.dpdk.org (Postfix) with ESMTP id 4111740EDE for ; Tue, 25 Apr 2023 08:20:17 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1682403617; x=1713939617; h=from:to:subject:date:message-id:references:in-reply-to: content-transfer-encoding:mime-version; bh=6MLTPZrkTLn+D64P7xC4W/xV5tgvGvUE/+t2mlOyi3M=; b=fcF2IcRgl8B7dwUMUbU4wwBQzqvXDSaguCe5Zx8vYnbCem3FbFyVJ2G2 k2UiEXVzaP8ml7fu/Vpkep5ll8IO/e/eUck2y57ou++Ydu5eJM0bIFy31 WSm+7DgKDzirgrxjBtIJhJrHvNti+tCL60e9ogkJ/zYMOwemftDG1H3we RLpxyZUSg3y7ittAOr1Jm/zsRiLDgC2U7tqPHyfsQmDWDUhJYxRIDfqBj R7dq67Fgc4nLappF4TrVF6VbVD6rC4SMFo7WrM/+1ydr69Mp3LJiJi9rI bgpbXuLkq0z2/JWKtWXbQKlOJQ+3EsJwfx2FPmpEBmSErRnHvVyGZGWPt Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10690"; a="330883851" X-IronPort-AV: E=Sophos;i="5.99,224,1677571200"; d="scan'208";a="330883851" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Apr 2023 23:20:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10690"; a="696049734" X-IronPort-AV: E=Sophos;i="5.99,224,1677571200"; d="scan'208";a="696049734" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by fmsmga007.fm.intel.com with ESMTP; 24 Apr 2023 23:20:13 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Mon, 24 Apr 2023 23:20:06 -0700 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23 via Frontend Transport; Mon, 24 Apr 2023 23:20:06 -0700 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (104.47.70.103) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.23; Mon, 24 Apr 2023 23:20:06 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PUbkyjWiJNVR8gXT+y2XrIa7Ar/qyugnkYg6W47uNIwOibbwypLRhJPY/FAntGQ1fQBzX9BQd1sgH5NfecM8rQ+/ynheD8i+Qafvaxluyckx0Qkjri2c0WTxtQKCo2vnICOCxSKDLwAyrjl+0XRoFYDxdeJcAUC/QgZBpjyoW6jTMsCTJ5Q9vA0PQz6eD7otkklCzee9QC8YSV73loPFijiSpJU8rXcmcfzN0PwdL8OAakHbGoG3xpJhbn5eKepzL5EBjCQPMm6zvQHeg1i8N5ucDPl+waq2tJWdqQT6Eyazi6D28xGo/RPsx9tYfV9VvFI1bkWnVPZB8e5WTfWHrw== 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=5EZ+U0lq646/ANB9wHrdUxMdz+11HBO65ypoAA63YkU=; b=naKjzs3ocC0xBd4QW/F3QAkwcHpN0v0aiNedveAHfL8J8/Nq1M+ipE1UIf77ic5k8318JiVS2r7FZgyhSI8eklZ0zeR6vhSutohvjEQ1hqV1fz0j8AOh5KwXoVgof44CFsi0CY1wiycrT9wsYFTsPk68k5UkMrCfUe95BfcoAol+y25R7YjlTeq5Trr0Mnpd5NRGlH58XffsyIsgFF9h2vEzBQ0YfKiyoXi9LFnuBoYP5KH6Yw51xBF5+lNgrhQP5FAANM0bTvU5EeqcZBkShxkL9lB6kyJaVdqYFpUqpDzdqlDqxixAqiFch/D9WOrfUu1YnE+AKGtPh8UvGgkvpA== 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 SN7PR11MB7439.namprd11.prod.outlook.com (2603:10b6:806:343::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.22; Tue, 25 Apr 2023 06:20:04 +0000 Received: from SN6PR11MB3504.namprd11.prod.outlook.com ([fe80::2d7a:a878:7bed:bb11]) by SN6PR11MB3504.namprd11.prod.outlook.com ([fe80::2d7a:a878:7bed:bb11%4]) with mapi id 15.20.6319.033; Tue, 25 Apr 2023 06:20:04 +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" Subject: RE: [RFC 09/27] vhost: add page size info to IOTLB entry Thread-Topic: [RFC 09/27] vhost: add page size info to IOTLB entry Thread-Index: AQHZY+eWtwLK7ruj2UWvlYN9BejIha87s3Yw Date: Tue, 25 Apr 2023 06:20:04 +0000 Message-ID: References: <20230331154259.1447831-1-maxime.coquelin@redhat.com> <20230331154259.1447831-10-maxime.coquelin@redhat.com> In-Reply-To: <20230331154259.1447831-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_|SN7PR11MB7439:EE_ x-ms-office365-filtering-correlation-id: 669e06d6-8424-446f-0dde-08db45551bce 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: 6ZlIwNDjvEucqMZtqo/X+x5l5bfK0fQqoy3MYyEdu2A1pNQh5+hUf9LRhgSqzEU+EuJfFS/hBE/cTy/5HjWHR//INhADybufT/i/ZLoL/BeAYPYwtiGb8zDHKlRjMkDqCK41utNipOcHtLarFNjxPtDX2tgA93tt2hAfnJK3oZF32YVrC9g2oVl6GMv338o2eDMKhW0Eg6si/2Gy5POeJVAs8POPNTbs0MTT4TrWt7uS3IaaX/T8UOXKxyIH/9wSJuZ5lbg9W/k1gatZn4ZZmse7e0UiFQlVBVJRFYxlKY+V7Vc/5uSrfwC//V3W6UxTU9lXHCnIRIoSP8stDqTR88VQdfDH681yotXy7TGQ0BaDcpJn/kAGjlY9S0uMzzlaADANn8+BOIPA8C9No/f5esO9OJl62wx7ygJqQSpuTJ4xsFGYFqLprYcBqVRqpFhn/49uzAtphiSm8GtsxihU2qqKke5XFrmgwOPGE0UlAhgz8SvKLxxSTBXNMttBWbM1Qyv6CZS5Ddc6/mpTCcukoqBrMKe8Anf5Oqat2CfSoCKL+J1fairbf8YfCAc6WEvEJqtO4XiSlWhodQ25rhWglhQLSJLk4ogrvb31ukdVX58En6SmxDmW6hdPkMITPX393RrXMZ0y8PJ4ILWh1TTuzA== 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)(136003)(366004)(376002)(396003)(39860400002)(346002)(451199021)(82960400001)(316002)(64756008)(66446008)(38100700002)(41300700001)(122000001)(5660300002)(7416002)(52536014)(921005)(8936002)(8676002)(33656002)(86362001)(38070700005)(2906002)(66476007)(55016003)(66556008)(7696005)(71200400001)(53546011)(6506007)(26005)(9686003)(478600001)(83380400001)(186003)(76116006)(110136005)(66946007); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?Z3hdJGWptHOakgAQIDGhlONulZJv2r9FTNaM8xOd00S+k05t5bSIkpt+mXJ5?= =?us-ascii?Q?cLbELuG7cOfloMTI4XugB2Tuewfo9CIWpJnugxZgoFM3PZy96HhfcbPaQ6S6?= =?us-ascii?Q?s3N85Wd5dFv7j6riUNXbOBZtVrVqBTT/VrH5goxEFQ1rKZm67pMP2dL8RZeO?= =?us-ascii?Q?N/rjGPA7pa1ki0WxaBXlR8fnErLAfQws036teTBA1dRHYx+gH5yf9LA2A4dA?= =?us-ascii?Q?JHIbF/NCl3mIEIo6Z6mKZRJ4SkSCslITs5NOr32Cflts7Wf007qEc7KbUDnT?= =?us-ascii?Q?nS+qKCeTGMrDncnOH1I9gvzclFXkPzXofwb0QoZL7Na4GVNkaui82arrRYgg?= =?us-ascii?Q?FJs8ppcLLKOZ5KNuFB+V7GB9UNsNcQ4QGVnM45+0ORwcbZuGPa6Fuzf9NQgu?= =?us-ascii?Q?xGd7WhuCeDN8WLJZYz/pi7vulaU7LIC8jbHTKOUTGaMIN0bRIo8A6U89+JtK?= =?us-ascii?Q?mhsdVZtPLTyNjSDx6N9eh1buSJ1luTQ5IGeG/YX5rbQJmyuAoD5GCtr8OZ7L?= =?us-ascii?Q?XTJbhuKYhuqPM8QpygHPZ69BTWK9EHL/p45oF/mAJKq2ON7nKpLPhzanMq/X?= =?us-ascii?Q?goJiaSNsD9UcKbHsKTf5vimbelqpZVn/NnhlHIdK/IWMIlFJfY9tsNzhF6xE?= =?us-ascii?Q?9FQdXSxZXnFWA0KPsyBNHzOffcdM3Iu+CSs8TaFAXZv3O4CqXnHvzDyYkq/L?= =?us-ascii?Q?fFotxal0fcr0LtVaSc+v/M16yO0ClyBLefwhaOWE0eIt3VIbulNO/aI6LAfx?= =?us-ascii?Q?3uh7KjdHzlYSuFAQyaen8gzUSDqaKaV9DcI1LFbqgykddgqF2SnfzEXiBqnZ?= =?us-ascii?Q?BTKxM34a7y4yNNGjuuFLfcCjgDZKwf7nAIPIm/jBwBsrc1Kcoh+ti33Zt4CY?= =?us-ascii?Q?Tl5WEHgn47O6GLD9dbuxdFHzZK15agmNb6uaMQ2FF71bzYZ3pWCfRfh4Ppfn?= =?us-ascii?Q?+kGU2WN8XF1AAigM9YukE1iDT2M05XMXY8WuEguUY9qywP3FXJy1dbnj9BWC?= =?us-ascii?Q?DjrzsZ0AMXI21m42TED40+MEQkjHikKece0ScUi70//yqWbOdZqGnnEOVWWe?= =?us-ascii?Q?zJUT7KFyMjNa4sV0a0xroUmWUEAk0EiavupqAt6HKPVosjtcIt7PW10LR9Hs?= =?us-ascii?Q?6IgxjLhFvQmIWVz4nn7A/OvjWEAfYmHT8aqmiNtTKXPHf6QqaDSX+yqRR+Vs?= =?us-ascii?Q?q5a2BMmvQ94qgD2y3x06XFtby/oU4jI1aAULF6I78npHihuHoOb19vPp4Csy?= =?us-ascii?Q?y0hrYvmpkgpwfrCJ7lVQxFvCOGFcCg8sDM96XUjnxZPJU8ifZxBElmJBP55z?= =?us-ascii?Q?eKyMKaF4ZRrfT4NMOeIPI2DdBp4mImcga4y8K/ps9UyuA+Gxbu7QeZ/GfvNT?= =?us-ascii?Q?q83p+VdrZMnkqCA+c/kx+1Puw3s7IDMrsPZqYl0OqGSIKjp6vbYbON5cU6vl?= =?us-ascii?Q?d2h1P6Oe93N+A9tCIQBx3BVkF75mTxK3vpt3l6CZvJe1TJfz9Gw/DPdwK7Kn?= =?us-ascii?Q?iirJLwAPj9FMHuNYXBx+XAGGfRA46hJRdINcccN64ttcQD8PfnKZHIEXEyT3?= =?us-ascii?Q?+UTo2FZUKk6sFXIrMhb2S0xzkAKl9EN8U//12xvI?= 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: 669e06d6-8424-446f-0dde-08db45551bce X-MS-Exchange-CrossTenant-originalarrivaltime: 25 Apr 2023 06:20:04.3906 (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: 16pI7gWjsEMF9bRrY57a3kRS428TArsJ1hn06gBx5oTKbklW4QpR44IrCbcuQUwoJzOppxqHJiWzUkuTv2yiaQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR11MB7439 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 Hi Maxime, > -----Original Message----- > From: Maxime Coquelin > Sent: Friday, March 31, 2023 11:43 PM > To: dev@dpdk.org; david.marchand@redhat.com; Xia, Chenbo > ; mkp@redhat.com; fbl@redhat.com; > jasowang@redhat.com; Liang, Cunming ; Xie, Yongj= i > ; echaudro@redhat.com; eperezma@redhat.com; > amorenoz@redhat.com > Cc: Maxime Coquelin > Subject: [RFC 09/27] 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 51f118bc48..188dfb8e38 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, false, align); > + mem_set_dump((void *)(uintptr_t)start, node->size, false, > 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_ctz(page_size); __builtin_ctzll ? Thanks, Chenbo > 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 93673d3902..a989f2c46d 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.39.2