From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 15E317CFA; Tue, 27 Mar 2018 03:15:46 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Mar 2018 18:15:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,366,1517904000"; d="scan'208";a="211541302" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by orsmga005.jf.intel.com with ESMTP; 26 Mar 2018 18:15:45 -0700 Received: from fmsmsx154.amr.corp.intel.com (10.18.116.70) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 26 Mar 2018 18:15:44 -0700 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by FMSMSX154.amr.corp.intel.com (10.18.116.70) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 26 Mar 2018 18:15:44 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.235]) by shsmsx102.ccr.corp.intel.com ([169.254.2.80]) with mapi id 14.03.0319.002; Tue, 27 Mar 2018 09:15:42 +0800 From: "Tan, Jianfeng" To: Maxime Coquelin , "dev@dpdk.org" , "Bie, Tiwei" , "jfreimann@redhat.com" CC: "stable@dpdk.org" Thread-Topic: [PATCH] vhost: avoid concurrency when logging dirty pages Thread-Index: AQHTwSuG2XjQwwX5YkGvn3aDMPuVbqPjTbkA Date: Tue, 27 Mar 2018 01:15:41 +0000 Message-ID: References: <20180321154413.1120-1-maxime.coquelin@redhat.com> In-Reply-To: <20180321154413.1120-1-maxime.coquelin@redhat.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] vhost: avoid concurrency when logging dirty pages X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Mar 2018 01:15:47 -0000 > -----Original Message----- > From: Maxime Coquelin [mailto:maxime.coquelin@redhat.com] > Sent: Wednesday, March 21, 2018 11:44 PM > To: dev@dpdk.org; Tan, Jianfeng; Bie, Tiwei; jfreimann@redhat.com > Cc: stable@dpdk.org; Maxime Coquelin > Subject: [PATCH] vhost: avoid concurrency when logging dirty pages >=20 > This patch aims at fixing a migration performance regression > faced since atomic operation is used to log pages as dirty when > doing live migration. >=20 > Instead of setting a single bit by doing an atomic read-modify-write > operation to log a page as dirty, this patch write 0xFF to the > corresponding byte, and so logs 8 page as dirty. >=20 > The advantage is that it avoids concurrent atomic operations by > multiple PMD threads, the drawback is that some clean pages are > marked as dirty and so are transferred twice. >=20 > Fixes: 897f13a1f726 ("vhost: make page logging atomic") > Cc: stable@dpdk.org >=20 > Signed-off-by: Maxime Coquelin As you mentioned, the concern is if it affects the rate of convergence. Hop= e we could have some tests on that. Reviewed-by: Jianfeng Tan Thanks! > --- > lib/librte_vhost/vhost.h | 12 ++++-------- > 1 file changed, 4 insertions(+), 8 deletions(-) >=20 > diff --git a/lib/librte_vhost/vhost.h b/lib/librte_vhost/vhost.h > index d947bc9e3..aa2606f8a 100644 > --- a/lib/librte_vhost/vhost.h > +++ b/lib/librte_vhost/vhost.h > @@ -247,18 +247,14 @@ struct virtio_net { > #define VHOST_LOG_PAGE 4096 >=20 > /* > - * Atomically set a bit in memory. > + * Mark all pages belonging to the same dirty log bitmap byte > + * as dirty. The goal is to avoid concurrency between different > + * threads doing atomic read-modify-writes on the same byte. > */ > -static __rte_always_inline void > -vhost_set_bit(unsigned int nr, volatile uint8_t *addr) > -{ > - __sync_fetch_and_or_8(addr, (1U << nr)); > -} > - > static __rte_always_inline void > vhost_log_page(uint8_t *log_base, uint64_t page) > { > - vhost_set_bit(page % 8, &log_base[page / 8]); > + log_base[page / 8] =3D 0xff; > } >=20 > static __rte_always_inline void > -- > 2.14.3