From patchwork Tue Mar 7 10:55:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 660969 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5B0B9C678DB for ; Tue, 7 Mar 2023 10:57:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230410AbjCGK5J (ORCPT ); Tue, 7 Mar 2023 05:57:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42518 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230332AbjCGK4m (ORCPT ); Tue, 7 Mar 2023 05:56:42 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2858958B69; Tue, 7 Mar 2023 02:56:42 -0800 (PST) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 32783mut003734; Tue, 7 Mar 2023 10:56:38 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=UUx/WZkYVdmToGLEBcLIF4hOlhZTRZatODE906Il2VA=; b=y7xlyzwrIekPrgK18mQgqDRa1AQvkUGKdDHsGxEEU7/6n4CvQN6LdgPsSS68SLQFU+p0 PdrvCigZcARO8pX4ItMBrAB8hHCuSqEMNGVOfMUjkX84rMDVkGJLS9mkjYLfM6qtfVfb 7eFmiAc+oMhptdTJa0gKnFjsR4YFFmssqwplvMGGcJZBm3BVlJYsdixr0tyOilZLDRh8 CdFFU/YSYQmQ742Qvg6Jzp6NYngwbV5zhWagepo53cyDU5RQ3Dqb4H1ausqp9pNsltVK vfdZ+/X+TRocVmYYINzIcumvJoUYLR3S94KdCr30G3uwVRffQ23Y5LjORDBgPSjCf/19 Pw== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3p4168n72m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 07 Mar 2023 10:56:37 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 327A0S68019086; Tue, 7 Mar 2023 10:56:37 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2172.outbound.protection.outlook.com [104.47.56.172]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3p4tur3wkf-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 07 Mar 2023 10:56:37 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oefmHwhqmOzNR3M7lwJ96cgaPHsLRHj2DCxIsUjwEIVwpauvDtdL20ijc3KkpNx5t7OJaVT750c/hL2y+xMFrHR/7qBVZGdeaLvb/7doTdEmn6FEc+B83ZeifSb8RkSnqImsyXILQG9hRE4ipkrcZiX6P/mBQDOpl8GMBwOYlApv+QDchlsjTeCyPhINgHf9EaCI9DlpElrgTncWAOdqlEaJ2BlNw0AP33d/iDxFeQ1oeosvZ7IfItAUdVX9q5p2Qxf6XF/Sxbq6fnFGMSwnyuNhuxOczHljP+Rcaai6frv+XZOFFaeBMecNCvUOrfvaieSocEYu404WbsnZ0RKAUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=UUx/WZkYVdmToGLEBcLIF4hOlhZTRZatODE906Il2VA=; b=YsgcLfrFDpfVC6JcGnEnnS3YoLN5GEl+LAfKuPUcEjdhgFAySCDf06EAo7o9sWdoFD0mAb931NkpcnIqC70B6uqYzyqaE66iB+cPPdWLRYZq5PNirck/LkA6APEYr9ezczHhOuAguT8b/xL+Bz+n6I/NelYu37HZsHq/5sn9OJEhZcLkXoO9ZY3AQN+ZToVnBodM/e615qpeZ4Jr8GjRPdDBErhfuK70GX0Xfo8SVVRYCipdv6DU+2qBxdev7VawdU8huk5Lhbsk+epJmvssO5pH4NkpCrewlkKxklfP3We1PgtQJ/BIEb7J2DRlui/zCy2sK8Qt7FIjqzmrabxsDA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=UUx/WZkYVdmToGLEBcLIF4hOlhZTRZatODE906Il2VA=; b=f+xarPhXlsYExLIoh3C6nviQQ3bDbb8q90LuRc0PAiGFwGkKOUXLeOqcEHd/pRlHM1/qdbL1k55Mgp24fTGXKeyIxgtVx7pQA91/jTydk3HbnMd8xMFJyJE76e+iK3Efh5ezcGCSYvm4JhQrBBDSLv2tkF9D52DW7cOQ6ilWSRw= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by DM4PR10MB6719.namprd10.prod.outlook.com (2603:10b6:8:111::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6156.28; Tue, 7 Mar 2023 10:56:35 +0000 Received: from DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::fff7:981:3ae6:92eb]) by DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::fff7:981:3ae6:92eb%4]) with mapi id 15.20.6156.029; Tue, 7 Mar 2023 10:56:35 +0000 From: John Garry To: jejb@linux.ibm.com, martin.petersen@oracle.com Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, dgilbert@interlog.com, John Garry Subject: [PATCH 01/11] scsi: scsi_debug: Don't hold driver host struct pointer in host->hostdata[] Date: Tue, 7 Mar 2023 10:55:45 +0000 Message-Id: <20230307105555.3745277-2-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230307105555.3745277-1-john.g.garry@oracle.com> References: <20230307105555.3745277-1-john.g.garry@oracle.com> X-ClientProxiedBy: DM6PR08CA0018.namprd08.prod.outlook.com (2603:10b6:5:80::31) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|DM4PR10MB6719:EE_ X-MS-Office365-Filtering-Correlation-Id: f6fbb336-755f-4392-3df8-08db1efa9e83 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Nc9CiNDkf+hSGVfpYPW8qBZQKjdneuwlgCE668mDT6mTbW+z5sNu2LqGo1nJlFUHhac33eBDiYKoxtC9DheO3j1K4m1/MkigT1BkOIinPAN5ikx6GFgTlgfxoHrozcMl9CPC0fW3IhQgsHkKffmFVXeqp2ntgCykOTGoLEEAVjVwLvaGeSPgR6grxvd/RVXVBjRvo9fralZuCeslrfkvewIBDNVH8OYVjjJat6qgZokpUmGCgdfUI36OQSTqFYYU4RaI7OxeJWPBOhwmSSX3sSZRofJ8stnAtceCzrYJNrMafeirnKa0KlVB4bhKaC6OAJVvPaLi6cQfV9orD3oBnp7JC4BkR5smtxIuRQ8aVH5Z/zkWwn6vrJraxpKji+OHwwXMEimqXHPjjx606caCw0RRtngz62k9yvlVZErwtwxp9IX6f0aJa4bTGVZvLLRddJx6rHqRfzP8yg4uXAuPu1gxdWzBqCyOHHaBRhJUgIE/feD4I/8EWweDVX3RfHlZGQvj01m64AparswHH+9O9GCAv9Ju6hgC76g2xe1ofHJaNOn+MrZFYlC/9UQcByBCC5rzkUz1qnYVyLt+3Bh7BhRuaUUdS14h6niix51iPkOM3AbIJQJJ5fUXTcIaxcsL8FxfUiUNOk/YHqyEzOWrXQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR10MB4313.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230025)(346002)(396003)(136003)(376002)(366004)(39860400002)(451199018)(103116003)(66946007)(4326008)(66476007)(8676002)(41300700001)(83380400001)(2906002)(86362001)(38100700002)(8936002)(36756003)(66556008)(6486002)(478600001)(6636002)(316002)(5660300002)(26005)(186003)(2616005)(6512007)(1076003)(107886003)(6506007)(6666004); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 72PhEd4a7nRXLonq+hWu17ldCYoL8aOALjMq++CXUcuWMFnZblK+aW+G31RoDfWHwHAebYgo5rS9HEvCP9rheNRWl2gc1v9mdHMGCDGMBDTlpp70/CUDyEL7kUhXLUQaAogzjqAn+iZDsm6AcxcwERflFoducOW+5aBbSIapoO+E79p6XneBw9wTr2l7MPCzGT7/e2rsN+JI3n/iH5g1IhI4lDz+UMvC7po6mKJl+Lk2lGL1Mvgz7jiiqPPWn6XLx0JmsIqZvAVhVMjM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bMpGxrrudYYBv5JhE8nTAj+xyOTjHKeF1b/WdsVE0VMP11LTUXkb3wbAPERczwfEVS+WUY7s6rtiqPCi18GrxIdvdIPeuMWTI7EEwLfmzucrIXCtElGEA== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: f6fbb336-755f-4392-3df8-08db1efa9e83 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Mar 2023 10:56:35.4209 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: UEnGxjAnaDdZKqxlqDVFfO7rRE8xibep81zpbD5x/YMjMMwIdBf1MM8CqxLKQ9DOCLXrNZcyegC/U3zzWvCDRg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR10MB6719 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-07_05,2023-03-07_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 bulkscore=0 malwarescore=0 spamscore=0 mlxscore=0 suspectscore=0 adultscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2303070098 X-Proofpoint-GUID: R4HA9_baB0-7FUuD-X6ibh78GURuQ5BA X-Proofpoint-ORIG-GUID: R4HA9_baB0-7FUuD-X6ibh78GURuQ5BA Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This driver stores just a pointer to the driver host structure in host->hostdata[]. Most other drivers actually have the driver host structure allocated in host->hostdata[], but this driver is different as we allocate that memory separately. However there is no need to allocate this memory only in host->hostdata[] when we can already look up the driver host structure from shost->dma_dev. Also remove a check for !sdbg_host in find_build_dev_info(), as this cannot be true. Other similar checks will be later removed. Signed-off-by: John Garry --- drivers/scsi/scsi_debug.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c index 226139a8aaac..f713117a5f2e 100644 --- a/drivers/scsi/scsi_debug.c +++ b/drivers/scsi/scsi_debug.c @@ -327,6 +327,9 @@ struct sdeb_store_info { #define to_sdebug_host(d) \ container_of(d, struct sdebug_host_info, dev) +#define to_sdebug_host_from_shost(shost) \ + to_sdebug_host(shost->dma_dev) + enum sdeb_defer_type {SDEB_DEFER_NONE = 0, SDEB_DEFER_HRT = 1, SDEB_DEFER_WQ = 2, SDEB_DEFER_POLL = 3}; @@ -5168,11 +5171,7 @@ static struct sdebug_dev_info *find_build_dev_info(struct scsi_device *sdev) struct sdebug_dev_info *open_devip = NULL; struct sdebug_dev_info *devip; - sdbg_host = *(struct sdebug_host_info **)shost_priv(sdev->host); - if (!sdbg_host) { - pr_err("Host info NULL\n"); - return NULL; - } + sdbg_host = to_sdebug_host_from_shost(sdev->host); list_for_each_entry(devip, &sdbg_host->dev_info_list, dev_list) { if ((devip->used) && (devip->channel == sdev->channel) && @@ -5409,7 +5408,7 @@ static int scsi_debug_target_reset(struct scsi_cmnd *SCpnt) hp = sdp->host; if (!hp) goto lie; - sdbg_host = *(struct sdebug_host_info **)shost_priv(hp); + sdbg_host = to_sdebug_host_from_shost(hp); if (sdbg_host) { list_for_each_entry(devip, &sdbg_host->dev_info_list, @@ -5442,7 +5441,7 @@ static int scsi_debug_bus_reset(struct scsi_cmnd *SCpnt) sdev_printk(KERN_INFO, sdp, "%s\n", __func__); hp = sdp->host; if (hp) { - sdbg_host = *(struct sdebug_host_info **)shost_priv(hp); + sdbg_host = to_sdebug_host_from_shost(hp); if (sdbg_host) { list_for_each_entry(devip, &sdbg_host->dev_info_list, @@ -7821,7 +7820,7 @@ static int sdebug_driver_probe(struct device *dev) if (!sdebug_clustering) sdebug_driver_template.dma_boundary = PAGE_SIZE - 1; - hpnt = scsi_host_alloc(&sdebug_driver_template, sizeof(sdbg_host)); + hpnt = scsi_host_alloc(&sdebug_driver_template, 0); if (NULL == hpnt) { pr_err("scsi_host_alloc failed\n"); error = -ENODEV; @@ -7864,7 +7863,6 @@ static int sdebug_driver_probe(struct device *dev) hpnt->nr_maps = 3; sdbg_host->shost = hpnt; - *((struct sdebug_host_info **)hpnt->hostdata) = sdbg_host; if ((hpnt->this_id >= 0) && (sdebug_num_tgts > hpnt->this_id)) hpnt->max_id = sdebug_num_tgts + 1; else From patchwork Tue Mar 7 10:55:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 660968 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7FB86C6FD1E for ; Tue, 7 Mar 2023 10:57:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230425AbjCGK5K (ORCPT ); Tue, 7 Mar 2023 05:57:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42514 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230362AbjCGK4m (ORCPT ); Tue, 7 Mar 2023 05:56:42 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B6397574FE; Tue, 7 Mar 2023 02:56:41 -0800 (PST) Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 32784Cv4001853; Tue, 7 Mar 2023 10:56:40 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=/WSKckEbUSVt5D7kzGlMREy+vUNR4zK/sl6IpcEUTi0=; b=1S5cLbU1bcMzZ8l9I5Cdt78vTs8qYTWWxTzUDDQvgqjEbPO5DYvdCyW0OBCuEpnVSwry VwFAZI5ERGMQV3OzeYrO8CCHhTZMMOAUgd1AotDe5tRiZsgyr8eDrSVM6wUuc5RLAvMR k0MYl5v3T/U3uYHvBlCKDU/SqK6wkodmVhgy2KaQbYXUBRJqwA8RfMP3pjwmYugo9dbd 8+/SgKrmLWxPMC2saLkF5vqLQ+E4Zto8g+GK+hpiXW1cFvB7Bj5es0HuFcrfjya/u60V cFl2dSOWp2N3JR4TBWujBCEeEYbWtOXjdr5Y4HTkFb+R9QzW/KZpxPEoWPKwtWf/mtLV yg== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3p415hw875-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 07 Mar 2023 10:56:39 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 327AY0gZ023444; Tue, 7 Mar 2023 10:56:38 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2172.outbound.protection.outlook.com [104.47.56.172]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3p4u062k94-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 07 Mar 2023 10:56:38 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CgrFiXK3+PPt8KUrwbw0QEKCSAQWE5xZRCixhhSp7/zFj8ncWcrMrHkxAUbjAO0cMhUGsB/Hz0cQnMK/SDv+Ua2Lg+GMYueYX2bR7bzrFcwfTJhXvL6Q33NYQqAP8WpWGQbKFgUrCR1qxQgL4ADdbTOSZxyRVWA9PJtGSTKRjhVqtj7a7fSv7ZjcIXRfHFxf9ISg+6GS7uNWsC1nYy/Y8sJzSt1+6uYY9HSdW7jLKUbtmkrc6l2o+Q23tpF+vKvmlqv2lSJejnEHVcO4EFTM4LfQgJjzDh5DgMQYrSDs6O4qQXGU51Hexlqw9WX21Rds4eZ/d1EA7FR3oGdt7jsWzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=/WSKckEbUSVt5D7kzGlMREy+vUNR4zK/sl6IpcEUTi0=; b=mYvyA3Ev7in4lIWi0wdih9wh1gYNtVLchrdMIQqABljlpQr9xFkwb9SHg0QaDkHzYc+2oXPzqoXGmByrnFKVxscyxgjtHZ0KOtMAynyd4cLT4YhI7c/tJ2lb8vVXMGrTbQ0rT2Fu7T9hBl2tGhyTxc3wsLDzU5IDJ0zwS78NrbBXQAhRsyHLo8rj8a+sH9T58xnKlVxAWeVRpKc8/ZB4vnZ2Om4q0AKFZ6YVD/9MVFJqti4zkNstlV5MP6t+yF3tRQEPiQ5zSF6NuI5SD9FL3Tkyw7SJOWYCT6i8Hvco6NK4ZqcvGMGULwK7OxPrswODr0RX8RPSqaLfNYOc+6LmIA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/WSKckEbUSVt5D7kzGlMREy+vUNR4zK/sl6IpcEUTi0=; b=X0TizPFTLiHOXNGkA1yMugIrglyIH0W/ZQnc7QsEudR4+955Yga2Mt0TJeqyOReQ/H0RiZoU2lSudOVYghOJcPKYqSoxFgdivZp09qQLy22yaoqUIcNKtTG47nNpMOY1qw9Ciravh+MckCBkVsaXHhYEqoD6iZbII6uf5wQ3WNM= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by DM4PR10MB6719.namprd10.prod.outlook.com (2603:10b6:8:111::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6156.28; Tue, 7 Mar 2023 10:56:36 +0000 Received: from DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::fff7:981:3ae6:92eb]) by DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::fff7:981:3ae6:92eb%4]) with mapi id 15.20.6156.029; Tue, 7 Mar 2023 10:56:36 +0000 From: John Garry To: jejb@linux.ibm.com, martin.petersen@oracle.com Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, dgilbert@interlog.com, John Garry Subject: [PATCH 02/11] scsi: scsi_debug: Stop setting devip->sdbg_host twice Date: Tue, 7 Mar 2023 10:55:46 +0000 Message-Id: <20230307105555.3745277-3-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230307105555.3745277-1-john.g.garry@oracle.com> References: <20230307105555.3745277-1-john.g.garry@oracle.com> X-ClientProxiedBy: DS7PR03CA0173.namprd03.prod.outlook.com (2603:10b6:5:3b2::28) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|DM4PR10MB6719:EE_ X-MS-Office365-Filtering-Correlation-Id: 5247c82e-2f8d-4304-9b93-08db1efa9f60 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: z2IdmTSeA5luFjxZ9tYWLdxeUpX1F9YeqyxlbBKmVtBPcC48/kklF0iY2YjM7N7tDwUWGnU1RM+7LgadL/GpXemMk4jWmM38v6DPf3zoT8gfxYOXLqsdup5qv3IwU988Ho8vM3ja+72bx1RJ5bD5fPqGZtSmdgmYNB/R+wuWsDCpc7qaPVBkN9uul4STBR1ohojFPSeMG8v6RwUjKJiNm0FPxo58XkvxZF8up3ctQKBOz9AWDeH++jgrH+DbudgTZlVaQeu5I8svs0NiMHG3WNowm5JVfH72ctPQ0sFtPGeArGM0ELT/GjIthikEHXOfij+3PKZ9x2GdGPp2dfCs9ET896Ln9E/dCv3AgCCQdtEN3bR1ZwwHn45lqUDS+TsOmjDNukteniOyfNRTa9QvouHtNGLpCaMx8OAEn4KlaCVVo4U8Ou0syIX1r4kuQvxind9UNHiQhltG44lYlNtuFYCaqbiGkR3Evz7iqHdFD6KGDw1CwfZkF+9aCzJpYyPAyBAvpm64ZuEmqWcbCca7PcgNS40Ydq8k42R+KOUuf69uNwbYSk6QL0TOCg5qc7KJ74fFiTyOBIfE5750iDmwgDhfJZPetaxKzMEzUvUm51P6Vd/J6/x0Mu+hzTyxGdjouDMtpY2JZNEzg/ldQHwcIA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR10MB4313.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230025)(346002)(396003)(136003)(376002)(366004)(39860400002)(451199018)(103116003)(66946007)(4326008)(66476007)(8676002)(41300700001)(83380400001)(2906002)(86362001)(38100700002)(8936002)(36756003)(66556008)(6486002)(478600001)(6636002)(316002)(5660300002)(26005)(186003)(2616005)(6512007)(1076003)(107886003)(6506007)(6666004)(4744005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: HJQo5rr/iERpgInslEdUaQk46xYef/I3elqPDSvq9h+ykkeRwMZTBpsTr/6JSR7Wxpg2KCnVPSmhVOITL37Ttl8f9JbdwwHG5yGCKZhyr5p6GZlVo6bAFjRApFtNFI29hAtOOhyF3ugPqZ3t6ZGmuVtiAEnC1c1ioV9YCm1DFWups0KQ6q2NNh2dhgJocAM5EkkcwaX3oivGHtxq6Y5N5GfzR/hJHmJjtTSaLyMwX+zwpmLicVFN+eO91dYS3FJNNbM4D2+7NTOOdY6zAGWwfm8LAC9TZczZpjrl3Xe0uOSOujRAow5CbUBqMHGN6JwTUKNetKQVBoKTGf1YKk8JdAKpaDgXOTrxZkTJ67QALRa71teqMj+peE/E4NWjgf3H4Opyp8Eat6Piv8eAY8VAbiAYk7SQKLjsfHuVLr1g3oo/0F/DKQ2On5mrOOp9ihj3jiiWqp9vUdhdNlu8pgmNbLy9bT4T2ipcBUZ52tg8bxDG4FPZioQP1CeCG35mOglxla3gqFFRyGazCI4TQqK9vngtoCGRkMtC/vcI5qZXNBI59dfokTNmc71T4Bh51auDmW/xBC9FjVrn02hpKXCtKZ6x86yCrBqn/WlGgd5yR3lMalmUo0ed+H0v0J9fyrqOZkqg3YSPj7naCFdydgfUGFc5nu6BKL4G+BxLitci1yrxtuQA0ozWCSY1FG3SwsoIOHPp0fH+IUARKDyxLahEhcNkzxtiTifyTj7n1dhDc20XbT8zVBO2Gocu4g0DNem+nL+Ic0j54jgJwzjujtqmzQO2utaoDHpm9gvkMohT86qsZTG9gsUMNi8SFRUiyGga85fTKO1QdwV802MUGOTIxywEc51d7caPmjbix4/mUvcjSFk9u3oQPuBz8bo4tBRNidf1USKG4g6iYRSI4oGEcnE0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B857/tXiEW9vDvzUV2LbCtUEvLzYZuVgSEH5n8spxozm4YPg6p+zXaPQ6XE1Mu8yL8b8W9mvVeHpI9KIQfCSBdnR/r2/24jwchQMabrQz7FA0cAMkDQFgSCEyykSRooAW1Bze9JUOQCRS3o5w4rkv7vmjvteq/J8BxCCTTdQ4K1bQPe/jguof3Xmt5RgTcHDyOtgWu5ASbOQ5dAz0C8vb9RjRZNgOxAhe6d84iJQdgs3gnDTDhwZBinS5UulwHVdraQsIssX8/slOrrzbGtlpNDdz0o7SiurpBYW1CQNqMj0TKlB7y9AgolrTKmpk48X9sm83UsWzfz0KFyGd5wAUT8gb4w/TU8/aoqs4yiQz6dBwNj7c+8//wmTDAuJqT2k4jBz5F2RN5dXKtXllR+hCZ+dJi24z00u210g1GAlZW0kKoYf2oiSbu+atClmZBfpBusNRngBcq5qlfm0FnW4QLyuzCj0QLPOki1Qhz4DwFOtziDQsqbVcRIwmSFs4WXGTzEB6gSjPAhhQfhv6TY1/kggs3iWxvnq1WGxx/U10IUbA== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5247c82e-2f8d-4304-9b93-08db1efa9f60 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Mar 2023 10:56:36.8404 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: gW8HditmiujQDiGJtB7njh2BmE+hOIuCUp5d0DWDgBwMqQzfg69Tvtt2XOoBpZ8uWKg3sW6EOfmvdLoP7vZvxg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR10MB6719 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-07_05,2023-03-07_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxlogscore=982 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 malwarescore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2303070098 X-Proofpoint-GUID: eScSKhL36Jp0cz6-pafRoO3dcs1hCumX X-Proofpoint-ORIG-GUID: eScSKhL36Jp0cz6-pafRoO3dcs1hCumX Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org In sdebug_device_create(), the devip->sdbg_host pointer is needlessly set twice, so stop doing that. Signed-off-by: John Garry --- drivers/scsi/scsi_debug.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c index f713117a5f2e..6d1c483a0a3b 100644 --- a/drivers/scsi/scsi_debug.c +++ b/drivers/scsi/scsi_debug.c @@ -5157,7 +5157,6 @@ static struct sdebug_dev_info *sdebug_device_create( } else { devip->zmodel = BLK_ZONED_NONE; } - devip->sdbg_host = sdbg_host; devip->create_ts = ktime_get_boottime(); atomic_set(&devip->stopped, (sdeb_tur_ms_to_ready > 0 ? 2 : 0)); list_add_tail(&devip->dev_list, &sdbg_host->dev_info_list); From patchwork Tue Mar 7 10:55:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 660384 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 974F9C6FD20 for ; Tue, 7 Mar 2023 10:57:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230440AbjCGK5L (ORCPT ); Tue, 7 Mar 2023 05:57:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42526 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230368AbjCGK4n (ORCPT ); Tue, 7 Mar 2023 05:56:43 -0500 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E0E9A5BC84; Tue, 7 Mar 2023 02:56:42 -0800 (PST) Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 32784PwB032149; Tue, 7 Mar 2023 10:56:40 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=o4av/CFOGKxbDVobMIKS3lljhvLbxcIxCcQaIFhrjWI=; b=bIKS5zQzAz76cVxd/nTJuGJ6i8joXtlwfkXtDXlbHbyI9UnoHiHmAZf9JYzAYHJQiee/ MSq58KStZdCAYZhg29wqEvyxYCZL0E0rkZag9KZL4dbak/x4T/NGbxlyMJIKYHokkQud HQkrwAr+cm75NGlNc0eHVbE4Q+ZV31kOkI7YDPQ1Q5kHHeccSv1sqiZZKMDDSkboUBfV dDU2npbKjJI7BsRGHye03j5gdU+tSD8nGalpHAO08qr014lL7fNkkcxX2XkOionERyLz 2FFZyeJU9GJ+zYIALEAVVXPpAFvuvKqiJM4PvxXIzNQbei1tmqe3cwHqYWX+jDc2+8Yt Qg== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3p418xw7hr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 07 Mar 2023 10:56:39 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 327AY0gb023444; Tue, 7 Mar 2023 10:56:39 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2172.outbound.protection.outlook.com [104.47.56.172]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3p4u062k94-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 07 Mar 2023 10:56:39 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=I9+exblbhcaHIaakYjunToRLjckFTU27/V6W5I2nVOdWMJaVxu48QQS5CbVK7VDWH1E21QvZC9UoISNU/3JxgLEV4yXbpjS3tir98IneczpcHihGY0fuglEoGLWMEcTp+JjyZmPb7VJGmL035UtDbr7R0FGizmXp++RG9o+jmof9j55p0dIiGjMCqzngQ+45wqLmifxTYLjSkF/G7XmppQj/egC1wXm+0+vYKywIOWJSsLjOa0Wq7nY2o/yMmKTG7Jeb35MCb/gX9aaCkaCFMFeWFQ+5BKHMyP7GuondYkF6eY175/APsFjGNEnh9Z1miWAYG2kxiqBdswiJxYNMNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=o4av/CFOGKxbDVobMIKS3lljhvLbxcIxCcQaIFhrjWI=; b=bq+JIotiliErxlxA1IieNaJhzaBgtiJ5kr6BE9zHMpH3sXGV/tMaIOAx/BJoR/ZnTLL7iKOlLNaNf5ufFKRmESrpDGAyX61tsiPYALA+wBXE7LAxAIfdtDuEF+QddzElCDkkJn6LRN6w9CToIJsRLQnV7+Rn6mBftpGFjeBzjqB7nUEX7JmmpKGz0MDObCOozONu21NhvLOagbeXC7KyeSbZAE6/9vu9ozM+yiGETZYqzDAjIrOipaHA/SmFpqmOdoETze49QtSZFUbod+Pj2RNvCHdWAo3MgEaTEU3h5AvEGq/wc3DjBZnZ2d5GPooA68D8nyG5sWSq/5hDPSpH8w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=o4av/CFOGKxbDVobMIKS3lljhvLbxcIxCcQaIFhrjWI=; b=cq4YIQ6LeeJXGQtecqhsh9onIP7a40loANuTJNEDui62P9lqAJjaA1AGLVad1IzNxne2tlfUfJKBJgN1VYJGmdDlubQQtJqC1yC744WoQfCEZC5ref49p4Cn7XmBdxGQTpLdSSEOqTkKpiNsyg3ZLDVpYEfNHreK2lOdPDj03LU= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by DM4PR10MB6719.namprd10.prod.outlook.com (2603:10b6:8:111::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6156.28; Tue, 7 Mar 2023 10:56:38 +0000 Received: from DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::fff7:981:3ae6:92eb]) by DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::fff7:981:3ae6:92eb%4]) with mapi id 15.20.6156.029; Tue, 7 Mar 2023 10:56:37 +0000 From: John Garry To: jejb@linux.ibm.com, martin.petersen@oracle.com Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, dgilbert@interlog.com, John Garry Subject: [PATCH 03/11] scsi: scsi_debug: Drop scsi_debug_abort() NULL pointer checks Date: Tue, 7 Mar 2023 10:55:47 +0000 Message-Id: <20230307105555.3745277-4-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230307105555.3745277-1-john.g.garry@oracle.com> References: <20230307105555.3745277-1-john.g.garry@oracle.com> X-ClientProxiedBy: DM5PR08CA0048.namprd08.prod.outlook.com (2603:10b6:4:60::37) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|DM4PR10MB6719:EE_ X-MS-Office365-Filtering-Correlation-Id: b369364e-8b16-4e4e-c03f-08db1efa9ffb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: E0UnyYNkLPjw2Y0NFMhyv2hRwQrl7t7qTGkAPUdwVtTyZe3n3PFwXvgA/rYZsNz0nsDBHJ4ltQyZ70pUd2mQsmIXV2xqEjUevJWg4Ily87Pc0/qMYnXv3sgC9+yTHN9f2HNh6zSDJKEIqMsYhVXwYRvJXnFniN7iZJ6onDWAWDzJdYE2rNmPTTOrA/NLRQc4QMvqwYDt2++NwZE3nZFDLygk6NBGpeQFFuIFeSgvJMyyenh6pe1YX2tQ3pINmL1Kdx2dDqZp2eC7IgZ+6OAcjnFft49clSlSMsNL+rp4ve5wQSTlXkdOaS1sZmRZ3PYdIJMlvwEP757VNCBsWtbxtmBh6OSE5S6gWLFeqC+aGpK3c5B1HwfFyVXUYRoXPXrKKJlPeOG1WxRfJhT0WhnZyU8sJHB7bVjYSwbk9wpds2O314bae/PVwPsnCeMT60RtyXGEuYX+S8D7Sm4KF8NY5pkJoRuzeZZKCtHCCvgOydIOg/uT0vDMesTDY900aeOcRVhx6jqZlGMEt4I0WiK5dF1YL+Eco1zsyBDCjHZMBAgjR9Er7WDFuUhAu7tj+XEXKgOwn2oAv3d+3OJpQh4w1qcj2Yt6f/9Sl0VmbYVE5QgsPsRCjOFy4HZP3IQaC5IiayxPOHr/tR92nqWC49PAbA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR10MB4313.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230025)(346002)(396003)(136003)(376002)(366004)(39860400002)(451199018)(103116003)(66946007)(4326008)(66476007)(8676002)(41300700001)(83380400001)(2906002)(86362001)(38100700002)(8936002)(36756003)(66556008)(6486002)(478600001)(6636002)(316002)(5660300002)(26005)(186003)(2616005)(6512007)(1076003)(107886003)(6506007)(6666004); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: lhhDvMvLOEwxtWeFu7GtFzpjB9Zt6g5P6LHcS9mNDLMP86jc61PqMkuTvFjQ8NwT9DLqRL/tOtvcQTOk0qfeI7ofOrFzrPet5SaVezPGHKzmmZC08m34v0AIGWPmxslqFcXxrIGkgiG8j3eTmx5U2U/MQg95xuyYVc59w82KEn2nEmbP6Q/lRQtEhKDRAB35tt4TFuOkSf7ZrGbm9/PtSJwBTr+cHqmGnciy1vXzae4YpEXrgE6e/TlXtJ7hFFZuc01tL3Xfa7+U5qYALvGpfF6z4U5sdSSXATAj/YkF9EZBLPSFJMrEBAwjtXHu8A35MkqE4TRpLjl8WRP6NkebXvnD4sxdvCrUP87gWaW94sZ41OomYd6rMzqsw2AEjXmtnu3HNO15Pn/HxdEFI/VKwyusxyC9fq12yP5mMG/Ofll9jfPVc2lVWBEubBpehEGo4GmJ//ccF1OaTZL8cl3D0zlkiX3sB3A4fG4zLSicOBzWxLI9ns6YeGczJRCx8w+q3RDRYfNEWLCghoJzRyqZ8onfpgqCAdWELC4tQ7AqnCe/nVsfI7eJYcsQuwHOK+KxC1WJv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am-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: cIw/lHiKPwGxhmUrGtBMcF+Gc9qQJkF8T5OAQmrDuaataRP71GaQOGncZJEfjcBRZ02g1GlPdoNUnSwarTdl1zarY0iBszBhCBg9L/QVwn9TRrL5QZeaF7Lr79SUYElL78uZkjOa9aK2WtUODzqMLslvekH/2BlZ6bJwV1S+0f5MxqQ7TRcPXrVR4DmjBs9rYRT5JnijRCSU0y5ZyYolJ2IDC9MplhQ21CqmnCZ7RXA/YI3zn0sJgZ968SwSxAefaQa0khSC/yGcAqbVHR/Z6kev68m5IyUJ0rwhQSsI9Ab0fVGqmQUZs94CVTfDPcgQqafsZ9jPzMrBv1F1FG9tVd1ENShHp9SuNKSUh05O1ZSRYlQXJ4ahZAQSVXYkNN0ASUYKg8D5IkE5hQzb5OHAs9fAUrSXW+mbD3we+99mNQcJuO3QuiL6aluAMnr9H9mo92RiFKV3dOlurOLclIeCHOgto6FuvbD23G0LMtqsDU+x+r9YHVUM3syQ4B7VMKfzeqEy+Srt7KWCBY58MNPFjpn2saYjOXyFbBLBqHx0WnTZRFDJ03LdJAXRjp+as8SIbCuNrsP1gx5AjFWcss+F7W/hXkdelmwMlgOcPD8D2eKKK1QzXOVSFLRI4zruchWgcYoo5+xRMBTTkuAqX/mTrLP9mGMy0GqBP7RNAux/B3F0/OEeteea8Fw0e7gVZZiw1YNB0ySF1vI4qdCdcGVivHh9lnDxCJtF0acYJI2xL4maDwFs5OXmNjtCsyLqPxx2szA+tDoVcxTPXmEn+w3BnclTE2Msu3S9984pE9EDp7pi12rAqOdit0XYrcPTtElrjE5zUvTGbAGCwxqhLF7ylg== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: b369364e-8b16-4e4e-c03f-08db1efa9ffb X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Mar 2023 10:56:37.8727 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Dafuwev4nLRD+/CEYyHYvFLdZmUdtk0I+tyI3GdeDYZgukeBno5RRZkQOYaGUi821U9yPnfm2yqZ2NC/A3TvQQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR10MB6719 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-07_05,2023-03-07_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxlogscore=999 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 malwarescore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2303070098 X-Proofpoint-GUID: AOKTQfPuepCASsw4s40TRaZ5XEcl3QH6 X-Proofpoint-ORIG-GUID: AOKTQfPuepCASsw4s40TRaZ5XEcl3QH6 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org The SCSI cmnd pointer arg would never be NULL, so drop the check. In addition, its SCSI device pointer would never be NULL. The only caller is scsi_send_eh_cmnd() -> scsi_abort_eh_cmnd() -> scsi_try_to_abort_cmd() -> scsi_try_to_abort_cmd(), and in the origin of that chain those pointers cannot be NULL. Signed-off-by: John Garry --- drivers/scsi/scsi_debug.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c index 6d1c483a0a3b..4f971e8bfebc 100644 --- a/drivers/scsi/scsi_debug.c +++ b/drivers/scsi/scsi_debug.c @@ -5362,13 +5362,13 @@ static int scsi_debug_abort(struct scsi_cmnd *SCpnt) bool ok; ++num_aborts; - if (SCpnt) { - ok = stop_queued_cmnd(SCpnt); - if (SCpnt->device && (SDEBUG_OPT_ALL_NOISE & sdebug_opts)) - sdev_printk(KERN_INFO, SCpnt->device, - "%s: command%s found\n", __func__, - ok ? "" : " not"); - } + + ok = stop_queued_cmnd(SCpnt); + if (SDEBUG_OPT_ALL_NOISE & sdebug_opts) + sdev_printk(KERN_INFO, SCpnt->device, + "%s: command%s found\n", __func__, + ok ? "" : " not"); + return SUCCESS; } From patchwork Tue Mar 7 10:55:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 660383 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DAFF1C74A5B for ; Tue, 7 Mar 2023 10:57:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230490AbjCGK5O (ORCPT ); Tue, 7 Mar 2023 05:57:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230369AbjCGK4q (ORCPT ); Tue, 7 Mar 2023 05:56:46 -0500 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 269F553733; Tue, 7 Mar 2023 02:56:45 -0800 (PST) Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 32783sRY007655; Tue, 7 Mar 2023 10:56:43 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=MvpuJvsMTRsA31XLO/mIPNcrtilaj0qKlwFqNMZsDPU=; b=18M3dlsNOaEXZop0M/8gekufgU81xx1Wavt+0pQj5OG4io0it26f+v6yYx3/86PPtnge rrmkofSD7UUxcSvPtl8TeQ/4MN3LN9A6B5gIfTdWejd98Wyao+BeAuUXo7X3EYaZxOkq MCapc0WtPpYvP7IiEbzgcaxLZwjWlEE6mY1WaSqw1ctMX7R0VIEm9FCkDMSFDLKQpymT CsHbVCyq2/nnWF5j3f8IQYJIGHX8fI3FLkebFEdU9TZ4mqmRg25vJ7d5FWIXTnEunvs7 vHmd1FPlzY5xixhoAoYNq37EpnJmuivgdmOAw5YDjEZOFvSj1NqJwF9hc9qXKq+3K8Zl eQ== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3p5nn91gwt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 07 Mar 2023 10:56:42 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 3279RxW6011193; Tue, 7 Mar 2023 10:56:41 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2174.outbound.protection.outlook.com [104.47.56.174]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3p4u2hkp1j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 07 Mar 2023 10:56:41 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=esNdDcNm9sokCshCod6eq4c/pktVi8RpwKdqtTh/AyIfvl1IMmKl1ytAJz3WvwHJDGbz5bLWJtxOqt3y+2mxAouSXnk3KigIlYFq37Js/GtMkDRatqsFlOdaSDATlmFd8amv1wwKe5Nyz1I28Nef/VMZUb2eZNKFCvtpzOMwM3qIiH1z4sU4klzpVrwJBpKqeNCDA4Taldd2uJWiRRLVFZtDaHe27XkQPrWDt3m/ZlfyhT6uQ2KYuq/TCuSkz2lFRRyt2c8LoXljAtf6mK5spqN2vkz6OhIN50ewDTv3VzAbH2H1LHyO3G4jr5FylJQhsRVBSBxe6BIdysW6CO/+xg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=MvpuJvsMTRsA31XLO/mIPNcrtilaj0qKlwFqNMZsDPU=; b=KJKzxBPfqnN1V0EoJA4jer5vIiJVmQIwbZCCWyHtzmYtoltFBAij/3LDpY3p8Ac/qebSV3cg1aH8ygMnf4qwnrLqTl1Q6w2ThiRfPsOw61CLydXQq7z4q7JgPn79IeXzbrOsMK45zC3J2L47jUHgVnS8WBkQcX96PcZ2aQWaZgNvdtEd0BFL6+oWBFq5yojqxO6nHTqmuy5BK54RQYq4SBIK5M7ZgNUE4FiHKMkv5KfE0RfxEYIdjGJZ3XtlMhVyVwWNQoOrr55j6wV6DbB0rvW408M0FroT39M6detYRXV8wekLHM3SqgRCR8pQo1SEFfdzIKnIDFjgcVaRG2oBMQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=MvpuJvsMTRsA31XLO/mIPNcrtilaj0qKlwFqNMZsDPU=; b=w42+evw41YTcpQE9/KQgGvDz74GnsW3CazQrSKmbTcMJvadNhXLcXK3vzMA/yQeRxm7GBJvXdBaXpaN9NrmXyY9svZ0XEiySvJNKu9JH/xGme1hhurot+jsV/weUeGpZVQAuHdjA0L6GZa/a06qhkSc9TAvK8umk6DnnzVbSrLs= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by DM4PR10MB6719.namprd10.prod.outlook.com (2603:10b6:8:111::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6156.28; Tue, 7 Mar 2023 10:56:39 +0000 Received: from DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::fff7:981:3ae6:92eb]) by DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::fff7:981:3ae6:92eb%4]) with mapi id 15.20.6156.029; Tue, 7 Mar 2023 10:56:39 +0000 From: John Garry To: jejb@linux.ibm.com, martin.petersen@oracle.com Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, dgilbert@interlog.com, John Garry Subject: [PATCH 04/11] scsi: scsi_debug: Drop scsi_debug_device_reset() NULL pointer checks Date: Tue, 7 Mar 2023 10:55:48 +0000 Message-Id: <20230307105555.3745277-5-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230307105555.3745277-1-john.g.garry@oracle.com> References: <20230307105555.3745277-1-john.g.garry@oracle.com> X-ClientProxiedBy: DS7PR03CA0169.namprd03.prod.outlook.com (2603:10b6:5:3b2::24) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|DM4PR10MB6719:EE_ X-MS-Office365-Filtering-Correlation-Id: 79bea638-15bb-4aea-ed78-08db1efaa0e7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4HHbN4jrX63bhuF/djm6chnC25Ol+MBTnslDDO3M1GVjDo3ZvrpVpmWYpI7XmgaAVGECYhdddqfWju/QQyooIDk99D+vfqY9h7aoNgfvUbKF/lgWsHVTJasLuNKznlGU1EzDaDqmaA5pFNttDGoWUXeeXNFzzVCwF4bxN9pijMwoX0bC17BP4cDLmTiTb9hrzndFsW4OLfBztNJ74bpBirSaDt7wWdsBzHVetCaZjytrbxa9korNBBDLeifFw8IoxfFZh3DSBYefNPIfRrf5tEJGGgy08X7T1LG+7Vc3HQFgxxN6FMZK1AmM0suBv+uZp0UG40Ja668IyjRtrAe5NaSTPpmxjhgZq2bZeWsZnkkKNzFbWjhBn9is8ae3o1/tzE+RKr7OoPZO8Hg3db7IhvXnUWJPbTzg3BWQzWTmCL6IHjjnq4jiUCSxePhBGNEBlWzSRxNe6C9lT9fvjzomKOP3IOAkXYZcngYvbuCQ3lCjc3eiBCacGH+5ivI9T0mI1b631jxaN4sivXDPLergK6X8XStLivayM0+6y7jxQ7hAI4ToK/0LHOPlGphIUvl2sm6s6zQyKhPTSvUSGARpBoN2b8YXj9T3npZOi3IsSheV486vRH7fu4tW6qZDX7OaqoYG4rTkuEqBlqbIselX2w== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR10MB4313.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230025)(346002)(396003)(136003)(376002)(366004)(39860400002)(451199018)(103116003)(66946007)(4326008)(66476007)(8676002)(41300700001)(83380400001)(2906002)(86362001)(38100700002)(8936002)(36756003)(66556008)(6486002)(478600001)(6636002)(316002)(5660300002)(26005)(186003)(2616005)(6512007)(1076003)(107886003)(6506007)(6666004); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 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g3SpUQCROXCZ1DktVNHdUQwMovZN7d52HJyti+p691+lTMFgsIZKPRftndSTwkjOuuipc+LkBp5To5qJ3A0pJo+9PVkjOfhYSuMirszPgMhg+I6QlNrcaDehUdKKw61jBd221iy3rDlo/a3HBqVTlYfFbZM/9g/O9fGMlDsPvTfkduQf0DFp/yFD9OMkhBTYHM3kUOev9ciHCNH5VxBgGX3xOW33HhBm/SUIfXOxDrFyS2WtfypVPb0IKNAnW4AAe1d3yhNMyqdNv4uCbNWS6HBj8H4G+cNtfMlfAumW59jGshsBB12UenONYGnNsP0gzdRsmvUzTjdGDBWGW3/TM3GgI1RqLgDjOVX7jnEIWKhfqgXC26tFSvCdQTAHYnm3I44ZkrytPPXoRSdeiC93WXoy7s53gxdPaf26ZgdVL7NrU7bYdyT3l58m8GOn9M7O16HZ8zCNKl+LWLnNcyj8sgNXPVaiIuQTj+zQbPJwNWj3OUiWtKEktGIxnioRB9roPWzWGTYqK9mksAfBo+F8q8V/dCz7TmSBYECX+vO3tTf1bvcTw== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: +tHJUUr+f/TiAG/f8P8AT19x1MiW6MI938vvTHvzZdEXmnWthk32P3/64gziwPVTWg5zyUwvzyuWRqmjzv7r8IaEOykQWgLpGne4Zf2MldP5O223pxrBisETcGASgZFSIUa5tZRKK+TqrSo3bqTzc2FAjuy5juJoKhqwSDAsLodYDQnGWztse/r6lr07ZW7teKugh12xVBFIcKr7YyGm23WgWl9NupH3VMFk0noaAVpv0me72i2YmrI4EafWTdWa29CWwUrzuGtx+LX4bFqKGokaZE2yBwVhmHu6TMCXVZI24WZphb5QlwjscZhtVbjefLGi4iqAKaa50W3Pca8CihHJEyTpyWwRBgRSlDxI0ahms2jwvHPJuZ4uIF/8V8/6rBH5TC5gAGAtThYAaghMwgjB2Ep6wyc6+A+cH1bw7VO7Rhn5y47/wWlQdQBUDXVFswbCAXPzOVD/gmoNDSeRPgBB9hFu1aDfkkxNqWIBZC0HGlLhYLQDMoyz5+GaGkAs960KvK+ExRg2v21nBS/f1nbfXZ8UHYg05CLA1g4rxWtmQiigA/P2AGu4llyB8ZdmitGvnFO7CnVPdxvoWh6THhXj1Yej+4SkNueWT0DXcU3p86u+BVaFhIv8ljr7Csv6lg4ct0qbcgk0K9v63lTAgSYF5trhyn+uB1/yOeM5jCw3Wmb+ajbKVkaVdyM7xeXV9c2KF7mISD34qCkXJYD01+0xz+TgZAHbl4MxDjSy8zIbfLl/f0lZ1P8kWBoBoNOXsxs9Hw3n29QZNSM8s7uxx1D4orTDnW9bff6aHlIEt7/yjP1BFagX5fq2OnzCzI38DaUFIz7LmnjdubNZ6Brk+g== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 79bea638-15bb-4aea-ed78-08db1efaa0e7 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Mar 2023 10:56:39.4205 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: U0++ctyKJtxG9UeZWOt/HSAAmQrqDvo13l3PI8J1yw/KcpGFRy5jgC9468ySECWL3+m886VTTH86X2fhOp3ZaA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR10MB6719 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-07_05,2023-03-07_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 suspectscore=0 bulkscore=0 phishscore=0 spamscore=0 mlxlogscore=999 mlxscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2303070098 X-Proofpoint-GUID: Yb-Hslj-Z_CdUeKqp6_Wsj-KAJ1jooBp X-Proofpoint-ORIG-GUID: Yb-Hslj-Z_CdUeKqp6_Wsj-KAJ1jooBp Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org The SCSI cmnd pointer arg would never be NULL, so drop the check. In addition, its SCSI device pointer would never be NULL (so drop that check also). The only caller is scsi_try_bus_device_reset(), and the command and its device pointer could not be NULL when calling eh_device_reset_handler() there. Signed-off-by: John Garry --- drivers/scsi/scsi_debug.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c index 4f971e8bfebc..b67d0c72118c 100644 --- a/drivers/scsi/scsi_debug.c +++ b/drivers/scsi/scsi_debug.c @@ -5374,17 +5374,16 @@ static int scsi_debug_abort(struct scsi_cmnd *SCpnt) static int scsi_debug_device_reset(struct scsi_cmnd *SCpnt) { + struct scsi_device *sdp = SCpnt->device; + struct sdebug_dev_info *devip = sdp->hostdata; + ++num_dev_resets; - if (SCpnt && SCpnt->device) { - struct scsi_device *sdp = SCpnt->device; - struct sdebug_dev_info *devip = - (struct sdebug_dev_info *)sdp->hostdata; - if (SDEBUG_OPT_ALL_NOISE & sdebug_opts) - sdev_printk(KERN_INFO, sdp, "%s\n", __func__); - if (devip) - set_bit(SDEBUG_UA_POR, devip->uas_bm); - } + if (SDEBUG_OPT_ALL_NOISE & sdebug_opts) + sdev_printk(KERN_INFO, sdp, "%s\n", __func__); + if (devip) + set_bit(SDEBUG_UA_POR, devip->uas_bm); + return SUCCESS; } From patchwork Tue Mar 7 10:55:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 660966 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 390A9C76188 for ; Tue, 7 Mar 2023 10:57:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230501AbjCGK5Q (ORCPT ); Tue, 7 Mar 2023 05:57:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230372AbjCGK4q (ORCPT ); Tue, 7 Mar 2023 05:56:46 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 46E9953736; Tue, 7 Mar 2023 02:56:45 -0800 (PST) Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 32783kIO010517; Tue, 7 Mar 2023 10:56:42 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=g+hgas+uJmbPd8ldoWoJBR6FqmoeDKkraJThfdi3n+s=; b=08Wfn7u8I7uJbSGUptnqeMsHilvDUVvEdaalVeAHzOA42mY3Mu/MIBstXyC/EcbHs0i8 qDdRqSq4beqQJbIZOpxOFRjCAmGAsex9JZ5vGrVSe9MygRH9MJQLjKi/RFR3EKG619Sc WNhKGuSCcOo5oFdPGSNS9a0v5ze7OzLdHA1WIvRYlcpFpm5/vSpep98gDqSSVUCwmLLW pVbcg813OE/oAlSkjwOwyfEn3KmCciyDTZeVxo26nwapFPqI+t4qgbrhfDqic6S561XM zey2uj3VfTwMNTY3AFnn/e6fjao04k4IAVqBSecuytl1z7Uh4k0TEad1OTl/mgKlmDhi ug== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3p4180w5ra-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 07 Mar 2023 10:56:42 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 3279RxW7011193; Tue, 7 Mar 2023 10:56:42 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2174.outbound.protection.outlook.com [104.47.56.174]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3p4u2hkp1j-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 07 Mar 2023 10:56:42 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LuN2F0creOO3syO/fSdQFIC/dMYQ9nS7mas6R+dIYY8mYwQATIJ0AKIfcoz3AUF0oU8VCHioK0H5zkHWE4LYM1EY+dK+IWo1kM+Mov18H0PPrm3+RI0BueCPA1KhmeU3gJg3tKl4m+qzgJRmFDyXZ5BngoiFLJq9z3M6XXy+ROnZP0iBq0/F1Jes1s/SucJcV/v1TGtYX/RBDmmr61w1wGMR/A03ueCoKVNNwyXvM3BJK0fXwA6RhJhgqAhBQJQsnAJkuSTE75tgDSf3QTzcmH4UIBAYpYXOxDwp3r4ugmXU/L8rpw/UY8N3o23FMIMCIzvhTAf3SBv1NzsI//UCdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=g+hgas+uJmbPd8ldoWoJBR6FqmoeDKkraJThfdi3n+s=; b=aN2UKoys2Ludxvx3FFFT3oWgWJavqGFrVbSdTaMhbStXXEgURrSCkJQt0ztf0fa9h+k3qGVRc7cF75NooXLoNFlpDQYemsR/CclymVCzQkWChiBtBOqE5gdWYkJ0oE4ENHYjsnwQfLsrNaopJlfEZ+i4qf3qdc5eYVJnh5NrTkpby3oDhpvVGnHVfRUFmj4ya3xuA8sZ1LKr2MvvMTENO3jvp8AhBL5XxVEkBt+AKM4l8Wwa4CwcuGOW8Ay9IJRoIangNLRYb0WCbMPMnZ6YxflbZNO8zms2SnYY4jVm0xYxmHkMgbhylgO/7E8jv6mLr0AVAQuvGgit9dJ1h9vAOA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=g+hgas+uJmbPd8ldoWoJBR6FqmoeDKkraJThfdi3n+s=; b=r6v1EmqiAf+bTDUx8Z53lE2TO4IOUzTZNak68nuiZYq3iyQYLkdkvplIMV5ONzmJdj8AxxAyzILFRpRqVF69tIC9FxAKPeHYNcDaXvCdy6YlR7XogMcLIuHnL80H0+g4PHCgEp3qrVJg/ExJ6wK6b4tRpoqNeEehI5qJuZizEOE= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by DM4PR10MB6719.namprd10.prod.outlook.com (2603:10b6:8:111::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6156.28; Tue, 7 Mar 2023 10:56:41 +0000 Received: from DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::fff7:981:3ae6:92eb]) by DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::fff7:981:3ae6:92eb%4]) with mapi id 15.20.6156.029; Tue, 7 Mar 2023 10:56:41 +0000 From: John Garry To: jejb@linux.ibm.com, martin.petersen@oracle.com Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, dgilbert@interlog.com, John Garry Subject: [PATCH 05/11] scsi: scsi_debug: Drop scsi_debug_target_reset() NULL pointer checks Date: Tue, 7 Mar 2023 10:55:49 +0000 Message-Id: <20230307105555.3745277-6-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230307105555.3745277-1-john.g.garry@oracle.com> References: <20230307105555.3745277-1-john.g.garry@oracle.com> X-ClientProxiedBy: DM6PR08CA0028.namprd08.prod.outlook.com (2603:10b6:5:80::41) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|DM4PR10MB6719:EE_ X-MS-Office365-Filtering-Correlation-Id: 9b577e37-67ff-4ce1-4d37-08db1efaa1d6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZQKyOtnjN/dDRKsQ3n8LEtZSHbYhIZUJnuyuKAsuEpHKaidfwMTFyn46DRx+SvYRcFXgEoXVJFg1AvGYZqNaK3Tmq5StyFfyOrwIuhsw4XyQ7Cy94IR0yKpq2D969ouGtChsXqPXDvOyN3k1MmgbvKj+xK5Ocmba98PxmiT8hiWVXiveHI/B7n4NSZxp/3CCTuYbbwfLnhyfwI0kBAf4WuIDSfhOo74WzAHNi+uRQBwhn+oiAZXrsRvMlKJhlQwTOpSPgYi3v7saSi2CydTZdHfacMRMSloigqroPo5yVu7FxiAP483axoNH1fS+0j+gx0KuaecI99fOJaPsU/9DhVP0MSuXvU7OCRaR+GD0wV3gXDtw9OYKMQEcsrZJIhF6HdKmtcwpl/Odqpx2kZSqVHmiOvMMtx//b+qQISTnZkbioYHNBdulKeoMs5MeoB0Fbpi32dURQeHEOfXyecjSG14f+/m0fA0Rrv9+3MKtGXm9VGPcH4LDohWx9uqOKM2JUkSGpv/IItgyzERzwrnVTKNbhhLXSmQmZzK67C6SwDq7T7xiwp5kBZdFsmqHn2s3QlxM59UBGo12RC3+dgQwXOigU0jjwVRMPdalnIj4zYn8aPHJLa/JCxLy+05Ut4LIBs4D1XlllfdLWoaNQj5vUA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR10MB4313.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230025)(346002)(396003)(136003)(376002)(366004)(39860400002)(451199018)(103116003)(66946007)(4326008)(66476007)(8676002)(41300700001)(83380400001)(2906002)(86362001)(38100700002)(8936002)(36756003)(66556008)(6486002)(478600001)(6636002)(316002)(5660300002)(26005)(186003)(2616005)(6512007)(1076003)(107886003)(6506007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: k81oeMgPsVAKSnHei0/4kOqmG1hox5xMBjJSHaQD9RfAwt9KKxGq/vBPGqFuLDhj8pfOsnn6ex8RG7Jd7qrJZkLRKUXM/3vhhLQkKYvlMrPuNTgezHl9l5n8rmom37xkznq6pcdnem50hP9Gdw/1218vhxchXQMydav+M2mqEqJKOvpsgQtbUWEmab99KccisfqIQC21q/1yZ/7dOTRd0S3H2ksvhNwAAaGVpMvkDBIobiUU7SfMNjYuBkaZFM+xrGT0Z0wz8nyHQ0Iq8BqbDPQF0oHI8rF9c+iq8x+OaxQJH7ZGGyNyqcHTsPUcFOBHfO0D3v2aKSgSoaPeF+oqEv/2xYqtz8osC7QpKJvA2asHNWpXQjVxPOk5VEMdlhFpnF8I1B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SvBl+mA== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9b577e37-67ff-4ce1-4d37-08db1efaa1d6 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Mar 2023 10:56:40.9828 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: FghyD20cK+rCuFNzTEEnI5+YmD7DsKrgrDyZvOa8A+CoGmkGieNIAMskKj8kt0RJgqUTMbUU43bnu7+kMI6D/A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR10MB6719 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-07_05,2023-03-07_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 suspectscore=0 bulkscore=0 phishscore=0 spamscore=0 mlxlogscore=999 mlxscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2303070098 X-Proofpoint-ORIG-GUID: 6GUYQJ-9NszgxCX4vLgAfNtmX2-klosN X-Proofpoint-GUID: 6GUYQJ-9NszgxCX4vLgAfNtmX2-klosN Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org The checks for SCSI cmnd, SCSI device, and SCSI host are unnecessary, so drop them. Likewise, drop the NULL check for sdbg_host. The only caller is scsi_try_target_reset() -> eh_target_reset_handler(), and there those pointers cannot be NULL. Signed-off-by: John Garry --- drivers/scsi/scsi_debug.c | 31 +++++++++++-------------------- 1 file changed, 11 insertions(+), 20 deletions(-) diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c index b67d0c72118c..33c0df6a3275 100644 --- a/drivers/scsi/scsi_debug.c +++ b/drivers/scsi/scsi_debug.c @@ -5389,37 +5389,28 @@ static int scsi_debug_device_reset(struct scsi_cmnd *SCpnt) static int scsi_debug_target_reset(struct scsi_cmnd *SCpnt) { + struct scsi_device *sdp = SCpnt->device; struct sdebug_host_info *sdbg_host; struct sdebug_dev_info *devip; - struct scsi_device *sdp; - struct Scsi_Host *hp; int k = 0; ++num_target_resets; - if (!SCpnt) - goto lie; - sdp = SCpnt->device; - if (!sdp) - goto lie; if (SDEBUG_OPT_ALL_NOISE & sdebug_opts) sdev_printk(KERN_INFO, sdp, "%s\n", __func__); - hp = sdp->host; - if (!hp) - goto lie; - sdbg_host = to_sdebug_host_from_shost(hp); - if (sdbg_host) { - list_for_each_entry(devip, - &sdbg_host->dev_info_list, - dev_list) - if (devip->target == sdp->id) { - set_bit(SDEBUG_UA_BUS_RESET, devip->uas_bm); - ++k; - } + + sdbg_host = to_sdebug_host_from_shost(sdp->host); + + list_for_each_entry(devip, &sdbg_host->dev_info_list, dev_list) { + if (devip->target == sdp->id) { + set_bit(SDEBUG_UA_BUS_RESET, devip->uas_bm); + ++k; + } } + if (SDEBUG_OPT_RESET_NOISE & sdebug_opts) sdev_printk(KERN_INFO, sdp, "%s: %d device(s) found in target\n", __func__, k); -lie: + return SUCCESS; } From patchwork Tue Mar 7 10:55:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 660967 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A8F05C74A44 for ; Tue, 7 Mar 2023 10:57:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230446AbjCGK5N (ORCPT ); Tue, 7 Mar 2023 05:57:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230383AbjCGK4r (ORCPT ); Tue, 7 Mar 2023 05:56:47 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1AD5953D8B; Tue, 7 Mar 2023 02:56:46 -0800 (PST) Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 32784MDr017687; Tue, 7 Mar 2023 10:56:44 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=tuVn94Qm3UrzyeLRRp8i6f+oTA+ygTIcHf33mikuf5I=; b=2F/fym7cHGRA6kHN0hdNnAr3HRYc1OZxrDm7vRVA6Sz8/SvarHDzciIGm6vHwTaXPHy0 GtgLDnh/ee7xq216RaZ3Kmg++0zk028JjaJhqP3mB4Sh1Lk5cL1apZpkrgmv9/JT5HuN k2qynns3lSSGn39fB2kfm8NS0uHuV2Su3UGELX6cD2fUCMlWw+JfaTHN7ip5NJMuZxzj NMo6KcqdfojfjyitzdrH3ymgYiQIYXOX0Geh1UfBBPPi5HSnrS7KbUneckl5hMPW6go1 4VBN8/hKJUxSJvEWpqOCCaJ0bSXZhlklhI5utir46NZsOACgbGcU0zeQxvswnkNp8iTl +w== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3p417cd6w6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 07 Mar 2023 10:56:44 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 3279xmJe009177; Tue, 7 Mar 2023 10:56:43 GMT Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam02lp2048.outbound.protection.outlook.com [104.47.51.48]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3p4u2hkp34-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 07 Mar 2023 10:56:43 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aDrUnrNT7M6kBfsLpGRa0vsa+rEeix7QIUcyyVA6oOzqtM201O37WOUacshtDXU9ZjdOa7A5Ja6TG09HrIt/2zGxqZKrbDsAJIMTwWk7g+P6TpLEIsGytx2GqnHNcaCZx4ik+9H4R4iED6oSepPw72zBQ/RfZoECNqIBD811EuKSQ6zpLJIXCl19gCRFp4FJmBNLJfO5CATO4AJbs/lrllfzxLm+kaL9BtTZOUc6vRjiW9971QI74tJc9yTV5vY7PWenIpLOlUXb0HqcD8Tot5vnZBDRBCFq5L3wgoSXKkTQ9NmDvS+st586yC8pG75uPAwZOXbS8SjE3AHfBRZwYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=tuVn94Qm3UrzyeLRRp8i6f+oTA+ygTIcHf33mikuf5I=; b=eBXsQFNw3tpKdRg+OVWaTIdwUuBP+v5oYpVA9caRpb5TwDQhVPP+rIizBtS1HOulCOpTt4Vr6bYAaCzaTS4Xtsd5CUF5fmx9S+JjMUP+exaXxtprPSXgtzBeUaVxOBKsBwKUJgzNy0LCA5K5wNQtc4xE+qKJaoc1qOvCMZSk1y63M/MQ61o2VTMGxIXSGLncH7iQ+D9jSHxa7NdjJQfn4aSwSIVRCnFPXyrwxG8NIPV9MuIj7+9rY92cT7pn1htCajcUbq4YsjMo4/w0bLEoVZ+vyQ4Yih0q6cnu8MzFAoxl7bYD9HL0sdJKWj3QhehtTYMk9jgsR2HsUuitXHQVZg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tuVn94Qm3UrzyeLRRp8i6f+oTA+ygTIcHf33mikuf5I=; b=djaCcfJ9tLnWoCK3TsMiBkHe4Xrg940+X2a16A2BgCupaxEJxle3t+aTt+OpcRnj2EFxWRtdJIlVDiG3uRMoh7v3OmwS3s+doh2WpTCKXcR1brlqeeUn9ZocMa3DuOvi5eHWDhLqKv2o/NA6pBKOaNrRzZKmCVwxX3HEOFrxyeE= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by DM4PR10MB6719.namprd10.prod.outlook.com (2603:10b6:8:111::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6156.28; Tue, 7 Mar 2023 10:56:42 +0000 Received: from DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::fff7:981:3ae6:92eb]) by DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::fff7:981:3ae6:92eb%4]) with mapi id 15.20.6156.029; Tue, 7 Mar 2023 10:56:42 +0000 From: John Garry To: jejb@linux.ibm.com, martin.petersen@oracle.com Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, dgilbert@interlog.com, John Garry Subject: [PATCH 06/11] scsi: scsi_debug: Drop scsi_debug_bus_reset() NULL pointer checks Date: Tue, 7 Mar 2023 10:55:50 +0000 Message-Id: <20230307105555.3745277-7-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230307105555.3745277-1-john.g.garry@oracle.com> References: <20230307105555.3745277-1-john.g.garry@oracle.com> X-ClientProxiedBy: DM6PR06CA0100.namprd06.prod.outlook.com (2603:10b6:5:336::33) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|DM4PR10MB6719:EE_ X-MS-Office365-Filtering-Correlation-Id: c989a234-4253-4e30-36cf-08db1efaa29c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 78jhTwcKvpA36gHH4RkI9kIjDH4V7I+sWy8ToHV0UuMbtddu+7XhtB+q0O1tFJYLh+86/5oF5qgOxu72HZzkXfqPk9mhPRGK8sCZJVG8OYOYhC6gmSbQezgcEMlR3lwaaxByPjyIL//kCr/15WhNj9+kutmxbTqiKI+qejzRKeb0dcI8bnZq5HO/LyPZq576w6GEK9DUxih4whSyxQn2DDvD/Rpu+0pyXuXNHC1KDJVwSVBeHX4gDDgEpbajpPKDn1+Q6g5ejbTgxIdB/ZFFkjJwTBrW8py5c49N8NxXELQDkxM7OlQHgdy6OfLPIM0fqy9oC1J7E0oJt4o1wlamSJGvzg6Os7ilAN5yw55b1h5RvGCD7ZngmMgHDeji4HQrycsrLJXJnrgL5/MUj+Klw0sDa/+qsPy4R4QuzDd1zESMmoCTfPSmL3L6iJc6UxIZ8fJ24vkDpQV5VbXhzZSgSX20NS/jDZg7BLmCkyNvy2UhVzDvSYDFweYzVVWFIRn8MSJEhi8N/T+Vn/nmdPMxNnxrgEZTmQYqG2IQsJS4/jKtoXwbWs/OWeuzl45YeF/tcoGRSzwiqfvNXqRTH3SMzuq3M889MqFqDpExSzFyg3prinoefZeKEfffoc6hmaWkXuBXv6M67yL+KZBlxtl8nA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR10MB4313.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230025)(346002)(396003)(136003)(376002)(366004)(39860400002)(451199018)(103116003)(66946007)(4326008)(66476007)(8676002)(41300700001)(83380400001)(2906002)(86362001)(38100700002)(8936002)(36756003)(66556008)(6486002)(478600001)(6636002)(316002)(5660300002)(26005)(186003)(2616005)(6512007)(1076003)(107886003)(6506007)(6666004); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 2rfJ84pMD2TL8PHbJg1F/ky1Tnj/xXclgAIp0v6+t5Auh13406VLiA0hTyFMjQPdOL/xlzAjRr8E7vhP6ndri4iMdpmpLErca8x++8z3T/tT4xzG8UkfzEgOcWNkksTy1+jeW2ziWIMfX2odZ88oDYXSrIOfvCkyI6NuAoS5aUv7t40WAFWXu+mOXSg37o+dATvDpWzLiuMTPQTgdLHCONYBUSm+gErbDg1AbSps+LcowSkayKV3lEBSafKlmDc7STsc4TXqKpJdZ4/PC+gUjeoqRWCs74aYzWlaJ3zAywXzS3C2NJJQTwTuAPOtT7flY0KSQEgcPP4iH4ZNbmKakJYVLwt5fmpVTXUPiTMbjR58fHPfUg5Gr84bCnY03qaa1yS3tPQPLwxiltmuUI4WQw/Ze8j5x3DiWF03+fL8tTGGAR60zs6AFJnjJ0xc7zwYaZBsrCDj71BfNNKItxSMmxjMcj8PPEiiC3LgU04tlGdUJmXRoV1ohVPbSIiXwXLd0PKMDmG6xf5BWDHeQCmyZ309eBntmB5C/Cs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change-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 8fxxMc9UqSLCCSpfh3wN5PfhKlYy0kriPZEwYVkDu8JLRr3ML5TNbDA31+YDYA41WBLfjMqv/okgW9l/UauvJuZIMiU6o/i25G7Eu5r5QZ1IfHD1qCeMSrqAHSqN2a4w4wRPejgqcqf3tFueqeBwoCVWq9fDbW3IE33RmcVfeaD8C5zvjzKlxOTN0h2Bo1vHY1T/vbuPk+DGgmdUpPc5sfuLEr5Toz3IoOh5fFao6cWPekG5YB6nKyVIpyv2TkChMAHpX9VSeT5s/VzrLvH8pKpkUvPZyRnGz1diocXDVk+u0fUB0JxWjsxCBYu+t9FHncjIvzekY0T7Ir1VxUIizOnhsyqGDJVaC1Sx2TBgknD03J+UkrDb1q0dI9K1OkdzY7Se7PdiNWpIq8cXHSriXGherot3fA+CZ01urVwDLz/J69ohqJslkOAfWaZFV9NXdL1o+nxZZ+fhtk+kFZyOJ096ZFsr85qeEjaAE1NzQlrIf5+N968GaFIUhzsufpdXgqMe5LcvFdXNT9qS2o+OMYZy9qVXgE5pJnjxnPFjFNUGPdxDuvp7YCTwEdZTnxb0iQwc7FraUBgFLPGNW6Ng3lhXoR8vLQwRY0KowSIWdKpJckt8VT1DehJ3KueopBmvBVpMLJj9Bz2T6sUJZ6cJBBJ/n4kOLrxtjERo+HXFCOGZXC44luoUGdtw0FrtJx7E+EAnSqiWLP5zmJDRZGnXukr/kcXVkY34voRp4uIqXID1ZnfphYpYMQF60u+quweYRReaYRadRBFZHC7XQD2XoMKtXQNOJrpGoix4ueuWgW1+ddRY8cJHk/fwPLL2JmSbQ/pnKNI9dTBdZiIPY8uBjQ== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: c989a234-4253-4e30-36cf-08db1efaa29c X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Mar 2023 10:56:42.2798 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: x2/NurEuMIpNLvy6CNFoAvbiX03w27R/ISQ4unVgCvqGB0WOy8ukQcxSmeU5Wp152itTC0EN2Lk+J5UlEAJ5yA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR10MB6719 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-07_05,2023-03-07_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 suspectscore=0 bulkscore=0 phishscore=0 spamscore=0 mlxlogscore=999 mlxscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2303070098 X-Proofpoint-GUID: lCCvkKfJjQG_Ld-IGWIX0G0pgGJGzGbL X-Proofpoint-ORIG-GUID: lCCvkKfJjQG_Ld-IGWIX0G0pgGJGzGbL Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org The checks for SCSI cmnd, SCSI device, and SCSI host are unnecessary, so drop them. Likewise, drop the NULL check for sdbg_host. The only caller is scsi_try_bus_reset() -> eh_bus_reset_handler(), and there those pointers cannot be NULL. Signed-off-by: John Garry --- drivers/scsi/scsi_debug.c | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c index 33c0df6a3275..6f1dbd8dc37f 100644 --- a/drivers/scsi/scsi_debug.c +++ b/drivers/scsi/scsi_debug.c @@ -5418,32 +5418,24 @@ static int scsi_debug_bus_reset(struct scsi_cmnd *SCpnt) { struct sdebug_host_info *sdbg_host; struct sdebug_dev_info *devip; - struct scsi_device *sdp; - struct Scsi_Host *hp; + struct scsi_device *sdp = SCpnt->device; int k = 0; ++num_bus_resets; - if (!(SCpnt && SCpnt->device)) - goto lie; - sdp = SCpnt->device; + if (SDEBUG_OPT_ALL_NOISE & sdebug_opts) sdev_printk(KERN_INFO, sdp, "%s\n", __func__); - hp = sdp->host; - if (hp) { - sdbg_host = to_sdebug_host_from_shost(hp); - if (sdbg_host) { - list_for_each_entry(devip, - &sdbg_host->dev_info_list, - dev_list) { - set_bit(SDEBUG_UA_BUS_RESET, devip->uas_bm); - ++k; - } - } + + sdbg_host = to_sdebug_host_from_shost(sdp->host); + + list_for_each_entry(devip, &sdbg_host->dev_info_list, dev_list) { + set_bit(SDEBUG_UA_BUS_RESET, devip->uas_bm); + ++k; } + if (SDEBUG_OPT_RESET_NOISE & sdebug_opts) sdev_printk(KERN_INFO, sdp, "%s: %d device(s) found in host\n", __func__, k); -lie: return SUCCESS; } From patchwork Tue Mar 7 10:55:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 660381 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EF008C7618B for ; Tue, 7 Mar 2023 10:57:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231168AbjCGK5U (ORCPT ); Tue, 7 Mar 2023 05:57:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42598 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230385AbjCGK4u (ORCPT ); Tue, 7 Mar 2023 05:56:50 -0500 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E1215BC8A; Tue, 7 Mar 2023 02:56:49 -0800 (PST) Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 32783tAu023583; Tue, 7 Mar 2023 10:56:46 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=6PezMTTwtTDtsA0UTwC/AIqB1yiqVCXGZoXWdF/TFfI=; b=Ul1swIDqPgd5ZdWIG8xmQdCCRjcy07666FgpwO9U7HhpbJ5r+oltqBPQJW8w96e7GILr V6emteW7IfSnnJUc5LbNKXMSbvxTmso+2eoyAz1lC9zu8gPgl+DPsZn3wHVMcaabWx7O FQYgw0Rg5u9dwOe9kCehKauL+xW4EPmsOfy//Pb8V14AAI1HedTJcsNwLoQ9GYsvp0mZ CvdWGyGiGaEsUwq1Lqt2UJQDdORfEPvLCZQcw8xuJnSKlrbBwuFq0UyR0DRqoq0nxIwX 7SaSaU3sQRS4av0rhW5/9tWncEQ4V38Zrl6xzkPEQCnCBQf/tyqT98Hy3kHxxKr54Q/I PA== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3p416wn74y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 07 Mar 2023 10:56:46 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 327A86Se037277; Tue, 7 Mar 2023 10:56:45 GMT Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam02lp2040.outbound.protection.outlook.com [104.47.51.40]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3p4txeavfw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 07 Mar 2023 10:56:45 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SzVSxYo4zZXuAUeGniMR18CBlJkBSGnnvQoYkJKLK+RDQpYuwnnrhJF1qtZ0qwG10FK7qbzhAmI9oc9q28WkmGnf0brydVsXoJ+MDBXxCb86UEx/XPukX8UGtAaFXU4Rog8I7krQTMYdKosbAW7EEIwpjJBRLgaoeQ4cSomWWqiC8ZgBxNoZHgFU/NfuB2S8Im+IC8SWiowczDGlHTV9UcK/2PPRPuM067/GAriTW3Jl88cG6TMRnyV/6JLGxK0m3TLdKl15GuhoJLBziDzAvZ6963NPOqqg0mOmRYN+8bfdCtX/xA9fLliTZZ8PfzuYTdJ45HTxxsNMfH8zj1eJxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=6PezMTTwtTDtsA0UTwC/AIqB1yiqVCXGZoXWdF/TFfI=; b=nQUbJR7C1VnRhCeJfXjZU26HUVEvPOG8KZjT175AAj+FOVS+pDUMfz8Ssab0dUmeT6Bua4Jl90H7Aul6nC+oexweSlgPBA2OPZ7L4Hzn4WTUfsCTsml+3ocP4fuYHUt1IoW+pNQsBueUyHo7svXV/2WmILkjVtkZWrObG0NNkItxuAw5uf8g0tnW7tgMyyDAeUAWzwLw4sjBpcSTQwuMGV8qY7GiljndD7vD5sAA2+ehKSPew3NzU3irf58WzBsR3ggxtfIelkIkxCCLAlkHVFb82u0TnBF9Bzv0aqiWpCq4EEWszVBLjBVD9DcYdiPq3Bywt28ffGeYGkNvWHGnRQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=6PezMTTwtTDtsA0UTwC/AIqB1yiqVCXGZoXWdF/TFfI=; b=0UpXqjVqMXN1Y1JP3tXtaZaxb61B8Fe+uV126zS76g8RuXrw0RfJnzEM1oXn3tqv3Rn/6muisIp0rtbuhNkzmgt7oW77R1ivsEOKtlUIgmoqRFpdBI4aUbTCPbuY2w8LHRTy+7Zuc2N6Kq6f72DNVfKB1ZeNKP1MhkHsvSFwkPY= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by DM4PR10MB6719.namprd10.prod.outlook.com (2603:10b6:8:111::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6156.28; Tue, 7 Mar 2023 10:56:43 +0000 Received: from DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::fff7:981:3ae6:92eb]) by DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::fff7:981:3ae6:92eb%4]) with mapi id 15.20.6156.029; Tue, 7 Mar 2023 10:56:43 +0000 From: John Garry To: jejb@linux.ibm.com, martin.petersen@oracle.com Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, dgilbert@interlog.com, John Garry Subject: [PATCH 07/11] scsi: scsi_debug: Drop scsi_debug_host_reset() device NULL pointer check Date: Tue, 7 Mar 2023 10:55:51 +0000 Message-Id: <20230307105555.3745277-8-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230307105555.3745277-1-john.g.garry@oracle.com> References: <20230307105555.3745277-1-john.g.garry@oracle.com> X-ClientProxiedBy: DM6PR18CA0036.namprd18.prod.outlook.com (2603:10b6:5:15b::49) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|DM4PR10MB6719:EE_ X-MS-Office365-Filtering-Correlation-Id: 4fe9f871-a98a-41d8-0394-08db1efaa386 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: nvNz+abhz8ELVwLbJvg04fLmecIGHqDoM8OkMIcYV59/A63cjZPBNFWPBOhDiDmKAMdFvuBOtnEZklhTaMEQKoUyohGCCYDlirjYFFMURnhUVklvNp/VMY9URSheSHgTtgYuiFjdY2lQqQc99roA3rllzKD9agPVyXQ/HeksTGDN5OJkR4xi4isvGmCO4hGHuk9r/JqkEGWN2qpbrqPtW78Gypw7jCIBRKSzMwA7JjZr9QXuh+LkPH6hl8gMOdaAY07/bn0d+9A+v68ac70/w1EOjLEn57lqb0Ac1vAKOHJeR5q3YEsqEn7G4YHu1FuLvqvhqYVpShJpyQnNi3P/UIXCeHSqPHrgrQUUrHW0gB448N8y7rKOP2m2VoUqzp4jGXiJ8E77e6lrBKnEWJMsyQnmFZdEQHz9VNDrYqLdifxQvkU3pzhu8YjAkw7x3nx7JWxrGJOkpRsxShv4zAUKXCl8CVkeAT7i1lXkpdXBrO4uvSkxMIDGlqXsTC+H+6DS5jhldkFTjnXpDkoFYps0sr5qMTlMrt8L1cAtelHHH9ng1mVsOvCW6E9AkUTyf/V2tvouoP4lnWBAllnuAVmifVQWHa/aHTFof3Lkai65E/ObvIVhf/QTv7dTvDYNrlnGeyA2s4/dJS8vt7cierEzKw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR10MB4313.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230025)(346002)(396003)(136003)(376002)(366004)(39860400002)(451199018)(103116003)(66946007)(4326008)(66476007)(8676002)(41300700001)(83380400001)(2906002)(86362001)(38100700002)(8936002)(36756003)(66556008)(6486002)(478600001)(6636002)(316002)(5660300002)(26005)(186003)(2616005)(6512007)(1076003)(107886003)(6506007)(6666004)(4744005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: QfuLknIoR1X5+psfLcwZINWD5EcuS2n9pB65MRFNiMrLvJLJzJogGXjOsFLGhl84fjTAaieSi4htdxuv8qq8GFan4JavOmBVAC3BwAldsUb3tHxqvmilazOxOO4TjoyueOlKuHV3y5fT1Bw+cjQAtUWqc6CODGSD/hq1W+dcYjAfcxezd4KbYWXtPAaVjoK6cdjdr0aFj+wkd9p4xVxq+4F/StJfMmSjMQxxcYxabPRIDqJyT/VJqivL1PdzlEc0sQ73VIdVO8apUaDzUlcjQTIHrdDFZVHpIhzfFxbAx0CaPVfuGcZsYc88pFovMTXRcGngfDrzJfUyG0PnENEtEB7lOqjG0gtoCZpraWE9CrEmuxaJj3Q3U0jjuWrB03JKrPPcyOqaYwQduseV6hpsqZv0GM594qv6q1MfPl4darTOZvalt2XmJIP8uH9XWxMtTSzzolAJkrRY31Z0eSwqDU1kHoL/lDcIFR4tuOYnFrH8Ji+BuGaiVueOMc52H+EDTqfJfrs5gQToby6v0CGn6ub7oxvQeVWexXUCiC8Nkr9V5KoKniT2RVDq/Uss097CVSi6P17Q2wTYRhZ9Pszix68542RNNn5FmCEjcqHbUO0W4u+qBF39E/fIiBZvqFrDw3ZtvTKUmFiMxcUwExyuszMv15sRdZAgwp2TwTRoofc4W2uAL95xOhyntKBzO3tAVZTKf+apFB4zUvqv5yN2Mmtxrqx3NMe+TEohKvQ2L0I3qECxNErNnNvQG8wfZKwkNI8aSgH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QLMHQN2osOEpoXMb76od+GpYDMWSvZOH77VK+iYudYyZzH12yXtAU++e/eCAqDqd5APRjTMo/4//Oc9N+dPCJIkafFUXPmfHkHD9KYv59EdET8L2g09M7OQfaX+S4Vr7G/1zf/UHdB7/UfS/Dd3WvIbG+bxJvXnBnTTxUsLb1T4CAeb6SCJbi/ExnsgVC33xtLFeGO7OLrcsHPTFLSxMSoTBisx/TE9Wy1Zc9jrXYQeVXbkbP+lxpSFV8lB7ZUHO2B7gKVfPrRc8w51NmhT4uctq/bP+fjurfAnRQKdQHIl/40TxfyedosIfEU+XlmCb7PruiaXxPMAnreqDd0zU4GOf1p/VZYbxgWsmgGxIVcpi0G+6gdGX73Dg1DIIffwT2fOGrtLrwlH1FrUY94URrkgrsSpBeUA3hb7AFzB6Q6lRYdo/zYhB6/ERx8pm0L7DQAlQxwhcW37KwuNOmNBeCQaQoGWFAQwOS120BvhTolHSQX8QqljwaJmHW3Uo3zykkUQAPSdPj+qZpo3UBgXqWxkNGQsBfq7dzyZGHLelj8unLP2uMqpS9EdnrJifInkaBbckV3X/aaJ3VyyhweBCVted9l3J9so40xnkcxKT29S0eDu3SpEroQv8kALReJlgMZ328H21Ng+aNG3iOjYZIymoNCWILgWGr4V+8tk14m2/SfxFLX5OitjWIvQ== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4fe9f871-a98a-41d8-0394-08db1efaa386 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Mar 2023 10:56:43.8120 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: O/Q2A9RJB8RB5rIF094RYiB3sUbTL2RVjjnN4HWuGTq0s6Ic+DwtQnXISjIc51FEBn+tgJSmpB3hPOWfe39OoA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR10MB6719 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-07_05,2023-03-07_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 mlxscore=0 adultscore=0 spamscore=0 suspectscore=0 mlxlogscore=999 phishscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2303070098 X-Proofpoint-GUID: 5c_RBjOqSlILJBrmgmy5PvcIJife8IT9 X-Proofpoint-ORIG-GUID: 5c_RBjOqSlILJBrmgmy5PvcIJife8IT9 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org The check for device pointer for the SCSI command is unnecessary, so drop it. The only caller is scsi_try_host_reset() -> eh_host_reset_handler(), and there that pointer cannot be NULL. Indeed, there is already code later in the same function which does not check the device pointer for the SCSI command. Signed-off-by: John Garry --- drivers/scsi/scsi_debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c index 6f1dbd8dc37f..6707ccdc07c9 100644 --- a/drivers/scsi/scsi_debug.c +++ b/drivers/scsi/scsi_debug.c @@ -5446,7 +5446,7 @@ static int scsi_debug_host_reset(struct scsi_cmnd *SCpnt) int k = 0; ++num_host_resets; - if ((SCpnt->device) && (SDEBUG_OPT_ALL_NOISE & sdebug_opts)) + if (SDEBUG_OPT_ALL_NOISE & sdebug_opts) sdev_printk(KERN_INFO, SCpnt->device, "%s\n", __func__); spin_lock(&sdebug_host_list_lock); list_for_each_entry(sdbg_host, &sdebug_host_list, host_list) { From patchwork Tue Mar 7 10:55:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 660382 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B97D2C76186 for ; Tue, 7 Mar 2023 10:57:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231160AbjCGK5S (ORCPT ); Tue, 7 Mar 2023 05:57:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230384AbjCGK4t (ORCPT ); Tue, 7 Mar 2023 05:56:49 -0500 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 20C9A574FE; Tue, 7 Mar 2023 02:56:49 -0800 (PST) Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 32783r29002147; Tue, 7 Mar 2023 10:56:47 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=aH3QiSSDoKP7O5PCyGmv+RmzwMLrsmbkLrjNr9mvqeY=; b=gqPfwmP8H67xvIO52f2Q1c0+ZjE4pbDuaAmlZ15kGDIVPLg8tgYLwAi2UNdt5aCKVXlx SDdSlO8szaXgV5aAKYI0T5j5s5z2bx1V+rpxnlaw+5A2KPm7H1mHRnOusDDx+3mlhL3B DpHqJ5/nA+unO6shANstNo5Vdr7h/vQZ+n7J2QtS3JPGSXP4k0HhSx3JXn58W7Rup+qO W6VGpTTRy8XCz22jCj6403BVgjd+o0D2IwD5nwrpMJIesdBfVZxvjfk/PNkzxB0jOdES nDmI4ZSZZMJNjVi+AovfNc1uK319HizIbihaf1EyFaAWITodIH+VqEtPd1X3AqQ838wZ ZQ== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3p4161w5fn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 07 Mar 2023 10:56:47 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 327A86Sf037277; Tue, 7 Mar 2023 10:56:46 GMT Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam02lp2040.outbound.protection.outlook.com [104.47.51.40]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3p4txeavfw-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 07 Mar 2023 10:56:46 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=D1wLqQz6bu0wN9I1kk7iJQj9xqGF2hH+cryN445uSfLh2gFAKG08tANliGcUSVzyNH7t97qAB4XMR3803zC3Qv7Zigg8wcQJfrkfrjgu8BVudfciUVdtHMGHlPmwQKpyriOt5c9Fr4NWkwiSvX5zdVxlBlF4jcYOsbDVB4pKtg7XcVj2jjNM9erUsnEfZhIYu1C/WurYF9IxuNISP+jBXGhzNIuoczXY+sClmiW+Ex6U7kABtsegtAYnXB6hVqufJHqY5nQ25ozA9Gw2ukKI/fqL7x9Vlv/hgRfSunywnMzJI9U+g9+dDmmRusUDBQPhZn6lCvErmeidHWoTd+wjaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=aH3QiSSDoKP7O5PCyGmv+RmzwMLrsmbkLrjNr9mvqeY=; b=PJRKqCYqml5vzkfxEk8u57AVxHTThwzD2i8Wtb7txG4g2oYYj70geD8AiddG9f71WqpB5LAlXUC71QSSPA7dZ0p3V0OnpWHM2+JPPPymKrqd9fcKC4od9YaH5CHR58uIizf+rsA/9Ic4vm/i89C4ODwNq5VfTsMvCe2q5W1KCPRD+EGkZRTHB9jXpb0P5GZRZuBR609KU7Wtjqe6EDXO535CL1l1l4TNEX35Yb3L07jwwouZXbDB2peeXKmZzizQPeTOZe+5ZweuUmcpO9Kc6BL5mJtH3l5Sbv0q3mB3tX3brToFu6cZ0UwjSj3xkoopq2Yb2Lt3QJ2XnjQauhpsDA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=aH3QiSSDoKP7O5PCyGmv+RmzwMLrsmbkLrjNr9mvqeY=; b=osiE0N8sWqg2xKv+kVsZVnnFxtkhIyWFRukviyXgtoc2g6GKkUQxbRXSJ8+2bfRS0Qxz1QuqF7OF65FlJgpFctwNMm/p2xiqarTtbAwitmrOwyZt5NuqzhRX2eXxoY8ht5UJqtYwCD22BQmlcxHtPnHtEtnPsDNjV/9N9ploA+k= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by DM4PR10MB6719.namprd10.prod.outlook.com (2603:10b6:8:111::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6156.28; Tue, 7 Mar 2023 10:56:45 +0000 Received: from DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::fff7:981:3ae6:92eb]) by DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::fff7:981:3ae6:92eb%4]) with mapi id 15.20.6156.029; Tue, 7 Mar 2023 10:56:45 +0000 From: John Garry To: jejb@linux.ibm.com, martin.petersen@oracle.com Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, dgilbert@interlog.com, John Garry Subject: [PATCH 08/11] scsi: scsi_debug: Drop check for num_in_q exceeding queue depth Date: Tue, 7 Mar 2023 10:55:52 +0000 Message-Id: <20230307105555.3745277-9-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230307105555.3745277-1-john.g.garry@oracle.com> References: <20230307105555.3745277-1-john.g.garry@oracle.com> X-ClientProxiedBy: DM6PR06CA0098.namprd06.prod.outlook.com (2603:10b6:5:336::31) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|DM4PR10MB6719:EE_ X-MS-Office365-Filtering-Correlation-Id: 8f6a26cf-bf68-423f-0372-08db1efaa453 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fsMpJ8jS57lCAzp+lHkFayRroeBMg82q4meaJWWIXKh+hcQfj1hx3x39kJKgG+9i08vAj9I1KcGj7y5bPHScf3ElwDi420fb95kxG0NB8QlVQNzidDaEfHt6w5pKYxtJ/LI7fbONqEuKEoIZqPR6sag+oxuIx6zhCqeCCMD816eunvfFlXiq2JwMaSyx0vZMGyUp1GPM0LNm70sLXn9+3mHhmmkBDIgDgQkRF8vkHOnmPqgnQ+4jtG1ozvNQolmtKXUjafjSOoUCUHlnpTzGKZt1Pl07J4l0gwq+jHutzNqIiHGJQSYUxWhfVFwZgFWuCNx1KUC76+lfTJUEBRRC/HNWhgnSqxn6BYM6wb3BN12mg5/gq4QMdmEpO6VGaTV3RVfpX5Q8dCK+5h/E3xk351iAIaHEcRxZNhPemsAVmIc7K5oEFBcA674vA6t2xttBQCdMcXwDpZBCKIGxjkgVdKQZrpfcowhwd0trD3bhqaEOrNn+2N9GdbhGI7lS0gENCPvgbTOsjZaLxuF8doKPCZF1mmR07TWnLImXCwo+xTLCkV+7neZqVVe0xnlxz8hgYXLT+5xbCBpaNyoUQjt2/dx7957IqrQeywRYeEK5bySKutii19y7XMwu8sior1u1VOK2VbC7yudTgVOGcqixUA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR10MB4313.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230025)(346002)(396003)(136003)(376002)(366004)(39860400002)(451199018)(103116003)(66946007)(4326008)(66476007)(8676002)(41300700001)(83380400001)(2906002)(86362001)(38100700002)(8936002)(36756003)(66556008)(6486002)(478600001)(6636002)(316002)(5660300002)(26005)(186003)(2616005)(6512007)(1076003)(107886003)(6506007)(6666004); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: czI9ceaWfcZPRqzA/HAr9sW63uf/CynXKpxTEuzbOi4G16Cv7wdPc7mriqdQEBLN5pkSugH3lwGiHfhPcpgfMgOE/38BKq1t9zHzvVYaBwqWKpWYVSnnQAR9mG8vjN/Aq6Gdq3MplkHOP5d3s/ljW9t8vV/2HoVtSM+YNNB7bQQFC4/rmwduLN0RVbbdZHQoFEemFwRqzOEudjN8y/A37Hw0mi6IOg6buEa/SmSL3/nZDyEkDQgiF9xFZecKtIw8SFQ46rGouN8St3JjWrd/Sz1esdiOh0W4kworr3IsHQpUwdnQshcEU3AbS4MYjkdWNFX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lC99hpeWVNjkYVJOU5NPqduj6tNUEDZ3Eh8IrI+5XRs69x0y6m0VnwJXuf4P3T7zjOlldODxJdAw== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8f6a26cf-bf68-423f-0372-08db1efaa453 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Mar 2023 10:56:45.1724 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: xmGSjzEePJQSfFGLwynFCvbQZVTs+6Bl5bhpQMrk3uB4FP/9VjkIvVuoDyWQSNWCksULYciZ6mXmYXIQSPgoig== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR10MB6719 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-07_05,2023-03-07_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 mlxscore=0 adultscore=0 spamscore=0 suspectscore=0 mlxlogscore=999 phishscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2303070098 X-Proofpoint-GUID: 7CIIjZz_jvPlt4R0ZuqKSf--GUq6j1Z6 X-Proofpoint-ORIG-GUID: 7CIIjZz_jvPlt4R0ZuqKSf--GUq6j1Z6 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org The per-device num_in_q value cannot exceed the device queue depth, so drop the check. Signed-off-by: John Garry --- drivers/scsi/scsi_debug.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c index 6707ccdc07c9..fb7434d09cb9 100644 --- a/drivers/scsi/scsi_debug.c +++ b/drivers/scsi/scsi_debug.c @@ -5599,15 +5599,8 @@ static int schedule_resp(struct scsi_cmnd *cmnd, struct sdebug_dev_info *devip, } num_in_q = atomic_read(&devip->num_in_q); qdepth = cmnd->device->queue_depth; - if (unlikely((qdepth > 0) && (num_in_q >= qdepth))) { - if (scsi_result) { - spin_unlock_irqrestore(&sqp->qc_lock, iflags); - goto respond_in_thread; - } else - scsi_result = device_qfull_result; - } else if (unlikely(sdebug_every_nth && - (SDEBUG_OPT_RARE_TSF & sdebug_opts) && - (scsi_result == 0))) { + if (unlikely(sdebug_every_nth && (SDEBUG_OPT_RARE_TSF & sdebug_opts) && + (scsi_result == 0))) { if ((num_in_q == (qdepth - 1)) && (atomic_inc_return(&sdebug_a_tsf) >= abs(sdebug_every_nth))) { From patchwork Tue Mar 7 10:55:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 660964 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0D9B6C7618A for ; Tue, 7 Mar 2023 10:57:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231186AbjCGK5W (ORCPT ); Tue, 7 Mar 2023 05:57:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42620 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230387AbjCGK4z (ORCPT ); Tue, 7 Mar 2023 05:56:55 -0500 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9CDCE574FE; Tue, 7 Mar 2023 02:56:53 -0800 (PST) Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 32783pbe023546; Tue, 7 Mar 2023 10:56:50 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=46iqLIlJeaoqEX2H9ZKpRMpm382H/5bb8PEAoms267w=; b=sjh+PMI2TFpBaGQPpIr06xmSAjHqCNddyrv3GPETNB6Y43raRB+NwbE0F4kTJRh//Kn/ OwqGt/c17L1rzhD4y6Xv+6OfAOMYMxNSZh5f2yEcwHGoAI+YCJEGvQbXLEt/FjUwIvib zteL4eLWR9Wykskh1jwb9IaaVXY0B37Jt71FBuI2t7grUGjJ1X0jTrKyAHNh+SPxj5m7 LNe/s7AMjDwNWGHq5KCyEBjUFF8UieKwRcwiZATxDkp259Gmd1EsylT6Yo2mvXQeLTVz TmVPX3rw7fxVxGtL4DaxZFaR7nS0FhNtbVqQyxUiYJidgSd4vmlAPMPxi7pisFLrH9QO VQ== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3p416wn753-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 07 Mar 2023 10:56:49 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 327AgfEq025120; Tue, 7 Mar 2023 10:56:49 GMT Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam02lp2043.outbound.protection.outlook.com [104.47.51.43]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3p4ttjtwdy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 07 Mar 2023 10:56:49 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=h7QzZ3GD8FkqJU8UTDVxsk0JO8BzZikpZQ7K8IK1TO7Gm8pHUbIFEQqAfUT3YaLacVGqZgRaVGZ3jW/clSw+LSx/bu0YxTf5CndoBaGs2D+eYWWCf3aWLYgLnbJ7PkwfleRZttqMEdnKPQl11AfnVgJd0021RKIikO+Qz39sQTc55r+4j0RlQVWe2opyzcYLPgTxKW7q4u/1j8SrRrzgSkkjgWQ6OTY5/tfX6J1ReRPzNCkvIJcpBObxVdmJ68jItHlfnWF/YA9cygX6SbwXstVz55CqRCB5kcNOssWf5o0wrQ5cn3PUR5ci5rf04Z2dELuFtzT1rvQpI1ThKUh6Cg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=46iqLIlJeaoqEX2H9ZKpRMpm382H/5bb8PEAoms267w=; b=Q1JV1X7CUc9ildLcIJfK/Fa3Kmc5AFib0tmV+jP5m9S0xPIJ/FWo2bXNfiig5mbrOoWMY+SyphckFzhMSmUtL6fsptRKqb16o1iIIE0xgFVUIRSg3KYWLO5zbEzpil09y5IPOZVZ+yicqxqqJTLHPLq9Oppq498ZXInQFarJQy1oCNrvVbEpcVM1XgX1csm+NufyDcZSuGMHBM+Gqb1zKywf1XyeDAS7G9+vxZpVO71tK+xTZbGR0nwsPoZwAYyd+raWZNPOHcxy8lLsK3nkc1mst4VLht6pWIxoMxguqQYb7FK4WMOMPTJj6EG4AnjrPQ0qPt3SRYsx9vA5RafYTg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=46iqLIlJeaoqEX2H9ZKpRMpm382H/5bb8PEAoms267w=; b=JVqvYlEWFLkrAZ+yTeUEHi6IMK+3Pm+ugOwIlWROyXtk20+SiylxUVnCkUKdqgyszBLUzsDZOfEHmecsc9HDeWKgVnP/3KJPsJaNwlxcnhlqMFbemrE1X2k9HTcderKzPDCjMCw0rrdFyLapNwz/ttCols4NznXhPhpUoWlH8z0= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by DM4PR10MB6719.namprd10.prod.outlook.com (2603:10b6:8:111::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6156.28; Tue, 7 Mar 2023 10:56:47 +0000 Received: from DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::fff7:981:3ae6:92eb]) by DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::fff7:981:3ae6:92eb%4]) with mapi id 15.20.6156.029; Tue, 7 Mar 2023 10:56:47 +0000 From: John Garry To: jejb@linux.ibm.com, martin.petersen@oracle.com Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, dgilbert@interlog.com, John Garry Subject: [PATCH 09/11] scsi: scsi_debug: Drop sdebug_dev_info.num_in_q Date: Tue, 7 Mar 2023 10:55:53 +0000 Message-Id: <20230307105555.3745277-10-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230307105555.3745277-1-john.g.garry@oracle.com> References: <20230307105555.3745277-1-john.g.garry@oracle.com> X-ClientProxiedBy: DM5PR08CA0056.namprd08.prod.outlook.com (2603:10b6:4:60::45) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|DM4PR10MB6719:EE_ X-MS-Office365-Filtering-Correlation-Id: c57c4108-f8f6-4582-6420-08db1efaa586 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: t/yYYjSdY6yvf9KJWiQI+cw0c7Maxfusda0hdPUKOoXMgkuUnSjs8U6vVDGFFW+uQiTJZ4ho+viWwQThx1kDUQ8SN1IJBiV+QeygkWtpPNMbnMwVxHOjeHWKkRW//ZFGjPLlKM36Djz7b4HtR3wewyn9rgOAfBD55P5Gh7JOjckfQIG2PHYPlpdrN/4YccEkX8H4Cc9ChfOsHD+nLek4rWTCriun1t31v3kJWYbP+WtTuyvnlLCBqk+czietG2Dv/eLlMQVo4NeWawmQU/365FeP+OARxV1fhCBbwnXl/w6HhMhoh0H6mcQ8gJlJPTs77OTFrx+TlsCBCHekDrl6SMvKLTrACbblx5rcaSt7q72FI17hoQ/kzqJK543uuUYK8ws4o5ayP1D2EkFkwGkadVC9v7xEqiv0b9D3bQdfsCGf9bv4E4dhvnBeToC0aUk90ncfPQ+3yBX437DTNJw3jVqGH4a0qFhKz+WbrdAdMCGmby+Ax8o6TezIiG4RAovdArv0Gbp+z8Tj6kNdud5wScx3oz5QSQ6XhWlZQ49n+sWYMr5qxn9TYZlqieROWLONbCPp2i+ivRTx1s7gwNopGS2T8OV0yMnwVhscRTqYpOi+eAq2BMvd26l92dViLO6tLCpA1fijIUqTs5jl/Jlhpw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR10MB4313.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230025)(346002)(396003)(136003)(376002)(366004)(39860400002)(451199018)(103116003)(66946007)(4326008)(66476007)(8676002)(41300700001)(83380400001)(2906002)(86362001)(38100700002)(8936002)(36756003)(66556008)(6486002)(478600001)(6636002)(316002)(5660300002)(26005)(186003)(2616005)(6512007)(1076003)(107886003)(6506007)(6666004); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: waSCjIm2PUJdmFbKf1MQmtZVBt5XBORnCBoW7ObBW3n5OKNOVwMipK36fAgx2jtH97sQQRY2+r03D2oTkGpkqu1giyAuSU908BjZoknRZ4va+bSrylLhQq/q13LGKu4jfExm2ogHImwCzSCVhP7uZ4J8KL3ZFAyt4QdZ7jDqjXQNgMoQI98TXKrDyxpeJH/z0WsyTz5xmRl4l0JD3vnZEyOEmphIKrhGeL6TccyI6RhIHKwty8sSRnipil88tnV4Eh1AvhArSAgTpJD3Mk2U/adWYKyMWaI9CcF1TGX28JDwFI/aau0dR5yIrMwNWNa81mMyUTd+oPfRqQT4hJ/qdxCoMcPmwAh5GGbCw4OQJbl4Fx35JvX6XaTU5+RmygoiBR5NMfg1XWvSbg9TbH2oVbDtMDvvlz4+2IcXmYJs+ArItOz3faYYWrJLzJg/GOjgBHoxDx2z2FyVn63VGILlQS4b3YLiDD2LgavisMQ5Kfun7VYElrWFKcM3OPFJ+vQv3/rplKeZsQiX2tkt70zz/jkZj1xAHtWzXAT1Aiu/2SNCFaEUVS7fHSERgGEDA1NwtTwi3H9lO1RfM3yY+bguEYniHhUo7b9w9zwY7/MfB2/hkmLPZJk+MNPmx/jXZKE3YcDFM6sFIzcPH6uTIO96dPVCe1KOQeokh3CCXyz5Rn+ynQ6NKX6yF0olqDB/HA2rZkjV3MGppRkqn8iuOK8mjzHWH9xSqhrlKA48OiAbUW1PhwuaHnU24mTdUeQHKH/zW6EHR1LY9gVqcA8hnA/pnguOGd0Q2GVwT83ZdvUycZ8lm32uvvkAvHmIPaxXY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1dHk3wYUoxZhPcpk2AyjzYdl7xwEjzDeenSM/p/JHg07BPu3fT4Y0Ikr7u+/96ePwl8BnhYXWwJarMWycfvhiTD81kLn7e8E6c2YEwahoSzVIgmlBxcq/hsQ5aBB/1dp1GfXRFTkbrkAAfKfSlCffMy7K/8oVbG7EQ7rYUq0//ZCnJ5crv6Rre0OK2Hr6lENDtvj9byYmDabLG3rt7WOBiqR+QPbTKVwGbSPenWFNLE1ygrLIPYAcvrIqTwrYOigsURlyZ0y9ricFiCvIU/NkNU5TVMyryiTz3sY70tV8fvXWcryXZSqKBK8UgK9JaCbD5HFhf/kT+u0zbqq1jMLi7PHvY1LLcdnasj56yzWZVFYzT4GPGMXQkhYso9ojVaes5AFqS7q4ElIINTknF8/whqJRZvSKHuQmOn8P/v0A0MjRtz29n/6DlxdIS2RuAnJ3CYuCcuok/TefRNE3iDhLLeimRLMx016Zrcjwmf0RNlBpzO4JtKybESCQdH5/oXrh4QNdzC5E/56JSzPrlTVzYoqkfNYlz1yVsl205LEw6wjXvXh7+OIsoG/VWaKdPXAsqOgIQD26wDmhr+pbGOoKPbHO/vXb9p+xXfyKdMcq7gYmEvrm4vpD3b03W2A== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: c57c4108-f8f6-4582-6420-08db1efaa586 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Mar 2023 10:56:47.1712 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: CfyBDsXmrYM1a8VpUpwcTsVDQWT5GVMnoUYP2QrPksX8Rha4UPlWuyl57OB6BFA099OEEakCandYoFaZfsAosw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR10MB6719 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-07_05,2023-03-07_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 phishscore=0 malwarescore=0 mlxlogscore=999 bulkscore=0 mlxscore=0 adultscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2303070098 X-Proofpoint-GUID: RVTaIiKk_0yintXYF_-VmJH1bLNABMmU X-Proofpoint-ORIG-GUID: RVTaIiKk_0yintXYF_-VmJH1bLNABMmU Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org In schedule_resp(), under certain conditions we check whether the per-device queue is full (num_in_q == queue depth - 1) and we may inject a "task set full" (TSF) error if it is. However how we read num_in_q is racy - many threads may see the same "queue is full" value (and also issue a TSF). There is per-queue locking in reading per-device num_in_q, but that would not help. Replace how we read num_in_q at this location with a call to scsi_device_busy(). Calling scsi_device_busy() is likewise racy (as reading num_in_q), so nothing lost or gained. Calling scsi_device_busy() is also slow as it needs to read all bits in the per-device budget bitmap, but we can live with that since we're just a simulator and it's only under a certain configs which we would see this. Also move the "task set full" print earlier as it would only be called now under this conditions. However, previously it may not have been called - like returning early - but keep it simple and always call it. At this point we can drop sdebug_dev_info.num_in_q - it is difficult to maintain properly and adds extra normal case command processing. Signed-off-by: John Garry --- drivers/scsi/scsi_debug.c | 63 ++++++++++----------------------------- 1 file changed, 16 insertions(+), 47 deletions(-) diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c index fb7434d09cb9..cf3745d7b8f9 100644 --- a/drivers/scsi/scsi_debug.c +++ b/drivers/scsi/scsi_debug.c @@ -288,7 +288,6 @@ struct sdebug_dev_info { uuid_t lu_name; struct sdebug_host_info *sdbg_host; unsigned long uas_bm[1]; - atomic_t num_in_q; atomic_t stopped; /* 1: by SSU, 2: device start */ bool used; @@ -4933,7 +4932,6 @@ static void sdebug_q_cmd_complete(struct sdebug_defer *sd_dp) struct sdebug_queue *sqp; struct sdebug_queued_cmd *sqcp; struct scsi_cmnd *scp; - struct sdebug_dev_info *devip; if (unlikely(aborted)) sd_dp->aborted = false; @@ -4958,11 +4956,7 @@ static void sdebug_q_cmd_complete(struct sdebug_defer *sd_dp) sd_dp->sqa_idx, qc_idx, sd_dp->hc_idx); return; } - devip = (struct sdebug_dev_info *)scp->device->hostdata; - if (likely(devip)) - atomic_dec(&devip->num_in_q); - else - pr_err("devip=NULL\n"); + if (unlikely(atomic_read(&retired_max_queue) > 0)) retiring = 1; @@ -5194,7 +5188,6 @@ static struct sdebug_dev_info *find_build_dev_info(struct scsi_device *sdev) open_devip->target = sdev->id; open_devip->lun = sdev->lun; open_devip->sdbg_host = sdbg_host; - atomic_set(&open_devip->num_in_q, 0); set_bit(SDEBUG_UA_POOCCUR, open_devip->uas_bm); open_devip->used = true; return open_devip; @@ -5265,7 +5258,6 @@ static bool stop_queued_cmnd(struct scsi_cmnd *cmnd) enum sdeb_defer_type l_defer_t; struct sdebug_queue *sqp; struct sdebug_queued_cmd *sqcp; - struct sdebug_dev_info *devip; struct sdebug_defer *sd_dp; for (j = 0, sqp = sdebug_q_arr; j < submit_queues; ++j, ++sqp) { @@ -5280,10 +5272,6 @@ static bool stop_queued_cmnd(struct scsi_cmnd *cmnd) if (cmnd != sqcp->a_cmnd) continue; /* found */ - devip = (struct sdebug_dev_info *) - cmnd->device->hostdata; - if (devip) - atomic_dec(&devip->num_in_q); sqcp->a_cmnd = NULL; sd_dp = sqcp->sd_dp; if (sd_dp) { @@ -5310,7 +5298,6 @@ static void stop_all_queued(void) enum sdeb_defer_type l_defer_t; struct sdebug_queue *sqp; struct sdebug_queued_cmd *sqcp; - struct sdebug_dev_info *devip; struct sdebug_defer *sd_dp; for (j = 0, sqp = sdebug_q_arr; j < submit_queues; ++j, ++sqp) { @@ -5320,10 +5307,6 @@ static void stop_all_queued(void) sqcp = &sqp->qc_arr[k]; if (sqcp->a_cmnd == NULL) continue; - devip = (struct sdebug_dev_info *) - sqcp->a_cmnd->device->hostdata; - if (devip) - atomic_dec(&devip->num_in_q); sqcp->a_cmnd = NULL; sd_dp = sqcp->sd_dp; if (sd_dp) { @@ -5571,9 +5554,8 @@ static int schedule_resp(struct scsi_cmnd *cmnd, struct sdebug_dev_info *devip, int delta_jiff, int ndelay) { bool new_sd_dp; - bool inject = false; bool polled = scsi_cmd_to_rq(cmnd)->cmd_flags & REQ_POLLED; - int k, num_in_q, qdepth; + int k; unsigned long iflags; u64 ns_from_boot = 0; struct sdebug_queue *sqp; @@ -5597,16 +5579,21 @@ static int schedule_resp(struct scsi_cmnd *cmnd, struct sdebug_dev_info *devip, spin_unlock_irqrestore(&sqp->qc_lock, iflags); return SCSI_MLQUEUE_HOST_BUSY; } - num_in_q = atomic_read(&devip->num_in_q); - qdepth = cmnd->device->queue_depth; + if (unlikely(sdebug_every_nth && (SDEBUG_OPT_RARE_TSF & sdebug_opts) && (scsi_result == 0))) { + int num_in_q = scsi_device_busy(sdp); + int qdepth = cmnd->device->queue_depth; + if ((num_in_q == (qdepth - 1)) && (atomic_inc_return(&sdebug_a_tsf) >= abs(sdebug_every_nth))) { atomic_set(&sdebug_a_tsf, 0); - inject = true; scsi_result = device_qfull_result; + + if (unlikely(SDEBUG_OPT_Q_NOISE & sdebug_opts)) + sdev_printk(KERN_INFO, sdp, "%s: num_in_q=%d +1, status: TASK SET FULL\n", + __func__, num_in_q); } } @@ -5622,7 +5609,6 @@ static int schedule_resp(struct scsi_cmnd *cmnd, struct sdebug_dev_info *devip, goto respond_in_thread; } set_bit(k, sqp->in_use_bm); - atomic_inc(&devip->num_in_q); sqcp = &sqp->qc_arr[k]; sqcp->a_cmnd = cmnd; cmnd->host_scribble = (unsigned char *)sqcp; @@ -5632,7 +5618,6 @@ static int schedule_resp(struct scsi_cmnd *cmnd, struct sdebug_dev_info *devip, if (!sd_dp) { sd_dp = kzalloc(sizeof(*sd_dp), GFP_ATOMIC); if (!sd_dp) { - atomic_dec(&devip->num_in_q); clear_bit(k, sqp->in_use_bm); return SCSI_MLQUEUE_HOST_BUSY; } @@ -5692,7 +5677,6 @@ static int schedule_resp(struct scsi_cmnd *cmnd, struct sdebug_dev_info *devip, if (kt <= d) { /* elapsed duration >= kt */ spin_lock_irqsave(&sqp->qc_lock, iflags); sqcp->a_cmnd = NULL; - atomic_dec(&devip->num_in_q); clear_bit(k, sqp->in_use_bm); spin_unlock_irqrestore(&sqp->qc_lock, iflags); if (new_sd_dp) @@ -5768,9 +5752,7 @@ static int schedule_resp(struct scsi_cmnd *cmnd, struct sdebug_dev_info *devip, sd_dp->aborted = false; } } - if (unlikely((SDEBUG_OPT_Q_NOISE & sdebug_opts) && scsi_result == device_qfull_result)) - sdev_printk(KERN_INFO, sdp, "%s: num_in_q=%d +1, %s%s\n", __func__, - num_in_q, (inject ? " " : ""), "status: TASK SET FULL"); + return 0; respond_in_thread: /* call back to mid-layer using invocation thread */ @@ -7375,17 +7357,12 @@ static void sdebug_do_remove_host(bool the_end) static int sdebug_change_qdepth(struct scsi_device *sdev, int qdepth) { - int num_in_q = 0; - struct sdebug_dev_info *devip; + struct sdebug_dev_info *devip = sdev->hostdata; - block_unblock_all_queues(true); - devip = (struct sdebug_dev_info *)sdev->hostdata; - if (NULL == devip) { - block_unblock_all_queues(false); + if (!devip) return -ENODEV; - } - num_in_q = atomic_read(&devip->num_in_q); + block_unblock_all_queues(true); if (qdepth > SDEBUG_CANQUEUE) { qdepth = SDEBUG_CANQUEUE; pr_warn("%s: requested qdepth [%d] exceeds canqueue [%d], trim\n", __func__, @@ -7396,10 +7373,8 @@ static int sdebug_change_qdepth(struct scsi_device *sdev, int qdepth) if (qdepth != sdev->queue_depth) scsi_change_queue_depth(sdev, qdepth); - if (SDEBUG_OPT_Q_NOISE & sdebug_opts) { - sdev_printk(KERN_INFO, sdev, "%s: qdepth=%d, num_in_q=%d\n", - __func__, qdepth, num_in_q); - } + if (SDEBUG_OPT_Q_NOISE & sdebug_opts) + sdev_printk(KERN_INFO, sdev, "%s: qdepth=%d\n", __func__, qdepth); block_unblock_all_queues(false); return sdev->queue_depth; } @@ -7501,7 +7476,6 @@ static int sdebug_blk_mq_poll(struct Scsi_Host *shost, unsigned int queue_num) struct sdebug_queue *sqp; struct sdebug_queued_cmd *sqcp; struct scsi_cmnd *scp; - struct sdebug_dev_info *devip; struct sdebug_defer *sd_dp; sqp = sdebug_q_arr + queue_num; @@ -7539,11 +7513,6 @@ static int sdebug_blk_mq_poll(struct Scsi_Host *shost, unsigned int queue_num) } else /* ignoring non REQ_POLLED requests */ continue; - devip = (struct sdebug_dev_info *)scp->device->hostdata; - if (likely(devip)) - atomic_dec(&devip->num_in_q); - else - pr_err("devip=NULL from %s\n", __func__); if (unlikely(atomic_read(&retired_max_queue) > 0)) retiring = true; From patchwork Tue Mar 7 10:55:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 660380 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 71827C678D5 for ; Tue, 7 Mar 2023 10:57:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231207AbjCGK5Z (ORCPT ); Tue, 7 Mar 2023 05:57:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42622 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230391AbjCGK45 (ORCPT ); Tue, 7 Mar 2023 05:56:57 -0500 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C931B5BC8A; Tue, 7 Mar 2023 02:56:53 -0800 (PST) Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 327846D9007773; Tue, 7 Mar 2023 10:56:50 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=jTs93JwNEgtN/1ilRQDl0kkIpgUw0uHJTIQj7LpZ/Gg=; b=L7x28Xx1k3xwEoCYeKxxxn85SCipqm1PtwuV3jSYIXS09RXz+Qn+XU7Y/isiXATR+HDB ZgJIiFDLQQ+WEmWNHfyIuLGq6I8D1WKmFmYr+iAhVWEnWVxyP6qWbPnHCzFmwEieFyDZ mbRKKchLLSR6DbYGWZjmYdo2/O4jQDwfq5JWxcoMD3xZ3g2nBiLOXHXXgI1qIpMfB0uo 3iuoH7JIKWWiv40cAYlSSUNblqq0/97S/cXPf+Wyb6fdyN/Xy3ucJTGYFSE5jI5Tv7Xi b32ghEc7slLvK+GGhU1R9BfyAotUM/aJ+WFdu9VGnHpbeGT2Vs5sc8tPsySENrIW2oqX tw== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3p5nn91gx2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 07 Mar 2023 10:56:50 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 327AgfEr025120; Tue, 7 Mar 2023 10:56:49 GMT Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam02lp2043.outbound.protection.outlook.com [104.47.51.43]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3p4ttjtwdy-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 07 Mar 2023 10:56:49 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=K/8Q35VmAyg/6Zf22MPXd30gOm5PwIjBsDA+gbSt2UD+SFBaIZydllr4KDXcC6KZ/aAWli5cHX8TAJWxXTUll2aKpAmXOl0ubhsB7/shRk9PitjSFDuOVo1ELbxkqTKJCihNjFNWDLaWJexbmgiu2H6cgLy//XD0/9qQk0P6OBJYtgGjdusafMtmn4+hXV7SFuXR4RKT4ADZQYnXFuNtwoY7aUYRKDtfE9Q/Cy3heNKgBt3OlKqxbt6RDuKdExofItDfXJOd/EV0i0pNF2K8p1NoojkLXzndjEKFsjIkAZnSWXp+q8Tffo4urLmL7NJXA4c/uozI4zKWI+okZiGn8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=jTs93JwNEgtN/1ilRQDl0kkIpgUw0uHJTIQj7LpZ/Gg=; b=NTXZ4i2kV6W3EpDYSq/JH9Wusf+7UsyA1jdLROz6AdAnXJG6TsnE3mgeD52vn7PF9CTVb0OQO3aGgJ+hLscEV10HlI8qVbuwve4qBcq6aNFvX88l2FSmWF2neQ2LVNXeRC1P3VIdbIRmVnY+p+at4EnaZd6yDPhKziPiVXTFYhDNVpucjgevB/OkQ5SqzkYmH2FRdxI7Yr+pnBdIO7kFGIgMfR5UVt6KBjIulhUKnqrObeo1nMbIeLnxIDeSMJVAWr5kdQB0iiTu4vhkBjK1nC7/BKgUUAR7Z++8Sg5iLm0YHG7PNjeZ2QOWq75q8W6UBbVbWnOTZEfzQMiFF7FVuQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=jTs93JwNEgtN/1ilRQDl0kkIpgUw0uHJTIQj7LpZ/Gg=; b=znH/OEKWwLLtBVZyCng4/YPL+aLnlxd4xLJM5MYwEiAdT3lILGH9G+1ptZJMFMbaIrLcAvUypb4ZigLaF6ZmKwBTOjzHhn+meu9z3IujiyCfT9NfzoxohU0FGyubDiw4oDeiSKW4hnHI6KZ9K3lQ3PFKHHZXDzGfwCnSm7ZT9Rs= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by DM4PR10MB6719.namprd10.prod.outlook.com (2603:10b6:8:111::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6156.28; Tue, 7 Mar 2023 10:56:48 +0000 Received: from DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::fff7:981:3ae6:92eb]) by DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::fff7:981:3ae6:92eb%4]) with mapi id 15.20.6156.029; Tue, 7 Mar 2023 10:56:48 +0000 From: John Garry To: jejb@linux.ibm.com, martin.petersen@oracle.com Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, dgilbert@interlog.com, John Garry Subject: [PATCH 10/11] scsi: scsi_debug: Get command abort feature working again Date: Tue, 7 Mar 2023 10:55:54 +0000 Message-Id: <20230307105555.3745277-11-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230307105555.3745277-1-john.g.garry@oracle.com> References: <20230307105555.3745277-1-john.g.garry@oracle.com> X-ClientProxiedBy: DM6PR03CA0063.namprd03.prod.outlook.com (2603:10b6:5:100::40) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|DM4PR10MB6719:EE_ X-MS-Office365-Filtering-Correlation-Id: 2ea82c69-81fa-4c3a-4494-08db1efaa664 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: H3LzNIjZaYMOKExyboekoeEzU7uuaXbYxtx7xkZfSi9nIKNWObx5A0+lwx1GzZhFej2sjrckPgQVmpEvhehhdp1vXU9KsljlFaT4WBWisnhlgnfEFZ6/85mnKzbRRkkUfVwprkYaxU/UWojaZpUX6YT3aSmtbc2F5sHNDESvCntPryE+Fs/w5kEQEti8DbmP5kpRg/3hxhdCLUEH5LQhmEXf0y3KU9JRgDm0nuciOeokUTXEKMPiBglwYIrfQ29Plb0sR4KMC6rTjQS+z9DKxwi6RcMI/bmE8US3c47gOeHN008XpX8sbAMdx/EHcNMVynVJryCe9vYI3bhPTc90uBche8yBt9SjxiQ9iAq/caXXv3tWiVQO1V+5/Qh/B1dFbg5nSLkmBot9yV56oPgeGf+jNJkksQW/qkv8OCjjf5fXKxVqoK58NWpfm8rJ0RXyV1ny5Ng9Xt9VaiwXhc6AFk03+XTIxWskeeLu+tW0ubQRXKSD8BporhzfTf1gVHrHssDTb7yN4aVJMAmALIRY/J4NzrcprHGa6SEULiZqFMEEqcqDREt96VsM7lfWoVst0+Qz02wq8EFyFatuiixy+yNtzd4u0oem5B91DEBl7Er+rbqdHXbSHZwb+WXGtGgSDAVtKq4vsTuVzsBLpfZEOg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR10MB4313.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230025)(346002)(396003)(136003)(376002)(366004)(39860400002)(451199018)(103116003)(66946007)(4326008)(66476007)(8676002)(41300700001)(83380400001)(2906002)(86362001)(38100700002)(8936002)(36756003)(66556008)(6486002)(478600001)(6636002)(316002)(5660300002)(26005)(186003)(2616005)(6512007)(1076003)(107886003)(6506007)(6666004); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 0bYAF8cVUF6oSthlCrIQG0Y+NQd4YDCyukzPsyi4vSfXMZ2KTmXN+MpoWJeiPFzC/pRNSaxEhub4CES/ae/BLoY9gH+afuXvNKOciTFaxUCQDBsW1fwPaq3hep3VzR6Cpd1wtHVGWbrkeczb0vzPkZ8oVdolhMZNRGs176nTZe5SCupHI5nfMBNhJ6ZQfGAbJx4me8I0AqJlffmTl8ZKQjr5n59p6h8rckHGcRtZXl0r3orihHWIu3i644ekml7v6NQOhovPNhCcdpo3rWi34kP/e8jJDEksRgTvmufpNFg8sMHu0C16eHT+tQZO+RKGu57/wfqmc/W11bmObDJYrbPKACF0WotbqV3BXCWPbo0TxU1ntTzvZjZc62Hg43Tz0BmWJ9i3uubuZA3wEDV1CMo5Iepea7crqFY1qrYr/jtNl4i6iBE/rtl+Z4UBWPcJid6gqB+jCRb7S4yfVHg1EaMOnzc9sj+EwJkxKR1SqYliHlZuBBwJcPJzNfuySLOaW2pzT9By2k7UJm4XQUGn/VttlQIwRcZK4bYJ7fHQl1imPpSfRtvyhSH9cLG/VNZBkGT1SF0VEH2iexfWLVD2M5Rab79w0oP3ENuVYtB12oiocAXn3lN4UUYcXuClVQDdJU3FlGZW2pCiZrbjTHOELHFuRBt+n6WrPT+BTTC3XtCHBmyLEngGVfwC6ZV/BxfibJpQ+HhRwCs7WQiTmk9Kl1VeFZ1C6XV4Ab2aVevtj9pHG0JyFo3Cg+1qP/wYKF9C4zRKTAvCzDq/y6Hzoqs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nPTLdUFF7hhPqsu+vPdtCOOPtIPQSi7M0iFzu47P6QXQzt2R1Mt82lWkgRZWj3A+3ZHGJej5s9J3sFATSuvv0koEdV2XbgVEv6079IzhgyJ3IaoAfGONdY2EA95s/KSFuLqYXZFY961hPtHs16mfGoPgoNBFn2HjA/Oi/hXht3Ush8BanlBMGM6/k1NGx3xjTiYOD5SrKu5KkFoo2jpXXJtOIvSX7B3j/eKYotwUVX3V3Sem9p1eri58BF+13fqFK0NB201a7EIuKOHQQoc/sQed0hfgrTlRQ1RYFiA7Kxwnqx9Iman67RsTslZTLy/jff/hisF9ff+tCCX3X53npZBvNoIOFuif/IMPPiN07gyEP3Do9d6T4Z1PVkmwGF/asAbA3ycIT5jo7qWdCC0ua3uGRInK0NJftFRjCbhr07lPb67F7WicOU4xDTnJW2Qgy4Fh4Wh0CE3ZYLAFHbgBlid10vRpzBcWECM0QUHtNPpZC3p8jHJENTt7/qt6coef0rUbyIVSQ5ihYT6DPx7/cGfYwOwex/Mr753epsuhmWw033JHA8gFOX4FnJlIPGZARcnRhR/RguVAyLXvfmLg/RSwFr/vCptHH2HZWjAtDYlmch6mNruhehQ7rqc4lipULgoHnHjfdor+T+0iPeK3wvC42t8q9nsTBaNoz2w== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2ea82c69-81fa-4c3a-4494-08db1efaa664 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Mar 2023 10:56:48.6240 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ++NHwqZUwLbzaq7AqoYsgyqPaf8wtsm8/cdbf/v2rcICn4Dvvp8LSqY++ILbY1njE9im3pqoxL3WkfzQhvF7Ww== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR10MB6719 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-07_05,2023-03-07_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 phishscore=0 malwarescore=0 mlxlogscore=999 bulkscore=0 mlxscore=0 adultscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2303070098 X-Proofpoint-GUID: UwXzWWmvM349DpyMgEX2icKhh2pDuOzV X-Proofpoint-ORIG-GUID: UwXzWWmvM349DpyMgEX2icKhh2pDuOzV Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org The command abort feature allows us to test aborting a command which has timed-out. The idea is that for specific commands we just don't call scsi_done() and allow the request to timeout, which ensures SCSI EH kicks-in we try to abort the command. Since commit 4a0c6f432d15 ("scsi: scsi_debug: Add new defer type for mq_poll") this does not seem to work. The issue is that we clear the sd_dp->aborted flag in schedule_resp() before the completion callback has run. When the completion callback actually runs, it calls scsi_done() as normal as sd_dp->aborted unset. This is all very racy. Fix by not clearing sd_dp->aborted in schedule_resp(). Also move the call to blk_abort_request() from schedule_resp() to sdebug_q_cmd_complete(), which makes the code have a more logical sequence. I also note that this feature only works for commands which are classed as "SDEG_RES_IMMED_MASK", but only practically triggered with prior RW commands. So for my experiment I need to run fio to trigger the error on the "nth" command (see inject_on_this_cmd()), and then run something like sg_sync to queue a command to actually trigger the abort. Signed-off-by: John Garry --- drivers/scsi/scsi_debug.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c index cf3745d7b8f9..6cf30fceab78 100644 --- a/drivers/scsi/scsi_debug.c +++ b/drivers/scsi/scsi_debug.c @@ -4985,7 +4985,8 @@ static void sdebug_q_cmd_complete(struct sdebug_defer *sd_dp) spin_unlock_irqrestore(&sqp->qc_lock, iflags); if (unlikely(aborted)) { if (sdebug_verbose) - pr_info("bypassing scsi_done() due to aborted cmd\n"); + pr_info("bypassing scsi_done() due to aborted cmd, kicking-off EH\n"); + blk_abort_request(scsi_cmd_to_rq(scp)); return; } scsi_done(scp); /* callback to mid level */ @@ -5718,8 +5719,13 @@ static int schedule_resp(struct scsi_cmnd *cmnd, struct sdebug_dev_info *devip, sd_dp->issuing_cpu = raw_smp_processor_id(); } else { /* jdelay < 0, use work queue */ if (unlikely((sdebug_opts & SDEBUG_OPT_CMD_ABORT) && - atomic_read(&sdeb_inject_pending))) + atomic_read(&sdeb_inject_pending))) { sd_dp->aborted = true; + atomic_set(&sdeb_inject_pending, 0); + sdev_printk(KERN_INFO, sdp, "abort request tag=%#x\n", + blk_mq_unique_tag_to_tag(get_tag(cmnd))); + } + if (polled) { sd_dp->cmpl_ts = ns_to_ktime(ns_from_boot); spin_lock_irqsave(&sqp->qc_lock, iflags); @@ -5744,13 +5750,6 @@ static int schedule_resp(struct scsi_cmnd *cmnd, struct sdebug_dev_info *devip, } if (sdebug_statistics) sd_dp->issuing_cpu = raw_smp_processor_id(); - if (unlikely(sd_dp->aborted)) { - sdev_printk(KERN_INFO, sdp, "abort request tag %d\n", - scsi_cmd_to_rq(cmnd)->tag); - blk_abort_request(scsi_cmd_to_rq(cmnd)); - atomic_set(&sdeb_inject_pending, 0); - sd_dp->aborted = false; - } } return 0; From patchwork Tue Mar 7 10:55:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 660965 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3DDA6C76195 for ; Tue, 7 Mar 2023 10:57:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231199AbjCGK5X (ORCPT ); Tue, 7 Mar 2023 05:57:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42624 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230388AbjCGK45 (ORCPT ); Tue, 7 Mar 2023 05:56:57 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6986157D2C; Tue, 7 Mar 2023 02:56:55 -0800 (PST) Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 32783nqY001667; Tue, 7 Mar 2023 10:56:52 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=8FhSnp/i5FW6gxnbBvylWTT8tXuOk2weQX3imZQFZLI=; b=VnPew6DqZr6pk3CUQerUNTlsj9L1vWrTjgnbCtjyYVb7IhfEnlJLOJL/HBwEmL/X8bgs brmEHpWn5epvU3rHEvG+UCRbnSQHo0Ja1eP4G/c/pQ2N55lcfJACObIq5fRDs50n48C6 z4SuvbMlrvtACne3FLDuhMYgYaqTlHpGwiJGWoX8Amdipo4Qs2Mj2mMQRJJuEhb9wOsE 46cbfUI9Rw9I7cJ7w3Qfu8Mh8JSCKziy1ZPFFGtKqmQYl4w8/tiI/9qNUkdE4bgVw0Nj gIq4m4HA5l1a+GSGZAWCXVGnbpJwlPcsV0cKCeSjBZNYceUwsldWzlWGLuwi2xU/6IGN Bg== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3p415hw87g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 07 Mar 2023 10:56:52 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 3279Yv3D017135; Tue, 7 Mar 2023 10:56:51 GMT Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam02lp2048.outbound.protection.outlook.com [104.47.51.48]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3p4tur3wvk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 07 Mar 2023 10:56:51 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UXZT3MEMWpPpnDEmsc8UGoojK91LibHizOvHMPX3l6LDlW3HkeYQOc0CQETZ0Bn5N0JGHs4mJy4l043rb8VN9c8OMRe2g6rHp9Ut+Ea0YyJt3wBly4TUoMwtunsYnfG2bwqvi0CJGN95vWh6ysGkU9EUoVDrrEuwo799DMjU74RXlp8m95U6odwt35iStUrHSRHGMsOba4GmdB0e6TXzg+UIS80/J25jhjHyZTS+RdnmpNN6iCcmFhfKx8Rv3HwAc7y1bgBj3ONMOzKQyaan+Bmo67nVvX3vCRxzpKHDQKRTWQuOkNrpqeifQeH7ArxMHvV+HuAPeOsJQgo5y5TBWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=8FhSnp/i5FW6gxnbBvylWTT8tXuOk2weQX3imZQFZLI=; b=VHuq7nIgxtao6XQA6eH5ae9gGtjeeYaWC0zpd5+qjUWQZ5YvlN2IEDf9ceMl9DbvPgMNDgRtaxcRNt4hvOV+xubqymrxgs1y1eTR2HTfAizKC5M06lgxCspF2ZjDrMuMcDQkNu783Vj2Zh53g+soAhgA4j4XzgIJ8+oVyvt/69F/wCHADM0+lAAuhhX5eXbmalnlF/SijxVIlr8qU/6Bnuk8T29X6pH0Qk/cW03kS9aBIzcK00LVJm2tIBC1wZJeXBNscoPWVjLZWfR56mAetaIH3q2AGXOMaHtRz0sKQtzQ5qt7FzDDbwpISOYYVq46P+S1iEvJXVffNx/5P1Ni1A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8FhSnp/i5FW6gxnbBvylWTT8tXuOk2weQX3imZQFZLI=; b=JuJUpSEvpjD/wP3VMZrwuOSjDGPiR5mDqr6Y5DUcIttlfbG1L46NP2vsHvPdhcJiFY2sQbjh7GVIm+K1ncsVsKX1wUbTpAG4yn1uu2pmIJdRGisDhZIrK2GG3nQ8KKy5spYPhZp43cvRC/F0Zxrb5FQrWf9VAszbnczXhTMSpE8= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by DM4PR10MB6719.namprd10.prod.outlook.com (2603:10b6:8:111::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6156.28; Tue, 7 Mar 2023 10:56:50 +0000 Received: from DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::fff7:981:3ae6:92eb]) by DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::fff7:981:3ae6:92eb%4]) with mapi id 15.20.6156.029; Tue, 7 Mar 2023 10:56:50 +0000 From: John Garry To: jejb@linux.ibm.com, martin.petersen@oracle.com Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, dgilbert@interlog.com, John Garry Subject: [PATCH 11/11] scsi: scsi_debug: Add poll mode deferred completions to statistics Date: Tue, 7 Mar 2023 10:55:55 +0000 Message-Id: <20230307105555.3745277-12-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230307105555.3745277-1-john.g.garry@oracle.com> References: <20230307105555.3745277-1-john.g.garry@oracle.com> X-ClientProxiedBy: DM6PR18CA0030.namprd18.prod.outlook.com (2603:10b6:5:15b::43) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|DM4PR10MB6719:EE_ X-MS-Office365-Filtering-Correlation-Id: e470f735-aab2-4417-66e6-08db1efaa75c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2LqCq0bIGWblp5n9se3F8r7Bj4XznANauG5MFsQCE+yAf+iHiJ24Ty1OomdhIn01YtAkj4kBpoGxsAvATwIHacPkpgOoS7guOCYibTwIdykmMKrs4ozdijFwMVZAE8duwUv3Jy4m6mMd5mFa2xTcUh3L7bHwPivMHw01ofZtssKp10GcplXrerRDLJkRrIWktECwQpfb6H+cGurNZfnicKybtbePDiFPaXw1kgdNRpOLeAtmLn6jAp4Ql84bzP5TsRSUjt8Tm6ug1xNIEQiyarjzEWHFdCxjWFt0wDVcxAXfH30u1Qi2H4BOvTeE7UZaMJSL9inLWQ8TbXebjWUNUtcd/tkLzB1ex/kAqcA9S2q1nzyEJYSNQ9op/JeHXxubRBKyOIkRuoZgcv/VmNm3xU4syeZr+m+FzN7wLl0eX1N6Mp75b3n3RwRZRKlmysKpnWC4uoHpd0D+nI9OZFocVPV/K2c4nPP+KR0D+o6ZGGYb3pryv1/WgxasmFZ0+oddfe0er5LxXhN3jGWoWWqnwdQ6dKvd+s5ZJVh5wjsSLOMSblGFD0dKpzelve0B8tIV6d7hNZ1mr6cs97zDduZd9HHQrjzUyGq83goHmBdByA9h2ssBKrdBPnXTxygVKIzUH7xQ9ao7B/KOcCkhF9DbjA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR10MB4313.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230025)(346002)(396003)(136003)(376002)(366004)(39860400002)(451199018)(103116003)(66946007)(4326008)(66476007)(8676002)(41300700001)(83380400001)(2906002)(86362001)(38100700002)(8936002)(36756003)(66556008)(6486002)(478600001)(6636002)(316002)(5660300002)(26005)(186003)(2616005)(6512007)(1076003)(107886003)(6506007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: bM3qlTf2+YrgafV575SaWUO/iJy/izUGwkVvTMaaeVj3DNnThsQHeqPaxcfGdLq6wvc75fVai+vG3CWv/naFBRjcnwrPe14BxyLktEXAvYiZ5+xMfb4oU7RSANDWc2MU2my6giPWVNlD0jTyr2j1xyMl/M2sudkGdfVVOBx63sKZKB87JeQMWtRFJf/On3kgPXih/5la0X6BjpjD8kDnOZBCiiGt36N7xVwl/PSFjCHKDo4FCFJfT4AS6VRdqc21MXh7Rb97b9k00DZt/eteuyaOXUSAurQLkvheSFdXwlmYo9f1HErWcwR7J3ZtwKb6fUZBhMg4JFRLi7KFjXXMy4TS2qdpRfE/kKwm/IppJcvj5H8kyN6o7XHOYPgbYiCDLS9h/6W8J2fIlcMXPoIuysbpoWqTczXm4OzOl4fKz8JtiZ5/0uok15Fkflm7xWlo3ZmmWC17FxL0sPY1EJgaIZp63SEWZAg5psP3UZ4WH+og1NL9dBQ4m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DFxRyxp29w7EWZCrno9QMlQJTHO0eo82aEImoEU3Zf58wgT1JsHA== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: dAdg3zlCNq6crqIzFVDaIBMspPeSzxnFSKavp8ioBdG/NsMjtCoYuhoy7dAN/ntAYGMBIaoguwuaxJc5oKsDl1N2juhMZY/rjShkaWItU+/k01VdBwHeWhorhP6eiJ9nmgj01KW8uS2h8Z/ahS/3QtF9et4Nat3ToFSoIW1HxHyPZC9Iks3EXNGVYiCCNbuVIvlMnEF8Oc6DgLt6m6BGgJvfbP2pgPee86S+KaBDKXvoGyQVkGm9ha9l5lSmkMzpRXaPZLCHoVj7g48QiCrrqfmbz24fvhKiIoBgRyoHczehRJcSMdDola9zKX2ceP/mqgs8ozH3Bk5+doZ8+qfy/gsC806EGlvRM/x3WwBAEA40+QNtYgczO7f1s0DI6PKoJED4oQqCc7DVDHcYJAIQeP9nfW7Mwwztg6WRlx6wYUwudhNXw0l78EsxxMg+QGax2OBvo1QUw+l9dY644HSyMP327W6vzlqOvVcBtT884M1Ho5nr06H3zUk59VCVM5i2V/1ESdxWYnFD6kwl9Isqv+jjQOD6g6KDGskwCvUoGkYQQ7s5waHamOh+pgl9PTUrKeYQWoTdUCIvpmo1sl5ejZTV8C+05momLshlwj8TtvISIozfC0ay9utKy7Aci24O5D5+bgjHUAtYPczurw64LWIrNmOcwEgu9eW3q7UbJlYFfrnP/6PVkZEEoraxRf7OK5nhZgMrjDrKHC5qXhFsX2xuZCpbhxiR6dozauKVsABDRPgz9kNqq++6Qms6ybIBpJBMQHRR5YwUbu9ZuLWAmhUXhQFcT6tc11RNHmX+ni6XMwdrjwSa7MXrpMmZudh/zSfQ339ZutQbNwzoS0I0vA== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: e470f735-aab2-4417-66e6-08db1efaa75c X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Mar 2023 10:56:50.2658 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: foj6y6vl4c22OgQSxc1m2KeZGXjf2mRSkzI5esrKQjDEEqNXfbBKoSG3RyDRTuSDJULs5aqeUCQm9RSXJz/goQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR10MB6719 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-07_05,2023-03-07_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 bulkscore=0 malwarescore=0 spamscore=0 mlxscore=0 suspectscore=0 adultscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2303070098 X-Proofpoint-GUID: 9wI7C015PaeOvfQfate5Z3qg_CFkiZuD X-Proofpoint-ORIG-GUID: 9wI7C015PaeOvfQfate5Z3qg_CFkiZuD Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Currently commands completed via poll mode are not included in the statistics gathering for deferred completions and missed CPUs. Poll mode completions should be treated the same as other deferred completion types, so add poll mode completions to the statistics. Signed-off-by: John Garry --- drivers/scsi/scsi_debug.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c index 6cf30fceab78..76ff8ca6070d 100644 --- a/drivers/scsi/scsi_debug.c +++ b/drivers/scsi/scsi_debug.c @@ -7537,6 +7537,13 @@ static int sdebug_blk_mq_poll(struct Scsi_Host *shost, unsigned int queue_num) } WRITE_ONCE(sd_dp->defer_t, SDEB_DEFER_NONE); spin_unlock_irqrestore(&sqp->qc_lock, iflags); + + if (sdebug_statistics) { + atomic_inc(&sdebug_completions); + if (raw_smp_processor_id() != sd_dp->issuing_cpu) + atomic_inc(&sdebug_miss_cpus); + } + scsi_done(scp); /* callback to mid level */ num_entries++; spin_lock_irqsave(&sqp->qc_lock, iflags);