From patchwork Mon Apr 29 20:14:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Parri X-Patchwork-Id: 10922495 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 14E7E1398 for ; Mon, 29 Apr 2019 20:16:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 066F328660 for ; Mon, 29 Apr 2019 20:16:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EED18287B3; Mon, 29 Apr 2019 20:16:29 +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 94E8128660 for ; Mon, 29 Apr 2019 20:16:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729212AbfD2UQB (ORCPT ); Mon, 29 Apr 2019 16:16:01 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:38928 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729260AbfD2UQA (ORCPT ); Mon, 29 Apr 2019 16:16:00 -0400 Received: by mail-wr1-f65.google.com with SMTP id a9so17888231wrp.6 for ; Mon, 29 Apr 2019 13:15:59 -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=HnQQB+q10KJ+tBjmTDVhEUeBuplkgzFkaabaWorIDK0=; b=V8llIgXP6nhj3mBW9/AXO9OGQRGRnVOgd/Mgx/UqS0Dmg6P71DCInuxWyizpcBDv2v s4LWS3ulfKwPBDJxaH97b/cxsArPA7/vK6pLhrgQwPdEmqCASyvUl8VDq6EE/M867QlH vuLUSwu+6ZvKtN0hQBgi2CjSm7a1FwV/4h3/I= 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=HnQQB+q10KJ+tBjmTDVhEUeBuplkgzFkaabaWorIDK0=; b=V9XFs0TQurQhY7pQprOgkp7Filabt8M2AG367hrmym1bgj8/8ysNQlr7gPeYBFVNue JRaaH6mrEMn/2Z1h+yMOheHBp/6IgVPhHv5CWzbAGwc/rHu50jcR+bwuhwBtXzs+ZfQ3 Atwwb+3IDRjfTz25vll62oxtA3wLJq4hlTtQOSUwIPiTmlMz8wBaoV2XamCM4EGgBd7+ jcTIkPiQNCZuVR1bGzn9mTbikJvXnsNTA+oxAKkFpdNe12y98XAOW7u0ck+SaJO8uO8v UoMGkNVF/X+wG1zifm6lgrSRpPiXknwF8e5pOxhS3s8t3mVWtVS6KjVh0XPyDbR8ytQW /42w== X-Gm-Message-State: APjAAAUPBPZIxWNSgc0UlaYgVLzgEyXIX96H71sbxvPTj2yZnPMvk9Ff XFGp0/MtbCpmiLBZGCWKnMF6gA== X-Google-Smtp-Source: APXvYqzO/shy+lwWyu704q2dOX00yaUvvzyKRtzyAEk5wDzatGiK5EyHB6NgTBNQOz/tIfNcD7NiVw== X-Received: by 2002:adf:fb4a:: with SMTP id c10mr13358709wrs.309.1556568958675; Mon, 29 Apr 2019 13:15:58 -0700 (PDT) Received: from localhost.localdomain (ip-93-97.sn2.clouditalia.com. [83.211.93.97]) by smtp.gmail.com with ESMTPSA id k6sm22864019wrd.20.2019.04.29.13.15.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 29 Apr 2019 13:15:57 -0700 (PDT) From: Andrea Parri To: linux-kernel@vger.kernel.org Cc: Andrea Parri , stable@vger.kernel.org, Jens Axboe , linux-block@vger.kernel.org Subject: [PATCH 2/5] bio: fix improper use of smp_mb__before_atomic() Date: Mon, 29 Apr 2019 22:14:58 +0200 Message-Id: <1556568902-12464-3-git-send-email-andrea.parri@amarulasolutions.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1556568902-12464-1-git-send-email-andrea.parri@amarulasolutions.com> References: <1556568902-12464-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 Cc: Jens Axboe Cc: linux-block@vger.kernel.org Reviewed-by: Ming Lei --- 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 e584673c18814..5becbafb84e8a 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h @@ -224,7 +224,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 Apr 29 20:14:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Parri X-Patchwork-Id: 10922489 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 840DD14C0 for ; Mon, 29 Apr 2019 20:16:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 728C328660 for ; Mon, 29 Apr 2019 20:16:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 66A68287AD; Mon, 29 Apr 2019 20:16:05 +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 0EE6D287B3 for ; Mon, 29 Apr 2019 20:16:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729315AbfD2UQE (ORCPT ); Mon, 29 Apr 2019 16:16:04 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:33608 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729421AbfD2UQD (ORCPT ); Mon, 29 Apr 2019 16:16:03 -0400 Received: by mail-wr1-f67.google.com with SMTP id s18so17952310wrp.0 for ; Mon, 29 Apr 2019 13:16:02 -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=Tf7MLbuwm8AwySzke/NOZGkPfHj632yqYUtU8HHCGbc=; b=lt2JmU9usNLupk17GENygz8xjZEYXly2t8l41TwQCwNB/wXDK7iOj5DEQUmhzdByfb 3mdulYuOjhKIMLP7Y1bb6H6JQDVOLvM3JhAdlgWC53GJQUEAFdK0HN122obTyWFcvnzl p5eaoNHIlJvKwUhaLPWMn5i8SXw1vHRMH0NLE= 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=Tf7MLbuwm8AwySzke/NOZGkPfHj632yqYUtU8HHCGbc=; b=GrEt2gIeNzEYWmyrTZChbRg+Cr+hO0P1YrpkwQws8SC1nTvIc4JCNqhKYNdPX9y0JO 3WndZJR016shQ5esrORWXDT8qpga/3Q06X2A7amkWG//koL7s73qAhqK3jHYui03R7FZ cMtqIHSFDogPvbl0AOUY1OZCeAHRiBl2Gf+pbOChjHg1wF2bU7846YaNq2yT4ZhN3Huw zrfolQro2hhOkT+UGzgw60Bt3reiRU9ymFGGxEn3H/MmrOxG25qW4poeIfnxKNPjs8Of zhyfiBP4GVMaW0gJdKQ+GrOxXS4ydIV9M0V0/u5L39RplgywOtC+ygH1uPOz7uqUUeVR BC8g== X-Gm-Message-State: APjAAAVrjo31jiSIhsF+cYZ/EzQDgDiFLIYsFlQsteBTlEZRywhFkiMi 4+yOqKV0WJVeODSbi1guB6NR8w== X-Google-Smtp-Source: APXvYqxCWUtW1QCMY+cBeSIXhZF4eeOqHKw9FHvYl2dBn2UjRBtO2Cz5wDL0aGxLp6V2/9d/+3rzKQ== X-Received: by 2002:adf:df92:: with SMTP id z18mr6962697wrl.213.1556568961502; Mon, 29 Apr 2019 13:16:01 -0700 (PDT) Received: from localhost.localdomain (ip-93-97.sn2.clouditalia.com. [83.211.93.97]) by smtp.gmail.com with ESMTPSA id k6sm22864019wrd.20.2019.04.29.13.16.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 29 Apr 2019 13:16:00 -0700 (PDT) From: Andrea Parri To: linux-kernel@vger.kernel.org Cc: Andrea Parri , stable@vger.kernel.org, Jens Axboe , Omar Sandoval , linux-block@vger.kernel.org Subject: [PATCH 3/5] sbitmap: fix improper use of smp_mb__before_atomic() Date: Mon, 29 Apr 2019 22:14:59 +0200 Message-Id: <1556568902-12464-4-git-send-email-andrea.parri@amarulasolutions.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1556568902-12464-1-git-send-email-andrea.parri@amarulasolutions.com> References: <1556568902-12464-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 Cc: Jens Axboe Cc: Omar Sandoval Cc: linux-block@vger.kernel.org Reviewed-by: Ming Lei --- 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); }