From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f193.google.com (mail-wr0-f193.google.com [209.85.128.193]) by dpdk.org (Postfix) with ESMTP id 3266B1B19 for ; Mon, 30 Apr 2018 16:42:34 +0200 (CEST) Received: by mail-wr0-f193.google.com with SMTP id o2-v6so5375040wrj.13 for ; Mon, 30 Apr 2018 07:42:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=EkGCrDkKiU0JiyNXGIUplHb2AjXnK5YfTMQRBybcOH0=; b=D70BCQeX7Hm4fCxrMGZtSMjDseRof+Ue2ys64LCIMbU4z+Jf/W+rP2EJhXQ/d8k2V3 c+Vhn3wmrGvQxJBr0W057BUgf9SLNeZj7FEnSm/32OZkQwRr4uwwFe7SrZQrekKehAMr A6pOL3m7f9z5PHmlA9Y9FvYovbGt/tl6749Aas35rI69eiw5wmdKbsK6xmY4DScstBF0 tXToBT2b5buQxAAKIfgD1CRsdsH6uut2MROtj2KV5pkLo9PFNTN7ZjGRkHpKBDA7E/iV FdqwvzpSegOOd+CDHNNf4OYwdARPLq5g2Ypnp4Cx/asqQIkXGGegzSV9M1lZZeLoPvbJ TvIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=EkGCrDkKiU0JiyNXGIUplHb2AjXnK5YfTMQRBybcOH0=; b=tkjhbwMEJ0a3o78G7sVKPc1fpQfBnaUJGeEy9UYcGsyiTkWDt4vm0RcK3P4ODv4yJ0 TWJXf6in7Vv7I5ndyfyopQrUUBx8yal99RVvRlV6Ho6kUjWTRbudVjvM1lH1JgMPRgXH xGTrC6kz6nHaBtok/377jwN2S2X1iy4KNw0zsU56KazFMLb2TRw3Kd1oPhLG9bpKynF4 qeuJ/NJ5gNzCMXik7GbFUD90mMcbUSkUu1REp0QOojaH0Yj10UcKqsqX2xFjz/MW1lJr JghZCR+ml93NeKbIWqObKVhea6iqRqkzYuNIVVAKzCzOZzvuWx9BmJCmVhy9HRurC4Cg 1bHA== X-Gm-Message-State: ALQs6tAa9lt8rkEsw6dlisR4tHSIOOLxfXGb2/LUb4HPxdtgZpykOIxX /Q/Xwnf8NjAyjcVYLy0gdBs= X-Google-Smtp-Source: AB8JxZrBcsyuifgXK4UmnqkuGFfMlUH0TULFMKkvmEE+FJFyziDoBQd6OsndXfFe2kyDyXtnJAlYdw== X-Received: by 2002:adf:9ed0:: with SMTP id b16-v6mr5689663wrf.170.1525099353798; Mon, 30 Apr 2018 07:42:33 -0700 (PDT) Received: from localhost ([2a00:23c5:be9a:5200:ce4c:82c0:d567:ecbb]) by smtp.gmail.com with ESMTPSA id y45-v6sm9039896wrd.97.2018.04.30.07.42.32 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 30 Apr 2018 07:42:32 -0700 (PDT) From: luca.boccassi@gmail.com To: Maxime Coquelin Cc: Jianfeng Tan , dpdk stable Date: Mon, 30 Apr 2018 15:40:20 +0100 Message-Id: <20180430144223.18657-5-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20180430144223.18657-1-luca.boccassi@gmail.com> References: <20180430140606.4615-80-luca.boccassi@gmail.com> <20180430144223.18657-1-luca.boccassi@gmail.com> Subject: [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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Apr 2018 14:42:34 -0000 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 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 Reviewed-by: Jianfeng Tan --- 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 -- 2.14.2