From patchwork Mon Jan 8 19:15:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tejun Heo X-Patchwork-Id: 10150419 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D68AC601A1 for ; Mon, 8 Jan 2018 19:19:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DFF3328639 for ; Mon, 8 Jan 2018 19:19:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D495A28698; Mon, 8 Jan 2018 19:19:01 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 8022E28639 for ; Mon, 8 Jan 2018 19:19:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932424AbeAHTP5 (ORCPT ); Mon, 8 Jan 2018 14:15:57 -0500 Received: from mail-qt0-f194.google.com ([209.85.216.194]:35860 "EHLO mail-qt0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932365AbeAHTPy (ORCPT ); Mon, 8 Jan 2018 14:15:54 -0500 Received: by mail-qt0-f194.google.com with SMTP id a16so14945909qtj.3; Mon, 08 Jan 2018 11:15:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=vEZBzgMthgRpcRjH/EmPEl4hhmes/JLw/99rUOnrr8s=; b=i2bgP6oKjRvdqVBQMtnp4l+7mCvYzkdfgYzu+PjLaZIg2RKTkkO53eO7wiBh7cmrky hXrA8oTxhrWgJoJgWz877czyhz/DF37fOEq2f7D/IGNCyWlieo2up/BM86INgSyVbEsS L8MPc9sbhqV8bpGdGSykRZCcK6KpNDAddJE01SvIfjdT994TV45p44T5gXzLRmcmx1bx cXRD+I1AQtRuabmKLLJikX7eVh6RZsHYmyBVNwx3tejHje96uwmujGMop8OHO2sOdtFC XakY/HGb8vBu7HucwuNOjhyQNiW4fP/d3Z/dCZrf4QmlaaBpYH4BICpG/MF3VGKdbSv7 ksjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=vEZBzgMthgRpcRjH/EmPEl4hhmes/JLw/99rUOnrr8s=; b=CXwyYFTtpuzwiWi1D1ZcmE7L/+xDj4hkMxB4JFR0qygLYVUL0mNEEwpkdqMIj40ayw zVbVBFh6jZ3YB+oAkVZJf7hdh14CTCGATMe4cLtzRALUYEbdHhP/zTp1PrmOZtvbWNKV W0uHwH2cdNStSxFjKKVe+S/jr0xo4EGA3T2ciAQR4u6TSHNKN+PdzF0S/+sZ8OdDYJom 7794OtyzKBy1tAngFIf3pUO9U7KNU7GtLuQSd/e9ABMFoh6AnsIu4UggjflfS91FPYSC HUW0iXcaCFBGR938akwjs7DkF01q952uh/eAzSsHACZUyklTnVbR2Nq4qF9rdADQB6b8 IVAw== X-Gm-Message-State: AKwxytd3Mp1mejpVokKpnmJI63lWRXRRUzPghC4m24XnkrsIaIfNfH63 dyiw0VglHTw0a61uAm9aE8U= X-Google-Smtp-Source: ACJfBouTaGRcDsW4iJc0Jb42V/BkJ16LOqpVh5Bdscn4PAobn8tphfwRH6wvJvNk2U4ntaZN+IJ18A== X-Received: by 10.200.16.21 with SMTP id z21mr18087413qti.101.1515438953377; Mon, 08 Jan 2018 11:15:53 -0800 (PST) Received: from localhost (dhcp-ec-8-6b-ed-7a-cf.cpe.echoes.net. [72.28.5.223]) by smtp.gmail.com with ESMTPSA id c203sm8221134qkb.20.2018.01.08.11.15.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 08 Jan 2018 11:15:52 -0800 (PST) From: Tejun Heo To: jack@suse.cz, axboe@kernel.dk, clm@fb.com, jbacik@fb.com Cc: kernel-team@fb.com, linux-kernel@vger.kernel.org, linux-btrfs@vger.kernel.org, peterz@infradead.org, jianchao.w.wang@oracle.com, Bart.VanAssche@wdc.com, linux-block@vger.kernel.org, Tejun Heo Subject: [PATCH 2/8] blk-mq: protect completion path with RCU Date: Mon, 8 Jan 2018 11:15:36 -0800 Message-Id: <20180108191542.379478-3-tj@kernel.org> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20180108191542.379478-1-tj@kernel.org> References: <20180108191542.379478-1-tj@kernel.org> Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Currently, blk-mq protects only the issue path with RCU. This patch puts the completion path under the same RCU protection. This will be used to synchronize issue/completion against timeout by later patches, which will also add the comments. Signed-off-by: Tejun Heo --- block/blk-mq.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/block/blk-mq.c b/block/blk-mq.c index ddc9261..6741c3e 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -584,11 +584,16 @@ static void hctx_lock(struct blk_mq_hw_ctx *hctx, int *srcu_idx) void blk_mq_complete_request(struct request *rq) { struct request_queue *q = rq->q; + struct blk_mq_hw_ctx *hctx = blk_mq_map_queue(q, rq->mq_ctx->cpu); + int srcu_idx; if (unlikely(blk_should_fake_timeout(q))) return; + + hctx_lock(hctx, &srcu_idx); if (!blk_mark_rq_complete(rq)) __blk_mq_complete_request(rq); + hctx_unlock(hctx, srcu_idx); } EXPORT_SYMBOL(blk_mq_complete_request);