From patchwork Sat Feb 27 16:59:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 388357 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4B1D6C433E6 for ; Sat, 27 Feb 2021 17:09:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1400A64E86 for ; Sat, 27 Feb 2021 17:09:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230333AbhB0RIp (ORCPT ); Sat, 27 Feb 2021 12:08:45 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:47930 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230195AbhB0RCI (ORCPT ); Sat, 27 Feb 2021 12:02:08 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11RGxaKH178656; Sat, 27 Feb 2021 17:00:19 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-2020-01-29; bh=YifcLh0il3TAoAtiSTT8Q8kHskbGL/+3duj92Vi8qB4=; b=o+Q820ZqLyxC7aZuLCN+2ue3erc6gnL6DulMXD9iyBephbfM6HwuI8O+cnJkSK1OATs9 sJGDgWbXuGLYyhyRfTHic/hXUh900wkgkj5DvSh9Qj6W2wgDTxdgAzYmKo8WuH2mrb7N kzbsGOg2gQcxE1VK7ISk8m0BgYis7rVSXpzgXY6V/vd3MSpqfVKlA+E19SbPFKUz4FZ6 wbQJ8FbRLz7r2LS4zkYcC46OeVpgh6A4C3rbqP1IFq8tiTHNG19ZUY8ctEBK6m62Xegy s7G5OwiOKODqsaafQIFt8h1rZHorr00kzWNDXvFmLSwHnBppn/YoDxqKw43eKTDKF9EU vA== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2120.oracle.com with ESMTP id 36yeqmrpsn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 27 Feb 2021 17:00:19 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11RGslmV115709; Sat, 27 Feb 2021 17:00:18 GMT Received: from nam04-dm6-obe.outbound.protection.outlook.com (mail-dm6nam08lp2046.outbound.protection.outlook.com [104.47.73.46]) by aserp3030.oracle.com with ESMTP id 36yc4a7jaw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 27 Feb 2021 17:00:18 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=K3P8qiXTPqupabMoHkplUaN40vlgNWBW77OxAbBmtvDalWdsZdDklBtMyaaa9eXfow4sAl9oDyt9z8zVO3hrqZbC1ivvoir7E56HjQ1+ut4AtSstlPPA8zIfZMtRtEJv4s0Q5UG8HLRqPn1fSLpoXXrNojkt1oDHP42cGmRNpyNxtzfAbDuZ8+aontJm9Vg9/NzxVc5VnOqEsGXcJ3zKNcBLENYKXAuZrVwfmGUvg5yh5BrIz0P5YWRTNjlVfWvVdOQDPnczNPnRkM6mRK/l9CG+zPSruCoKJdHZwlFgp1kwITJ57Tg936UMpONVopsBEvkVS4La9+XzfvDaqBhjSg== 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-SenderADCheck; bh=YifcLh0il3TAoAtiSTT8Q8kHskbGL/+3duj92Vi8qB4=; b=J4iNC+V1nLUZDD+bK+CNvb1LUYa/caghpXjaLCaBeiq4F929MCXGdMfVt40HuPztXT566Rl49VRrzNpv2lvRlJgs5YX0RdnXIfWTXP3Z7C/j6DqbQmRgsdN4O6bqVkewBWBXQUq2ByjFMea7USbBvvjQ0eoaP64sIasU4NE+r6yagmk4XWWHClSiyEBjQEtDW9bORkW0QLutxTgkWXBsuAQjBMXlO8rUM+Bgx7vKlGoqRzY7DQcVSIIPRO2eWoXJXMsR7ugp5P87dC9OCy/ik0JzjeMEyUwVORjljrnc+5PiAcZXxxQDO6vWXdV8HgtGaqj70G5aAZurB0Kh98yJrg== 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=YifcLh0il3TAoAtiSTT8Q8kHskbGL/+3duj92Vi8qB4=; b=JJEnRfHTcx4p0cTEhbiwWV6soF3NiiSdJnSqZyfestQpjrBBxSFG0eyx8XhAlFb3AO8lQtB8d8z/MBMSJ9NxN7E8nKhuynCWvjY3+UTHPyVI3ErihD6zQbVMg9vm9Kh2uo/v+G63dFJvDgxdoDBerC23KrPHNeieHQs2eDL+sc4= Authentication-Results: gmail.com; dkim=none (message not signed) header.d=none; gmail.com; dmarc=none action=none header.from=oracle.com; Received: from DM6PR10MB3577.namprd10.prod.outlook.com (2603:10b6:5:152::16) by DM6PR10MB3499.namprd10.prod.outlook.com (2603:10b6:5:178::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.22; Sat, 27 Feb 2021 17:00:16 +0000 Received: from DM6PR10MB3577.namprd10.prod.outlook.com ([fe80::5120:8a97:3547:bc3b]) by DM6PR10MB3577.namprd10.prod.outlook.com ([fe80::5120:8a97:3547:bc3b%7]) with mapi id 15.20.3868.034; Sat, 27 Feb 2021 17:00:16 +0000 From: Mike Christie To: bostroesser@gmail.com, mst@redhat.com, stefanha@redhat.com, Chaitanya.Kulkarni@wdc.com, hch@lst.de, loberman@redhat.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org Cc: Mike Christie , Himanshu Madhani Subject: [PATCH 01/25] target: move t_task_cdb initialization Date: Sat, 27 Feb 2021 10:59:42 -0600 Message-Id: <20210227170006.5077-2-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210227170006.5077-1-michael.christie@oracle.com> References: <20210227170006.5077-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: CH0PR13CA0027.namprd13.prod.outlook.com (2603:10b6:610:b1::32) To DM6PR10MB3577.namprd10.prod.outlook.com (2603:10b6:5:152::16) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by CH0PR13CA0027.namprd13.prod.outlook.com (2603:10b6:610:b1::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.13 via Frontend Transport; Sat, 27 Feb 2021 17:00:15 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 39d8bdae-a000-4739-a7bd-08d8db4127a2 X-MS-TrafficTypeDiagnostic: DM6PR10MB3499: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6790; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: z3bLMhVYftVUzPBHV6ObZWaU2AMkdzz0NvvYFtA6+tbmeWsgP50bA6GbuBnmgnNCScqUoPaBygIkH2oINvL7RPjX7zZBbRo7Ms7k+2FFIFQupv+0I86wsrgciCdp3h5Jp9IZpJ00gGYM9bbWeIlgQN/P4GGTIc/XpSdFmluPSSGHGJcbiiSzvARbqHUOLcB6ejsl2XjHUuL3rLtUsMZhAOgDWZPtqKJuaOrBnDHGIYAvhfSesvIFSbXLbjUcAadULRtYEk+OOIJe6vn+tJMeEPUwmnceF0uqmkLlj7eXqTsRIYuE0/XERjGWyrfX5swhiQVzvoaKIQLtCPLVil4wUAjjyHqPumvQLmN2ZUloiwO5NhVMToWf+xbqvgieuLpcDr+/yBT0KuC8uT34349x1SP3As6+kwbxQVuCBIxztNlBDZcoEODCteRf49Cj2qtfCMuu93L2Th+6OQ0MwW7DIUfhcazQ3aFzUCecJvax9IwhgdV9j8+EkcK5M7DW+jmai6MmCAfd6w3WHYaLRllFuME3d663J8U+DzhGZyfCWViuMMmIZuwkMqJULckwRqrBWegNYfyU+jPjtnIeY+8T0g== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR10MB3577.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(136003)(39860400002)(376002)(396003)(366004)(346002)(6666004)(956004)(36756003)(316002)(6512007)(86362001)(69590400012)(6506007)(1076003)(8936002)(83380400001)(2616005)(478600001)(2906002)(4326008)(186003)(16526019)(66556008)(5660300002)(66946007)(6486002)(66476007)(54906003)(8676002)(107886003)(26005)(52116002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: +kenI56dpK9K/BEtFd8BST3xHA6ZRxGShMMru3lu/RmU8tdEBgVOv29z4DXyedA5iJiN/JEJYlNUOUjTzpXxPGOIeVue89KqP47FRJSmorCmd5ttghlKGp4WKi9Aae3IuHQrrOkzqVC1Rm0dN7ZphCdp6N+DT4lAUlQx6GKFmN+UE39QKSO1sXeNmTtXEyJFHqXFXMu+o6aJ9sJQYPLF9ZaBe3Gsg4Kj2tvpNqNTe7kmx06baUvuBX3961sFKOU4cb0yTfVEgMh6+Mrlqy/fJGLgB0RWsAFo0B8hfNqXIDz3TVHV0VJRtCo/StLcBtx7YTVgKrBmPMEVufvYEHgrPFaR1OY44FUyBNk3JAvHlT5hhkTL1XkweEfnLO+8wEkJ5cbSf3USnzc/nIinZt1k1GCx0kwmVQrkw+oo5r4Q83yWVrA0DzveM6JXGg1ICOhMmEXJvmAy2Z/YDTegHQw2keQEs/i55WM7BpqI/gLdq2/3CJ4MP5uyGSIZpCG8+alNCOFOlzKrCItDv8VEmI+jDCrLqYWqRt64pncydxVKYPfyGaprNadkeG1ANGRRj8qPR1e+vaP8UaY5XbOVZp5YHOWob0yC+FrWuXEu1Gjf117yUmcQQ/Ko9N5ZZQc/jt4OcUkb3WV+n0LB7shu+71XUFqvW5IMNZ7HivIYfBJmv02OOCWtrWGEY9BcAlohe3DfPXeS+66dyqvoZLESEqv0k26gIl5zL/X1MC7QSfj6N5UAyfZ5084GF2tum3N5CDJ30x7Wt5lnVTQNtTYIG5qBRR93OILtiJnMWNhjY1bax0BxA4ZCNVxo6owkjQCQs/WuIS3DRu16fSlAwVm9e3Q3t32PWaaTl3GPQOleYtyzy6yqsJu/cCYEn30H1ZHAdf84wirMs3sOaKt5jbtdy7zbjTmn0y8XySRY/20z460M9NspOLKecli7LW6p2dXGAo4BVYB0ngH1MN9f8XDQy5wkNmUBBIknI6NCZnbbK/w0Psguh3OoRMo0VCoXHST5SvJDmGcoe6OEw+FIHU4mJYfmMjTScz1AlkEUA0KJSRC52ZLUPKWdM7CM4b1zUgZxmENhyt3US+iIhnvSRfHt81YFBFygQFBVnv4bKHsUetlxDid8BYDPonkMgTymoWetefQyc1kNEmyJOgIg2G3zFlsOTJ6xdd/H8aKTD33CUKLdtY770RA9iDI5jqLz/fTp7b0vOag/z+iQmwewZxsll5ZjeATGOFtmEBnimlCYXGiB40kCUwcDCv25UkorBT7WDUn+OlwybhAODs0mY4zvJOJN+WQVlWbXS3ZwYVf7XJhkPulLiM1CjTf28j6eg/juzc0V X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 39d8bdae-a000-4739-a7bd-08d8db4127a2 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB3577.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Feb 2021 17:00:15.8952 (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: OseskYHd6ZFHQ0weMeU0dC7NL2rFX3QVn8vJX2rh90ve9xPi2KlnqZCEarnA/UegXL9eiYkIw70QppnIJBlIkHzHHusgNzfIPC94eadxu9g= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB3499 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9908 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 adultscore=0 malwarescore=0 phishscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102270145 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9908 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 clxscore=1015 priorityscore=1501 mlxlogscore=999 suspectscore=0 malwarescore=0 impostorscore=0 bulkscore=0 adultscore=0 mlxscore=0 phishscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102270146 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org The next patch splits target_submit_cmd_map_sgls so the initialization and submission part can be called at different times. If the init part fails we can reference the t_task_cdb early in some of the logging and tracing code. This moves it to transport_init_se_cmd so we don't hit NULL pointer crashes. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig Reviewed-by: Himanshu Madhani Tested-by: Laurence Oberman --- drivers/target/target_core_transport.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index d47bfd8b0f87..5c4adde96d5e 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@ -1389,6 +1389,7 @@ void transport_init_se_cmd( INIT_WORK(&cmd->work, NULL); kref_init(&cmd->cmd_kref); + cmd->t_task_cdb = &cmd->__t_task_cdb[0]; cmd->se_tfo = tfo; cmd->se_sess = se_sess; cmd->data_length = data_length; @@ -1430,7 +1431,6 @@ target_cmd_init_cdb(struct se_cmd *cmd, unsigned char *cdb) { sense_reason_t ret; - cmd->t_task_cdb = &cmd->__t_task_cdb[0]; /* * Ensure that the received CDB is less than the max (252 + 8) bytes * for VARIABLE_LENGTH_CMD From patchwork Sat Feb 27 16:59:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 388359 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 30F9FC433DB for ; Sat, 27 Feb 2021 17:08:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0675D64E86 for ; Sat, 27 Feb 2021 17:08:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230019AbhB0RH1 (ORCPT ); Sat, 27 Feb 2021 12:07:27 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:46620 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230209AbhB0RCH (ORCPT ); Sat, 27 Feb 2021 12:02:07 -0500 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11RGxiNX033057; Sat, 27 Feb 2021 17:00:23 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-2020-01-29; bh=IIGvzMJTnj7LCDuzrwvw4HdY5QbD9p3SIVclTcSvc3s=; b=f9zcMFJApVwiZUeoFAHVbAObJuFIJ33kCDgaWrB9g6kouRnE8hh5d71/9KavXUyOyzBa n0uddyTodYuwGElOo906UUOXRufe0brjVc3pFBPCbYfwU3c/e4C28Iw5XupEgF+pypYn G4qSGM0w8CcdIqeUPFaZAmKOswxF0tkT/uojYpuqw68lLpS1yyqHP6/D1nrQrtTiG2f9 loZWOm5ozckXwVWMAUzrAphq13YRXWeBMMVRlj+AQs2m/X3cis/FOlgdPaKaRnyLII8d 53ea/auWqSE8Sj5pLos8mEHOgGdKhqIepG1wR3+UQHQ3WIf1pTbjgKD0NRg2Al+EnuoI cw== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by aserp2130.oracle.com with ESMTP id 36ybkb0v3s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 27 Feb 2021 17:00:23 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11RGslma115709; Sat, 27 Feb 2021 17:00:23 GMT Received: from nam04-dm6-obe.outbound.protection.outlook.com (mail-dm6nam08lp2046.outbound.protection.outlook.com [104.47.73.46]) by aserp3030.oracle.com with ESMTP id 36yc4a7jaw-6 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 27 Feb 2021 17:00:23 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=l4u+mqCeh2rdNubStj/L++bny7x6/FrBBwyA9p2KcfRNydvrahpFFggFzJL3iM1tckaE01dUVdNYUq7MOR8JZFN90L5pW2hmHK9VeLs3IGnKtCK8kCn/vP2Whsm7PuEwPYzLPjGK992RfK5SqTy7DdgI52fjAFQqa4op582Jb9DnG2FbOtUDW6eotIVgVLo6BoNCj4GJPHgZ0kiRneqBzaRqKY9RNvQGyedu6Xd6qHySajPk/EFxlz+UgjkO4JSdXj9oJZB271McktDZ08oph/NZNli9OMLKq3PKsDJn9tmYrOti+jMoYg+BsTj65SxAtSJJjrf7riuaEd5ieFXqrw== 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-SenderADCheck; bh=IIGvzMJTnj7LCDuzrwvw4HdY5QbD9p3SIVclTcSvc3s=; b=UFGO10L0IdiKUiD6Xwvcyd1LKV5PKylD8Pt0Y8uQ00svrWxfvQPMWbAZSdYCK1/e4KyEmKhMhmBPeuYJl+B31wQlGjSvxbOaO8BiqVabduPFglNwR1LsQnqzTVphvwMDdEdPm6xOnnW2XPvjlb2opG3BFRlm2EdfE7SBLq7xnxREJHDtePca6G3zNTxmMXo2J/4I6MkMB1KLYRdN6NqS099CIZGoR3V7GkB0TDoyH/Yy7Jvv+PXm4I9rQ/Y4pahNTVOaxpwquTm+AZ9RBlqtzDwy7YG75AQ507qsSsnITr8gM2E4pMKu23IpXG/u9jckE9RWP6/EUzFQ6+LYQEnI8A== 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=IIGvzMJTnj7LCDuzrwvw4HdY5QbD9p3SIVclTcSvc3s=; b=ntYmpVG7VHm66TO65Or1GlOhRz5D+sBX1Uui5h87mUYlE+L5RPZzLCCZbA1BSJArBc+QOO5mtVDIU2/a9vW0a/QLiiGPR92qswcyWmnb7SSOje5qO5FfVhNyCIlEzvI8OhpK6N5yDeYK3nFf4BNOxUwbEL1PuZtX5xW2rw5obfM= Authentication-Results: gmail.com; dkim=none (message not signed) header.d=none; gmail.com; dmarc=none action=none header.from=oracle.com; Received: from DM6PR10MB3577.namprd10.prod.outlook.com (2603:10b6:5:152::16) by DM6PR10MB3499.namprd10.prod.outlook.com (2603:10b6:5:178::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.22; Sat, 27 Feb 2021 17:00:21 +0000 Received: from DM6PR10MB3577.namprd10.prod.outlook.com ([fe80::5120:8a97:3547:bc3b]) by DM6PR10MB3577.namprd10.prod.outlook.com ([fe80::5120:8a97:3547:bc3b%7]) with mapi id 15.20.3868.034; Sat, 27 Feb 2021 17:00:19 +0000 From: Mike Christie To: bostroesser@gmail.com, mst@redhat.com, stefanha@redhat.com, Chaitanya.Kulkarni@wdc.com, hch@lst.de, loberman@redhat.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org Cc: Mike Christie , Bart Van Assche Subject: [PATCH 05/25] srpt: Convert to new submission API Date: Sat, 27 Feb 2021 10:59:46 -0600 Message-Id: <20210227170006.5077-6-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210227170006.5077-1-michael.christie@oracle.com> References: <20210227170006.5077-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: CH0PR13CA0027.namprd13.prod.outlook.com (2603:10b6:610:b1::32) To DM6PR10MB3577.namprd10.prod.outlook.com (2603:10b6:5:152::16) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by CH0PR13CA0027.namprd13.prod.outlook.com (2603:10b6:610:b1::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.13 via Frontend Transport; Sat, 27 Feb 2021 17:00:19 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d1f86892-d377-4d74-dd79-08d8db4129fe X-MS-TrafficTypeDiagnostic: DM6PR10MB3499: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3276; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vcR1CJWPpDmWEb2h98lCbu/1xUmoHoWDcxCHxsrw/rNKGPvisyXyM7RCqAc6NakOD9E51MidvfSKA+XlaX/4bZeud5TBxUH+JMeeU24Llsf0pjsN0unz+GRM2UMz/XGeMTbdw6pTpb9B/WnM8m/kIlS3/ZZEaQLMitdIcRKy4olN/DkiOzw+PYP/mOZGvKQigQE7B7ZgcrYN5bKvGJTjkJMzejS6p+JLOpGBAuPoeS0vwr3jAajmI+SiHpwE+p9djrMNtM2wfjvRgpQcAx9F/8SERIlDgg/h/ySLpoXTPFLh9utIpolbjJEa/9OIkOI3aoZjPS8zQGZ5BGm2TLALTjx5DM4m5qnrNONQmuGcxlFXaDKbHfzE3RArBUzHbmmGBohsSa9BL3JmLQ/kCBpdyAfpiNgOOT+NtcepYKmnio/DSTNue0WhQTKEgEJ4oJ4OmNcyHgFtKaPw+y+9156IfZf2+IEmgiufjSphGwpfztkrlMSnV5/1ij0btUlwb7eOq+XwEufZy70YMbReaa8YeFvG9lgTv6GK7BRxJFG/Af+/lX1KtKnRGrhU9AH3VHOY4l9yxrc1b7LpLNi/ZjFUTw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR10MB3577.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(136003)(39860400002)(376002)(396003)(366004)(346002)(6666004)(956004)(36756003)(316002)(6512007)(86362001)(69590400012)(6506007)(1076003)(8936002)(83380400001)(2616005)(478600001)(2906002)(4326008)(186003)(16526019)(66556008)(5660300002)(66946007)(6486002)(66476007)(54906003)(8676002)(26005)(52116002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 2GUC+fjpUZyonBc+xbH/oDdz+xWm9PUbltgeTAQwx9V9R0Me98EAr/0PJV0nggRlFVhgwOxra0nnVHlJUT7+/CoOS136rPyD6ib0NV3onVtz4eBgWXiMV2DpnguiX5KU5Gpe/gTSJriY34D/P6waSvS26rWtXiCOZj0Cah8U6JMzVT5TS3B/AAE6n8hCxKCq6xc5iCThyAmUtps3QqMVy6efYp2bbqd+ET76yaTVlFeYf45Oegki60QF6pkEs1MUr1yABmgerCeNCXAhmiZRADFiihLBLXc5ler1Ch4DWjXLSR6siuZDhWLTZ6uBfiA3XKWtoIGJb2fBElrmvEfz9fZV+QNdIsDScCVYzOt8FoffWmPuYj998PWFKHz4IBndEunZwWzzFtAOOtel0LJvDg7SCiuKgSeIaFfR0tZpCcFh8hbpS2ZCnDHfVCOX8saobnShoYOxtp5EBq2lJCKoEZz6ULt+tu5VwlHGi8JCvSf3p/tn/6em7KQ/Tq9Rk1+I6mMOZ02L9YYBe9PlAW8N8mmRCfchx8xDpvQShiAJpDd6cUG6kMxusIcQOZintm2jQJZD2qjO8uALA7EebtoWxLQUjQAPti0w6x/SVkVnARoyOuPnpkOpmYA1TVJ0B3+93Gl5wuLGM9Qr//VNZTL5osQBCyeNDbPnqUF3KpEsJCqUBB5zMXUDxKypJJ75+9v/DDipnngzBxbOmf+Jdk3pFigGwen5ptJNGkyWEX+fKCtWAHKfJ5IDn6+/uR3jQQBtuqGOhT0ERB10yfRe4L3OBEe99mzLQM/68TwK5Tmuq+wwzIGBwRH3xt3BMq6UdjO95DvJH9WZ8S7SxZwCema1FPpcVqAnOsmzW4Pd8HdtrdmmRvXfcqC8blk9hcoa8Rhv6qdEH1i6yn98/px4YhHYeVYBgulQcKJbyTFxAQKcvmQYB172AsZYtU5Qgq2wzQGHsn+/xoE7VQ4uDMXgc+m88ddqaVPeZPPJfrdETN6nt7Z7pJi8FuVb5C+VjL16faIx5NU4j88D/xuuHmIp4sATEuuApeDtdv9cDQ5aoQuuCYWC5C7oYgXz3vrz29FxQXtD/LJE+TKgFrfAWaarTKQf5ll88ihv8iXi3UfOIpn/IFUnRDx8ZOAoLFOuHnar2JbrlmyRQqLnlX1ZETadiKCLU5dLLXsiy9y9kInsKkWksld6QKIHdj35jmM9TZntDuaZEqQJNF3B9wXcOdIYW8/C6bJ/DwafQWOKHVz7YClU0vgMgFwM4VaXThZgpFOitOgWg/J4UqRjx5s7/BeWSnkv69WtS2NhHWFG9AsalbOim4avGjIkJWKZICRQ1lmIc4Wa X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: d1f86892-d377-4d74-dd79-08d8db4129fe X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB3577.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Feb 2021 17:00:19.8550 (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: pRY2HtYRKEsZlTLna71+W6RvzNlB4/U5eiVSXJ6Wglf5qLy95bGUbLOdZVWIcYdW275Jqf8IFbsRLiz5WfVSkBt0XFSfBvFMzvlV6X1RtFg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB3499 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9908 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 adultscore=0 malwarescore=0 phishscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102270145 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9908 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 impostorscore=0 suspectscore=0 phishscore=0 bulkscore=0 mlxscore=0 lowpriorityscore=0 clxscore=1015 mlxlogscore=999 adultscore=0 malwarescore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102270146 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org target_submit_cmd_map_sgls is being removed, so convert srpt to the new submission API. srpt uses target_stop_session to sync session shutdown with lio core, so we use target_init_cmd/target_submit_prep/target_submit, because target_init_cmd will detect the target_stop_session call and return an error. Cc: Bart Van Assche Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig Reviewed-by: Bart Van Assche --- drivers/infiniband/ulp/srpt/ib_srpt.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c index 6be60aa5ffe2..87741e0b4bca 100644 --- a/drivers/infiniband/ulp/srpt/ib_srpt.c +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c @@ -1528,16 +1528,19 @@ static void srpt_handle_cmd(struct srpt_rdma_ch *ch, goto busy; } - rc = target_submit_cmd_map_sgls(cmd, ch->sess, srp_cmd->cdb, - &send_ioctx->sense_data[0], - scsilun_to_int(&srp_cmd->lun), data_len, - TCM_SIMPLE_TAG, dir, TARGET_SCF_ACK_KREF, - sg, sg_cnt, NULL, 0, NULL, 0); + rc = target_init_cmd(cmd, ch->sess, &send_ioctx->sense_data[0], + scsilun_to_int(&srp_cmd->lun), data_len, + TCM_SIMPLE_TAG, dir, TARGET_SCF_ACK_KREF); if (rc != 0) { pr_debug("target_submit_cmd() returned %d for tag %#llx\n", rc, srp_cmd->tag); goto busy; } + + if (target_submit_prep(cmd, srp_cmd->cdb, sg, sg_cnt, NULL, 0, NULL, 0)) + return; + + target_submit(cmd); return; busy: From patchwork Sat Feb 27 16:59:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 388358 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 735E8C4332D for ; Sat, 27 Feb 2021 17:08:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5A24E64E99 for ; Sat, 27 Feb 2021 17:08:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230225AbhB0RHy (ORCPT ); Sat, 27 Feb 2021 12:07:54 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:46664 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230212AbhB0RCI (ORCPT ); Sat, 27 Feb 2021 12:02:08 -0500 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11RGx2pm030979; Sat, 27 Feb 2021 17:00:25 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-2020-01-29; bh=kl/EjnB9ZwBzqtChF9uf2wvKcrv+VSurCwCXDzlG5UY=; b=x+TqU33WLOe0QpsT49RZpUqGC09KgbO9BKeJtamcT9qpwRiUi/gP2kRB8d9I4CyvjZ3U tcm9frkkf/oIvTLJslH8TOyOwXXvJLyy6W/WhdAo/JmgTohrBY8Uztxie3kYe2k2zT+c 1j6RpQ5HQYWXweKX2WZRYBtvxK33ibYkEQGywrvKEM7EbkW5yQfdJbeuYQntcCGmFMzw jRZ2qBBw0vq4wnByodFE7xcrZUaA0yBnTT1pWcGECqlMAkN4HoYtgOODvGKpirzMkasN GkaWYqiOk+CqZq2M17Wrh2Nj6lqUvj8/LNU3ajqokSHPpPop72DkX7ykKW0r8jsbnRCu uw== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by aserp2130.oracle.com with ESMTP id 36ybkb0v3y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 27 Feb 2021 17:00:24 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11RGslmd115709; Sat, 27 Feb 2021 17:00:24 GMT Received: from nam04-dm6-obe.outbound.protection.outlook.com (mail-dm6nam08lp2046.outbound.protection.outlook.com [104.47.73.46]) by aserp3030.oracle.com with ESMTP id 36yc4a7jaw-8 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 27 Feb 2021 17:00:24 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jRB6mmr0x2W3S7wKd01KAzXVNbnZdo+M7qzzomieBOcfIS9VNGcJxsWPdEwUBrzh6bGMkXLdvBHSzCW6lsV8xxCbnH5iwphUTa3a2ZSb2wITFKUQvFVcSwdzHQ29sTaO048sBO5/ikEjHVbInghF4UK0pCYElZJAirbv8AxNs2dG38CEB/Hhf3iKAV4nrUnl3rfujPsgwrdbQoOOCEA0h8IjfVUkwdENZQxW/+X16Z+1bwPYv4LJfx9xAkRz1iI32g8VewQMVE8dmvAFyqUwuy3S4ihvAwgbHqhvuFnnS9zrXa05GnU8yTrRc4qXaoDX+pm76VohmN3bZEL0gy6Lrg== 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-SenderADCheck; bh=kl/EjnB9ZwBzqtChF9uf2wvKcrv+VSurCwCXDzlG5UY=; b=j2+St+vVIE45+2M7DGA4N9vyOatXGKrS5CVDo9yoZEUV69Uf8Hvs3s+ddx2lcu8h+VN/PGnHG6X3pwgRVZukkeLHIDKa7a4jLM8ee318OPqNqCz0Chkf5FJRUr/SvslQGeFgEM7Q7TPg56S5Kw0+EEoZ7dYominjl6uzoqR/5iKBAzvGc744lkBhNNPUMszJqSEefJCLbS5Tq0bsCeNVVHgB57ecMp70esj8bveptlvBGzMYzwsHdbijCjaqOUMP0bLE6SYu/xpm14WH1xhtnJW+irHo1T7Eo0HB71a18hTe5QNzBjj8CZKSr3XDRXaU+bWXZ0/upaHg2sBrPNEeVQ== 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=kl/EjnB9ZwBzqtChF9uf2wvKcrv+VSurCwCXDzlG5UY=; b=jOna4fW/RDEoDoIqvFjyBVDvbPG0Tk4du4NEDpTv7ZM0rboXGP8mKKCQxzwjJ44M6G7kU7VgCHYRK8dxgmSK2iAmCo+ITr7denro2A8e7yrlhgAcnHT7KjHeLGDh8aFusnBNqPPeAhPv7DV4SrFYyCJkhpwXo76X4C9xIwStuRs= Authentication-Results: gmail.com; dkim=none (message not signed) header.d=none; gmail.com; dmarc=none action=none header.from=oracle.com; Received: from DM6PR10MB3577.namprd10.prod.outlook.com (2603:10b6:5:152::16) by DM6PR10MB3499.namprd10.prod.outlook.com (2603:10b6:5:178::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.22; Sat, 27 Feb 2021 17:00:22 +0000 Received: from DM6PR10MB3577.namprd10.prod.outlook.com ([fe80::5120:8a97:3547:bc3b]) by DM6PR10MB3577.namprd10.prod.outlook.com ([fe80::5120:8a97:3547:bc3b%7]) with mapi id 15.20.3868.034; Sat, 27 Feb 2021 17:00:22 +0000 From: Mike Christie To: bostroesser@gmail.com, mst@redhat.com, stefanha@redhat.com, Chaitanya.Kulkarni@wdc.com, hch@lst.de, loberman@redhat.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org Cc: Mike Christie , Nilesh Javali , Himanshu Madhani Subject: [PATCH 07/25] qla2xxx: Convert to new submission API Date: Sat, 27 Feb 2021 10:59:48 -0600 Message-Id: <20210227170006.5077-8-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210227170006.5077-1-michael.christie@oracle.com> References: <20210227170006.5077-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: CH0PR13CA0027.namprd13.prod.outlook.com (2603:10b6:610:b1::32) To DM6PR10MB3577.namprd10.prod.outlook.com (2603:10b6:5:152::16) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by CH0PR13CA0027.namprd13.prod.outlook.com (2603:10b6:610:b1::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.13 via Frontend Transport; Sat, 27 Feb 2021 17:00:20 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 73076f53-e98c-4e9e-ec24-08d8db412b20 X-MS-TrafficTypeDiagnostic: DM6PR10MB3499: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2803; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: AMhJ6l4n4jsrI2YVu7qBR9yM1GUgWUsPlHgb54grFyussNzHZv2nzZpzSm5mWsHCwCK9D8/F8BTUJw/2M8OTVy/qV7SQ8bau6aSAIle23NHWSs0S4JCkhWXxWCg6L1D+hKkMmT5iLF8Hp07ajIWQaPYhN4xaFvJoil9bv0AqGWQToR5bBvNferiEkpnpZZqV5YYDD39kn/QxOaqzSORq4xy+oCSG5yNnXdZALVCDwIhfXeGrZjZ3XpY/K5mKS+k9x1DXGRvR2lkc0vrY4uZjvtN5ljPKT5gxaPuxbnNhmfCeICwycWwXs4GpLqA83hrNojpS5rSmd9Mqq7NCK90PDajbCDkXUMirnpytm4NWFvVbqVbdvQ9XLB342Ellz4nx7dJvx6hcWOdo5HpjYLMJWEChNFRoBxVt3yfblEG2SyEGlE4pqrzAqvm6AiJZxWBMcO6bKsHL29CjER5lmNuvKdH8phmweec3YzA/5MZjMGystZT+dxoJEPoBv6jQUu2xoUrQ35ajIr/blnPa4++vWpRwHalpTs1N/NWyt/1aRTZEI+JTrNdSUyV1su+uKXIUku8F2HZkGNm3hCU6zQQuIQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR10MB3577.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(136003)(39860400002)(376002)(396003)(366004)(346002)(6666004)(956004)(36756003)(316002)(6512007)(86362001)(69590400012)(6506007)(1076003)(8936002)(83380400001)(2616005)(478600001)(2906002)(4326008)(186003)(16526019)(66556008)(5660300002)(66946007)(6486002)(66476007)(54906003)(8676002)(107886003)(26005)(52116002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: Fev2Lw/9pfwS0aQ2yoRl8LP7ovY5GbQUKo1PoGzYQxc+0s8UysuRULqOQ219mPs9XlazeI6Pm/MV5fen1i51ScbVmcsn+0WujRSAIABACX7Zh3riycb0PsyF7aoTUq2rAayIV061FfFQSmvt5ZJ40sh0gqzf5AKk8TPIjS11Js5d6Hhqv4eLXh6w2vRPQrTOdPU+0m940hewYRNqsXUIG0uyLc1OSrKmXYCvmpBshvS1biA9cC68hMLVCfQy7StEuIDPk0JH0evT+NxuNkn8z5gsYcqybAmH5ErMfMytB326hJKjLpXq7Ph1ohJmsDUddsqkBnm33TMf47spYdguUWBwwGRbL1aww5tlMseuaUUBM1qCgkUa6360m082cFLgYuMrNfUEhjlWTaiVlgsFIrJYSTb3tMJNSrmAag8YyzmURLa1pEe+ZvC183OCJMCABaZhjVJTa1aP4kaOo8XBheB+sh94Qs+DghoX8/YSOq3uE2DagjxdQjt5H9023KN0nSfDnr7j2dHaX6AQMNaRjQ/zPktZydGYK3XfRvNMHuDNl0nSelc1pVJw29QV+3/IE7G/7Uj2B67eBG/C8hS+Wd57nrla4aZjlY3WAGesgxlNo07G6uLbRCmHs/7TAYTPuay4DbFCv5t3OpBF7zXs049IybsCaG8z52dYZx7E4fT1SZMmdBjoG6s6ZBsLgpb2nARoYfrVlw/8rVz+Qx0FSh1TzfGHRM6t6nW8x9tztjXAC5jsrJTXIp5Wh4wjAef1mVW+MEPw2e5ArNYUZbCnIKBPdisRwQUFq3YpN17EC3TDGdViPeDCnV+/hQ2BAu6IYHEsSLCafSNhzLm+rs7LKSxgq4vHLbdIdiFbAvbfH2QQHoI6p5Xi5YDG4bCBoDlHhqWKUMxHhSyc835y//WMZ9WE7LTNDDPxaqTSwHDb+0D8BG7CMd7qt6s13k4Fwn/lPzYgwnLlk4VUtCbKV6EllBT35I4PiZfMkX5dFKrKLh+YCRvwgDbc3ZfkClTIg8YM2wYNmVpWzz6wrBZXeNj6NHZNXgAMgflgf1V0ybqdqZ15ql+e2jT7o+JV9OL+3paqFEKXwS2kqqdfNrchsw2zefNaSDJSHFa0X04IxOLz38IBB9cZovJHI5YD4BkL3U3Cdg1okd5mcB1yTiacOstW9NCCYCLGhRnm4PShDIX0wCms6v0xrPvP5uRuPAw52/ueePnf3z20GJdIIUW8X4hTlwK6ym9dY1A8n08W+LX7HD0T6CTAx76rIVJT3wW+ht1mJSk6SCfJQqOiD/27YDRqxflSf/gnrKJhhqWEGqwyMO55CLAOve3crTPtvg8pW7sf X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 73076f53-e98c-4e9e-ec24-08d8db412b20 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB3577.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Feb 2021 17:00:21.7949 (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: sBmaYzsfbqx0CetZTRaVM5B8QLJAIFgZbtbV/MlRc2DjMNJswz7weCLZcZKKmCECfExa2iuR4NThvLDiPYwjaxf8dbTByrnFbt2AWN7tOGA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB3499 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9908 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 adultscore=0 malwarescore=0 phishscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102270145 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9908 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 impostorscore=0 suspectscore=0 phishscore=0 bulkscore=0 mlxscore=0 lowpriorityscore=0 clxscore=1015 mlxlogscore=999 adultscore=0 malwarescore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102270146 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org target_submit_cmd is now only for simple drivers that do their own sync during shutdown and do not use target_stop_session. tcm_qla2xxx uses target_stop_session to sync session shutdown with lio core, so we use target_init_cmd/target_submit_prep/target_submit, because target_init_cmd will detect the target_stop_session call and return an error. Cc: Nilesh Javali Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig Reviewed-by: Himanshu Madhani Tested-by: Laurence Oberman --- drivers/scsi/qla2xxx/tcm_qla2xxx.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c b/drivers/scsi/qla2xxx/tcm_qla2xxx.c index b55fc768a2a7..56394d901791 100644 --- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c +++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c @@ -451,7 +451,7 @@ static int tcm_qla2xxx_handle_cmd(scsi_qla_host_t *vha, struct qla_tgt_cmd *cmd, struct se_portal_group *se_tpg; struct tcm_qla2xxx_tpg *tpg; #endif - int target_flags = TARGET_SCF_ACK_KREF; + int rc, target_flags = TARGET_SCF_ACK_KREF; unsigned long flags; if (bidi) @@ -486,9 +486,17 @@ static int tcm_qla2xxx_handle_cmd(scsi_qla_host_t *vha, struct qla_tgt_cmd *cmd, list_add_tail(&cmd->sess_cmd_list, &sess->sess_cmd_list); spin_unlock_irqrestore(&sess->sess_cmd_lock, flags); - return target_submit_cmd(se_cmd, se_sess, cdb, &cmd->sense_buffer[0], - cmd->unpacked_lun, data_length, fcp_task_attr, - data_dir, target_flags); + rc = target_init_cmd(se_cmd, se_sess, &cmd->sense_buffer[0], + cmd->unpacked_lun, data_length, fcp_task_attr, + data_dir, target_flags); + if (rc) + return rc; + + if (target_submit_prep(se_cmd, cdb, NULL, 0, NULL, 0, NULL, 0)) + return 0; + + target_submit(se_cmd); + return 0; } static void tcm_qla2xxx_handle_data_work(struct work_struct *work) From patchwork Sat Feb 27 16:59:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 388355 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 47726C433DB for ; Sat, 27 Feb 2021 17:13:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 14D9364E85 for ; Sat, 27 Feb 2021 17:13:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230366AbhB0RLC (ORCPT ); Sat, 27 Feb 2021 12:11:02 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:49078 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230261AbhB0REG (ORCPT ); Sat, 27 Feb 2021 12:04:06 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11RGwf3a165579; Sat, 27 Feb 2021 17:00:26 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-2020-01-29; bh=REChbTM+nyS84aN3X8b0x4n2j/YKp8W1E93Zib/qGds=; b=L8jb+INnEUQEiy/B8Eqtle7rIMwmuTWECirmOBwbGy/dOS58yC8vX4zmcgTBzQzZ83+u SF65oZ7/VpPOQL2LqZ6VrMpfJK40rnWoP+HM1f0GIJNiT4wf9yD9bKcj4q6KIphLwiRa kMnzQVQExxBdXisQV+MtXtFjYfT/8m86Im7rN4VXvFNlRzcXNL9xivQhVkUGVUB9zX/B +JdKCE5QZiVzqnLdV9lB3BXQe4m+zSyiTIM55Pjtdey+W81RhpuyvPFdhLOyI3elzFEh 7T2IYevxuzZrcovF0GxR9UbwzzCNMg4xUB/hWUmQsHHbaTNSL5IJBmjMVlS3fLNXC775 Dg== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2120.oracle.com with ESMTP id 36yeqmrpsx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 27 Feb 2021 17:00:26 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11RGslmf115709; Sat, 27 Feb 2021 17:00:25 GMT Received: from nam04-dm6-obe.outbound.protection.outlook.com (mail-dm6nam08lp2046.outbound.protection.outlook.com [104.47.73.46]) by aserp3030.oracle.com with ESMTP id 36yc4a7jaw-10 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 27 Feb 2021 17:00:25 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=X88r/UGmM+e+jdWYSpyoUIJJVsbcnsddsH3C3hWXaD/+rwqy8hKR5ydN401xZ/NoyTgtIkKqLYMZZV76OvrAIoRSOkioSAwmoOr5G8H/nULXGtZ+VocpbdOeUQ9lfXMaGC08yzpwFvWQf0oFX4heN0925wkLGLjwRAB84FWhN5MyvTiQgVajMY1KvimtqJe1AK2TNFEwSQ6UvauMjAd948WdMH5P4nSWqd4PZU0Py3f4n/HLhDv3aKd1JHpZbJxzBLyTdpnHEFPSwqKkLzaeZAW0Z/VudX3x2oteht6HOsWidPUjhb03Rvjdfrhcu3Ob7zleSlCkbq+9f8zvCHdcEA== 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-SenderADCheck; bh=REChbTM+nyS84aN3X8b0x4n2j/YKp8W1E93Zib/qGds=; b=IMoCIuGeBntA60N3mRGU+FjCePCyCf2Gzvon4g7gUHOIps7StTs8aKw6sP7y9K2eHantkVJqVHSR7vrPPbuWDMIrnj58mNm/f7f1UxNfHamGCvm7t+5FVEW52cUtZ3n3mQ7IJnarc/RNJr7F09ck9O2XCF/2f8xa0k69wp8fhCqVo4lLkokxvVwvMxpk7XHuzSljOrka8s8ZbazHb28eCZUKM4n3GeZmWiLqqSgzg3hzKYYX9LObB4e0s2NYzn/7UQbprKvCi/DhCQg3Cr0xfn6FwTv8iQGTmPc83eGMTDDjqH3IMdlDR2+NRgQKObL+SSaYBQAvUZJoy8lOu2eQog== 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=REChbTM+nyS84aN3X8b0x4n2j/YKp8W1E93Zib/qGds=; b=p9D6x6gNbbS8BvJZ8+EoN7rFogQsZJFAEcV5WKIw10GE7Kr3P1Cx7+PAys0q0zon2DBYkIP0kziZjdhYdathJYXn8JEshba/ok2tXEw3pF4Jo8soJo1G55y7Gft8CSaOwqxFbbDWPbHUj17LbkN02wlglP4IoQQ/YWvMNBYVSEQ= Authentication-Results: gmail.com; dkim=none (message not signed) header.d=none; gmail.com; dmarc=none action=none header.from=oracle.com; Received: from DM6PR10MB3577.namprd10.prod.outlook.com (2603:10b6:5:152::16) by DM6PR10MB3499.namprd10.prod.outlook.com (2603:10b6:5:178::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.22; Sat, 27 Feb 2021 17:00:23 +0000 Received: from DM6PR10MB3577.namprd10.prod.outlook.com ([fe80::5120:8a97:3547:bc3b]) by DM6PR10MB3577.namprd10.prod.outlook.com ([fe80::5120:8a97:3547:bc3b%7]) with mapi id 15.20.3868.034; Sat, 27 Feb 2021 17:00:23 +0000 From: Mike Christie To: bostroesser@gmail.com, mst@redhat.com, stefanha@redhat.com, Chaitanya.Kulkarni@wdc.com, hch@lst.de, loberman@redhat.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org Cc: Mike Christie , Chris Boot Subject: [PATCH 09/25] sbp_target: Convert to new submission API Date: Sat, 27 Feb 2021 10:59:50 -0600 Message-Id: <20210227170006.5077-10-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210227170006.5077-1-michael.christie@oracle.com> References: <20210227170006.5077-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: CH0PR13CA0027.namprd13.prod.outlook.com (2603:10b6:610:b1::32) To DM6PR10MB3577.namprd10.prod.outlook.com (2603:10b6:5:152::16) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by CH0PR13CA0027.namprd13.prod.outlook.com (2603:10b6:610:b1::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.13 via Frontend Transport; Sat, 27 Feb 2021 17:00:22 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4236886b-f775-4b2d-fc11-08d8db412c30 X-MS-TrafficTypeDiagnostic: DM6PR10MB3499: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4303; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xxTYCKAGA0fvvBQ6ZtaiqglZt38Tu9pBXMkmfVWquBIznT8RWYh3mioMwxcOp4TiAwMj3jrOcgTrsopxPzV4AsZx1NNdiyq6QMX6d2XLTTNAeaxeZ9Pr5+aiZSt0hB2vFWkMCkyCmd/UQ+0+fJJwXrFEpIDPiEaJG8jbiOjipRdoPfYZ0+/nw8D7K+B040fc9BWU4rxyc5gQYRnf2XEtY3BuMpeUndmiklhsccIS7NBBmO48q5RELZ0AjRfmX4T2LUoXjCS73YemzGodJF0Hpf1gbs3wDAPzQFGU5gcMkbkNTfj9bGvA7b3UYHsFzm3shCqC/TdikDh+cJMKMHUjX5m7h8rs9eBc2vKFGwAzY63Al/z0yGSMggbaRAc0310FgIoO6AQ9Fjw2YEK3yLYc+pA8ACa9DnE+cWurvflYxr3KcUEfBKNUBov8NLi3+xGWx9ZedSh2UFt94Psw7OooCrCe8nfIgH/vSBg9nIdgU6njps9ntngfhGrRGWWBujMaUCa7usknnIcNJveuqb0XW74GxnCq5paRe4xKc5K1tJlbW69DxDxwJxbO5N+dsdOkYK9ikU29hlV8zk29bE/rmA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR10MB3577.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(136003)(39860400002)(376002)(396003)(366004)(346002)(6666004)(956004)(36756003)(316002)(6512007)(86362001)(69590400012)(6506007)(1076003)(8936002)(83380400001)(2616005)(478600001)(2906002)(4326008)(186003)(16526019)(66556008)(5660300002)(66946007)(6486002)(66476007)(54906003)(8676002)(26005)(52116002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: W9p1wKEQff3K8AeGHCMOO1KC8KVbrJlfe73spHy8jhlhoXhyj52hY1LafLVfkg1s08kXZrk03MsZSzeQazTnFWyzMKesA7GDzY43sjXyNUv2ecDIrWW9nqpMIWXYTLtTx7rBuzNR1RgFlZxFzJzFwGAnf/0lbQnFzZoU5NVj51LMIU3R9yCUMOatIdTpI1mBwAxv8kDHsvUTrpTzvgUfLXoid+pIG49X1XoaPIie1+aEuMr5xXOU8GBWnu93jqT7Vby16FT4OcHKGk4puN0EBsCKLG6YrRvyHgL5u4vNSby073OjSkw8kgThJLjZZ4DZmL9I0NpYrqCWfQXwI1j/1aXhmHXQsnYhx5axUn1RxSbKchbm+06ICpdhvX8PDeneViQo+5Pt0Kj1TYq9dK65E4ZRIBG1kDKXtmPRwn6avJEpgVX+WgkOGaKfAU7EgAsgm3UgUR6PmpWb0i0HEm8JOGbM76OkV0GMw6BQlxPn3wp/DjVFtzhc7a4bvmIG5XjI3iigzKgiW/auqJVNg+LGGz0zLmUazZFC93FbMxrc4ySbIYE/ACiT1gnFG9p8R2oHjjd9/LhM76yNO1Lo6ujjLd9+yXBPjZrCpCfSJQ5ZblQa5whq6dElYfv3nVLB7uU3Zlf1Qx+bp+KpQlX1dDPlBGTfHiuMB8hEAe+T3rKR2wjuYWIqwA2guN6Nl9COwBsBSLNNn/wIWBtLG62B6OuQHeT5VKtQj7+KMC3wfs6N7sEZUMZ2zx/+9BYfHYnTiid8u4Cm/9Ej4+eoqZpK9XIkT08OmUrHx9WszkCdKP2ahc5omFuiaGOaoIYuWzx2ubCze0V3L7jiUqTw9z77I0h6cgm1OhSf1vF9zpH+rQFwimTsTzzn7S+E0ZymIXD8jfA4Cm2djyt7Tn+RIKPtxBEPfQXV6C4suUGLhWY9mvyclRsP9rfbAJYIM0u2S2BOeicWldxzPaNs7jIG/zcjKrPZeaFkT6SSNGCwDaJW1GTfppaFGVYp5WkDaH+gFfApbK3JeIgfUHIUHqpca1vPhZ/Zogi9CHI9EwqXDwIDp0YHun6FpNuX8gbKG76VLHribAeMmwFk2q9M4UHI7O4F+O1iKdqA9vxOk+CjCJ6fu+32paJpL7rojQ4C69+XlbDum871IdjPkdWQInxAvwrB3yntnZ1JLb10232LX5BnCuBpULVUXzE6mLcfmoCZ05zDPRSS4daB2zOOigswkJ82HsZYStFCdhpbH0/K7SAf+oQCz1R8kEe5kgtU5b8KIsyaiacvX1dgdmoYUCQYNe/YQUTNAl5KTJ55UTn1uXp44Qcttj/DqSzWwc+QjNGwoxzUr+OW X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4236886b-f775-4b2d-fc11-08d8db412c30 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB3577.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Feb 2021 17:00:23.5589 (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: zZ1nZncLXb56mdEci97T/2HwV0ASNwArGgVN+xIVj0ib//UescKaAYNUtH6zobzZ9YCViCmi9ONP5fjyLVSez9ZAoO+6tAALwLNgFPKwPL4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB3499 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9908 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 adultscore=0 malwarescore=0 phishscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102270145 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9908 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 clxscore=1015 priorityscore=1501 mlxlogscore=999 suspectscore=0 malwarescore=0 impostorscore=0 bulkscore=0 adultscore=0 mlxscore=0 phishscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102270146 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org target_submit_cmd is now only for simple drivers that do their own sync during shutdown and do not use target_stop_session. It will never return a failure, so we can remove that code from the driver. Cc: Chris Boot Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig --- drivers/target/sbp/sbp_target.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/target/sbp/sbp_target.c b/drivers/target/sbp/sbp_target.c index e4a9b9fe3dfb..f467c50aee08 100644 --- a/drivers/target/sbp/sbp_target.c +++ b/drivers/target/sbp/sbp_target.c @@ -1218,11 +1218,9 @@ static void sbp_handle_command(struct sbp_target_request *req) /* only used for printk until we do TMRs */ req->se_cmd.tag = req->orb_pointer; - if (target_submit_cmd(&req->se_cmd, sess->se_sess, req->cmd_buf, - req->sense_buf, unpacked_lun, data_length, - TCM_SIMPLE_TAG, data_dir, TARGET_SCF_ACK_KREF)) - goto err; - + target_submit_cmd(&req->se_cmd, sess->se_sess, req->cmd_buf, + req->sense_buf, unpacked_lun, data_length, + TCM_SIMPLE_TAG, data_dir, TARGET_SCF_ACK_KREF); return; err: From patchwork Sat Feb 27 16:59:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 388350 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8323CC433E0 for ; Sat, 27 Feb 2021 17:18:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 554F964E85 for ; Sat, 27 Feb 2021 17:18:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230195AbhB0RPm (ORCPT ); Sat, 27 Feb 2021 12:15:42 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:49044 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230203AbhB0REH (ORCPT ); Sat, 27 Feb 2021 12:04:07 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11RGx0ou175562; Sat, 27 Feb 2021 17:00:27 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-2020-01-29; bh=IUNK9kzWw5Lp9c3MgYqKzYs3IW3QY94cy1GUfTpPk78=; b=CI5uXppb8PQQYR1g9Hwn6tGNXuJVBFATIND5Qjf8sHh7vKHGIugSSJMKUXNN3uay4/pb PGo8Ez3N+rgdxebkMw9J+Y3cSmIjlsikQggPRFTgYQT5B95nYrR4l1caIhnJoe7WZX9w PkyKeSE7XwlcHuZJ8iPamTRq+Jf/LUsaJnTWmpoIeodn34G39JuJ5rsyF+LW1iyyn/jD SoAjywXKplcLK+EPGkqG3XOQff+yzz5fB1F0XZb73DDUx67jHTklBXB3OYEcIdq3cNE9 F5oNiuMLzIEerPpv0oAmDohIan4yAJEnk+R5zTn35aLuxwF5GZp/bKAy5R78Q852sXMc LQ== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2120.oracle.com with ESMTP id 36yeqmrpt2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 27 Feb 2021 17:00:27 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11RGslmh115709; Sat, 27 Feb 2021 17:00:26 GMT Received: from nam04-dm6-obe.outbound.protection.outlook.com (mail-dm6nam08lp2046.outbound.protection.outlook.com [104.47.73.46]) by aserp3030.oracle.com with ESMTP id 36yc4a7jaw-12 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 27 Feb 2021 17:00:26 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Xd8VJ/5Nb9YsRyQkj+g4JiBqA93O/ofB4l8k5MEQjAoJFaduEF0DY7i5aCCRhJRr4gBrlM2zqz9/soHJ7jgoPp0ZpCq2FD73ChIQOfM7dMOtzruuW5exXRZeooRzoxzLHk/ggvZAO1V0befRT+twe4l3fYUuICWybnFkQNq9/d1zCnkb8G+e2d5T+TylfgSD+u6k+/EwKXIXsCWdSe52U6qbdQbaY4baUx9lNQadhz+4SOoBLtQ0crsrnHKyki7jzdfQURq7muirXGV5BGZgHaWnQAa+7VhdYiXZvfHwI72rmrKrJLZ85Bw3wjLvDjWZBZmV2XGylM7FNcVmhk4Mgw== 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-SenderADCheck; bh=IUNK9kzWw5Lp9c3MgYqKzYs3IW3QY94cy1GUfTpPk78=; b=NPMmYE43Kjgctu0IQdIFMdXooy98/yj85gQRz3voxI6/FVEiftx88EGLpYHDEF2PmFd/moMub82YfmL8+j+bV3eqi+TprxUhPLNafOcNYPxXPQUJiQnfLRa9VPJlT2nBbA9Xh53nVB7fiOy0BmVS0IezoN9MX1G28vJJVAYcmKM/O2D8hblDqMcKvF7692fWycZU1Wv4GiJ/6QM8C3MkhTsLq2CwhWBUdKWePAOJsAbLFcz9feGSOSrPrsum3ewTIiP8EA25qQJxbDN57pLrWKqZn5kIexLt54wMFxBy5Rou5soS7LG0L1+UTjJlQWRtVQj9ODXOGPjV6xbbbewgnA== 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=IUNK9kzWw5Lp9c3MgYqKzYs3IW3QY94cy1GUfTpPk78=; b=wBF5Y5t6fHCyq1GJyjV6XUyFXGCG5aQ3WjcUJpQvtVBpCVuo2GDM8SgkCXnd8c4IrDmiDU+fT1+x/GS26Lg38LG9aYY2b6Slk8aboEf8tPeyJnaSNM22sihFoXtx8HgZMOPv/MFZCk54wI3vc4pwIhiGhdjlrAtnWoQh9TH9cwA= Authentication-Results: gmail.com; dkim=none (message not signed) header.d=none; gmail.com; dmarc=none action=none header.from=oracle.com; Received: from DM6PR10MB3577.namprd10.prod.outlook.com (2603:10b6:5:152::16) by DM6PR10MB3499.namprd10.prod.outlook.com (2603:10b6:5:178::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.22; Sat, 27 Feb 2021 17:00:25 +0000 Received: from DM6PR10MB3577.namprd10.prod.outlook.com ([fe80::5120:8a97:3547:bc3b]) by DM6PR10MB3577.namprd10.prod.outlook.com ([fe80::5120:8a97:3547:bc3b%7]) with mapi id 15.20.3868.034; Sat, 27 Feb 2021 17:00:25 +0000 From: Mike Christie To: bostroesser@gmail.com, mst@redhat.com, stefanha@redhat.com, Chaitanya.Kulkarni@wdc.com, hch@lst.de, loberman@redhat.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org Cc: Mike Christie Subject: [PATCH 11/25] vhost-scsi: Convert to new submission API Date: Sat, 27 Feb 2021 10:59:52 -0600 Message-Id: <20210227170006.5077-12-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210227170006.5077-1-michael.christie@oracle.com> References: <20210227170006.5077-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: CH0PR13CA0027.namprd13.prod.outlook.com (2603:10b6:610:b1::32) To DM6PR10MB3577.namprd10.prod.outlook.com (2603:10b6:5:152::16) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by CH0PR13CA0027.namprd13.prod.outlook.com (2603:10b6:610:b1::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.13 via Frontend Transport; Sat, 27 Feb 2021 17:00:24 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3067e887-35f9-4dbf-faae-08d8db412d3f X-MS-TrafficTypeDiagnostic: DM6PR10MB3499: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:364; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wuI8Fv48aZv/WzxC+bIuBUfRbwPLErxvlcjXYSV1wKUAle5FRNqU8MivKEg+7FiUjP0jNYTSXlBJcLq13GMWUDubp0f0dIkfEvsxvpYKSwYj+gKkcdRKBCrgclnTF6SHxpWwzOKXv65ZKWycUdR2mcH0TOQtNvtaUFd3RGuXMebXSH7mGKFjUy/vg5ehgFkcK/OSD0LX3g+5uDLsTP+RUifZr9154K+YRhG075EkkOgE4blj8IAZR+3MJ5uQctcFMzs4q2xBaUUd36Adq8riXlMPXSwplJ0WSc+LYizP80tIF8gAA7wKQ478F9No11yC/gmm7+lQ8rplvS2vfdC60C0xh8N8xudbs3uhObMrCd8L+6OO5z6Crio3AoFwtopwnVtrBBeamBoNJQUky6kznQiil03NdeGJPVQMa5Qof2PEtxJyFd+YLqAvYdFLLuGmTNuXkA5Su8IQ4egpTWOVdvfuq6r9fs7Iub7jH53n/OpgweIRvXwI4Y7ZtxtRQdMJrSSoM3m6hhTRpNL6qELp7cHT0POVGq38LiI+6Q/EEuQ7AKmYL58KIaJKDM4zqw+U+ttyBZ7CZGBzvXruAGLu6g== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR10MB3577.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(136003)(39860400002)(376002)(396003)(366004)(346002)(6666004)(956004)(36756003)(316002)(6512007)(86362001)(69590400012)(6506007)(1076003)(8936002)(83380400001)(2616005)(478600001)(2906002)(4326008)(186003)(16526019)(66556008)(5660300002)(66946007)(6486002)(66476007)(8676002)(107886003)(26005)(52116002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: ttQ8Wtnm3whpMHOg10fCUSTDttbPVtqW178zuxsYfPlVexI0FKV0SL46DYndCYLrTzvrf+E71z+2zkc31h+vzr3jBABA1URTQP7uZrwLBzsmMydNaMoXRGZSVjQPEWvcWM0pMXDzrHdFmPRBG1yY0lUBYJYRGCSgLb9aqW/A04yvnBHJyJOK/PtcurK6nPii3i5rvvuMeKeUKjljbQJriNiY1YfQJfcGDrvCxyCzGB/XY/8Z1RHM6tGYTtdeHMJ9giSC44lHpJhfmgLD8iQ7bbDRZtdsh1WaP2/aNe92fre88ru6v3q+TOK5fUTI+CHoRiYw7v91ti0unHGJJX5a6SN4vZtyISSAyIWhKG7OHLkfAzbQtGdqtC7+LPB/muNSaq8qwcriKCWrAiFANPk1ruEh/pQxu/74pbA79paI61zcbyRN8fzgBSssz23YqDWG7ANUhHQjDhj+ThL7vJy0oOOP7p67MDYi+HoaOVIDC+mEFp28MZrtmJ/5TyB7+xxoXKiGn/L6HTMLGgopgLNj1roKnP6x6pqaHP4+yVcV777wgig+5VX8FvuCmj7A8kBzcG1R45yQoME+zxJOvjGgcjcOLZNjj6tn9ZxZZqjPOx+xyFXJ1RP6GHD3AEgmo71oQmM0kNrl1ER6trzifxj9qme5mTJVsFVrjHclpVgoe/M4EyKc0ggx12Sqs/WzL/m9zau5jUlR5Ws/h4y3OCLdAhgzkxmD3hvBwyLsYIWRDCvWbGhHlKUy1nh7PPFsLcEF9taJ0Xn75m2ESsMUdYbsGGmSmMAZm3Bk1tUH1tABFuTdGV/aoVLXYxoxH/zFrnS8OAbN1VAyzWqhFy8gL+jkVosuGXjvMY4ZLnQ18aiynUnsL8avSeyvAu/1I2Tq373AkVTaJbQYSEqy7EJCa2kjvTBbRCL/0gC7Q/RWNUSJKTlT9g50sZx1/hXZeemHoH6+9i8Lpudah9klvEP0ja+dWX13zHjt6Mvg4tu+9L81fP+kNYHmsSV4V89Y52EpvCmTVJ6uvWQOQW60SJ8BfcV3XRCjzYpbA13evWNgO5nVwCI9+HZgSY1OFt+rwgPN8zYxiljTmjyhw0Wzjs/iIBNySYWRd2b077CdLnCcz4DKNPG7W4tmT7Pjre6+Z+4bJgayTEMiuIxAtp8CcMX7607BA9brNacamkstLqq5+sZonvJdaE/GLdGPbl+0vz/iLQMBcb7LN98Wl+6HOsLktO5Zz6ss6zUKqRTuWyhzk4q8hGFmnH8pDE3adWKL4RGK/Rl71HKSf7UJCidEmaY5j88nDGvtz2cEI9UkJRiAZLran95S+atIk89rCV6sfYDkzfC5 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3067e887-35f9-4dbf-faae-08d8db412d3f X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB3577.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Feb 2021 17:00:25.3069 (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: RNSF34T7aSwWubWlVgg+XVShjPxiNWaavRTC6QKP1uINTZwJ+MYJqb2UiPEIhw5Dx8l+c2HozjF0YtzZpvNaBumWOwu+OzrRb+kn53qrECM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB3499 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9908 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 adultscore=0 malwarescore=0 phishscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102270145 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9908 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 clxscore=1015 priorityscore=1501 mlxlogscore=999 suspectscore=0 malwarescore=0 impostorscore=0 bulkscore=0 adultscore=0 mlxscore=0 phishscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102270146 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org target_submit_cmd_map_sgls is being removed, so convert vhost-scsi to the new submission API. This has it use target_init_cmd/target_submit_prep/target_submit because we need to have lio core map sgls which is now done in target_submit_prep, and in the next patches we will do the target_submit step from the lio workqueue. Note: vhost-scsi never calls target_stop_session so target_submit_cmd_map_sgls never failed (in the new API target_init_cmd handles target_stop_session being called when cmds are being submitted). If it were to have used target_stop_session and got an error, we would have hit a refcount bug like xen and usb, because it does: if (rc < 0) { transport_send_check_condition_and_sense(se_cmd, TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE, 0); transport_generic_free_cmd(se_cmd, 0); } transport_send_check_condition_and_sense calls queue_status which does transport_generic_free_cmd, and then we do an extra transport_generic_free_cmd call above which would have dropped the refcount to -1 and the refcount code would spit out errors. Cc: "Michael S. Tsirkin" Cc: Stefan Hajnoczi Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig --- drivers/vhost/scsi.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c index 4ce9f00ae10e..76508d408bb3 100644 --- a/drivers/vhost/scsi.c +++ b/drivers/vhost/scsi.c @@ -789,7 +789,6 @@ static void vhost_scsi_submission_work(struct work_struct *work) struct vhost_scsi_nexus *tv_nexus; struct se_cmd *se_cmd = &cmd->tvc_se_cmd; struct scatterlist *sg_ptr, *sg_prot_ptr = NULL; - int rc; /* FIXME: BIDI operation */ if (cmd->tvc_sgl_count) { @@ -805,18 +804,17 @@ static void vhost_scsi_submission_work(struct work_struct *work) tv_nexus = cmd->tvc_nexus; se_cmd->tag = 0; - rc = target_submit_cmd_map_sgls(se_cmd, tv_nexus->tvn_se_sess, - cmd->tvc_cdb, &cmd->tvc_sense_buf[0], + target_init_cmd(se_cmd, tv_nexus->tvn_se_sess, &cmd->tvc_sense_buf[0], cmd->tvc_lun, cmd->tvc_exp_data_len, vhost_scsi_to_tcm_attr(cmd->tvc_task_attr), - cmd->tvc_data_direction, TARGET_SCF_ACK_KREF, - sg_ptr, cmd->tvc_sgl_count, NULL, 0, sg_prot_ptr, - cmd->tvc_prot_sgl_count); - if (rc < 0) { - transport_send_check_condition_and_sense(se_cmd, - TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE, 0); - transport_generic_free_cmd(se_cmd, 0); - } + cmd->tvc_data_direction, TARGET_SCF_ACK_KREF); + + if (target_submit_prep(se_cmd, cmd->tvc_cdb, sg_ptr, + cmd->tvc_sgl_count, NULL, 0, sg_prot_ptr, + cmd->tvc_prot_sgl_count)) + return; + + target_submit(se_cmd); } static void From patchwork Sat Feb 27 16:59:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 388356 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E3B25C433E6 for ; Sat, 27 Feb 2021 17:11:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CD30664E83 for ; Sat, 27 Feb 2021 17:11:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230360AbhB0RKi (ORCPT ); Sat, 27 Feb 2021 12:10:38 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:51252 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230215AbhB0RCI (ORCPT ); Sat, 27 Feb 2021 12:02:08 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11RH0TgY079934; Sat, 27 Feb 2021 17:00:29 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-2020-01-29; bh=fykfHGcyaFRt5NhIis3zRliEuZ4j2G8ziMADvFSZUI4=; b=wXhcciP7R68NZ9NTCbqsRF2OSJR7gXF4yfyGwVyG4jaUh1HPdMdbinpgmGWHp+J0MuDg dVLHWRVeXhmM8E+sq8LO20x9VTN9aGC9i9q0aGTk8RS1mWu0wevvNW6oX1cA0OvL1Hfb CCo9AfQMJJDmfS3QDWpYDC3OHAKeJDeJoiCX7OesuxjKZJRGIz+/6FhVVXyck6QxdzOa hNwfcJVjsuK/wPUpceEKtunis0jiSUIApdsxid2p1qgVBoad76tFC++xVMg9Ze2VwTu8 mcIquaqFeqbz3hUQTPZfo8NjTdz8a18HnZf2rC7K3cavLr+1MDARFNBwXIM518RKiZEW yA== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2130.oracle.com with ESMTP id 36ydgr0rs2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 27 Feb 2021 17:00:28 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11RGsmD5041731; Sat, 27 Feb 2021 17:00:28 GMT Received: from nam04-dm6-obe.outbound.protection.outlook.com (mail-dm6nam08lp2048.outbound.protection.outlook.com [104.47.73.48]) by userp3030.oracle.com with ESMTP id 36yb6sam7c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 27 Feb 2021 17:00:28 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BlPwZ9O5uvYvbDg6URAiVl/8R2zKsWPQ4/pLXs9ufxQKEMgr4KO48wYy8YcbPaNGElW4SUm8B3Yev4zBW7dUF7zgfth5Du7JTWxxWKlcwuswFBtiaWsLdLFPTx2SiCwnHKWNx6WZNR0YOjOPERudMSde4mvYbkg+pPnqkONvQ6CX8m4MZJ+1HFcbYClDZEKPPQAONAYHrWZ2fXik7AucFIbQbZ7oVg0cYAL88HC1e59CTnm/IQQ/jXkTi6g94E01FJ0AYW7f4pyoOEJjoNUR5i5lNHdSrxUeP3dpRESVzhvkS+HXQoRYepWZKE77drcsT/plk7PmznwhMYcuHG1r2w== 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-SenderADCheck; bh=fykfHGcyaFRt5NhIis3zRliEuZ4j2G8ziMADvFSZUI4=; b=Nu52qH/U7Uoz9irRUeF7DPWrxVCS59raGoIK2PyLwa+7obiZQSDI6kX0UXc1vqM49ME7pJh3zSD1yifMMhPSpk56lLFLY7gXw0A20BVv0b5MFxsCbnQQlKreYf9T5Nk0hBgEVRy0iSOozfZxxgP3BGsUqWXSCgRG2KbU/7IROGbOQYDeppou7qRNarmgsJWFXS8MBeYMP3w9TMKe+6gzV4X07fquaHqj/qxFJgOt0Ysl7H44gXLjDkvQ1g4uiEHP8Z2khgsUczO4BL7gMRqy1vGM7M9exH/2MMoJ7pmdU5R4J27NZhAVeTkPNPscHniUA2EIhPMSFIoxnBlMrRl5gA== 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=fykfHGcyaFRt5NhIis3zRliEuZ4j2G8ziMADvFSZUI4=; b=M+OOTCqpLTVml52cjps6eJYKdSyp8esB/JVTFLqTlS9NpwTN4/s6PKcAoBeoOpYgWUWhmKjy5MrfsuekUQ5UFK2nxFGUT1dlcKnUK6eal5HBvKTO+BnZlp5+gpJi3C6tnOjwjT4P2GgpT/3nrfOXDI8gGOgUWaioBBP8prWgR40= Authentication-Results: gmail.com; dkim=none (message not signed) header.d=none; gmail.com; dmarc=none action=none header.from=oracle.com; Received: from DM6PR10MB3577.namprd10.prod.outlook.com (2603:10b6:5:152::16) by DM6PR10MB3499.namprd10.prod.outlook.com (2603:10b6:5:178::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.22; Sat, 27 Feb 2021 17:00:26 +0000 Received: from DM6PR10MB3577.namprd10.prod.outlook.com ([fe80::5120:8a97:3547:bc3b]) by DM6PR10MB3577.namprd10.prod.outlook.com ([fe80::5120:8a97:3547:bc3b%7]) with mapi id 15.20.3868.034; Sat, 27 Feb 2021 17:00:26 +0000 From: Mike Christie To: bostroesser@gmail.com, mst@redhat.com, stefanha@redhat.com, Chaitanya.Kulkarni@wdc.com, hch@lst.de, loberman@redhat.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org Cc: Mike Christie Subject: [PATCH 12/25] xen-scsiback: Convert to new submission API Date: Sat, 27 Feb 2021 10:59:53 -0600 Message-Id: <20210227170006.5077-13-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210227170006.5077-1-michael.christie@oracle.com> References: <20210227170006.5077-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: CH0PR13CA0027.namprd13.prod.outlook.com (2603:10b6:610:b1::32) To DM6PR10MB3577.namprd10.prod.outlook.com (2603:10b6:5:152::16) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by CH0PR13CA0027.namprd13.prod.outlook.com (2603:10b6:610:b1::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.13 via Frontend Transport; Sat, 27 Feb 2021 17:00:25 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 509ebed9-4692-4e9b-dc3a-08d8db412dbe X-MS-TrafficTypeDiagnostic: DM6PR10MB3499: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:415; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mpHZTQRO4/y3OZYc7s2fUaiVr/0mQpyG6txuQl++Yevc9KzgPZPQsbMDFEe2OGdrLvFyMwYjBqQ7VBILrdEhQ2x5+/KcXFTwizafgYpfC+J8FGXeRaA6SQTv90AafPNxHbl18IxwScYadkB9TLOGzIvZ5hfDfJqnH78wPhWIApYqC5sX7TBTDBKBmssR9WwVYqlGszHs12BgdWAvh7g1GBnH/3xpvQ0Lqu9QEaolcp9LlUeNDJaHU+U3lTa3Ei0waFrl1hwqJkkJA5fV3XVhtgp6yBk5YoctTx/b5sT2u+nl1yFl9bqIganInNA74Y/fOSBtfpVgTvr5LCD2TQK5/5Fo95QgRPEnmPi3LjZG9yK0tydbxJ+HmHEOCo/XLaOZiCsPhtLwBzq35uzIzxDcBmlLahTwlWdkUAD7MVEKGZZfdRPbk/DMNf1zEg9kcxLvnJWt8MOHlRLgCcV/oT5K4BjooUP4hKBdclDsPvxZAeQJnpDXKZ2GimUG0TH+D3Cdw05ep3TNb8ywy5qD0ZrCFMlJVKnSvNTDBbyyybjNhHQvFURFgCv9ku4lQTtQhC+3iO7KrnZSiI73T8WIdwT2Gg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR10MB3577.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(136003)(39860400002)(376002)(396003)(366004)(346002)(6666004)(956004)(36756003)(316002)(6512007)(86362001)(69590400012)(6506007)(1076003)(8936002)(83380400001)(2616005)(478600001)(2906002)(4326008)(186003)(16526019)(66556008)(5660300002)(66946007)(6486002)(66476007)(8676002)(107886003)(26005)(52116002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: PqbepmigSEyIrv/+KASurLJIzW9yfWNfE3eWnsz47zuHG7QtYbseJLqpfaWagzMdbY7YcNU3YCPYHX9qC41UU4Xk0yedvWOeuMGYP6ejODj5uNU4M60tdk2UiI9Dir5ZkmedxOTFC9F1FWNAT0sbzK3q551qHzLygPxm2Yrzv4JTLpz1vYWasz38f87R5Ey/uK/kLqYw8BiXWasQZBgXW0q3R/+nKBtI3X5UNgmcsAsHRe//VRUOxwqu8kxuwutzQ5M6V5F1V0Cg8/FLHAQZ4zakGAlRUBYGNXfEg/XB2duOtcu7tgsPdOGycTJFMHRU5VnxuURACPlbDPy7di3u/WSExB7XSEAwfyqJrCmqZN3xEg+MUQZc+YjHu2dAJIrSTw7n6CqeiGSBbLh31ioZw9fiY/D1WVhoDLYpLm40+OfBLNnSi+IoJRjFyWolX55KTnNtf69ZlLYWO7DWUUV58q+39+GuROTz/Mtz92HRAzu7riauFh7pwpELXN3mbI0dFWdhaoFJuA8HlkocHu01F6pzosPItbEV8LlTcrB4Fd15DK/TZs7QJNcCUsGfwryWC1QjjBgpajIZmAlI8gpH2x09CGf0yoC2jP34Fb7FyU8NabpFslXtuSo25ysDdFWcEOStC3+dCoRI50Vvuwk47C1rMb4x6czqo9jjXRyUaVxZ0kGcmDnxFoP0ou0mW3R5DOEKmuqxeXe3snwMut/QiSzmtrjldLSkOMCKoUyt5JYJqYH3QRW9TcsuieEE9r0J8PSk8TkLIx12nV8PyA0fcMh2mydNLYN1c2Y8ZrpB37Wc56FwsU14Pq0xYMN9ffCmgx2NdUXxvh9cqEqnCBYYqkGdAsq7A/aVAssN0wy2i3DCIxxyOlTMX48UHCYy8eppSN0PSWeVvvXHl0MaMq2LmWcaWW7O3uPcTD9un6Up9Zv2VzLizMSBdpWzw911FgE2eH2qFfsbzHmwV4e+G/dKuPatzKIStfGg8qcA0n1Xwp5+rx/cDIRpAjngxDo6naRjUWV1tVcO/QSwnFQAR37v7buZa4/KKIa6S1JRAc4B28/ECZPOtato10T7Ege8cNUIFUQqysJqJ0aiHP2Jvg8OCVRJEoKaS2KBbnA+9cpjsvBU9BhxlSS9OWJtQwwwr6rPG4QGIQhazaU22zvs+j+rFYJE4zeSeM1+CCdXvp6gf7wxxgKQjiWLjuTY3uQk+7f5wI5mTxjo3Hg52h03lz6ZlI0t6vzP9zg0nm/21gxgco4Sx16jKFqhjWdhpVh9g6aWNO7+0JKU3bG5rVzt9K4BcaklUn0yHW3zagNFGngZb2jtvo/TvZXOtPOWGBCRNphg X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 509ebed9-4692-4e9b-dc3a-08d8db412dbe X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB3577.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Feb 2021 17:00:26.1564 (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: ZrMFmJTaYMRYwazIE+4z4iWWMrO+q74n6DL4Spquynouf/CNAL9aP1obqXgA9L5IQP960FtQ0C/phzTdol2FQ0mh5+ZoUwrVJfE1kzTKrLA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB3499 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9908 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 suspectscore=0 mlxlogscore=999 bulkscore=0 malwarescore=0 mlxscore=0 spamscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102270145 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9908 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 adultscore=0 impostorscore=0 clxscore=1015 suspectscore=0 malwarescore=0 priorityscore=1501 mlxscore=0 phishscore=0 bulkscore=0 mlxlogscore=999 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102270146 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org target_submit_cmd_map_sgls is being removed, so convert xen to the new submission API. This has it use target_init_cmd/target_submit_prep/target_submit because we need to have lio core map sgls which is now done in target_submit_prep. target_init_cmd will never fail for xen because it does it's own sync during session shutdown, so we can remove that code. Note: xen never calls target_stop_session so target_submit_cmd_map_sgls never failed (in the new API target_init_cmd handles target_stop_session being called when cmds are being submitted). If it were to have used target_stop_session and got an error, we would have hit a refcount bug like xen and usb, because it does: if (rc < 0) { transport_send_check_condition_and_sense(se_cmd, TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE, 0); transport_generic_free_cmd(se_cmd, 0); } transport_send_check_condition_and_sense calls queue_status which calls scsiback_cmd_done->target_put_sess_cmd. We do an extra transport_generic_free_cmd call above which would have dropped the refcount to -1 and the refcount code would spit out errors. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig --- drivers/xen/xen-scsiback.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/drivers/xen/xen-scsiback.c b/drivers/xen/xen-scsiback.c index 862162dca33c..7bf9a6bede6d 100644 --- a/drivers/xen/xen-scsiback.c +++ b/drivers/xen/xen-scsiback.c @@ -360,21 +360,18 @@ static void scsiback_cmd_exec(struct vscsibk_pend *pending_req) { struct se_cmd *se_cmd = &pending_req->se_cmd; struct se_session *sess = pending_req->v2p->tpg->tpg_nexus->tvn_se_sess; - int rc; scsiback_get(pending_req->info); se_cmd->tag = pending_req->rqid; - rc = target_submit_cmd_map_sgls(se_cmd, sess, pending_req->cmnd, - pending_req->sense_buffer, pending_req->v2p->lun, - pending_req->data_len, 0, - pending_req->sc_data_direction, TARGET_SCF_ACK_KREF, - pending_req->sgl, pending_req->n_sg, - NULL, 0, NULL, 0); - if (rc < 0) { - transport_send_check_condition_and_sense(se_cmd, - TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE, 0); - transport_generic_free_cmd(se_cmd, 0); - } + target_init_cmd(se_cmd, sess, pending_req->sense_buffer, + pending_req->v2p->lun, pending_req->data_len, 0, + pending_req->sc_data_direction, TARGET_SCF_ACK_KREF); + + if (target_submit_prep(se_cmd, pending_req->cmnd, pending_req->sgl, + pending_req->n_sg, NULL, 0, NULL, 0)) + return; + + target_submit(se_cmd); } static int scsiback_gnttab_data_map_batch(struct gnttab_map_grant_ref *map, From patchwork Sat Feb 27 16:59:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 388352 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 40BC5C43381 for ; Sat, 27 Feb 2021 17:14:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 227DF64E86 for ; Sat, 27 Feb 2021 17:14:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230399AbhB0ROP (ORCPT ); Sat, 27 Feb 2021 12:14:15 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:47938 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230253AbhB0REI (ORCPT ); Sat, 27 Feb 2021 12:04:08 -0500 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11RH01pL034101; Sat, 27 Feb 2021 17:00: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-2020-01-29; bh=eezqp08w8pBwL6SGoHgccxkJ28lPG4kjR46euuk9a3I=; b=ZtXQxfwepsZKCw7TyrYkLm0FPdIBmhg4o7rmvIh1D56kZyKprQXfRq60uSnuo1TJIYTT aYENfdgn0odnmInrPi6fI3j/rZwKG9quRApYDh3gB7FHtzNwCVXaXKoQrCZ8TTlyg+tO /K3fn9cQbkrw15eq0k20jkj0Nhj4aZUU5toceYyov54lhoNnXUNlorLyNoPkOteaBsUl 7tB6xOPce3NMhoxPUSQjJtjQ0go9wRjk/l7yBv9RHXIZt6xdoSePaUQV9S1f937HPV57 0Dyy08ICPgpTYP72n6tTUXQY7mmk+rxutlSpjVidAPvsb0ItXeOyCilwWslWT5yN5cTf 0A== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by aserp2130.oracle.com with ESMTP id 36ybkb0v48-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 27 Feb 2021 17:00:31 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11RGsmD9041731; Sat, 27 Feb 2021 17:00:30 GMT Received: from nam04-dm6-obe.outbound.protection.outlook.com (mail-dm6nam08lp2048.outbound.protection.outlook.com [104.47.73.48]) by userp3030.oracle.com with ESMTP id 36yb6sam7c-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 27 Feb 2021 17:00:29 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OBELIsG7t1S8dtTanzReiRdn/BLJyKX5cNX//W43UtjVbRS8yQM8QCpEs6S4mI2I2GYjCR8T3uxowpZfUTwDLPzjbw0LaPsW8cgvBGDr9qX2BQsl1XCAUlVG/4TH7DNtLuOwlbBu0KKnCzsLOQKKcwHo80iPa2V9dsQDSpDZiuaMYIgOlsJVsRomEYdQLbYP28E5pDpo/1DAzJn+C2yXleM0Nnml5yeNd/c4FnuKR8Kf//lxAyTO7SK/Q4gRCh4DlW71kHaX2jvfuA8JQZW+DlO6H0HJrx0sZZ4cipXbse+klIr+j9qP2lSyvecc+UA1iUA9qWgwFPGZ1jEeMWQ8zA== 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-SenderADCheck; bh=eezqp08w8pBwL6SGoHgccxkJ28lPG4kjR46euuk9a3I=; b=KhaHJxhxGlIq3HEn7lyD6WNC5aj5TWQ+qRyPupNBSPppy2hx/HUayNMbtED1rBCCvVplbbxwu821CouE1FOjH4Puiper8s/OKnM4SGXU8RYwddKbGNZDVB7hidxzYs8/WISipnRm3m8o3yaD4+mmY9/sC+t2HtDbKJvOTRl6DUIqxKmS4XDwvQQRHdhvM37TaNJj/w6aSqmBNrCiuYJQu56R940snjFBWrg165VkCbvRm0RSLsV7N/owlj4qne5/7L7suKUq6bvS6K9Y3md9rFNpKmJExzAeIaim7M/0un8chdD1huivKCMpAMUpYGUZDdQW2PvVRXiO7v+dfZCUTg== 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=eezqp08w8pBwL6SGoHgccxkJ28lPG4kjR46euuk9a3I=; b=Jh6P8WQ3WBm5CGaPPjgOq1BmOoJ8WBNesYwG4XP5+QAFnxP7ZKSCp0QaIF6+bC/HsPmjSuNZ1Xl9QRX+bWW0lZ7osnYFechdr1Ry2OUeScqU+SDChD50wO8nQjn+28aWfImuBVEN4V053tA6DnW6UY/eow8CP9jLyaw+DDQg2xE= Authentication-Results: gmail.com; dkim=none (message not signed) header.d=none; gmail.com; dmarc=none action=none header.from=oracle.com; Received: from DM6PR10MB3577.namprd10.prod.outlook.com (2603:10b6:5:152::16) by DM6PR10MB3499.namprd10.prod.outlook.com (2603:10b6:5:178::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.22; Sat, 27 Feb 2021 17:00:27 +0000 Received: from DM6PR10MB3577.namprd10.prod.outlook.com ([fe80::5120:8a97:3547:bc3b]) by DM6PR10MB3577.namprd10.prod.outlook.com ([fe80::5120:8a97:3547:bc3b%7]) with mapi id 15.20.3868.034; Sat, 27 Feb 2021 17:00:27 +0000 From: Mike Christie To: bostroesser@gmail.com, mst@redhat.com, stefanha@redhat.com, Chaitanya.Kulkarni@wdc.com, hch@lst.de, loberman@redhat.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org Cc: Mike Christie Subject: [PATCH 14/25] target: remove target_submit_cmd_map_sgls Date: Sat, 27 Feb 2021 10:59:55 -0600 Message-Id: <20210227170006.5077-15-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210227170006.5077-1-michael.christie@oracle.com> References: <20210227170006.5077-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: CH0PR13CA0027.namprd13.prod.outlook.com (2603:10b6:610:b1::32) To DM6PR10MB3577.namprd10.prod.outlook.com (2603:10b6:5:152::16) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by CH0PR13CA0027.namprd13.prod.outlook.com (2603:10b6:610:b1::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.13 via Frontend Transport; Sat, 27 Feb 2021 17:00:27 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e1de28dc-ee7a-4e0c-8d63-08d8db412ec4 X-MS-TrafficTypeDiagnostic: DM6PR10MB3499: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1uMVjjDLau/QLY0J86qjwh5bz3swv8pzsI3LLpNNA37ElerhqhNBYlUJ0gUJB8wjV1C7gjMiGbxCIAjZzy1WhiJ7I1ayAal/q8VX1sAkY2M9eW8jn9IRBygeMy0GpkE3E8WF7F5TXE1ePZo+KZsTeH8U3bGv5mPJ6S2JXW9qVzwjyhCzFdpPSUg1PHKmBRo0I487H3hS++wL+haUlYeFErwTxEzmXh97YkwXRnkt7bILgtFU0ty5nBMkXyqh5+BsaaHXcXscnmI7p697sjq83S/H3DUySaN1k9ueJQSOlnwk/yVCSKTyZLlLlKPoh+CaQjM/OLRG1GZajDXI3ANdF//qpGp7fHAzoFUzWw51IadTTCvgJxSNurJbQSuNfarBO+ockFlQnlpW4VxZnKDuUQPHwOmHaxeJFxL7AUp2qzcG4q9X2lOuLZyvX5kSv4Kz6FZ3USaKydEHUykLfz3N9OSNv0yZF6Eo/iz/hwQ+Vx7rHR6KJICkYHcPOD+NsK82rTkO0JFv2C4+lOqxoo46al23VBaA6HxHq35Qxj4kAmhbTrIbK6ITOUhNcMDCq98qhlEcvAoEl1Etin6sZE7KHw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR10MB3577.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(136003)(39860400002)(376002)(396003)(366004)(346002)(6666004)(956004)(36756003)(316002)(6512007)(86362001)(69590400012)(6506007)(1076003)(8936002)(83380400001)(2616005)(478600001)(2906002)(4326008)(186003)(16526019)(66556008)(5660300002)(66946007)(6486002)(66476007)(8676002)(107886003)(26005)(52116002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: s7AYCDRzFYAzdr8KyedovpwSJdU7yB3e9BYy1ybg8s4RgrP+FMkq76v5wIYJPgR7WMYH9rXeHCMDwzPde000jVBHh6r6LIPO43Z08Hl3hGRdbJTSJX8p9rcEO+L3jyeFN6oPg+948kVb+NdlF6zhlsNzU7CRzgyp7GoH1O11TQ/u7iOX/U6Ybp/xzvfAbWQV0yYBeYwiUh+89Kgo+lvAozwT08Unih3UmVDr/yUgND+86xThMW1Iz43QjdU6CtpLLXNtp7dj1xdQrfaHt89pOtbR3mj8dRdmi2YynjUxlg8spVF2lhOHS1rj6iYGbXIlIOTH6FheeYCgNv0A57SZR4RnDjoZR6hRUbmRj6rDlI7H2JBkdOrLabtyO97NbCci1qTaBIbLTkKMHAybHc1V1VtAqLumeT7zdre+bfzpGNaCAszZjSytWr/+IjjvzfZEKqNT8V3OPxulwvElW3TjNM9Vdb8i68xHhm+JRNCwdDJ0FU5ABSdYeitEpFc9MeO90us8UPcvHaQZiYQjTJ5i2u6eXRtJDLHOsy4I2deblDTcPUBTnjyYA5DQqVqSTZNVyQQu4XcvtwwZKMocNfgY4JF8eQNRqDD5Nl6OxunOXpxC9Le+HMItPmzLFLK4tyjzNyBUJ1RnbxtLpM7jrsJei4JTRHSkglFO77AtfOw1mBLKJPhHD4H6ggIRyJppHmGmgQo8gMAhEHjsH3JJ20E9rNvbRVpHENmujUOywd0SZcO1GHvZS8SoEMR2rT8Ye3r+mP3/+ca+tK2P9sOcJ1ebJwzUMMPKD/OYCzL+L6KMkMF2KRY1lm0HBMA3MbaEDBVkARagcH8dHthgEGWnUhVqZG5N3NQNW81KcrYkMAA4gcEuycBoJu95iQVGRw6dJPniCW8eKkIYii9q8R3EoJ971i82KKYzQjGBnjxat12WNei/Opn/+H4+2soFgpE5a11X8jMIeV4XNs7t7qT17CA87kfRffmvbZAX3FPfxp78s0Qle6slazfJ3kNGZEwDi7ttxwqAlvdtm2YZO8iWNzvgue3Xx4FhcIQ7TocmGH1RdxIf3W6TTVxG2sI9RMmCIPC5DBAayGKj/l2xKbTwYX52nPxRdWzKJRKtDAvLVfwwR47n4lKUJrhF+Ov5ROQqpecDvuNS/RAy82nW6HuPF1gghRcMxoz2g7D0GY2Fk6O56+88y093q+h2Iq1gbdvkubloh70VjSyNh2NhRCVwKJQiOYbGdKqpH0bCELwaFi6kd140IiamkMhGdWcnCVxSGwVZBF3v+oKrj/90rnyAXDmkc+ji9qpbi0ty6PrCgn3wiLlxVeJylB63NS5XVBv8cGpW X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: e1de28dc-ee7a-4e0c-8d63-08d8db412ec4 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB3577.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Feb 2021 17:00:27.8724 (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: AMl456wEgrJNGs8zo8VzPIfyCpaBUssHaqJvoFIOR/ef/VkHcu8EoXWvk3MzWl3cN2mygSfRKuOnG0NZH3UIIed51fbif818NCKTs8s7+SU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB3499 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9908 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 suspectscore=0 mlxlogscore=999 bulkscore=0 malwarescore=0 mlxscore=0 spamscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102270145 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9908 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 impostorscore=0 suspectscore=0 phishscore=0 bulkscore=0 mlxscore=0 lowpriorityscore=0 clxscore=1015 mlxlogscore=999 adultscore=0 malwarescore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102270146 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Convert target_submit_cmd to do its own calls and then remove target_submit_cmd_map_sgls since no one uses it. Signed-off-by: Mike Christie Reviewed-by: Bodo Stroesser Tested-by: Laurence Oberman --- drivers/target/target_core_transport.c | 76 ++++++-------------------- include/target/target_core_fabric.h | 6 +- 2 files changed, 18 insertions(+), 64 deletions(-) diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index 8b2b805316dc..1f35cce6e92b 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@ -1752,8 +1752,7 @@ void target_submit(struct se_cmd *se_cmd) EXPORT_SYMBOL_GPL(target_submit); /** - * target_submit_cmd_map_sgls - lookup unpacked lun and submit uninitialized - * se_cmd + use pre-allocated SGL memory. + * target_submit_cmd - lookup unpacked lun and submit uninitialized se_cmd * * @se_cmd: command descriptor to submit * @se_sess: associated se_sess for endpoint @@ -1764,76 +1763,35 @@ EXPORT_SYMBOL_GPL(target_submit); * @task_attr: SAM task attribute * @data_dir: DMA data direction * @flags: flags for command submission from target_sc_flags_tables - * @sgl: struct scatterlist memory for unidirectional mapping - * @sgl_count: scatterlist count for unidirectional mapping - * @sgl_bidi: struct scatterlist memory for bidirectional READ mapping - * @sgl_bidi_count: scatterlist count for bidirectional READ mapping - * @sgl_prot: struct scatterlist memory protection information - * @sgl_prot_count: scatterlist count for protection information * * Task tags are supported if the caller has set @se_cmd->tag. * - * Returns non zero to signal active I/O shutdown failure. All other - * setup exceptions will be returned as a SCSI CHECK_CONDITION response, - * but still return zero here. - * * This may only be called from process context, and also currently * assumes internal allocation of fabric payload buffer by target-core. + * + * It also assumes interal target core SGL memory allocation. + * + * This function must only be used by drivers that do their own + * sync during shutdown and does not use target_stop_session. If there + * is a failure this function will call into the fabric driver's + * queue_status with a CHECK_CONDITION. */ -int target_submit_cmd_map_sgls(struct se_cmd *se_cmd, struct se_session *se_sess, +void target_submit_cmd(struct se_cmd *se_cmd, struct se_session *se_sess, unsigned char *cdb, unsigned char *sense, u64 unpacked_lun, - u32 data_length, int task_attr, int data_dir, int flags, - struct scatterlist *sgl, u32 sgl_count, - struct scatterlist *sgl_bidi, u32 sgl_bidi_count, - struct scatterlist *sgl_prot, u32 sgl_prot_count) + u32 data_length, int task_attr, int data_dir, int flags) { int rc; - rc = target_init_cmd(se_cmd, se_sess, sense, unpacked_lun, - data_length, task_attr, data_dir, flags); - if (rc < 0) - return rc; + rc = target_init_cmd(se_cmd, se_sess, sense, unpacked_lun, data_length, + task_attr, data_dir, flags); + WARN(rc, "Invalid target_submit_cmd use. Driver must not use target_stop_session or call target_init_cmd directly.\n"); + if (rc) + return; - if (target_submit_prep(se_cmd, cdb, sgl, sgl_count, sgl_bidi, - sgl_bidi_count, sgl_prot, sgl_prot_count)) - return 0; + if (target_submit_prep(se_cmd, cdb, NULL, 0, NULL, 0, NULL, 0)) + return; target_submit(se_cmd); - return 0; -} -EXPORT_SYMBOL(target_submit_cmd_map_sgls); - -/** - * target_submit_cmd - lookup unpacked lun and submit uninitialized se_cmd - * - * @se_cmd: command descriptor to submit - * @se_sess: associated se_sess for endpoint - * @cdb: pointer to SCSI CDB - * @sense: pointer to SCSI sense buffer - * @unpacked_lun: unpacked LUN to reference for struct se_lun - * @data_length: fabric expected data transfer length - * @task_attr: SAM task attribute - * @data_dir: DMA data direction - * @flags: flags for command submission from target_sc_flags_tables - * - * Task tags are supported if the caller has set @se_cmd->tag. - * - * Returns non zero to signal active I/O shutdown failure. All other - * setup exceptions will be returned as a SCSI CHECK_CONDITION response, - * but still return zero here. - * - * This may only be called from process context, and also currently - * assumes internal allocation of fabric payload buffer by target-core. - * - * It also assumes interal target core SGL memory allocation. - */ -int target_submit_cmd(struct se_cmd *se_cmd, struct se_session *se_sess, - unsigned char *cdb, unsigned char *sense, u64 unpacked_lun, - u32 data_length, int task_attr, int data_dir, int flags) -{ - return target_submit_cmd_map_sgls(se_cmd, se_sess, cdb, sense, - unpacked_lun, data_length, task_attr, data_dir, - flags, NULL, 0, NULL, 0, NULL, 0); } EXPORT_SYMBOL(target_submit_cmd); diff --git a/include/target/target_core_fabric.h b/include/target/target_core_fabric.h index 4b5f6687393a..86b0d4a7df92 100644 --- a/include/target/target_core_fabric.h +++ b/include/target/target_core_fabric.h @@ -162,11 +162,7 @@ void target_submit(struct se_cmd *se_cmd); sense_reason_t transport_lookup_cmd_lun(struct se_cmd *); sense_reason_t target_cmd_init_cdb(struct se_cmd *, unsigned char *); sense_reason_t target_cmd_parse_cdb(struct se_cmd *); -int target_submit_cmd_map_sgls(struct se_cmd *, struct se_session *, - unsigned char *, unsigned char *, u64, u32, int, int, int, - struct scatterlist *, u32, struct scatterlist *, u32, - struct scatterlist *, u32); -int target_submit_cmd(struct se_cmd *, struct se_session *, unsigned char *, +void target_submit_cmd(struct se_cmd *, struct se_session *, unsigned char *, unsigned char *, u64, u32, int, int, int); int target_submit_tmr(struct se_cmd *se_cmd, struct se_session *se_sess, unsigned char *sense, u64 unpacked_lun, From patchwork Sat Feb 27 16:59:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 388349 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D05ACC4332E for ; Sat, 27 Feb 2021 17:18:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9D7E464EB7 for ; Sat, 27 Feb 2021 17:18:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230237AbhB0RPy (ORCPT ); Sat, 27 Feb 2021 12:15:54 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:47950 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230258AbhB0REH (ORCPT ); Sat, 27 Feb 2021 12:04:07 -0500 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11RGxcOU033030; Sat, 27 Feb 2021 17:00: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-2020-01-29; bh=88n/iaEqMlDdNWimYTScm0G2+2hTQhxw1NLa1CnNe7E=; b=TkiCBFHqDdMSqANTiWKJPUahkN9zWdbsedaPcjVSH/5FO9AOQ5sc4mKxuBUuheZ3/Rwy IQB3F0C8Z3P22Gr8E/AQne5Ne0JI/+B6vT8279K7B5QDa1xr4GtFpnTLYxyeQDSlng5B /EFT1xSgwWTKRqg5yZ4fqVUiINn3USc+S5lMsG1rApDBFWzILKSVApF27kDWjE9CdxLB kNgXsskqfDoaQaTpmc3UCIwVokqCtZZ/1aXU5moY3b2tS7MQgtIhJvCFUn9CPxdPbWOd BNMlvdDomWRCNf+Dgw1jSDC5ZreLtv3LrsEyQFNKlIj4g0od0/mEsqQEAi4Vh1oTaZ6v Jg== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by aserp2130.oracle.com with ESMTP id 36ybkb0v49-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 27 Feb 2021 17:00:31 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11RGsmDA041731; Sat, 27 Feb 2021 17:00:31 GMT Received: from nam04-dm6-obe.outbound.protection.outlook.com (mail-dm6nam08lp2048.outbound.protection.outlook.com [104.47.73.48]) by userp3030.oracle.com with ESMTP id 36yb6sam7c-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 27 Feb 2021 17:00:30 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gM7ooBypX5IdPLQGoPthwd8USueoEiNAWVi8XONTlrTVKHQddbpJqKvlrCiiSmbd108S79Q0OfyNP5M6YAyf0TGo93CGLo9xKMMGinX77OyfzBueV0MFIS7xlgKIyU0PxVna/HWmrchRClam2oJOc0A++iI/TEavEfD2xzCXaw1woX8QtgI9OcwvIa9QcyHFwxa2QsJbeqL8/5Q5qDsNibyQbOw1u6q54C/xGxddRYa6LA26v509BzQigD5thHCsd+eiKT7eo0KIZrQuTGAC2XQHRv8RYVSgopXUhE1JF996I/H/0RdBzyrSibnXS7++Yxpb9s+e/D+ckFrfB/Ngaw== 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-SenderADCheck; bh=88n/iaEqMlDdNWimYTScm0G2+2hTQhxw1NLa1CnNe7E=; b=lmQ71PgWaPIhLsRQ6WFVhQsOiVAACM9kxhwa3VULb1uOY442Mb4/Q0zZeQV042uc5/JVqK2WX6X9QasNrdmFM8gfJmGsMJLrdzxxX/bQ6DrTCEzgXV7w5o71VhKtc6FGSXUNXYjj8ddb5aUdNM5EZmNK5icHCeXU4zCJAg2VODtHFybkqbL8J78qsxwTOY3lvCxoaCv1oVZM8gBWK8Pn8vpLiBZK+/PN44hC9Z9U3pcSdu5kPjFG1I7jS5tjSZGINqP1+tCQ4iWltriN0AFraGn/ZhvLUN/4/aqnCuDOEPG89uyklVTnX5eoQNzCJi/Uaeh6rtE0cf7yJ1QJty3N6w== 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=88n/iaEqMlDdNWimYTScm0G2+2hTQhxw1NLa1CnNe7E=; b=ccdPfCJ/BiwZSELmerP1l4njrWPjuNx5tnILNVR9LmEI5TOU73vVnsEWRh3QYIrihpEfOCGwGx5EUK4JSnPM61Zq83MXzyN4pS1w1jTkQ4Ru5iOUcnJeBgiVhnBs9dGznlIROuj7QdwuJJOnMyoU7ThGjNQp0iLLFFb+ynmm8bs= Authentication-Results: gmail.com; dkim=none (message not signed) header.d=none; gmail.com; dmarc=none action=none header.from=oracle.com; Received: from DM6PR10MB3577.namprd10.prod.outlook.com (2603:10b6:5:152::16) by DM6PR10MB3499.namprd10.prod.outlook.com (2603:10b6:5:178::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.22; Sat, 27 Feb 2021 17:00:28 +0000 Received: from DM6PR10MB3577.namprd10.prod.outlook.com ([fe80::5120:8a97:3547:bc3b]) by DM6PR10MB3577.namprd10.prod.outlook.com ([fe80::5120:8a97:3547:bc3b%7]) with mapi id 15.20.3868.034; Sat, 27 Feb 2021 17:00:28 +0000 From: Mike Christie To: bostroesser@gmail.com, mst@redhat.com, stefanha@redhat.com, Chaitanya.Kulkarni@wdc.com, hch@lst.de, loberman@redhat.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org Cc: Mike Christie Subject: [PATCH 15/25] target: add gfp_t arg to target_cmd_init_cdb Date: Sat, 27 Feb 2021 10:59:56 -0600 Message-Id: <20210227170006.5077-16-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210227170006.5077-1-michael.christie@oracle.com> References: <20210227170006.5077-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: CH0PR13CA0027.namprd13.prod.outlook.com (2603:10b6:610:b1::32) To DM6PR10MB3577.namprd10.prod.outlook.com (2603:10b6:5:152::16) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by CH0PR13CA0027.namprd13.prod.outlook.com (2603:10b6:610:b1::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.13 via Frontend Transport; Sat, 27 Feb 2021 17:00:28 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 75de0d46-29ea-4506-436c-08d8db412f45 X-MS-TrafficTypeDiagnostic: DM6PR10MB3499: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3513; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: sKdW98JTV8csiD/l/tQ8ArkxsJOYblXhIuD/+D4Wt1B1V2pK0ICMBPKE70AFsNjI2FMCtqH7JPx9x9w1Y2et01AushkNR1+k7hL0WkG49XuY8f4DjkYIkxdf1oMjKa0hhPREZ/SmedWs+PE24W56LVvlrOY/N2ZB7QN+RyRuOTxH6KL6DTOnMw/67bMpRwtW30GS0kZaXnNA5LMLUNLtM/LvFcAPrQVIYnKC0WilkqBW0rm4YdIA+a6X9upyZLMZO/mQ1M4EmnKRNvQk8l3JfpgRNqhSQSA9FH00xdQxg5VQAOf5d1Myh2baYtTIfMXi8oAdnGfrRUaS4fNYjbwO3627x8qlh3H8Pcpn1n45uatle1dHcQD1qNJ3yIN3QUwLnLI6ZVOyo1ij4xhTgYsu0JsDVHUDQn65EoguEQRLGu204yKfVkjuXWIMoTyWVeUh7TBKNpu/o3Mu4X1NQsyjFEeW4vAACquq8xkjOPM8RJ0CnsTdbKHLGylmB8bDWdcnucbrOWl1GVfylonrIGzUFVCMxdfo05F+I3dUH79q/zT/2QXyQ15/o6uO6WWwAZENy3k7afUAcEFH+ysggtvJ1A== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR10MB3577.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(136003)(39860400002)(376002)(396003)(366004)(346002)(6666004)(956004)(36756003)(316002)(6512007)(86362001)(69590400012)(6506007)(1076003)(8936002)(83380400001)(2616005)(478600001)(2906002)(4326008)(186003)(16526019)(66556008)(5660300002)(66946007)(6486002)(66476007)(8676002)(107886003)(26005)(52116002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: /GDuHgznm4K1VXLyMM43XKAwiGoeXCZ0ERUtb+Jk6x2kQ2eeNLP4kdm+8buMbBC8BGDIlSkT9uW6+enWqUW7vzB6rpsjiDZ04Cb0Rhbrnnt2w9YgpUlqjW8ltXb58CYi5PXQivlZ10dhIl5RoTHtZXDmtDsAKqt/vtamjXQo86SivlQOKFdoTduoJteLBIUMMMTdh2elUov+DNsAenbSz/R1+J3raFldWJUwe5EBysbPeVnUZllDRfX2XyYBAJG/hM9Q6Fo6exRTu40ArU7mMcITTi+HsngJwGybZsx52xJle3t9cmhVf7SScsu2qZtQ0uRJ1NSkWJIACIZOCWsma+2Jl/dfJ1j/BRAQgLa2LG15ARMuioz4pAvCzni4Ovw4jRnXsb0EvXFCDjSZrXdy2C0NP9P34tY63xEyep1DWHVOGHgRyUdRoYXkHAg7DxLPE4EhD9EdIfpyexs1G2ZyOUWr3bsnz+N2BWTqOPn9jLXVDl78u7w7l5/DnES8LpA9kK+SbRZXeCDE9JCmYNKd9uikodgrdOty7v3VMbMewoyEtuB6aG7DcgA17iL4jR4WWfQLq1Rl/2mUf/a8EK1XYhjkV5Y2xTDB7VQk91xrLA6pNx99eayFoK5LtBqaSouBN2qAaQtcwJCptf0pVorZ8VBCpeHPQoMJ0OMjSw6l1qVecfMOksLFKeTz7WbEXtKrT0twAx4mtFQr9gDIRugCiiy9SpfR6wl/tZQlwxlF3NEwYijz4Q6wVZWC6AnDxCw/071hJ8qf/Nde1OgeasGcD6gU1XGg1orEp6uyqzCa6ByrIuoXULVe1moP+IBJLXqNC0QU+gR8fiDCih4YshJy7lg59b5zsYXMf+42bheENpczValgsBWHTKm0lNVGjdijwWT8YdkecKGdG6UU7gHkXAPWDC/SEVH9kyBTXxTFgGpaCWdTrw+dpP1b3U7wN3rcqkmtdkbC3d1uGKzfb5VwnM82I0W3NuxA3ARB2mAZvB2z02jp/o5DO+hKYd+eZzxEc/uKDWuqB458VmLDduhPanbAX9r3nXYYisvJNZAUaDD+x6IYTyYqZvKYtj3whzJOLIr8s6aC3Hp1Fy0RTdQDw7CmQk2YtTbSf7o8ilqn/8a4Wksy0TkdCQ2ww76f6ERNbYfUUhMpRFFiDAur5CStyth1cJsKQ7ZwwdjnjuGDnPNDIrhPpqDA8L/2BzB+GyqGAtembLzqzJzNDOUfdRqDLDZjeRhHgGoZQa7qIUwf9+/xdpZeTjsvVdGBBdFCBX72G0jL29paxANOC0j4nlwWPRiv7F/4bEwYkoN9w+oKJDfSFNjy8VF+tqrU6Sab0pqG X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 75de0d46-29ea-4506-436c-08d8db412f45 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB3577.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Feb 2021 17:00:28.7629 (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: pOo9iS8cCHKsqO4VYJ0/PBY7h2JfKT1QXa62RUVgbVeZlOF9YVgyvBRBB9TqHsv3DWqaKhyz4HbgpLSYJ0gxelrGSlctKjwW0klUN3l6Oo8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB3499 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9908 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 suspectscore=0 mlxlogscore=999 bulkscore=0 malwarescore=0 mlxscore=0 spamscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102270145 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9908 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 impostorscore=0 suspectscore=0 phishscore=0 bulkscore=0 mlxscore=0 lowpriorityscore=0 clxscore=1015 mlxlogscore=999 adultscore=0 malwarescore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102270146 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org tcm_loop could be used like a normal block device, so we can't use GFP_KERNEL and should use GFP_NOIO. This adds a gfp_t arg to target_cmd_init_cdb and covnerts the users. For every driver but loop I kept GFP_KERNEL. This will also be useful in the later patches where loop needs to do target_submit_prep from interrupt context to get a ref to the se_device, and so it will need to use GFP_ATOMIC. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig Tested-by: Laurence Oberman --- drivers/infiniband/ulp/srpt/ib_srpt.c | 3 ++- drivers/scsi/qla2xxx/tcm_qla2xxx.c | 3 ++- drivers/target/iscsi/iscsi_target.c | 3 ++- drivers/target/loopback/tcm_loop.c | 3 ++- drivers/target/target_core_transport.c | 14 ++++++++------ drivers/target/target_core_xcopy.c | 2 +- drivers/target/tcm_fc/tfc_cmd.c | 2 +- drivers/vhost/scsi.c | 2 +- drivers/xen/xen-scsiback.c | 2 +- include/target/target_core_fabric.h | 5 +++-- 10 files changed, 23 insertions(+), 16 deletions(-) diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c index 87741e0b4bca..51c386a215f5 100644 --- a/drivers/infiniband/ulp/srpt/ib_srpt.c +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c @@ -1537,7 +1537,8 @@ static void srpt_handle_cmd(struct srpt_rdma_ch *ch, goto busy; } - if (target_submit_prep(cmd, srp_cmd->cdb, sg, sg_cnt, NULL, 0, NULL, 0)) + if (target_submit_prep(cmd, srp_cmd->cdb, sg, sg_cnt, NULL, 0, NULL, 0, + GFP_KERNEL)) return; target_submit(cmd); diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c b/drivers/scsi/qla2xxx/tcm_qla2xxx.c index 56394d901791..12a2265eb2de 100644 --- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c +++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c @@ -492,7 +492,8 @@ static int tcm_qla2xxx_handle_cmd(scsi_qla_host_t *vha, struct qla_tgt_cmd *cmd, if (rc) return rc; - if (target_submit_prep(se_cmd, cdb, NULL, 0, NULL, 0, NULL, 0)) + if (target_submit_prep(se_cmd, cdb, NULL, 0, NULL, 0, NULL, 0, + GFP_KERNEL)) return 0; target_submit(se_cmd); diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c index f2107705f2ea..566adfde1661 100644 --- a/drivers/target/iscsi/iscsi_target.c +++ b/drivers/target/iscsi/iscsi_target.c @@ -1166,7 +1166,8 @@ int iscsit_setup_scsi_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd, target_get_sess_cmd(&cmd->se_cmd, true); - cmd->sense_reason = target_cmd_init_cdb(&cmd->se_cmd, hdr->cdb); + cmd->sense_reason = target_cmd_init_cdb(&cmd->se_cmd, hdr->cdb, + GFP_KERNEL); if (cmd->sense_reason) { if (cmd->sense_reason == TCM_OUT_OF_RESOURCES) { return iscsit_add_reject_cmd(cmd, diff --git a/drivers/target/loopback/tcm_loop.c b/drivers/target/loopback/tcm_loop.c index 461f4125fcab..677e4b8f0642 100644 --- a/drivers/target/loopback/tcm_loop.c +++ b/drivers/target/loopback/tcm_loop.c @@ -156,7 +156,8 @@ static void tcm_loop_submission_work(struct work_struct *work) if (target_submit_prep(se_cmd, sc->cmnd, scsi_sglist(sc), scsi_sg_count(sc), sgl_bidi, sgl_bidi_count, - scsi_prot_sglist(sc), scsi_prot_sg_count(sc))) + scsi_prot_sglist(sc), scsi_prot_sg_count(sc), + GFP_NOIO)) return; target_submit(se_cmd); diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index 1f35cce6e92b..6c88ca832da6 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@ -1427,7 +1427,7 @@ transport_check_alloc_task_attr(struct se_cmd *cmd) } sense_reason_t -target_cmd_init_cdb(struct se_cmd *cmd, unsigned char *cdb) +target_cmd_init_cdb(struct se_cmd *cmd, unsigned char *cdb, gfp_t gfp) { sense_reason_t ret; @@ -1448,8 +1448,7 @@ target_cmd_init_cdb(struct se_cmd *cmd, unsigned char *cdb) * setup the pointer from __t_task_cdb to t_task_cdb. */ if (scsi_command_size(cdb) > sizeof(cmd->__t_task_cdb)) { - cmd->t_task_cdb = kzalloc(scsi_command_size(cdb), - GFP_KERNEL); + cmd->t_task_cdb = kzalloc(scsi_command_size(cdb), gfp); if (!cmd->t_task_cdb) { pr_err("Unable to allocate cmd->t_task_cdb" " %u > sizeof(cmd->__t_task_cdb): %lu ops\n", @@ -1638,6 +1637,7 @@ EXPORT_SYMBOL_GPL(target_init_cmd); * @sgl_bidi_count: scatterlist count for bidirectional READ mapping * @sgl_prot: struct scatterlist memory protection information * @sgl_prot_count: scatterlist count for protection information + * @gfp: gfp allocation type * * Returns: * - less than zero to signal failure. @@ -1648,11 +1648,12 @@ EXPORT_SYMBOL_GPL(target_init_cmd); int target_submit_prep(struct se_cmd *se_cmd, unsigned char *cdb, struct scatterlist *sgl, u32 sgl_count, struct scatterlist *sgl_bidi, u32 sgl_bidi_count, - struct scatterlist *sgl_prot, u32 sgl_prot_count) + struct scatterlist *sgl_prot, u32 sgl_prot_count, + gfp_t gfp) { sense_reason_t rc; - rc = target_cmd_init_cdb(se_cmd, cdb); + rc = target_cmd_init_cdb(se_cmd, cdb, gfp); if (rc) goto send_cc_direct; @@ -1788,7 +1789,8 @@ void target_submit_cmd(struct se_cmd *se_cmd, struct se_session *se_sess, if (rc) return; - if (target_submit_prep(se_cmd, cdb, NULL, 0, NULL, 0, NULL, 0)) + if (target_submit_prep(se_cmd, cdb, NULL, 0, NULL, 0, NULL, 0, + GFP_KERNEL)) return; target_submit(se_cmd); diff --git a/drivers/target/target_core_xcopy.c b/drivers/target/target_core_xcopy.c index e86cc6135587..d31ed071cb08 100644 --- a/drivers/target/target_core_xcopy.c +++ b/drivers/target/target_core_xcopy.c @@ -554,7 +554,7 @@ static int target_xcopy_setup_pt_cmd( } cmd->se_cmd_flags |= SCF_SE_LUN_CMD; - if (target_cmd_init_cdb(cmd, cdb)) + if (target_cmd_init_cdb(cmd, cdb, GFP_KERNEL)) return -EINVAL; cmd->tag = 0; diff --git a/drivers/target/tcm_fc/tfc_cmd.c b/drivers/target/tcm_fc/tfc_cmd.c index 1376501ee3d0..410b723f9d79 100644 --- a/drivers/target/tcm_fc/tfc_cmd.c +++ b/drivers/target/tcm_fc/tfc_cmd.c @@ -555,7 +555,7 @@ static void ft_send_work(struct work_struct *work) goto err; if (target_submit_prep(&cmd->se_cmd, fcp->fc_cdb, NULL, 0, NULL, 0, - NULL, 0)) + NULL, 0, GFP_KERNEL)) return; target_submit(&cmd->se_cmd); diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c index 76508d408bb3..93f5631b469c 100644 --- a/drivers/vhost/scsi.c +++ b/drivers/vhost/scsi.c @@ -811,7 +811,7 @@ static void vhost_scsi_submission_work(struct work_struct *work) if (target_submit_prep(se_cmd, cmd->tvc_cdb, sg_ptr, cmd->tvc_sgl_count, NULL, 0, sg_prot_ptr, - cmd->tvc_prot_sgl_count)) + cmd->tvc_prot_sgl_count, GFP_KERNEL)) return; target_submit(se_cmd); diff --git a/drivers/xen/xen-scsiback.c b/drivers/xen/xen-scsiback.c index 7bf9a6bede6d..eb3d8e35cbcd 100644 --- a/drivers/xen/xen-scsiback.c +++ b/drivers/xen/xen-scsiback.c @@ -368,7 +368,7 @@ static void scsiback_cmd_exec(struct vscsibk_pend *pending_req) pending_req->sc_data_direction, TARGET_SCF_ACK_KREF); if (target_submit_prep(se_cmd, pending_req->cmnd, pending_req->sgl, - pending_req->n_sg, NULL, 0, NULL, 0)) + pending_req->n_sg, NULL, 0, NULL, 0, GFP_KERNEL)) return; target_submit(se_cmd); diff --git a/include/target/target_core_fabric.h b/include/target/target_core_fabric.h index 86b0d4a7df92..0543ab107723 100644 --- a/include/target/target_core_fabric.h +++ b/include/target/target_core_fabric.h @@ -157,10 +157,11 @@ int target_init_cmd(struct se_cmd *se_cmd, struct se_session *se_sess, int target_submit_prep(struct se_cmd *se_cmd, unsigned char *cdb, struct scatterlist *sgl, u32 sgl_count, struct scatterlist *sgl_bidi, u32 sgl_bidi_count, - struct scatterlist *sgl_prot, u32 sgl_prot_count); + struct scatterlist *sgl_prot, u32 sgl_prot_count, gfp_t gfp); void target_submit(struct se_cmd *se_cmd); sense_reason_t transport_lookup_cmd_lun(struct se_cmd *); -sense_reason_t target_cmd_init_cdb(struct se_cmd *, unsigned char *); +sense_reason_t target_cmd_init_cdb(struct se_cmd *se_cmd, unsigned char *cdb, + gfp_t gfp); sense_reason_t target_cmd_parse_cdb(struct se_cmd *); void target_submit_cmd(struct se_cmd *, struct se_session *, unsigned char *, unsigned char *, u64, u32, int, int, int); From patchwork Sat Feb 27 16:59:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 388361 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 85837C433E0 for ; Sat, 27 Feb 2021 17:05:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4CE1D64E24 for ; Sat, 27 Feb 2021 17:05:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230306AbhB0RFS (ORCPT ); Sat, 27 Feb 2021 12:05:18 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:59346 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230223AbhB0RCH (ORCPT ); Sat, 27 Feb 2021 12:02:07 -0500 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11RH09ss005231; Sat, 27 Feb 2021 17:00: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-2020-01-29; bh=9ROJe34rBy+wJHGYiwS9ievWK9z3GgeKUC3bgZLnp7I=; b=e9IJm5a5P9u0n58PwtYSaOoiyCEiwRxE4TxHUDoh//q2oBN15Yasua4jrwjObqP7KKWn ua8r/47DA3jI2zztMKtZwPcvM86E73Qu509nMEyOwBiXFWtPT3n/xYUCZy7w2cOccJUX 9Q77cvp6Dq6kafKgTes0LweqA9F8lMMpuh/2KADoI4QYDZY5ul6mQKYeOXybT5fXbBF6 ZFQmpkQBdetETTLiBTNL9PepBR/vW3pWSmZTemsgDbL8ZeJOuxPSNaBlSSECq5rv2GUf pDRRja03OrAzR8EfSJWhI0t2Qj+lFvMJmq05mYHvQycwH9atw766qP0NcPxVnDBSsk79 Hw== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2120.oracle.com with ESMTP id 36ye1m0qpp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 27 Feb 2021 17:00:34 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11RH0MBP173116; Sat, 27 Feb 2021 17:00:34 GMT Received: from nam04-dm6-obe.outbound.protection.outlook.com (mail-dm6nam08lp2040.outbound.protection.outlook.com [104.47.73.40]) by userp3020.oracle.com with ESMTP id 36yddhy8rt-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 27 Feb 2021 17:00:33 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=F5xEJxE60G5yewLBD+NQT4MNdIAZ+B01rVnPxUTA4kYX5GJhIFlkzyQPSkJyJjTOB3NNe46jnWpDAM5RBa9AUXnOJb3MyB5fgXAu2OhCbXXImj2racdGpQVp+orCiLmwj2GTUjNGi2dQdOIY15y/svLODc4n7/aowunwtvmX6ihbTuzZx6Mb+xk8sukxK+XfI3Smj6w5mZd08cbIhoKM/Zzb9GJcQUTqETwjAcpqNvrjM5J6SvvoFBW9utAkGXo4psQe6k4sWKy838Abo7o256OFON8sgAHsbSMkwsbELm7cBwbpUszQH7G81s/2KK3tcV+rAoedDzJv069XghYlkA== 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-SenderADCheck; bh=9ROJe34rBy+wJHGYiwS9ievWK9z3GgeKUC3bgZLnp7I=; b=cjGxLUt7+XD2TCbLSfA4hpX6OmnB/LRFcDJJb7ElYs0AH61TiShsJR9QuTseb/32XM6W1CTnlgfY9iJN6coe21+z/yT9V0qUWb63yduWHkiEJ4q+p8rPTzJbLMDp+Bao3aT0Pd0GjNjrqZblPFAh8gYichRDrHhcskbiuNjNao4Cwotk0TV2OEk9LDK+L4315StSB/YGMzpQn+sMNQw4m1NwVEUiSD2DfHGEbuBbWDAWNjV97WPgaNln04V6xsM9X9kDR3k4pSJf31N0W6Y9IZE9HZb1gWYJUFaSECxsSa6Tvh6x+KfjQ4Fw6izkNoGLtvlipJRGePBFpYvkaVdjhg== 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=9ROJe34rBy+wJHGYiwS9ievWK9z3GgeKUC3bgZLnp7I=; b=pCErwY71M4fWDF6twAU+cdauJ08HhGDldCqOUSFjhcjjSyzbjckYs1y+Dzow0LedWKCBCKple90NYUV2hZ8qrZsGuwg980th25kA2mUBwJgKn5ciNSPf+LdEICXdFOK8/chPVa3mi/OVPWcDUAoX0S/W1qz8Vgdram4FUd7RyGk= Authentication-Results: gmail.com; dkim=none (message not signed) header.d=none; gmail.com; dmarc=none action=none header.from=oracle.com; Received: from DM6PR10MB3577.namprd10.prod.outlook.com (2603:10b6:5:152::16) by DM6PR10MB3499.namprd10.prod.outlook.com (2603:10b6:5:178::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.22; Sat, 27 Feb 2021 17:00:31 +0000 Received: from DM6PR10MB3577.namprd10.prod.outlook.com ([fe80::5120:8a97:3547:bc3b]) by DM6PR10MB3577.namprd10.prod.outlook.com ([fe80::5120:8a97:3547:bc3b%7]) with mapi id 15.20.3868.034; Sat, 27 Feb 2021 17:00:31 +0000 From: Mike Christie To: bostroesser@gmail.com, mst@redhat.com, stefanha@redhat.com, Chaitanya.Kulkarni@wdc.com, hch@lst.de, loberman@redhat.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org Cc: Mike Christie Subject: [PATCH 18/25] tcm loop: use blk cmd allocator for se_cmds Date: Sat, 27 Feb 2021 10:59:59 -0600 Message-Id: <20210227170006.5077-19-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210227170006.5077-1-michael.christie@oracle.com> References: <20210227170006.5077-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: CH0PR13CA0027.namprd13.prod.outlook.com (2603:10b6:610:b1::32) To DM6PR10MB3577.namprd10.prod.outlook.com (2603:10b6:5:152::16) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by CH0PR13CA0027.namprd13.prod.outlook.com (2603:10b6:610:b1::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.13 via Frontend Transport; Sat, 27 Feb 2021 17:00:30 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6cd23031-8519-4045-d107-08d8db4130d4 X-MS-TrafficTypeDiagnostic: DM6PR10MB3499: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1002; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wD7z2L3Ga4dd/uDYrrQKk4ghvYhGTjOX1ugZ0HCpROHzv+3cFB8vnTD1tWOz4KyaMWUnh+8XiAmCo+TNVcsRNnOGZL5B84zBnVCu/LphVjUHeHdx2E1rfStNxAa9bu/oWOgDXv4eHJIWF+GuXgyz1opZ9QQyXi9AF9mPdx5WO5bj1VPbB7P7/dIIaQVAQfJ8rF4sa+9q8YeuZS0UXG8SVDe7WL9/SFthnzFMUh/dDpU9do4eqc+gsQGVKnEsGRkzfFknkgq5htNf9/vYqnYc57cfs0x+NLeDg2+oWc5BC4inZX54eabVL3deRDNu86H40JlblNFgZdFpCN4MZHTckHVfqETi5wnftlV++usgmMfYE9PBydLdpl5xUSMUGx1gdsiI8ILJBrRHuL2te9KGc01YewCrOLIyYoiHtS3z7Q7xCuCastwHxE9XzxQTYENAtxIDUFw9DDrDOoLNrehO763NTAldkMBIdUCQRhhTuGzwctWRJzToPne5S6dqjIH9Vqw9uBmvRMJwimd97R5NMDrUmDSQLBFRjUz8N1KsxQ0CG+7SFRBHF/of1Qgr7DwkXFIFLQ0usIBCYf7laXsBtQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR10MB3577.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(136003)(39860400002)(376002)(396003)(366004)(346002)(6666004)(956004)(36756003)(316002)(6512007)(86362001)(69590400012)(6506007)(1076003)(8936002)(83380400001)(2616005)(478600001)(2906002)(4326008)(186003)(16526019)(66556008)(5660300002)(66946007)(6486002)(66476007)(8676002)(107886003)(26005)(52116002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: t5bVcnNUB20Ix18lYYIjRDdI3leFITM8mb9bxpJwHJ63XhkIdhY2TDCPp/3USbshrDikHffKxPfwZG+cdsQCixR+N3AxehW+kveEsuRJ70jbn1mNMp6F3QeBQ/ZqyTXZ9YRWTp8Cn5Xr/das1ixix2apYWA11BY0aYRJZzHPIP28P1S1F+U2rN1FTRtjLvL0SjEXSyf7jY+lwkvNU6yjD7Xd7eyyypC4+9lI2dhZfajZ37wii511V//Dcy5Rq3oMGPm6Mh1vrubozVifoCJfYxrYkB/yxRmr+ZoroFomfbV5NM+M4pNAtXfL88COPaOX2R7SJ9Pl18cHVC3Fa88i6v0ZDaze6eHjZVUThu1w1wOUnUqmA7oBk1bWiYcMMwZsQzCqYcKIB8ILmuCa77CbBJ300d50DuPelxiLSPsIxSGM4i9Pfuxb/JjT+/5RIQ336Q8s4wuu/3U/EEyDRp9Tp/5WNIJX7EsAag+utyOBGJQ6Lx7tfGzaN6i/UHOPBued3nPIdd67gAjMae621qlexxa3xxYHXk55jv10aEIUl/98jlPL+5x63/ifWjA0E3lmDh2+bPxoZjq8P/3m5ieBomzDT5sfljoQdlBsv00cZ9OMFvAZj1eqDanekQlLSA4ZEg57E/5BagRPgXofBh0UtNMKjhE2QgYpb0fMHBZHqKNFM4XF1NRHgQJnbrVyGxPnXBFyN4Os67Wq1Ir0LKU0ju3XR93p0KuXjyl+6IefQZWZQ25kSAC0KaDIPU0eHeXolgwGcYTGS90jB0adOKGIxx27Q/jo5A2USJ6FHAYbqeqpvsufRMJicCFUJhMZqCr6qTntTqRv4GS3+AZ9uysPN5V2T+WAvEGlPo1bAfNKyxtrSH4UKR8sYHksT84OzRQAXtXxOz2RotA5L+PHaIQj9qGgxL//zATVjZUsmBqF8gSTdtY19nVIGhWqqm1ilcJSXDjCojIy+OOKvV8LAqaD+sr/g7MnQPdb7k7feAGo+QlJRHQs8/M2yd44XwHQoiWQN+6/Zw/w7dtsDdg5z2vZTT3Fq96QsEBzHHGFsqXoGKgEBN9iqs282n3Wqf39FW3ubYsL7Oe3hT/wBK8f1yzbNf7LJBzVlFwJE8TNWGTGEHgsckp79vrqMoL0aWEHm428tJoONiBMnphxIvWBy6z4N4OVsUciEz6BFa0EctiJTx02g7g9Zt2rAnNQASuW2l6591QFudqGup6gn7kiAKhU1LIgPWIWyIU7Xmj7M/nwHqAN/5HTPSUoUdflKzGoIsR8WthD34PamV7Hm6GghBkn00GRxg3yCvbY6AaBgY0+tYZneInnGlJlCdbO8gA5HleT X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6cd23031-8519-4045-d107-08d8db4130d4 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB3577.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Feb 2021 17:00:31.3444 (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: hneLJIpuFphS+DN+SdUviJMBADd0BG0jAi3OuIW2jAsjlt1ZMvDkhW90ba9nF+K6AT40EdoPwARWkhg8KiuFRbCBaJ5K8QsLF/mAMT+A8TU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB3499 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9908 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxlogscore=999 spamscore=0 malwarescore=0 mlxscore=0 phishscore=0 bulkscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102270146 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9908 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 priorityscore=1501 mlxlogscore=999 impostorscore=0 suspectscore=0 adultscore=0 malwarescore=0 mlxscore=0 spamscore=0 bulkscore=0 lowpriorityscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102270146 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This just has tcm loop use the block layer cmd allocator for se_cmds instead of using the tcm_loop_cmd_cache. In future patches when we can use the host tags for internal requests like TMFs we can completely kill the tcm_loop_cmd_cache. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig Tested-by: Laurence Oberman --- drivers/target/loopback/tcm_loop.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/drivers/target/loopback/tcm_loop.c b/drivers/target/loopback/tcm_loop.c index 677e4b8f0642..fb877aec6321 100644 --- a/drivers/target/loopback/tcm_loop.c +++ b/drivers/target/loopback/tcm_loop.c @@ -67,8 +67,12 @@ static void tcm_loop_release_cmd(struct se_cmd *se_cmd) { struct tcm_loop_cmd *tl_cmd = container_of(se_cmd, struct tcm_loop_cmd, tl_se_cmd); + struct scsi_cmnd *sc = tl_cmd->sc; - kmem_cache_free(tcm_loop_cmd_cache, tl_cmd); + if (se_cmd->se_cmd_flags & SCF_SCSI_TMR_CDB) + kmem_cache_free(tcm_loop_cmd_cache, tl_cmd); + else + sc->scsi_done(sc); } static int tcm_loop_show_info(struct seq_file *m, struct Scsi_Host *host) @@ -164,7 +168,6 @@ static void tcm_loop_submission_work(struct work_struct *work) return; out_done: - kmem_cache_free(tcm_loop_cmd_cache, tl_cmd); sc->scsi_done(sc); } @@ -174,20 +177,14 @@ static void tcm_loop_submission_work(struct work_struct *work) */ static int tcm_loop_queuecommand(struct Scsi_Host *sh, struct scsi_cmnd *sc) { - struct tcm_loop_cmd *tl_cmd; + struct tcm_loop_cmd *tl_cmd = scsi_cmd_priv(sc); pr_debug("%s() %d:%d:%d:%llu got CDB: 0x%02x scsi_buf_len: %u\n", __func__, sc->device->host->host_no, sc->device->id, sc->device->channel, sc->device->lun, sc->cmnd[0], scsi_bufflen(sc)); - tl_cmd = kmem_cache_zalloc(tcm_loop_cmd_cache, GFP_ATOMIC); - if (!tl_cmd) { - set_host_byte(sc, DID_ERROR); - sc->scsi_done(sc); - return 0; - } - + memset(tl_cmd, 0, sizeof(*tl_cmd)); tl_cmd->sc = sc; tl_cmd->sc_cmd_tag = sc->request->tag; INIT_WORK(&tl_cmd->work, tcm_loop_submission_work); @@ -319,6 +316,7 @@ static struct scsi_host_template tcm_loop_driver_template = { .dma_boundary = PAGE_SIZE - 1, .module = THIS_MODULE, .track_queue_depth = 1, + .cmd_size = sizeof(struct tcm_loop_cmd), }; static int tcm_loop_driver_probe(struct device *dev) @@ -579,7 +577,6 @@ static int tcm_loop_queue_data_or_status(const char *func, if ((se_cmd->se_cmd_flags & SCF_OVERFLOW_BIT) || (se_cmd->se_cmd_flags & SCF_UNDERFLOW_BIT)) scsi_set_resid(sc, se_cmd->residual_count); - sc->scsi_done(sc); return 0; } From patchwork Sat Feb 27 17:00:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 388360 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5F0ABC433DB for ; Sat, 27 Feb 2021 17:07:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2435B64E84 for ; Sat, 27 Feb 2021 17:07:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230132AbhB0RGQ (ORCPT ); Sat, 27 Feb 2021 12:06:16 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:51608 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230225AbhB0RCH (ORCPT ); Sat, 27 Feb 2021 12:02:07 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11RGxR87078351; Sat, 27 Feb 2021 17:00:37 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=vlX6xTkUTzqjxWOhaywa5aYgPBH03VRJJE2/sySbgOk=; b=hzdKZyyBLI/ZG06xZb4FuipT4PeJ4ORKL/w6xM+6vsFO9MBzMVBtXbtdGSkNcGYbRhSu Cpk+rh8pdFhDpzdQY2+VlhTajNWFQKMJEnMNPUx5Y/9sYrjGyPfGNojpC3gi+4qSUbYy 3gvA7Vtx6GHRAtz8QhIzvyUJBNZW/v04ehBUFYN5PCiUiMoUOqIO+NDEOcY5cj0ickKY uJElUr2upbVOK8fC9os5QwCV6zf8xyTznzaOxGXeeJKD4vM+6kKL0XrulUk9wVD72Ndj yHZVJ45g+7dlh7nGnT7AX9Dnk16CdtjSxiLBdax/TmvS1guMYseHiREKF4HxRoK1b6A/ 0A== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2130.oracle.com with ESMTP id 36ydgr0rs7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 27 Feb 2021 17:00:36 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11RH0Mbi173209; Sat, 27 Feb 2021 17:00:36 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2108.outbound.protection.outlook.com [104.47.70.108]) by userp3020.oracle.com with ESMTP id 36yddhy8te-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 27 Feb 2021 17:00:36 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QvOviQC1YGoObEG5x7p5QZE1qO6Vvhv550Emgs4GQu0QdFcQ+oeacPP+QiZPjLCl7vFJqXtxVDMbRuhnuOONpfA48P/7MNE3Ig1zS1BKI6CNEsuhGUzNJp4eb6iaHY35bJmyJqA+aWtLgAbL4+Eq5J1yQsQnl/6Zq2v0Ude8o3ekOQnIM3pyOizauahJSf1emldoE57YkxG4Zy12t/ABOzyWC5Yh8Acz0DtXIY5Phjn32TCaigrcDjX3nYP9LqEuoiPOPNbz+8Fj0ud+9hLGhF/uwnJ/5WqPx5bBCqoTGLuuHlgTuVIZcfpWWwqcgYSdC5jqBkiuUzZep7mD0wH57w== 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-SenderADCheck; bh=vlX6xTkUTzqjxWOhaywa5aYgPBH03VRJJE2/sySbgOk=; b=IZe/NmZy+umh/RTs7esQ5tjTiF8u8KIl2Tiqf6VrUV6ZI1Z0heqSbib3j59aSQoVeuquueuhcnFW6q3sep4/ykZaJhhZkjq+mDzH+Xywy4AKXnt9VYq0IiOp6ejrOfz2Ulj8/q5ZCMrQ465KXFufqATc59YVaFCvWABlmFG6A0MeCJ/FrFD5euhuGvtIPQG6O6XeNwAiSe7Cm69OsHeTKYvFDWEqpTyIceDnVkdgD3CPSsvoQCzp+7bktkv6U2S3KxFXedNCp30D318gYmd7Ye+AN+ZG/CdYiow7/mjDntgjCyjYvJlFdcP9ABO0qkBB1035f84RmO52i6lnt0RuEA== 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=vlX6xTkUTzqjxWOhaywa5aYgPBH03VRJJE2/sySbgOk=; b=bI6tVWkt0YBXEVS4oSBDeAaEKk6OqHqDPZ1DbugLZCw4JOz9cghu0Wq7aZC9MmsSi2qHQZkggCmyO1eIcrJqibJMhgN5WxB2bbLciMLrVJEN22efWztjkPFQjtkmFY6lZ572jBgUvIjJpQlKJPXzgTT94GzSLW3Z/ywmw0tNXFM= Authentication-Results: gmail.com; dkim=none (message not signed) header.d=none; gmail.com; dmarc=none action=none header.from=oracle.com; Received: from DM6PR10MB3577.namprd10.prod.outlook.com (2603:10b6:5:152::16) by DM6PR10MB2538.namprd10.prod.outlook.com (2603:10b6:5:b3::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.19; Sat, 27 Feb 2021 17:00:32 +0000 Received: from DM6PR10MB3577.namprd10.prod.outlook.com ([fe80::5120:8a97:3547:bc3b]) by DM6PR10MB3577.namprd10.prod.outlook.com ([fe80::5120:8a97:3547:bc3b%7]) with mapi id 15.20.3868.034; Sat, 27 Feb 2021 17:00:32 +0000 From: Mike Christie To: bostroesser@gmail.com, mst@redhat.com, stefanha@redhat.com, Chaitanya.Kulkarni@wdc.com, hch@lst.de, loberman@redhat.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org Cc: Mike Christie Subject: [PATCH 19/25] tcm loop: use lio wq cmd submission helper Date: Sat, 27 Feb 2021 11:00:00 -0600 Message-Id: <20210227170006.5077-20-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210227170006.5077-1-michael.christie@oracle.com> References: <20210227170006.5077-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: CH0PR13CA0027.namprd13.prod.outlook.com (2603:10b6:610:b1::32) To DM6PR10MB3577.namprd10.prod.outlook.com (2603:10b6:5:152::16) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by CH0PR13CA0027.namprd13.prod.outlook.com (2603:10b6:610:b1::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.13 via Frontend Transport; Sat, 27 Feb 2021 17:00:31 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b393123e-8333-4856-8aef-08d8db41315c X-MS-TrafficTypeDiagnostic: DM6PR10MB2538: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2449; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: E99IC9DCqFSQgN2KUQIY2mj/1L3wTdSy0DdB04nK8gUsHNtW3V9dBfor95J/N0tIWKO2ieIMDmv2BtnJG28KBA4P4yXDIyw5T11JefwlI3U/3uFxo+epsDVPzrVxycxYWA5taTdpNfDSKi8w9PNkIlKVHAYMDU52ubqPhwm77nG5quJQkyaQGsDXeRmBi2Z6GyEGJ+G4Ke2F3/FuitKjNkkGUgdp6JiiA3fq893x8R9yFlnL2WuBFayOse6cp1oguV8KCKSR0ZW8GM/CwO/O+4ey3Qb2/YFuwgUTvIgwLTXnDiwRYxKlMnjljm8qtLyCiuDyAat4I9wWi2Jn5xyjg0t7k2q6/8D3rBnvJsbQN8tv4KasUtetFUZ08vhM2wLxZEhwPeeCG0HuKZqLwqyb6Qwl65gfqsNXllc+fejxwmuCd/hODcXUVhpBF3JU2Td9jB7CS/dhYeD1fK1+9td0/N4ZwVdc4eQcCuqkwrQ+enPFUOqP5VifJa01JcWRQXh2RCyujwbh9m3zuJSI1F5bWToPSzqJaUN9tCoqtiIywFK4gAom4MPAG7wj9PD+ZSc6jom77mg+PBfdM5EMprU+pg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR10MB3577.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(366004)(346002)(396003)(376002)(39860400002)(136003)(69590400012)(478600001)(36756003)(6506007)(5660300002)(4326008)(107886003)(83380400001)(316002)(52116002)(6486002)(956004)(2906002)(2616005)(66946007)(6512007)(8676002)(66556008)(66476007)(6666004)(8936002)(16526019)(186003)(86362001)(1076003)(26005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: jQWDriSfZQahcEUCUSnzHYlzN7XrzxyuKB8Xsp5y2Nq8X8PzJ3C/6+nDLFNSjic9cZJkDiIWXsS+Cx+ILe327mBbb78CRwwzy960A0KB4x/WCJtlYgaj4OLavSIfpZoUhRPIYq0nztuJsvQRIVTDDbcO/wS4KSs/3s+6/2BHv8VhwJ8EtXGiWbPYOHXjZKiY8TQhINpvgWgPVA2hytB2W2dz60e2IxYQm+lK/ivRbL5JSee6qPvHMgEzAA5w5Miv5d0xXBpsmZuVLA39uGhvdCcPSi/ObrHZA3oAps7wQzmFNZ9lxcLl4SklO5dVtB3c6mU5ZWifMD7E9p5oeukCb/dfL/UfmpLrWw3u2Of0tPgtAdRRaUNdfGhodw3nLyfY9uUwIYxgwSGfnMYtYlF3NuLiSgqwiIxwWkvMM+pTJRlgUkWc9f88T3isiiCL7tTuKOEKmF22N/CiZsAX/raUS5/EL8B8SfZf1rd5O3AAZENUfDqj7sAdKg19IYaz6xl59mXd+dqdjIL520WwiOEDhz5MOS+ll5c7XyZMQtlxfAjuNtX5LGflV6+9b4+Qv00jA01lgi4e7n3xLjE/vnpA7vkU9UQm1Qdf6Poj8qf9bTe0QGwCLRfqj9wAIfBLjSmcNO+ivnn5z84SZM24vDguKXOoC/KTsaMxsPRlTDjD7y4I2YPw+Pt7XzCPaH+rQp3KG5jDMtEVKMTO5eKFv2MAY4aWWq4H8sAE9qfHCTY775vR0QiFv92sqUsSlhkfz8IAhxPQ4fFkGzYKIPaUkbSa69YRcA7iKUuQ3YNYZT13+Lcy3GFRe0Zl4l/wFcKKpVL6CEjLt2zxk2mlqkFnzNubxTCbycdPStKlkLoT83O/WpFW1Z1ooEY3CxMM4UZfta2sMG6Aod0DSG8Oi6L/+3fOO9nfYldQusMCC2LPbMQLrv1NIZBqiW2/cCTwOodfZzFrEm+siLwTreraxKjBtlcDT1I349qQOtpBOcuHdg8EgzGaXQvbtmYaRireZp3ZIJLRnIYf2hNpIIokduOA4RJB7T1Z9bpJcba2Xp1Y5Un/TrV0KGBBZkYTNXVL3pA7IfS/teriUvNoQ+9Ji7a1MSagwTPgf8PM0yrgALUxuLqYeUgd5TcXTzZ6sRERajlg2CmUVu/kf0zv9KpAQkU5Le/Y/ndyl3fkyIInPzNZE00ORw1SRzA0uZeSri4aqhP2hLeLVjIILcRzfK6cZSK+6W0LdPKlOIUaorpvRTZRs4ehgXtGSlnYAIoQP4tiwidcrFsXKx0S3wpFddASqZ7dbabcGmGFPKdBqBxmqNFIFT7Xz7DNZtv82OoHFvE+Ow8EL+Ym X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: b393123e-8333-4856-8aef-08d8db41315c X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB3577.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Feb 2021 17:00:32.2149 (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: rLc5f2uUtUcUyB4Q7xdrYW5+EUVLu4XSu0Jh2i2DY9fAjvfYE1byDcuf1maX/5irPk5Ym62cgPYHK1ok7N3mWKxDcYrwOzg1PZPEh79fnbU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB2538 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9908 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxlogscore=999 spamscore=0 malwarescore=0 mlxscore=0 phishscore=0 bulkscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102270146 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9908 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 adultscore=0 impostorscore=0 clxscore=1015 suspectscore=0 malwarescore=0 priorityscore=1501 mlxscore=0 phishscore=0 bulkscore=0 mlxlogscore=999 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102270146 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Convert loop to use the lio wq cmd submission helper. Signed-off-by: Mike Christie Reviewed-by: Bodo Stroesser Tested-by: Laurence Oberman --- drivers/target/loopback/tcm_loop.c | 22 ++++++---------------- drivers/target/loopback/tcm_loop.h | 1 - 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/drivers/target/loopback/tcm_loop.c b/drivers/target/loopback/tcm_loop.c index fb877aec6321..2687fd7d45db 100644 --- a/drivers/target/loopback/tcm_loop.c +++ b/drivers/target/loopback/tcm_loop.c @@ -39,7 +39,6 @@ #define to_tcm_loop_hba(hba) container_of(hba, struct tcm_loop_hba, dev) -static struct workqueue_struct *tcm_loop_workqueue; static struct kmem_cache *tcm_loop_cmd_cache; static int tcm_loop_hba_no_cnt; @@ -106,10 +105,8 @@ static struct device_driver tcm_loop_driverfs = { */ static struct device *tcm_loop_primary; -static void tcm_loop_submission_work(struct work_struct *work) +static void tcm_loop_target_queue_cmd(struct tcm_loop_cmd *tl_cmd) { - struct tcm_loop_cmd *tl_cmd = - container_of(work, struct tcm_loop_cmd, work); struct se_cmd *se_cmd = &tl_cmd->tl_se_cmd; struct scsi_cmnd *sc = tl_cmd->sc; struct tcm_loop_nexus *tl_nexus; @@ -161,10 +158,10 @@ static void tcm_loop_submission_work(struct work_struct *work) if (target_submit_prep(se_cmd, sc->cmnd, scsi_sglist(sc), scsi_sg_count(sc), sgl_bidi, sgl_bidi_count, scsi_prot_sglist(sc), scsi_prot_sg_count(sc), - GFP_NOIO)) + GFP_ATOMIC)) return; - target_submit(se_cmd); + target_queue_submission(se_cmd); return; out_done: @@ -187,8 +184,8 @@ static int tcm_loop_queuecommand(struct Scsi_Host *sh, struct scsi_cmnd *sc) memset(tl_cmd, 0, sizeof(*tl_cmd)); tl_cmd->sc = sc; tl_cmd->sc_cmd_tag = sc->request->tag; - INIT_WORK(&tl_cmd->work, tcm_loop_submission_work); - queue_work(tcm_loop_workqueue, &tl_cmd->work); + + tcm_loop_target_queue_cmd(tl_cmd); return 0; } @@ -1160,17 +1157,13 @@ static int __init tcm_loop_fabric_init(void) { int ret = -ENOMEM; - tcm_loop_workqueue = alloc_workqueue("tcm_loop", 0, 0); - if (!tcm_loop_workqueue) - goto out; - tcm_loop_cmd_cache = kmem_cache_create("tcm_loop_cmd_cache", sizeof(struct tcm_loop_cmd), __alignof__(struct tcm_loop_cmd), 0, NULL); if (!tcm_loop_cmd_cache) { pr_debug("kmem_cache_create() for tcm_loop_cmd_cache failed\n"); - goto out_destroy_workqueue; + goto out; } ret = tcm_loop_alloc_core_bus(); @@ -1187,8 +1180,6 @@ static int __init tcm_loop_fabric_init(void) tcm_loop_release_core_bus(); out_destroy_cache: kmem_cache_destroy(tcm_loop_cmd_cache); -out_destroy_workqueue: - destroy_workqueue(tcm_loop_workqueue); out: return ret; } @@ -1198,7 +1189,6 @@ static void __exit tcm_loop_fabric_exit(void) target_unregister_template(&loop_ops); tcm_loop_release_core_bus(); kmem_cache_destroy(tcm_loop_cmd_cache); - destroy_workqueue(tcm_loop_workqueue); } MODULE_DESCRIPTION("TCM loopback virtual Linux/SCSI fabric module"); diff --git a/drivers/target/loopback/tcm_loop.h b/drivers/target/loopback/tcm_loop.h index d3110909a213..437663b3905c 100644 --- a/drivers/target/loopback/tcm_loop.h +++ b/drivers/target/loopback/tcm_loop.h @@ -16,7 +16,6 @@ struct tcm_loop_cmd { struct scsi_cmnd *sc; /* The TCM I/O descriptor that is accessed via container_of() */ struct se_cmd tl_se_cmd; - struct work_struct work; struct completion tmr_done; /* Sense buffer that will be mapped into outgoing status */ unsigned char tl_sense_buf[TRANSPORT_SENSE_BUFFER]; From patchwork Sat Feb 27 17:00:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 388353 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0941BC433E0 for ; Sat, 27 Feb 2021 17:14:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D2FB164E86 for ; Sat, 27 Feb 2021 17:14:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230295AbhB0ROA (ORCPT ); Sat, 27 Feb 2021 12:14:00 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:49160 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230273AbhB0REm (ORCPT ); Sat, 27 Feb 2021 12:04:42 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11RGxaKI178656; Sat, 27 Feb 2021 17:00:38 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=vkI7pVbjPpUYMdhGnmWZkin4Vzj3OtMnjwsUvl1/w24=; b=uqxM+uL2hAt9v/fAJSZa6EXNMKWkB1Lw7Jcqu4332R7B35BT9K0Gt0eT1wbDecJvoIQu Ayv2ZUqGSWPc5p23zppbo/1EZlGWMvlo0Nhp4NpZ3pOxEI9O3H/6PEgf9lTIJ6RDUxu/ sww3POiTa1tS/kQYFw7MYEqrIEYsDJxEiFTvpMT1nNF1SII30M2FDdem+7dOvN9T+1+/ +8IiLdgl/mlR6z+Knjv5VNFcfxTGvBXmEC1njQtcRSx39yCCsvZ4HgFFjJkFnwu++blt 0ntLgb1ZGHKFWrOCbViSaUgRxb1vyFoHR2PkyVtZ6ln9vBFGHKjgu1iOvbM8xnMCtrVu +Q== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2120.oracle.com with ESMTP id 36yeqmrptf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 27 Feb 2021 17:00:38 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11RH0Mbk173209; Sat, 27 Feb 2021 17:00:38 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2108.outbound.protection.outlook.com [104.47.70.108]) by userp3020.oracle.com with ESMTP id 36yddhy8te-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 27 Feb 2021 17:00:37 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KwQufDyD3kQaQxqfIO9BWD/4wIEMc34E+P/26l1mTTuaWX6pmzXKg797T6RUOciG9gfAd/DhX1qysu6MsZBvLzfwHSi5Hqr0B9yxnN4mJokPSMne7gzBo0S6d44BQ0wEB04RR8Sm10kI9VQUQL8ovK1h+06i3aNEtyHOeRE7eoOakDdewaClR6+5+/Agr6mnilbn3mnUqMvk//CCKF2z/Wy9StADPoL8IvSE6n4Xf9XFP7ubl1/MyFFFAmLK6Tp7WLrnmvbynXuJAqXC7msQjtnIGzHV0+ltBL/+d+XJDr74wxhz+nckbuOyPzUgECORRtAmuXZsytVKvRXE78nzag== 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-SenderADCheck; bh=vkI7pVbjPpUYMdhGnmWZkin4Vzj3OtMnjwsUvl1/w24=; b=WpgBWOXq1GMzIX4MRSGd10yUc44TrOv9CsXBJYaEdiu/mFutZ78Bwt/za1I6Y8tdnRrzhjCBIPkE4MBtUueoTtsS37H2J1dmBsO6G/YPeCsN7wgB0o0F/Zh4lK0nuXoQUHW/WYnU/cEFIIB66eF1jpRqJmxE53RUKFN5Pcr5cl87BSORLx0QJg8O1z+GZqZGN76dz4059258s2toOXy7ILdli4HDyQTnRtP5ljBUeGbqOvuBKN+LZmL85V3oXFiRG8DAWdSVZE1GfkgeLq6re43HFSv3rqhH5nwaFNkq52NJNU4zu5xKDeHll6hQkOzqtFyKiaWfwrX7fa2gDq6mAA== 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=vkI7pVbjPpUYMdhGnmWZkin4Vzj3OtMnjwsUvl1/w24=; b=CqxX8rCQSg7Hxzvw+JitivLqQBK5Egqw0QPLg3rk1XY/mDX+sIICoNs5hu1LfsE9+q7HY/tLdoQLzosNHngvnOORtCj/+UxRToUGNiPvruMmeLhHnYal8VjL9nRrZ71DFSeEYbXuGIZhDdMs8aso/XdHHvH9wamkqeeZhLZQHII= Authentication-Results: gmail.com; dkim=none (message not signed) header.d=none; gmail.com; dmarc=none action=none header.from=oracle.com; Received: from DM6PR10MB3577.namprd10.prod.outlook.com (2603:10b6:5:152::16) by DM6PR10MB2538.namprd10.prod.outlook.com (2603:10b6:5:b3::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.19; Sat, 27 Feb 2021 17:00:35 +0000 Received: from DM6PR10MB3577.namprd10.prod.outlook.com ([fe80::5120:8a97:3547:bc3b]) by DM6PR10MB3577.namprd10.prod.outlook.com ([fe80::5120:8a97:3547:bc3b%7]) with mapi id 15.20.3868.034; Sat, 27 Feb 2021 17:00:34 +0000 From: Mike Christie To: bostroesser@gmail.com, mst@redhat.com, stefanha@redhat.com, Chaitanya.Kulkarni@wdc.com, hch@lst.de, loberman@redhat.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org Cc: Mike Christie Subject: [PATCH 22/25] target iblock: add backend plug/unplug callouts Date: Sat, 27 Feb 2021 11:00:03 -0600 Message-Id: <20210227170006.5077-23-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210227170006.5077-1-michael.christie@oracle.com> References: <20210227170006.5077-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: CH0PR13CA0027.namprd13.prod.outlook.com (2603:10b6:610:b1::32) To DM6PR10MB3577.namprd10.prod.outlook.com (2603:10b6:5:152::16) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by CH0PR13CA0027.namprd13.prod.outlook.com (2603:10b6:610:b1::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.13 via Frontend Transport; Sat, 27 Feb 2021 17:00:34 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d83b05b8-8fbb-4724-2da9-08d8db4132f4 X-MS-TrafficTypeDiagnostic: DM6PR10MB2538: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4714; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ThqF2E66ftkRjIe7j8N3bPZu0r3093iPbPkPAELk8xaFhbGwG94Dg976HeVlejuayT5f+lQS4i1gPEZelxGnBRHZuJ0KEVS6GQlYQcen8FMyoJLsjOKDSK6B8dudjA8qZwyLCwfJRzF8K+3L/9880n22BbUwCsROkfPI7CH6Xe5jNzvV1FJvQ2dne2/sIl6FdBPWkc+U/zY8xJHAnxqBdIXD/OUYHrlO1sJ0mY18tThTVRPHEjVjhLnVK0S4nj3RUUcwLAgQ7TwuA5KNeiYVqUxSez/G9k6U7z7unUr0lZW2d1OHubL9p3WwGXvBRdDAsPxklDdTQBbUwRUdf0OgnANmUcJoKG/kAYimkwLYbCdX3wuwKi/PzJThSjDGQG2mrlq94BxVv2M+J24eGkapKOLqAjPcS4gpqfR5ovRuAIUe/3yQOveXx0zG/CRWfWRJeRQqsIfqaqeOjtxk0kGDswFFa07o1GPFiR16Xm10e9e15HHOgKPpX8XrtUSLFYPH9qKChKGeghLgVHayQ1nVyOzT1azCQ8asVvRl3nZF9d84un3lKr4nYckZ02520QWEMBbLZLjRKKr64qj7YUVyMQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR10MB3577.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(366004)(346002)(396003)(376002)(39860400002)(136003)(69590400012)(478600001)(36756003)(6506007)(5660300002)(4326008)(107886003)(83380400001)(316002)(52116002)(6486002)(956004)(2906002)(2616005)(66946007)(6512007)(8676002)(66556008)(66476007)(6666004)(8936002)(16526019)(186003)(86362001)(1076003)(26005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: pmQ7fGHLT/GFIVi7GJLNt/oAvZTAcB+2lcAsbQLJ7kIh7cJspFGjO+EulfuOeFUavc+q49Ize2GvyrMS5PLY+wol1OeWWpb1Gd4/Kqk130roSL18ZMR450nPVv+J13MQoJPa3vWQDJY/Kyhwlvqt0/G0B9L/916h+u0CeGCFnR8NOvTbumfnf7xhevuqfTDNZvHmps/MgS9Bu94wrQmSz/EIGn3ePkiCODv8uC28a+z75flji2FFNhBze0VuxAcBAx/Z3F5hqG9uhXouLumtWGMF/xao0iN95GGEr3i0PanPM1dnTSbJa6EsIuJkpTuz5nwiwlFqFv7bFHW5nSUgqJPeygIvNu+6vYixVUQH+/bDAvHXR7U8I2Jc+cedkiYvfx1XxoiN8JVF6QwuVGRJXCHfHql1au1L+GO3MyvPfTjsoSkXWsNWSxltIFpywhfvBpFCNEibpmCtV9KXeyEpwMkfwtrWA8puQRUXZNrSDaGeDz2fRrT7qMdH0eDNPqq0BLRiMele5UW1nB0Pr3TyjbkvQ4yt2OjUEThwpYKusPibRellFe4ctTtxtKG7LiKRzuld1REgbIvye4mXFE4fF7yklY9edg9vC87+67CoqeA8LhoKToouGRpPvyT0dN3ncnbR/Djp+cNRUuA44qGpkdXVcZ4N/Qss1S5brwWZ1JLbxGktWpWrTVWCCDQMMlvW89/NIQ1sKWz30RFTz5CsuycSyratPweykRyXhj3+jGx9Mfqb7GOUbsxuv87OgGni2BtvYAyekh5GwOO4WzeGXcoMFgMsuapCXTr1N7KY0ZIf4/eEbyBTP6OBlf/YB3l0pIHE0MfVArMJLgwY9d79zO0PRUgOLllZeiu4Q0JELM+TzxG1debmbaSqWsMlTqHHsjwwS5BzwnGmGHZY359sDDZbNTcVIi3Xz2L7Xc4MHDi5Ijv2AqZvoD75D4x9/6J5hVQ/D88Q2sB3XLkXeoiKyIhNd2v4VH94UKv/VTNPxK4R5fed7esHl2T8NXsK0Au+qTKiqAxFk/qqve/5QJ3LWqX7SUhQu6thBs3l1jmAS9KL0dKPeb2zS0RNBDfi8Hnb8bQ1sPjBoYN/gKgsvR6HP+AJ0mRh0Pz5IR/St7EK+FbIiTL0RJ4hfczX6xn7obzNxJQEwtS8/Y07XirxjkBq9oL4Xp2lXidvJdsx44geONztDUfc0x/3yQ1InKEIXz4zaCa99lmVwhgPKkA06KPJ3kFxGJEoTiZU38l9UjBY+Lg5h3yQFd1D3WYmn4lbHfEtAjTumjFMh+g43NsdE6SzCWvZdOpZ60BK2HmyrkrZOvEZbeMQIT2i6ulphJhOPWUt X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: d83b05b8-8fbb-4724-2da9-08d8db4132f4 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB3577.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Feb 2021 17:00:34.9194 (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: N3nBQyYTl5t/LbwP5ImalHmpw6ob8h0gOjX7vzUayMlMbJVeMIeicP+rmPSVN81QFLEIgg9/tvP8twQlDvBYzmskLtbS0ym8a+tdBKh9vPQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB2538 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9908 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxlogscore=999 spamscore=0 malwarescore=0 mlxscore=0 phishscore=0 bulkscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102270146 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9908 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 clxscore=1015 priorityscore=1501 mlxlogscore=999 suspectscore=0 malwarescore=0 impostorscore=0 bulkscore=0 adultscore=0 mlxscore=0 phishscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102270146 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This patch adds plug/unplug callouts for iblock. For initiator drivers like iscsi which wants to pass multiple cmds to its xmit thread instead of one cmd at a time, this increases IOPs by around 10% with vhost-scsi (combined with the last patches we can see a total 40-50% increase). For driver combos like tcm_loop and faster drivers like the iser initiator, we can still see IOPs increase by 20-30% when tcm_loop's nr_hw_queues setting is also increased. Signed-off-by: Mike Christie --- drivers/target/target_core_iblock.c | 44 ++++++++++++++++++++++++++++- drivers/target/target_core_iblock.h | 10 +++++++ 2 files changed, 53 insertions(+), 1 deletion(-) diff --git a/drivers/target/target_core_iblock.c b/drivers/target/target_core_iblock.c index 8ed93fd205c7..33c88eca090f 100644 --- a/drivers/target/target_core_iblock.c +++ b/drivers/target/target_core_iblock.c @@ -61,9 +61,18 @@ static struct se_device *iblock_alloc_device(struct se_hba *hba, const char *nam return NULL; } + ib_dev->ibd_plug = kcalloc(nr_cpu_ids, sizeof(*ib_dev->ibd_plug), + GFP_KERNEL); + if (!ib_dev->ibd_plug) + goto free_dev; + pr_debug( "IBLOCK: Allocated ib_dev for %s\n", name); return &ib_dev->dev; + +free_dev: + kfree(ib_dev); + return NULL; } static int iblock_configure_device(struct se_device *dev) @@ -171,6 +180,7 @@ static void iblock_dev_call_rcu(struct rcu_head *p) struct se_device *dev = container_of(p, struct se_device, rcu_head); struct iblock_dev *ib_dev = IBLOCK_DEV(dev); + kfree(ib_dev->ibd_plug); kfree(ib_dev); } @@ -188,6 +198,33 @@ static void iblock_destroy_device(struct se_device *dev) bioset_exit(&ib_dev->ibd_bio_set); } +static struct se_dev_plug *iblock_plug_device(struct se_device *se_dev) +{ + struct iblock_dev *ib_dev = IBLOCK_DEV(se_dev); + struct iblock_dev_plug *ib_dev_plug; + + /* + * Each se_device has a per cpu work this can be run from. Wwe + * shouldn't have multiple threads on the same cpu calling this + * at the same time. + */ + ib_dev_plug = &ib_dev->ibd_plug[smp_processor_id()]; + if (test_and_set_bit(IBD_PLUGF_PLUGGED, &ib_dev_plug->flags)) + return NULL; + + blk_start_plug(&ib_dev_plug->blk_plug); + return &ib_dev_plug->se_plug; +} + +static void iblock_unplug_device(struct se_dev_plug *se_plug) +{ + struct iblock_dev_plug *ib_dev_plug = container_of(se_plug, + struct iblock_dev_plug, se_plug); + + blk_finish_plug(&ib_dev_plug->blk_plug); + clear_bit(IBD_PLUGF_PLUGGED, &ib_dev_plug->flags); +} + static unsigned long long iblock_emulate_read_cap_with_block_size( struct se_device *dev, struct block_device *bd, @@ -337,7 +374,10 @@ static void iblock_submit_bios(struct bio_list *list) { struct blk_plug plug; struct bio *bio; - + /* + * The block layer handles nested plugs, so just plug/unplug to handle + * fabric drivers that didn't support batching and multi bio cmds. + */ blk_start_plug(&plug); while ((bio = bio_list_pop(list))) submit_bio(bio); @@ -870,6 +910,8 @@ static const struct target_backend_ops iblock_ops = { .configure_device = iblock_configure_device, .destroy_device = iblock_destroy_device, .free_device = iblock_free_device, + .plug_device = iblock_plug_device, + .unplug_device = iblock_unplug_device, .parse_cdb = iblock_parse_cdb, .set_configfs_dev_params = iblock_set_configfs_dev_params, .show_configfs_dev_params = iblock_show_configfs_dev_params, diff --git a/drivers/target/target_core_iblock.h b/drivers/target/target_core_iblock.h index cefc641145b3..8c55375d2f75 100644 --- a/drivers/target/target_core_iblock.h +++ b/drivers/target/target_core_iblock.h @@ -4,6 +4,7 @@ #include #include +#include #include #define IBLOCK_VERSION "4.0" @@ -17,6 +18,14 @@ struct iblock_req { #define IBDF_HAS_UDEV_PATH 0x01 +#define IBD_PLUGF_PLUGGED 0x01 + +struct iblock_dev_plug { + struct se_dev_plug se_plug; + struct blk_plug blk_plug; + unsigned long flags; +}; + struct iblock_dev { struct se_device dev; unsigned char ibd_udev_path[SE_UDEV_PATH_LEN]; @@ -24,6 +33,7 @@ struct iblock_dev { struct bio_set ibd_bio_set; struct block_device *ibd_bd; bool ibd_readonly; + struct iblock_dev_plug *ibd_plug; } ____cacheline_aligned; #endif /* TARGET_CORE_IBLOCK_H */ From patchwork Sat Feb 27 17:00:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 388351 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5BAD1C433DB for ; Sat, 27 Feb 2021 17:15:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2E9CC64E84 for ; Sat, 27 Feb 2021 17:15:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230403AbhB0ROo (ORCPT ); Sat, 27 Feb 2021 12:14:44 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:60512 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230274AbhB0REm (ORCPT ); Sat, 27 Feb 2021 12:04:42 -0500 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11RH09AK005209; Sat, 27 Feb 2021 17:00:40 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=OwyHFp1kW2CgIqRPRzsgm1iyAz4lHmZp9HU4HYM1yQA=; b=A5zjLwTMUzCSQIqQu+QooGIWWWjQevTHwoFGWqRQI6NpHaW0wD5A3FhZTPJS2wy+C9Zk HciNBajgw/6pZJNoOiQwDNdK5dcvlrLBQ1V3Kt6Ng6VyJ1Ov76Lrq99E07gsU8LfIqMM BxVWxYlh1SaxZnQVPMm6sCW/Q+KRg0on7DteGS9WOVN0E6jxC80Z5YQCIrGV7zj16dsD i28QsIt1rDQ1wpVPrVhwz3XhMIZGq5+dulxTKWaqXHsdY4++eGUkpNLPEgHjObMz8N3J YCMGxRUtvl38K08bYeAtOLvu8v/OnKpZXe5Vqd6gOCj4MCbD+O2D0NoAHG5orIreNTJh mQ== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2120.oracle.com with ESMTP id 36ye1m0qpq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 27 Feb 2021 17:00:40 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11RH0Mbm173209; Sat, 27 Feb 2021 17:00:39 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2108.outbound.protection.outlook.com [104.47.70.108]) by userp3020.oracle.com with ESMTP id 36yddhy8te-6 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 27 Feb 2021 17:00:39 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Xwnu+flGp2SNdfLqw9m31e2h/dQXFXYNxPPSAx+sWD+9u+mf2L8uYmirckzKAmdNFBtzZF0lIe2pAO1uaU3400ru73a+atIkBVqHywy4Ei++eWRHS6uA3u3rN//6k+vbmzSR3fmLbYNM5XYLiYNKnSjoj5Hd7vBj8/sPJtDfUvuR6GTqW8Yzuv8e7oaUbGRfwW5eUkB0cMFMjaC2uGKXpXEDsAADzUj/XdrHhlEaSZwCCIdaKfZLVqxk+E5w/Hag19jjQgyL2VzueINKNf+7OkiIAf0CodEbiqKfRw0Lwhg59rmoYrxxCh8F2bFcSBUxbMWy8a5W31oWTkpZilj3DQ== 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-SenderADCheck; bh=OwyHFp1kW2CgIqRPRzsgm1iyAz4lHmZp9HU4HYM1yQA=; b=Be92DOXV50gbJEtAhAnP0cZq2QCy5thcWK/tjZDnnBHYKKS1dcFpNpVsuTJxWIPwcn9Xw1Tl5WJqD48vedC8tt2S6diGmSPk29iseClE1j2Ox1Ke6Xz/wscCRbS+ER10lndVR2CUlK1ZXPkATnOxxWVMyMSRdHWiGsl7VoLjAGJ3YayqZzAPbpc2QMcL7bPAXGf2iRxUz3tmo3CMeX70aO+U85gKuLmG6ZVirXUCh16gIW1Ari8hZfv5eaQdB5YKd9N/GyRjur9cvMNl7B3yL9A52bjLEIpz11cImFMCgEnL0zzN+TDKCSv9hUBUCsmiV4nst3mVOGd6aPlaSsrvcg== 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=OwyHFp1kW2CgIqRPRzsgm1iyAz4lHmZp9HU4HYM1yQA=; b=Df9pbLO5R126eTIwODuq/rV63HKeyD3s5WTWGJsMPTArR9cLiDgMBsIBTL4lUmGbTRof3KU2G9PeG0EYnesl4DFxVfAtF616WCfMBDSzVqPnQIAtV2dfLXYEeyW80iqeyBJuInzyjZLTHMHdWr7lgaq4CArjKMgRkx8gyIRpO5w= Authentication-Results: gmail.com; dkim=none (message not signed) header.d=none; gmail.com; dmarc=none action=none header.from=oracle.com; Received: from DM6PR10MB3577.namprd10.prod.outlook.com (2603:10b6:5:152::16) by DM6PR10MB2538.namprd10.prod.outlook.com (2603:10b6:5:b3::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.19; Sat, 27 Feb 2021 17:00:36 +0000 Received: from DM6PR10MB3577.namprd10.prod.outlook.com ([fe80::5120:8a97:3547:bc3b]) by DM6PR10MB3577.namprd10.prod.outlook.com ([fe80::5120:8a97:3547:bc3b%7]) with mapi id 15.20.3868.034; Sat, 27 Feb 2021 17:00:36 +0000 From: Mike Christie To: bostroesser@gmail.com, mst@redhat.com, stefanha@redhat.com, Chaitanya.Kulkarni@wdc.com, hch@lst.de, loberman@redhat.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org Cc: Mike Christie Subject: [PATCH 24/25] target: flush submission work during TMR processing Date: Sat, 27 Feb 2021 11:00:05 -0600 Message-Id: <20210227170006.5077-25-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210227170006.5077-1-michael.christie@oracle.com> References: <20210227170006.5077-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: CH0PR13CA0027.namprd13.prod.outlook.com (2603:10b6:610:b1::32) To DM6PR10MB3577.namprd10.prod.outlook.com (2603:10b6:5:152::16) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by CH0PR13CA0027.namprd13.prod.outlook.com (2603:10b6:610:b1::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.13 via Frontend Transport; Sat, 27 Feb 2021 17:00:35 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1992eae0-7692-4df8-aa62-08d8db4133ff X-MS-TrafficTypeDiagnostic: DM6PR10MB2538: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5797; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZL5tpgl/My8MGOHEH7wA+wGaEaL55ujOzvUP//9jXq4NGj4wH5gHhTCVzeFdLF8atE+kN9dan29Kq9OYqQGfrALxPBwgFdCzqusOsoMIjE80k+p7J/cMW0qyMyxxAuPYR5I9X2ICWUmlTjM8CtPG1VNfBspgrmWX6Ot75vjzrbHCVD/0vklTkxZ3d4uIlJrmVza5GeZ0uYg3dpGB6F5M7/ldRU2WdtBrzGuMYnuGCxc15vBQcEBc3VI0UDINcX9ul/nyliySsennRdoxDVDosD7ofD6FFaXLvexOAeGeBBhg23GgtPqXJh5tyG1iC8JIuXus67JNebgFav9j3xWvEQM0RletFktyZwPQwhlM/DkSwfrDMaVHzWzxiAl9+k+hwyz5UNSaKmLEZqAIFw1kd3KmiTZkdxx4QRXwXWUEfSv1Y4l7fRgLZvA9LpFkf+lry7X3Xkrv75hBjIY5CccqKBW1tB4sbghynsQXdV3Ms479hIAO9vpy7aFbYLWFh+Sn5u0eOuxJZTIbErC5powH+o3K5jsKyPg9OFzbD+ilu9VYxnuhCFMIial2WShmsNzisCBtlldJAmDWL+u+8LK8UQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR10MB3577.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(366004)(346002)(396003)(376002)(39860400002)(136003)(69590400012)(478600001)(36756003)(6506007)(5660300002)(4326008)(107886003)(83380400001)(316002)(52116002)(6486002)(956004)(2906002)(2616005)(66946007)(6512007)(8676002)(66556008)(66476007)(6666004)(8936002)(16526019)(186003)(86362001)(1076003)(26005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 6ym3fpc9jw9Zf2f1GM+zRBUYOliz1pjnlX42Eieg9ln5WfznzaiT+1OHSmv3gnVbUbHtzNDHZchvfkVoQaqQcAnm0SmoYlulVkaFLpPcWL6tPsVG2IQCeK/bEUrazn3EytBa5PUVtIwGMxhSdGYC1+Rg1qkYXHYw0B0VEahE450FMKs3Lt/dgrMOkFfoi1kSRvzbjBAIK/qRKcuG8HbQL+r16sy4R+iuHia6+TUReWEd2GnQ9ZP18Xd0pfVrdLCBPT/u5+xVCLU6LKJ6b3Ltm+96sm7bOiDhD/QMekpgLsp9kH5/FtevsbL28H3y8+Udxp0Dip6ZK485Nd1uqmjhJSnKIWt5yCcdP7IbC7qH4YhQafM72x5n0kxdaEwHGTyjZ7KdQ5B21tLZGGXvao9nqtNVBK9m8StaeDN7iLphcxjI7L3zkkL5janNAz8AJ6w12pduloO9HdKvhmturfIyu79vEYFlc+t0GKYMRuhQQFfqDbaf6xqpurwqpn/q0ipsmH9ymXtZgVK2ulwS2wQycwdXUDX+4fpB626wn57znKLwunCQEoswXcNHhPTzmsvwK8Dyd1KwpjTvGaGWVeNUdDbTSZ8a2SSRQxV03HfPLJF6e9qhozshikae4URfcc6HBc0NLMFWn4zabKPbj6y9kLpH2X9OYFalJ+s/ef1gBT+miJy8qBKhapyUZCXMump8SsDNe7+VPWpzCH8xLBWb59IJmCTc8qyBXiwkKk75hkOrpsGiDarxKz0JYF85CykijS4/qBNhLSBsEihQQ2Tlnwe9cs4aP4XFGPC8Pq5akw4OYXY0UUicSpj6IYqRXGAH/PLrY/7/6Hx7GaCeabXLIRWsubGYhEzsrhy1xWbtulspFkfUCmPTzuOmuJqnPOAVOKAq02qiE3tvXLtdvOsfzvH+S/Q19sfBt2VcM791040lnhcNHTtnhenwLOmBqAWFKuJvCsv30eoUvVwIkFOOd8EKJhSgBjqGTi4C28Cvg/WhvhVbnK28LaRRemBDOtMHitmFLn7r1GJh+UKdeC+zAFaSpZz5EEYuzdpUDxKl3OJtjqyfL9wom7LwbeKtEyi3gYKhdazlUBAs3dPiu9a2LSuVgypHsoFa73NNI/CTdBj4i+RNjD2F5t0O61cMbi7hqhkJHbOHvrP4eHa9uMMS/9I94HWUCEsnNMdFWyevxDoTQZcuN3zuwzYmOb12mHuFucHKql5YMfmUbu+GbOLYOByqNmxSXyUbAw1UnyWjs05Ttpdr9Zfs7MmX0yQ7jDcvt6EG0zB/XyVNlFFzbV+ldx76pE2E2n9UhOpzvw9Qcj08jMro9T5qBnIG+iT61qg/ X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1992eae0-7692-4df8-aa62-08d8db4133ff X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB3577.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Feb 2021 17:00:36.6444 (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: g+Fkbdo2uJVBylfeCRXfsty0uqId45RfLfS/n5pfhsHPC9jhYzSBSRSZdoeO9wqrcqn8I5zeZhbS5ygg+hpHWoiOl9Lh/Nh0UD8ToX3L34Q= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB2538 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9908 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxlogscore=999 spamscore=0 malwarescore=0 mlxscore=0 phishscore=0 bulkscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102270146 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9908 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 priorityscore=1501 mlxlogscore=999 impostorscore=0 suspectscore=0 adultscore=0 malwarescore=0 mlxscore=0 spamscore=0 bulkscore=0 lowpriorityscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102270146 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org If a cmd is on the submission workqueue then the TMR code will miss it, and end up returning task not found or success for lun resets. The fabric driver might then tell the initiator that the running cmds have been handled when they are about to run. This adds a flush when we are processing TMRs to make sure queued cmds do not run after returning the TMR response. Signed-off-by: Mike Christie Reviewed-by: Bodo Stroesser Tested-by: Laurence Oberman --- drivers/target/target_core_tmr.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/target/target_core_tmr.c b/drivers/target/target_core_tmr.c index 7347285471fa..e7fcbc09f9db 100644 --- a/drivers/target/target_core_tmr.c +++ b/drivers/target/target_core_tmr.c @@ -124,6 +124,8 @@ void core_tmr_abort_task( int i; for (i = 0; i < dev->queue_cnt; i++) { + flush_work(&dev->queues[i].sq.work); + spin_lock_irqsave(&dev->queues[i].lock, flags); list_for_each_entry_safe(se_cmd, next, &dev->queues[i].state_list, state_list) { @@ -302,6 +304,8 @@ static void core_tmr_drain_state_list( * in the Control Mode Page. */ for (i = 0; i < dev->queue_cnt; i++) { + flush_work(&dev->queues[i].sq.work); + spin_lock_irqsave(&dev->queues[i].lock, flags); list_for_each_entry_safe(cmd, next, &dev->queues[i].state_list, state_list) { From patchwork Sat Feb 27 17:00:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 388354 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 94AEFC43381 for ; Sat, 27 Feb 2021 17:13:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 66A8564E85 for ; Sat, 27 Feb 2021 17:13:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230209AbhB0RMh (ORCPT ); Sat, 27 Feb 2021 12:12:37 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:49182 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230282AbhB0REn (ORCPT ); Sat, 27 Feb 2021 12:04:43 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11RGwfQe165588; Sat, 27 Feb 2021 17:00:40 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=AJ9anJ63iBUbfHdEZbe2MC73uDIAPJ7AAhB48FyX79w=; b=NEYFHO/itVqSImiAuONJZrUP7tDBfQnJeEC7uRz8T95gQCDIuwtE2aw8QWOZLBNYs3s6 V0FL35ShwVqhh/5FiKWq2mMM8Ufx91kNrK9cTfyHy/fF7tjY1zvmEy45GPNFr0AQn+rL s7hCrtqM1uFlj3CAFJVZ5YPibnFn3v9jskdbASKp26SGdpGiToOg3cGz+8CvivZlBN/U zKoU4hVOI3MzogGb51LP8ExkGkq+9uSgaxPOB2sXXGwqoOR+DYOR2JKY6TTfEg1EWbRf t+stxzjhLpd/8AUgXuUXN1BY5Eqtt9osJdvZJeUAOCh2F+HxHmb0cBN+34HFCcfS/eyw mQ== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2120.oracle.com with ESMTP id 36yeqmrptg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 27 Feb 2021 17:00:40 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11RH0Mbn173209; Sat, 27 Feb 2021 17:00:40 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2108.outbound.protection.outlook.com [104.47.70.108]) by userp3020.oracle.com with ESMTP id 36yddhy8te-7 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 27 Feb 2021 17:00:40 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dAGkRN2yYdqPye5qm2zD49shHnpWtPKy3h4xCoyTa+A6hrp0JW2BZQ93t/siMeMz7mKli2DVDZNe/PAQCWBaUbPyyQ4AlJy93Khkafmtrj+IHFCu8jMmDVihvaNu/61O+DyY7iJJz23FG4zODh4J5LSuSjABLuuViEIox7VAC85+wZhq7HgJFKX3DySlpwUTFM4e1FMURGAV8CNHmZQWY1jDO5O5mJW17y0iZ70dVxKn8cF0DYn8bTtpSqhH6paJiddHlTyjAbE0FZOfidGjJvpZFgznZZYYLLH9eVcKvzKnz7GUz/61XMhatCzZGzMqOPXnUkvqdKWEDfkgXI8I/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-SenderADCheck; bh=AJ9anJ63iBUbfHdEZbe2MC73uDIAPJ7AAhB48FyX79w=; b=Wux9Lqt9CNSuV8jfglaDBb0cUIZGSwLw0Ww3ZNPVMZr1yVqr8HUEsdBvvZwDfALmY40jsSf2epcHv4YTm3CQtcFeL/a4mElIVS8tplf8u5s1oblaXwKXZzedBH8I2gSwU0tDsamCvA/SLUbQ9H6Zuq4AvSHxkczqNtrXh2UVNogN0BEY8ToCAI/c1yH2h3/n5wI7NzRSJyneAumSUdIih+i9CNRmJ/kjEOC177yBZRD/McJRylQaqg5UKEa8huYHv4IaiSNrdEsC/ZrP48Ze1q2PMCrLd0VvlvxPCv8xx68YaZx4T4Os3q+IDWIMb7MUVQ6kykmjbqVvzvzNZO6G6g== 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=AJ9anJ63iBUbfHdEZbe2MC73uDIAPJ7AAhB48FyX79w=; b=wgNRd0cUFLxgecaqNnXUKNSMCff/3tlYE5FUGeOWFx7RQ5oMxLTv9AyDyqYCcol6lnVlNEPSA7x8lclzNVaoKxoHeTMuadiy+nZErdwK/QNvK4htBk6vUkCxM/mJiCJ/tUB3nRtt5hvhn+F5eoYp5o/YkXHmX2hD1BPLGMpmGHE= Authentication-Results: gmail.com; dkim=none (message not signed) header.d=none; gmail.com; dmarc=none action=none header.from=oracle.com; Received: from DM6PR10MB3577.namprd10.prod.outlook.com (2603:10b6:5:152::16) by DM6PR10MB2538.namprd10.prod.outlook.com (2603:10b6:5:b3::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.19; Sat, 27 Feb 2021 17:00:37 +0000 Received: from DM6PR10MB3577.namprd10.prod.outlook.com ([fe80::5120:8a97:3547:bc3b]) by DM6PR10MB3577.namprd10.prod.outlook.com ([fe80::5120:8a97:3547:bc3b%7]) with mapi id 15.20.3868.034; Sat, 27 Feb 2021 17:00:37 +0000 From: Mike Christie To: bostroesser@gmail.com, mst@redhat.com, stefanha@redhat.com, Chaitanya.Kulkarni@wdc.com, hch@lst.de, loberman@redhat.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org Cc: Mike Christie , Himanshu Madhani Subject: [PATCH 25/25] target: make completion affinity configurable Date: Sat, 27 Feb 2021 11:00:06 -0600 Message-Id: <20210227170006.5077-26-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210227170006.5077-1-michael.christie@oracle.com> References: <20210227170006.5077-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: CH0PR13CA0027.namprd13.prod.outlook.com (2603:10b6:610:b1::32) To DM6PR10MB3577.namprd10.prod.outlook.com (2603:10b6:5:152::16) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by CH0PR13CA0027.namprd13.prod.outlook.com (2603:10b6:610:b1::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.13 via Frontend Transport; Sat, 27 Feb 2021 17:00:36 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5bb033a9-2a4e-40ba-1e7b-08d8db41348c X-MS-TrafficTypeDiagnostic: DM6PR10MB2538: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hybCNWJjxVbj/i81L4h/q8wSaOwmMaC5LKLPA/8PzQlsZK3J6IZMzgIbvJt/PpPF8XSmxJS8Bh3+rj3VXDIZi+ms9TC5fie/RJUOp8R5RmfSQoeQ+/KRZ+woqT1orgUp1nSLoUiI1uBoyTHBljX1uGL4I3vCCply9W62Mwh/83bTvxI/NVVOpom/w1rBd17gwmC7cOPNxh8hgtVea82Jn7acqRkiF/kElvG1P7xHtSRG92baNova7zarwmgqT0iw8IBC0wtXRnMRMbpHS4L3f95LWeDoCk7i/VVWHhGZUmExz5fUMtjF9fd03YMH9+DwmMfKx9KiXVq5m8rb2tk35Lv/s8epMMuk3x1Iyf/hP17uGQElFO5OSq+b/joRLztfiPd2gAtB4FHh5a9CZkpgPjODXiHcOOpUmJi7uEwnByf3TvGSyjaHtR7WBTdMBVKqzckGff9WkJYuEvVdzPXNnGKhE+5uLDT1Nkru2L7sFvXRtOkOQxDrfQkq++x/RJvCeV6ym1R5VIT1+ptXwdf0O0TSBr4SWfaoNmGHVf/clnOPAaSYvBw/mUuDsW5ut9WAYCbVAYlR3kNfDZ2qXcJYLw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR10MB3577.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(366004)(346002)(396003)(376002)(39860400002)(136003)(69590400012)(478600001)(36756003)(6506007)(5660300002)(54906003)(4326008)(107886003)(83380400001)(316002)(52116002)(6486002)(956004)(2906002)(2616005)(66946007)(6512007)(8676002)(66556008)(66476007)(6666004)(8936002)(16526019)(186003)(86362001)(1076003)(26005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: Jk3dlGfvoFmif+gDx52/7i8x1UC2K2WqJ9hyY7cRvxPRJSO51B/+V15r/yjjs+g8lTLmab9Ol6lktJLbCOxTN4Ewcxml7cKZmc5j2XORiZfx5AJ2oy0bDu4SXBCTNH+zS+s1XHRFHnDC6Db1nj5C+1pP1O5rMKk4Q3BnjDYToKGE+LZF9w25Lq0MAsh0XH6CQDWyb+6jXoOV1NH4KGiPK4Zxw6C1pAfMvRiFNyol5t5mhuaxber4YFwMSx5JTlVXB6u9z8QJC85fmG2zqz80nO9hKKzH2CJmqPRNhVwDtzkjhR8rfmNjqCqKkHixBj50EsCJu8DRl1AN8BwnaEgzMS2IWrRJ9WTzlaKmw9QAxO/bJI0olg24Dyqvi+A5rmvrwLuJZzivgvBUn8sw+8O+yOJmOvsNg5l0yqMP2q/+Tm59Q41opwEAX4n3/Z0QrB2AooezCOjW/wJEqxj2Nv7lsw++U+cUNxHdy2PS/4EpHzgLb3JOtqXcGZHpLoxLLxYDCxZKecBmg3cYb4bVBoBq7JOGsDsDi/mORn6Ee46ub3UVVqrIS9VBiPmjNLRBpcJnRF3JV+02f7uETJjJdrXe8B/y0UiedsFa3Vfh0ALcLLcvMfzn+l4dM44nTswltP+3ufa36OJbjYbVFHnAYgGseHKqQevDV5lGRMw+wDIK0cjaiZeovxRRuPPJUCFi0wXW2M7L1xtJLIb9JTF3xg0jTu9sbPdV+SKxOwW0gKFf2yS6siQssezqGi32/tME5We6w1myZD9Jw453eRfjCG/9mBha9jiLmKhxd5W513QGrTzvz1l8fKGwAJLLmjrXW2R+5MOu3ofPMHLpQnjDRaISDwxQsHENAqZzgRqIfTUO2etXoRzT4W7ng5FKuSgAqUSwiNuVWPUXM8EBIcthfb0KjQQHQibH1TSghc3ugrhoz+yeIENEo9hymlLJkaf/upAI47wW096vzo6Fs/9OxoXCJZzfznvEmOg1sQwmE6K+qpvH74MX9cm/ZsRHlMNWuLOOVvGc1JMRccQccDXAaKqm4oS0d532gdoyEE6XwzJkRo38194m8ArfK1gIEl+72jX7bCsZ1IlaohWbk0tA+ONOsYoH2U34+PSfd1VDNYdWB1E0SaqBv/Bj8++k3qyKrv8wwTMrl0ZYXQkUZjDEHJ/1GST1oAFQEGjdSVT4//rQVhr4MmuJTU4O8vpW4wB4oWsm6AMlNZgv35uNP0R+RB+iRIw05mk6BC9qLuEYdEd/RiogVX1yP0zdFkLcyruiBEylPAJYfWoPKc4fyI7fyZiOnSDFoCEWfxzeQ96hJ9pyh89rGwWuF7KQjFH081QgJLWE X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5bb033a9-2a4e-40ba-1e7b-08d8db41348c X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB3577.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Feb 2021 17:00:37.5489 (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: D5GzWGBMd8+BxnkXtckFdr8OpuxlQLVjqlvwzZMLeRBDykOTLRPTXi0lxWcec2VEa67x1qvqk5FxvTJVikw4qLfanWJ38UAnexQg7dcHe7Q= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB2538 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9908 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxlogscore=999 spamscore=0 malwarescore=0 mlxscore=0 phishscore=0 bulkscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102270146 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9908 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 clxscore=1015 priorityscore=1501 mlxlogscore=999 suspectscore=0 malwarescore=0 impostorscore=0 bulkscore=0 adultscore=0 mlxscore=0 phishscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102270146 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org It may not always be best to complete the IO on same CPU as it was submitted on. This allows userspace to config it. This has been useful for vhost-scsi where we have a single thread for submissions and completions. If we force the completion on the submission cpu we may be adding conflicts with what the user has setup in the lower levels with settings like the block layer rq_affinity or the driver's irq or softirq (the network's rps_cpus value) settings. We may also want to set it up where the vhost thread runs on CPU N and does it's submissions/completions there, and then have LIO do it's completion booking on CPU M, but can't config the lower levels due to issues like using dm-multipath with lots of paths (the path selector can throw commands all over the system because it's only aking into account latency/throughput at its level). The new setting is in /sys/kernel/config/target/$fabric/$target/param/cmd_completion_affinity Writing: -1 -> gives the current default behavior of completing on the submission CPU. -2 -> completes the cmd on the CPU the lower layers sent it to us from. 0 > -> complete on the CPU userspace has specified. Signed-off-by: Mike Christie Reviewed-by: Himanshu Madhani --- drivers/target/target_core_fabric_configfs.c | 58 ++++++++++++++++++++ drivers/target/target_core_internal.h | 1 + drivers/target/target_core_transport.c | 11 +++- include/target/target_core_base.h | 9 +++ 4 files changed, 77 insertions(+), 2 deletions(-) diff --git a/drivers/target/target_core_fabric_configfs.c b/drivers/target/target_core_fabric_configfs.c index ee85602213f7..fc7edc04ee09 100644 --- a/drivers/target/target_core_fabric_configfs.c +++ b/drivers/target/target_core_fabric_configfs.c @@ -892,6 +892,7 @@ static void target_fabric_release_wwn(struct config_item *item) struct target_fabric_configfs *tf = wwn->wwn_tf; configfs_remove_default_groups(&wwn->fabric_stat_group); + configfs_remove_default_groups(&wwn->param_group); tf->tf_ops->fabric_drop_wwn(wwn); } @@ -918,6 +919,57 @@ TF_CIT_SETUP(wwn_fabric_stats, NULL, NULL, NULL); /* End of tfc_wwn_fabric_stats_cit */ +static ssize_t +target_fabric_wwn_cmd_completion_affinity_show(struct config_item *item, + char *page) +{ + struct se_wwn *wwn = container_of(to_config_group(item), struct se_wwn, + param_group); + return sprintf(page, "%d\n", + wwn->cmd_compl_affinity == WORK_CPU_UNBOUND ? + SE_COMPL_AFFINITY_CURR_CPU : wwn->cmd_compl_affinity); +} + +static ssize_t +target_fabric_wwn_cmd_completion_affinity_store(struct config_item *item, + const char *page, size_t count) +{ + struct se_wwn *wwn = container_of(to_config_group(item), struct se_wwn, + param_group); + int compl_val; + + if (kstrtoint(page, 0, &compl_val)) + return -EINVAL; + + switch (compl_val) { + case SE_COMPL_AFFINITY_CPUID: + wwn->cmd_compl_affinity = compl_val; + break; + case SE_COMPL_AFFINITY_CURR_CPU: + wwn->cmd_compl_affinity = WORK_CPU_UNBOUND; + break; + default: + if (compl_val < 0 || compl_val >= nr_cpu_ids || + !cpu_online(compl_val)) { + pr_err("Command completion value must be between %d and %d or an online CPU.\n", + SE_COMPL_AFFINITY_CPUID, + SE_COMPL_AFFINITY_CURR_CPU); + return -EINVAL; + } + wwn->cmd_compl_affinity = compl_val; + } + + return count; +} +CONFIGFS_ATTR(target_fabric_wwn_, cmd_completion_affinity); + +static struct configfs_attribute *target_fabric_wwn_param_attrs[] = { + &target_fabric_wwn_attr_cmd_completion_affinity, + NULL, +}; + +TF_CIT_SETUP(wwn_param, NULL, NULL, target_fabric_wwn_param_attrs); + /* Start of tfc_wwn_cit */ static struct config_group *target_fabric_make_wwn( @@ -937,6 +989,7 @@ static struct config_group *target_fabric_make_wwn( if (!wwn || IS_ERR(wwn)) return ERR_PTR(-EINVAL); + wwn->cmd_compl_affinity = SE_COMPL_AFFINITY_CPUID; wwn->wwn_tf = tf; config_group_init_type_name(&wwn->wwn_group, name, &tf->tf_tpg_cit); @@ -945,6 +998,10 @@ static struct config_group *target_fabric_make_wwn( &tf->tf_wwn_fabric_stats_cit); configfs_add_default_group(&wwn->fabric_stat_group, &wwn->wwn_group); + config_group_init_type_name(&wwn->param_group, "param", + &tf->tf_wwn_param_cit); + configfs_add_default_group(&wwn->param_group, &wwn->wwn_group); + if (tf->tf_ops->add_wwn_groups) tf->tf_ops->add_wwn_groups(wwn); return &wwn->wwn_group; @@ -974,6 +1031,7 @@ int target_fabric_setup_cits(struct target_fabric_configfs *tf) target_fabric_setup_discovery_cit(tf); target_fabric_setup_wwn_cit(tf); target_fabric_setup_wwn_fabric_stats_cit(tf); + target_fabric_setup_wwn_param_cit(tf); target_fabric_setup_tpg_cit(tf); target_fabric_setup_tpg_base_cit(tf); target_fabric_setup_tpg_port_cit(tf); diff --git a/drivers/target/target_core_internal.h b/drivers/target/target_core_internal.h index 56f841fd7f04..a343bcfa2180 100644 --- a/drivers/target/target_core_internal.h +++ b/drivers/target/target_core_internal.h @@ -34,6 +34,7 @@ struct target_fabric_configfs { struct config_item_type tf_discovery_cit; struct config_item_type tf_wwn_cit; struct config_item_type tf_wwn_fabric_stats_cit; + struct config_item_type tf_wwn_param_cit; struct config_item_type tf_tpg_cit; struct config_item_type tf_tpg_base_cit; struct config_item_type tf_tpg_lun_cit; diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index 18cb00a1ee2f..6b8ccc4bbf2b 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@ -857,7 +857,8 @@ static bool target_cmd_interrupted(struct se_cmd *cmd) /* May be called from interrupt context so must not sleep. */ void target_complete_cmd(struct se_cmd *cmd, u8 scsi_status) { - int success; + struct se_wwn *wwn = cmd->se_sess->se_tpg->se_tpg_wwn; + int success, cpu; unsigned long flags; if (target_cmd_interrupted(cmd)) @@ -884,7 +885,13 @@ void target_complete_cmd(struct se_cmd *cmd, u8 scsi_status) INIT_WORK(&cmd->work, success ? target_complete_ok_work : target_complete_failure_work); - queue_work_on(cmd->cpuid, target_completion_wq, &cmd->work); + + if (wwn->cmd_compl_affinity == SE_COMPL_AFFINITY_CPUID) + cpu = cmd->cpuid; + else + cpu = wwn->cmd_compl_affinity; + + queue_work_on(cpu, target_completion_wq, &cmd->work); } EXPORT_SYMBOL(target_complete_cmd); diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h index b8e0a3250bd0..2a73b6209a15 100644 --- a/include/target/target_core_base.h +++ b/include/target/target_core_base.h @@ -943,11 +943,20 @@ static inline struct se_portal_group *param_to_tpg(struct config_item *item) tpg_param_group); } +enum { + /* Use se_cmd's cpuid for completion */ + SE_COMPL_AFFINITY_CPUID = -1, + /* Complete on current CPU */ + SE_COMPL_AFFINITY_CURR_CPU = -2, +}; + struct se_wwn { struct target_fabric_configfs *wwn_tf; void *priv; struct config_group wwn_group; struct config_group fabric_stat_group; + struct config_group param_group; + int cmd_compl_affinity; }; static inline void atomic_inc_mb(atomic_t *v)