From patchwork Mon Mar 13 08:44:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 13172068 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 12C06C61DA4 for ; Mon, 13 Mar 2023 08:45:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230129AbjCMIpd (ORCPT ); Mon, 13 Mar 2023 04:45:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230047AbjCMIp3 (ORCPT ); Mon, 13 Mar 2023 04:45:29 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 480D222798; Mon, 13 Mar 2023 01:45:27 -0700 (PDT) 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 32D0Ighh020044; Mon, 13 Mar 2023 08:45:24 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=RpfwjlR5NSIsbG1LgT3/6b8EwaISwikIKxQsBbflVmc=; b=nuRF5nZUQ05zR3tyMP3qTZHnNZkUJBdR7ndxrdr8Tw1uEPncn7+WgErkCIW8+WDg9wYa Fir9wUZjuS5LPZSIfJgA63xVPRCMCsw+2h9F7t24x1J5XRjJgQuINUio1mALO6o4b8G/ MgWYFClW/SPHadySxZpHpITAEQ/WtGQBCqDXrQLhyGzkuY6pXPTcI11oLnXxy65Xpbp3 e9Tg1ueSqWoounXRSJ9VJQtqCwVytDawrMqL4uaiTdvM05q1Vw+K/8uFtRCYpciTFtMv ms14UoMUmdIKTqcdQnQmZRUZQjbPlMaIplDjn8IfN09iTwASCW3W0fqCTQaFSDW3CnRS Fg== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3p8ge2u99p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 13 Mar 2023 08:45:24 +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 32D6q9Lg008306; Mon, 13 Mar 2023 08:45:23 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2169.outbound.protection.outlook.com [104.47.57.169]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3p8g34b4d9-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 13 Mar 2023 08:45:23 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lMhF3GzFuIWy2xy9aoiVhZanI9vtvMhrkdTEKI+F1qRHgVXN1K/5tkwNwJBWcFyp496rJtyj6xuVWP2TL3WHqyrbWT6mPSf/BlrqbsQg6MIT73kCFtLEjjmOxNINqXJlTyYKdaDzOCqFxPxNXF5ZROiY87F2tpUx0BMFn0j1cW8ez0ICfOlkdST8OoSz8wURnOGQd9M61uu2pp6cWvb2Y714GpVBMam0y21Ysz3pgrB7pAkMs0KEK6q083K8+xfd01vAyRv4HOatwUxwrnOAve8XLjDxZssZEbCTTpgUl5eMM0AEA+QnCMTastBE5khJnMGYOUP3W4kxS1cjvtX62A== 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=RpfwjlR5NSIsbG1LgT3/6b8EwaISwikIKxQsBbflVmc=; b=J8i5nXSVfDiA9Zr+7+2hEegBX8tNskL4ocKYtdQHzBa45Mbx2MN/ImQPUVeXuEpODcI2CiXff2ijUTFXpLXtIW9tgSSkJPO66h+kAeUILemPHwx26vyBW7G/f3tKuz8Q32hX2P80H4RL+/X0ummDjerYl9wy+iMuRIyg7CqGpXXmVXfLaIlaC16qNZMQh9/UNtKtER+hgUD1DmdOKdVyM4Uu7IZ1PhOpmCW1D2k/+PxRpLLLLHp3jSxu4vp7ioxejXGnQ3tzmrG9EH0EG1USlYLt9vuCv5jrj+DOVBKNYKICeAh2qCkKp0hWwl9nblQtg99rn9aQz43KnSMls4M5LQ== 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=RpfwjlR5NSIsbG1LgT3/6b8EwaISwikIKxQsBbflVmc=; b=k8FfmTs5u3Jwd62kW0fTf1AviBGLNBvIV29Xa9kq40wa+lv+cIn9md2Uq5TSXfXQPkceXfUdLf5dj8mFooSGqyr18zI87q4sT32+LuYXEeYQ7VenwZjXR23P7zgofaqbft0oiYC27ySdHy9KhC1jhhT4IcSEQ4F7Wl49eOJGuv4= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by SJ0PR10MB4703.namprd10.prod.outlook.com (2603:10b6:a03:2d3::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.24; Mon, 13 Mar 2023 08:45:21 +0000 Received: from DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::7276:bc4c:17a0:7267]) by DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::7276:bc4c:17a0:7267%6]) with mapi id 15.20.6178.024; Mon, 13 Mar 2023 08:45:21 +0000 From: John Garry To: jejb@linux.ibm.com, martin.petersen@oracle.com Cc: linux-scsi@vger.kernel.org, bvanassche@acm.org, linux-kernel@vger.kernel.org, dgilbert@interlog.com, John Garry Subject: [PATCH v2 01/11] scsi: scsi_debug: Don't hold driver host struct pointer in host->hostdata[] Date: Mon, 13 Mar 2023 08:44:56 +0000 Message-Id: <20230313084505.1487337-2-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230313084505.1487337-1-john.g.garry@oracle.com> References: <20230313084505.1487337-1-john.g.garry@oracle.com> X-ClientProxiedBy: BL0PR02CA0060.namprd02.prod.outlook.com (2603:10b6:207:3d::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_|SJ0PR10MB4703:EE_ X-MS-Office365-Filtering-Correlation-Id: 1078707f-7070-46d8-b06e-08db239f4774 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5tx02ZKeb0GPo39Nez8mJLyAy+hSbCB+ivU422hHaufcinkz5e2WWgbomUT8nrK2/kccph0s7/46WrWf5fZKF+CR7wOHODP9dhZBuQT8vcTbwEaEDsXHVtmQPjRa2LIq0nlZBVz9O9vsZVflipMrVkEcNnuJ3pzbLrqtqxR0gJSnN+vTMucFuCFlkKHvk7oXt3FYAz8OgZpPIAVbIuhVeudF3enDrgWosZ3ZNeULx1AeLT8ZGSrER2jOQ+6QI5kt2RejwzPQpr1Y6+oUB9YQxEu7eNeRGLkLjs8MMsa4a4er9xrRWnYVIP+zIgmoZXYbIDTQZRVTzOmPLY+EPB34qm0JD19dUZ5mCxVAprbgx+S+jEBOqTQTDsKi/t6HRNnHxLFfRXM0MNXQYPqOUl+wSds/5UrZtuHfgehb0lnqjqTs4Og6+r/RdxQkQ+f5vwZrFNN5CCqSC4E59csRmmzHjprrjla7KG1GIYZtfTmwvD0hKdL9dCWbOjfjM8SPwrcGrCqGfclFgoi8qxBv5G4ZZeRJibbYf7ehO4wB1Gy/E+Xzj2oJyU5tkBgqWqf2BwzRydZZqTRivBFBEyL++meRXhN4RUgsdf7KjPZb2WYOjG3Nli3WnwYT6esDRcKd3an+kefHdSC9mFqFXNs8ICnaUw== 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)(396003)(136003)(346002)(376002)(39860400002)(366004)(451199018)(2906002)(83380400001)(36756003)(5660300002)(66946007)(66556008)(41300700001)(8936002)(4326008)(103116003)(8676002)(66476007)(38100700002)(6636002)(86362001)(316002)(478600001)(186003)(2616005)(6486002)(26005)(107886003)(6666004)(6506007)(1076003)(6512007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 0iT/Qh5MP2OH4i7wA9hb5cNK4KABdvGN1w7Yvt/ggJOgFYbV9SFwYj6sokPsCSmp5mOSYcsz6anvnJU+To+aaAgUsWnIQJgyWf955D8t3mJNnzaoetD2bvWVKG/EEuOq2STnTDveXGehHKmw3ZMyANjFpUa24rUdZG+I9W6qyBvoBWaokpWnolAZ3dBVjp18SYWfnk529DgZfOEcyh+4sOktSv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v4bQGT01v7lURuTfobOkfSnORxLKWjbUsrhylaO9o4mSWdNhuxbUwQp0UAX7/zDmvqYrYyt3ifqvX02nPqLNi+5ac9qPQL/fd5LFLU2EhOjr8LTpH/liaWiWHjpOb/ZIijl2OKsENFAI5q7jurc5xEPHVGASk4il59OpVZt+Ftpy22mLpDiHj+kGAcD+w7No104wSQMOOQHRhaNk12fG3+c7ioOnqa/kyCErgNJPFbBBrp/RnO10Kfjeb+jJzf6hOMj87CDKdEPeN/5SBKe/Xqf1TTHi21qNOrBphUDlZKkNjnf94tPIBv6bsk+fQLwZo9VgAO1m1oqcKmC3FZ2A== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: gI01dK+0s2LGgWw9pmbgZGX0PLYQXUnSCNTGFttgYVTd1vbfOByXwbXwxQsLZyPuYIGwzh0H5DGyH1VrAkMrLqvV/8ESdd1YBtXRnhD+o/aiCfPUBzpcHp20z3MOeELLhE0s5YJNnnaG94fYvPoVas9S44AKx6hz8NyGidHXUp7iQSHuvEi44jB545GRtUhU6DDcMRwQzTSaAOOsjOCHoBteI25IzjWj/OdVVcD7GsqXE24I4W4cLLOhC4f8BVFfKHfCiNAoJC7oND8H9NkWkYlSFxohK+EVq/33dTXBju9tODsGmJi+33f0QMHY0odPy1RliHyyHXA4rLsxWZuXdznZXPw1gVPfWWv2eVPsIeccE8YHOnWTc5FkbEpsZemJDgmki11JHjd6+Yb73QzkZK4AqRKC+vIORwzGlitj8VqfsrtmsvCEXw/4E40kWFllvvPHu8SEQkeU06tWQraltudwrxwWeLKvsLl8MGN32GM3j7sFLRvel5Xa8uqQ4nAD0SefeNsyFIVAbXdJrZCb6AqOOk49f9XPgaiW7dMkk0ZORK759hziuYA+D7EhCMrtKPUpgB+9fO6XXrrdG71U5+wgseCllLC9Ob1OiIulW775hy59Y+896Z7N5z42Dz/4jpPcdEl1o/yGXFcVg1K2tijSJl7yUIH9nSmKC7ue8hA3sD/7bx5YemTDNaJtdH/4pY68O01CY3prTwqcXp3fQTa0jJc71/ZSEprgmRnbsr1cXzYlzKJvwlMpWN5vWn30tM5N2gKc64DDJZFFOq/undks9IbPiuS56O9HJgPSJtV3yxxNkVvUYaWm/nnvvXWukqbz2S64FjOJUyqiqo2B149uq2KKK5hr0hms04zJfXA= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1078707f-7070-46d8-b06e-08db239f4774 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Mar 2023 08:45:21.0064 (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: A0VAIiaRZsqPtE0qsH3izsGfjM9RvMMHs3lnrQFaZRD3FdRr27nBab1oPWSDaZpQNbpqrLB9xP4Y3F5ppw1Hzg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB4703 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-13_01,2023-03-10_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 phishscore=0 suspectscore=0 spamscore=0 malwarescore=0 adultscore=0 mlxscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2303130070 X-Proofpoint-GUID: ycAC7iXlbxVkNKE7CkMKYkcldaedcqI- X-Proofpoint-ORIG-GUID: ycAC7iXlbxVkNKE7CkMKYkcldaedcqI- 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 before allocating the shost memory. 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, so add a macro for this - shost_to_sdebug_host(). Rename to_sdebug_host() -> dev_to_sdebug_host() to avoid ambiguity. 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 | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c index 72149eeee6e6..554c03d7a648 100644 --- a/drivers/scsi/scsi_debug.c +++ b/drivers/scsi/scsi_debug.c @@ -324,9 +324,12 @@ struct sdeb_store_info { void *map_storep; /* provisioning map */ }; -#define to_sdebug_host(d) \ +#define dev_to_sdebug_host(d) \ container_of(d, struct sdebug_host_info, dev) +#define shost_to_sdebug_host(shost) \ + dev_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}; @@ -5166,11 +5169,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 = shost_to_sdebug_host(sdev->host); list_for_each_entry(devip, &sdbg_host->dev_info_list, dev_list) { if ((devip->used) && (devip->channel == sdev->channel) && @@ -5407,7 +5406,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 = shost_to_sdebug_host(hp); if (sdbg_host) { list_for_each_entry(devip, &sdbg_host->dev_info_list, @@ -5440,7 +5439,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 = shost_to_sdebug_host(hp); if (sdbg_host) { list_for_each_entry(devip, &sdbg_host->dev_info_list, @@ -7165,7 +7164,7 @@ static void sdebug_release_adapter(struct device *dev) { struct sdebug_host_info *sdbg_host; - sdbg_host = to_sdebug_host(dev); + sdbg_host = dev_to_sdebug_host(dev); kfree(sdbg_host); } @@ -7812,14 +7811,14 @@ static int sdebug_driver_probe(struct device *dev) struct Scsi_Host *hpnt; int hprot; - sdbg_host = to_sdebug_host(dev); + sdbg_host = dev_to_sdebug_host(dev); sdebug_driver_template.can_queue = sdebug_max_queue; sdebug_driver_template.cmd_per_lun = sdebug_max_queue; 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; @@ -7862,7 +7861,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 @@ -7936,7 +7934,7 @@ static void sdebug_driver_remove(struct device *dev) struct sdebug_host_info *sdbg_host; struct sdebug_dev_info *sdbg_devinfo, *tmp; - sdbg_host = to_sdebug_host(dev); + sdbg_host = dev_to_sdebug_host(dev); scsi_remove_host(sdbg_host->shost); From patchwork Mon Mar 13 08:44:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 13172071 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 E4999C61DA4 for ; Mon, 13 Mar 2023 08:45:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230188AbjCMIpp (ORCPT ); Mon, 13 Mar 2023 04:45:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50314 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230157AbjCMIph (ORCPT ); Mon, 13 Mar 2023 04:45:37 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 058C6274A0; Mon, 13 Mar 2023 01:45:35 -0700 (PDT) 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 32CMWwJ2001346; Mon, 13 Mar 2023 08:45:32 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=F7DOKRf4GwxnVrEMQXHFYO8VfuWsdW4fBG+9/Nk6PJ8=; b=Z5qk1JJXsRbLqMiB/yVj3E5fpXV2SjEs+lIR21GZASUA/sRM1sXIIhFPiaKe3HdOw15W rThwZ4pjhIsPm1YJ9FHN0gcCo/YmDNK7uELCRbRm7FDRdSiQoqLU+miVmpdmTZwlQg6a iRSXLb0yL2oZsCsiQ4cFPzHomM30AvGNQzXuldrW7XbeKGHP09LYXIN1SXW3JqPZrMtA w/EuipBUkeIHm5sF3WH5nHwbbDrs0SozbVBvkPxLjuUUyj0Z4BcW5Mu2+9Sz4kKTpeef d4GOjMa3cKyHom4S5FJrYMS+dbFNOb51RL0nDHHOpy5fhTd1duKaeJt4fHhp4JIYczDE +Q== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3p8h8tb7y4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 13 Mar 2023 08:45:32 +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 32D7NBJx024989; Mon, 13 Mar 2023 08:45:31 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2168.outbound.protection.outlook.com [104.47.57.168]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3p8g34bjuf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 13 Mar 2023 08:45:31 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ebPA2JkFpTbzJ8obEcGIciaUWwF08BsizKzPZ2IocIatHlztUMplvP8ybMSYZbnzOPZ64WLnJA85KmTT/d+xfWYFOwYL1PcAh9jX6jAh8C3Om15Az1Ar8JiKLzxAx4/TNFFquvRjrYXAmCTGw6cw0r9l3UVrk8qzGy4TRfpDP21qGPRieNINSXQCI2tiyJjimXl3KGRkIzstXuqBXtqX8WbCBe6lu0nq2PPUiimxS0LIeSlU98gr2zbebsJKlSEo+7d0+LyYTDsem4bqe+8GeEUiRGUO05eOhzhbhwBet8F/aqqUnkGG62Z2addrYPfldLG5LAKbiDNszk6Vzz6yZQ== 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=F7DOKRf4GwxnVrEMQXHFYO8VfuWsdW4fBG+9/Nk6PJ8=; b=ChKNamKZOLXBjXeIeD+Z/tpiC+lIh7+tgzQLV/5KhACojHPyJCG6d1P94mbqj9CaXU2IIMVREnGI6VNi+wu5HDSW4sNOvaZHuZLfZtU/aVHtLfbxHeBI+pOAJnhkBd0igQqTAwvyQOiH/NK41022piOyasa1cRSXhNy2Otx+/zCpcsoUEBwIvB69zXYtU57SrtFzbkNgsyjYNPb+6aZAnAPBqYIP1BKPUyMXRvH867dx3aE5KORsPLr/ofVu4Ri5FCzXfUkHwsmUZ7hNmT3YZLxhJCWOHlpNOrmUIhqojkxM0p72wB2tLYnNS9YL8keoGO6lnSsBmXZEBhjVWeuekQ== 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=F7DOKRf4GwxnVrEMQXHFYO8VfuWsdW4fBG+9/Nk6PJ8=; b=wgII5TAG7Cl5SMeB0RQ8fhbqr1nPYZ10EKMFVNq7Fh/pMyV+wx9/A6eCVoI2MA9IEVNQqdjWKFlETfVa2u6vVwUAR/ESgpbbwG/O2nqvWGinsPLDKUvNFMEWcEJcquiW658/aFzjTBTKPOIvkD5Nw+qmv5ONVC1p5Odt1ZbUHdA= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by SJ0PR10MB4703.namprd10.prod.outlook.com (2603:10b6:a03:2d3::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.24; Mon, 13 Mar 2023 08:45:28 +0000 Received: from DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::7276:bc4c:17a0:7267]) by DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::7276:bc4c:17a0:7267%6]) with mapi id 15.20.6178.024; Mon, 13 Mar 2023 08:45:28 +0000 From: John Garry To: jejb@linux.ibm.com, martin.petersen@oracle.com Cc: linux-scsi@vger.kernel.org, bvanassche@acm.org, linux-kernel@vger.kernel.org, dgilbert@interlog.com, John Garry Subject: [PATCH v2 02/11] scsi: scsi_debug: Stop setting devip->sdbg_host twice Date: Mon, 13 Mar 2023 08:44:57 +0000 Message-Id: <20230313084505.1487337-3-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230313084505.1487337-1-john.g.garry@oracle.com> References: <20230313084505.1487337-1-john.g.garry@oracle.com> X-ClientProxiedBy: BL0PR03CA0012.namprd03.prod.outlook.com (2603:10b6:208:2d::25) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|SJ0PR10MB4703:EE_ X-MS-Office365-Filtering-Correlation-Id: 8186e702-83f5-4e62-5eed-08db239f4bfe X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: oPtVtioR32qH811D7E4wdZTw4+ojmygqqQiaNU31LhqJGDAUcHiRslt5hz+ZRdVzLIluAG+Ohr5CbTewC7mt/utoZEvbh5/L9+t1Ruk7syMpBX+7mNb5hCxCmxhZhT+2Xq28wPaLQH7KJc2wcvw60ZjfIz6JYsnPAuXydBPBElET/+Q8GYqN48FswAXSaQvrc1qKlKG4BZ0iJhi3F0e+iOwDNG2v3fAbqNYCrbQKP6REpORcMj1yLQVBhfznjzdMFZWf8FX3VeKTkvh276wuBethvXAQzPWNpjOmn8qMS/FWFOeh2tyyIlSsVKTy8COl+YnLUuLMcGmbhDWvRIq99tMX5/SEBE+pYJP8YNEEyV/cT/1vPF6rKKWPYIrbBqdNCyJWuJZCGpEYuDg22dQBQGn/HPNlaXN+kxENm+bDGm0CxX9wIp74kAQNKb++orv7RwPMIkguCA64Z7r2atlINDGv5wEVcKVQ1s06RGTevgHt7TiYV5q+iWLoV1JCzFbZCv/KTdmKdE9Iya0RDzcx/XqYvAjlRQd94qNzdJoVXdIlgD0Dl+PcSAhEZsEIAeLOUmy+ao6p+vLWsYE5JABan1jjfdVrWe6g1chFUxD4DZRHrVW5KYWxpSTkB9lXFv1U3m89rTlU0CqVfO2DcghigA== 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)(396003)(136003)(346002)(376002)(39860400002)(366004)(451199018)(2906002)(83380400001)(4744005)(36756003)(5660300002)(66946007)(66556008)(41300700001)(8936002)(4326008)(103116003)(8676002)(66476007)(38100700002)(6636002)(86362001)(316002)(478600001)(186003)(2616005)(6486002)(26005)(107886003)(6666004)(6506007)(1076003)(6512007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: G42TkTzxHFRhglm2IU5c9CsqmtCrcqlUxybTx2/XjW0etYZdxfBH1pZmirhBLQDc9a1nZE+RkVhQEEApm58OYGsRK/kWhVs23yCB4IcE4H3MYMpadXrPRRXWzKIAJ1oLwRjkORgorlXAu1CuW5fc4Bemvc7QMFdUEYaKagG3tEAAfiYHjQ93pojskC5mN+bTHSsTy3NIDqs77rV9lNYnYYBoQ637bL9Glyzc94hErCEYuRadJPR0dO343BFNEp9tdot+KVYf8ga5Acp/Lv62OncPxw6cw2adH+V68nnqypidixm12MttLzSgUAOGFvcCX+c3K9wBslcVMPohyv0rcBFo8MNXm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PgJKpEw4osZFaEL2OpJQ+l2VMy8x9A4kNdMtWBILeVThBVrSR8ZaERl3YTRYfc= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8186e702-83f5-4e62-5eed-08db239f4bfe X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Mar 2023 08:45:28.5885 (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: vj+onAmrKJkKBEst5fR9RwGyyIBiF0bmpfolwbdXI1SfStehZqiM79N2AyHV5CfHTYKvks/mLoDLYis4+xuEag== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB4703 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-12_10,2023-03-10_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 adultscore=0 malwarescore=0 mlxlogscore=987 mlxscore=0 suspectscore=0 bulkscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2303130070 X-Proofpoint-ORIG-GUID: 0k4PWZ2U4IsFIJaidopPfWfUXXtbNFPV X-Proofpoint-GUID: 0k4PWZ2U4IsFIJaidopPfWfUXXtbNFPV 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 554c03d7a648..4c60a055610a 100644 --- a/drivers/scsi/scsi_debug.c +++ b/drivers/scsi/scsi_debug.c @@ -5155,7 +5155,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 Mon Mar 13 08:44:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 13172072 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 63D98C61DA4 for ; Mon, 13 Mar 2023 08:45:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230194AbjCMIpt (ORCPT ); Mon, 13 Mar 2023 04:45:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229688AbjCMIph (ORCPT ); Mon, 13 Mar 2023 04:45:37 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4000927D72; Mon, 13 Mar 2023 01:45:36 -0700 (PDT) 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 32CN2mh6027099; Mon, 13 Mar 2023 08:45:32 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=Ls6Eo1X9j6h+D+hYtYNKhPBOnQyjqpjONeX+CFfSem4=; b=D6rWCbfGb/EHwGBt9kW9QrNP8Ecw/rCtFGlSIS8qV/ItBqe+BQfUfr2GUAld1vzUrVYQ atN8m2QlYNlBdoiy++lhaL5ZxhuR83v+73dKltxmbIaNO8wMii+k7BbE6+r/48IAdZXY Vba5T+itYwE66qUDSMYJkUs2sKZYJFrG6WQNxMZkz5V7uxLosl5uXGbz+Nytj4fMRJw6 QeHeeEkD0Vaptl04rupewePed0S52bq3ZIloPvfQSBnsJVubJzT7NTzCcZ1rc4U9un0Y fzpAbqAI1eMtNtGKo/XlnfHo4lN40h8gbuKUGY8zCfNG8dovhAkBz4ZmGdqjYIDHr5+r LA== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3p8j6u3833-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 13 Mar 2023 08:45:32 +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 32D7NBK0024989; Mon, 13 Mar 2023 08:45:32 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2168.outbound.protection.outlook.com [104.47.57.168]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3p8g34bjuf-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 13 Mar 2023 08:45:31 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VhQKI+7N2KG+JrtsGnoTTRQdOkAM4DVUOpGPtCCCnMw+sngyKAVbFx9SjcCGxkDWVMJXSNfNx3p4sQtGmQCz747qJUDKCGlg++uy8hI9JbhE2fHKLWqlWHXlHDo3vqPnAWdu4AwbKq1MQZFtjs9tw9CLpWxFAW0+4N/PKk806Nzw1ItbbhGBzC/qxVAYy8uplLlJqh41UjUdrLT87FIey0lQVKvAgmeGWKKijuZQDoT/uecNS8uEth47NXYNRvjzGd6KmXZIq+X5jGS/TeBcfhEBw+IJqVUqpjdS7aXXf6/Z7nJHBwEB7Bq/eG84qZLF6DfW/EElYyUN+apHJ9ewBw== 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=Ls6Eo1X9j6h+D+hYtYNKhPBOnQyjqpjONeX+CFfSem4=; b=JiauRJusdu7F2u9dU7S1U6+HSN9/0WtPeKwyo1XAeBmxuhAGPsJpNHzT0CtR7lLht6TqHK1ciB/wBsN77cOCFfFSa7GZ9XnK8j7J98f0Tv9z2apsc+4vIfSmUtCXEexuKWtgDotQMBsiTt3+vdLvS6lQshn+2IM2yIZocQaW+1o0cPQ6bK/rqXW5aXNw+1zziwjYvUPqrHhP5XBwa1dSFxD5ppVdzM48k06XO38eoeNy8kZf6fwFZpiFfLCiv8cxfTyMjmmQXnOkwZvKbBV3wD1ssjl3VWfFtjxpNEploggyDAGsVE6b13YfJmO3sJDUiQ4Ep2ngRH6SfAb4FpEl2Q== 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=Ls6Eo1X9j6h+D+hYtYNKhPBOnQyjqpjONeX+CFfSem4=; b=BbNFGKoXAZNWQ4nava+Q3KEdedjzlJT/iVAwpQN+tWmgzFyDwJJPIFfeXg9A+S384EMcG/F6JBQL9L1xE8NXw7hfIiW4EshrQRx8X3me5RTE7eASbLlUw/FxfY26t5LB75v5coDFJ5fMg5a+2jqzwz48OkfWKbuo9lL98eljZhI= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by SJ0PR10MB4703.namprd10.prod.outlook.com (2603:10b6:a03:2d3::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.24; Mon, 13 Mar 2023 08:45:30 +0000 Received: from DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::7276:bc4c:17a0:7267]) by DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::7276:bc4c:17a0:7267%6]) with mapi id 15.20.6178.024; Mon, 13 Mar 2023 08:45:30 +0000 From: John Garry To: jejb@linux.ibm.com, martin.petersen@oracle.com Cc: linux-scsi@vger.kernel.org, bvanassche@acm.org, linux-kernel@vger.kernel.org, dgilbert@interlog.com, John Garry Subject: [PATCH v2 03/11] scsi: scsi_debug: Drop scsi_debug_abort() NULL pointer checks Date: Mon, 13 Mar 2023 08:44:58 +0000 Message-Id: <20230313084505.1487337-4-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230313084505.1487337-1-john.g.garry@oracle.com> References: <20230313084505.1487337-1-john.g.garry@oracle.com> X-ClientProxiedBy: BL0PR03CA0009.namprd03.prod.outlook.com (2603:10b6:208:2d::22) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|SJ0PR10MB4703:EE_ X-MS-Office365-Filtering-Correlation-Id: d1f9de51-a273-48b5-d925-08db239f4ce0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: j/SZwNHXBiRJPLubvBlpKKbL+k80os4fkU/q+iZRoOXjRLJXzcUcGh/FjPcWYcn9/g8K03lmb1c9R6fIsWSmFM0vHKapX74y+OPbORojLMUlt+tSOfhoMvx7taOLvMbJljfOl1L6Ox8u9SRLOEtMdwXgq6dBP6Cz5XWvbqn066m3cJGu6Yow3uLlG0Gzb6AF4D42L4ASC06cGfR62uL3H+jTR14XLWPCVEgoO8PGeNyHhpzLX0SxLgsD8dAfeK4ODF05QOzBty4I7F86teIozyEkvwh1RcL0o9f/v9Z9L4l37KQ7lBOLpOnsiKVEnKnW1x75V2k0Kl5lRs/ZxP/NPvWgpOUt89l1SHcIBwjfIOYlrq98SzQcx2NkGa9b7jcyoSNW9XtxOBQZ9XV9fNeNkbcB1KHZD0uDF+FvCxFQzxyOlehaS8uXGmC6iFD8FvxNh9Ldv/XW7nB9MNfcuDyVNEM+eaucB7KFhN+fnrfrt+ACRZ7dfjW8KqZGZDXkmEgcrPhT7eJvGuli3RJAgyex+MFmFdsUc6RWHSD1+DmS3f8EX6GDHCADWm401PzWPP6OIosJ97Ha4uNwnvw/QH/L7+zufWEJhKeFELbLTwVXRipIjHE2tyJjqGdh4ilHKcU3fJO3gp6pXubCu8NH29MKGw== 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)(396003)(136003)(346002)(376002)(39860400002)(366004)(451199018)(2906002)(83380400001)(36756003)(5660300002)(66946007)(66556008)(41300700001)(8936002)(4326008)(103116003)(8676002)(66476007)(38100700002)(6636002)(86362001)(316002)(478600001)(186003)(2616005)(6486002)(26005)(107886003)(6666004)(6506007)(1076003)(6512007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSp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rmyABiA5g1RzW1lyW837acl6doBYoOXLvCSFmr3gBJmwZdA4RBxdgbVu+Ol54Hpy65JhI/LrkKTNblrXNVWwbTBOH1SrNzBj4uRn+EwpdfaeAuWGUU2LHyKuswjk5Zrp6bzE7KokgBW/3EFcArT03T8QGQdXBUjgTvCQrQDOTapfua9j18u9fSF1JmlXv/BFvptDWfc5XLZzj8rsV/CPGp5MBe5R2z69ZYDVVqLbL8WTU5NJK4rhCYtIow/F/7L1w5gRtbJEWufL8pKmdfHb5Iiz3VnJkMdYIvN6Olb8+zJsKqk3bMsb/g3YrJbDud0KTdAFS8cRW5ry4EXKJxQ3VN/QA8EQJcRYlS1vR8MDbjtYEx29JpdJxVbiNnVRVECCXWfnsJg4IGQWQVXcc5KeybKWs5KFj4KCaP4z+gB70pdWuuNfzEP3WCADg5D8ObNOgofwbjOWFn5S/otJ9EnH+pbyT+M= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: d1f9de51-a273-48b5-d925-08db239f4ce0 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Mar 2023 08:45:30.1039 (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: /V7RLdfG/t+Q97FN2Sh+gb7EiOjXxBapVdhV5YSsJ9FI6pgL6nfa9acY+53bZQqsiPs/JhbGVLQKZOnv4OoGEQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB4703 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-12_10,2023-03-10_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 adultscore=0 malwarescore=0 mlxlogscore=999 mlxscore=0 suspectscore=0 bulkscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2303130070 X-Proofpoint-GUID: l0aqOz1-sYPi-MlXSGfLUOcIvDaqs4za X-Proofpoint-ORIG-GUID: l0aqOz1-sYPi-MlXSGfLUOcIvDaqs4za 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 4c60a055610a..2c2a41b99641 100644 --- a/drivers/scsi/scsi_debug.c +++ b/drivers/scsi/scsi_debug.c @@ -5360,13 +5360,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 Mon Mar 13 08:44:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 13172070 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 DDE7CC74A4B for ; Mon, 13 Mar 2023 08:45:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230179AbjCMIpm (ORCPT ); Mon, 13 Mar 2023 04:45:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50442 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230167AbjCMIpj (ORCPT ); Mon, 13 Mar 2023 04:45:39 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2DBE027482; Mon, 13 Mar 2023 01:45:37 -0700 (PDT) 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 32D3TCIY005465; Mon, 13 Mar 2023 08:45:34 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=36dDPHXcLpMsV0S9kqXd6k2T64d3FwQN/6vyDHhEMCU=; b=hfbvr1NcqkHsRWPtpCd9+dzKUWu6GxFjZEtiv897j/C+2vAEcGisO1Flok9awSBPVOng q1uU+vfStudfF2BazB9cQj+w/bgtt+S+46I+qM0pR6WcxQr68QaLH5OuF6XvSwHjGzaM 5ehpbxot1UPfwYx0T8BWtgATHiBObDmv2eWDKCqp860ESipIPZ+1EL6uP/azyS406NiJ tHNaOlPUGq2rfyroDsT7/M3tBuK+9kgjL8lajVV7cjI8MTMZ/F+0SPL1aqBUhZB+2Unt 3qoFJWFF88yTIjE3a+CuJwsJKbzwNe4WibxQGsgfGD3LAVgVhy0o45MSqzCJYJ3+uw6W 5w== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3p8hpcu8vw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 13 Mar 2023 08:45:33 +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 32D6Kkq2008353; Mon, 13 Mar 2023 08:45:33 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2170.outbound.protection.outlook.com [104.47.57.170]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3p8g3b40ct-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 13 Mar 2023 08:45:33 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jlbJT1boRP9J095/j5evBqv+YnRfMQGZMaPfaW0eH13+YiAJ+t9NHCdefUpkmatpbLMvUUx2U9JRY5j2wfundYVG0xii/qPHln8eHyg6/WRdkbXnWV6i4KvbJvEvE7wMkyXcOf2BEvDoF7kSm9ZfWdwq1AV3zASETPRdOqN+tzq6s2KHHJN0wO5+k95vIPeZkzCRR93cOK2h4QojxS8r38dyfdabaMdF3rEAv9XH7jiNWIlpl2aDtEm6FYMc6BZlczUPku3YRiZuq59R10wKcL3i1rLyoVQaVsBqrAUEYOHRM7NBvDAftGYll6Y6/GJ5Ces86yCn3wr4qK/Smz/1DQ== 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=36dDPHXcLpMsV0S9kqXd6k2T64d3FwQN/6vyDHhEMCU=; b=kcusEdNR8pmmT4XY+NSo624517mlpLFBjfyvlaRfyWF5PB4nhsvCJfwJhiAVBmqo82xpVBtJvdujPEFAJUKBhWNs8fle00qZQ5wqT7TogYClWQuZch312arAm4jGO6RmEh+Vgc8vnS7Aveu89QTuDPikI9spZwJqATmdg8l/wTugdLgVIoMijJ51kXOyiXyTF9Hl58bCEJS35AoVxFyhhmjpGav6ofo9a3VXoJMaH4U6x4/UxwUP6i6pAbb4RRxd5zAjsH0HxNpFE2Kw/UoZm8Bj5ZND4eSbGvS5FahiHqDPhkq3TndPjzZKV7fp9/n/MupLfZ/8vYD0FVTswrNcfw== 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=36dDPHXcLpMsV0S9kqXd6k2T64d3FwQN/6vyDHhEMCU=; b=rB4t+65phqIpDWUvaFiQpYghSGmAdHiO9Tcn9IZVq56I1XUpJ7wlpEsBfJn+zqBq3e6rd/L6/VcWK2AQTk9UEdmxhWvN/vAEQQQvy24k4htsuei3oGQ7SNzUCkWK4GZDHB6FFKlhn1r68UFPfNRXk9o5j6vslkBQhDYtKi/O8PI= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by SJ0PR10MB4703.namprd10.prod.outlook.com (2603:10b6:a03:2d3::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.24; Mon, 13 Mar 2023 08:45:31 +0000 Received: from DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::7276:bc4c:17a0:7267]) by DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::7276:bc4c:17a0:7267%6]) with mapi id 15.20.6178.024; Mon, 13 Mar 2023 08:45:31 +0000 From: John Garry To: jejb@linux.ibm.com, martin.petersen@oracle.com Cc: linux-scsi@vger.kernel.org, bvanassche@acm.org, linux-kernel@vger.kernel.org, dgilbert@interlog.com, John Garry Subject: [PATCH v2 04/11] scsi: scsi_debug: Drop scsi_debug_device_reset() NULL pointer checks Date: Mon, 13 Mar 2023 08:44:59 +0000 Message-Id: <20230313084505.1487337-5-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230313084505.1487337-1-john.g.garry@oracle.com> References: <20230313084505.1487337-1-john.g.garry@oracle.com> X-ClientProxiedBy: BLAPR03CA0006.namprd03.prod.outlook.com (2603:10b6:208:32b::11) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|SJ0PR10MB4703:EE_ X-MS-Office365-Filtering-Correlation-Id: ec1e1ca1-f5be-428b-0da8-08db239f4d9d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: iCZIZ+Plyynxr8nNnEauARMgmGf+GZHPnjPt5Y0App2wmZoVWo9MebjJThbOVXbpiMpdPvylCCBMQTWDFb0ne/TfKLl2xaGT5WLU2w0g9Zr0dqAlbnLW2vZz5mhwn7jDKb79rGOYUrEc8fuyLj6r8IEqgdpa+ImAEDna8MAKpzvPgd1ESi5oayNiOYg+bA/cMcVmIiQfcN2opf0C9fGTSPtyRzX+nJPpDWizUV3ucN5h2UdFXnlS7u/cXmFc/x5CXqkoNGavjovgA6dUZ/ye+86Lvzh7wtV1vUp17Zv8YnJUKf30SXeFfARkSni2RiDHDbT4J9NruKFVrlvYGjDDcC1t6OsMMeUSsD4NbQS4TFWginmUuMuowo7FLXQQ4YHDDe3alsISyWjyJN+xMtk/1vriZ7Qm3kugKkkETrzWx6FBUOdCqjND5V5rilCu4bh7MY75o4ZVX8tIqdVUicriJXXOiFrukGxgO2b/KmVhyE6Q1+Q6v304CJ8uTNzdbt5XR3qTcRQaXgqs76SU4zAC9f/0Du1iXCLRAzqxLsywQ0kBVMNwKjzUtk34HF17Eq8fgmI5HNfKXAW3KfSbVLex9gkS7RK88BJ4T+tQTxNyMJR/Soo2huN0Eh5TCUpjfeYJAot4zkP7oHhgVu4sU95P3Q== 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)(396003)(136003)(346002)(376002)(39860400002)(366004)(451199018)(2906002)(83380400001)(36756003)(5660300002)(66946007)(66556008)(41300700001)(8936002)(4326008)(103116003)(8676002)(66476007)(38100700002)(6636002)(86362001)(316002)(478600001)(186003)(2616005)(6486002)(26005)(107886003)(6666004)(6506007)(1076003)(6512007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: /dtY9QIMpc4KLNRsEymw80tCLRpH4a1DXvqtfzJ2wJgToRTu/cgfiDsBlPok2RqAmngc1cbbuJpcHx0YbnAyve2RZBfth4skADicpFLpvmx/ynBqS0eVbRs+A0pGTFG2QXpppgA6mFpg8llHM2JgGZvVzZZw6ZSHkhc7jSkPbPhAfQ8iHHwHuHXOy2mrY8J0INtNItom3J7yGVSQyY8+D6It2+cAILQKf9E7pXUxpEy19rruXYrBVs3kHdw+Nfvucft5/rRsWZgipVJbhhdJ6aR5ogd/PmiMr2d6hBpLmAJ0YxwtGr5mGDvP9X6Bnsc5EVUJ1+Clh72fZpTOScyMX+BFoh8J7PgLIwJ0WNVUVC8fu4a2VTmf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lpMTF9xcAiWRpGTVgkX/5jDh67RaoP/w= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: ec1e1ca1-f5be-428b-0da8-08db239f4d9d X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Mar 2023 08:45:31.3373 (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: 60lB09Y5lrJW3i+ma59tWaqq8YeiLF88nf1kxv1aWRG2yO26vskq5v8UYltjimPlD3PYMbJFrRcQoLm/bRrK8g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB4703 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-13_01,2023-03-10_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxscore=0 bulkscore=0 adultscore=0 mlxlogscore=999 malwarescore=0 spamscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2303130070 X-Proofpoint-ORIG-GUID: uVVhkcZXxnlo_Y6wJcFeWKHF-JQJ7RzT X-Proofpoint-GUID: uVVhkcZXxnlo_Y6wJcFeWKHF-JQJ7RzT 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 2c2a41b99641..5b51c24f7d09 100644 --- a/drivers/scsi/scsi_debug.c +++ b/drivers/scsi/scsi_debug.c @@ -5372,17 +5372,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 Mon Mar 13 08:45:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 13172075 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 BB2A3C6FD19 for ; Mon, 13 Mar 2023 08:46:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229561AbjCMIqV (ORCPT ); Mon, 13 Mar 2023 04:46:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50556 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230186AbjCMIpm (ORCPT ); Mon, 13 Mar 2023 04:45:42 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3083629141; Mon, 13 Mar 2023 01:45:41 -0700 (PDT) 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 32D01VWJ018846; Mon, 13 Mar 2023 08:45:37 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=xBVeTvLzBsoJHRKo7CEnffiNcOIz9zRSdm+Wg+Lq5Qs=; b=tk2hqFK+u2hAV40/ttkFN56/API4z07bYNKTZVKSwXqoExaSo3nnm6UUtydqWTVyRbE3 m8WE5z34a4lMVGBA7682ycAYIHC+5heWYKKxB/7LK4ycuXH1QIjnmLJjg02s2GKU0KYP EjtdUay8TOj9ZCb3boa870D0UhYd6Fs6ayqa0yL/OrqrB0d8XuaKJtD5kkCUQZgOCHLt EWeIqSr9U+02KpGr6MtAwCOuqGHgQexavLodSBRYNeRPU6YDl3t8MqP29M+MAiKCCgPo kpLKbvJhskPcHqCXaTwYaDM5sg9E7t+zPWN68AmEFqJW3N4oFmW0mxXQUJ9n5eFVy9Cj xQ== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3p8hhab7qu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 13 Mar 2023 08:45:36 +0000 Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 32D80TRs015268; Mon, 13 Mar 2023 08:45:35 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2170.outbound.protection.outlook.com [104.47.57.170]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3p8g34umkd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 13 Mar 2023 08:45:35 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bAe3h5Q+Nsyj3uMWnaRGhPNP9iOLJRIeF9qpsy0zXBJfdORwbkr4+8adPrJdTclRf88t/c53M7+tlrjTH2zxFY/u4UltPhpwMmVe5JgZhvW9AUdtuIU58hRc+DozlTsMh0ibtS9lRHgGByQ6vSCYzRGjPs8pYmYopCLmfKbz6kUiX7An0SQkaDlNFOXrhRCLnaHkxUlG89khcLoLuaiCbF63lK7ULxtqBRH1d3DKb4J4jLU/UnvyX/UUewxnfqbX3YhRnlj2uiZ5DnzR4pyQmfjpbC8B9UNG+ETgUBklFaYr9YPIyBEyIAo20aVUHEAKHQ3KMjAQtg9/6Xc7p3gdRg== 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=xBVeTvLzBsoJHRKo7CEnffiNcOIz9zRSdm+Wg+Lq5Qs=; b=DMjfyF5XApOKg9OJWBDjQbNKrUrGFM6VfaxelzpCDl73nMfJ06CSCNV1SFMkaoOJWac+JcAscHjzNzFFkH/TNSkkfNmKMw0/i0qPmJjzS4c8VbohdHInL0jXCwZQmg+gC71ofZFlChD9E1TKTVnPx6vGabArHNJEDTcs412sNlkNnj4Cgz6uSnEmFv6dd1HMGYPD2ZxXC/PlwZl2Ov2DFZT05XxIjuVlBCY7tOgTwtQ6ZFdbX7dJ2s60b+tWPs2NcNSfFHJDCPsz2T8f7nExOAUHwvBxAdK9O54tPTjttFEzKmDXkvPo7BUO2Mjzk3vwHjW2ad2ebDNIuGWgj/J2QA== 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=xBVeTvLzBsoJHRKo7CEnffiNcOIz9zRSdm+Wg+Lq5Qs=; b=AoZJ8TabH/QeJEQtFSiU4dYONXQS6jS2NFbuHqkUywCr4X0q2xfngFm+mQ76u2ZUrwl5CfYUk1lCi8u1JYxWuToyNWiI2NhzDPAuy9EjXc0+ahBHBTqGtIn6bYsZN6tnMmXOOoqDUMxHB3IPdaMRRUGwjA2FZ0PscXf+YrJ0aeo= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by SJ0PR10MB4703.namprd10.prod.outlook.com (2603:10b6:a03:2d3::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.24; Mon, 13 Mar 2023 08:45:33 +0000 Received: from DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::7276:bc4c:17a0:7267]) by DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::7276:bc4c:17a0:7267%6]) with mapi id 15.20.6178.024; Mon, 13 Mar 2023 08:45:33 +0000 From: John Garry To: jejb@linux.ibm.com, martin.petersen@oracle.com Cc: linux-scsi@vger.kernel.org, bvanassche@acm.org, linux-kernel@vger.kernel.org, dgilbert@interlog.com, John Garry Subject: [PATCH v2 05/11] scsi: scsi_debug: Drop scsi_debug_target_reset() NULL pointer checks Date: Mon, 13 Mar 2023 08:45:00 +0000 Message-Id: <20230313084505.1487337-6-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230313084505.1487337-1-john.g.garry@oracle.com> References: <20230313084505.1487337-1-john.g.garry@oracle.com> X-ClientProxiedBy: BL1PR13CA0218.namprd13.prod.outlook.com (2603:10b6:208:2bf::13) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|SJ0PR10MB4703:EE_ X-MS-Office365-Filtering-Correlation-Id: 6efc1876-b7fb-4ca4-2345-08db239f4ecc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: SyrWbZqzjXVnoeIB/KR82OaYaPg/WeHGIS11DYztK8AM7s1d8YwajXjUgDCSKxlEzpqHFc8AhWF0kEqvcKvglrkZAp90gGkXT9bBJEK26eMirE4PeblMR24r/zkRpczJ9mHH5mC7Q9KOPj1cZCUoIBmBZjqbJDQUklTMzeEvgxeeUkbWb1w6qWWo5m77zNPr6pP5cd9v+Tacy3Ix/PxvuAdezVOsVdEuT4znj8bitxePsBA/g9IIqBlotlCCumIIGypomoUfm4TBJTv2M8zaUU2q9TfdhGzbDRla6cCrNK8vh8nZYx74KcvT2OffnEaftqhBSWCK+LTHZU4B2GwE8jkQ+YD80SQoCiSpe7Qst4IiZfPl8DP/ZgtUwHtNlv9ikDhc9ihQIqvmjg2iFGEHX3IhFPDVpl7KrIXZkJ7+2XXr7zG13rh67cj6y5K/RmC0fxJlQ7O4+T5S/omuhU6xG1pdcCEM3+dRhttfRXalp8j602CB10OJ9ZSs/uFx85SGnDIGwzsV/i7LAoru85qm7J97/l7OpksBJub8y9rAGyVcNWvcpsOeXmmQ6aDwY3RV2MdOK2QnaUbBejyHezWkHRglHMBA9WXyjJD9wPs7HDhLYxHKVuhtqaHkcxHfWkVcRvwqhtuiiprmemaGGrt3Dg== 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)(396003)(136003)(346002)(376002)(39860400002)(366004)(451199018)(2906002)(83380400001)(36756003)(5660300002)(66946007)(66556008)(41300700001)(8936002)(4326008)(103116003)(8676002)(66476007)(38100700002)(6636002)(86362001)(316002)(478600001)(186003)(2616005)(6486002)(26005)(107886003)(6666004)(6506007)(1076003)(6512007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 5F5nazqTwaZCzvrjTExfSfGE6FrdR3JnPSHU5KTRul0l4F/L/0QxWVYF9i6zUdM18BLd4e+dsovpyVMixtg4Oe5RqsA4l3pnMO7Vhg4usOS+zwJNhYFQbr65PfdNA21cJvfiwdnVJMTNczc3fjUgElIdf8BbIUaA1DEfKvVEByZDwU5d0BgKjE8wmZSs61+cnRuR2Xf9qvrzxKrtq6/zd/ohUBnsX727DCe59mSdc8t2D7PYc+Q/ODykia6ICcZlstL9eo8jZL9WGhPf+iFSpi31QwWC/Ifh4BA1J3K/O2tbR+CRDWP3wJC/LPIBvoUrUBlPx79ydiWkwxNd2y3L0JM09BBEdVB8rQT+CkjCKNncz3pv2HPijVz3reQ0hI4CZRlHxXN3AABVecdrc6juqB+NWizNKg1ORzLagzihbSRpolFmvsG0JamLWGsVze5RfGihQU+/mAZMRiZTEyME+OXwqsgPCIWPZtYHBJsEkVuOCELtZd+0o8kcPfjV68r0tvk2oIf2DCAougp/XWqPhXz6ND+KnQZukNCPBeZCCH2us4MZ4Mem1MDuMMjzB8DQpVl2GXDzjlADbjG1KAxMVtqkTd8fJ+zpdJ4YK7vpk0eVTR1WQqB7tzOGf2y+FkyI3YpIiheCy46795r7sXV5deCXe9WhOkOMPe18v9ISoJ5g9AWGc6taXz7lsAUoEo5TcvXhhLzsVnLWWuLDpbgETfNFIgHDnipWOPVtBtPVzc3q/nGjV1tlHxwy5QvwoSyFgqCe1ew9HBdk/bALUj0AtstenPh19feTrSikwmP/eaLSz/pHyCPRLEldsonkzWFPBnCjPVnVYwHqRgU1743Px8TSPrD2kaQQPNFFHxO02t9oWdh4L1SMzpPdMzN3DISWppS9ASmYIXI0A5VqP/6ByO6IX+geELQEZw95186pCCXrxAESqUDPtzseNZqgX35sJRaDUe8Ja2etbMfFmIZ+A2mlsBQyn6kBUZS1g6I3FKla5UHRLMlbvYVPzaOYCZM9dOJRGrucGP8tAZeZL42mR0V5sR0V24sPhLfE8e7DNkErdgs6s7IocCortrDt7qib1yC9QEohacUXQBadzy/FiUcOqwo8M1DqekgulP8hYkci7oKOM71T7RULSomJNAxKG/enqihZm70AfcM6BbyulvPHCUgnWV10Ko645a9xp89kISPtbsTQXxFGoCm7JBwwEGUkvNauGtgZeRqQp6NQKL2gRjPsFFxUbRWO7rTgXwkEdWXcpfqBfNO8mgbgqWOvAfMypxHGWM7dmkmAtQbct3cfBZr/3ZNnx7vVwIPqqbRO1B0P0jUHG93DyCj35VQfU4Es1KDjnLIHADbhnECeG27XZcAkfzOXNxNYNhsjP5QfVMc+wsii0BK+J9Tw/ibrU0HsQuswfbUYSHaCyVwyMTsrISkKzznsDLrlIoVqDNnfejZ0/pqeVBgy6D7tUXkOUwGFAXHiVAEgo7YwaJcVZToAzv6gdCwv09JnXrUxQ5qHGEOCorwiJZHITnj2f5qVimZ1eWXSCFsHMKawGoB+HcMDiHp5rLytXkAbvrZ16Bw29R+ghZlKzja2Hw6FLl99V0ulrHNwRAd/rpIMLmpu6w== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: IOvYEb8eKcmwbFHsyWZVB3Ewyy+DoNskwFPWaLfcj9lxDwdN7pb3bus9lDawfSgHVl68OBehgcvg8pPUPY8O1L0tbHzhaawM5+E0758bzVLKXf78afyhakJ7yifywvib3jnSAyddNd3Tr2KLJyWYBMhQBwzMg+K6yrdfEKfjgkJE/ucj2OIHTkTNLYuMr+90mbPBqbPUaOLFfPP9EmHnfNOMr2/QiMYjlBaNBWdO1ZRM9nova6RG95HEBaAfmGlXBZV1W13wY++37jUiqtF+BK7EIVgdiHImpNGIHgt7LZ8pilCOYvw2bqZLhGgeSga/Kr0qlBxDv0ZF9wYBWJEjwqxPbdocLehItfkqBhnMRZzAtCVDw+12XSBhw19wKZ8lLM0IJKba6kd53jnyImuII/KHpXT1WMZJjtqN5YmrpcR2oXPof4zZj3W3CcYznIVQBcoI0W6fqsuJKY4AzuIA6kwfMwcHBgy7CTvpzBYnvWHypzZLne7+pyPUhH8pKm/E2eVtld4774BP7ZNZtSj+DfXVmw67C3j4LVSlqiFvqRSZDCFJTp75Rdwb7n9nhaZp1caHXjtg2HCJeF6sJh50/6+Yw9F2S1cv8Wu2PTgWtsf6J8UvTVV1rBKcB5kLTNliLGo1JRMaQQuxNRISUAIgLdufBY6JFBUCiEO8R5OrCIiqeIebdTWpZIk9dw1FAFgEf6C7PyBm99L7IxRfjShECoycseMxodWgXrFeX3VMFVpGvaCLuu4E/C22MbZPs7II/q0VKOMJwRHEi2DbPhcCl7jglzY3O1ybVUIy5MYhuY7MECU/zZVSA+OoWdn1XYH34WBzdWTFsdbPzUKHDDYEnLa+AAfa4M1DZvgyy7AKluI= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6efc1876-b7fb-4ca4-2345-08db239f4ecc X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Mar 2023 08:45:33.3392 (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: +bG1ywTH0+7LRYN6nD1/BDkyLOQBv3KVer3mzoTHgcGr05Htkz6yOQdr/sZlFhj2eW1JVB++BiuTZ05lk+sLSQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB4703 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-12_10,2023-03-10_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 mlxscore=0 phishscore=0 spamscore=0 suspectscore=0 malwarescore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2303130070 X-Proofpoint-GUID: RXYyu_QfbLQIgz2d5rZxMLOUXp8-C--r X-Proofpoint-ORIG-GUID: RXYyu_QfbLQIgz2d5rZxMLOUXp8-C--r 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, 10 insertions(+), 21 deletions(-) diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c index 5b51c24f7d09..6364d6f08861 100644 --- a/drivers/scsi/scsi_debug.c +++ b/drivers/scsi/scsi_debug.c @@ -5387,37 +5387,26 @@ static int scsi_debug_device_reset(struct scsi_cmnd *SCpnt) static int scsi_debug_target_reset(struct scsi_cmnd *SCpnt) { - struct sdebug_host_info *sdbg_host; + struct scsi_device *sdp = SCpnt->device; + struct sdebug_host_info *sdbg_host = shost_to_sdebug_host(sdp->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 = shost_to_sdebug_host(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; - } + + 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 Mon Mar 13 08:45:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 13172073 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 E80F4C6FD19 for ; Mon, 13 Mar 2023 08:45:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230213AbjCMIp5 (ORCPT ); Mon, 13 Mar 2023 04:45:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230177AbjCMIpm (ORCPT ); Mon, 13 Mar 2023 04:45:42 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5512728E51; Mon, 13 Mar 2023 01:45:40 -0700 (PDT) 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 32CNxAbN027282; Mon, 13 Mar 2023 08:45:37 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=3twTDmQzcn3PpUPNMcEt26F6nLlJpy9fVUXokJnpMaI=; b=EHp+SgHld+JcDi2bIbB2kQ+BkFytNjt/QOWadfOsHzbkYH7nE3kb2q2e4GWYCyhdGXMC ufBXqVEhgI7nr28N2d1ZkuelzPuvBI+YotsNxeITFp13yBZlB8uOekCMp72412vmgESK tfDFE8klsWiE9AuTjovr35HHbhyt5Pf16f7ulBkmWgyu5SkXb8fFNJ7w0rW3jr1LZoNl SYpKUqSU8ZtZ4/Oj8bqupac7Rmsof998AgFc0xc72SDjrLdImkwWDQxV80bWQBzKTO42 KC0GmQg1BkT7z7Hr5oC/6FCFYq1gazzMDZ1avqjRDSkzorXW8XlTvdyMzoIdywxKI1GX zA== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3p8h8tb7yr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 13 Mar 2023 08:45:37 +0000 Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 32D81e2O015267; Mon, 13 Mar 2023 08:45:36 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2173.outbound.protection.outlook.com [104.47.57.173]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3p8g34umme-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 13 Mar 2023 08:45:36 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bG3LLVVkqxqbCrnUIMQxcnlX0MvVct/8aHHkeR0rRkecPIom7pdQJvhLhOU+TL8akTSZjKJa22dzypHBUxZ9nGl5tHH5oGSD/NOcPhV7jtYbkj/fNwSZM859Qi6gqDOlcPXGnWwFdyxFmYFNBlSYH9vv2OgrQD82f90zXTmQKeCcXjrX7Ja1R0u0zA7eD/fAatG164VcWHcI8qQvEjCaepmnjpE7isA3tk24NRcGBJ4KOJz5tiDJJwiqrcBTCAzI4hWGbz1Ft1aZaX5wBBGrYeI30tlUQPwsrkx3vJreSP4YjGV/CEpCDvvm7P9Cy8uwe1EGTJL49pbIiESecbO7oQ== 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=3twTDmQzcn3PpUPNMcEt26F6nLlJpy9fVUXokJnpMaI=; b=P3I55vga8SZY5IMv8Y4AWu16HSXuw48Fb3KhPFFBJb2w+b44y2oNe41E8HIr8sJDHoFNyFzrxDTli0n/+EIu+lRi4tPMV+N/CKYHQ2u0OlSJTa2r+IRNtR1L2ZGcIbZ2Do2+Z6M0gRKRMJO9kgmmfmzdj9tVshFtWkg3UgGItuRNaB34myFuUcxjRm0PUJv6pgDYo4nZ+1fw930PQTw1oL7qUIKwufeyYAsbows5Low+vr2RdgoxiK+Sb5/2496D7dCg6woBMN+VZAVg4IGsSrrXh7NjHGKnnhIf5nJwVDx9ZukCLrTCArSkBuCxsEFhhStVTvULYph1++m8mvIeWw== 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=3twTDmQzcn3PpUPNMcEt26F6nLlJpy9fVUXokJnpMaI=; b=LMDq3zxXPiQ6yo/rR8XzHGKpyU+ynU1eQhe6aDN6cqX2Bwo5I0Zowh3BmoTRVKoIfTDtfKl0n5cmmjBXwHga2I4SO8aH62jTrqAgsjbXoQIPtIuMg+ygl2QWDRe90VdGuJ0cA2nJ8BH7IcKiV6+kWaMKlLgqTF+3J1u7CJR18Lo= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by SJ0PR10MB4703.namprd10.prod.outlook.com (2603:10b6:a03:2d3::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.24; Mon, 13 Mar 2023 08:45:35 +0000 Received: from DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::7276:bc4c:17a0:7267]) by DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::7276:bc4c:17a0:7267%6]) with mapi id 15.20.6178.024; Mon, 13 Mar 2023 08:45:34 +0000 From: John Garry To: jejb@linux.ibm.com, martin.petersen@oracle.com Cc: linux-scsi@vger.kernel.org, bvanassche@acm.org, linux-kernel@vger.kernel.org, dgilbert@interlog.com, John Garry Subject: [PATCH v2 06/11] scsi: scsi_debug: Drop scsi_debug_bus_reset() NULL pointer checks Date: Mon, 13 Mar 2023 08:45:01 +0000 Message-Id: <20230313084505.1487337-7-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230313084505.1487337-1-john.g.garry@oracle.com> References: <20230313084505.1487337-1-john.g.garry@oracle.com> X-ClientProxiedBy: MN2PR03CA0021.namprd03.prod.outlook.com (2603:10b6:208:23a::26) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|SJ0PR10MB4703:EE_ X-MS-Office365-Filtering-Correlation-Id: 4e0e10aa-9ef8-489b-f5a7-08db239f4fb5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: r/vwfgEse/zb9oi61nK8w32+eIO+js2Vc66jDK9UmbM2ak0UPRkkuXLbVZ9ZSXhXXIRXjuaxQaK8eCp3HAnI7eTmJijNDxcvqDK8ymhN0OCoHlRrrPWG4LKie5uaijq1aO51In2pAdR7cPVxAHkhzV6d5PFZEll48NOqdndde+0DNzTMqSX9h94/HMFo19ANbt+z9DCUt+J5cqWCeuw1EF8hRgo2t6j4IkePBCV52maFwBKK2IwTXvtZWeRjwv3IxpAbN1dyvmbQ5tEIUM+YI/dehG5tWsLrOtomYrX4RRMqyPZX3CG7jYS4ntSheUT87/TR37oIOSwatf2V2GrchauoC5ftD7ou/Vgy3QKHUjx0XeElpYJH0wQOp6/6qfSsbm/I07hjJMNu8BIpEAuFlfx05A5X/rY0Tr6Gma0/3Yg2Tl+rBQ2rC+vzBNTWeMHt8zD+SV6Kqb8m5ZUsbXxL+QP7B2SrN7MC7qXPXGo+2UxhAm677v807VezTVmXgD66s+pYErLhPZhBfk99QLUa2D8akoQpHKF6HScXjgYe9dP01pyKp3SEvINWGvVixWm/PojXF1kfjX/SRksAdRdVUnrPC5E9vXhBaMm5yNtMqrjG2cX9/3kE9b2BXAst/BglbycN3iEkk6JbM/Bv6UIGgg== 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)(396003)(136003)(346002)(376002)(39860400002)(366004)(451199018)(2906002)(83380400001)(36756003)(5660300002)(66946007)(66556008)(41300700001)(8936002)(4326008)(103116003)(8676002)(66476007)(38100700002)(6636002)(86362001)(316002)(478600001)(186003)(2616005)(6486002)(26005)(107886003)(6666004)(6506007)(1076003)(6512007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: XuedCLXgiX24P5RG0Y+3pnYeSRctdksZtzRC/l54km4La1qSfjqbqTOFlnkGd1gLR4lN3nlLC3fKybNpDO9ZtH45SX8L8B50uXNGBCA1RhBUKZqnITdHYfsuSNs6gjM5B3IC55JFxWM3QqWlJ+bCeEegxwXWKfMrVO9BEZiJQUZlaLmNoFm1FLlwB3dJFlAtgA5syYK5YkgNgC3hRIbScXrEqaZljhHN0Qlbt3DKlw33MGhaF9jcUxWJgKaKMs0JQpk6BNlW+gGcznKmGe5Swks6Wz9XBBzBCH+FPfzS1aURKwQxi7hlEsY8Voa6nPrsMA1cxweO+fEU8T/nVy6nz1jnPD+18Wufdfr0BKzB7An3+3Re5XDayGj6tl6Qoc40mQpNdv7lglDl94r1owcKgDr60V5zgNISfAjmIjfxTmQ7RPr4P0gcQxbvrz5T7unvuZWbZhm/X3AIWhJ1cp03z+69OTRMUvjZcGcIY/Rj6aoDO6Seo88JubLvzb9YGtE0GHMDith/cW9gR50IqF0sXTDgXZel2l1tZD4wDpPOVLf9cv3L0npre5djR2nTJMcSd/EWaO5oUCLnXigvXGGuRequW3CJRVO2AdutyqlquBk/HvGjrMT5pXdxH+Fd0vI494CYSf9syKIQ0Bi2x7W8dijommO9wTXiG0e6NN/A5yXZZc+ARm4azKmmW4nnFs3UOnNmJvvv+EbsOV5SAY7lWVgs7Y8s/7cb9M9QTRW6yaA0y3/1BzpcHpyHohJ/LH+e4ttoBwS7KF4MssFq07gwA6RUQlwelPhpS1LM70QiR3pDxnd/d+x1ejpPdWBzdmWVK1af5kZ+GbyLK4BN+7suJynK8XyqP3yYGy3beDWhiNQv22EUIbFQp4wh4kpWlCvZsMSXJxJEX2el+IP5d3CBoEX00sLt4cmbMRWFEbMDbllvZJuP+vpUJSU5FD3L7OvxODo67driBLfWeKnXbsImwiNtXCByWCs4BnBI8HscyqKSLgPjSl1hxc8lk9BCqgx9P1IiZhmupg+WzO1MQQb2WLhEH7RHLedEoQCbMT2iQWltanfLGfmZlUqe0dpY5uO/qAqgLtx1vaBSziV1cbjlL/eG2OWSRyO1/31wszL3N0cMIrv/Y4tyil6YVxtxtqNHZ2fU8tjat3KeIhKeuDc019x1cAHWAihK02qklFxmTcyX/KQxRU4YmRF/1YHdUaV+pVFFaVefEAxQD2QyVQ8Tjsbe46gQE7RIRUqig5uCoN/GASsHl/OfisZEU/TS05ne9hPNqByGuayXtxBMxjGYlMLRrcINqHRPEyb81HHPe50xP1Qu19SxGZbMtWuM2lTO6GEEM4mREwaDR+jjVJEhGBdNpLO9wgRf7fi3foaTc4PtrZbJUnpkshCOGUPKNsv+s6Y+D2Kn8EvtHhDRVvppblU6/k2TGxF1XVb9OEGylsovAS2Fivs2tmDDIIwGSTxykmX1lVYg8ADsj4eVpit4Tyt/NE82DEZoB249I6BK7SxStLUaK5GLLmRXrU/5nmpA/ncg0pfJwbS9s0pncEdh8r3ewdlq0LW200wds+A1dFpBJMyYEbuux7pfmF5z3R9Srs3XNVHBTJTCaRt4gJRnOg== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: +QJhXv1JKrE854To26zCf/ZIhMeHjM+8ARooSAy7QKJSm/T1cXtx09m9IS0bstRuIlSb6xXK4HZuTB1IXuVnzSGUz6E/yx0gYCDovNkRmVt8Lak96B9UcsIWpOAhxq/FimHTsZ3ZimfWBDhQLORqOlzHWzE6poIUPiCUaJAvUW/lS+Vrz+scGJQqTscPymhtnlbEWiCsn8AohSW8DZmDkPDgGeQ7N1t2XVTP5cFQjrYSqBBTMZo09XfRKkyJdusFUJCQ2OBgMBm1N7xF43WeAezYTW/6ph4w2isPvgXORDeiUQ1R1ONFotv80teKam2FPXAngMcX8IUFol6dfSY2JZ+cCEUIJKYwgfa3mpU7kmiittjLx4uikLd119xskjklUnp1iWgungBeLFgZ7nbz7QCwns5u3VO8VUUj14d7w2noAPHSzMXQv6g5FrhjV1TGyz2Voyt36v21Ux62MLdXy5LTwXxDt4w2xEgZ2etNh7jqkAhmnubJ+zH1kLVE40BStV65G+z2TJwF2GiSZmXtEuKmjnGY+j7UViYnfIpg0GHJRm3eIUtdQXJw2Fqtfthly/Nk9pgJsXTqI3X4GVCtjWrFNcTKDvGH7iyHSyeufyb2q0jjHUi6uU36VErufCrwAyO+w2y6htQJDgLlVkbzhpUg1BdqpecqgW9xGEDziqgaGpa5jgQ0UdLmqqfbn7iL6fv5dS1XP6xW9hindLYz37ugSutQ68deQFtvliIDc1VZjHjuuwUmhdCIoFSI1moDFBLeXTjVaiKsiYUcrjnNwXiNQeQ8Qb9KqDfnCZdhM+u9LPmw0Uflz7/rDg5mpGD4GegBy0ROCogNXqIEgKxGfwa0vQqaAOlTezclc8p3uKE= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4e0e10aa-9ef8-489b-f5a7-08db239f4fb5 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Mar 2023 08:45:34.8559 (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: 8gPzI+a9HlvsT+RQPvkjet+V/ejo5inTqHSxuwHf/6YYCMiFe6fWEnq6gZUTyeKk4wbcbtCew6F/ytS5pTX/WQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB4703 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-12_10,2023-03-10_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 mlxscore=0 phishscore=0 spamscore=0 suspectscore=0 malwarescore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2303130070 X-Proofpoint-ORIG-GUID: SczhUJ_zHd5LU_jh4msMsq4Hd_mW2mmW X-Proofpoint-GUID: SczhUJ_zHd5LU_jh4msMsq4Hd_mW2mmW 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, 8 insertions(+), 18 deletions(-) diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c index 6364d6f08861..749358b48335 100644 --- a/drivers/scsi/scsi_debug.c +++ b/drivers/scsi/scsi_debug.c @@ -5412,34 +5412,24 @@ static int scsi_debug_target_reset(struct scsi_cmnd *SCpnt) static int scsi_debug_bus_reset(struct scsi_cmnd *SCpnt) { - struct sdebug_host_info *sdbg_host; + struct scsi_device *sdp = SCpnt->device; + struct sdebug_host_info *sdbg_host = shost_to_sdebug_host(sdp->host); struct sdebug_dev_info *devip; - struct scsi_device *sdp; - struct Scsi_Host *hp; 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 = shost_to_sdebug_host(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; - } - } + + 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 Mon Mar 13 08:45:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 13172074 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 7FEDEC74A5B for ; Mon, 13 Mar 2023 08:46:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229688AbjCMIp7 (ORCPT ); Mon, 13 Mar 2023 04:45:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230184AbjCMIpm (ORCPT ); Mon, 13 Mar 2023 04:45:42 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 34DB329145; Mon, 13 Mar 2023 01:45:42 -0700 (PDT) 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 32CN0lJp005179; Mon, 13 Mar 2023 08:45:39 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=JT0I1lmBwY2/I26xELUpQi/FnxBeftdM885RAyK68YI=; b=eDVmQs8pZsbPMF2/eV/3LFDfrallp3jh9pAkxhi/zNVu9h18OOg9sv/1i3slpv8mJ4Rq qljfbzo6Qw1I/kPe54idA3YFOjleAz10cD84JgoR925ae23fosnJa7oROb5J2AbuIybd AyKuTl3DATwN7qJq60PQNHvLyrtZwx5QC0FXn2VKoGA0wSKyarssA4tGGbQFpnZxcaXL odwL2kAsj6AqwAcs+gwS+n+Nf5yOcrgiRxijXhCquYG4Ce3YXe4oC7Breumo5fMLPmwG 8svMAC1+QxE8/67zv3wUtW8X07soaRz2NBUuMtNZyK9FJ9asTL9r6xhIJIiqA/xLMkKN AQ== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3p8hhab7rw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 13 Mar 2023 08:45: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 32D6tIlO033575; Mon, 13 Mar 2023 08:45:39 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2171.outbound.protection.outlook.com [104.47.57.171]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3p8g343a9u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 13 Mar 2023 08:45:39 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Y8cZFvaupNFNgvT9ctBxFpBixW3qqm1P/f2KCeJdk9R6Fx+jWs0pIRxtrGa3TszYnptQe+f4KH3npmNpiwTW8onP+zLIwhFETenOtEjeT9M6rk66oApOoiiOOg3FOjj1Vvd5LkiFq+2AqlRfcNVxhEzESaZ3JwXUSxzYdI60IZo/638jbWCatRwPSDsvyjvXteDZdeKA/9YgKRs56CEwqTpvlVFDg0AfNtRtk6roFcCuvnqUaIqY56U4VNM8xkCZLrmJiYEI3w28+EerF9UFnQCcLpQpTi0KcGJQWSn0q1C3gnKg5NkerB8EJi+y5Byo8SWmk1YdMbIHNiGob+QFEQ== 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=JT0I1lmBwY2/I26xELUpQi/FnxBeftdM885RAyK68YI=; b=A/f0ZMSTgLK35fhKjtpGl8gzNwRr6g6hxd7mWpuZo89IoCJPJPEbtZNsNkPwSwKDWyEoxtV9Hz881+y32XrrQtRhG9X3B2NYgD3uFg2/4giFkF21C6lz94pGM1gpjqnBl0c2ltdZwMiUttrRmpKUi/dvMCKO00oQ/fK3LNXbpVTy6uf08Cad0KzA6a4GOrNaPJaxmocuBwd2A4+Ubjw53fjy/ydNluP+AkD0ByWPyI2QoUpD2VuVk1Twt/4tK/Ps/gzh+9bh8i+2GLjBqqm0I8C+aCsq98iJZ9STRzzqAZft1c1qEeUjGrk6iyu0Wwk6VelW8sZIADx21tE/wS1iRg== 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=JT0I1lmBwY2/I26xELUpQi/FnxBeftdM885RAyK68YI=; b=JSvyn+0kGpcL+CsA7zpx37LFXPXd38lrfH6Txx/cRsQNBwkAn+EMFw38LRVte7uP/K01MuBn32nqJULHuhyw2xab8145p+DGl7GnDnzsuQUNHi5nlhSkPQRHWLTB36YW/rcDHlPB9Oktrl3NUvG59vOP6qtdSExIxbd5v6ECLqw= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by SJ0PR10MB4703.namprd10.prod.outlook.com (2603:10b6:a03:2d3::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.24; Mon, 13 Mar 2023 08:45:37 +0000 Received: from DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::7276:bc4c:17a0:7267]) by DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::7276:bc4c:17a0:7267%6]) with mapi id 15.20.6178.024; Mon, 13 Mar 2023 08:45:36 +0000 From: John Garry To: jejb@linux.ibm.com, martin.petersen@oracle.com Cc: linux-scsi@vger.kernel.org, bvanassche@acm.org, linux-kernel@vger.kernel.org, dgilbert@interlog.com, John Garry Subject: [PATCH v2 07/11] scsi: scsi_debug: Drop scsi_debug_host_reset() device NULL pointer check Date: Mon, 13 Mar 2023 08:45:02 +0000 Message-Id: <20230313084505.1487337-8-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230313084505.1487337-1-john.g.garry@oracle.com> References: <20230313084505.1487337-1-john.g.garry@oracle.com> X-ClientProxiedBy: MN2PR07CA0015.namprd07.prod.outlook.com (2603:10b6:208:1a0::25) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|SJ0PR10MB4703:EE_ X-MS-Office365-Filtering-Correlation-Id: 963c57e3-06cb-4e49-b129-08db239f50e4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Sa0hnsDNumlO8WxN9NHlgMAgvds1D66TrcDPyAAbdr/HHZ6NZfDFWW+hu0XmgyDgNjzMPPoHYYHPQJZOVL8I7ZPuC2OPW+L2BMaDqx9xlEZf3N/XNE3cqGcwvRiDihBqQgMAv1is29EaBZxa2Jbq8miCrZwt874FoPuvDzvqvCG5F+BTXs9SGq1kg5/fO+cOneiSTochx7j+nGOX8EkzqZfvpHHf5pTULTMwMpJ4/807lJJbHwg/Utkx2Ls1gby+7UKkTvC0oBteuGlMJ/zUD73Ur8WvLTRrPyMP92N1dzxeQGHpzo/8q7mTJJkZhEMrAyzNbuwsh/jDMzfiIAjb46pzf+zmmwQE5uVKQ/LFx6ElT2GxncGxF51bXBwcSluEUX0C9Ccfw5L2WmmGL00Jp/VBx1nSDSngFpTPkexl0xCZWGlWV9gyP2MzbVV9MPZ8knpOkzwENGRoQvAUMQrOIjQVNdHJbsCG7ARf6YIV4hN41jOChLQ1Od7/cw4fHk2g0wmjz5tOOa7DPUVS5AKolf85S5xz4QAYhFCoohYcXppSJYrdZGc4bCkYVfcGmthbQsFrCt4iBBCANesWS+gqfthF0NDBhP+0vXHUJTqtr/Jw6LbT6x4z1CePKRnR07ZrGuBHREl4RzNa+3yK6OFL6A== 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)(396003)(136003)(346002)(376002)(39860400002)(366004)(451199018)(2906002)(83380400001)(4744005)(36756003)(5660300002)(66946007)(66556008)(41300700001)(8936002)(4326008)(103116003)(8676002)(66476007)(38100700002)(6636002)(86362001)(316002)(478600001)(186003)(2616005)(6486002)(26005)(107886003)(6666004)(6506007)(1076003)(6512007);DIR:OUT;SFP:1101; X-M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YRhToREDnLk3O0d3Igc7Ln79IrQigt7O382S8+6TSUAAiHCfHUGilnhaDbdGTNqBD68ovPsK2AerC1+XCxI/N4bDrnPuSb5sIdrGa5XLT8RJmgZ/vOAtzGU/BCjJHRW36QAwdpOwi5I0jk6ACwAs71rlOaW2jBol/s9zVd5DFT3/3OlOYr/X03nVg3TJ8QxzljA7GqV9Y3iMiMklvWOVbqgBN9w0opvDMYO9/dOBElJ0asxOw7reBCDb28bvQmBrfNmI2V8+x6Y7rdjO1kgISmiMzVNc5gxlKkAxL/Ox7kP8j3OEOn6p9IcVIPDoG/fUk8gbRDK5tdYkMlOAQ+kPfP4f012H17EDLOna6RZ05kxt4hw06O/gVl5zhPs5oASF9/yESnaME/iAX6kJsbTMvZ+14C62t5PDupW8Q6slGVQ9R5b6pYZ+Of//aypKKFsL5MgI6K0pCIWLjF0zlZC5lQ/9IpGyDCXj36xhMpCdiIVlcj51KibQoAXFw5Cs0rO0xNc14BPCfgLd/AoSfefUbOVJobndSMtde/Fm4FWyY9UVXmulVulhwCz628xZFtD+J7k9P+zgU7gnOxnOEQ== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: IFt6ny+AUvTyyMyA7YWrptVeZJ+c3PWgjdaVsmdah3RR0/u29Ch7USmEckqA7M2F1u7dG5J0mFLGXbVuD2Z1tjTKbccs91kxuJETCUJ719LHFQAHkMAgjuaMkw5w/KDQQIb54oxg/jGeaLUTCo8OIEYPmiC6DKSdJNdKtMmDR/xwQR+p1wnnxC9yCRit39lwOtpzHPgchNHxBnEyFwrWbQl/+USsAd9xau5f/1c2W5DQ1iCi/L/UNheGnXd+6ieg9xsGfyVmB8uymPBcx8wif42qK8MGRw6vQspxBx7tOKX7mgIglZFuT2qJO430Iukc8/y8Ls6lbl+yYmvKkV14rntM9iiockZvhVmeQlnKCjOQYTYECesHtfFHUN9BBygA8yNXEGwYr/BmcyOaACy+telvD1AbE68ST1CECd8TAmPX6uKXrQ2P8RKJ74FN1ixLacdL94pxSRqcc/IM/ZoweflEEZnCjClGnDcBLJoSf+Z4fuWF+NFrTqddS2eLTHaqLOWtiM3o/0zB/Ky4tvOl7os2NG6Omp39BRrhnS/TDORbBpirsQ01vp/HDDVh1Hs9q37HeNgxt0dWL9e7q43lloqDEVwCVY8Z/uG1xA6h+Fhk+5U7fXdBbCA9hoZ7IzTWVmMNKYAQVY6Dew22SQBRdltFg/TVZtOO3h7dUZT1v19BPTF0gfvML43i3QynlI8qNE+GZQfNWbennWxDE5lkEX2ERBM5rDP2uwyCRVT4amB/46zSpduuNIczqWnCCAQ6uptA9yLe0/Z5xCl4O6tf2RXjF3dvLj8ryEBpXAwHc3/2NjVMcnPuNZY8ZWZPJLICFqpzcsbztnyM2jKy8KtwuaB1oTvM1VL/v2kgRPVv03k= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 963c57e3-06cb-4e49-b129-08db239f50e4 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Mar 2023 08:45:36.8400 (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: xw/n6Fq7JTlFGkpmDAz3mhsiWB/VuzCKuRS9t0N7bEHmke/RWAziDFhDCb35S+aiuwXCJ6QNp5enjUl0TnxogA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB4703 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-13_01,2023-03-10_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 malwarescore=0 mlxscore=0 phishscore=0 suspectscore=0 adultscore=0 mlxlogscore=999 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2303130070 X-Proofpoint-GUID: KnIuZP1N7orhC0GPR893yP3L2NMVBYk7 X-Proofpoint-ORIG-GUID: KnIuZP1N7orhC0GPR893yP3L2NMVBYk7 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 749358b48335..47820b9f6326 100644 --- a/drivers/scsi/scsi_debug.c +++ b/drivers/scsi/scsi_debug.c @@ -5440,7 +5440,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 Mon Mar 13 08:45:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 13172076 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 76D37C6FD19 for ; Mon, 13 Mar 2023 08:46:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230300AbjCMIqy (ORCPT ); Mon, 13 Mar 2023 04:46:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51102 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230225AbjCMIq1 (ORCPT ); Mon, 13 Mar 2023 04:46:27 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 394084D621; Mon, 13 Mar 2023 01:45:44 -0700 (PDT) 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 32CN0lJq005179; Mon, 13 Mar 2023 08:45: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=l5emtnqnAuF5rngG5kvp0R7AJJUPTkH1GIQnJU5Z4ZM=; b=JgTlblEnUA64VVgC8ItR16lB7yl4gQ40uyjs7QY5m2CGU7q71GDjBK2IRJLJPynoowEA dXnudo7IZGOYrSy2DokU30vqOEeVJvDKA16vC3VxpKnJa8ME7gxaoEyG1vuT76kb+Lqz HdRp3f2Xu+uSNGq/jbKHGNXqNCLHZluX1f164moDWInfMiRf8xhxYR1S70/IyPTgCOQJ DLxhrWmn0eoJPaG3BvUzB6K5gkKEc6r9l02AANV1hlTR96Z2hCO/XufUYhbEh58t7yPD 2TEfV1DUIq/UqIsguMAEUTKDx8SJKBLLHbKIPytEduuRG/7FWwE2NKxgf1zR/IOxgIQY hg== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3p8hhab7s0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 13 Mar 2023 08:45:40 +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 32D6tIlP033575; Mon, 13 Mar 2023 08:45:39 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2171.outbound.protection.outlook.com [104.47.57.171]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3p8g343a9u-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 13 Mar 2023 08:45:39 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CJdbHvAenDNGseKvsW/INdbzy3UkuOrRv/TWxcfNcsLrJoTR+kkT/As76AitkrgRGmg0JhtnQncBOER4ClFISkJZqd/XBakFvlXHfw9eUXv934mdtkfJrBSXU71rutqCb3TGPwjHPOiFB78o9+prpN97Ic/R3fZ3tBJ4kWoJ/v18it+K6neTp5pc0HrCodbmdGKCQxV6mGEjynu7MN1yYL1xvHy2ZSZIw3tEn3eGi99c1gikSMLqSDjO4PKKgtfZcid4JN5vkOVIMwwJKepJfK0UqcvK+sP22nyDzNaJX9PYRL+NvE/pMw8d2fDIH4NsiEC48uCSyi0nxooUrLMaww== 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=l5emtnqnAuF5rngG5kvp0R7AJJUPTkH1GIQnJU5Z4ZM=; b=C9+SrCk2MK3z7ftwvlGpMt9GAlrXpWq6j374cmjizyE96H6LXfgVMg7GJ75TV+bxUwtuPUSvGJ9WyKKXhiswCYUMH02BsBMJtr3EDRThMtlkYWeEbEUVbrUY2KJBzAB0N02P1qYmUDMArkGsWK9J0xNEAWssh9+ow5YgIFY0Tm2NACltfCdOMZiqxmW9OXtL+kH6LfSHKX5KNz4hLTvnuTW5jQ2vNVjJZQ39HdsAzm0jg6SmoEY+XJKDcY6FDMsOUIm/V6wL88mlzO0Ezn+16Ajf5GMvw4KQrFlvWzEI9GJZ0I6869vnLkHSelKS96svLjpFYRdB/P6e6GtWgDWbag== 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=l5emtnqnAuF5rngG5kvp0R7AJJUPTkH1GIQnJU5Z4ZM=; b=dReOhmijTS4IvDFP0g0VfHQKpF44I/T/zDq+ZauqJP2NFG2Jc0/Do2ehEJCjZamVVIEnL5ViK+U5ZP66Kr20kK+vvE7hKh2pbaexR8DTIjgmmkiMGm4gcBe94qmceFDszpmdJMxkzVkObBpEsdtXHcQf+nua1wQUYnmLjQI7NGo= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by SJ0PR10MB4703.namprd10.prod.outlook.com (2603:10b6:a03:2d3::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.24; Mon, 13 Mar 2023 08:45:38 +0000 Received: from DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::7276:bc4c:17a0:7267]) by DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::7276:bc4c:17a0:7267%6]) with mapi id 15.20.6178.024; Mon, 13 Mar 2023 08:45:38 +0000 From: John Garry To: jejb@linux.ibm.com, martin.petersen@oracle.com Cc: linux-scsi@vger.kernel.org, bvanassche@acm.org, linux-kernel@vger.kernel.org, dgilbert@interlog.com, John Garry Subject: [PATCH v2 08/11] scsi: scsi_debug: Drop check for num_in_q exceeding queue depth Date: Mon, 13 Mar 2023 08:45:03 +0000 Message-Id: <20230313084505.1487337-9-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230313084505.1487337-1-john.g.garry@oracle.com> References: <20230313084505.1487337-1-john.g.garry@oracle.com> X-ClientProxiedBy: MN2PR03CA0019.namprd03.prod.outlook.com (2603:10b6:208:23a::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_|SJ0PR10MB4703:EE_ X-MS-Office365-Filtering-Correlation-Id: dfb11cb2-30f1-48f3-d9b1-08db239f51b8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: roo+oVVXyaQOFLS1F8JmmIJaW7/b3p5vI9g6CGg+F0a5jGUVfaikD3yfaWm6rDTOEIwBfjqkgi/261u0H73f38iDRUwqsf70KHfJJgIVn8Rh+dcKjjfQ3hdNC/7Ws6ttw2Y8l2fUktjplx4fSeT402nBFODK4WYkZisMR1/VNz9aXuY0pzZzHrv8/iJ7AGf16ixc9+ZBRSrhnrmCp273BGxBJKm85kCiw8Jl2JjXnWFunhDGPGkmug4+SMS1asvKkwRhd9Qcuv11hqOy0cKo1Sj2WnIzWDjBttOqDLrPq68ymhiDWvdv96y4AkHvGghWwE0mZI/7S1f94Ry0XS1VxrBmOgMCN6+o4EvWetccFNgSb+oEYtoseHUOnSiC3pmDsDrg5d7TdK8AGzO1YUDyBJtp3m0tM3rc24smHMkaEAwBJis6Ntblv2nST2W5oQ9t4PhC+7FGufsa2w+GkqwzpR5owguEpvN17MmL+crQwXrBU7T6pD20uM4SGfzOo/lM2HQnskkUIAz8+JZLPeljde23IbN9UzUMLF7B1rp+n8BqXleschEf31W3RU1xYUiJkQYFI3/iTWST9wwYuSteJcxATDfjBy0P2br95BTOM8pZLHgWic6yPRY3qEq2F5LTWV8NuPUf+grgvyVA2ZUlRA== 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)(396003)(136003)(346002)(376002)(39860400002)(366004)(451199018)(2906002)(83380400001)(36756003)(5660300002)(66946007)(66556008)(41300700001)(8936002)(4326008)(103116003)(8676002)(66476007)(38100700002)(6636002)(86362001)(316002)(478600001)(186003)(2616005)(6486002)(26005)(107886003)(6666004)(6506007)(1076003)(6512007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: /ABESVRRZaBi429z+cEjXe6ipBr1OwdKQs0po2jUxWPmKXWwaqyJA8waA/qcocelp9Ffoh4XslvwtHWqz4p0DekKJDrQzYIwf1vGyR3Gw2ID2OOtOlXQK6DLACU+WKcNbJPk+LNNuoFHZnMuq1DDGaodkLrj/peeQV6Qr4klZYbtD90YlaMLrUfYd1pwymKAaWoz4eaat3cE+Oe0pqu8x8eAOPAWpZoVbM4kyZtiNu6umfn+mCAHVFiNavwcaKYD29BzrKMF9fkZpB+Knlxg3+z0aYmAJjn0tv/5n59dVPZvzvUznpeQVhE5RoPR79mSsmGM73+fQ0R1gmJwu3mTNEmgZ5+t8ZtMAdGvALNvmqk462aTm7PsfqWJb2KxD8nOfpmQjz9ChaLHIc52QaCm3uPPTQrF7iPaxe9cijjcfguyCrKhmaSE/RpU/15nx0m9MPssRgaT0FfJ7PA9ktC1/dNbHSdcgI99y/Y8gFjv/UJiycpguwzndP4ZlakGxgilZpcYiDSdYIcYDwlBr0wcLHXDoGu+JGuHrJoa0P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iSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: xn1D3ZR9km3OA1q8tXrFpWLKWVUhXZlkEbfXwnYPqL1qRcm8iGPTzMjcmsaNyB8WQj+17yU8MJZ+gRlXsJh4DsMc1Rv6txyRb2OMiiiePFmozI3sb3zh1TxnzHZAdHTxo6Q87jGA8R7BMB6LRZVlel+ykv1/wXC1bCB2dqxJ2SxtKH4VjGdsSXJ7KqknJdzw6a93j4bRMtMXCKI48dy3Q1lHUxE57WPPp2VA9XfHHjNjS3on4AWs9n9OURikHIY/UR328x8Mm+7J/PcKPWlITArBQH8V0g7/pHIJvNUjOpAVCXtj0QNcc2mJnMV8GGmFPKqno8rjaPeriavyhmMMFPT6Uu7RLQeqYVx9sx8Gdtm/ad8RfrxxDuTpude4oZuKepjQjBQUh2xtNEWfDLr1jt8hpkJjaacupo/Uf+hw1aRqK1ymBOueJdQdSMVOtXnRzaySMSZRQcnYUxWUSo/PLq5haPe481DkV1eTzu4kawl+iebN6Mkftd1Ldti6UZvBOBGqKGSTwUrwuTaDByPw8sXWR93h3/dhBtq333SGmWZJKKnqP80RXB9owz60gWI93pVSwVGcjjDv62ScNTxVjh7toc2CqNvi9Y80TdTSS1eH6oBx58mCkMrwn0f5wz4d9IqmRhTwsaXlEFWW4wNDPq9fNUcS5ZB4HxX8pmPaHykC72qB+ecHv607zmPuZsrG+J8M/4lCHnqiB1lVxZPclecUQnKmXiTVCcGKgfg2LI0KzZYXgq2URCoTu9fjVCf7k2Pfs9KnxfkDVlZprTFT6vKC0tNHSpZnmwCj97pS0fPbyZJCQomJ7DeeebIntiFUqXM/OPFYsbEZVIUtIPSPoAkfaNZgZ6v4+d0557trwDI= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: dfb11cb2-30f1-48f3-d9b1-08db239f51b8 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Mar 2023 08:45:38.2304 (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: cteYM1yuskwtI+ZSd25KaQv+MBQFj5q0d8E/v9+K6UBBTv9aCul6INcKsfWsvzXGM2QfP6NBpUts/hbQxqF05w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB4703 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-13_01,2023-03-10_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 malwarescore=0 mlxscore=0 phishscore=0 suspectscore=0 adultscore=0 mlxlogscore=999 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2303130070 X-Proofpoint-GUID: R7Nq09oVXTi_-u0l8i0ICIjv9Bp-U_qP X-Proofpoint-ORIG-GUID: R7Nq09oVXTi_-u0l8i0ICIjv9Bp-U_qP 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 47820b9f6326..0d515bac93bf 100644 --- a/drivers/scsi/scsi_debug.c +++ b/drivers/scsi/scsi_debug.c @@ -5593,15 +5593,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 Mon Mar 13 08:45:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 13172077 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 ACF36C6FD19 for ; Mon, 13 Mar 2023 08:46:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230203AbjCMIq5 (ORCPT ); Mon, 13 Mar 2023 04:46:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230174AbjCMIqq (ORCPT ); Mon, 13 Mar 2023 04:46:46 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E13834DBC7; Mon, 13 Mar 2023 01:45:48 -0700 (PDT) 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 32CNfBN1011019; Mon, 13 Mar 2023 08:45: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=AIiTWATWPyFuTDZUG5HFf0bdHkWMXoIf2fbBo+ky270=; b=pb/KEusICC4FGAcF70dKX+PIblV1kHXsuy36aqXYi1w9gqSqCxK9e3B3mBgJ9k9O0SDu 6Zkdl0btNXaDVTVXCOqq0iypD/T8xDl+79KH3ZSgxjU8DPMWEdImbTG0qYz1dyUy4aLB DAxfpt//E3MSwotgqeNNVV1CS0merVLwOICgjKKEralI4oRR7H4svgOSlFU1GX4tc/rk AyWRruxnrld4M0WvYWtPYOr/w/cIxbU26yv+kQ2LnUaEElndvjapSOJoNlv/O5H8DLQc vfh/iG+ypCikVWPHINSp4ao3hdY2p1use6fwtgea8ElKYiJXRTvyizQ2totKe1u2+mTZ rg== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3p8hhab7s7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 13 Mar 2023 08:45:42 +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 32D83W0k008260; Mon, 13 Mar 2023 08:45:41 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2177.outbound.protection.outlook.com [104.47.57.177]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3p8g34b4vn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 13 Mar 2023 08:45:41 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fbHO0srKUMPVF2amIZ/JlMzxSR3Oq7IvcuVAmuygGhGQIxSHswl0EbAnp8Po5HOuNsUXeDxM3iJ1Nrf2F+kT0cZyKtAmBpos1DgPhBwuV9mBwn7CYZlRRy3JedNToAGOmK7tLmJP8gg/Bn+XN1o+WgPGy5l5kk3lmCgeWfW8U1zDCfLjoNb4hoRnBe2qGBWZNnOB1MHdBHJO/F+YfpkpBdYsUUHJZX1mo+eZXkil+Jm3zW2qfk7zoHNSOzn471LRyswpWIwOs00F3eVYDAOJjdDitvl5WB5jhcZrMFSHLya/sL4+7kC+Kc9Kg8h6qEDn5hRFs5rOk0QHmt1zO+1H5g== 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=AIiTWATWPyFuTDZUG5HFf0bdHkWMXoIf2fbBo+ky270=; b=e1oldIx6WqtcWWL9OkReqhAO/AuH2Jtsq5VRj7WmPwVOlupy0LDNwatbP5MlRSJ9RhArJeuPgaacR+oNHVQX9dPqL6/f9RsG5LDaZRdTqjxc2w9CT9/q1hys7fN1GzOEG6PtgR/iaulH0Yeerqg5+hXZQjoi5iCclGWcTG58EvvGjv0ljmFvl/FvmB6BvN59gIAAckSQEGAG3SKtYWZ/mF4JzZhXh2HUdP62fMIF8o/KJYK4d/Yxx4w/tUjGp7Ff23Fh8i81wlaY8nLWMt4/Wwu7DmuG0zjiHsPtk/0W6ZSiDaaviFgrLO0g4ku1PRc7bmYP32Ld+VrH2DOFydgT0A== 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=AIiTWATWPyFuTDZUG5HFf0bdHkWMXoIf2fbBo+ky270=; b=d8XTRT1JL5Q/wX1XHg0kqVfPa2X0p9L3Afd2JL+l7gepPaLfYL4fPLs7opdDrCqO2WLHkmATvZ5LJDlebzFlXdvDA3Do6IuQZSQVXR9iQl/bI5YIYwXSCk/ERTdZj2iNBiaAtOhn8/Q1VkSGGxcET+eUB6djLNeWOnUBIZ4JM5U= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by SJ0PR10MB4703.namprd10.prod.outlook.com (2603:10b6:a03:2d3::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.24; Mon, 13 Mar 2023 08:45:39 +0000 Received: from DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::7276:bc4c:17a0:7267]) by DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::7276:bc4c:17a0:7267%6]) with mapi id 15.20.6178.024; Mon, 13 Mar 2023 08:45:39 +0000 From: John Garry To: jejb@linux.ibm.com, martin.petersen@oracle.com Cc: linux-scsi@vger.kernel.org, bvanassche@acm.org, linux-kernel@vger.kernel.org, dgilbert@interlog.com, John Garry Subject: [PATCH v2 10/11] scsi: scsi_debug: Get command abort feature working again Date: Mon, 13 Mar 2023 08:45:04 +0000 Message-Id: <20230313084505.1487337-10-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230313084505.1487337-1-john.g.garry@oracle.com> References: <20230313084505.1487337-1-john.g.garry@oracle.com> X-ClientProxiedBy: MN2PR07CA0008.namprd07.prod.outlook.com (2603:10b6:208:1a0::18) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|SJ0PR10MB4703:EE_ X-MS-Office365-Filtering-Correlation-Id: 0a58df55-746b-4252-56ae-08db239f5294 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LOEUclo4GMNo50tc0mrhInwbdnXpYx03aG93ztvOj4/8SX16gpsOOnpmjo2zKB76ARRWcuX6TT+u+yZBom1+vv4OHMEwTsh3J741qh1NmpJmuqEI8gSzk/n1ltAWSUuSkNBEc+IHBsEZ8cK86PzenvzcoLSphzZUDn+ix8qv3HzCC9RNmu8EQZzqM+HUQ6zTWU8SfElZmkAziFMh5M8471m2r12+fIV5EtO0gvzBioW9ics73rYipUvuyuMwaSOcPP1ytz7Ex2RDfhgLzjatGaLfSdmGKMkvW2TFiDFl38ls+lTknSbHtXjeayL6rKRjSl4zSkLOkVpj4nfXJOtTnW2njO7qcPtiwPEV3gnz7Ov0RGemR18jN4i2hl/pkrbXimSG8WfhUd8I9GLETpoNsob/5sa6ik1eDRVcYMNifkWgNFkfpC3GmijuV6PQJFXrtP0bNNBWY8Z4n6lQYZZKAsLfzUhG8XI2I+/IuhDsRAR4KSKXm03s6h0Wl9OOis4RzGvtOU7S2ENWiaHSMuSc2gf/tcWFCOT/7baJAlkoQQPpV2GOeqeAQI56XSrf/LIx+SKYF5oZBjVe7DWComb/XT4Djvo6AsBEVB5w+OJfg7X/j6ufXVmXZGUeEBz3ERfSYGVaElnJhwPNR6kcRFlzUw== 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)(396003)(136003)(346002)(376002)(39860400002)(366004)(451199018)(2906002)(83380400001)(36756003)(5660300002)(66946007)(66556008)(41300700001)(8936002)(4326008)(103116003)(8676002)(66476007)(38100700002)(6636002)(86362001)(316002)(478600001)(186003)(2616005)(6486002)(26005)(107886003)(6666004)(6506007)(1076003)(6512007);DIR:OUT;SFP:1101; X-MS-Exchange-Anti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yWn8kgDh7601K6jDi5N3CRY66jV3PlQyzfn5nf6LYzNfZUEGT5xeFIauBEfr0IPQ+2soIHlEYuGEMyAVOlMGdfYk++1I0ByGIcC4hzEkVP0Ew3JIVpD2nzbvRP7rTaCrhx2S8Xppoy+ItLsXV53klNsjSfmGStH1fj2Yn4wmZ7QCAcaAeSuaeR+s91m7Z35tZ0Igtkx6RfzVDc5ouGr+Ft+FhT1FTiUMt3rsuPH3GyzBLfSHsvGu3Jg8y1VIvhwcH8WyuH9e1ahcVoi5mx3UsrN189BHxNj42annVoYqX6eddX3L4RtOufJtBYVc8j8Hz1mXMvzr88yO/ehjifK7i7HDUyN8yXS1X/Z4q38o3FgchPLXvrIHFLs6nfJgEhUyBSQE5Xak7iSCV/yJFwxLsZCirZUZl4g9sp5fynXPuxT46ui0nR+hfvCVL87hsLDR4iwKrCDh/ENd/DmoHnLNEoURtASIIMC36yyqM= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0a58df55-746b-4252-56ae-08db239f5294 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Mar 2023 08:45:39.6532 (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: WZUpnOpUEvf9MnDRGKiYDQtw/vzlu/tsyvEAzjRtLume8njAaW88ipnKZsFcbFaftbzgqGMQYycdWzZdT7y/HQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB4703 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-13_01,2023-03-10_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 phishscore=0 suspectscore=0 spamscore=0 malwarescore=0 adultscore=0 mlxscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2303130070 X-Proofpoint-GUID: hQHB58_Ug8Kh9bsZfZNFKEGf5TffUVo_ X-Proofpoint-ORIG-GUID: hQHB58_Ug8Kh9bsZfZNFKEGf5TffUVo_ 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 449b460e4c1b..1463e54179bf 100644 --- a/drivers/scsi/scsi_debug.c +++ b/drivers/scsi/scsi_debug.c @@ -4983,7 +4983,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 */ @@ -5712,8 +5713,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); @@ -5738,13 +5744,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 Mon Mar 13 08:45:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 13172078 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 AED2FC6FD19 for ; Mon, 13 Mar 2023 08:47:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230240AbjCMIrL (ORCPT ); Mon, 13 Mar 2023 04:47:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50442 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230234AbjCMIqs (ORCPT ); Mon, 13 Mar 2023 04:46:48 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7247E4FA9C; Mon, 13 Mar 2023 01:45:49 -0700 (PDT) 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 32CNs1kb029642; Mon, 13 Mar 2023 08:45: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=71CBl6OUE/KdEwxSdcAvNYP0lkXTQJ/ovxP3w8FCjgg=; b=26rGXgIJXd3NPR1eXA8mbNVNmg3HXE5Z7WYqE69dFytBuRstziiH+/svbDyhRCC0l4+k fU3RBiXJebJImOp0X9io5mbD7oHCqdijAoDi4O+bKnT356hwR44Dv2Bq/njdCMv7TFkU /xnMe4rfFQgndXcmiDwK36vMhc6MWATimXKi5aDhg+iU6n/vqr5GYMOV/xu1pfwQgAYP UNA7qX3OSTm+KQZRine4GDx+zzgDv9zGAcaTB36lTGInDo0Coc8CifXpC6Y6PVb1nLQe S3v2LWHLQgdbzGD1KAPdBAd3NxzhQYYrgjTOEQ7vzPRIEiEVakod7mA5HVUe5T0UEMb1 jw== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3p8g2dk9h6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 13 Mar 2023 08:45:43 +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 32D6qLeA008167; Mon, 13 Mar 2023 08:45:43 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2168.outbound.protection.outlook.com [104.47.57.168]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3p8g3b40ky-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 13 Mar 2023 08:45:43 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iFBobgykvfExvtTFiTOQFSTZWkVl4Nhdmb+lXb1tCw8te0xo/gd9hLmF53coGujyhG59NDmH3byoEYGnvqQFeKHRL+tHcEU46Gc6IvP+EgyJX3SwDMCU/gFqyo0MjRyhpJGRBgDzuiMye0KbBfrW//YciC5rcBd59kN6Gbqau16UlbGYQHViG9QNGfwykr77v5p6C4lZWkKuO33HSjMTl9wHRPO0pmlhEctBzBEaNs+jMzJtQnNgUeLULxWD7AemD4r7nbExvnN/0brgeH8VFmosDaRNM30Q2Rx/e9yFot2armVkH2RMGz//tCyBcFULCpHzfhvgHy/v+6HOr5Zong== 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=71CBl6OUE/KdEwxSdcAvNYP0lkXTQJ/ovxP3w8FCjgg=; b=R1ZOYzdjBnlM2PI/3JNz5oS0O1iRXFikrtIwTQUjSVstALU8ZdGta243WVwSr9Cg1R16xSY8yzSXtYD1sLk28e+EMVXTyDP2/vipiMV7Ih3+AyEXpekNUof4Y27PXRUtjxjaGMvzqJXwORqis3PYV4WvkhfDB0myeJ/+Ygl46DidiIE5XtSPvsS67gFp2sTTrvvQIsvI77qowoPO8cTErZeCVIdtogITpWzLDcje30rLnPAA2f+CT4KLs2kI/7RE2Fsd/u6kpgxyzEyuQ0308ETbtRTha7r4nQaEyOCXGvBPp28zNgeAKv00H3n2FjZURKBV8VV8p2qu4/nH1DEJJw== 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=71CBl6OUE/KdEwxSdcAvNYP0lkXTQJ/ovxP3w8FCjgg=; b=zzoCHqF+MRnn4JBAadTx8ph/hrJ2pDDRTphf/Q3MB3kClakFsVVMDWJiY0wkmD7xYTXW6RRbYjsFcJ4QqVyfeeCxQu6bWSQqMxPZsDGUl5+Ih1h8O8fRAcishOJV36+7Mvyo019ib1AvLKYFSByGvmSQGyozlBfnHrjZaLnyZqU= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by SJ0PR10MB4703.namprd10.prod.outlook.com (2603:10b6:a03:2d3::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.24; Mon, 13 Mar 2023 08:45:41 +0000 Received: from DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::7276:bc4c:17a0:7267]) by DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::7276:bc4c:17a0:7267%6]) with mapi id 15.20.6178.024; Mon, 13 Mar 2023 08:45:41 +0000 From: John Garry To: jejb@linux.ibm.com, martin.petersen@oracle.com Cc: linux-scsi@vger.kernel.org, bvanassche@acm.org, linux-kernel@vger.kernel.org, dgilbert@interlog.com, John Garry Subject: [PATCH v2 11/11] scsi: scsi_debug: Add poll mode deferred completions to statistics Date: Mon, 13 Mar 2023 08:45:05 +0000 Message-Id: <20230313084505.1487337-11-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230313084505.1487337-1-john.g.garry@oracle.com> References: <20230313084505.1487337-1-john.g.garry@oracle.com> X-ClientProxiedBy: MN2PR03CA0030.namprd03.prod.outlook.com (2603:10b6:208:23a::35) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|SJ0PR10MB4703:EE_ X-MS-Office365-Filtering-Correlation-Id: a6c94330-84ca-4ab7-e252-08db239f5371 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: uMoBSzkFDbgjeBQKG/eEDPG8jQ98UpPjLddqdWYRTXW7QCyDhWMHMZpM/Eih1Jq+xIltFL/PhGEO6cubUHXf6ZXnSKl5qs4Dra8KDrpyFn5Tk8nzIWRXMQ/iK4Epo5c4wjg7i2f2CzQ0Cmz5QivBhk72HzgsnQjc6Dupz1GDHe3oTiSlvtu8em2/QAXd4XPtwZvjHdz2+cFqz+jtaSVrAd497RbKm/L2iylFNZ/mFgavVgXv8zwzzQCJaYCQXJozPScRr0ZtTXHEjB4iMfzArKcOwH44JG1ZBlNEYZZ4cD5ScgzfKdKG1BNU4Bp5UpblFke/I5Mqu+ClPLjXWabCotyhV2MvxRcEAFtAl+2v0/MQM/fwkTOONVxirfqnCAurrajuPlyql5ljhGlFae7vzn2r5tKVIOngmGTUUgxtrU/cy9vKWuDMqb/so06UbFdA6DeHT1iyK9C03c5fkxWb2r4qSotJblhd0rpAuy5TfkuTXWlpZrAejRv54uX8Dzk5cWhkyddXl9WA6DL5DiFm6A+ck3HlGSWyV8oLQi6DrtXN7wiHeeSrUIvIZ8O6yCFQxBcc5EEuRPQEVmi+CYGPiRB4Gptg+4TWuq30gVIrrUnGFBmrnD5RT6dM5cQn9AP8tkX+g6qCuCp3S5UUvcn2cw== 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)(396003)(136003)(346002)(376002)(39860400002)(366004)(451199018)(2906002)(83380400001)(36756003)(5660300002)(66946007)(66556008)(41300700001)(8936002)(4326008)(103116003)(8676002)(66476007)(38100700002)(6636002)(86362001)(316002)(478600001)(186003)(2616005)(6486002)(26005)(107886003)(6666004)(6506007)(1076003)(6512007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: KsdeJ6JNLPUiM+vqvqgjx0c4QS4RHkf/cVVy8/KovxyFBeaIV8EFu7gKSkmUEzgRerwMcxY+MQwwCKU5i03TOJNSSwMYGp66gLuVYltSPjKle4+3R+RqSIwSG8ylVYvlb8H9VRmIg8Sxeoykboi5YYYVNFiRus/jFs5Eoggi54QtGRT4qqvDD+wC9ns+v6aY0RbdZAg+19CuFjeB3Q9wALFwiQzKpk0q1PTAdvlYlQXxQfb8MPpO6TDqq8ciYdcH4GpP9jLS4PfZlI1vDLsGv++CvWM9XleXRvW07wjQUD4b67PbZsCQHDMJp8mWZeHfS1RsEmjFNJWybCYi0HkIc9WgOtB48Q3QBZyi5GdzwCs8meZAUBGxtPr6YNE8QZXBeD3PGzBcgMo0f0zowUSeC5TncTX8V0lzwTTqP5Vq7AAtUbobO7SD+ZON7AfUkBizg/3Qqd8Ym42NBb9V8gg2xoJqczIMqZ5caijXO+XVWfE6RU9AGFLrtbxX7poCxAskFkb1JkYWPg6/nAjV/YpDbTd683bRFt/95cOxYdUJ4sN18QCNEhVrGXDmo7sIE/FerekbNPsHULFtaCmBKGCDuvP07go0wpVLPLBWcG6zw7Embt1+I2JA4BIk8nPsDLOtI+gwb5/McX4KE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Mq/v1it1QaQfNEqq+8Aw7tbKyYpmt6S5454IcBKc+zzmqgXsW/F23QGowVf08dP7iAJuwTHYAi+1QslBfy41/5/Q/wSRPiQVmBzDjyxnHttqCUhiLmttkFxmj9+k0gztzOmAYslhrzvmuBF9F57DYaFMBJC6keqGHfnT0AYrMWnc7aFwADgpma1jXTfI7fQRRtDnxHCjDkArhwJrmDZDXXqjQ0ush6MOEubn72ZgZ5VJ7lMUy+XuvV9iGvUGFF6PC8AXomN5PPddHVnm6ftBtW/yIURLEeYorjxROENVG3rsx467qpBaftYPLs0aDQrP1+g0LFLPG0erzKYEqKSOWmDPc8468MmBYY8HmKkWJY2UXbx7qC2XNR4V4LhF9UDqWzPQbPviZRgTtSsw6ZEW7piEkid2cd4x3uYFHPVYRK0Irz16OGllgrDX/txXR1aQ5V7d4jOo/bHCaXGkYLO3UqyHho7+2ecS1FSdDNP4F3SUDc1ciWrcsKoNo0ORN5EX+wgfqYc2Qrhe2qoVrMDB4QD7Z4KIgV5akSeNGfi9Da5BcthqCiBqAUS7QUwc6ygXvNWmoMbDgnHGZm11LRgHiQ6bgooYSfzj2LSS+geH7rSc3cFx92bbi8NXQlEir7epduHKKqgTuBsparlKNDCUNkCnj5mlP2n9ba6exxNeVgRw/Zga+zpwDstUACZk1jrb+wPCv8F9+84WF9+fFPe0VN/qjbUnkiDVbgNMoYtc6Ru0F08JcVnp9qzQ+nId5eBCqlB84PNRM/VXZJ9+tjCL6dwrHRPtnH1kJ9QGqmFh9/PG9TJlE37DYd8EPuDb3ixxQWVrnXHDePLSY= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: a6c94330-84ca-4ab7-e252-08db239f5371 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Mar 2023 08:45:41.1363 (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: Bxrl/grSJ97Cvd9QkwfZWQn8IcPnQ9GfNDbK+EcpRdHCrczAYrflZzY8JqsNztT7qMT3BOaAhrhzhW/tqFJ7jw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB4703 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-13_01,2023-03-10_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxscore=0 bulkscore=0 adultscore=0 mlxlogscore=999 malwarescore=0 spamscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2303130070 X-Proofpoint-GUID: XuDan-Ux_XKbNY9uY49hEaVuO7KOG6mD X-Proofpoint-ORIG-GUID: XuDan-Ux_XKbNY9uY49hEaVuO7KOG6mD 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 1463e54179bf..073fc02f9fed 100644 --- a/drivers/scsi/scsi_debug.c +++ b/drivers/scsi/scsi_debug.c @@ -7531,6 +7531,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);