From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id 2E5C65B20; Thu, 17 May 2018 06:49:49 +0200 (CEST) X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 May 2018 21:49:48 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,409,1520924400"; d="scan'208";a="40580632" Received: from debian.sh.intel.com (HELO debian) ([10.67.104.203]) by fmsmga008.fm.intel.com with ESMTP; 16 May 2018 21:49:47 -0700 Date: Thu, 17 May 2018 12:50:14 +0800 From: Tiwei Bie To: "Michael S. Tsirkin" Cc: Maxime Coquelin , dev@dpdk.org, stable@dpdk.org Message-ID: <20180517045014.GA22736@debian> References: <20180516165423.5430-1-maxime.coquelin@redhat.com> <20180517060353-mutt-send-email-mst@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20180517060353-mutt-send-email-mst@kernel.org> User-Agent: Mutt/1.9.5 (2018-04-13) Subject: Re: [dpdk-stable] [PATCH v3] vhost: improve dirty pages logging performance X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 May 2018 04:49:50 -0000 On Thu, May 17, 2018 at 06:06:34AM +0300, Michael S. Tsirkin wrote: > On Wed, May 16, 2018 at 06:54:23PM +0200, Maxime Coquelin wrote: > > This patch caches all dirty pages logging until the used ring index > > is updated. > > > > The goal of this optimization is to fix a performance regression > > introduced when the vhost library started to use atomic operations > > to set bits in the shared dirty log map. While the fix was valid > > as previous implementation wasn't safe against concurent accesses, > > contention was induced. > > > > With this patch, during migration, we have: > > 1. Less atomic operations as only a single atomic OR operation > > per 32 or 64 (depending on CPU) pages. > > 2. Less atomic operations as during a burst, the same page will > > be marked dirty only once. > > 3. Less write memory barriers. > > > > Fixes: 897f13a1f726 ("vhost: make page logging atomic") > > > > Cc: stable@dpdk.org > > > > Cc: Tiwei Bie > > Suggested-by: Michael S. Tsirkin > > Signed-off-by: Maxime Coquelin > > > Deferring updates until GET_BASE would also be possible, > but would increase the chance that a disconnect causes > ring to become inconsistent. Yeah. The sync of the updates from vhost backend will be deferred a lot. Another issue is that, it probably will increase the downtime, as there will be more pages to sync after the old device is stopped and before the new device is started. > > I'm not sure whether there is a chance of that with this > patch (in case of a crash after used idx updated but > before dirty log update of the used idx), but > at least it's not bigger than before this patch. The used idx update and the corresponding logging are two operations instead of one atomic operation. So theoretically, it should be possible. I got your point now. Maybe we should add a barrier between cache sync and the used idx update to ensure that all dirty pages are logged before they can be seen by the guest. Best regards, Tiwei Bie