From patchwork Mon May 20 17:23:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Parri X-Patchwork-Id: 10951985 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CA0106C5 for ; Mon, 20 May 2019 17:24:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AA827288DC for ; Mon, 20 May 2019 17:24:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9E29C288E1; Mon, 20 May 2019 17:24:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3CDBC288DC for ; Mon, 20 May 2019 17:24:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392888AbfETRYm (ORCPT ); Mon, 20 May 2019 13:24:42 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:55319 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2392876AbfETRYm (ORCPT ); Mon, 20 May 2019 13:24:42 -0400 Received: by mail-wm1-f65.google.com with SMTP id x64so157568wmb.5 for ; Mon, 20 May 2019 10:24:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=8JCGP2keOd1v4ZtvnJIPJLCc79LDgGj6QPJ6XqW4/pQ=; b=i+tc6wIoCAm8Fs2rzTAE6lyMnY10bwE3S7lTIkqJZ4wLp9lZCEZJRBRsM8BrFytdhh LhMP4NBM+t13gVQ+nr5MAL77FdB/RHw847SxYmWgnsV5G8YzL+7g9ryybdRAXx6qXTBL Zx0oYhcnH36ZwuiC+JJg0EMqU8kNiHG7ukSDk= 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=8JCGP2keOd1v4ZtvnJIPJLCc79LDgGj6QPJ6XqW4/pQ=; b=AT0I55tZbqwBOy2HdYB8JTyI9lt22OD8fOmFMZnX9T52/72kmqIM7Dbgub8sJ4j1Tl Tl63IO/eo+JklPMexkmUIM5L88dL1qTY+yDL7j0ycb7V+PiQb8LkU6OQttN0gysD9iTE +KPETc8DULEIKlVdSjl5FpGcimljGh8j/GPm/N+2K/42lTT9qnJUnf893dcgFLhx+Y08 XiFdx7PFCRXYHHZCZyMQqRSgEaqhvxqVtP1o94XdvMqUNZMys4F4cyqTjZF7wHR12sEY 0DG1xpu+qPQtsGnoKDV76Kc7j7VOopuoIlKWn4yTcKaNVV/P7pGmovJXUuNvfPvS7ayv 7+UQ== X-Gm-Message-State: APjAAAXGyn1ME12N472JVhO1uxm3bVJ8cazho9ETJFlHSqbyxabblwAo IFqqdkg02ZEaahNW36eoVPLksg== X-Google-Smtp-Source: APXvYqxgeV4LGEt7Jk6ZUdmwfJ/W+F8V+ZdFAtR5wPJjhjlfgOX2onUnuiC23YystDlcOv8EoDDY4Q== X-Received: by 2002:a1c:f50a:: with SMTP id t10mr185633wmh.86.1558373080090; Mon, 20 May 2019 10:24:40 -0700 (PDT) Received: from localhost.localdomain ([91.253.179.221]) by smtp.gmail.com with ESMTPSA id b12sm180021wmg.27.2019.05.20.10.24.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 20 May 2019 10:24:39 -0700 (PDT) From: Andrea Parri To: linux-kernel@vger.kernel.org Cc: Andrea Parri , stable@vger.kernel.org, Jens Axboe , Ming Lei , linux-block@vger.kernel.org, "Paul E. McKenney" , Peter Zijlstra Subject: [PATCH 2/4] bio: fix improper use of smp_mb__before_atomic() Date: Mon, 20 May 2019 19:23:56 +0200 Message-Id: <1558373038-5611-3-git-send-email-andrea.parri@amarulasolutions.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1558373038-5611-1-git-send-email-andrea.parri@amarulasolutions.com> References: <1558373038-5611-1-git-send-email-andrea.parri@amarulasolutions.com> Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This barrier only applies to the read-modify-write operations; in particular, it does not apply to the atomic_set() primitive. Replace the barrier with an smp_mb(). Fixes: dac56212e8127 ("bio: skip atomic inc/dec of ->bi_cnt for most use cases") Cc: stable@vger.kernel.org Reported-by: "Paul E. McKenney" Reported-by: Peter Zijlstra Signed-off-by: Andrea Parri Reviewed-by: Ming Lei Cc: Jens Axboe Cc: Ming Lei Cc: linux-block@vger.kernel.org Cc: "Paul E. McKenney" Cc: Peter Zijlstra --- include/linux/bio.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/bio.h b/include/linux/bio.h index ea73df36529ad..0f23b56826403 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h @@ -210,7 +210,7 @@ static inline void bio_cnt_set(struct bio *bio, unsigned int count) { if (count != 1) { bio->bi_flags |= (1 << BIO_REFFED); - smp_mb__before_atomic(); + smp_mb(); } atomic_set(&bio->__bi_cnt, count); } From patchwork Mon May 20 17:23:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Parri X-Patchwork-Id: 10951987 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 40035933 for ; Mon, 20 May 2019 17:24:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 21373288DC for ; Mon, 20 May 2019 17:24:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 14E69288E1; Mon, 20 May 2019 17:24:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B06BF288DC for ; Mon, 20 May 2019 17:24:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390690AbfETRYo (ORCPT ); Mon, 20 May 2019 13:24:44 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:40962 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2392899AbfETRYo (ORCPT ); Mon, 20 May 2019 13:24:44 -0400 Received: by mail-wr1-f67.google.com with SMTP id g12so15235216wro.8 for ; Mon, 20 May 2019 10:24:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=9f53yOiq05lWNzaZ4psZ5nNqcD+KW9Z7mWrkNOPWql4=; b=efPBd60SOweuaEtrPmrvEAgFFXxgKxmKmyy9bpp8zJvI5p/4b8l1Mn6o8ECeNMr/8o TR/T60XAGyrFAEC62ziZN83mYFMvD8us0wEeBN1UQDPpg+6HiATagjokE0O0ckPxuq8a u81B8sI9GEMzVMYxkYjOB3RafSNgh5bJD8f2s= 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=9f53yOiq05lWNzaZ4psZ5nNqcD+KW9Z7mWrkNOPWql4=; b=sCVt3K2Ia/UGlb4Bvd43MUDMMhZmCNlt2ksTTGvlMIg4CoVhBNdSePWITuergp4eYc waivDF2V95H9Mfh4xOgGd/Ij+tGT0zhcsnuhSYyPgS736Qn9KZ3bx5bqQiATUCdAjqKO Lgl/cqip/YbutEOu1JPL1bC+zTI/Lz5xuligzArxyV1/Tv45FHjSP9RCEA/cUSvlJatN H5AiVTiUhrU3vPGpJ2wxh3wlI9uDicgpDFETUv53EE7iSgGrID27xq6QSOeIziztPCtS dc2+XhjlnF6G/l/UbnWwB9i0FXLd9SXHt3gc4OGXY919zNkZPySmFR8Op3W+8wi9S/fk 7x1w== X-Gm-Message-State: APjAAAXxxNdOW/rX7cBGXbPloHaEF9fdfj+sCz/UHlpgokOcaOmqTF06 ha+37tDwwlNiaHFWUM4Txm7OCZ0Mljs+/A== X-Google-Smtp-Source: APXvYqyx/q1u3qdOUfvt8mMH75in5zSdwv3nB5g27nP/2IT3WgDE13X8vLgZnhmLOLrTkenOvjl+Zw== X-Received: by 2002:adf:efc3:: with SMTP id i3mr30248014wrp.45.1558373083131; Mon, 20 May 2019 10:24:43 -0700 (PDT) Received: from localhost.localdomain ([91.253.179.221]) by smtp.gmail.com with ESMTPSA id b12sm180021wmg.27.2019.05.20.10.24.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 20 May 2019 10:24:42 -0700 (PDT) From: Andrea Parri To: linux-kernel@vger.kernel.org Cc: Andrea Parri , stable@vger.kernel.org, Jens Axboe , Omar Sandoval , Ming Lei , linux-block@vger.kernel.org, "Paul E. McKenney" , Peter Zijlstra Subject: [PATCH 3/4] sbitmap: fix improper use of smp_mb__before_atomic() Date: Mon, 20 May 2019 19:23:57 +0200 Message-Id: <1558373038-5611-4-git-send-email-andrea.parri@amarulasolutions.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1558373038-5611-1-git-send-email-andrea.parri@amarulasolutions.com> References: <1558373038-5611-1-git-send-email-andrea.parri@amarulasolutions.com> Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This barrier only applies to the read-modify-write operations; in particular, it does not apply to the atomic_set() primitive. Replace the barrier with an smp_mb(). Fixes: 6c0ca7ae292ad ("sbitmap: fix wakeup hang after sbq resize") Cc: stable@vger.kernel.org Reported-by: "Paul E. McKenney" Reported-by: Peter Zijlstra Signed-off-by: Andrea Parri Reviewed-by: Ming Lei Cc: Jens Axboe Cc: Omar Sandoval Cc: Ming Lei Cc: linux-block@vger.kernel.org Cc: "Paul E. McKenney" Cc: Peter Zijlstra --- lib/sbitmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/sbitmap.c b/lib/sbitmap.c index 155fe38756ecf..4a7fc4915dfc6 100644 --- a/lib/sbitmap.c +++ b/lib/sbitmap.c @@ -435,7 +435,7 @@ static void sbitmap_queue_update_wake_batch(struct sbitmap_queue *sbq, * to ensure that the batch size is updated before the wait * counts. */ - smp_mb__before_atomic(); + smp_mb(); for (i = 0; i < SBQ_WAIT_QUEUES; i++) atomic_set(&sbq->ws[i].wait_cnt, 1); }