From patchwork Fri Jan 12 22:11:16 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: 10161821 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 0F59E602A7 for ; Fri, 12 Jan 2018 22:11:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0060528AB9 for ; Fri, 12 Jan 2018 22:11:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E87E828AC1; Fri, 12 Jan 2018 22:11:20 +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.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,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 4A6A428AB9 for ; Fri, 12 Jan 2018 22:11:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965172AbeALWLT (ORCPT ); Fri, 12 Jan 2018 17:11:19 -0500 Received: from esa1.hgst.iphmx.com ([68.232.141.245]:41018 "EHLO esa1.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965133AbeALWLS (ORCPT ); Fri, 12 Jan 2018 17:11:18 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1515795078; x=1547331078; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-id:content-transfer-encoding: mime-version; bh=zKIA1bHonnF3B1Dpk9fbXQ1ZZGq8srgbkByD9ynpsEw=; b=GnkaHFeluVJAnYuNiZ4DndVmHhBLvw+UZkjPtnBTH7iUXGffGNyUaevu En54PmYN/EXUgXDtG0Xu3t5J16hylp3Bl/hlWT/wvioGSUX9W8UTvFJOs Yd+/J6qtUqedEEi81iF54OBVpiMrjwcXzEa4EdQOS5IiU6D1sK+2MWBMb mvCwo6P9u43azJdAHrdnyqevm99q1cjXFKBKy0QvUYcBNDlRwuyjtmtQC lmDzSp8QSR5VNysN5w6TI7KDUSRotahO3ks2pWTQru2bAslXR16xUtzu1 2xlEkq8vU9PDbbXszjnLXxQaBnRerJXGOnV8q2+663knE8y+lIj6KyBpH A==; X-IronPort-AV: E=Sophos;i="5.46,350,1511798400"; d="scan'208";a="171413906" Received: from mail-dm3nam03lp0022.outbound.protection.outlook.com (HELO NAM03-DM3-obe.outbound.protection.outlook.com) ([207.46.163.22]) by ob1.hgst.iphmx.com with ESMTP; 13 Jan 2018 06:11:17 +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; bh=zKIA1bHonnF3B1Dpk9fbXQ1ZZGq8srgbkByD9ynpsEw=; b=abYICf2ywdJxqP1w1f/3zZIQLvc/4Z04xMMAGQvH+iPCWCmnxnDnsuVeWpiRutRkNMWFK7wll/MXXjWyXRurBrFwShp9Vx9tD8WjdR433v+G47MU5kIMytkcKDw63lrSAhfdBQ+uboMHijxzk0K+SmZ8ePCm3Nu/RnsueL9bTBA= Received: from CY1PR0401MB1536.namprd04.prod.outlook.com (10.163.19.154) by CY1PR0401MB1535.namprd04.prod.outlook.com (10.163.19.153) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.407.7; Fri, 12 Jan 2018 22:11:16 +0000 Received: from CY1PR0401MB1536.namprd04.prod.outlook.com ([10.163.19.154]) by CY1PR0401MB1536.namprd04.prod.outlook.com ([10.163.19.154]) with mapi id 15.20.0386.008; Fri, 12 Jan 2018 22:11:16 +0000 From: Bart Van Assche To: "axboe@kernel.dk" CC: "hch@lst.de" , "jthumshirn@suse.de" , "linux-block@vger.kernel.org" , "martin.petersen@oracle.com" , "hare@suse.com" , "ming.lei@redhat.com" Subject: Re: [PATCH] blk-mq-debugfs: Also show requests that have not yet been started Thread-Topic: [PATCH] blk-mq-debugfs: Also show requests that have not yet been started Thread-Index: AQHTi++Z9uXrH88+pkWotnfADuziHaNwyGCAgAABNoCAAAFVgIAAAbsA Date: Fri, 12 Jan 2018 22:11:16 +0000 Message-ID: <1515795074.2396.75.camel@wdc.com> References: <20180112215207.17852-1-bart.vanassche@wdc.com> <78a60ddb-7e5f-3dac-2024-390e17da02f8@kernel.dk> <1515794417.2396.72.camel@wdc.com> <9ae89a07-7ade-f0c6-cc54-ed56bcc4d5cf@kernel.dk> In-Reply-To: <9ae89a07-7ade-f0c6-cc54-ed56bcc4d5cf@kernel.dk> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Bart.VanAssche@wdc.com; x-originating-ip: [199.255.44.172] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; CY1PR0401MB1535; 7:nnFdyJU80nTsfjq2SbFAerbQsQgP9qb0R0/AL+NvxhDS+Q9GjVgCH6muSJFrdNbpnh8yE5F5S30veyaeMnDgqagfFQKym65DE0/3ceg+00KyacYW/H9Pqw6P56KwqsDu19pVaBZjKLOCcUEcrSmznUj4mUvSkVCFHzBEkCznG5VhJw0Bzuf4ouQAINQDiFsWqKmMRVNYNLcE7wW46uPWLUkFycZeKcZx2tXG/EbYzpfqeWzNUy6Z+kBpX+J5Atn4; 20:tllYRDvpb9TgcU/z08G4rLbGPvDb0PDSm8Q6s2x9zETcZMvUy9jpNpHiPfldLQWorNLSx4htS0pyBp1Ma58jzyrXyES1BX+3l68zy4/MuqUwKBpCBsJPsu2O9u3o7XjJWlCe/mDZdvxWhQjwMFZqBDF+9zmvlp6Y9fP/8DHsPVc= x-ms-exchange-antispam-srfa-diagnostics: SSOS; x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: dee36ef2-fb10-4d18-0bad-08d55a0966b0 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(48565401081)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(3008032)(2017052603307)(7153060)(7193020); SRVR:CY1PR0401MB1535; x-ms-traffictypediagnostic: CY1PR0401MB1535: wdcipoutbound: EOP-TRUE x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(5005006)(8121501046)(93006095)(93001095)(3002001)(3231023)(944501075)(10201501046)(6055026)(6041268)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(6072148)(201708071742011); SRVR:CY1PR0401MB1535; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:CY1PR0401MB1535; x-forefront-prvs: 0550778858 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(346002)(39860400002)(39380400002)(366004)(376002)(396003)(377424004)(189003)(199004)(24454002)(6506007)(3660700001)(3280700002)(316002)(229853002)(53546011)(105586002)(6436002)(4326008)(77096006)(54906003)(5640700003)(6486002)(25786009)(103116003)(2950100002)(59450400001)(106356001)(2351001)(3846002)(81166006)(86362001)(97736004)(6116002)(8676002)(81156014)(230783001)(102836004)(8936002)(6916009)(1730700003)(5660300001)(2900100001)(2501003)(68736007)(76176011)(305945005)(2906002)(7736002)(36756003)(93886005)(72206003)(66066001)(478600001)(14454004)(6512007)(53936002)(99286004)(6246003); DIR:OUT; SFP:1102; SCL:1; SRVR:CY1PR0401MB1535; H:CY1PR0401MB1536.namprd04.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; x-microsoft-antispam-message-info: z4wsmi8lAr+aC/JXTJzthldvFA6LbEsQJa/rRaYRUsSHm/6+KuXTwFf7Hug48BkDjCyEV7RL/RPFwmVEdUv6ug== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-ID: MIME-Version: 1.0 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: dee36ef2-fb10-4d18-0bad-08d55a0966b0 X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Jan 2018 22:11:16.5140 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR0401MB1535 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 On Fri, 2018-01-12 at 15:05 -0700, Jens Axboe wrote: > On 1/12/18 3:00 PM, Bart Van Assche wrote: > > On Fri, 2018-01-12 at 14:55 -0700, Jens Axboe wrote: > > > On 1/12/18 2:52 PM, Bart Van Assche wrote: > > > > When debugging e.g. the SCSI timeout handler it is important that > > > > requests that have not yet been started or that already have > > > > completed are also reported through debugfs. > > > > > > > > This patch depends on a patch that went upstream recently, namely > > > > commit 14e3062fb185 ("scsi: core: Fix a scsi_show_rq() NULL pointer > > > > dereference"). > > > > > > Why don't we just kill the check, and dump any request that has a > > > matching hctx? We already know the bit was set, so just print > > > all of them. > > > > It is very helpful during debugging that requests owned by a block driver and > > requests owned by the block layer core show up in different debugfs files. > > Removing the check completely would cause all requests to show up in the same > > debugfs file and would make interpreting the contents of these debugfs files > > much harder. > > Yeah, we'd have to make it just one file at that point. I'm not hugely > against the queuelist check, but probably warrants a comment as it's not > immediately clear (as opposed to the idle check, or the previous START > bit check). How about the below? Thanks, Bart. diff --git a/block/blk-mq-debugfs.c b/block/blk-mq-debugfs.c index 19db3f583bf1..da859dac442b 100644 --- a/block/blk-mq-debugfs.c +++ b/block/blk-mq-debugfs.c @@ -394,6 +394,12 @@ struct show_busy_params { }; /* + * Show "busy" requests - these are the requests owned by the block driver. + * The test list_empty(&rq->queuelist) is used to figure out whether or not + * a request is owned by the block driver. That test works because the block + * layer core uses list_del_init() consistently to remove a request from one + * of the request lists. + * * Note: the state of a request may change while this function is in progress, * e.g. due to a concurrent blk_mq_finish_request() call. */ @@ -402,7 +408,7 @@ static void hctx_show_busy_rq(struct request *rq, void *data, bool reserved) const struct show_busy_params *params = data; if (blk_mq_map_queue(rq->q, rq->mq_ctx->cpu) == params->hctx && - blk_mq_rq_state(rq) != MQ_RQ_IDLE) + list_empty(&rq->queuelist)) __blk_mq_debugfs_rq_show(params->m, list_entry_rq(&rq->queuelist)); }