From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <maxime.coquelin@redhat.com>
Received: from mx1.redhat.com (mx3-rdu2.redhat.com [66.187.233.73])
 by dpdk.org (Postfix) with ESMTP id A4D4CE5D
 for <stable@dpdk.org>; Mon, 30 Apr 2018 16:44:52 +0200 (CEST)
Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com
 [10.11.54.6])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by mx1.redhat.com (Postfix) with ESMTPS id 1E7E88DC4C;
 Mon, 30 Apr 2018 14:44:52 +0000 (UTC)
Received: from [10.36.112.35] (ovpn-112-35.ams2.redhat.com [10.36.112.35])
 by smtp.corp.redhat.com (Postfix) with ESMTPS id 4EF442166BAD;
 Mon, 30 Apr 2018 14:44:51 +0000 (UTC)
To: luca.boccassi@gmail.com
Cc: Jianfeng Tan <jianfeng.tan@intel.com>, dpdk stable <stable@dpdk.org>
References: <20180430140606.4615-80-luca.boccassi@gmail.com>
 <20180430144223.18657-1-luca.boccassi@gmail.com>
 <20180430144223.18657-5-luca.boccassi@gmail.com>
From: Maxime Coquelin <maxime.coquelin@redhat.com>
Message-ID: <242bac38-06ff-490a-df4a-f5734179ded6@redhat.com>
Date: Mon, 30 Apr 2018 16:44:49 +0200
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101
 Thunderbird/52.7.0
MIME-Version: 1.0
In-Reply-To: <20180430144223.18657-5-luca.boccassi@gmail.com>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16
 (mx1.redhat.com [10.11.55.2]); Mon, 30 Apr 2018 14:44:52 +0000 (UTC)
X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]);
 Mon, 30 Apr 2018 14:44:52 +0000 (UTC) for IP:'10.11.54.6'
 DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com'
 HELO:'smtp.corp.redhat.com' FROM:'maxime.coquelin@redhat.com' RCPT:''
Subject: Re: [dpdk-stable] patch 'vhost: avoid concurrency when logging
 dirty pages' has been queued to stable release 18.02.2
X-BeenThere: stable@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches for DPDK stable branches <stable.dpdk.org>
List-Unsubscribe: <https://dpdk.org/ml/options/stable>,
 <mailto:stable-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/stable/>
List-Post: <mailto:stable@dpdk.org>
List-Help: <mailto:stable-request@dpdk.org?subject=help>
List-Subscribe: <https://dpdk.org/ml/listinfo/stable>,
 <mailto:stable-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Mon, 30 Apr 2018 14:44:53 -0000

Hi Luca,

Please don't backport this patch to -stable releases.
It has already been reverted in upstream master, and a new patch is to
be posted in the coming hours.

I already notified Yuanhan for the same for v17.11 LTS.

Thanks,
Maxime

On 04/30/2018 04:40 PM, luca.boccassi@gmail.com wrote:
> Hi,
> 
> FYI, your patch has been queued to stable release 18.02.2
> 
> Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
> It will be pushed if I get no objections before 05/02/18. So please
> shout if anyone has objections.
> 
> Thanks.
> 
> Luca Boccassi
> 
> ---
>  From a5d642c446cc3a3be41694715d99f3e9f9ea44df Mon Sep 17 00:00:00 2001
> From: Maxime Coquelin <maxime.coquelin@redhat.com>
> Date: Wed, 21 Mar 2018 16:44:13 +0100
> Subject: [PATCH] vhost: avoid concurrency when logging dirty pages
> 
> [ upstream commit 394313fff39d0f994325c47f7eab39daf5dc9e11 ]
> 
> This patch aims at fixing a migration performance regression
> faced since atomic operation is used to log pages as dirty when
> doing live migration.
> 
> 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.
> 
> 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.
> 
> Fixes: 897f13a1f726 ("vhost: make page logging atomic")
> 
> Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> Reviewed-by: Jianfeng Tan <jianfeng.tan@intel.com>
> ---
>   lib/librte_vhost/vhost.h | 12 ++++--------
>   1 file changed, 4 insertions(+), 8 deletions(-)
> 
> diff --git a/lib/librte_vhost/vhost.h b/lib/librte_vhost/vhost.h
> index bab0b456e..a4f23f714 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
>   
>   /*
> - * 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] = 0xff;
>   }
>   
>   static __rte_always_inline void
>