From patchwork Thu Aug 9 19:41:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 10561855 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 D7B8513B4 for ; Thu, 9 Aug 2018 19:42:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C778C2B979 for ; Thu, 9 Aug 2018 19:42:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B9A962B97F; Thu, 9 Aug 2018 19:42:11 +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=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,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 DAFC92B979 for ; Thu, 9 Aug 2018 19:42:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726971AbeHIWI2 (ORCPT ); Thu, 9 Aug 2018 18:08:28 -0400 Received: from esa1.hgst.iphmx.com ([68.232.141.245]:1352 "EHLO esa1.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726744AbeHIWI1 (ORCPT ); Thu, 9 Aug 2018 18:08:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1533843729; x=1565379729; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=wZHkDWD6raDrix7kY0p1HxuExgX2CoczUoBMuy66/nA=; b=B5cnOe2wkUzpfHI7h+uHmIIZhdKRnRlqGCsbZ0bG3/vSlXupiAqpnyiT ix8qtniD/5kW0aQsYd/q0cf/lae4QQDletKgwgYM8ABXdgFATDt0F0YED NN1OyztNCK9aNMOPOiVXDKXnbIpYfNvQz3XASDv1QVG9DfHQCRN39CR89 Od0O/bvCT1ayODedA0D44amYw0rCYBGWvRS60dgftIDc98YcgwW9odCR5 0zclF+seyO98RwXb6CkWohGQCqW2RlwpsSnzw/iN7uwbI9ATkyAA2xoD+ 9a5Yrt0655Sv9NmUCIUkA0K48PQ2nhR4waSCB+iXb2yrz13E3rutasjP7 Q==; X-IronPort-AV: E=Sophos;i="5.53,215,1531756800"; d="scan'208";a="191119591" Received: from mail-sn1nam01lp0119.outbound.protection.outlook.com (HELO NAM01-SN1-obe.outbound.protection.outlook.com) ([207.46.163.119]) by ob1.hgst.iphmx.com with ESMTP; 10 Aug 2018 03:42:08 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector1-wdc-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=pvqTkTJB1FRQXxzNI7s7Sev7m4F5xEJmloH08kikT9E=; b=Ed0xoZmnsTkEV5sWGYgNCmPe88r1f2u+CSwidjcb5yuQG3LGOIIgy5EWCLoYgK1QlVmVrSmtEWCKINpm0XEl7FoYt/lEPx3fYM93LGp+vIO2NVWsqI8m0Ic53OjwIrvne54FtX2TUo01v5qlpVx9ZE5RSd2r6YCGDkcsf3UCx1o= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Bart.VanAssche@wdc.com; Received: from asus.hsd1.ca.comcast.net (174.62.111.89) by MWHPR04MB1198.namprd04.prod.outlook.com (2603:10b6:300:71::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1038.23; Thu, 9 Aug 2018 19:42:04 +0000 From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, Christoph Hellwig , Bart Van Assche , "Martin K . Petersen" , "David S . Miller" , Ming Lei , Jianchao Wang , Hannes Reinecke , Johannes Thumshirn , Alan Stern Subject: [PATCH v6 01/12] block, scsi: Introduce request flag RQF_DV Date: Thu, 9 Aug 2018 12:41:38 -0700 Message-Id: <20180809194149.15285-2-bart.vanassche@wdc.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180809194149.15285-1-bart.vanassche@wdc.com> References: <20180809194149.15285-1-bart.vanassche@wdc.com> MIME-Version: 1.0 X-Originating-IP: [174.62.111.89] X-ClientProxiedBy: MWHPR2201CA0066.namprd22.prod.outlook.com (2603:10b6:301:5e::19) To MWHPR04MB1198.namprd04.prod.outlook.com (2603:10b6:300:71::23) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 37c595b2-de51-4642-c349-08d5fe302f73 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020);SRVR:MWHPR04MB1198; X-Microsoft-Exchange-Diagnostics: 1;MWHPR04MB1198;3:SvObngyIWSHCvlkM35Gw7yjYJ8M5EbZpcBNLU94jT2oTAWRM+MBD2IOHwsuja+dlfyoMuyGdYRUwRrSMyPsP/HqfavOiEasv5b6sD7oAzHp1ItH8hkvIJK58RdtlhvtJU7pgl3Ds0XSqzrfpcYgXscx03xdRLrn9gXcgyddi6nWTAcai/L925dlDf/YVvzOP0EWAfOzoLrNgfipBv1wIdo/MMfGuq2OOrbVHSJkWnctNuIF96sJL6X48j+yai170;25:LFLKJBQEsILHHxB/W2xWF0YT0x9vAp/xurBw5J0iR15RL/HZ7qdDokztZUF8JsX/HCZflof16QKv6JtB19O2HqzcFqANWawV8hvy8NWC02OiFyiWY1N8GyMe2TwU8mfS3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PW8Lu6LWFFsQjOOhaBN3q71p/wNaTOGJ63ybfro3E3FNNFe82OKRVbIzxZiVAgY3/CgUY4AOdOR/UFWd2H/ZsCS2wmkJUqTthsLF3XJvmVMVm+4lRfuED0CalpcOERKH1kj0qzF1XWk/vIWnHW8oGUAtY3yD8ljsr/4sGILhUarPTla2mMJhEhSRntTH6Lc0JD5I64f1/qPoYvtToGXrJPTCTIKDCGd9HbnN/kCp+h+DCjQkCJNwowGeBCl+ciWtbmxkeS6mANqxyADIgPaSbt1nM6QeAE78SBu8bv4hYdA1BDnSi8LQqm1wLIqzR3uCZjXOj+lgcB+S6GoEb0xvZIBPXQGs4vxKUtJFWSNQ= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(35762410373642)(146099531331640); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(3231311)(944501410)(52105095)(3002001)(10201501046)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123558120)(20161123564045)(20161123560045)(6072148)(201708071742011)(7699016);SRVR:MWHPR04MB1198;BCL:0;PCL:0;RULEID:;SRVR:MWHPR04MB1198; X-Forefront-PRVS: 0759F7A50A X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(396003)(39860400002)(136003)(366004)(346002)(376002)(199004)(189003)(76176011)(50466002)(476003)(51416003)(4326008)(478600001)(52116002)(6486002)(105586002)(72206003)(48376002)(5660300001)(47776003)(305945005)(2616005)(956004)(7736002)(6916009)(6666003)(486006)(8936002)(2906002)(68736007)(36756003)(66066001)(575784001)(186003)(7416002)(446003)(81166006)(50226002)(8676002)(81156014)(316002)(6506007)(386003)(106356001)(97736004)(25786009)(11346002)(16586007)(54906003)(14444005)(6116002)(1076002)(3846002)(86362001)(26005)(16526019)(53936002)(6512007);DIR:OUT;SFP:1102;SCL:1;SRVR:MWHPR04MB1198;H:asus.hsd1.ca.comcast.net;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; X-Microsoft-Exchange-Diagnostics: 1;MWHPR04MB1198;23:O045RCZO2gnGfuv7F9csU/KhtTN2ytJi+9ytaZmtcRaHYmP1RZ37XRlxKOTaQSGidDNWHGK+OHAci2Ua0L99MGPxeX7JPzcQNXsczHiBvho167TgrNNsXP3hJ7peVSeq4PLhwgVPUV46EMPrwLPmV5txaQslUzhCKG326p2QtoX0OZIw+3o6J/0FHhSQ30mIvtEQxHfKZokqYgXTsiWexGc3RHUxbPrcp+7Y2uCFg/58mOTdgSPqmnKZ/045mTxvOFvSkKYeEO+86ZA05U2OKmYndVF+MACpE7zfk/6e6ipOZcYyqQmSwecqf3srFWCXf6ZcA7jvK2aWD48XRJ++LBqAve24rfU47mLG0PpZ3dge25LIGrNNI3XnOJq4H13l4Yun+VkNiRams/M2wg5moY9g2yDhewZ2P3b5GXKPkHSe9+9Ost0BBd7cccjPfFmoiz+kvwOsAtnvwqGS1LtD1OzkMuUKuJKv1fcOXx3GDpmpxJkoyNN2OwueUbkYVG27elXuc3O105RjKqClbKMCXshAUlu/BmvHg+I/RC3NARRzCpMCFOmZmFfNwiyIcfnserjYKjeP0+auUO373assetw35UOaLuI9LlokuGu4CZLsP6OJkexmZkzkvGUHI2xgg/N0QmKINd2N6tBkNPshPUV8TB3eR7xHOT8Sc/3O2q/bIt1JcPE630r8lg8EvqI8VMnt1BdPLIuknJCPq5//LjjUPcigsz4IWQ9mwiugY6KH0++nzFlIEm4o4K/oVOV9rLq1NTl2sNLSOqxPANJ6uqlc7Dly+ulzTcA4W3SgZcirsFzYrjOhVYsQ7Eb5jc7Si8goH4W0mdjDF8hrkacAKjrcyZSnRSgLBbp1D0rqnzkjLR5NGxxqGJodL/oRWBCEF0XwHCnVpZPBaWJL++OUeybieg7vYIAaEZZhoTe3/onYhLb3JsYL5d3LlDL4V/sTBx8PnMVUfcfKoESUDP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/efMgSY0yOERU1JcDR/njxQDt8y0AaQbMKohr/oOez+JoDlyL9IYt3XPZ4kES/Opu8ZHXHMnmS12X7kaRYn0fAgPewwG5cpg2I2KOm/7g0dqFXzLqgYQ0ax4oKsKw5KCktPqfg==;5:Y63TGCrgfreJoujdyq1ZS31yLAP2i67vwX7XvSOb0waIrZoRB8dr0gtGJHAACDRD/bDoM+8tPuFnUsbvSBDRf/oOYyjT+hyBhZXklaR77osY2Ut6/rrrX73N5t+a39OBm6shot3hbFU5AfAE5CjtJpc+DV9qrsTsP8ADwiETQSw=;7:8dfDQyQbGvBgKYY2zHAr9l7eDj/Scsq9pBoVNZNxHp6Tr63KV7RAUL6ta5D6Nn3qlJQTs/raqOeVKRgc7vmk+TlcV/cBsG9cWD2LfbqCZOpRrC0F+uVdCkXiAd7ixZFPW97hndjwGy3j437P/VRwmjC2anomPRyit5FUVEAedvmdUEcw8+09udx848dbPP/d3DrRaF+wuhOKuPIMW8r+tLWUklZcc3jsxp81Do4rDJlZIR6sXBWy+ycrT1NIQZrl SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;MWHPR04MB1198;20:Mq3MUnoS6lCYtE1VPHFI2ggh20oIWht/AOhtOHXjGbYhVWySEQmabiwXqssNq4uPuEW1GyJAh69OFWzatG8RWoglua1ome6EYoLNwrz/WT17oVZza5+OgU5b2gZqSYxkOg443L983lOloQff1kI1GCjpQgL24Ppit/ENkfdF95A= X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Aug 2018 19:42:04.6390 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 37c595b2-de51-4642-c349-08d5fe302f73 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR04MB1198 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 Instead of marking all power management, SCSI domain validation and IDE preempt requests with RQF_PREEMPT, only mark IDE preempt requests with RQF_PREEMPT. Use RQF_DV to mark requests submitted by scsi_execute() and RQF_PM to mark power management requests. Most but not all power management requests already have the RQF_PM flag set. Signed-off-by: Bart Van Assche Cc: Martin K. Petersen Cc: David S. Miller Cc: Christoph Hellwig Cc: Ming Lei Cc: Jianchao Wang Cc: Hannes Reinecke Cc: Johannes Thumshirn Cc: Alan Stern --- block/blk-core.c | 11 +++++------ block/blk-mq-debugfs.c | 1 + block/blk-mq.c | 2 -- drivers/ide/ide-pm.c | 3 ++- drivers/scsi/scsi_lib.c | 11 ++++++++--- include/linux/blk-mq.h | 6 ++++-- include/linux/blkdev.h | 5 +++-- 7 files changed, 23 insertions(+), 16 deletions(-) diff --git a/block/blk-core.c b/block/blk-core.c index 12550340418d..c4ff58491758 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -913,11 +913,11 @@ EXPORT_SYMBOL(blk_alloc_queue); /** * blk_queue_enter() - try to increase q->q_usage_counter * @q: request queue pointer - * @flags: BLK_MQ_REQ_NOWAIT and/or BLK_MQ_REQ_PREEMPT + * @flags: BLK_MQ_REQ_NOWAIT, BLK_MQ_REQ_PM and/or BLK_MQ_REQ_DV */ int blk_queue_enter(struct request_queue *q, blk_mq_req_flags_t flags) { - const bool preempt = flags & BLK_MQ_REQ_PREEMPT; + const bool preempt = flags & (BLK_MQ_REQ_PM | BLK_MQ_REQ_DV); while (true) { bool success = false; @@ -1436,8 +1436,6 @@ static struct request *__get_request(struct request_list *rl, unsigned int op, blk_rq_set_rl(rq, rl); rq->cmd_flags = op; rq->rq_flags = rq_flags; - if (flags & BLK_MQ_REQ_PREEMPT) - rq->rq_flags |= RQF_PREEMPT; /* init elvpriv */ if (rq_flags & RQF_ELVPRIV) { @@ -1575,7 +1573,7 @@ static struct request *get_request(struct request_queue *q, unsigned int op, goto retry; } -/* flags: BLK_MQ_REQ_PREEMPT and/or BLK_MQ_REQ_NOWAIT. */ +/* flags: BLK_MQ_REQ_NOWAIT, BLK_MQ_REQ_PM and/or BLK_MQ_REQ_DV. */ static struct request *blk_old_get_request(struct request_queue *q, unsigned int op, blk_mq_req_flags_t flags) { @@ -1618,7 +1616,8 @@ struct request *blk_get_request(struct request_queue *q, unsigned int op, struct request *req; WARN_ON_ONCE(op & REQ_NOWAIT); - WARN_ON_ONCE(flags & ~(BLK_MQ_REQ_NOWAIT | BLK_MQ_REQ_PREEMPT)); + WARN_ON_ONCE(flags & ~(BLK_MQ_REQ_NOWAIT | BLK_MQ_REQ_PM | + BLK_MQ_REQ_DV)); if (q->mq_ops) { req = blk_mq_alloc_request(q, op, flags); diff --git a/block/blk-mq-debugfs.c b/block/blk-mq-debugfs.c index cb1e6cf7ac48..b4e722311ae1 100644 --- a/block/blk-mq-debugfs.c +++ b/block/blk-mq-debugfs.c @@ -330,6 +330,7 @@ static const char *const rqf_name[] = { RQF_NAME(SPECIAL_PAYLOAD), RQF_NAME(ZONE_WRITE_LOCKED), RQF_NAME(MQ_POLL_SLEPT), + RQF_NAME(DV), }; #undef RQF_NAME diff --git a/block/blk-mq.c b/block/blk-mq.c index 72a0033ccee9..2a0eb058ba5a 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -300,8 +300,6 @@ static struct request *blk_mq_rq_ctx_init(struct blk_mq_alloc_data *data, rq->rq_flags = rq_flags; rq->cpu = -1; rq->cmd_flags = op; - if (data->flags & BLK_MQ_REQ_PREEMPT) - rq->rq_flags |= RQF_PREEMPT; if (blk_queue_io_stat(data->q)) rq->rq_flags |= RQF_IO_STAT; INIT_LIST_HEAD(&rq->queuelist); diff --git a/drivers/ide/ide-pm.c b/drivers/ide/ide-pm.c index 59217aa1d1fb..8bf378164aee 100644 --- a/drivers/ide/ide-pm.c +++ b/drivers/ide/ide-pm.c @@ -90,8 +90,9 @@ int generic_ide_resume(struct device *dev) } memset(&rqpm, 0, sizeof(rqpm)); - rq = blk_get_request(drive->queue, REQ_OP_DRV_IN, BLK_MQ_REQ_PREEMPT); + rq = blk_get_request(drive->queue, REQ_OP_DRV_IN, BLK_MQ_REQ_PM); ide_req(rq)->type = ATA_PRIV_PM_RESUME; + rq->rq_flags |= RQF_PM; rq->special = &rqpm; rqpm.pm_step = IDE_PM_START_RESUME; rqpm.pm_state = PM_EVENT_ON; diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 9cb9a166fa0c..a65a03e2bcc4 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -263,11 +263,16 @@ int __scsi_execute(struct scsi_device *sdev, const unsigned char *cmd, { struct request *req; struct scsi_request *rq; + blk_mq_req_flags_t blk_mq_req_flags = 0; int ret = DRIVER_ERROR << 24; + if (rq_flags & RQF_PM) + blk_mq_req_flags |= BLK_MQ_REQ_PM; + rq_flags |= RQF_DV; + blk_mq_req_flags |= BLK_MQ_REQ_DV; req = blk_get_request(sdev->request_queue, data_direction == DMA_TO_DEVICE ? - REQ_OP_SCSI_OUT : REQ_OP_SCSI_IN, BLK_MQ_REQ_PREEMPT); + REQ_OP_SCSI_OUT : REQ_OP_SCSI_IN, blk_mq_req_flags); if (IS_ERR(req)) return ret; rq = scsi_req(req); @@ -1356,7 +1361,7 @@ scsi_prep_state_check(struct scsi_device *sdev, struct request *req) /* * If the devices is blocked we defer normal commands. */ - if (req && !(req->rq_flags & RQF_PREEMPT)) + if (req && !(req->rq_flags & (RQF_PM | RQF_DV))) ret = BLKPREP_DEFER; break; default: @@ -1365,7 +1370,7 @@ scsi_prep_state_check(struct scsi_device *sdev, struct request *req) * special commands. In particular any user initiated * command is not allowed. */ - if (req && !(req->rq_flags & RQF_PREEMPT)) + if (req && !(req->rq_flags & (RQF_PM | RQF_DV))) ret = BLKPREP_KILL; break; } diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h index 1da59c16f637..4ac964eeabc8 100644 --- a/include/linux/blk-mq.h +++ b/include/linux/blk-mq.h @@ -221,8 +221,10 @@ enum { BLK_MQ_REQ_RESERVED = (__force blk_mq_req_flags_t)(1 << 1), /* allocate internal/sched tag */ BLK_MQ_REQ_INTERNAL = (__force blk_mq_req_flags_t)(1 << 2), - /* set RQF_PREEMPT */ - BLK_MQ_REQ_PREEMPT = (__force blk_mq_req_flags_t)(1 << 3), + /* RQF_PM will be set by the caller */ + BLK_MQ_REQ_PM = (__force blk_mq_req_flags_t)(1 << 3), + /* RQF_DV will be set by the caller */ + BLK_MQ_REQ_DV = (__force blk_mq_req_flags_t)(1 << 4), }; struct request *blk_mq_alloc_request(struct request_queue *q, unsigned int op, diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index d6869e0e2b64..938725ef492b 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -97,8 +97,7 @@ typedef __u32 __bitwise req_flags_t; #define RQF_MQ_INFLIGHT ((__force req_flags_t)(1 << 6)) /* don't call prep for this one */ #define RQF_DONTPREP ((__force req_flags_t)(1 << 7)) -/* set for "ide_preempt" requests and also for requests for which the SCSI - "quiesce" state must be ignored. */ +/* set for "ide_preempt" requests */ #define RQF_PREEMPT ((__force req_flags_t)(1 << 8)) /* contains copies of user pages */ #define RQF_COPY_USER ((__force req_flags_t)(1 << 9)) @@ -127,6 +126,8 @@ typedef __u32 __bitwise req_flags_t; #define RQF_MQ_POLL_SLEPT ((__force req_flags_t)(1 << 20)) /* ->timeout has been called, don't expire again */ #define RQF_TIMED_OUT ((__force req_flags_t)(1 << 21)) +/* set for SCSI domain validation requests */ +#define RQF_DV ((__force req_flags_t)(1 << 22)) /* flags that prevent us from merging requests: */ #define RQF_NOMERGE_FLAGS \