From patchwork Tue Jan 9 16:29:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tejun Heo X-Patchwork-Id: 10152865 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 AE8D7602CA for ; Tue, 9 Jan 2018 16:32:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BC63F20453 for ; Tue, 9 Jan 2018 16:32:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B03F728534; Tue, 9 Jan 2018 16:32:02 +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 6BCCE20453 for ; Tue, 9 Jan 2018 16:32:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759511AbeAIQaG (ORCPT ); Tue, 9 Jan 2018 11:30:06 -0500 Received: from mail-qk0-f196.google.com ([209.85.220.196]:45899 "EHLO mail-qk0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758965AbeAIQaE (ORCPT ); Tue, 9 Jan 2018 11:30:04 -0500 Received: by mail-qk0-f196.google.com with SMTP id o126so19213167qke.12; Tue, 09 Jan 2018 08:30:03 -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=q89CZELTtkMD04b14/kIx5n6QpVlTsnpnaZ+GGlaFZf7Og9NqAtXgCRHxa2PMfmwlG Kx/gOIR7wDCAyLqfZWB7CUeaHoCrCeRunRfvDC+YLW7hAoq5ZD4bQ6jMXRVtHAHhmwst iq3hYIt/I5iNuFzIBiBcw16GseJ1UtJN9P/SFn482KWCFN0UY6YX7iIiJoMmFUbZ6Htg j0T94w6M5ozBZFCqT0HKXCCJ4wOtQSwe7MNq7EKt+owUit0BygrD+s0FSff7KSlWjcYz CuHNPMB+TC4EwWjFW+09MH0ENA4LG8IIL5NGWZkdVpXMrlNchhgriIT7Dfjl7F7Dp2xJ W4JA== 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=KtAu+Sql/dZDpR5lfFgDUdajrZnxPrHHdLD+fYDvRnphePinG862CU4rPsmMDvyUfl +8IOZVfC11Fts3acLi4QPa54maeW3d4aWQt/kL99YfSZIJEnXv82atEHEtJZeXDyCqWY iFGfybNs4xmjk7MvGqruPKZ8t96zcQ5+beDbSnAyxBBnCv46SnaKIcKsgsWgKmaFdY1V 4ws7KwoegAisG7I35V34cTts7e5Ign16YFD0Hw2Ba3Vv+AB9bq+QRYxHPZrZ+j8NWlsr W0uF6plTbD0T8NCV2y0uMR04rNRQAlOtF5JiZyJXcwnjS5ZpNQfkIF4gYI5Wwn7DS9Dc y8Iw== X-Gm-Message-State: AKwxytfLxMGxB4/1jyGo6u1CtrPCRd4rMpuuXloFIoComwLpE+WlF5vQ D0Xl+V+zWizf99rSwJbrDhM= X-Google-Smtp-Source: ACJfBosxvKBx99AC/bfSTwGcfPBgCh2V5WdzPAMVnLHGsnSGy9XbFNzUhTYj8PUFLG+6OkTD14A1gQ== X-Received: by 10.55.41.20 with SMTP id p20mr20980071qkh.5.1515515403072; Tue, 09 Jan 2018 08:30:03 -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 d10sm9482015qkg.16.2018.01.09.08.30.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Jan 2018 08:30:02 -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: Tue, 9 Jan 2018 08:29:47 -0800 Message-Id: <20180109162953.1211451-3-tj@kernel.org> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20180109162953.1211451-1-tj@kernel.org> References: <20180109162953.1211451-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);