Received: by 2002:a05:7412:f584:b0:e2:908c:2ebd with SMTP id eh4csp104198rdb; Sat, 2 Sep 2023 01:49:26 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHHM+OBK096YNtWBi9UmTVItUK+IP+Y/N6VC3p4GodhEZY5BoFV1bWW8ay88iNgMKSztwSl X-Received: by 2002:a17:907:7710:b0:9a1:e58d:73b8 with SMTP id kw16-20020a170907771000b009a1e58d73b8mr2884098ejc.72.1693644565779; Sat, 02 Sep 2023 01:49:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693644565; cv=none; d=google.com; s=arc-20160816; b=AVIPQuo0ipdrzwg48zXr39Fw58qVEdinuw47uwz64sxdJWngntEJeZl6qGsSRnBTeP IppY7rwq1xxsGpeFkM55hpXL5n8G+Hv4wMciHPtAw0lxxGpcmmu2Wa38IYzLbMlvW100 4UvaZnpJZNvFuPnWDCFPQ6yKNg3k/W7oLLJnPDZnOGs3liU5Cpf5ILseslu4MqcSEIWw zifkWsgyAz6aeh8DfJ9BJXUKQz0x/zUrlWxHL7AmhwxW33yF76KeWavlqbU3xGzzdL9f KdQ+xpc6h6Eyls6mJrKqhFkq3ksihlmhc4Cn4r7oLZOByNqfFuzxuWjDsCOx3qyAOhPB 5bgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=OKJRR8W40xpO9XrrAtHn+zX+2fskBBtDQTTbjOAnNMI=; fh=U8QwZ5xHaU2/8ln497S/E2sKzHGkM9mdrpYdmq3DJOs=; b=neZlkxe/LdV5A4YqJejkjiiHGsV1VLZI4ILzNvPkBAWAStXSL+CCbB1XLhy/cKZ9wi TodfpIi7VBdt+v5DKimhjIBzRNnVI9MjrtwdU366UhXb+qrVVdqCoW/E2qDW3Rnlt78s CAEmDK4AblXgXw+eDdS2O/GXeS6BoSvfWSWQ4fnkub8oQoSte/PaFgG6UCHZTOLCX3xS JbupVqBseg7f6HcbLDjnSPVa3oxO9cN6lQdQw1czao1AANXUTQ2H8BrKfGRucHSe5E7F qaLE1iENdEfXXaZdUQFpW1gtzVBz8zjNxpldXIvyiinbH4xlTIuEDZ+xIRixFdO7FZQE kcHA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id se21-20020a170906ce5500b0099251942e1bsi3183564ejb.82.2023.09.02.01.49.00; Sat, 02 Sep 2023 01:49:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349029AbjIAJms (ORCPT + 99 others); Fri, 1 Sep 2023 05:42:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348950AbjIAJmW (ORCPT ); Fri, 1 Sep 2023 05:42:22 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 120131735; Fri, 1 Sep 2023 02:42:02 -0700 (PDT) Received: from kwepemm600012.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4RcY021ljdzVkSD; Fri, 1 Sep 2023 17:39:30 +0800 (CST) Received: from build.huawei.com (10.175.101.6) by kwepemm600012.china.huawei.com (7.193.23.74) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Fri, 1 Sep 2023 17:41:58 +0800 From: Wenchao Hao To: "James E . J . Bottomley" , "Martin K . Petersen" , CC: Hannes Reinecke , , , , Wenchao Hao Subject: [RFC PATCH v2 12/19] scsi: scsi_debug: Add param to control LUN bassed error handler Date: Fri, 1 Sep 2023 17:41:20 +0800 Message-ID: <20230901094127.2010873-13-haowenchao2@huawei.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20230901094127.2010873-1-haowenchao2@huawei.com> References: <20230901094127.2010873-1-haowenchao2@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.101.6] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemm600012.china.huawei.com (7.193.23.74) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add new module param lun_eh to control if enable LUN based error handle, and param lun_eh_fallback to control if fallback to further recover when LUN recovery can not recover all error commands. This is used to test the LUN based error handle. Signed-off-by: Wenchao Hao --- drivers/scsi/scsi_debug.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c index f30399a75ec0..af3d43c9db6f 100644 --- a/drivers/scsi/scsi_debug.c +++ b/drivers/scsi/scsi_debug.c @@ -841,6 +841,8 @@ static bool have_dif_prot; static bool write_since_sync; static bool sdebug_statistics = DEF_STATISTICS; static bool sdebug_wp; +static bool sdebug_lun_eh; +static bool sdebug_lun_eh_fallback; /* Following enum: 0: no zbc, def; 1: host aware; 2: host managed */ static enum blk_zoned_model sdeb_zbc_model = BLK_ZONED_NONE; static char *sdeb_zbc_model_s; @@ -5437,6 +5439,9 @@ static int scsi_debug_slave_alloc(struct scsi_device *sdp) pr_info("slave_alloc <%u %u %u %llu>\n", sdp->host->host_no, sdp->channel, sdp->id, sdp->lun); + if (sdebug_lun_eh) + return scsi_device_setup_eh(sdp, sdebug_lun_eh_fallback); + return 0; } @@ -5491,6 +5496,9 @@ static void scsi_debug_slave_destroy(struct scsi_device *sdp) /* make this slot available for re-use */ devip->used = false; sdp->hostdata = NULL; + + if (sdebug_lun_eh) + scsi_device_clear_eh(sdp); } /* Returns true if we require the queued memory to be freed by the caller. */ @@ -6167,6 +6175,8 @@ module_param_named(zone_cap_mb, sdeb_zbc_zone_cap_mb, int, S_IRUGO); module_param_named(zone_max_open, sdeb_zbc_max_open, int, S_IRUGO); module_param_named(zone_nr_conv, sdeb_zbc_nr_conv, int, S_IRUGO); module_param_named(zone_size_mb, sdeb_zbc_zone_size_mb, int, S_IRUGO); +module_param_named(lun_eh, sdebug_lun_eh, bool, S_IRUGO); +module_param_named(lun_eh_fallback, sdebug_lun_eh_fallback, bool, S_IRUGO); MODULE_AUTHOR("Eric Youngdale + Douglas Gilbert"); MODULE_DESCRIPTION("SCSI debug adapter driver"); @@ -6239,6 +6249,8 @@ MODULE_PARM_DESC(zone_cap_mb, "Zone capacity in MiB (def=zone size)"); MODULE_PARM_DESC(zone_max_open, "Maximum number of open zones; [0] for no limit (def=auto)"); MODULE_PARM_DESC(zone_nr_conv, "Number of conventional zones (def=1)"); MODULE_PARM_DESC(zone_size_mb, "Zone size in MiB (def=auto)"); +MODULE_PARM_DESC(lun_eh, "LUN based error handle (def=0)"); +MODULE_PARM_DESC(lun_eh_fallback, "Fallback to further recovery if LUN recovery failed (def=0)"); #define SDEBUG_INFO_LEN 256 static char sdebug_info[SDEBUG_INFO_LEN]; -- 2.35.3