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 3CC46A0540; Thu, 7 Jul 2022 10:23:46 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E1B6E40A7B; Thu, 7 Jul 2022 10:23:45 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mails.dpdk.org (Postfix) with ESMTP id 2DE3A406B4 for ; Thu, 7 Jul 2022 10:23:45 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1657182225; x=1688718225; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=nFTNZLrMeuY4NOKiNwh6GoS5wdNrrI3XUHfzN2bIWR0=; b=PehwkeytpvR21VZbkjqbAZOeiMruJdkCdFral9rY4nZKPHBuPSGVrrwv XIpYz/u0SACfmJwxx498hBiv4PA0zad14uJYq4NERe0oOPb9o5gbg+/yY nOqIrjIFUHFM6a+gSD9Faj3fT+o9RfRqhQSuj4dDG1w758M/pK8JSsg0g UzAFxcwpCSZrBegtKFk5+vwiRpljI3j4FORzq/4g50r6cixaTDyVunCD2 8fFSEmTYwOMfQSqAjYuaAAXlmRyTGqrN8jie8NV2TZsnVdszW4Puab8e6 Tjy/Uw8xOXsnYQbC8q9WZZonfhHTDelynO3zqPlr+tpplWHI8/K9RSHcG w==; X-IronPort-AV: E=McAfee;i="6400,9594,10400"; a="284706957" X-IronPort-AV: E=Sophos;i="5.92,252,1650956400"; d="scan'208";a="284706957" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Jul 2022 01:23:44 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.92,252,1650956400"; d="scan'208";a="683233127" Received: from fmsmsx605.amr.corp.intel.com ([10.18.126.85]) by FMSMGA003.fm.intel.com with ESMTP; 07 Jul 2022 01:23:43 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx605.amr.corp.intel.com (10.18.126.85) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Thu, 7 Jul 2022 01:23:43 -0700 Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) 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.2308.27; Thu, 7 Jul 2022 01:23:36 -0700 Received: from fmsmsx612.amr.corp.intel.com ([10.18.126.92]) by fmsmsx612.amr.corp.intel.com ([10.18.126.92]) with mapi id 15.01.2308.027; Thu, 7 Jul 2022 01:23:36 -0700 From: "Hu, Jiayu" To: "Ding, Xuan" , "maxime.coquelin@redhat.com" , "Xia, Chenbo" CC: "dev@dpdk.org" , "He, Xingguang" , "Yang, YvonneX" , "Jiang, Cheng1" Subject: RE: [PATCH] vhost: fix unnecessary dirty page logging Thread-Topic: [PATCH] vhost: fix unnecessary dirty page logging Thread-Index: AQHYkc6/DTCC9PifWEKjoDTaNkC3kq1ykenw Date: Thu, 7 Jul 2022 08:23:36 +0000 Message-ID: References: <20220707065513.66458-1-xuan.ding@intel.com> In-Reply-To: <20220707065513.66458-1-xuan.ding@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.108.32.68] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 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: Ding, Xuan > Sent: Thursday, July 7, 2022 2:55 PM > To: maxime.coquelin@redhat.com; Xia, Chenbo > Cc: dev@dpdk.org; Hu, Jiayu ; He, Xingguang > ; Yang, YvonneX ; > Jiang, Cheng1 ; Ding, Xuan > Subject: [PATCH] vhost: fix unnecessary dirty page logging >=20 > From: Xuan Ding >=20 > The dirty page logging is only required in vhost enqueue direction for li= ve > migration. This patch removes the unnecessary dirty page logging in vhost > dequeue direction. Otherwise, it will result in a performance drop. Some = if- > else judgements are also optimized to improve performance. >=20 > Fixes: 6d823bb302c7 ("vhost: prepare sync for descriptor to mbuf > refactoring") > Fixes: b6eee3e83402 ("vhost: fix sync dequeue offload") >=20 > Signed-off-by: Xuan Ding > --- > lib/vhost/virtio_net.c | 31 +++++++++++++------------------ > 1 file changed, 13 insertions(+), 18 deletions(-) >=20 > diff --git a/lib/vhost/virtio_net.c b/lib/vhost/virtio_net.c index > e842c35fef..12b7fbe7f9 100644 > --- a/lib/vhost/virtio_net.c > +++ b/lib/vhost/virtio_net.c > @@ -1113,27 +1113,27 @@ sync_fill_seg(struct virtio_net *dev, struct > vhost_virtqueue *vq, > rte_memcpy((void *)((uintptr_t)(buf_addr)), > rte_pktmbuf_mtod_offset(m, void *, > mbuf_offset), > cpy_len); > + vhost_log_cache_write_iova(dev, vq, buf_iova, > cpy_len); > + PRINT_PACKET(dev, (uintptr_t)(buf_addr), cpy_len, > 0); > } else { > rte_memcpy(rte_pktmbuf_mtod_offset(m, void *, > mbuf_offset), > (void *)((uintptr_t)(buf_addr)), > cpy_len); > } > - vhost_log_cache_write_iova(dev, vq, buf_iova, cpy_len); > - PRINT_PACKET(dev, (uintptr_t)(buf_addr), cpy_len, 0); > } else { > if (to_desc) { > batch_copy[vq->batch_copy_nb_elems].dst =3D > (void *)((uintptr_t)(buf_addr)); > batch_copy[vq->batch_copy_nb_elems].src =3D > rte_pktmbuf_mtod_offset(m, void *, > mbuf_offset); > + batch_copy[vq->batch_copy_nb_elems].log_addr =3D > buf_iova; > + batch_copy[vq->batch_copy_nb_elems].len =3D > cpy_len; > } else { > batch_copy[vq->batch_copy_nb_elems].dst =3D > rte_pktmbuf_mtod_offset(m, void *, > mbuf_offset); > batch_copy[vq->batch_copy_nb_elems].src =3D > (void *)((uintptr_t)(buf_addr)); > } > - batch_copy[vq->batch_copy_nb_elems].log_addr =3D > buf_iova; > - batch_copy[vq->batch_copy_nb_elems].len =3D cpy_len; > vq->batch_copy_nb_elems++; > } > } > @@ -2739,18 +2739,14 @@ desc_to_mbuf(struct virtio_net *dev, struct > vhost_virtqueue *vq, > if (async_fill_seg(dev, vq, cur, mbuf_offset, > buf_iova + buf_offset, cpy_len, > false) < 0) > goto error; > + } else if (likely(hdr && cur =3D=3D m)) { > + rte_memcpy(rte_pktmbuf_mtod_offset(cur, void *, > mbuf_offset), > + (void *)((uintptr_t)(buf_addr + buf_offset)), > + cpy_len); > } else { > - if (hdr && cur =3D=3D m) { > - rte_memcpy(rte_pktmbuf_mtod_offset(cur, > void *, mbuf_offset), > - (void *)((uintptr_t)(buf_addr + > buf_offset)), > - cpy_len); > - vhost_log_cache_write_iova(dev, vq, > buf_iova + buf_offset, cpy_len); > - PRINT_PACKET(dev, (uintptr_t)(buf_addr + > buf_offset), cpy_len, 0); > - } else { > - sync_fill_seg(dev, vq, cur, mbuf_offset, > - buf_addr + buf_offset, > - buf_iova + buf_offset, cpy_len, false); > - } > + sync_fill_seg(dev, vq, cur, mbuf_offset, > + buf_addr + buf_offset, > + buf_iova + buf_offset, cpy_len, false); > } >=20 > mbuf_avail -=3D cpy_len; > @@ -2804,9 +2800,8 @@ desc_to_mbuf(struct virtio_net *dev, struct > vhost_virtqueue *vq, > async_iter_finalize(async); > if (hdr) > pkts_info[slot_idx].nethdr =3D *hdr; > - } else { > - if (hdr) > - vhost_dequeue_offload(dev, hdr, m, > legacy_ol_flags); > + } else if (hdr) { > + vhost_dequeue_offload(dev, hdr, m, legacy_ol_flags); > } >=20 > return 0; > -- > 2.17.1 Reviewed-by: Jiayu Hu Thanks, Jiayu