From patchwork Wed Jul 20 03:12:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Ruffell X-Patchwork-Id: 1658321 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=JdHpDWmi; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Lngjr63KKz9s2R for ; Wed, 20 Jul 2022 13:12:32 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1oE08Q-000863-1c; Wed, 20 Jul 2022 03:12:26 +0000 Received: from smtp-relay-internal-1.internal ([10.131.114.114] helo=smtp-relay-internal-1.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1oE08K-00084F-ML for kernel-team@lists.ubuntu.com; Wed, 20 Jul 2022 03:12:20 +0000 Received: from mail-pf1-f197.google.com (mail-pf1-f197.google.com [209.85.210.197]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id 757F43F0C8 for ; Wed, 20 Jul 2022 03:12:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1658286740; bh=/+VxWX74pvDdsCkz5PBL23bSjZBhte/xupwXQd8nXdM=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=JdHpDWmiQ6vlNCxsPWTTkE6N4aE+PQ4s1DuQ5wJLGCqoLa86pjeJYvoV8H0mv6EkK tMKhT6NE4xHjaGa2PaP2raah9JxO8VbQ7jWwHSJ5ijhSwrV7zMVCqHCm9KMrA+3EMW ZFTrYlf059rxVjoog4RWN0ChxnH45w4rRrx7JilTJznSMVYGUUtTyzjHfyngrnY/bI I+ryd0Jti2zIngUo8xbBnIihANSNUzQ23oGrNFsDXw/Us7f5U41k5PbGsS/afc4aRm 9OYtEMrCjFNqnv4kH8rStDtP2b0kLwNhmBScmBR0ftyiwNqHwhnu4hU2q767GxJIyz sTwPRBNjXSzbA== Received: by mail-pf1-f197.google.com with SMTP id d18-20020aa78692000000b0052abaa9a6bbso5215921pfo.2 for ; Tue, 19 Jul 2022 20:12:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/+VxWX74pvDdsCkz5PBL23bSjZBhte/xupwXQd8nXdM=; b=M0pSIKQzm5WWwPltRLsgug1svox2/qYS+kF4C2fteTpll1PqS6RLyOLlP25H7O1u21 cdSViA/Eqc8FwZCdjhtNWIp1Lso01dZtVKGsCIFPtOszy58GqdYsHNv/FdcDdZXX4ltf koN853PgbCD55gefVrFPUcK8MmGyZ/aLXop+wb3z8GaHCH4H+31TMvBSqm6oPESigKnw zn1//pXeUiP2liK40Z36W93lAhhGO01s6AkQwNyP0a+IFs2WRTYL0ZYclQoodnLKKeZm 2UWwKzu1GvxP0oF78opxoeNriEsP6TiyRguVdEv6i9ylsz5hZSxICmG/oMeRBz/85vqR p66Q== X-Gm-Message-State: AJIora9BiMwpfR5++KBc588JrzCRHN4ziEJYwNkyvwRv9xY6tQQ0rzZG BBse0jAosF/ZEVfmid98WhSls5qJKLF4j8kOONSusKPr1dbIhMROpL/kAfh6GQ4SnhHyH1YRSXb H2TIRWunL6wZdt85W6rYX26W2rq1VSuCfdzfn8Ib6Xg== X-Received: by 2002:a05:6a00:a93:b0:528:77d6:f660 with SMTP id b19-20020a056a000a9300b0052877d6f660mr36836401pfl.50.1658286739122; Tue, 19 Jul 2022 20:12:19 -0700 (PDT) X-Google-Smtp-Source: AGRyM1umIUSMBkJ8+NuQrDLGMk4xfA0tA02CHg+pIZeVpLs7eYRt6VKE1JdH9Kcvd8CS7Ck2P9wmkA== X-Received: by 2002:a05:6a00:a93:b0:528:77d6:f660 with SMTP id b19-20020a056a000a9300b0052877d6f660mr36836382pfl.50.1658286738790; Tue, 19 Jul 2022 20:12:18 -0700 (PDT) Received: from desktop.. (125-239-70-54-fibre.sparkbb.co.nz. [125.239.70.54]) by smtp.gmail.com with ESMTPSA id i2-20020a17090ac40200b001efbc3ad105sm331812pjt.54.2022.07.19.20.12.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Jul 2022 20:12:18 -0700 (PDT) From: Matthew Ruffell To: kernel-team@lists.ubuntu.com Subject: [SRU][F][PATCH V2 1/6] blk-mq: blk-mq: provide forced completion method Date: Wed, 20 Jul 2022 15:12:05 +1200 Message-Id: <20220720031210.17801-2-matthew.ruffell@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220720031210.17801-1-matthew.ruffell@canonical.com> References: <20220720031210.17801-1-matthew.ruffell@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Keith Busch BugLink: https://bugs.launchpad.net/bugs/1896350 Drivers may need to bypass error injection for error recovery. Rename __blk_mq_complete_request() to blk_mq_force_complete_rq() and export that function so drivers may skip potential fake timeouts after they've reclaimed lost requests. Signed-off-by: Keith Busch Reviewed-by: Daniel Wagner Signed-off-by: Jens Axboe (cherry picked from commit 7b11eab041dacfeaaa6d27d9183b247a995bc16d) Signed-off-by: Matthew Ruffell --- block/blk-mq.c | 15 +++++++++++++-- include/linux/blk-mq.h | 1 + 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/block/blk-mq.c b/block/blk-mq.c index 84798d09ca46..82e93cd9f60d 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -579,7 +579,17 @@ static void __blk_mq_complete_request_remote(void *data) q->mq_ops->complete(rq); } -static void __blk_mq_complete_request(struct request *rq) +/** + * blk_mq_force_complete_rq() - Force complete the request, bypassing any error + * injection that could drop the completion. + * @rq: Request to be force completed + * + * Drivers should use blk_mq_complete_request() to complete requests in their + * normal IO path. For timeout error recovery, drivers may call this forced + * completion routine after they've reclaimed timed out requests to bypass + * potentially subsequent fake timeouts. + */ +void blk_mq_force_complete_rq(struct request *rq) { struct blk_mq_ctx *ctx = rq->mq_ctx; struct request_queue *q = rq->q; @@ -625,6 +635,7 @@ static void __blk_mq_complete_request(struct request *rq) } put_cpu(); } +EXPORT_SYMBOL_GPL(blk_mq_force_complete_rq); static void hctx_unlock(struct blk_mq_hw_ctx *hctx, int srcu_idx) __releases(hctx->srcu) @@ -658,7 +669,7 @@ bool blk_mq_complete_request(struct request *rq) { if (unlikely(blk_should_fake_timeout(rq->q))) return false; - __blk_mq_complete_request(rq); + blk_mq_force_complete_rq(rq); return true; } EXPORT_SYMBOL(blk_mq_complete_request); diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h index 0bf056de5cc3..92b48a8e4af3 100644 --- a/include/linux/blk-mq.h +++ b/include/linux/blk-mq.h @@ -312,6 +312,7 @@ void blk_mq_requeue_request(struct request *rq, bool kick_requeue_list); void blk_mq_kick_requeue_list(struct request_queue *q); void blk_mq_delay_kick_requeue_list(struct request_queue *q, unsigned long msecs); bool blk_mq_complete_request(struct request *rq); +void blk_mq_force_complete_rq(struct request *rq); bool blk_mq_bio_list_merge(struct request_queue *q, struct list_head *list, struct bio *bio, unsigned int nr_segs); bool blk_mq_queue_stopped(struct request_queue *q);