From patchwork Thu Jan 18 22:55:03 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: 10174199 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 EED73603B5 for ; Thu, 18 Jan 2018 22:55:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D67A628469 for ; Thu, 18 Jan 2018 22:55:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C8C2C28511; Thu, 18 Jan 2018 22:55:10 +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 E9F8B28469 for ; Thu, 18 Jan 2018 22:55:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932379AbeARWzJ (ORCPT ); Thu, 18 Jan 2018 17:55:09 -0500 Received: from esa6.hgst.iphmx.com ([216.71.154.45]:20883 "EHLO esa6.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932131AbeARWzH (ORCPT ); Thu, 18 Jan 2018 17:55:07 -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=1516316108; x=1547852108; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-id:content-transfer-encoding: mime-version; bh=OFYbFTNkHvzct0ZwATRhdUdD1cDaP66lmhtXzl89zOw=; b=Sc3XZy5L0lRJ67RVNV5Z0t+5LQl1elwU1HvhMVaWR5zadOsBu7EV7yFt M0YhG0u33E3vdL1cGTKdAmimSmVwZLamGjf7QHAPm3wlZhLttX8YiKbAO /VOGerVlduBQWX+CFEpTL+12tiBZZzpezuZIW6+shantIL/riGE4OKYZD sL8Bt70YAHWm6BYUG/nUFnZ5GBU+3E3JIBC04Gg98THXL0Se4eOF/yOsm wxz2MOBXhxFCSXP0b0Pu0+jnO7Y+QzXrfEkavN0TKzkGOFy+F/0MA4ftY G5DOrSd+E+pdD9MNTvnyfLhTZvyArmzDJ1iSu8KzA3MNiwCKfTZdVazZ8 Q==; X-IronPort-AV: E=Sophos;i="5.46,378,1511798400"; d="scan'208";a="69903315" Received: from mail-bn3nam01lp0180.outbound.protection.outlook.com (HELO NAM01-BN3-obe.outbound.protection.outlook.com) ([216.32.180.180]) by ob1.hgst.iphmx.com with ESMTP; 19 Jan 2018 06:55:06 +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=OFYbFTNkHvzct0ZwATRhdUdD1cDaP66lmhtXzl89zOw=; b=TaMrf79uxb+qMFXfwAAprbMzXIG8u3svfa0xtyTqW0E+JUGts61f0dJAC7XKgbiqllhE+D2DZRJO6c89bXNHF1kJdk9ZcOSARs40E/a4wmPeZPGQt2W/6jxmFfYhK1hiKlafakjn/vuDaPEWLEFes/NoISRI4J7jo6WuQK/B5tw= Received: from CY1PR0401MB1536.namprd04.prod.outlook.com (10.163.19.154) by CY1PR0401MB0907.namprd04.prod.outlook.com (10.160.160.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.407.7; Thu, 18 Jan 2018 22:55:04 +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.0428.014; Thu, 18 Jan 2018 22:55:04 +0000 From: Bart Van Assche To: "snitzer@redhat.com" , "axboe@kernel.dk" , "loberman@redhat.com" CC: "dm-devel@redhat.com" , "linux-kernel@vger.kernel.org" , "hch@infradead.org" , "linux-block@vger.kernel.org" , "osandov@fb.com" , "ming.lei@redhat.com" Subject: Re: [RFC PATCH] blk-mq: fixup RESTART when queue becomes idle Thread-Topic: [RFC PATCH] blk-mq: fixup RESTART when queue becomes idle Thread-Index: AQHTkKfyH9yE3b9g50uHm4ZmGS9HzaN6M0UAgAABfYCAAANUAIAAAOmAgAAEcAA= Date: Thu, 18 Jan 2018 22:55:03 +0000 Message-ID: <1516316102.2676.97.camel@wdc.com> References: <20180118170353.GB19734@redhat.com> <1516296056.2676.23.camel@wdc.com> <20180118183039.GA20121@redhat.com> <1516301278.2676.35.camel@wdc.com> <20180118204856.GA31679@redhat.com> <1516309128.2676.38.camel@wdc.com> <20180118212327.GB31679@redhat.com> <1516311554.2676.50.camel@wdc.com> <20180118220132.GA20860@redhat.com> <1516313920.24506.4.camel@redhat.com> <1516314239.2676.79.camel@wdc.com> <1516314954.24506.6.camel@redhat.com> In-Reply-To: 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; CY1PR0401MB0907; 7:BA5JEN/piStJyjNqYluIJ17pLzoEWpXFhOoUAiLUFomJNtMWtNPp2tLvuSHzfZkZfBwJFP5Ni7cNSHKPw4N5mYNc9D+rdgWMnGs2/pJVP8mpvwFV52+iklQm2OIbQeZf80e2DnhS0M12XEW51xAlmxzOnhREBPVYBkW/H99QyCD9xqH2Vqj0lP5iiCC9JlNmRTm8S72XInmT/yePdcxXDg45Pmqk3LBnv7oxJsHVb4fhpzXqp7LplzKTUB5bnGfp; 20:ez4mygkSutWrcMg/ocgGqivviYU8/WJNwX1lQn6J595cO546KV8+4qInFOh50wFxiNi3bKidHidDr+7/5IXUq8bepxku/X56tsTqNOJlzFP/XWzcljU2xPX/BddFaWJjKRaYHrsibREAT31fLqxhLZQdQpGcZmSmLqmcMlZkf8s= x-ms-exchange-antispam-srfa-diagnostics: SSOS; x-ms-office365-filtering-correlation-id: a66d1257-12e0-4bf7-005d-08d55ec68340 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(3008032)(48565401081)(2017052603307)(7153060)(7193020); SRVR:CY1PR0401MB0907; x-ms-traffictypediagnostic: CY1PR0401MB0907: 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)(3002001)(93006095)(93001095)(3231023)(944501161)(10201501046)(6055026)(6041268)(20161123558120)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(6072148)(201708071742011); SRVR:CY1PR0401MB0907; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:CY1PR0401MB0907; x-forefront-prvs: 05568D1FF7 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(396003)(376002)(366004)(39860400002)(39380400002)(346002)(377424004)(199004)(189003)(51234002)(72206003)(102836004)(6506007)(229853002)(106356001)(14454004)(478600001)(4326008)(76176011)(25786009)(3280700002)(3660700001)(105586002)(97736004)(99286004)(86362001)(103116003)(54906003)(316002)(110136005)(26005)(6246003)(2201001)(93886005)(77096007)(5660300001)(6116002)(2906002)(3846002)(81156014)(8676002)(305945005)(7736002)(81166006)(68736007)(36756003)(6486002)(6512007)(66066001)(6436002)(2950100002)(8936002)(2501003)(2900100001)(53936002); DIR:OUT; SFP:1102; SCL:1; SRVR:CY1PR0401MB0907; H:CY1PR0401MB1536.namprd04.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; x-microsoft-antispam-message-info: u0SdK3pstl53h6SfARziy/wI1yiBHDWNYfy9jt41iCrA0lv/NTrx6VHUZZaKn4kGvpIH0BSSadvJ5uF1CuJyNw== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-ID: <5EBDAE80C4F8E049AC4112F30A50ACA7@namprd04.prod.outlook.com> MIME-Version: 1.0 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: a66d1257-12e0-4bf7-005d-08d55ec68340 X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Jan 2018 22:55:04.0088 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR0401MB0907 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 Thu, 2018-01-18 at 15:39 -0700, Jens Axboe wrote: > When you do have a solid test case, please please submit a blktests > test case for it! This needs to be something we can regularly in > testing. Hello Jens, That sounds like a good idea to me. BTW, I think the reason why so far I can reproduce these queue stalls easier than others is because I modified the SRP initiator to make it easy to cause the .get_budget() call to succeed and the scsi_queue_rq() to return BLK_STS_BUSY. A possible next step is to apply a similar change to the scsi_debug driver. The change I made is as follows: Bart. diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c index 0c887ebfbc64..7f3c4a197425 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.c +++ b/drivers/infiniband/ulp/srp/ib_srp.c @@ -3135,6 +3135,16 @@ static int srp_reset_host(struct scsi_cmnd *scmnd) return srp_reconnect_rport(target->rport) == 0 ? SUCCESS : FAILED; } +static int srp_target_alloc(struct scsi_target *starget) +{ + struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); + struct srp_target_port *target = host_to_target(shost); + + if (target->target_can_queue) + starget->can_queue = target->target_can_queue; + return 0; +} + static int srp_slave_alloc(struct scsi_device *sdev) { struct Scsi_Host *shost = sdev->host; @@ -3348,6 +3358,7 @@ static struct scsi_host_template srp_template = { .module = THIS_MODULE, .name = "InfiniBand SRP initiator", .proc_name = DRV_NAME, + .target_alloc = srp_target_alloc, .slave_alloc = srp_slave_alloc, .slave_configure = srp_slave_configure, .info = srp_target_info, @@ -3515,6 +3526,7 @@ enum { SRP_OPT_QUEUE_SIZE = 1 << 14, SRP_OPT_IP_SRC = 1 << 15, SRP_OPT_IP_DEST = 1 << 16, + SRP_OPT_TARGET_CAN_QUEUE= 1 << 17, }; static unsigned int srp_opt_mandatory[] = { @@ -3536,6 +3548,7 @@ static const match_table_t srp_opt_tokens = { { SRP_OPT_SERVICE_ID, "service_id=%s" }, { SRP_OPT_MAX_SECT, "max_sect=%d" }, { SRP_OPT_MAX_CMD_PER_LUN, "max_cmd_per_lun=%d" }, + { SRP_OPT_TARGET_CAN_QUEUE, "target_can_queue=%d" }, { SRP_OPT_IO_CLASS, "io_class=%x" }, { SRP_OPT_INITIATOR_EXT, "initiator_ext=%s" }, { SRP_OPT_CMD_SG_ENTRIES, "cmd_sg_entries=%u" }, @@ -3724,6 +3737,15 @@ static int srp_parse_options(struct net *net, const char *buf, target->scsi_host->cmd_per_lun = token; break; + case SRP_OPT_TARGET_CAN_QUEUE: + if (match_int(args, &token) || token < 1) { + pr_warn("bad max target_can_queue parameter '%s'\n", + p); + goto out; + } + target->target_can_queue = token; + break; + case SRP_OPT_IO_CLASS: if (match_hex(args, &token)) { pr_warn("bad IO class parameter '%s'\n", p); diff --git a/drivers/infiniband/ulp/srp/ib_srp.h b/drivers/infiniband/ulp/srp/ib_srp.h index d66c9057d5ea..70334fa3de8e 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.h +++ b/drivers/infiniband/ulp/srp/ib_srp.h @@ -216,6 +216,7 @@ struct srp_target_port { char target_name[32]; unsigned int scsi_id; unsigned int sg_tablesize; + unsigned int target_can_queue; int mr_pool_size; int mr_per_cmd; int queue_size;