From patchwork Mon Mar 13 09:31: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: 13172110 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 CC034C61DA4 for ; Mon, 13 Mar 2023 09:31:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230281AbjCMJbh (ORCPT ); Mon, 13 Mar 2023 05:31:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48522 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229633AbjCMJbf (ORCPT ); Mon, 13 Mar 2023 05:31:35 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3ED701E9F2; Mon, 13 Mar 2023 02:31:34 -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 32D01Vc3018846; Mon, 13 Mar 2023 09:31:31 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=LZS83sNwbvhPI+SCeTsK2vRWpk2baOVYj0r90KCeHSeyv/3wy6rLlKxvfx/+IcHKV6wT OwSQH8dvgKdt7gnroqv4DVGAn/CzxPrKY1hrby0UnBGaOnRs8UFtaK8LWlQOT3Y4BpZW rG932p/YCFXMUWaAwafRdtp08vVYaV9pNPaKWKGamfDVFa+lecpcDjVyvOwQXz2j2CrH ob/4tZqbTjUBxDjE45Ma3tuXqJOmavD559VeREj7704AIE1Iv4K3yf/tq1/sI2WO1VQf OokUgpUDWJ4irG1Rt4O/RsoYdkbz7sbO/5beVZ1uX/TtrOD+EkwRpmyqeegoiTATGfKk GQ== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3p8hhabas2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 13 Mar 2023 09:31:31 +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 32D846UY024963; Mon, 13 Mar 2023 09:31:30 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2168.outbound.protection.outlook.com [104.47.56.168]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3p8g34d2cr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 13 Mar 2023 09:31:30 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KJBIpDjEQOQdMtGeKs4XACohclAcERegnXB2icv0d6nJbowMXuVCjPnc6mwJeZZDDpQB7fA7ZLL30DVNHdu/ecQuiAe+p9aLBX+kEt6rbhR1aOCf58DVu/sr3EWzWWlN2IgSfFzTLwgI/J21yVGBKl0dqk9wr3vlsaDoVbDESUpaeuEWccsqYDySz0z7cq7vagvxwlWW3cUrmERvFQMkk6AI1q1HFEpZaiRFiXhYYsVj7gI8sP9O2JuAD9ktzBDJah3VRg56A5UpzkHjgTyGEHRsa9ZhY0FooSCdef08kWLSqfUami89tj2EDBPKjH2NzSGGxIYRC+7Mim7QlRE4Wg== 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=VYbnVrCSWmPIUXNHK9501SkD0IKmRxu3ZWn8rwwQdlLbgB+M2daH9Z0pG6woYKFJTVVVeBrpcp2AUqgeMoWazlL5WnfL50X4WEs7vS/8cp7ANcpMdya3LOv2Z/WElm1vTMtUvEYHINhmFmNhIjr5EbSQYeyfsjc75l+qB8qiavPk6zJQrBsBtgfuMIMdh9HCUzzCfI8+gagkDal9STy4DdJ08a5qAHjjjSdhnvP4jV1ZYMuyUniiObcN+JZQezGD8zwUnnnRThmHjoHrEJLCQuPO7eIrCZB5Ip78bOsWjn5H36hGhHHIF8XRK+00e38RzYLp6oFgImkFI8QASeceCA== 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=FT/GUHaU5s/rrUru7unCBIXAoRS4GFxfqO64Q6jcgINwtUvlIy16+4P/+jL0X2UWwEKX2t+NzvmVGm+gEmFyafAkW9GCAcJ7vdxXcQPzT8YSOG1vaqXW9do4E4KDHioAR2XYRzC7ikTP++cWJPtLzIrxfcBVLnWfQI81wtf2zUg= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by SN7PR10MB7048.namprd10.prod.outlook.com (2603:10b6:806:347::21) 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 09:31: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 09:31: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 RESEND v2 01/11] scsi: scsi_debug: Don't hold driver host struct pointer in host->hostdata[] Date: Mon, 13 Mar 2023 09:31:04 +0000 Message-Id: <20230313093114.1498305-2-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230313093114.1498305-1-john.g.garry@oracle.com> References: <20230313093114.1498305-1-john.g.garry@oracle.com> X-ClientProxiedBy: BL0PR03CA0022.namprd03.prod.outlook.com (2603:10b6:208:2d::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_|SN7PR10MB7048:EE_ X-MS-Office365-Filtering-Correlation-Id: 262f4bc2-f5e2-404b-a1c1-08db23a5b8fc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vsddBSLEr6eOfK+PdZNVydwxgfCwnSgOJQRV7hvGxfo6fNCpigxSUoo1RqQpWJG3/AF9ifKcU5bEKdjm5Tqssq+dZOJNpqtShIopaisTG1J6aL6JGrh6Bb5oDXcKrAa0p7AJSw8HmdAfJc9xrEPZdSUjb9p31e7w7EzuJ9NnqHDLPv3rM5PRb7i1Be656rmyJn7gwMFSb1NE+uOyRnl/oaZ3sxhXgdD2JeKgorvMfFHx5x3AxagNLhq4OUdFysybPL63HjPNac/2VYQTrR1W3gEOe5zEs7ViOxUghmKo0CWOXL0QPAKGS20+wV3lCMyexd6xOGKA6ngSuzqPK/hCvY9vWN9ey1qRqYnroW5+MVhqyXvY8+ZE3tBGBCIFpaYQfQ80nsArTAPPAg+YiGmStgUlm/5q0fteeI/Nuxs4DOvtIHTiEhEIJudKdYsYy90VfrJar6uk4mCRxkcYzdHo6q8HJi2U1hXvWgMmw183G13fTKiAFCP0HqoY3dBz9xSxbyV1wVby+hVdPX9o4HDyzQiRTuVYzV0A+bcGKXr3HdmpT8aN0XjLRMAKqFCynWrU1rWAqPBvO1OBENrPiBD/DrU1zmZosGLKb4VsUfOTkUSyUDy5xpfWq45yDYvbQ57tEaasnptFAvT4WSA/pAXdcA== 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)(39860400002)(346002)(396003)(136003)(376002)(366004)(451199018)(2616005)(186003)(6506007)(26005)(1076003)(6512007)(103116003)(6486002)(478600001)(83380400001)(6636002)(316002)(2906002)(41300700001)(8676002)(66476007)(66556008)(86362001)(4326008)(66946007)(8936002)(6666004)(107886003)(36756003)(5660300002)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ZhQCMw1jkV0GAGrYQXPHPqvCVQWapBLbvyZwu6XCR4WpF2k8XCNFvkrKUi66hAknNSIwvVDvaObV14W5OTrwbU+wCo266VoxVQUrdJWkqPmn6u29UjbJGnOZ90DcjLqLmDqRvh/ozpWGTc2AMn/fvapeY4U43E80EV2fOk9wdzViwIkfZyDUxErIoNQpCPsB9TwMm/6eIGAofcjSsEhdj4KT345spQVYteLbd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COhpCwbSkBy0n+wHVnS/YLtGUryrfLyja7UcJGW9NLt3N+NHdbxd6KKS8Nqbzny+SQiAdHNLEbqcpDuB8BFF8WOxBarwbKp3msBIA/bzStoKl4kLAs9sA+XcE63nvMIqMKOq64vSgbU5ZSlub7GZuWl4VGL303QvwlxiouQslMK8+55nH4M= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 262f4bc2-f5e2-404b-a1c1-08db23a5b8fc X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Mar 2023 09:31:28.4290 (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: ohw3GPsx+x0hV02TPFDdZpQF7ONfjefhl/J0VrIGogXrGCYN0SmetQ7T/Rskj0SqcnsDwdeB/0+RVO7TwCLQXg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR10MB7048 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_02,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-2303130077 X-Proofpoint-GUID: 6KA6UJZ3iXNF4nZSdRvNq4mA_KXbgeA4 X-Proofpoint-ORIG-GUID: 6KA6UJZ3iXNF4nZSdRvNq4mA_KXbgeA4 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 Acked-by: Douglas Gilbert --- 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 09:31: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: 13172111 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 48598C74A4B for ; Mon, 13 Mar 2023 09:31:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230303AbjCMJbk (ORCPT ); Mon, 13 Mar 2023 05:31:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48544 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229813AbjCMJbg (ORCPT ); Mon, 13 Mar 2023 05:31:36 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 03C291DB9B; Mon, 13 Mar 2023 02:31:34 -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 32D0798f001750; Mon, 13 Mar 2023 09:31: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=Wd5IiUB9427/YuSVzNlaLAu63BdeH1B1Bv0E296UMURnF1PpIrAdmqWk+rPqr4F04RDh LL1i/018+hye2kcIcbdAsD3E7MsXXIDCqvph1H7o+M9BiYQepakT5Br2EjhnM41iwDJD lYkzsCKhmNsemcjjxwmuA+BHx2ukaeHoALYGXg6gGcC1Ga1Dzs4Nb8Jw7canWFJmPd2P zFaIYeaD8hpV3qezKsxsisugDtm9TuQEynMKdgABbmVdIJ+JQ3PkYBeISGQ3wQzq99B/ voF2Z+fb1/Iywd8AjvAzM0H1NkctAcvxsneP5qAwLOVuff4r54ekis652hyqAiJRYppZ 4Q== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3p8ge2uc3h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 13 Mar 2023 09:31:31 +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 32D846UZ024963; Mon, 13 Mar 2023 09:31:31 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2168.outbound.protection.outlook.com [104.47.56.168]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3p8g34d2cr-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 13 Mar 2023 09:31:30 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nAZPsCc+XjHAuzlrr8gCmIk3V0LE6uovBR12zk70f/D22xnBp3f281Temnl46jsM99t6Y9AV9tb6m4vMgyNjEMOVyVEcQQ+2K9wkURKk1fP6DrTX8P5DbK+oULDODdFEd9/gBvg5hBPxzjHx9sd7ako1u0jZSclyW79gkrRXmu/Ko43KMhzYSoqWZva4ZwL8lv7joipMrnXONBXnorEdUBRUYy27M9J6XiG7b9OdK+5In1Z4iJmUNYUtM/biAvvFh3k3GYZgQS3a4UaYTs9TcqAUupcCAbV0FClwaDvQNnFZG/l0DMWYoGbkofoB8jJ0csY64OTwXRD7OsmHDgpaOA== 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=ShNjboTMxhxPyIbuQz3UG+o2vqJbg90P0ZOJl9iwDgjYUgT47qUa9A2QzeKeo8TykndIu0E/sVhRQddUB+Npfb6rni3fkM5uWn/NPyDpm3I7SoQJ6qWhkB25uRbA4j5FS1GTJlyeJTJYg/J3O8jCu0N59GaWyBduKDj2LvCfmM5JHWPD/kP9YRBGz+j60HYwwO52fWAFylTlQbqPmUYJVl7TuV5dzXJ246xMb20oHkKet8hcnoTI1pZWUA30qVKBv9MIxIZA+12Prt+aCrQyaQfC3yvasQjOBb93ohsGwEI6PreT+SKwXJN6vHek7+Lu220za6C/G3SDilwQgu9nzw== 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=KUnYzN7gHvpUkzbDMgqZmTBRnUQ8SVTleNTKmY2+FTkw1ZoBqnqtWtpoJYUapnjQ/8qaEPmhC+JOIf1s97nXHKUzWcv3P43sNYwOjsjpruz9XagHbTtGZOoaf9TkhIKHBX+ubbFzSPYN4bUNVg/ozVEqYUbfsg67LcgN+97SZiI= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by SN7PR10MB7048.namprd10.prod.outlook.com (2603:10b6:806:347::21) 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 09:31:29 +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 09:31:29 +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 RESEND v2 02/11] scsi: scsi_debug: Stop setting devip->sdbg_host twice Date: Mon, 13 Mar 2023 09:31:05 +0000 Message-Id: <20230313093114.1498305-3-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230313093114.1498305-1-john.g.garry@oracle.com> References: <20230313093114.1498305-1-john.g.garry@oracle.com> X-ClientProxiedBy: MN2PR19CA0070.namprd19.prod.outlook.com (2603:10b6:208:19b::47) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|SN7PR10MB7048:EE_ X-MS-Office365-Filtering-Correlation-Id: bf1925fd-5e8e-43bd-a798-08db23a5b9c4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bzQfC1bCusqZbYnAADQdoVx4x34HBlLtLeyM/9VC4szcN3qNzWJi29dUuUtUPArCxAMRBTvWNExmVvapc2jnfzPfpJJxPDwZRQEZ+nvsZMPjTAanKVFGl1luKfhN+Chkd6SdqrhL+/qkGPH3PVRXKScVIRPhk2Wj/L8zBa2xMO91zoEavPLf0P9YWpI486azL1IvSrvRmF0wiclGEwe5eDb0VrKp0IyvsDZtyyBJ9hhthGfQwdPDWoFaEd+dayxDHcMCDa66TdfdN9Am4w1CiatUIeM+EzdiH+i9HDS6OkEgYNDHAyIFu1T5c7RjWZOYoyAbgS5QjSB7012xYwH7jxbaVKgOKAzt4ekzmorTloEjFSJc2b/rjsLqzhYF7VwtKqUo3IPYrmvghPEJr/AnOG5l2yRsVJXVOaYzmQkAeUkkr29S++Pv9GvtqQq/Qyo7v76CwX69YS8N4FegF+wRkbFpSZwSw5cJLTRpWkKOnaREc2BUvxdTKlpP0b0xQ6ndjKJN74M8arMxnf9eryujCuuiLjEtxwieMdrwh0esLDPSaqny2w45tUMg8qBWpYQmuIBSee2aC7aY5BUN5141z8jPYarIMi5DrC2H3aJoUkofuWrHCnWAWM8+Y+cCzWTYgIaNlVcnP5uC/6e/gXeaHg== 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)(39860400002)(346002)(396003)(136003)(376002)(366004)(451199018)(2616005)(186003)(6506007)(26005)(1076003)(6512007)(103116003)(6486002)(478600001)(83380400001)(6636002)(316002)(2906002)(41300700001)(8676002)(66476007)(66556008)(86362001)(4326008)(66946007)(8936002)(6666004)(107886003)(36756003)(5660300002)(38100700002)(4744005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: oRE+eSNNHT5pWn9g6Jkq1X4k4/FyMXgi9vlFJSdY+aqTVBUASQWFOVHK93SgtTYESZUSgIeCh7TnrDesFoeCN3PfbBtUPRg7XCeRKje2fnGm4mB9z2C1hlGvGqj9vgxrfxrvFsfeCQfntEXtiCl6wh7Pdqbsni/WjQSkuLJoxoIxauI2OFwmojENzkK1hoJNlCTrDk+BYKu6Q+KJht3FpYNTFCNa6whiYYawxqbn90fWWN5eYkChl5rSVTAsFQA9oF7irkO+fqeQKUmgAJM8VJI/suRCwIXBfJOHz+O+zIM6Ypm1TMfowTFIIZq9+WKmiZkqqhLcQC2NmbUfv4LQiW51k4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BQ3vLRA48LOZ+QGjhRp0TEJdNtSDXimrjeuwXr1TwBra4xU6kU0BTaHTRiAFztLRHaF/TKmu8laK+SuP6bL88SOAvXBB18y1TE2jO+wwM1qDw0BDCSnoRgC6ZxVAvYY9bbH7vw4tm1ZZHwU5MOQArWm9el1k4zDZVhh2B+CYSDZ24Ay8R8a+Qe6DJFURotLWZDyV7TQ== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: TOVpu2EkCU9JEIWQGDFK+hkh3FDEykrEPesDHnZBnYZs+0APecRCeUJ93ODoPIVKuz3n4ZrUVyP9870wllb+ELAawVPdmiGDdaAfztAUdMy+okGFdYnJDvKhrnxI2+dQuCKGoYpE4qNz7tvHqQsKj0WCzX4yLOW783lC570+GKg9nX+Kul45aR8NK7RgEnLhT4TQoKDZzYdLfwhOWMh8+tZ0FXpmXIkKjqzz09KsKpH9n51HqDljsv0Twmk3AjdwK4MehQVF6rs1zxnURlPal/pDWpkWQTq5vz+ZvRARioWzLUpnVFSeJECpHN9L+IecSM7ytelUj9q2s17+LYQbCFXcNPgDdBc9uWfNWf7xfb44L+GMggSgmqnkqM5yLk5xwuyh1XVOV3jebFIoxx1O18wRQbyIs/lVnmTmgYS6DPkpvpHWVCffBSophPTF/Na6kD+nDYAY0c/8bX1wL/GTeevQgaNL1on4bgR7wuKmgLCj7JRBRMASMHX89LyosGl596Vx37PlO+vUvEKY66b2uyShPx5Z4ocd86WFSSRiOwzvVaGae3dS8t2uOk02ty6GfuKWP760+cV6VStDmgcR0Is4EBJ2K0pNN431rhB9oDkDx1OeGuUK93/nkVEh3SmC76Un52PpB8gAeQOaKROmQjDEGsHhuz11dbeQOkTWeIit1EJMocJeQ2mjNIjGweSuXYBI2y/kx5QS7Jd1X5hgz8QE9EbngDpd6FdBV/uSTGG9rpiqogMjQU7LOza+uyovN++PCi98okitqGtb1i09sNQFXeY/yY1b9Mot0pmXGcOkFhA+5ePYrq00rDhR9tTHkIR2M44urlSrDMxAcJp6ZTcmTgqpQ6zPypqy+djP7pc= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: bf1925fd-5e8e-43bd-a798-08db23a5b9c4 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Mar 2023 09:31:29.7087 (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: L57DM6P8t3a9CZcDUdP4L6MWcDghrM+xDwKxltEKF16Yz2qzG7UUC3yws5mBnQuYxOZFJoNp9pOX+LPeIjTbYQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR10MB7048 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_02,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-2303130077 X-Proofpoint-GUID: XpNiwspGpqbG4txIujBCDLmCre3bMs4b X-Proofpoint-ORIG-GUID: XpNiwspGpqbG4txIujBCDLmCre3bMs4b 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 09:31:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 13172113 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 73C31C6FD19 for ; Mon, 13 Mar 2023 09:31:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230483AbjCMJbo (ORCPT ); Mon, 13 Mar 2023 05:31:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48570 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230311AbjCMJbi (ORCPT ); Mon, 13 Mar 2023 05:31:38 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C032E1EFEC; Mon, 13 Mar 2023 02:31:37 -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 32D105p7014367; Mon, 13 Mar 2023 09:31: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=Ls6Eo1X9j6h+D+hYtYNKhPBOnQyjqpjONeX+CFfSem4=; b=XrzkAfQMJltlga3tgWE+C9rnP4E5VHrSdOR01P1BxB8S0tkhmHFQup4UC8VaAe4O2juU 5Jdmonxj7LohozBKiwvyZPBp0fay7ZMBF5+YH2W4mVxusPSsayh/m/nJsfNEUTIBIfJ4 3h2ZDTJWFNcg9/kZ1cX2RvLqAbS639c5twUrev5Th7Nwvzkr+58ITQxeY+eTVMQP+kNs rwj0WZlPIvfVP6SCgAuJskI6fgb/4V0JTEQQ7EjfsjI0dA3eJQ1e3hpx0lwvNDBqD+gu t2dW1oTzAMSn94uUt5ZAX6DotQK8IUow5s8YAhlr+1ii33h0aO6TcSPfOIy5UOL2ENFQ 6w== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3p8g2dkc9j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 13 Mar 2023 09:31:34 +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 32D9TO78025159; Mon, 13 Mar 2023 09:31:33 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2169.outbound.protection.outlook.com [104.47.56.169]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3p8g34d2e9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 13 Mar 2023 09:31:33 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hO5buSSP8fmR429oSb2GSW2Uf6OgQ8JQ1Q7hxUEFJSIFnTDlNOYjggObblLPT7EfUoixcYzTBRAkuPpInsqLK88A53oFgHMVYpo5WLV/EQNfngsGo4E7yohqFN+cX/uLHQZilfRzY3hAe3Woyc+0X2WZ+9TkHNgaaDOi1S+bdqZfJGFRg+d6VxjMdEH6dPnIbDhEP4meXV+ylTBaRATrcrWqWS+jxWXnVJh6kZjmAzEALnDMcU6wcwNzh1xJ5D6sS9jjhOounRSfBmP0NZuixjsNvR8kHGNHU+0Qojhlopno2EN0NaFruAA0lNg0LT7Iiagfueic24AdQyzX4v2/7w== 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=ZACXNghWlsWvEAzGNQIsopN7O2RlWry++hk3KrF2KYzoJDtykI7bDA59K96AB5Uk75VctXB5K+zehOJa2rQHtj+sOfZsAqPlnGFFrQhVoTXrWkpXn/PGigf1AfH69+M+3zHTQMtOxli7XMqwI6KybrvXjQoTDUBoBinfl2yf4GDqWpCEEU6bOJAxrdsIgmB0IukV0400IQuqlkWpxuBN4Wd3c7aZyXbWNB6ahojsHKwAHrP3Nn7sk9Temly4zjd/xdOUkzQUdsSSQ++BhIrl/9HH3qJXA5L7INM94upH/nGjgCUbvcX8S58Ul3VBta3bDNPx1funffUkdPWOOULZ4Q== 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=NjU2RclpRY9ZicHj0ZYxBUDSfCHqTRg5yGxe8kbVMk78AYGJ8uuaJZW4bRpttcYUEq6Z664flhmJ4FL936Fhm5xF5FXdvB2l5TNls/1GM2vyB99iLbsH7ueslox0tKEjDmBXNP9pfhXNYDJI7GunDBqZDJghfEzw7YoQj/H7ELk= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by SN7PR10MB7048.namprd10.prod.outlook.com (2603:10b6:806:347::21) 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 09:31: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 09:31: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 RESEND v2 03/11] scsi: scsi_debug: Drop scsi_debug_abort() NULL pointer checks Date: Mon, 13 Mar 2023 09:31:06 +0000 Message-Id: <20230313093114.1498305-4-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230313093114.1498305-1-john.g.garry@oracle.com> References: <20230313093114.1498305-1-john.g.garry@oracle.com> X-ClientProxiedBy: BL1PR13CA0373.namprd13.prod.outlook.com (2603:10b6:208:2c0::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_|SN7PR10MB7048:EE_ X-MS-Office365-Filtering-Correlation-Id: 6435751c-812b-440b-ce19-08db23a5badd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yM+/Tgo5uELOm45O9p0X1YxlxHnUOoNmKdWfY/Mt01K8GiZjZFgG6BxBkWlEKdnXyBkQWSwiPMQT9e7qNFZjzfBvmwPMvbaqReEr4yCWGnrL6e8vZ20OHl9f3DI4TH2/qDfvrhqSXKISPe5NH56MgKq9JDvCgzndUV/zPlJpYKbYnkHMK+fWQolRk6ZzacMN/kEjHui6nkxZzZb8mCZb1HiCbt08edPhnUO/LVpWrU8W14NWRNSkSTP1FUoVO8ADuu/krgmW1G4L4L6i49LzO/Y/ADnYcns0ZC3qbTnChPJPl/72oOqR5AqWUYK6rHv2U8cbaJhGUspa50Wz1K9JJxY1c6eiJijAZR7NUo9EmKHeU+ARzr0fH3E9gOFUXOMMTOtFaGyOHXJXNM3WEUtR7LQOLx8cbwvBnuUYRhoUyeCCXLeVbqYPl+8gSIGJVb5Eza9G8bcy5+ME5gyCK29J+R+WEYJJyqiRzvS4BwE0jV/sfb2vNqKBtwXBi6HKI9r4ZEecN1+xA7QX5Ki1nadH9zep/+iD8iBHh14s/y40L8y3vNsucwH9nnc0O65MDv2pOpGV5ab/VHTGcdi0n64/dSBONsadP91sWhwie18pcRTPKUcER1vZcPBxOYRfHi+9Mvhx3cS9U/qKxDPRIiAA7Q== 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)(39860400002)(346002)(396003)(136003)(376002)(366004)(451199018)(2616005)(186003)(6506007)(26005)(1076003)(6512007)(103116003)(6486002)(478600001)(83380400001)(6636002)(316002)(2906002)(41300700001)(8676002)(66476007)(66556008)(86362001)(4326008)(66946007)(8936002)(6666004)(107886003)(36756003)(5660300002)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-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Gt1qTm1UFx78yOjdPOBXfJRQID8DDYLJH9vjwzSuMBqqQU+gDHgDpNHeitF0DmDQPbmNYAzogal+F23b7i/Gds6rfGdYWo6uGr8mZzMIdhgihxlCA/yISvR/r7JfPU84HNY+f7OJ65XG9g2Pz+BBO+ctFMpbFCOFS+nEMUwAQ24zxRV72iE1rrY98tBo1AEXUZd2BemNhBYu0qK6KJ5ckXZnouU4CR+DodFGvJVNw084jbfcf3/rtjGI0jdS7RBmc+vCQzliA44JfXbUvaNPIyfxE416GJXe80vALmWBRtX+CQLb7lSrAn1iyjFspxNw428AVSaqpF/fd4ll81EZRwxDtn8jUg3AvIw/yLXhmGZ5NCveuRwKyaVbVTj2JsdLTkeaKHl4mglPxnrt72gaX10Q4e2A5reSVvahuxNKN7O5TQJrn5g= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6435751c-812b-440b-ce19-08db23a5badd X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Mar 2023 09:31:31.5826 (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: c02aMqbPmCaBdn8bb6zdFs4uBdQfupKaiXWPOxZ0EG0LkcEsmw6H0xFXqWSu5HCiCp7XgpmXbGzD/hSwFOF5tw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR10MB7048 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_02,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-2303130077 X-Proofpoint-GUID: zt0XdEMowFbyx7_w2JKmwrin3L_f3gBX X-Proofpoint-ORIG-GUID: zt0XdEMowFbyx7_w2JKmwrin3L_f3gBX 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 09:31:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 13172114 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 9115EC61DA4 for ; Mon, 13 Mar 2023 09:31:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230394AbjCMJbr (ORCPT ); Mon, 13 Mar 2023 05:31:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48710 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230268AbjCMJbl (ORCPT ); Mon, 13 Mar 2023 05:31:41 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 38AF121299; Mon, 13 Mar 2023 02:31:40 -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 32CN629d032552; Mon, 13 Mar 2023 09:31:35 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=IbyVeR0/63bm2pYOe6w9O8kXzCCXlF+qrkDUcjqAfQcs0BWqgu6hOorCxupJ0XzS2V+9 suAvO3qZjNz34qoxcf2i74xcsFXcWMPQJn+BTwMr30zSQnXLdeV98q2W3ypuFXvd5k8q Z7y+2PNmWALBpZc08h5aWTS2rS8FK+H0p/EM4/7JWmhx3qIiA9GZfizneU8tnl3eQsGX EbAstiCDbi6YTiNTnzBzQX/bO8SLeUJLuzX7p+evywBGtavFtnIAt6PI6vVwTcTo1AUX Ijo1xxm7Z2krCjnZQsYFz7fJ/bsU34q/bmCBj7Bkj3XV3qejR8ejVAfLydhHOlT3aGO6 PQ== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3p8j6u3b65-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 13 Mar 2023 09:31:35 +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 32D83WMr008260; Mon, 13 Mar 2023 09:31:34 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2174.outbound.protection.outlook.com [104.47.56.174]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3p8g34cjn0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 13 Mar 2023 09:31:34 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jB9vIJlVgi48P2dlnkYWGpN0Cv7uYUfeNOP3SpKPM1+8QDx/t71zfh6zuE96b8wqqoOSKv4i63LJpe7RcfQb5LMaSVvGIMAefDdlfgmCI+aHNTFgLD5lEYuMapQ5K6L63N4D47Bc1L2v/Lw4I401PSg9mChAagqwwI+9X/Uoww8AAZi7LGjDYSPWIJ8AEiopkDDz/GUNCTIV1tTZE0Vgl8sN9oWA9FekN2BFeCAfSdruqE7c2w2b2tjaKylanycQ/kjG+2GiEPvsWdrBL6QguzKhLuhdTzS37AROoSC6vGnQ3RDJp4pbvMZOTsqPDTkUVXI8WyRRm97nWI8PaA5LCw== 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=kkm+mne92kVeFI+8VKIQkPwDemGdOBj2YxurQooIe2SvGUsehteafQxNRfHNbZk5CJ312n+df2kY9Hmd45FS0HR2jybnerNzlPFRdr6DW7xOLVITwmNofmuZfmT03LWVkRARDyFcdFrX5+hE0dg/4trn0rdNQPrnRLnzJMNa776SaZ9XVnhR7pGSv7t4Rx9fE6G8dk8NC6stntytehbUcP1KHqk0swOtG/nHA2lpfkOh7ej4eTEv/oTFNEKAknAPvTOGTjyWG1NJKMNKmrl2DpkRb37VaWn92hlbJP98Nc3t9as1dgOp9AeSyuXqkfHZLiuUoelfmfmSWd3CKUIZmw== 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=kvIRV4jjZUXXGMgS6Bs6PsOfSG1OpPOIOmlRgVDBNy3aOjgfm1LxKvjyTiaxCzWl3PHVWHW2dy2BpGhU0USaRjfv7uTIFvo3Jc/Tqx93Ppt4OHm63DgFH/iG2PZeedYZHAcOUWDloHSPoNZRNyU6BkivaDLn7qp52PVldmz/JYg= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by SN7PR10MB7048.namprd10.prod.outlook.com (2603:10b6:806:347::21) 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 09:31: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 09:31: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 RESEND v2 04/11] scsi: scsi_debug: Drop scsi_debug_device_reset() NULL pointer checks Date: Mon, 13 Mar 2023 09:31:07 +0000 Message-Id: <20230313093114.1498305-5-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230313093114.1498305-1-john.g.garry@oracle.com> References: <20230313093114.1498305-1-john.g.garry@oracle.com> X-ClientProxiedBy: BL1PR13CA0367.namprd13.prod.outlook.com (2603:10b6:208:2c0::12) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|SN7PR10MB7048:EE_ X-MS-Office365-Filtering-Correlation-Id: 860caf8c-dd7e-44ac-c15d-08db23a5bbaf X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YKLTMc0Ll/q0pnjIY4Qi70Qn9j9c/7PxtdaPwDasTEUtV6r+i0fO7d/omN6bIZzmJybw2CRbRvz10Uv5lvp8j150wcIDUxTNHpMb18zxxC6DI61Svfa0nM3Cua7Z/S7JNDpOZ9uKngu+Sey8o5GYct/+16dvMtKFkvYnTUEsuvlVKpcHiCb9XQmSpcL1GpHqMvgpUeAsLhlKSYB8D/blQ3Tsa1yCjapLzt3gENdCKWQI0XtrDgVA2j/HAMsFDhAq+WtQespTcko2uWzsheBYbfFKybC4nXjjR4GWhJYVtHjcd061N8gLoNCjgAzS9XnnHO/feAnnv05Ajr98Va7kvdv3ZDyRKY7oJh0PlkyZKlmtxUGMhcd1zTvtfyEcngoXiZjVGpOqebrR52qF4qjG5MXNbhG9+411lbQ574Uf97MWbERVolJVFgbfZQo0nUAyC2PSIP9lgZbTwKXrNV0PC4TwB7zotBXtmJxCe625A+qTIQT1HKZ2b5GQkkG/TvI4ydb+ykytYcLZscaVeZCizhtY0MWxyjijmRIv4NEzAfx8hQKDCbLu1eqd7S55JiXkjIOOZx6AutXMurKCMJtC3qlpwT3eGDktN/3XT0QbYwqrkpdHwUEcQ84K04veNcrdUKae0JKIWTKjk7OChV6QIQ== 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)(39860400002)(346002)(396003)(136003)(376002)(366004)(451199018)(2616005)(186003)(6506007)(26005)(1076003)(6512007)(103116003)(6486002)(478600001)(83380400001)(6636002)(316002)(2906002)(41300700001)(8676002)(66476007)(66556008)(86362001)(4326008)(66946007)(8936002)(6666004)(107886003)(36756003)(5660300002)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: YxbTW3RSklOSy5eLyhiaeFehvi1DmJ9xknBImm2grnX6I1AQtyW0IYcj+AOeRWC6Y8ufsNQ8CKuqOqZvtwY3QkqP9aiAJ+SyGQGG1BP2pppfxCqNON2TdOC82xhwFvOPF+pIGQ/hgJD7WHNNYxKl8Kq8Aw+ky9VTUQEEUOJd509bJYy73oT6kBfFSQ0jIYQ2EUvDZcDHGGBjEkhqKZqJzs2n/JGNJ5CgEP8QTxA4wSfFgoIpAfBEqugpBTfJUpdfVu/nFoVXHVhqdlh9JdTyVz8Y+i/pbTAJp0ZfTTVyaNqHhIA++MmVNqA68st3IksfIqhuDpvAzehInhjxaSUU8aU5vqhj0UoORPtaYH/JYJbJ9ERIDeXf93x0v3zvG6X3tD47g3Rr7ZDUkqsLGw3YJoPRcqMG3dFeGTQWlZi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uCxbvI2SRtw= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 860caf8c-dd7e-44ac-c15d-08db23a5bbaf X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Mar 2023 09:31:32.9512 (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: mUakb+9sdwsoZeE3VMLdBJm0A50ZnJ9GYPFh4Yp0mP5Ta4xUlJu9oTLtOJ0jxna8t5/i8sfr43jRzeolu+aOwg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR10MB7048 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_02,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-2303130077 X-Proofpoint-GUID: pVT8DSAzC1KW-IQeEC58lBfvoyH6JoiH X-Proofpoint-ORIG-GUID: pVT8DSAzC1KW-IQeEC58lBfvoyH6JoiH 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 09:31:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 13172115 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 E13E2C6FD19 for ; Mon, 13 Mar 2023 09:32:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231162AbjCMJcZ (ORCPT ); Mon, 13 Mar 2023 05:32:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230311AbjCMJby (ORCPT ); Mon, 13 Mar 2023 05:31:54 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 07DB3498B9; Mon, 13 Mar 2023 02:31:44 -0700 (PDT) Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 32CMFvgG003364; Mon, 13 Mar 2023 09:31:41 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=Bk+ykmbt/fD8KG2oeZ9lbrQarrTPvfVtiPPgu4VuZeRVXlfU3lAjP5FRiVD2tWo0PV1h xmCWJZ04eQ7ANkCufrP2YYJP4TsJEJPiYKGoOIFqGqYr0JEWsoW5ReVoJPBnj53+vPYB JQiHqT9RiqSM8rmPJC/Hf3xP1jjlT2mooZymBK1aGjb1BmG0L12oaLOD9lLjU+67u5Ew F9IqXNda3lOWgiqSRrklf1/izfqyEg+SLv8Z5ye68Tme7PTcoCSv5+k2omZdKyd5WVnX 9hc1J2lqpN6uDlRMPciB3YeCiJd4eZiYTV8L0Wgkq0WPXXFz5MSqGs+pDPjCBVoz+ShF 2w== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3p8gjbbdf7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 13 Mar 2023 09:31:40 +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 32D7l0H7025093; Mon, 13 Mar 2023 09:31:40 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2172.outbound.protection.outlook.com [104.47.56.172]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3p8g34d2hh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 13 Mar 2023 09:31:40 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=M+M0QPphzzVy5DlWg9FLD1dektY48uUVuwgrOz3yUvtgROg7yPK7h1bgnV83l46Et8oeNG8+3CmFT4kH8vL9L/zBrbsPb8+/F7kIX/FWzdqyZudv8vBKYowccNQj5QSJ57JjQbeh6SMMRAHYq7JBI2pSNggGmel7fPbLCuJ0QbU82G0RNUPxlgrU0wN2eQpVStvzWxy4HKMmJGf07hqFfxdaMHo4KX1i5q+GjFAVQPpf1uUUkdkDOx41JvnrShuPF5NKfnBIBT1huleZPSvvftkwNn5kkWxEnl0giAIUjlrCL2PG8l+U3fKlLc4BmmZdB3uQZ0FeYC+gtoPZl4CA+A== 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=FxvFkgKuzM8Hdrh0RgDCpw+A1tm703925wCkMIONj2yK0sFkTjslrOVRqyB086yoEM232e5hNDH4XYHU5Qe471ifxhnMibBqoy/kYHxiV5AP51SbrXGYn5IJ6EAC1lod1xLllw0T1J+M0roqaKKun+FqBT9dCGiZ5nYvUdtPY08XhjQtgsSQp5tlC5QbnCChIk0pXSD8OnS7d7Cj6Ea5nToHN81xS4qJViWWoABe57HK03tmi227eU9gb5gOV6FePCBoOOWpnguRofKtnSD+oo8daMMIBbe2pZU+xSJc0HaAP7eu1H+TEaTkuR4syetVym8d8wZdgey63mDJ5AXMQA== 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=H6iJHM2RX1yI62W0zesdWg/oRlN0CoC/betKzQrGXwdFqSEIwwjTMBeEvPE/45oD/5uKJzRTdesXa6AM+ke10LV/hy5UXLA6KN4iUnAnfixWO2ot1D9ApIsQMAj94fWiPmoXy5IOzHAD86qHqrx8xDQYJ0GvjQ0ZPHkKPGjWL50= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by SN7PR10MB7048.namprd10.prod.outlook.com (2603:10b6:806:347::21) 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 09:31: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 09:31: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 RESEND v2 05/11] scsi: scsi_debug: Drop scsi_debug_target_reset() NULL pointer checks Date: Mon, 13 Mar 2023 09:31:08 +0000 Message-Id: <20230313093114.1498305-6-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230313093114.1498305-1-john.g.garry@oracle.com> References: <20230313093114.1498305-1-john.g.garry@oracle.com> X-ClientProxiedBy: LO6P123CA0005.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:338::10) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|SN7PR10MB7048:EE_ X-MS-Office365-Filtering-Correlation-Id: 5d97eb86-3b83-4b81-cfe6-08db23a5becf X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: abwqERINt/rRyUuU/KuFxJL4cMf/tlIFLe0O62ts5cWbylPQ/5wyLk3yyhp/DnAQgrbbyXA+T17mPRMwXQDrKxCz0Vh5Viy6bdNUDlCAIjub2bUrWIUvuHyZTIJ3Ro11LMv3PY1aJ+bTkFTOo7eSwDzmivHRoxgx/1P5D8BHEW7IBS13g/sf1EKWIzjvzs36N/90ErewwB4GpgcM/weQj5NwqBI7qYMrqDUpoKjBeQQDx6qzOi77+Weue4xCDu6DXv75YmJlAaRi7Uu5N70Zwfao03SnAH2jGlpX+BTsuwaWfw/chdjr2Rgj8qlMvb2a38QJ1kdjIDgzhVM8gmbg2tX1XpfSETKnsSsRio/rcA0n5YcIsJp3v6xkMo2u2ADM5OKnHOPjDbtKrAZooS5RKURZziZBjPgPyFxlhc/fU+a1bmMPL+BpGgZoq22Yf07Y+zxE+CHpjGlDJM43xIhEONgDr77Jl1KM/0Eo78c1Hm/rbTrixMNao/S5u9rgAucP9ahSTISk3f8IttupkPUdjVV9YqBkkTuLu2OL1lTgj01Ify3lWYC9YFdOiiuPclP5e8reCYGoGLu+cIWD2v2cAjZ33yMKiduvuMjQ7KiU9bIPW+1Cesjmh+yzREexvHfp0nwMdCj7gasdh4xqY/840Q== 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)(39860400002)(346002)(396003)(136003)(376002)(366004)(451199018)(2616005)(186003)(6506007)(26005)(1076003)(6512007)(103116003)(6486002)(478600001)(83380400001)(6636002)(316002)(2906002)(41300700001)(8676002)(66476007)(66556008)(86362001)(4326008)(66946007)(8936002)(6666004)(107886003)(36756003)(5660300002)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 6ZuEquCTA0j6GJflog5viVeQB8YPl+Z5j6Lj/95sSD280LwKHT40MkSn4MSHZcK09sfZh4SFLahKPFq9I8UurP90A7r/wYs3+OubgP3XUYTFRXzN6K1mxDXzRWfg7dtuDdQ4gQNFOJQ6mddl6TeYi+hPpEaBbP9ve82iQbS4Lzx3BmLGLS0Pw83eXNImnUW4CNO6zh1Ag9lDTSvenD7SFLUbmsoLfbQFQ71kAU19KIk0/4vvVeCAiz84CskSC5m870EZFjQ/XMXpC2QCppTJpaacO/jd2+Pq5iiYnj1tsebDPGV3oL2Hlq1LfktPX1O754EJl+MiINm/hwIx0Q84ztXCJOVlhQijzgNxxQlyfa1nbGEA3t6Q/2REH1Oyz9kh9vcjK3wY4CDrlMLmBuG9eH2cgzQ8jpFxnrpi7aYRjyM9wPlA778mnjsYWiAsRHgRRpkWOWXKgzjD7wdIyi+3c8nIctOsHPKlaEAQzGVbVf8SjoQDn+FZFEAE4tF+o5zngo2jqb8qLi96E7HWbuKnZ1XJQcU16DEpk7mcH4XRzQBoV/3/NokYQxweqcz4/Ql04VDjGhhI9baZk9zZvoElb2z7hWKd6NsxxFHYKMhhq4zGG2Qp3vbrtz6R9WtCUMFaSxSmfrnLNM41vWkCfPERRNWne7Ro7rsAKmH8a+CgWsTEdJpPk+4mVGQMNWOT2Y8z4ZyMyjovsCdP2vqggQfR4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5fcoBFyr/j1hyKf8YkNf/waAa6Ln5ndbUDVZSsC1ftF2TIm9LuMgC/xUwXaVYBHIhrjvHhAi6DuGbavMYd97K2ri25EKs3BwfU+FQlh9BK8Ad6aq1vInzBm0SdDehftFmzkTAAAo4sicfr92973y9lwt3WHaNQJS86uju/U6wRJea2JMzXKCxhDPG0KZV5huoUlY5gPkmXlI6CwPf3PsEjFmbdflPd8HJ/MzGLuNhz6NUYM3Zq1pJ462jVZ5HxfQI9jobBPhjY/nviYtgXbH45aYDdbHQSNWC8jQkFPTcrIFyTRDM6z+Vi3ev4f3yFVFr+BySjCZZ1bd2matl6ZFWQXDLvq2jYYqr2QivWhuF0/3UQR9CyTNGZExy9VvwKDD9FKH0Ml+/JYeZGygZZSldpqmo4RMA48ect1vxmQLZUO3bJTLY5b9nE1N7kYniIUf6eHho4m1CXdoNXfys9bU+AtI08GTG6wyjKV5NEJhNDZm6UB//R8KOyB1u8mO+m/I+5gIjPmOo2YeBBdOZlsFm/zZyTLwq1pm4TV5DpYFvvb1wXTbwYqJEusimNai3mFyNWN7hLacgiP9FzRWyAmjVETk6oZQ2WeydybcAMVmPhDm5N/1xUeYgsdZa89MutNLWfdYiiUfUYagFHOqEbM60ZTNToxnQRqcEn9k1HFF2N7na335SPmZWy7Rt/b0MSc8hlBB674+XOcKKKx8RD3Gp1FowWprBZNcAWAUeUoYHqT593KoL9uSzssEXxSZEsOfNELEJS8S1BT5Y= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5d97eb86-3b83-4b81-cfe6-08db23a5becf X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Mar 2023 09:31:38.2641 (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: K32TcK0+JUtJhwYux6BOsZtQeLalHNWhoH1b2/gzw8RCOs/AAJevLpPupEltHZHyOscTejl+4g7UsQ7YgSSMeA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR10MB7048 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_02,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-2303130077 X-Proofpoint-ORIG-GUID: B6paqOCrczLEfvQCI1X8yFgYJBfuEPMB X-Proofpoint-GUID: B6paqOCrczLEfvQCI1X8yFgYJBfuEPMB 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 09:31:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 13172116 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 3E5E1C6FD19 for ; Mon, 13 Mar 2023 09:32:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231301AbjCMJcr (ORCPT ); Mon, 13 Mar 2023 05:32:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229934AbjCMJcf (ORCPT ); Mon, 13 Mar 2023 05:32:35 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 124F12CFC3; Mon, 13 Mar 2023 02:31:49 -0700 (PDT) Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 32CMFvgH003364; Mon, 13 Mar 2023 09:31:47 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=3twTDmQzcn3PpUPNMcEt26F6nLlJpy9fVUXokJnpMaI=; b=wBHo6ZrYomxda+Xv7puzR3KPhi+syECKq1kMnIfgwb5qyrx12YMcheqER3v+Lsblg3gj ApP6TdNLMN6MQaRcMVJoA5b1PcSwKvBzuOOSC0dNMgMjcawIe/OByzfu2zzLIXHlhxkS 3hjnEn7u9zdEOIy9gggHTf/+PkA1HmI7xNTKbaOZ1iX3SxcdWpXNMiFRm4Ny50TKyvqc QxwiJWxVIhB9yaKKNXxBpRdk33fku5A8+Ctc1dDupR7qL2A+YUm9JzDiNvZ4RzkiHaBd yZ6Yd+/FNdZzbY/XtKFRG2mAwxlRyzSbV5pmuFR3OQSUQuUICW7t2CAE1bDDfsm/6z+8 6w== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3p8gjbbdfa-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 13 Mar 2023 09:31:47 +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 32D81psB015281; Mon, 13 Mar 2023 09:31:45 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2169.outbound.protection.outlook.com [104.47.56.169]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3p8g34w4tt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 13 Mar 2023 09:31:45 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QVBFR2jfISu+x61OhbapHHNniyZgHKrWwiv+7UZ0Lnaaqgo8XVCrnGofDbiApMNxpsckwpHdW37/YgxTDd+pqHyMDS53nhAd4HrVKOeCo4rgVehyKDDN7jDnx05pMnea7LrIpSNHhfDSAoO6vLVaz3Cgh9GtChY984O/bs3LA45UkZHPeTk8qXmTUlw/WAQT2H2ymJ9iJlsuIJrHueMDpKTQAvmpK+ennp5O9tvY5MslOSlQ/E13lvSXfMd1qyyQqA/Gc6Y+vXfWOMtaGpfDUQCFxTsUQDHfRmLB4trX1nMyxHS4O4tuFy1r+OgPOc/mYHBYjRvG5B3RHhWDq4b0CQ== 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=PPJqvtnBjg5OGKK8xOEHURmhTzLPy3b922mmgLbvLB1EauRUQs9WKUP6CQLE1LRdJsCAUwUh3oGzJL3yrbErZ1PBO2s53MmYWzFUH3L9PO3ZzBfWLkaW2GQDiiWdxByf1uqNwfTLoCzBl8cYOZB9LCh+Aaiiy28C9yQDs7hZAKKA9OxGmZz36BrRfNtEE+3WDXVLj4GW5Gi92GBTsGOXkeQ0z6fiPsz9ttMidsjF3SbDO1C/0QHY6P3hVase9Vkh6ENbYnRIWtztPdzUEXUm1RhIIJZ4dNj5ay/Do6b2X5S3XfpDE9QWLSp2PHJKFNptAx8xipFtFeAYxL1cMEwlkw== 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=sM2SDmlCBLuN2FlIzQmV471gxxs3JyvH7/UxQnCgDnxCdKChPyetG071owL45pDx0C++m7nTA1a5QGvOcmDvCpoUZvHOVVAxnOCdyy9koRdQW/BwwVGJ2uZJ4xtdOqbi2yqLJJAh3708ld1dLv2hustbuCoJfkjgOg+Wh/3hoWM= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by SN7PR10MB7048.namprd10.prod.outlook.com (2603:10b6:806:347::21) 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 09:31:43 +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 09:31:42 +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 RESEND v2 06/11] scsi: scsi_debug: Drop scsi_debug_bus_reset() NULL pointer checks Date: Mon, 13 Mar 2023 09:31:09 +0000 Message-Id: <20230313093114.1498305-7-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230313093114.1498305-1-john.g.garry@oracle.com> References: <20230313093114.1498305-1-john.g.garry@oracle.com> X-ClientProxiedBy: LO4P123CA0528.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:2c5::10) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|SN7PR10MB7048:EE_ X-MS-Office365-Filtering-Correlation-Id: 4c6a2bef-ec0c-4e9a-2bd4-08db23a5c18b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4lWp6J9h2mSRSfvnKEf7T2oxIpr1YYfcDaf/DbAf+DOxl7Yo6kGSBZkf+olhc2nrVcJ6QiboJPR+F83rST2wvmoxhMauAqLEmOG+mj8vjXJLpACf3Kp2YrLFBYRB9uUvx5YVb5exbARm86ICTuxWANAkHG0x7yggk4Jl07I777z3YQHk71q4o0sETud1OxkUskS3eVE8ULZ5EOKX9iPAt+swI90U3fsJNNp14tmtZe13vaAieCQ/2DxFTDYBOzjsgkYDlt6I4jsaX1i3+1PWcH5umrSnZes+pHk8pOIC6VBIVdjoF3FIB/76qAZC+eZXZJmDS/qg3gFbwenHaOsuHFZUmnbtx8/ugziDpgcpyh4ICp/aSvTDYW+sGKbZSDahaF2zcr8apfI2FysYNh6jgIiUWTTSydIJZb+twdoAXwa2PlL6ZDT3Vk0Zme9r3cHYTCRaqF4giaTo9J2yzuipBnpvV362bhf1RuzJ6mhz6UdjsX2n0Dnc5ax6LiDw6Sy4YmwaTpuzB0mJI7rjFfbXR/4LfZ2Rx6qPdBrpxrUKsbQU/c2DfbcdmZOgpD3HarN1aUqx1vu1UQml35uHwZKaNG5vpGqenErAeSDIXIrM3e0Xsxdz5VaY5GoKomvrt4Skjq/EINGnbCTP0X3x8NwBIQ== 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)(39860400002)(346002)(396003)(136003)(376002)(366004)(451199018)(2616005)(186003)(6506007)(26005)(1076003)(6512007)(103116003)(6486002)(478600001)(83380400001)(6636002)(316002)(2906002)(41300700001)(8676002)(66476007)(66556008)(86362001)(4326008)(66946007)(8936002)(6666004)(107886003)(36756003)(5660300002)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: wxLWKQh04cPyV6uP85lj41mNKBJDVtaGBaKrmZ7gbppM7lwQTq6j8yYJciSSOMjuFaaBSJbmk9jKh4R4JC9MsJafhBicv1JrDrZY+LRhrqcQziBXeYIBKScV2TahHj6sa16bjAG8eeP3204G2Y84qM1Say+VSbMEkXuiXb8xPUNLP9JdXnRNsFNllucEe5iQ770e/zSDvv+NKrzEa7QYsNgTMdiB01F/7/lmcIHYLTYJH7MVzjaP1XzUG+PlFR6i0IiTNt5PpWk0AQaoiyatDObdtREz2U6ZuUXbeK64QGhp1SfJSxUL7b/Qg4ey+zg6agYgBoRgL3dcbJFJT4NrsjQ8RQ+exVbMvO+WQrUFsJePo69JfzGkqE8oT0OkISHv0GPwHEh/hKneEhzrSq7zbjTaFmxzm93F1KyGRK6TAiphZCt3vmvmgJ4aJKf2ZdKrYlC2LE2cEx+n+oNCva5ZQRlQgR0jZd8K54J6zoKMni6ZyH8V4geEKJRtgOhV5IyYa7g85IT09R/qSUy99qRaC0rtl+nyGpDo4Tb0q6XxbkbE0i6AXgldC4BZOC3tOzSTAvlgaoZGxNoF1GYwMHZ6Gbi1P+dZUp4SeT3W+hDGKbwMiaOkCm5yDUE2OSrv4Y9Yg40CNVNd96y8Axbyk6Gpf2zAdU+4AnltqElthpHk+qPhd5zn9wUnpJweNCYYtmj19NfPveB9UCPMRLbT8hjzipB262AHqhmT+zcuVBH02ip0HR2s+M9yoBi2fU8Eb++pJHSdTpBacZK9aY2iiBMs1N4Va+TXfmdqH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EB+iuzd6G3yEyGoTerKR8KKzkv37jXcC8966qOd9Qzo91xXxMY/ZPR5nPXm4Zq45kwOFTUVyVB68yw5MpJ1qfhr8mCiPM/cXbF/BtDhSMtDuazoJqV894OVArvIRTqXFnrABwr0z8DkqQJQ5gQ5OKphZ0MGbsAWz30YZqRU7WaivYrczAKXQgYe3d2xW2eg6zQa+UunBNGnmVbflIpodOxbRcwKZ7Bpg3AbR455xYlHH0hjggwvzkdGvub6tC9aK6i3PJrPdz5IIjQvW572HVCX7Rgx8p5u7/pB0jFqSW6Y/Sv1hBu3+A21AG3yTgAHRMzTRM3ZCl5sZu+PqhldqKbQJRsC8pd63BTiHkFxOHqBH509OJmHgHkal5mywBdtb8Y0Ibg+X6jr1EcwDzQHstM+rw9t9Mfn4nhI2sWMcKz2o3ET9EbuuYfdBvnB4R6SoiBD6yuAqUOLlzlSAZ64H0EiublRDuENpfwXItCgZeB2KJuemm/qDQ1nez9/Cq3IgZ/UkMgYsvv8dmPpayypCKWIrdaLm7No4MtiurayQFsIPR/y+HsR0W4HaZuuXsP6dWTKcQUdVC2soAjknv51DcApLbU1o5EW12FtjRaQjhhAbkkMQouswEy3fRoyfaAsdD47kMEB7YBDNt2MLVAZ5ricKbrqYCUyrpchFV3kzuIYjzrKAiLsA8ehFE= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4c6a2bef-ec0c-4e9a-2bd4-08db23a5c18b X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Mar 2023 09:31:42.8787 (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: n+MLO1AFzrfMsG3UhYXs2NDKwtP0jispD0kQLMcI/o+aAY2A15R1tWGfaFF6mz0Eu9m8OoJohFxthfN0fzY+bA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR10MB7048 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_02,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-2303130077 X-Proofpoint-ORIG-GUID: st3tDyEGrkd01cLSeN3prXjwU80P8rk- X-Proofpoint-GUID: st3tDyEGrkd01cLSeN3prXjwU80P8rk- 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 09:31:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 13172117 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 64CB0C74A4B for ; Mon, 13 Mar 2023 09:33:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231288AbjCMJdW (ORCPT ); Mon, 13 Mar 2023 05:33:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50632 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230420AbjCMJcn (ORCPT ); Mon, 13 Mar 2023 05:32:43 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A5D3753D96; Mon, 13 Mar 2023 02:31:56 -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 32CMo832004881; Mon, 13 Mar 2023 09:31:51 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=Zf60wYcVpeba03dA6L0eUIylZSpPuEDoXAA+li9wp76HHmj6SiyD4FxJV7qOnFVZ3rS5 KJGvEyqLi/BzyZYXnP2mGPULC8i3cpmXG2e0WUjXFbK8vTMGIh4U1v6iGpaam1bwWGjP pNI6kiEzgYHQF5CflDERUluT4zjn1NU/oBsS/kFqkrl2SKM+hKxIWBrGh6zXTlzAoIFL YPOu9dN/xpOMvcuk0aZslbe8n+i6er9ZxNGoqezSOVJNBk0z4R5Tk83qssfqK9bhJiHS Yut88J2QhxttId2SVo0bYrVqIOZDJ8aD+DnV/DfXxVhDXuge9oe61TZMhQjx7GECF5D6 nQ== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3p8j6u3b6g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 13 Mar 2023 09:31:51 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 32D7v6bO002392; Mon, 13 Mar 2023 09:31:49 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2172.outbound.protection.outlook.com [104.47.56.172]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3p8g3awer7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 13 Mar 2023 09:31:49 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=j+FvIMMBEs2JsS9iCXVLe78lLwEhb2j8rtm3ut7AbxYlJP2wkaKU8XhCUX9DYPbVrXq9ETdxAknbRJ/a6KV/q8KA69joIW1Tk8VgZFPKcwI/in2PXWVMP+pyZ4Bha4lhkrVwa7nwuWaQEg6Ug6FwdWwBtgZcVwtXthZsSeCiYFLkY+Vl+jHnFV2fPjrLg3Eu0wueMkldHdGKR8bmrjWMHnC0MuUw3nKLx9RJ1AKxQdg9QQ2itSkbxzBQWCrIEfiyMo8EbIvAgIauaM5txy1tROHVELwzxrYyK4/EaH+YFcvRwPmbh4ywjPui2y863J9PMlco/a9eJJNDayFoQkQa8Q== 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=mi7b+oRU8A3aEOwoE7pIzNheDitUoBT98ziY+I7rJT42FXLHUXlwL3uqIcrkRZofV6MWNTpVRtvx2QYvOxX6hw32nSXZ5/xdEKn9jwUr3CV0PzCUA4je7E3jG6BK4ipp9ZkdPYv00AiaFDWuRC9X1Xpt0vtvqCqwMKvBR/GOwVssjXH0dsnVnjb0Q/45OtDLgtV+qIfAgzX3pNw6LxyjllSuelsc4Ol619rrn5XF8Qhwckkcolul5Y19aPmi5uuccOUxWC2c64S4hq1eYdh60ow2HHwZh6fUpz5MgOMMa5JtITDEv6bhP0/bvC5JXHQ/lDg9ttyOz2fEyUk+CXcvsQ== 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=wnQhRW9c7Qj3dMtacreo/v9NgVgBQclkgF0Npnc2yOVrY8r9O4ZijireAAUBs9lcHq3N8Hb0HxgooiRcdfjIcNInWUjlrXYEhAQEhZbAiUP49Tzd/mM5Qnh/fug+iX8HksMhrcxDVHr+yD0XwsnoDhpJOT264jFcpWAg682cc9o= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by SN7PR10MB7048.namprd10.prod.outlook.com (2603:10b6:806:347::21) 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 09:31:47 +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 09:31:47 +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 RESEND v2 07/11] scsi: scsi_debug: Drop scsi_debug_host_reset() device NULL pointer check Date: Mon, 13 Mar 2023 09:31:10 +0000 Message-Id: <20230313093114.1498305-8-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230313093114.1498305-1-john.g.garry@oracle.com> References: <20230313093114.1498305-1-john.g.garry@oracle.com> X-ClientProxiedBy: LO4P123CA0682.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:351::7) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|SN7PR10MB7048:EE_ X-MS-Office365-Filtering-Correlation-Id: aacc9396-bd30-4d3b-0fc7-08db23a5c46c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NVJoFjCLM5mB5X+rppvplF3hZpogxm/LyOGoSPNtDYDF4+hVkT6Z1vuIITrG9LOFDwII78jqMprE0Bb7RsSZAiUjLedFUmsHyQuajzogWdZ5NYt8b31oIydljOXZyg/zI3PdaK89NLsZhUbVgALRqzU9wCYH3Eh6zvUBi/HmTV/EDpICPUE2Yq7JKVRKy2PolV8r+E5XVL3F+u7x0fkciBwqr/tXZpp6sC8bXhiup8QlR4PJ0CKdCDKq24KDZ+VZh017kgJttyfrvHn3UbTnQrTRror4F3EL62bxIYnVQJvj/H4rz3APv9pD2l1/ZOV8yD29865e+AgTzni0Wiqf+k6QtpbOSxyBYmI6aIB3u0pO35se2ktuVsQA18I7lx6dCHsK836LjM2wQzPKT5r5174lNKgvwkRIMRMREdyzRxYe6Y7f8XLuiMxikmClrCSjiUtW6E/kkrIwVtwLMtl4q+MMtP540I/Jvad/vS+0Ov6c8oU+goUi6sM8QTFU+XeFS+0Q0clAKCeKd71gYshszm70wDeiQhWY7JWnpYXc6jSetjfU0YPi4OXeLYZH1wsanvPXUosWmnS//4At1SEGrcfDq0Y55Q6VMjPu5r8QteWThe3fSsrlTu1yPL2Df3SSQW+1twurplvc2dDFtQ8LhQ== 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)(39860400002)(346002)(396003)(136003)(376002)(366004)(451199018)(2616005)(186003)(6506007)(26005)(1076003)(6512007)(103116003)(6486002)(478600001)(83380400001)(6636002)(316002)(2906002)(41300700001)(8676002)(66476007)(66556008)(86362001)(4326008)(66946007)(8936002)(6666004)(107886003)(36756003)(5660300002)(38100700002)(4744005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: MHAe0pSjkfL25HxWv5SjmWlElu7nvta/dTiCqUm/xRY5vElGbFR/+DPi3qIh1b5aFiBpmDM6MnptZ4TbACxwliR0rdJmV/OfV9kKjUDzS3BmxOE6EBstbita+1/fKVHBU74mXsfCPYEWGDAyxY6UFoJuseTAlZjpzvVzO4LM0Zctck4KnSVf6TJZGPvBJtD5TzjMV3tIARHcx86WcFNmmd1tV7Y4ht01quGbBtOMsdCXdYd2eNWdDb0vYJnstx4LvTyGsL93u8KFgKAuOGIDyR8cJNovMhHrs8zcdZ25DirWM2zCJbDF9J6z1f/ZETq1nREu9jDXC4d+6jdWkSAyunAOVI1RiR4+uH3jZiN8UWfA9bpFjjmgTlOwVi568hPI2kLPeNo9sAX1BxGXo7SDwehEqF847KwXSeRdUZjxD1JlB2GcwinlgL/PZfpTP7ildGbu3QCd3sjMZVtg2Ba+IUXsjak2ftyjpvWT9fuYTtFDDsDeOJiauHJOz9OzKhNjMhiOIYeLCWqkLljMXHgLMDXrMUCvqF/pad5PIALnuOsE1fxouFNDiWYtw8IEyK6jFNYrOg5eP1dpCWIJ7OxlEbuWdySe2v30cj6fe6qi4sGZKVX8cWbRvJzLrpQ3owcl/eHIiz4uEAjUaEmZJnCc1G5Q03PkaV3AQCV7ZEZY258I16UoD2KIc7xuRtlbbpSWeYTeOpdE47cYGPIswF9iawG7fI1aRF46LnGlAhsvtLSJ5zJeFWi0MtgSOB5bH75P/twfFTQzpX3EkYEKaNZ5Ef256kYGSkFQ1d5IwPOUd25Gqhbzx6tU2sE4JtVabklhDVNeD4qXW5VBL5EXEhF8XTOrf75LQbQ4G4ELq5MmHIsMUx2QzxNH5YrZWob0Y2FFj4pZdj4AaJjOykGk7BNlsNGxoUruIrXK5343ozQsH33z4vlm5GA5oz7KLkSy/cUNhOz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yYOtsY3B5lev/16gekunh4CRJzT2vg1k8JFeV86Y9W9I6bCI4UVAe+9DOzymN3aZTVUXbVYtbmmNrnyXe5D5She6zKUVFklNZHV1M2BlI39uhXtK+fDeSEKQuEMqMK9Nr85BeUQJQY44HoWWRfbxjkKteS/yUvHCwfbMCQr6yyZ8bgJF58Bq0RfVgCcnOAsVI2sABYgECS4fYTMgyUPGTR53tywpowH5tHQV6R0U6Iwy/0QRdXsUeTMeORIb9ixiEx1tMa92+CPlvCbkjqCHY9WNqeFPUCtH+CgIHaguscPUL9VRjzrcpuaqTaB+Z4XrPQP100fXHxKE54XVHpvxvVyq6v8rqbEdJrLtCM5nV9DPZAer9hQEaAOI8V5sInjfDAwm3GBg/v7a9Yf1P/lRX9+nynix76fWPYkxKLdVJVKgLTnwbyipORBBm9UQSo50sKn1z/SiTp8tA+WnmzED6drsbod9MJIpDOVTyDpkQSYELA3Bk1Rr0PqEgUtCbcg95hPCLh2xAP1D4Abk= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: aacc9396-bd30-4d3b-0fc7-08db23a5c46c X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Mar 2023 09:31:47.5830 (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: OhudysfflbxL1t0htYilXv0zP+JwL2wxmB/flFdMn0iVCC0NaSK9FcRkAsd7sYILgYlEL3lsNfrJ6PeHwkusMw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR10MB7048 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_02,2023-03-10_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 malwarescore=0 mlxscore=0 mlxlogscore=999 suspectscore=0 adultscore=0 phishscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2303130077 X-Proofpoint-GUID: OqJSCrVDfQRIQlztVg8oyO1jE88XGOW0 X-Proofpoint-ORIG-GUID: OqJSCrVDfQRIQlztVg8oyO1jE88XGOW0 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 09:31:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 13172118 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 1AF4FC61DA4 for ; Mon, 13 Mar 2023 09:33:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231313AbjCMJdj (ORCPT ); Mon, 13 Mar 2023 05:33:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230204AbjCMJcv (ORCPT ); Mon, 13 Mar 2023 05:32:51 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 317A854C8C; Mon, 13 Mar 2023 02:32:00 -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 32D3TCO2005465; Mon, 13 Mar 2023 09:31:55 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=kK9pCtHNTqfhFT/g38H3QEwWysFagv4uWiwXavdM2XTZDNPiXfazdMSC2Yq2P4e1DWpm d7GSdI2jc+aMZY/S+pa4umAW8SNdTXfFG3/Pnk3SZJ2WwlJZH4FOESCQ7/AIxIj3HY6e BGct6grOgIcRmTY3VloTA2YgUMSDGQOmfEj2MJWOCxQNh4S3HlaQMmFASUdpHOiDinbJ UD49+gIaDVZwCmj/BY6KgXcrOB0ESsDnFSareIe8fRtvv1IaKMTFsQj+nFt26J+MJuwa Jv52+oc/qsNtmxvnpmHsw/jgtrMtKMUuFFOtNA1bdMrJJBc8de4gbGJqCkN6sjbJRfpW Cw== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3p8hpcubs0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 13 Mar 2023 09:31:55 +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 32D87LTi007941; Mon, 13 Mar 2023 09:31:54 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2170.outbound.protection.outlook.com [104.47.56.170]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3p8g34ck0k-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 13 Mar 2023 09:31:54 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=a+rNeoyQUeLMuAbXU2r1M8BuxNiauDsmUN+63IdG7oFDBP+mDhWGzcqT8L2TqgShd2ZZJqTskOd8LccZ6Y7e8bwLgWn7yWLLNfhdUct1javR9/5i8NfW9WhppoyRmiZ49erVzDyxrfdWL8P0qe9T5xtI0U1rNs6TqnPF7d5K7TYTi9Uwyi8KBzbSiCqUV3hYdWyPrKC6nri2/eCSeQ13L3XBODPKfCBKphFficF64y6IgliMrl40+IEF9zu4fc1m5nVYZYoIX70ykOxycoHHLzLV6ly42Zhtw1HrMhXPt/JA0LnSNSv27wtg1dZpLpOyAKeinDxeMyNutYzX0CC3LQ== 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=Mx67EKoXZR7HGLXxRWAnHy3PvjI7O70yk0MeDPUj8xDlOMwLAOEgNx6TIyN9qqTqYiz/RhrmRgPsHAdWN8eV0E9oi7OZX8EEXPEhGXb+4BLA8LBmzrMCOB+ZhlPlq8oIqQYme+/jeKvdgcHX0gq4f1gC6rzqWSQOrQq95EhqIdTM03dNLV+4k+UkE3IRjeqzMd44IwKfDg0Jrt7ERSI9KFLAdb1zlt42zh8F2IaIzGN73Wx9sS62Xb06J9qP7NBj0bc/PIZBoDGFOJ+kBW0me+ufXhFUjLISy/YPViM+hYCAdcv1LnZOPy6XGJKKm2jvGPOTZM53rqJt1HDQ9C5erA== 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=xmBxtEX6/ZGFE8677YWxmvZsY836wgLH1u/Qz9piFc2PoCyAuzrGXf3GJTDl5ym8A2X54f0kdTfuCOzgAXutGkSgQEXCqyziTDM1pahoQYMllwgtJ52QpclmTr85D7v9d9BfrJqn4nuNyCsMiZx928v2l+uRYOF/xvud3bVU8tY= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by SN7PR10MB7048.namprd10.prod.outlook.com (2603:10b6:806:347::21) 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 09:31:52 +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 09:31:52 +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 RESEND v2 08/11] scsi: scsi_debug: Drop check for num_in_q exceeding queue depth Date: Mon, 13 Mar 2023 09:31:11 +0000 Message-Id: <20230313093114.1498305-9-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230313093114.1498305-1-john.g.garry@oracle.com> References: <20230313093114.1498305-1-john.g.garry@oracle.com> X-ClientProxiedBy: LO2P265CA0037.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:61::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_|SN7PR10MB7048:EE_ X-MS-Office365-Filtering-Correlation-Id: 11b9a4dd-b8d3-4245-76d9-08db23a5c769 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: d7ty8+em+BqV36aA5APMVYRl5ShbVPvg1I1+q/fUSJbQb5oGhLi2HD7ygWoxk0lyiQFKo7miCIPm2UnbcqG3giB+XEOn8yWhL3zKeBTOkXv4l8ckJ/nktw+7Rg7q5L4iwTrH4OadYqJAJbWMSKn+H82AcfrTJAloF0Xd3z1TL8amQVkbLW/4cqLWAXJ4mVg3HEoeAmELerdgrojEJ+OCZZDb+NjJedCclmoTr/KJ7FmyEHsQ6xqzlYor93nKDP8ktHMy3zKNkIWKOc6D4GsGt0+krueLAVHFdyVHtvoDgBCyA6Gu59i3oSvdm0dgxjk/4lvxnqxwZ0R5eg0YHlEMU8A4xGYCFh/ttonP1Uw/UdFmN8R+NU5+93BC9NqxaejH5yXlVR7UNNLDCTvgHXVcf1x0n0tkD9IVlex0O2SRDidAbZ7+xZf/y2czgBGPkHESlobVV+c12/IITuDY+qlmpcHGNCEN9XIjRiD0tB3BsEfzyqynCo9g2Sdq3d0TALtx+DyshNp5oq5slQChIg5CV/h8l+6Yb7McouZw56XvteogRXFH571A2O7h/9Jorn8Iod9eoJ8Apcf3Oz/ufg5dvMdYlYoqDlmDRrRXZhR6D0ymjPZAwnuP+N7C3FFcMX6aW1ofci3Y9laUHqEStLyTyQ== 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)(39860400002)(346002)(396003)(136003)(376002)(366004)(451199018)(2616005)(186003)(6506007)(26005)(1076003)(6512007)(103116003)(6486002)(478600001)(83380400001)(6636002)(316002)(2906002)(41300700001)(8676002)(66476007)(66556008)(86362001)(4326008)(66946007)(8936002)(6666004)(107886003)(36756003)(5660300002)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ptViY02FdGmH1mTkcFF0yOHzKnBtcrpTvvuIsvRPy4xTATrPIkEOXKwXBpFoZAWdgmQVtHXOGCNycAVAftfOA58OQWjFJ0sjnd084kEegvUEgRvPZET9n/ktQBP6U1PyBriPEBEahTdb84t1z7VCDgpFbOsq6lphZ39BgJ90msZlMS4lZTsJSC+37HBOBqL2NtRpe4jbBhEUswwYZt0oXoeHYsW5PqLa71tSsfve5djh77HDJPR0oiLtKY0swAjo2sjPtj/Z8QV69w5S50hqcyfeRNk2WhjZDp6uf0Fj5eaJtegTNshC8Di1HLR66dpwOnBSts/mLLo6QA7dEuQYmSkWCEl8EMZ5BPL54hq7XE0+mmXn0Z2YgatejJ8zAJeqdd/2dxejVE0qhIcnT5AD8swBsQrcbXYg5Fa7qu3fvmcWDbz6u94cYMqmGOAeen/HIOySGg3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RkZQwdGEXQv4X/fN8a1sXhn8SuvUduF5gPLGxhmso6eTXKW4U7lKQDMrUkYx2VBS6S/LpC+JaPpqav1S7BCkqURdQ== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: kThzC0ktoDddgNvgE7YTu1r40x26Mllt/05v4MmXAMMKaNWqGr5gEtN3jcftQVezIFV/rkWJUGzaiL4cRD24Bsbl+jgP+ztPTZObbMvLjhJFUVv3rExWQMfgXXOT5ud0AqHPJI8na/3kd0NkI0SRkd4ibR3oKuoYuTVY0Bu8Ao14iqIuwqOE8LJWkD/gj7m4lzeDw66qfOPoqPmYjDVUesSmIzv8Mz6YNOCPLZzp96iQMdFTeGVyRFuPB4lhvmjDqb4ANs/XHBOVOevZjTfAy4wbtlwpkdBk1zzZVILggJaEKFPKVCdkLieFVEadJg3T/6m6rA7OHusA9fBsxFmjxj1j2PvL3Rmmkfc5m9bx2Akufkfsivh4O6Gq1WLN4K1hhNiStnKhdnhkTLFgsuivNosJg5rr9qQVA2lqbTgN7qvRpVZEnzT0U10qhY6TpuXxMngiZcB37vetnUzQVN9mhcYp7NZD+txqvcWddtc16M9qUDUjk1A/fGJ4Td7AUwgPcC1gioejADAcFWyFwvF35q6GyFkYAKKuOIe1kYbEgMXcI9xTCJfdoE1f7pFyae4VSgyH+5Kb8rFq4PNbzGZNkzQ2kIjRDsYj720SHuigJtRHt6LwzKooTMt8wXolCgxjxtE4zkPriypkvcW30CyEG9iW3zZt5teSekMi9PTF7HLFPXPoYJX6st03tzcvuVBiB9m28u9fcoz1ttK0/QROjoOjLwtBb5mcDIZpgrFHF8Wr3ibtaBTP/tPdcTnn16DaaTbRF8w9Iiqt61JLxuROM7AiestToZJe6xl9wOGOXtzLrIf2ejIha3gpN6ZoTEoYR9jhkXCUFWperPFevUu6cvgOAdupEQf2wMwOvC4wzPo= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 11b9a4dd-b8d3-4245-76d9-08db23a5c769 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Mar 2023 09:31:52.6929 (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: SItzw3ofX/Vj2Qby43WWqLTxvrQVo6XK0udK35fo1MDi0TLh1cc/65/LF/NeZexmWue7sfnTbf6sIECp4c3gkA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR10MB7048 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_02,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-2303130077 X-Proofpoint-ORIG-GUID: bsKQt3nwa43I2YQHblmw0yaqz3DqxV67 X-Proofpoint-GUID: bsKQt3nwa43I2YQHblmw0yaqz3DqxV67 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 09:31:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 13172119 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 09D57C6FD19 for ; Mon, 13 Mar 2023 09:34:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231331AbjCMJeL (ORCPT ); Mon, 13 Mar 2023 05:34:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230192AbjCMJdT (ORCPT ); Mon, 13 Mar 2023 05:33:19 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 604AE56163; Mon, 13 Mar 2023 02:32:16 -0700 (PDT) Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 32CNEIgH024676; Mon, 13 Mar 2023 09:32:02 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=iS3oQQgc7Zn8ODNsyFBZug+VoRiFIqNLNpm4/xSdDHU=; b=NVa4BXiNqwUYB6tQzhbtt8AdZAaC8exhZxO9Qah0/nLOu9+GrpvK9shZMxTm9orDGe0d Ji1h9hR15KRCb1jRWy5EhxEXUPGGsNBBmlxaacrqv97a04sDEf+mnSegvP7uVYSs4tUi 7Hne+cYzf5gF4E/vVPFeHJ0xi3lgjGrfgZkONLvTaO+//XQtBMmH4//LCM2TPU03SVIs 0+aT+xn7HDswtuNv+cVAFpTQ56SuwpMgUOU8pG7JBRV9T7vdneoUZq0+3dJwJHXkTzu9 Cgv961VrJfMpN5B8d3zX6tpF7/2mpHPaOyBx0gEYL3Ol/qqxebjOksMMjbRW1uB4BKvN Sg== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3p8gjbbdfu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 13 Mar 2023 09:32:01 +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 32D8gK1m007336; Mon, 13 Mar 2023 09:32:00 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2173.outbound.protection.outlook.com [104.47.56.173]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3p8g3b5fvn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 13 Mar 2023 09:32:00 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=S2RkFAnRpophrLUSPjKsstgDOYDC0faIwVTJXdMxfTfTmANTjpdjOY+AJPPCeYPsA/18feYx32CEtHDbtotPm9Bz/yCHTitNkP/SOIkV1rPhz+FQx3X/aZHeJfZKyuS3G1Yv80IbcbyZpqkp6G/n5N5z9ACaBLnFPZSGkwoWB+NDp8kSgzjJS3sbBdJPeVqmNjvrawb7kivtFqFKomilAcTQMq8VSKgYZHsXYAVumOfRyB47dS6Op3RRKRO2GX8yhyG3O6hKgcZIL0ajpKWUGLihe2nWR6F/Jo4qz1xFOdfRBlZU/m30iwP7YTcxOGXNw7kDLkMeiusE5BjzE0sjTw== 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=iS3oQQgc7Zn8ODNsyFBZug+VoRiFIqNLNpm4/xSdDHU=; b=koZVQYtrK8C/zNaIwNDDxNUnzk6ifIMv5u6ciPuCDthvWppaQy/utjqmj6tsPhAVyDKeaLDwKZn9qL60Osmpt9YqNAfhkXASRQpuCk151N7a+THZwu/Nj75nYdWRuGTC1WtAct6iD+M2J3FNz7clXKndEdezyINAz96S8u41EkH4Necp5nbT803yFuNcIlRWzgXzvdh82/6X34bsudbdRazDFOe1ue7F3DWehd3SFyENo3urqk00aeIyORx8ER+p8+0UNY2vlrVkfnd1IT8I57hc/JOsbhRmGnKLKLyyFueqxZciEVmcTDvV5naBGuzsFuvAjxf9JHeD5zDTlxoA3g== 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=iS3oQQgc7Zn8ODNsyFBZug+VoRiFIqNLNpm4/xSdDHU=; b=JJJbbIHAXtB4rLiDuRiDiTSFd/OXByWvE9kCIXC5TexhqhkkIwP9fZrlzT4n7w8NzOl5JZREiPXUy0ve4Zl9KHR1p+adu52zaQuIwP9pnbzO5IXHirzqalToEDmtJhDe5Ttnqv234GW5Q+EAFPWNZRQwDPFYb7Iw424UXbzye1w= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by SN7PR10MB7048.namprd10.prod.outlook.com (2603:10b6:806:347::21) 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 09:31:58 +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 09:31:58 +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 RESEND v2 09/11] scsi: scsi_debug: Drop sdebug_dev_info.num_in_q Date: Mon, 13 Mar 2023 09:31:12 +0000 Message-Id: <20230313093114.1498305-10-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230313093114.1498305-1-john.g.garry@oracle.com> References: <20230313093114.1498305-1-john.g.garry@oracle.com> X-ClientProxiedBy: LO4P123CA0331.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:18c::12) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|SN7PR10MB7048:EE_ X-MS-Office365-Filtering-Correlation-Id: c25c24bf-1c10-4d9e-1d22-08db23a5ca7f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ccj8S8ng+r4lKwKf+kJm/S0ffCBr2H4IlPtngbUR6/5HbatWy7oBVUldjnZsiAK8KS5cFeL+Pt7f5NteNSAi49LGAd1sKVA742rKEdLWpZflEOAEVkaqI7SefXlNWIXD/P0pw/tMjBegXw6NeobK+Cm6mA/rJuTSSLSED0aUd3vy3i2o70v4TqsmyVkLJiX66rjWGy6vjKCK1FnH+NqW8vrn9pXoUelC4tJGubhBJDrdhNSvRzxnMozSNacJBU1lbYitP79FazdnxgUYZOLG++03ZpDRxH5IRcnEkHMgkdpj46BXukvgno1AKbRenZgX5BfDtV93i9nBvD+zuRzGAdOy1CQ/vl5HMCzP6UDmcV/voGisL8bTq9jwazUMU23pR1/seIXCW5sVEW56Ow2tdMpykUnw5xYdZYJH/xnprHQHqQMkIhwJQMA1AsLD190Y/FzNKMwRQBGQJhbPa0t2LepgMpte9sHW8FA95vT41aN5Rsj2jRoTjV0fPknM4xvtpCmigSsQpBgM/GsspRCtFMmtruWA22rRSBQ4b710ws97Njy57q+pHaL1SBFkw0FJBBQ1pU07MqJhaDsLEZB9YWSjsrEsmNDCb40x0nOVZPgB0llPNvY44104klRUogrt2vqpj1n9nZqak77jMLbeHg== 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)(39860400002)(346002)(396003)(136003)(376002)(366004)(451199018)(2616005)(186003)(6506007)(26005)(1076003)(6512007)(103116003)(6486002)(478600001)(83380400001)(6636002)(316002)(2906002)(41300700001)(8676002)(66476007)(66556008)(86362001)(4326008)(66946007)(8936002)(6666004)(107886003)(36756003)(5660300002)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: se/TVY8QThGwzcNFV+Gs9bC+Sc9ineJ/Q5eC3mW3pUo3rvtJJbb0z1HYwucI4CVJzB8Jk9keFQ/Il3GwnGgor4Paxbp3gjxEIP9geBs/RGxvdRK3/1em5ku0Mw9esBxAB1HyO08W0hDzLjdiJ2oiLa0dGkXeEa/PHu55CGeCePvvN+PlJPpjl1S6kBJlCdC1lGwlQeX+IGpV1M6fBm4xfUIzU3sIBQ+EEiDtju46LkeOvTSfoZDnHl/2VqmgeVHnhRs2+aFOTb10MbvGoND7P6FRELkJLDmBTBmVbdwum+q9z3e0HOn4z2KdfwrTZb5/Byle8uC6EiS1pmuUvRvmfLe50hZzf+67JD402x4V0sNqWdRW7diKF9ycmGr0QXdp58ZjHW92ULot9tL3xdfRgxgAYaBfl0omo32lE3wgpXTf1D7eClbLF3ixAg3V6ZCvGa3FuqFnli2lFDqAahgIv/SY1sN7VCKwT5nDX3e/0nDLnNi41FiIw49iB5PKOsl7WJ3Uxi3X+1/7+yDDMWku0EJN14s7CWjV3G8YpsVgWNl3YHfOqgVj9YPBeGuQNTj//W5mtcBPDm3nYepA1ANWQp84CYE5sK4cCMNd6dTKAGsVWWRX4scyA6qqjjuj9kPp9m0T41sxgbSs3UGs+teahuq/Iy+lNMN4AZfCV11P1THOP9GQ2sgT6WJrPuPzUqC10pPa5zkefaD/+OxyHTT9XfasMCXwCXvfQlJ6EJ6lF9vg+WOql2YFjdNps0DuEebUyTzIAx8S6pHemrZX5zB2sxrUUY56M52uAhTaqYWkQ6mqfDWuvEIFpV8tBAoG5v8LCdrJlRyLIEFQfMpH/RiPrtXGPeElCk18STBn8apYQ1jJIYxAfBBAnF5p6lUsiLo9HTQzXTYameMcFeEsWQw+IJMaLtfyrIsV3yb0bSztMmlkTnHmZtDnIBningpE4FTWOigP5BQa36U3VeCO+kw1dh4xRnGL5fINEAvByci/i3tYGTn5j+bmz95/LW3VqCa6T/nnwui1Iue9zGz1trZeQNb7gv2ApX7o0myP7FQsd463V1euGPXa21cRf3hyny3tmFxk7AOgzd7x69+NXyUc8dniz0BC+43ssxK4muWkDSh+qfiETEScgkLOAJL9R3XDY/5szHvCbflIvN2J6bjMhMGlPsS6/Cih09C0+QFX1GyIztxEs5FnaU+0iPVSbxih3JF3e05/OQKHbAnWw3I0OWpDIy/No86oSOjB5/a7dDwtWH+0wX52uiYXAfS+YSl6q5gNBw0iKgH/nXPZlzpWQqqfq4R6DVBy9a5fUAOjoOVXMmvx0q3sxcttvc1gEif7sQXIK1wS0TrtV/GgROilA5KlG89pd+y3tWBUMTXqvdDdpo45BcVES6dmhOIDQaEpuI3AFleoVlhLqopCNRNy3bUNRg6cLGboLiQkd6qCY9neYiDNMn98tn0V8Fsd+88omGPK630adWBQvzStV1AmHIeX/x2vkxpUfq6K5EZPBEnxN9xhR996viR4wzlAMEWQQPo0BICeeEqdyj6NvutUlarAGBj6788Th8Wg4a93zB0NOlMRgF1vMj/bhlik0pYO3uQU1DkBa8EEh2nRFYGMdg== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: qBP7176wihnTZPOgCYtzF9VvDaMUaMTuPgxD6m+1wddS0MdQlIq6Vlau37MDs8ivpdsTz/3ZD5FkyVNUqDYT2Spc1OCQly3wbkKlvoaJ1kGQqtVskiHQToS4yy/Dc5T5gx7zCghlLGBQlgbvXFeTJ3ALjdgK/S6uCUn2uI3P78ibBVYEwWnGyViKizSYJqpdv/5l5J2AV1mx4BP8d9vF0Cq9eF1YQqhDVmj74VY7GsapEAnjgUdq6NphHkgvgOJ7IMNo5JJaA24M7s0pxerOOC3yGZTHDcTb4lVsg0BVQDIjSavy+1klikEOwEn6y1qCr9yVQghkx7r77+r0c4A8cdFjAbFyly8/q2k5A5usshyl/eB6WGTOCzw4zE6fIrcSXIPImb/LW/sykbiBbhYFJrwc3XUWLTUO/ww2MCcVSTKZlolHC5Zus799/T6a3REAa069BiJxsNrvIqfrahI4cqd5uIiYR5wQsoOiCqfFI5ctsrfu4P5uuccOiNA2OTeo/7Y8LPe28Zm5RNBzkgyLPX3+zCDFAde5rYcEuz97yfJ/vNymdkJmqX1ywhtxQxcCDDttA4AlIvQMsBnZhNPRLlvdn0bEJG66e2F9p1NR4nTdlMDHYmA5aBynieFjiUdf5owjOujjC7vyMFBChIeVOg37yCyvV7a8l8EMA7lqmW6gmtNzjiSj5MVQNBeK7P0KOF4bg39mHs4KXasKc6PHIMVO+M4mIraAfaFEJ0dBCvPoTYziBpi+7KVkr+ZJj9Il6tYrQ9Scd3YSVkIW+rgErYrLTgU1HwfvdO6PvN0MD6qMfaUw2GSRNYW4lURvo6qtYBHxLQFP55lAMR4+oFhPsiltOz2AsaJrZ5pb3VJuIag= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: c25c24bf-1c10-4d9e-1d22-08db23a5ca7f X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Mar 2023 09:31:57.8679 (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: DMnogREw4vL8yiKSsOsgvg6ib3+nD3k5dM2LZqr91DW0lJ4Fo3kNYGysw8pnFrX1TaCkG7UVdUXoAMU1Mt4z5Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR10MB7048 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_02,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-2303130077 X-Proofpoint-ORIG-GUID: us49QNoRhyJ68M7972DdxVZL8VKIebW- X-Proofpoint-GUID: us49QNoRhyJ68M7972DdxVZL8VKIebW- Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org In schedule_resp(), under certain conditions we check whether the per-device queue is full (num_in_q == queue depth - 1) and we may inject a "task set full" (TSF) error if it is. However how we read num_in_q is racy - many threads may see the same "queue is full" value (and also issue a TSF). There is per-queue locking in reading per-device num_in_q, but that would not help. Replace how we read num_in_q at this location with a call to scsi_device_busy(). Calling scsi_device_busy() is likewise racy (as reading num_in_q), so nothing lost or gained. Calling scsi_device_busy() is also slow as it needs to read all bits in the per-device budget bitmap, but we can live with that since we're just a simulator and it's only under a certain configs which we would see this. Also move the "task set full" print earlier as it would only be called now under this condition. However, previously it may not have been called - like returning early - but keep it simple and always call it. At this point we can drop sdebug_dev_info.num_in_q - it is difficult to maintain properly and adds extra normal case command processing. Signed-off-by: John Garry --- drivers/scsi/scsi_debug.c | 63 ++++++++++----------------------------- 1 file changed, 16 insertions(+), 47 deletions(-) diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c index 0d515bac93bf..449b460e4c1b 100644 --- a/drivers/scsi/scsi_debug.c +++ b/drivers/scsi/scsi_debug.c @@ -288,7 +288,6 @@ struct sdebug_dev_info { uuid_t lu_name; struct sdebug_host_info *sdbg_host; unsigned long uas_bm[1]; - atomic_t num_in_q; atomic_t stopped; /* 1: by SSU, 2: device start */ bool used; @@ -4931,7 +4930,6 @@ static void sdebug_q_cmd_complete(struct sdebug_defer *sd_dp) struct sdebug_queue *sqp; struct sdebug_queued_cmd *sqcp; struct scsi_cmnd *scp; - struct sdebug_dev_info *devip; if (unlikely(aborted)) sd_dp->aborted = false; @@ -4956,11 +4954,7 @@ static void sdebug_q_cmd_complete(struct sdebug_defer *sd_dp) sd_dp->sqa_idx, qc_idx, sd_dp->hc_idx); return; } - devip = (struct sdebug_dev_info *)scp->device->hostdata; - if (likely(devip)) - atomic_dec(&devip->num_in_q); - else - pr_err("devip=NULL\n"); + if (unlikely(atomic_read(&retired_max_queue) > 0)) retiring = 1; @@ -5192,7 +5186,6 @@ static struct sdebug_dev_info *find_build_dev_info(struct scsi_device *sdev) open_devip->target = sdev->id; open_devip->lun = sdev->lun; open_devip->sdbg_host = sdbg_host; - atomic_set(&open_devip->num_in_q, 0); set_bit(SDEBUG_UA_POOCCUR, open_devip->uas_bm); open_devip->used = true; return open_devip; @@ -5263,7 +5256,6 @@ static bool stop_queued_cmnd(struct scsi_cmnd *cmnd) enum sdeb_defer_type l_defer_t; struct sdebug_queue *sqp; struct sdebug_queued_cmd *sqcp; - struct sdebug_dev_info *devip; struct sdebug_defer *sd_dp; for (j = 0, sqp = sdebug_q_arr; j < submit_queues; ++j, ++sqp) { @@ -5278,10 +5270,6 @@ static bool stop_queued_cmnd(struct scsi_cmnd *cmnd) if (cmnd != sqcp->a_cmnd) continue; /* found */ - devip = (struct sdebug_dev_info *) - cmnd->device->hostdata; - if (devip) - atomic_dec(&devip->num_in_q); sqcp->a_cmnd = NULL; sd_dp = sqcp->sd_dp; if (sd_dp) { @@ -5308,7 +5296,6 @@ static void stop_all_queued(void) enum sdeb_defer_type l_defer_t; struct sdebug_queue *sqp; struct sdebug_queued_cmd *sqcp; - struct sdebug_dev_info *devip; struct sdebug_defer *sd_dp; for (j = 0, sqp = sdebug_q_arr; j < submit_queues; ++j, ++sqp) { @@ -5318,10 +5305,6 @@ static void stop_all_queued(void) sqcp = &sqp->qc_arr[k]; if (sqcp->a_cmnd == NULL) continue; - devip = (struct sdebug_dev_info *) - sqcp->a_cmnd->device->hostdata; - if (devip) - atomic_dec(&devip->num_in_q); sqcp->a_cmnd = NULL; sd_dp = sqcp->sd_dp; if (sd_dp) { @@ -5565,9 +5548,8 @@ static int schedule_resp(struct scsi_cmnd *cmnd, struct sdebug_dev_info *devip, int delta_jiff, int ndelay) { bool new_sd_dp; - bool inject = false; bool polled = scsi_cmd_to_rq(cmnd)->cmd_flags & REQ_POLLED; - int k, num_in_q, qdepth; + int k; unsigned long iflags; u64 ns_from_boot = 0; struct sdebug_queue *sqp; @@ -5591,16 +5573,21 @@ static int schedule_resp(struct scsi_cmnd *cmnd, struct sdebug_dev_info *devip, spin_unlock_irqrestore(&sqp->qc_lock, iflags); return SCSI_MLQUEUE_HOST_BUSY; } - num_in_q = atomic_read(&devip->num_in_q); - qdepth = cmnd->device->queue_depth; + if (unlikely(sdebug_every_nth && (SDEBUG_OPT_RARE_TSF & sdebug_opts) && (scsi_result == 0))) { + int num_in_q = scsi_device_busy(sdp); + int qdepth = cmnd->device->queue_depth; + if ((num_in_q == (qdepth - 1)) && (atomic_inc_return(&sdebug_a_tsf) >= abs(sdebug_every_nth))) { atomic_set(&sdebug_a_tsf, 0); - inject = true; scsi_result = device_qfull_result; + + if (unlikely(SDEBUG_OPT_Q_NOISE & sdebug_opts)) + sdev_printk(KERN_INFO, sdp, "%s: num_in_q=%d +1, status: TASK SET FULL\n", + __func__, num_in_q); } } @@ -5616,7 +5603,6 @@ static int schedule_resp(struct scsi_cmnd *cmnd, struct sdebug_dev_info *devip, goto respond_in_thread; } set_bit(k, sqp->in_use_bm); - atomic_inc(&devip->num_in_q); sqcp = &sqp->qc_arr[k]; sqcp->a_cmnd = cmnd; cmnd->host_scribble = (unsigned char *)sqcp; @@ -5626,7 +5612,6 @@ static int schedule_resp(struct scsi_cmnd *cmnd, struct sdebug_dev_info *devip, if (!sd_dp) { sd_dp = kzalloc(sizeof(*sd_dp), GFP_ATOMIC); if (!sd_dp) { - atomic_dec(&devip->num_in_q); clear_bit(k, sqp->in_use_bm); return SCSI_MLQUEUE_HOST_BUSY; } @@ -5686,7 +5671,6 @@ static int schedule_resp(struct scsi_cmnd *cmnd, struct sdebug_dev_info *devip, if (kt <= d) { /* elapsed duration >= kt */ spin_lock_irqsave(&sqp->qc_lock, iflags); sqcp->a_cmnd = NULL; - atomic_dec(&devip->num_in_q); clear_bit(k, sqp->in_use_bm); spin_unlock_irqrestore(&sqp->qc_lock, iflags); if (new_sd_dp) @@ -5762,9 +5746,7 @@ static int schedule_resp(struct scsi_cmnd *cmnd, struct sdebug_dev_info *devip, sd_dp->aborted = false; } } - if (unlikely((SDEBUG_OPT_Q_NOISE & sdebug_opts) && scsi_result == device_qfull_result)) - sdev_printk(KERN_INFO, sdp, "%s: num_in_q=%d +1, %s%s\n", __func__, - num_in_q, (inject ? " " : ""), "status: TASK SET FULL"); + return 0; respond_in_thread: /* call back to mid-layer using invocation thread */ @@ -7369,17 +7351,12 @@ static void sdebug_do_remove_host(bool the_end) static int sdebug_change_qdepth(struct scsi_device *sdev, int qdepth) { - int num_in_q = 0; - struct sdebug_dev_info *devip; + struct sdebug_dev_info *devip = sdev->hostdata; - block_unblock_all_queues(true); - devip = (struct sdebug_dev_info *)sdev->hostdata; - if (NULL == devip) { - block_unblock_all_queues(false); + if (!devip) return -ENODEV; - } - num_in_q = atomic_read(&devip->num_in_q); + block_unblock_all_queues(true); if (qdepth > SDEBUG_CANQUEUE) { qdepth = SDEBUG_CANQUEUE; pr_warn("%s: requested qdepth [%d] exceeds canqueue [%d], trim\n", __func__, @@ -7390,10 +7367,8 @@ static int sdebug_change_qdepth(struct scsi_device *sdev, int qdepth) if (qdepth != sdev->queue_depth) scsi_change_queue_depth(sdev, qdepth); - if (SDEBUG_OPT_Q_NOISE & sdebug_opts) { - sdev_printk(KERN_INFO, sdev, "%s: qdepth=%d, num_in_q=%d\n", - __func__, qdepth, num_in_q); - } + if (SDEBUG_OPT_Q_NOISE & sdebug_opts) + sdev_printk(KERN_INFO, sdev, "%s: qdepth=%d\n", __func__, qdepth); block_unblock_all_queues(false); return sdev->queue_depth; } @@ -7495,7 +7470,6 @@ static int sdebug_blk_mq_poll(struct Scsi_Host *shost, unsigned int queue_num) struct sdebug_queue *sqp; struct sdebug_queued_cmd *sqcp; struct scsi_cmnd *scp; - struct sdebug_dev_info *devip; struct sdebug_defer *sd_dp; sqp = sdebug_q_arr + queue_num; @@ -7533,11 +7507,6 @@ static int sdebug_blk_mq_poll(struct Scsi_Host *shost, unsigned int queue_num) } else /* ignoring non REQ_POLLED requests */ continue; - devip = (struct sdebug_dev_info *)scp->device->hostdata; - if (likely(devip)) - atomic_dec(&devip->num_in_q); - else - pr_err("devip=NULL from %s\n", __func__); if (unlikely(atomic_read(&retired_max_queue) > 0)) retiring = true; From patchwork Mon Mar 13 09:31:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 13172120 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 83DE4C61DA4 for ; Mon, 13 Mar 2023 09:34:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230293AbjCMJe1 (ORCPT ); Mon, 13 Mar 2023 05:34:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49768 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230075AbjCMJde (ORCPT ); Mon, 13 Mar 2023 05:33:34 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2FA1556531; Mon, 13 Mar 2023 02:32:22 -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 32D5f8rQ006522; Mon, 13 Mar 2023 09:32:06 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=VEpKMk8VnwlPljM0NTa4AnFFuedCf3d3AUavxwG68fvLFnLGdq0dGqIyRzWa1nffx9Au L8b8WCjXrHrSR3cGfTIXke2rW0hxthwGebQcW7fYWrQXD/1v/vDQQZ8167h9xkUmjX+i zRHx+UJD7U9Dc9/pY0pssdNTCmdw1smzfhp38ixdkxIaeUeyBxQMJxPq+Y/7xhckhH/F hZKCFep502K+rabzAnPRP0v9u1YUCW6il7OGgAvvXXVqXdHrJBPfTNJxJ+SrcnZP4iAj ST/2e3mhx2Gt+NFzzL5fTXVx5typH04/2SAK+VenSaGailuN4GARm9YKejX0RFFPS9nh 8w== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3p8h8tbat1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 13 Mar 2023 09:32:06 +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 32D89ePv025072; Mon, 13 Mar 2023 09:32:05 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2175.outbound.protection.outlook.com [104.47.59.175]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3p8g34d323-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 13 Mar 2023 09:32:05 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mUTHc2FFusLENzDabu/IaPgz41/vJmiXIZzcDiBI9R9lSpRv6g65QmBV8Hp3H1yPC7vNJkLBHlOaSRKjSZZ+1jEzoIrDcX7TTkTvpQVYjpP3yF3bloM5uWpnue8WZEX4xXAeBGA5RBPHlCnENGgZP02apsxXiON9c5aHvvmpKTMcQxS+s3SdSJPy7heUH9flqcS7aPvgf1V+Vr8RTWdjL003+/s9opJ5s0FeFUU6MjzMbTxAFXB7w6ZK24javr3WJlO8p0AwAekWGbIfErEPxCHIxV5XG+260mI9LOKzipAZbmlO8VwKc4IU6xkSJeOYqcR/rTCXatbq+eeCmu6K0w== 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=l6FRNnEsz+nMhoCqj4Fkq+61R/dyUIiCHq+h7oCTZYY2VG4liSOUOSK18C16thNeBeMcY6gOLzrcEERRQbfqlwqmOdBOJWXPuHICKXYt70u9fgqg5aheN9J1qQ7TNZ3FdhyMzZBJ9gFR+dW4U9raUz2R8tdB2qrBX5zKzMkKVA3d8UrIYhBHB++nVPlyUviBr9ZM+Kf9fc0wvtYc5c1xR8Fn5CBi97FM/WQGz+RuMiLvEqDgE906fNNDc7CemaX0lrd8eCPJfKwZLnoGEjhrAjGh3rHhWtK3kaTlMdCXkUttSoJpTzmFtk0wmakGriy3YvYMajCpIfkjPd3XD6ax+Q== 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=AuMQmHCXsgfxlZRd5inI9JA57fq1ueFP/6BIcq1NaqTM5ShRFLzoTcgq/1uKbbdB3kyGemEm9mETRzQvVGgERpalWBXh8c+tMnlxCa5Q0xUZMtQ5AH5KCbeVZqVSYW2sypnP5TWlwC/0GdhhCgPdqRSKiVJLb0rIJTwDIHX2PFY= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by BLAPR10MB5060.namprd10.prod.outlook.com (2603:10b6:208:333::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.26; Mon, 13 Mar 2023 09:32:03 +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 09:32:03 +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 RESEND v2 10/11] scsi: scsi_debug: Get command abort feature working again Date: Mon, 13 Mar 2023 09:31:13 +0000 Message-Id: <20230313093114.1498305-11-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230313093114.1498305-1-john.g.garry@oracle.com> References: <20230313093114.1498305-1-john.g.garry@oracle.com> X-ClientProxiedBy: LO4P265CA0038.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:2ac::6) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|BLAPR10MB5060:EE_ X-MS-Office365-Filtering-Correlation-Id: 9eefe6b7-4c33-464b-6690-08db23a5cd81 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: HBRwhbzmKcLa7wxybCVRmh+A5P8AZMoUm219tuqoTV4DJGPpFef1jiIWrk9n8NmBwJ3Ws66uBCe0I24uJR4g6xniRQVZWOUf/uh7XgBXHfu/eEPt24/+SkmsCp64K2OPpl5hLfXixueiWdgRaja3KpR8ULORFKKeFcsJhRj9X2YDk0evCYscAmhFNIilJ31sTSxTZhRPPghDs3utrZtU9/mD0GGqfJ3xPlNtxmYl2w5v/dbV5cq8NYtYQbB6KgzExs4z7mCbBNdTBjbzcnnUNJmHn1T8/n3JDZzEYMd4YJoT8wes4cirThCXbi1P38xrBhwX84+32nMLUv+y1vtceVvZ1rgVoKlnHkseJwxAYTRXHHehqgpGy8g8fW4np0EbuZ3iRdPO44Xq/oeFsxoPk0KMac9j/Y14OcMUjqIQOGrBm2Ipwy4s5HQC6KC2mVdfcSQUDUHmxFDAXSFD5+UKPDtY8szDuDNisSqag5fmqOnQ2ipU5MEfq/J8AdQQVucNiFmL/4lsMTJWDCtgxKuSxUAhT4faDr0hJ/a/cl9nzzitSqVsWygnGZi48Z3UPUQGuUG03EhwoEmv8XQLEgndhHNCdoUheyyzllQUY2lR7GaIZLd+ap2LXnRSG/amb+pIQFossnfRulQrAWtGp/y+GA== 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)(376002)(396003)(346002)(39860400002)(366004)(136003)(451199018)(2906002)(83380400001)(36756003)(5660300002)(66946007)(41300700001)(8936002)(8676002)(66556008)(66476007)(4326008)(38100700002)(6636002)(86362001)(316002)(478600001)(103116003)(186003)(2616005)(26005)(1076003)(6666004)(6506007)(107886003)(6486002)(6512007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: azplPkTzzmKPDMvRi+frb1rErengZTK57h1+ihjcuwKXb6FIZ1x32zAzwsoVen5aocaz5hPo/o7jIotjgWhoxXZ+Z06QmMj2u4JMMqYK5pbMSzWBhHGgK/ofccWAP/jUm7XFwyq1H2WUJ7Zvc8wF54l0AzA1PrxP3e/7TlbnUMDFL4nCHv2/crvn80535TVymKwkSGwv1vQwFGe0Vg8DPkj3tAbK+rP2zhcf5fW/ulpCNQ4TYwBJ2ENWKQqQHzLPSmqkKXcGqehFPiZTgM5qJqufwPtSsgeAGSeIoLSdr76t65B4sn0gtUVYp0Nuqll16PRRsXHjhW3klBBFUnlAaLLmFFnnn4ggBdRyeZ3gTbvCdtqGGqwQC0pVmXMEeeN9ACPHbxqYr9YEaIzyeWDiGUzKJH2pbAAw3mGwkQAEbclq5ENXGc4gNRvb+8IvFIdsrsZFY5Y6McU7E19WIMnJKzSvY3BObrOoP/zuZPf/8HkFKnoi9OonbrbBcRUciLsZQBx9V+D2DvWfr9VyeasrCMMXghqAGc1//BVWtDb4KP6Nr2/GZfY3ZttL2mPOtvCk4+4rlzqpQ5EWH50LtvSVz6b1gLY9bFZ9BnLRgCsnS5onDgiucNpO4holSdVo+BTv6wgHGg3gAEcCCmv/YlDq+GBVJAhrZzBKYs3/5Ohw5ctiIPh0q2NcnfbygyO6Z19xi/jXapeAMPO0PCZThVhDsvRMgQheCLPYM+sDfthHx9mJ3+pLuNMO2drpR+HGDaaBAZL80TwX9BFwkn9yoeHTvn4oqVpetSoCP9fKquwR4kADFPysj2g1eIacrays/gmcIWQCzxanUcrqmY8Dz2N0/5EtyKO5MsB7SR6AA4VIejsSLEIothugs1B9hdRb+eQRSXwPVLwA0IvVaBPbDjAtNSKoK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O66OR2fye/Ff+eBelTZFvvPWez3yifiVcJp0gCKuYcmSToYk/lOVHSdsXPE/WWAQTLO+wfTNAwcr+6XNY70PigkiUOJgNAB2OmwyRW1L+R3GF9utoPWLdROYtyo5M2OBiD/L2mPG7xZ7UHUoyraTKtwZFXvu9gCVx2KLCYRyaIrkJSfaK26XEPhh5LuSrHPUrFtR6yEHKmIKaTsmaWbAXzf/0EYLZBI9bHcZEOcQIPytsJhe5h489UbC+A13R/mWcfkzmN+CLrJF9GDjBBEYXAdEByeSPCzwIDo6mki44chOTcROHo6xTyXQrywq/PizE3/W7P//MOmokd1c2yoqFiKdnQdMm9gJRqhsb6ON1YZjM4vJ6y28ldAAcTYYwos+H8iYCK0+emsalyCwvUlPqPnFJYIAqZjC8vjB62OlXtTofwR+Z/adnwI2Wn+WFXTKCIewpEVBOEWSoIRw8n8I+++V2zcQF7oAlOsXkwn+nLu3SGJDcdpCoZ1f26YhbFr7f26pCYYo+gSioS5oRPDZHeV89iFSx05ESzEp1B+g+4NeylhlMVegbp01wPhQlBEQy52s= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9eefe6b7-4c33-464b-6690-08db23a5cd81 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Mar 2023 09:32:02.9786 (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: a3Vp25b33RL0kQjPz+dhHqG9WD0BR93oUS809xSifBMJAh2WPgtFM3f8yLn7VNxO4l/afferICegxBrPArz/Tw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLAPR10MB5060 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_02,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-2303130077 X-Proofpoint-ORIG-GUID: RxDIV8qTdUMJnMIM8kpD99iDWVs4SK9q X-Proofpoint-GUID: RxDIV8qTdUMJnMIM8kpD99iDWVs4SK9q 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 09:31:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 13172121 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 7F934C6FD19 for ; Mon, 13 Mar 2023 09:34:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231262AbjCMJed (ORCPT ); Mon, 13 Mar 2023 05:34:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231312AbjCMJdj (ORCPT ); Mon, 13 Mar 2023 05:33:39 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E7B1722DC8; Mon, 13 Mar 2023 02:32:28 -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 32CNEtuP011324; Mon, 13 Mar 2023 09:32:12 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=OpxEZAsJ44aUhiFLr6rsZGXgPpxkbJ2oWeONAh+d05Xt7I+mfvd1ATV0to/IKIPe5jla SmJxIgnRjHR1xhNYa//qprgDG+7yd6ZIR5ts2tkGgQgHGN1DxkozgeFryk8U95olylpK qiyQ2PSCOAK30JStZDpiG0RshSIRPMvLsDYecCuj2SwkoopUAbtpMKx5RHKZBeE1FCh1 YihLU57rwHerw7vTKZZwzeBObRE1vvzhJxLiKz4S7M24hfL4vb3g1MWrOvYoWJbcWlWW RhyJ21+jF9EHPyQO1yVRA+30xEEfjDcWvVH0bq15xrTA5/vCJWG3lEJmOlvW9xZdXu9E bQ== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3p8ge2uc4m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 13 Mar 2023 09:32:12 +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 32D7PpAp007433; Mon, 13 Mar 2023 09:32:11 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2175.outbound.protection.outlook.com [104.47.56.175]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3p8g3b5g2h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 13 Mar 2023 09:32:11 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=d7xRbXvEqLeJuIR7peVSklzAWA+8B6vU1vAVJU0YH+qUyfWmsu1pQMv96I3TPpF3EXKbtrRuXk1eM2RJ6juSo1DFDo30dWWWlB/Li9GJ2ikP5JeDJ71T5Vva2hUPrIWAtdYbcWqFoqkWIyVbQiNtaNls/zfl8Ayp7/zJXfFB608nxAJGMdybiXMz01KZFarpAEwBbPN+16EFnKJ9sXzcfJn4G/yjCLvo4q6WT+a0ttvpo7Ux06uv+21928kKIkszvJ7Q5IMb1Tlv1uLhwK5x4TMsb3RTPnDcc/WlqcisB8xcGZuW/F2u8xEOlwdXooiEUkpRbKO84exm503XwRk0SQ== 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=U8OQIcM/QiPlp1pT8Jjlegf2grbMxMXJR3uP3VXQa4ciw9BezpoNWcT+avSbRQOp5dbp+3L0ietMhARmBc/MMV6SDmrhUcbT5rJHqsIjUvB7wRskarwAYFDQ6MhI9fCzYVVv7WdqGLDWfnXmgPbvBV/dS7zmpEOcRK5LzejfARNLrI8UqkyefTRjsUjDa599p5zUO+3szLjnflSbaXjcOhBHSMxk1OX1wpbvzAaNfWPBVE0Qm7/rDc9mAfQkDK3Gj6RS5Rhk5nmyizmBSgAiFQa3AhvOkLHK/UTimF9RD6viz6DhNHeVYu4wh0cz3ckpQTmX3Ns5abJCJCHjhuEflw== 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=SXx8qe4/yfN8sdFQbc1NcQCT0gmHueSq9PD4lyY1Tdh9ISHm8pDgO3aXjccPZd94/girC0cLPc66YLxuCtTJvxXAlx73rwVc/NIFIeGSaE4VyjQCEqMOtrhNQkMMaInJljnmx5zTn0lRH2l9AvYlCGNqPLn2h3B08Ow4gGXkkQ8= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by SN7PR10MB7048.namprd10.prod.outlook.com (2603:10b6:806:347::21) 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 09:32:09 +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 09:32:08 +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 RESEND v2 11/11] scsi: scsi_debug: Add poll mode deferred completions to statistics Date: Mon, 13 Mar 2023 09:31:14 +0000 Message-Id: <20230313093114.1498305-12-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230313093114.1498305-1-john.g.garry@oracle.com> References: <20230313093114.1498305-1-john.g.garry@oracle.com> X-ClientProxiedBy: LO2P123CA0075.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:138::8) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|SN7PR10MB7048:EE_ X-MS-Office365-Filtering-Correlation-Id: bbfd535b-a787-47cf-a741-08db23a5d0f3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6aQInVxRCWB8zWfEhDinIDJoba7c6SGTYQiGRhaPKlRYHHr8UXB/l7PtmJNyVbi2G/W4PGQ4cYbSZPlkJeuIKcUXv7f1v7WvI4VFswG0wlBETGppvOy7xbhyn4WKMIZ7QSoqltqlDa5ETlei/eJED8eS4rUjUg1OOMkSFTzBqeFTjEWVkqrCpaoowXhTa6Mc7hwYiLuFumE+dEEYIqPAM+k+JwYUgdnhnM6/d2wKyNpb4Gne5JsBEyRj3fFJlV3rJvhvS5B9Rkm6wyuIazD5eOsIIqiseecWiT1Oji9pqRCcYw2s3rwzh8BQw4U0O7P56YsQ8pdupljMA/fHViVlAajZO6rN8pmVQjCHdyTIxDaY8NUHFqNhfoVa91wYSZLlX8Rc0X4eLjQjdKRvcFQxlWZW+iGoIsDCXByvNJZehTl1f3SAR4SOoMlKyw2ajyj3nUb1PfVaqXPi0Wl3zmcBz9zKsaaeZrGOVl8202sDz012+qRXEFIRdbZwJHExOIa2ppf54PlOpZE6b3unvVm4K/9d5dUhqh0preezmLjprQ8aoLlNe6vXfHJ4Lah2aRbLVZhB2ZGJk5A6wF04M9R3E9zZWbdZ98JaVR3TLYW7iku4paj3q/5mTXHSJiQ7oauvTrHL9PybEqpo9qEkciuFuQ== 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)(39860400002)(346002)(396003)(136003)(376002)(366004)(451199018)(2616005)(186003)(6506007)(26005)(1076003)(6512007)(103116003)(6486002)(478600001)(83380400001)(6636002)(316002)(2906002)(41300700001)(8676002)(66476007)(66556008)(86362001)(4326008)(66946007)(8936002)(6666004)(107886003)(36756003)(5660300002)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 8wDt/idR29r3P5Fi9/CunsAbuKcxJnpZprLIrpfNlFebSDqdsYL9VevkiXX7J8eXZ6CYz80WkNTSNjSPN+xuJh/5Rr7w4YlP31quJALo4omPf6QxYfR9LmQ8ggY5oiIWpaX1/WQUZfUrR+Z3gAl1dI2mCuQeMlPVgICj0kPuveS/DnUgtZdiyvYJv/Ch4f8qKKmhWMFmbgLws0IR/9h3KHFpPaxwaY3ko9gz6NCnb7RtWgpizkISPuFS+W36TZwqkuOmcUaBrnP33UXwRzdLvqrYZPBqFMXqXsGz3pJ4BHfgEglB8Qc7L8cU6qdiJziHgESWe2JNOT/0XMjQtz6Zyo4Amu4tgo5pg/1y6zywG/3Vb/6FuVDvtvEHw1FeknFYSZg4bJlzUOklJ3PGmsRug2J9dWgVY/iexX9bhBuHZ9aaW4yb5fhvzfihSLdFa/YTrDnybeHe8c6qfUBDrCD4DIR17kQa/l3e2f3QtYP3KV+rLBviSTYrlP6YnF2swmSh4Dj2OoR/z3riOUdPiUIkQujYyyfdy0pmZ2PVg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Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 9eaxylGaKHZ5xP+VE10XyXbupyyms9BvhLJnn18aS4L6ZcQYnCyWbKBLvT3vBVbW06Z2KZJhC1rwyhrbnXeWnoG1XenTWgbh5fpT3JFMvn2wK3WEEARAJHK6ZegAwa8zzP6UP+Qd5YRoSxY6ndU6r89fDlJiQZrABHQ3WhHtH02DW9KxsWmZ2FfBjWjh7cvC7q6oHeHLhuRLHo+0S6i5wu6uJ4s1qC739N2TPbvVgRQhUOv7C4JWPLb/W2aWUVXgPiLucKNO6bHfBND6+uDanYXo+ILMEzViqrXO937IynJLKCfDhNbEMlbhCjt+4yi9UU2kwbubgmiKskKi+AlgWk3Vsi2Bl8NmSms1aVmQMhOITEXj+tJsgpFjgbjEhlYvrwpJbtKi0tjwzLF5UOdALt4oIaEEC3HfoGcCNwRdrmiYKbNWGlG/G2xTrT8iEc/ij/rMBCmplanKPmMx84TfEHe5aXYQt+XQCUsLDaS9tm/lZCSLJq0MVijMJPcAqLn8JjrgJG4V6aPt/dHkoXcARHfJTaO0J+Lnh0jo0ac8S09kEwVOk+I3ppnvu2BVxVkndFF58ETBu8Bj/QGM6hiu4YugnmJW2twSi7zSrNKAkyPUJ2rVOVDYG2bUkIwD7uOXqJb8SQHKR+p/CG/NxE7Vt8yNWnX7c/fLyArSKFdyg7YehFYIVChDonwywZ1rk32ZCBIuUMH2HlFMWOdryanUNZoywDP2aO1050iwexeOdsrwAG/QJQ+3ahcYSW/7oFhJbrip1BhlEH6DcvIdAvqTMYDHKz/ZZhG6jrk5dxU0idxCfXfsYp8tSGt3Vkn2zV99EstLehTdQ+vlYr0YpVBD9EmHnlobthnB81ZutoUXr9M= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: bbfd535b-a787-47cf-a741-08db23a5d0f3 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Mar 2023 09:32:08.6199 (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: 6EKN1ity3l7qjeSQ2cI0UgXwygxYDX3vULtBPxK93ocfoK0qTxmBiQAcF4K+UKpIuwx6Sryt+4AvrX3bb/N5Sw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR10MB7048 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_02,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-2303130077 X-Proofpoint-GUID: vAwTx6WtlGugOwCUGLogDmpfMiZSuRRF X-Proofpoint-ORIG-GUID: vAwTx6WtlGugOwCUGLogDmpfMiZSuRRF 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);