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: 12107785 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=ham 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 1A8FFC433E0 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 DEC8964E83 for ; Sat, 27 Feb 2021 17:08:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230207AbhB0RHX (ORCPT ); Sat, 27 Feb 2021 12:07:23 -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: target-devel@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:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 12107789 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=ham 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 49114C433E6 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 1AF9E64E84 for ; Sat, 27 Feb 2021 17:08:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230169AbhB0RH1 (ORCPT ); Sat, 27 Feb 2021 12:07:27 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:59208 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230206AbhB0RCI (ORCPT ); Sat, 27 Feb 2021 12:02:08 -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 11RH0LKa005402; Sat, 27 Feb 2021 17:00:21 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=HfnTdvYNAhZ/V14HKCFNOmSmkSA2UO5nPhFpVFbegJ8=; b=CgChQ2w9ycWhrerq6t/BoNp/stG7dPTckQWubjhJz1G9rvA1nz9ECbolLF1/NBc7Wz4N wDh9Q5Y6yaGT8B/qtk//bQj9Xum00q2K/J522VE2LipmE8FQBROSgkA5DGM4iyBVrXWU iEk+LzQKMGYy6264ono3VF49UURdc9FS7Zm9NDZqwkmTzrV/4Z2UlVavmbQDkXUktil7 PlUc+gq6VV6q2GXooHt7pJC001fl3D83g4ZOpJpalWg2I4NgWnLTtWm1Rc/HerBWADl5 0Onnn8X1AQHJp1W8+Vc4K3nera4sLhw+4CURWoUTs3deMxN3y/qQE5cVsCpY+ZwlXxNu tA== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by aserp2120.oracle.com with ESMTP id 36ye1m0qp2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 27 Feb 2021 17:00:21 +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 11RGslmX115709; Sat, 27 Feb 2021 17:00:21 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-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 27 Feb 2021 17:00:21 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Tiyav7sP3YeOi9t8oXUUpsthDhXqJ5ItKQFzS1xrgZ+doU7ENUlbS/7PMR1/xyn5L/E0ZGgsZrMQLndFfPC5qc5pP8qSuuRxglHfQo+LIiMS31eIm5jZ2IU8B7BGZI/KzMQ8pPxF1zsUTqrS6fakWZc1MN2kIpKLwjyKzsG1ZDAmW601Iv+5q8Wuj7bgZW52Pf3ZHoN9vcoHyEWaCDwTOsq5jEUuV2G3Y3y046BcPqIE3fUpxLqx2jCvt4ZAThuX5GM4E6J+7q8iOvnWRFVhU2CcLXBzSwnYuBPYZfLGX/NSitoFq63Q1NK63C5iQ0azqyP+iTYGXkvkn2b+gTunwg== 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=HfnTdvYNAhZ/V14HKCFNOmSmkSA2UO5nPhFpVFbegJ8=; b=S0yJn9ccSSxmDAwXGGYCoAOwE7Xo7rn9/Oa2vP1/q4jxYd7ysjuW43Eh8IrASyQMeXK83jdC/vYlJu4Q+iE28jgPsmbMKMi1P66SJsxhansm8Tj8L2nTKmRLPmVrd6IsvGf4Mj6Pq2NqLT7ClY/urbAeE+Pw9PDmlGYLMzXdrgXyVu1z4IWywwemlPNzlBf6nHJIEmoTal4EHv+RDjFc9Z7MH1aM5/VVXOgODeFL89yPCF5GNByc6dIFMqhHJbnVbOcr1E6kRF2MpXaTgU1gCj11fmL3GDhkJGKAmXN5oki0rgc1LSsPynNk0sMTmcly2iDwItbvgP8UTFWPG6dyXg== 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=HfnTdvYNAhZ/V14HKCFNOmSmkSA2UO5nPhFpVFbegJ8=; b=z+tOgOO0dHR2ta92Lqwsn9LkgyRhzRFdc+O5RB6zc0Q4pegr0skI/0nojlMko/MAMGqr6wvVS0EcGPNpQW3n4TI3ald8phmVNGOmK/gpNmqUEvkpHzm955CPyPT3QrW1na5j6l/W6yUBknbpmAUJjiik/lL/um3pc2MvmRq3g/o= 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 02/25] target: drop kref_get_unless_zero in target_get_sess_cmd Date: Sat, 27 Feb 2021 10:59:43 -0600 Message-Id: <20210227170006.5077-3-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:16 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: bc3e12d4-4b25-4745-957c-08d8db41282d X-MS-TrafficTypeDiagnostic: DM6PR10MB3499: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gLXaIgBLrYLX6ztvSl6RefZ4vKGGhiPN1BzLGKxG+90MclJuNdTOSmJ5bUOo13V5DEJi/lB3NP/lmQC5Fb5rtWCsGAwBqy3K0i6MUPx0CXgjCCzg4qOHqD4MUnhGS9rc+ULSrBzWVD7y6MooEIYIT61X9PfOU40Q3H8TCvyh1/1fOwiYtzJCV99hMzSLxHbXT9d3AUOzdcKJ3ibo9xGpupZcOJH9QixNU/zqJbknRtNkNemdh2Z7l+rt7ZqwG+9OvOSBa1hCACTFnUfsDzRn12aH67GbKMCotQJa7ICbD4zgx0URqhNCryExr9sTGOvzyRjzw2BdphxPDPVgaeMoXNAZIUSK3287oXk8V7U6yYKgj2lBVjNq7V4UzKPsdV/T+rbAQ5s6sQQyknxpba/gA+PilyokV8GkjFcLvIl7BNrZ3GDczMDZpfca8dz8FVHJrC5PdpL3YKLJ5IZqRFHKKk8ulPwrSrbXvtT61Np3AGMbTWuGvZ5KDOtNBl7XFLqYC7EhhHk1vIuQA4hT15Sm73vimlK6MeYdVUBq5AL2gtDwEi/NMwSR9XoAKCUOdBFt3N2E7+obU9YsFblYsJIvtw== 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: 3bCpelRz9CZNcIRymUI/y7p023FXGc6bjFqe0FSNAv6aNcMCt8E4AqiBHjhbaJzykbtk+kpVU7mBD4Rn7zV02Fmv6Di0qm5S5Fge7dJh/JiyoMgXQqJPYEpyR+kLO7EFsuRutpYFuQF8/cuen+XOVZIHCboqtLz2JcWCIEl+1eeQ/9XS54HWVePnMHr7Epz6qT/FuNU2Cv+ZFoWZH1giCWMAPp2NZwm0zdNLf0A1KL8Plj9X5KIB8f6pSjkAoxTVHO+GG7JpB7GCREBXs0w1CLWO2K+SJL/EJSJH/I7OlsMNoBxEYfbaGCWRG1fAXdGaxti+jmAa2qgFkiMZvNeNUT2FA6iVuk/7jmJG55qb8PNCYXx139kVL+M6ugDIcOCYAF2A39HhxrHu8iZWCQBeqrRrgem8T/gDy/d79ia7oNZ5pTfsvmuSV3Oqm83t2e+Yy6GNG0hzkiM5WNA19+zWhzsMuutVGZ/le7E63QfDSCPgYriDvhqMNOcLTH5e6FDnXnrRC/cyh7yRlvT92bAVRCfj8dKCpacE9DhbXZzkh6JT3LbkXuOzL8foOXxEeFpmx0f+//rvBknLEwtH0iHZtFVBMnELPzw0qRxxuvvlRVqymm0NERjIAkIYHz2vMb4VeCZruYv8L9AEqYsgaluXAkxRJSst5w+1/foQT+WT9L0c+vBbry1fcOQkWw9/aOpWDlb4t7OfyR7dAjuH9TEF+tHTU7ilnaZWXWRbP6ANRKf4Yn3NNGEJexkUwl2M+1uhpDj/8WRwATzqivw6GYRBzONdP6WkW6Yp18JH0cb0SQiHBhRwkgjsjtL4uklQq1fLbdmD4U0vzD7nXbzn2YZoOL2S4OmM9ozEz6rbrVo17Q/E65ANJDS5m7H4c/4Dw7F+XAesemyjkHfxzWJAm8mQP5RBUppLZC1QBzb7xYvXUpg9GQAsgk1o0bzL4joSU07EEasjCNe6YwEzE0vWOhy9dD3E5BZzPz8IvGFaVR7sOBco/THZK2WsnshARPoP5o6zBAifpdT2r7bX1rry8xbvcq6Br/lcF8iwcbO73wBS/aVssT0fd01r5L5JSCJKVqWZlspErjDy/B6emnWEfn/h5icE1/y1CxfGiq8a7isFztM8qd2gmgPCmqZ8rWhCI51F/hU3cMQ3JL36jOUJgowEfh5B9pxOW7k9n1TTSycvo1YkrHolqxS6wSELGUnM2eJT7ZT/sTnbh4dGa2wOcmY1wAZOJvtmeviaUPhXcOChc+HKnlvfXvF5AhjsC3GOb6vq92ba1hls+00tuIa6utda7GSIG1WTmC7lovI1VxkDJMEPfi2QiXmCtnzLbFPUhq84 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: bc3e12d4-4b25-4745-957c-08d8db41282d 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:16.8307 (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: 3Da7CqfhcymR/CXz8yd86KvWYdBSJKYmLppwAVcvszkm7rN7pFxwEhx7jBxXEl8SF3K1GX6ewz1n9JeuDrFIc+BfDEysvtMVM07CkJO2OOU= 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 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: target-devel@vger.kernel.org The kref_get_unless_zero use in target_get_sess_cmd was added in: commit 1b4c59b7a1d0 ("target: fix potential race window in target_sess_cmd_list_waiting()")' but it does not seem to do anything. I think the original patch might have thought we could have added the cmd to the sess_wait_list and then target_wait_for_sess_cmds could do a put before target_get_sess_cmd did it's get. That wouldn't happen because we do the get first then grab the sess lock and put it on the list. It's also not needed now, because the sess_cmd_list does not exist anymore and we instead wait on the session cmd_count. The other problem with the patch is that several target_submit_cmd_map_sgls/ target_submit_cmd callers do not handle the error case properly if it were to ever happen. These drivers think they have their normal refcount on the cmd and in many cases do a transport_generic_free_cmd plus target_put_sess_cmd so they would have fired off the refcount WARN/BUGs. So this patch just changes the kref_get_unless_zero to kref_get. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig Reviewed-by: Himanshu Madhani Tested-by: Laurence Oberman --- drivers/target/target_core_transport.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index 5c4adde96d5e..b5427e26187b 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@ -2775,9 +2775,7 @@ int target_get_sess_cmd(struct se_cmd *se_cmd, bool ack_kref) * invocations before se_cmd descriptor release. */ if (ack_kref) { - if (!kref_get_unless_zero(&se_cmd->cmd_kref)) - return -EINVAL; - + kref_get(&se_cmd->cmd_kref); se_cmd->se_cmd_flags |= SCF_ACK_KREF; } From patchwork Sat Feb 27 16:59:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 12107769 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=ham 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 67BFFC433E6 for ; Sat, 27 Feb 2021 17:06:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3912464E83 for ; Sat, 27 Feb 2021 17:06:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230063AbhB0RFh (ORCPT ); Sat, 27 Feb 2021 12:05:37 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:46588 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230207AbhB0RCH (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 11RGxoSh033390; Sat, 27 Feb 2021 17:00:22 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=tjgPReFSRffGv6tKdFo9A9l/oA1V9dfNKG+TQ18QE4s=; b=W7a9dP95OiWGUv5gpHZY/GXyov1cleb60cqGsRMvZVhJ1IWHEh4FJpsaefk5c8uqacMe zKfJnFbWJJ9IJjA8v7ucoItrZUn5WHFe2kznP/fV1pwOLf6Rd8arBeuM3MoC9N6YBIyI ky0z9FJogTb3BPrdHXz8v9O2Sh8TIjWbQhD8rNFYkVNEi5MOYVuFK7YcGCIhCar/ifBn RZ7QMpdfSLxipkAbWghTDadCC3k4lHDuPcyIwMf5rQZ/wnBsui0O/QZ08LmsYVgSVXgm d6fTCiTpzLzhtsKeFVtUG7wuCCGkESKmRuXPQn/94Au9Mtl6i6H4K7zF7I7eakKPVYp+ mw== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by aserp2130.oracle.com with ESMTP id 36ybkb0v3q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 27 Feb 2021 17:00:22 +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 11RGslmY115709; Sat, 27 Feb 2021 17:00:21 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-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 27 Feb 2021 17:00:21 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Eu5nKTx5WDl7xV+hC8D2EL2drroq/2VoLWrQGGP2SIsxHdC7nlWJzkNRY4lCzQHcXVF6vs+qtJVW/oOashMJZ9LdB5v2HHdz2j7hFgY5vlBFrqcdXg9L5OFxVuX2iC9oyfLZc5RQWeefL9gxxiOrttPWg6xIoIxYtgKRDV6ChWG2hK/vDCOhYez00JxhtLRjeNJij8VghyI09hiwJtJO0D2bxYf0WY9zjfR9Y3KDI5Mob1Ptfycu3Gc56IT12YCXZlHlSH7srcVab9MYc9B7TUYpZEPeu6xX9ldMSDKo2ZoYrG9e2jNKPuB95XaifSzHMVC8MjBI/ShdoXUlUFyPzw== 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=tjgPReFSRffGv6tKdFo9A9l/oA1V9dfNKG+TQ18QE4s=; b=JPE2T1SVBIiOrMPldFOR7FoVzl5ExCl/6COSFeC5OBweJGah1BI7kzBseApuv4DBt11YBnTSu9ro8C0eafUyT7I+Zp1wKgNfV/q3CTTLvMDQztXyb5SqY1CMEoTQZL8ArGzoakW9luAQ0WuLJk0mBgbVxNBX+fsTTvqBPSrmJ+M7f5fFxqGcArtpwZSKaO3tRvIeFo9bXIb/lt25mH/25eoLnuqI0o89u3MwJQuMtEglX24yL0umE7utTpEqs862pXd+fUu8iK0wGI00IbrgwUTaCAEWEhxawibsdRnpGujf0z0KbDCdwyFOpc0w5/CxAC5Q8yZfbMfYjaMBUKx5dw== 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=tjgPReFSRffGv6tKdFo9A9l/oA1V9dfNKG+TQ18QE4s=; b=RZIHTltVTFoTDWEizc7oLWKToEEvNH0NJcx1n6tgHMGNJbDGQRIRhOiQuXfC1UC95Toxi+QCglp4ZeuPAG7dQ8t4PDBTr5Ggm8sBRGk2LTpJu4sKYF4MrR966XYNUeE3fh8aVZLqMzyteaM3O48bwNbscy9lQohhWJ3sKybfAM4= 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:17 +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:17 +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 03/25] target: rename transport_init_se_cmd Date: Sat, 27 Feb 2021 10:59:44 -0600 Message-Id: <20210227170006.5077-4-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:16 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c3244b26-51dd-4f80-eb83-08d8db4128b5 X-MS-TrafficTypeDiagnostic: DM6PR10MB3499: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4941; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: eUzEYdzxHm5dZmrn0WQBFYovJ6FnKEo/j/Q8rWclr0hpTxX0Brms3hz27VhPMZEyT+SgZ7OHWb7b86LqU21MmQ77/tOK6q28FXy8HX4sTxPtoL1Zj37uuyCnGzlJTLk2CGg2LtUiC3y021s8q/Oo/P7iJvpk3XkqL1bxPpNc89mxJyjugb9eylbwEJTV6tBNUsY885qCIAWSMbYsV3Ivuy1Ys0YHMrJBQPGTW1QWotG1GAi9rJ6ju+QY8cKudcj40aVggL2Gym9DgRR71uPzDuLgmW6FJ4G8Hcaly8kcIh8PUcvy0i9sMAEZERKChsy1yo1eWn7K5ajol3G+XmivWdJMI6JacuxwcfRlfGMtr0dVV0ofYfDWVOvD3cSCRzBtXgjsFY+047Cs1+UqqiQX+/l70N2Bq/eTX7t5LRHWlcDGi5attpgsMyUJuPQwE2EkB9OKbl54KkVKYo778Mpihb2znwlOg0cmJS5UGg78H4mrkVjTQo3CwPLu7H080wOd01euK9diL2KAsWmHaclHIOc+QfFnpohJf51cwiImjWF4qYoNpuvtVwRukeolWexbmZIsuCMXjzG0jYPcbTPNCA== 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: XxbkoPBjaIdTs2Ltm5W8ZoLvv15g+2PbZEuWUZAMXScJf8iul/KAGh9x26OrO4T8YcZa8eo90eZL9NrmLTWSIkxV3ixMIHsq93sIRZ/TV7+06xrI9byZWytWS4Ooc3ntV9ePQelfh43nccLv9+hpyUxVmUaAbloudrCzyy8qvyo338NOUVQJRt+9qf2rOrDevMMS8PoteXMKcnY7dS5UV7NEb1PsBhtOGbxxXYUpSEJ83njLDPH4zJQ9a+D1TiaIGi93j8yyTq/L8KX95d2s8z6wMkBWUtcZn/IYGNb3OZA64PjC9MY/+VP62ToWBUaJSs2UZ7KglzqT3jxjrPgECmEN0v1dgaE1JSYCavNionaDUqh/8i/Co6+RFi8EFIbAStRkGZ+ezntUL91rL/oobGH5gyXAo68BUQWDG7neBFnoPVMwMeFl/Gta/EJTpxiaf6QN4VzFs7anN0HY9LFnNXNS2xIhTSupHYeOsfIRgarMQgBbEsgi1mYgKj9Ye1DDYLukBf1OO+S0beovuZ2KFnaLCtO4pbvSTp9HsyzZrDsE100XVYy0y8nm7E5p3i78MIIcqQHNVrIKrZpUEOiMTm+fT+pW86mhbcQqNdzb3m/9w1S4SeNQ3DTGCeS3u6RCW43hMZEL6EMnjuBZY8ZXll/hA0p67HT21fsAjJ6iWX2/b6j9pnFKg9IU71yIvIhrvLdygufpDt5bM7hop9ffrokRd9Gxc9RyuCChlIdaUZeRIeQOfx3sGFce0UzUeMidZKwtZtZ74ZnlhfnvwVsUxsGh7uhNbrxTjZa4FaB/1zi0WM/Eq61zs0wSqadjct1twXp9afTt1mdUzzajdMLvrlNWvzbokIr3rhAT8iHy2TDHZvG8Yt1ShZ65fbOzlo9oDXXvyqp5VTRrkzD96RcOdSLBLRFewlLVvwQo2axZqzZTFYhfvcW6dAXU71Uphy8kcXV5tDnWCdf6U9AYy5YN6yIgglrOrqemQaIXJO/g6Id8O31zWFhexamkOFMQuxIHj2KUpMcbrzl1PzuTWV6Jq7DKvuGwH1zhX6SjKHZwlf6Umabw76SaKLhyskARUJpniHiS53yOuJeuu91kYjD8lPWoiMgyC1Wqwil+C3HMYVN7WHwDM/jBrrmRp3SgX5+7ZaWWkhxKGUik9l4/Mt5+1XKT4LHNoH4sgN134uM1dUUBti4MJOfQ8RY6TOvDDakv5Jhvz32dxfepB3KB42rVgVlGawSa3eNkXjVrPTvn9kBMzaHVvy9fYKOFY+nhsI7h6ISwqhkG9RJwXXR8N4bLTQeai2ePCDhKc8kjbywhkAoY6r21KM5oqVtX6ERhkQ9h X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: c3244b26-51dd-4f80-eb83-08d8db4128b5 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:17.7182 (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: gv2y/+purG4hSE2DcvMZ5NjLsOiukcgIJB6oQFMcgM+/1DrLMtwYGzX7D56hY+nIEJFBwVo0tSesS9ObFdy8V8dT+P74aColk1lHrLc+B+A= 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: target-devel@vger.kernel.org Rename transport_init_se_cmd to __target_init_cmd to reflect that it's more of an internal function that drivers should normally not use (usb seems to use it wrong and iscsi is that weird guy), and because we are going to add a new init function in the next patches. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig Reviewed-by: Himanshu Madhani --- drivers/target/iscsi/iscsi_target.c | 16 ++++++++-------- drivers/target/target_core_transport.c | 16 ++++++++-------- drivers/target/target_core_xcopy.c | 8 ++++---- drivers/usb/gadget/function/f_tcm.c | 20 ++++++++++---------- include/target/target_core_fabric.h | 2 +- 5 files changed, 31 insertions(+), 31 deletions(-) diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c index 518fac4864cf..f2107705f2ea 100644 --- a/drivers/target/iscsi/iscsi_target.c +++ b/drivers/target/iscsi/iscsi_target.c @@ -1154,10 +1154,10 @@ int iscsit_setup_scsi_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd, /* * Initialize struct se_cmd descriptor from target_core_mod infrastructure */ - transport_init_se_cmd(&cmd->se_cmd, &iscsi_ops, - conn->sess->se_sess, be32_to_cpu(hdr->data_length), - cmd->data_direction, sam_task_attr, - cmd->sense_buffer + 2, scsilun_to_int(&hdr->lun)); + __target_init_cmd(&cmd->se_cmd, &iscsi_ops, + conn->sess->se_sess, be32_to_cpu(hdr->data_length), + cmd->data_direction, sam_task_attr, + cmd->sense_buffer + 2, scsilun_to_int(&hdr->lun)); pr_debug("Got SCSI Command, ITT: 0x%08x, CmdSN: 0x%08x," " ExpXferLen: %u, Length: %u, CID: %hu\n", hdr->itt, @@ -2013,10 +2013,10 @@ iscsit_handle_task_mgt_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd, buf); } - transport_init_se_cmd(&cmd->se_cmd, &iscsi_ops, - conn->sess->se_sess, 0, DMA_NONE, - TCM_SIMPLE_TAG, cmd->sense_buffer + 2, - scsilun_to_int(&hdr->lun)); + __target_init_cmd(&cmd->se_cmd, &iscsi_ops, + conn->sess->se_sess, 0, DMA_NONE, + TCM_SIMPLE_TAG, cmd->sense_buffer + 2, + scsilun_to_int(&hdr->lun)); target_get_sess_cmd(&cmd->se_cmd, true); diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index b5427e26187b..013f4a5e8972 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@ -1297,7 +1297,7 @@ target_check_max_data_sg_nents(struct se_cmd *cmd, struct se_device *dev, * Compare the data buffer size from the CDB with the data buffer limit from the transport * header. Set @cmd->residual_count and SCF_OVERFLOW_BIT or SCF_UNDERFLOW_BIT if necessary. * - * Note: target drivers set @cmd->data_length by calling transport_init_se_cmd(). + * Note: target drivers set @cmd->data_length by calling __target_init_cmd(). * * Return: TCM_NO_SENSE */ @@ -1369,7 +1369,7 @@ target_cmd_size_check(struct se_cmd *cmd, unsigned int size) * * Preserves the value of @cmd->tag. */ -void transport_init_se_cmd( +void __target_init_cmd( struct se_cmd *cmd, const struct target_core_fabric_ops *tfo, struct se_session *se_sess, @@ -1403,7 +1403,7 @@ void transport_init_se_cmd( cmd->state_active = false; } -EXPORT_SYMBOL(transport_init_se_cmd); +EXPORT_SYMBOL(__target_init_cmd); static sense_reason_t transport_check_alloc_task_attr(struct se_cmd *cmd) @@ -1623,9 +1623,9 @@ int target_submit_cmd_map_sgls(struct se_cmd *se_cmd, struct se_session *se_sess * exceptions are handled by sending exception status via * target_core_fabric_ops->queue_status() callback */ - transport_init_se_cmd(se_cmd, se_tpg->se_tpg_tfo, se_sess, - data_length, data_dir, task_attr, sense, - unpacked_lun); + __target_init_cmd(se_cmd, se_tpg->se_tpg_tfo, se_sess, + data_length, data_dir, task_attr, sense, + unpacked_lun); if (flags & TARGET_SCF_UNKNOWN_SIZE) se_cmd->unknown_data_length = 1; @@ -1797,8 +1797,8 @@ int target_submit_tmr(struct se_cmd *se_cmd, struct se_session *se_sess, se_tpg = se_sess->se_tpg; BUG_ON(!se_tpg); - transport_init_se_cmd(se_cmd, se_tpg->se_tpg_tfo, se_sess, - 0, DMA_NONE, TCM_SIMPLE_TAG, sense, unpacked_lun); + __target_init_cmd(se_cmd, se_tpg->se_tpg_tfo, se_sess, + 0, DMA_NONE, TCM_SIMPLE_TAG, sense, unpacked_lun); /* * FIXME: Currently expect caller to handle se_cmd->se_tmr_req * allocation failure. diff --git a/drivers/target/target_core_xcopy.c b/drivers/target/target_core_xcopy.c index 66d6f1d06f21..e86cc6135587 100644 --- a/drivers/target/target_core_xcopy.c +++ b/drivers/target/target_core_xcopy.c @@ -615,8 +615,8 @@ static int target_xcopy_read_source( pr_debug("XCOPY: Built READ_16: LBA: %llu Sectors: %u Length: %u\n", (unsigned long long)src_lba, src_sectors, length); - transport_init_se_cmd(se_cmd, &xcopy_pt_tfo, &xcopy_pt_sess, length, - DMA_FROM_DEVICE, 0, &xpt_cmd.sense_buffer[0], 0); + __target_init_cmd(se_cmd, &xcopy_pt_tfo, &xcopy_pt_sess, length, + DMA_FROM_DEVICE, 0, &xpt_cmd.sense_buffer[0], 0); rc = target_xcopy_setup_pt_cmd(&xpt_cmd, xop, src_dev, &cdb[0], remote_port); @@ -660,8 +660,8 @@ static int target_xcopy_write_destination( pr_debug("XCOPY: Built WRITE_16: LBA: %llu Sectors: %u Length: %u\n", (unsigned long long)dst_lba, dst_sectors, length); - transport_init_se_cmd(se_cmd, &xcopy_pt_tfo, &xcopy_pt_sess, length, - DMA_TO_DEVICE, 0, &xpt_cmd.sense_buffer[0], 0); + __target_init_cmd(se_cmd, &xcopy_pt_tfo, &xcopy_pt_sess, length, + DMA_TO_DEVICE, 0, &xpt_cmd.sense_buffer[0], 0); rc = target_xcopy_setup_pt_cmd(&xpt_cmd, xop, dst_dev, &cdb[0], remote_port); diff --git a/drivers/usb/gadget/function/f_tcm.c b/drivers/usb/gadget/function/f_tcm.c index 410fa89eae8f..dcce6e2605f5 100644 --- a/drivers/usb/gadget/function/f_tcm.c +++ b/drivers/usb/gadget/function/f_tcm.c @@ -1050,11 +1050,11 @@ static void usbg_cmd_work(struct work_struct *work) tv_nexus = tpg->tpg_nexus; dir = get_cmd_dir(cmd->cmd_buf); if (dir < 0) { - transport_init_se_cmd(se_cmd, - tv_nexus->tvn_se_sess->se_tpg->se_tpg_tfo, - tv_nexus->tvn_se_sess, cmd->data_len, DMA_NONE, - cmd->prio_attr, cmd->sense_iu.sense, - cmd->unpacked_lun); + __target_init_cmd(se_cmd, + tv_nexus->tvn_se_sess->se_tpg->se_tpg_tfo, + tv_nexus->tvn_se_sess, cmd->data_len, DMA_NONE, + cmd->prio_attr, cmd->sense_iu.sense, + cmd->unpacked_lun); goto out; } @@ -1181,11 +1181,11 @@ static void bot_cmd_work(struct work_struct *work) tv_nexus = tpg->tpg_nexus; dir = get_cmd_dir(cmd->cmd_buf); if (dir < 0) { - transport_init_se_cmd(se_cmd, - tv_nexus->tvn_se_sess->se_tpg->se_tpg_tfo, - tv_nexus->tvn_se_sess, cmd->data_len, DMA_NONE, - cmd->prio_attr, cmd->sense_iu.sense, - cmd->unpacked_lun); + __target_init_cmd(se_cmd, + tv_nexus->tvn_se_sess->se_tpg->se_tpg_tfo, + tv_nexus->tvn_se_sess, cmd->data_len, DMA_NONE, + cmd->prio_attr, cmd->sense_iu.sense, + cmd->unpacked_lun); goto out; } diff --git a/include/target/target_core_fabric.h b/include/target/target_core_fabric.h index d60a3eb7517a..4975c4d2a933 100644 --- a/include/target/target_core_fabric.h +++ b/include/target/target_core_fabric.h @@ -148,7 +148,7 @@ void transport_deregister_session_configfs(struct se_session *); void transport_deregister_session(struct se_session *); -void transport_init_se_cmd(struct se_cmd *, +void __target_init_cmd(struct se_cmd *, const struct target_core_fabric_ops *, struct se_session *, u32, int, int, unsigned char *, u64); sense_reason_t transport_lookup_cmd_lun(struct se_cmd *); From patchwork Sat Feb 27 16:59:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 12107801 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=ham 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 69E55C433E6 for ; Sat, 27 Feb 2021 17:10:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3E6BA64E86 for ; Sat, 27 Feb 2021 17:10:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230347AbhB0RJR (ORCPT ); Sat, 27 Feb 2021 12:09:17 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:48052 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230281AbhB0REm (ORCPT ); Sat, 27 Feb 2021 12:04:42 -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 11RGx3wT032483; 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=HXHwPn4n49NmRvdLRZ2lIEM+fuQIc1gTrIMasqA08JQ=; b=WWFTh9C1HUXAIrn0i0totpd62YVKitXCq2mmiWk1aEUE9cCv6OWw8YIWyCzYaMSYmxkk 2D3j2IfjLDjDbavBLSa1gSCyY4m5+uRMBDKhzusi014JKWGpbPG+zkXY9qfW9mx3/8rv qqNbnVl818QpaKsxYo0+0pxanwv9mOGf+J3jG4El7WR3GUUv3rkKtsvTuQFKq+m+gagm 4ey7xrKg9hR49XBuNWiae1Ia8v65qjBRgIktHpaPbP4Scd3a9+rfWSn3HPoEpO2pQllV 0o8fvAyh/OZSyRj0WlC704o61i6FZcjqbZ2EAiFpa9g13L6DOsPOrZ3FRe9Y3MkwUvOG pQ== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by aserp2130.oracle.com with ESMTP id 36ybkb0v3r-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 11RGslmZ115709; Sat, 27 Feb 2021 17:00:22 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-5 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 27 Feb 2021 17:00:22 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=W4Aig8mOs/yPIewASUSQQJILPbmszM/mEW1rlOCBc3boJHPhxcMwdjlm69jxlN/ed7KhcSOVcUTj3JTJjeoBy2YDea08DTmRuZt78yX0IuVACKwiUpMCYQyOQ0UL2GTZHNAbDrQIpcux7z9hbsdpqGyIEpuDmWWRR9pVVIXNAa9eUMGvDDAQ1O2o/Yoh2SVnQD57vdnKe1TrqjNMBsjIkV79TmX0bZPuqQC+vY+0Ny/6rK9tb3zlrh86cKhEK446V273dxm5AhrMHk2ziSPILGKlgxXk4lTs8sfTt/EQs7iQVBu/lCH4fvVW4CipBg64xQsotm+KrxH5zLDKuwXZNQ== 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=HXHwPn4n49NmRvdLRZ2lIEM+fuQIc1gTrIMasqA08JQ=; b=YWwwTnWxRAas4VIkKLnIeyKtvj6QAvSJPGD1/5RMj0L3jwDeN5uO14ORWTP2mk1Qtx7+zxKUg86a9a8i1JUUh1XoEpun6sqL3T+RCoF9lFnBWg9UiPlq2ABt+9NWKrS23Z9n/TGI8/luj7ZYp23fAtqE4MLbhHBGh38gJFH8LYjq77IKlF7N+YezPDyOY52XWGTDEfe0z3u0aMouHhfcqhDnjnHaUUQo9mYCWVkv0j58DJ7T2mAbl6cFgqqkdjkiVvvOHu2x2K+mdroQh0w1CQnCpOIdhVoRZ4BjD1GQgU0eU1PP5PIaw1VFHfrpksYSk1w/TAoEF6mMFVDcTZTGUg== 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=HXHwPn4n49NmRvdLRZ2lIEM+fuQIc1gTrIMasqA08JQ=; b=ygVfCHeAMAyYlXenHk8CaFGiEmx/kG1ZxPJVbQAxjXOalSwAmVgTwAasNWza8zK3+6u8RpFhC+K3qd/JE40g9LqJRXnW1vebbUVGjVvq7ljkhgd9UFNpH5DYBPa31o309jkfrz/9ePdStA8f53ucoWuxiwwoBTYl2zUt1R+0kuA= 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:19 +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 , Juergen Gross , Hannes Reinecke , Nilesh Javali , Michael Cyr , Chris Boot , Felipe Balbi , Himanshu Madhani Subject: [PATCH 04/25] target: break up target_submit_cmd_map_sgls Date: Sat, 27 Feb 2021 10:59:45 -0600 Message-Id: <20210227170006.5077-5-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:17 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ef7300ea-f44c-475d-e770-08d8db41296e X-MS-TrafficTypeDiagnostic: DM6PR10MB3499: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: AD1mkyVBO0XUXRZecvrXwWrNSKPRBxRFaK+yxrsWHcAh91AwmgvVZfz7lOSV1reB4eICBrGbOLsxTA+aEuWN152p8fZy9rLghoOe7g/YvMbNKlsKInqgBIi/NOhiDgtRUXb1an423va9s2rAg0XMOvTuHioaCKOPlZiwgQKe7tAxsAP3cmAjBiuGm4gSZihdBHs3UfUfY9G7qMt/wIFhZPX821Weqqhhgen5JsukL2JQK9PwXHRnGoRFxTFKwyB3Z7oKGKzvSqRGHlZ8C7M25gtROTFs8srxMBtKgrELhXXtx4WAfEclc40GHPyNuo/Q3pdJaUoMBVdBLRqwsvPate3JGxNURU6Yq8mNoi8e6QficBpJIuIQLjIguFG0wVXwwJ0M+1JY0kEMH6DJXOAWbRh6dnrekI8eOVHpr1Xv/wgmLkVUy29BNYmaiJ9X6vMKOY+4ZM0esHoH7fq9CUuW3UzxhI69r7rEDjV2myeB3CeMwtuJ8Mp3CuI7dwHHyyo44cdyRaKe0hFjITfaXy161j+n1awmnlg+u43r4UfdjxOiXtDiXBEIGU1eszB6ViOLynjXeLr0X8/AT0RMXfj9Yw== 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)(30864003)(186003)(16526019)(66556008)(5660300002)(66946007)(7416002)(6486002)(66476007)(54906003)(8676002)(107886003)(26005)(52116002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: qF4yP3LqJd8BINDlQ/0JcY5hSpTJ+6rvXxANWlO5cNLQTCXOuywUTwS1maCEuETYR5Gp8RqZDz+iUo8hFlkuo4olvqKw564XxKbrtbWK4KcFElkQDLuc/REz1YQc0wmG2GZZiAebDtMXJN7SloxYw7JR2M+0+q57lNL4RbVeWiNV4BilFHwTeQNCVvQ2D+ODVGJAHnQAK103A7rxZkREWfVKqhZVCPmGz/CWvg0wuGjRBEhCRqW5D966Bae45NfFKu2GPJFMl0CAnCtNVgJ8LLIboUuEvK8TJXSEfn6NXEIrzgUx1fzpku7sR7myX6JkknzRvPnuCuOHeEkPSgSJVlEodWSyDI7fJ6mThGQWwVjb15IOjwqldxrBRtyktQK+MZyw0m8+6AS6oIb+LopQVi2lOeynu+/AHFuTgetI9lUrdXDbF+rl/XeyTpezFpweO+tOzElqN+NtphVaGN3WBfAHMtBRnuE2a3wPQBqFzkGfZzA9Qra1y7AikU0dfrbSYYKZteX8PZrxGI9qZDV5phAVACL+jW3WANEOgpQF9yano+Vn/T9m5CIyQrv+f2YLFtjoJtbIT3G3LWfMKYtXHtDxaq7+hcCdRMalj+bBPTuEpipnD+IMo/ppYRHddWCCuAZgJKcrZb6G9jhZ/vkJub5DHqUPZJ5IHAxxqpTwS1UqrgPTCkhF/jWY8JQMZaJl4kCID6HOTqmOj7GId0NqWWgiyFCM37xuQxto2tatW9aN1s86peQS4DTi0M3udFkJWiprZCkGu4hxMTVVwQvFkLbP2zz42A74fPu0tP6ft6OTp1eVTN9TlTEOLrb8a8Tv3iAqVgFy6iJ0pAjmnc34j7JCjq6a8By0kRrFmpqliBREZE16RYJfckrCZq5eaiR6VZhW2joJkEQhlKRMjRWfj74+lS8GQ3aizDqJIgFEsIPnH90sFBFVhDipbaePJ4lO/clDOH84Zp9JiPGwWC1e0TxEsM9F2NVzNMghvYRZVQ5NbNllALOFUw/BW/xUC2RLE3GjwNXd0TRctEM3YQUOpfOVFTMlBu1TazRsRCewe1c5twUSO6AilkYW7p2JxdF6NcvOUj/I6D8rMKQwL+y69FwaI2YdBXNBLOPlF1etbmTb1U3MrDFL8cMldfsGxNr02oOjF6F12ysxSaWq3EVmxZiALvyRWGq5Nxnmm0Q7augtEsojgDdOaJ8I7g5WHazBmoNQkan4tc7QsTkRdBX/z12RYw0W6Ir++vTL/pFbmQA6RCSeR8SMPvNGM/J+cqeaF+f1BcOdZ+uJtM8L3Q+fgcLNcm+ehjbJWNziaUS/Llnau0t7SxYncf7DjF39fOm8 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: ef7300ea-f44c-475d-e770-08d8db41296e 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:18.9605 (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: PmaVXY2o2kzkvAC5nKhSJWhm0z+IK1Y8eKjuaicqzEzHaZiBnAXH88YqFzOQuPbJcqBkY09Lot7A07JTuE6uhtrPn0wxVelK9XiiF9EUOfs= 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: target-devel@vger.kernel.org This breaks up target_submit_cmd_map_sgls into 3 helpers: - target_init_cmd: Do the basic general setup and get a refcount to the session to make sure the caller can execute the cmd. - target_submit_prep: Do the mapping, cdb processing and get a ref to the lun. - target_submit: Pass the cmd to LIO core for execution. The above functions must be used by drivers that either: 1. rely on lio for session shutdown synchronization by calling target_stop_session. 2. need to map sgls When the next patches are applied then simple drivers that do not need the extra functionality above can use target_submit_cmd and not worry about failures being returned and how to handle them, since many drivers were getting this wrong and would have hit refcount bugs. Also, by breaking target_submit_cmd_map_sgls up into these 3 helper functions, we can allow the later patches to do the init/prep from interrupt context and then do the submission from a workqueue. Cc: Bart Van Assche Cc: Juergen Gross Cc: Hannes Reinecke Cc: Nilesh Javali Cc: Michael Cyr Cc: Chris Boot Cc: Felipe Balbi Cc: "Michael S. Tsirkin" Cc: Stefan Hajnoczi Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig Reviewed-by: Himanshu Madhani Tested-by: Laurence Oberman --- drivers/target/target_core_transport.c | 201 +++++++++++++++++-------- include/target/target_core_fabric.h | 8 + 2 files changed, 148 insertions(+), 61 deletions(-) diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index 013f4a5e8972..8b2b805316dc 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@ -1571,46 +1571,31 @@ transport_generic_map_mem_to_cmd(struct se_cmd *cmd, struct scatterlist *sgl, } /** - * target_submit_cmd_map_sgls - lookup unpacked lun and submit uninitialized - * se_cmd + use pre-allocated SGL memory. - * - * @se_cmd: command descriptor to submit + * target_init_cmd - initialize se_cmd + * @se_cmd: command descriptor to init * @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 - * @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. + * Returns: + * - less than zero to signal active I/O shutdown failure. + * - zero on success. * - * This may only be called from process context, and also currently - * assumes internal allocation of fabric payload buffer by target-core. + * If the fabric driver calls target_stop_session, then it must check the + * return code and handle failures. This will never fail for other drivers, + * and the return code can be ignored. */ -int target_submit_cmd_map_sgls(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) +int target_init_cmd(struct se_cmd *se_cmd, struct se_session *se_sess, + unsigned char *sense, u64 unpacked_lun, + u32 data_length, int task_attr, int data_dir, int flags) { struct se_portal_group *se_tpg; - sense_reason_t rc; - int ret; - - might_sleep(); se_tpg = se_sess->se_tpg; BUG_ON(!se_tpg); @@ -1618,53 +1603,69 @@ int target_submit_cmd_map_sgls(struct se_cmd *se_cmd, struct se_session *se_sess if (flags & TARGET_SCF_USE_CPUID) se_cmd->se_cmd_flags |= SCF_USE_CPUID; + /* + * Signal bidirectional data payloads to target-core + */ + if (flags & TARGET_SCF_BIDI_OP) + se_cmd->se_cmd_flags |= SCF_BIDI; + + if (flags & TARGET_SCF_UNKNOWN_SIZE) + se_cmd->unknown_data_length = 1; /* * Initialize se_cmd for target operation. From this point * exceptions are handled by sending exception status via * target_core_fabric_ops->queue_status() callback */ - __target_init_cmd(se_cmd, se_tpg->se_tpg_tfo, se_sess, - data_length, data_dir, task_attr, sense, - unpacked_lun); + __target_init_cmd(se_cmd, se_tpg->se_tpg_tfo, se_sess, data_length, + data_dir, task_attr, sense, unpacked_lun); - if (flags & TARGET_SCF_UNKNOWN_SIZE) - se_cmd->unknown_data_length = 1; /* * Obtain struct se_cmd->cmd_kref reference. A second kref_get here is * necessary for fabrics using TARGET_SCF_ACK_KREF that expect a second * kref_put() to happen during fabric packet acknowledgement. */ - ret = target_get_sess_cmd(se_cmd, flags & TARGET_SCF_ACK_KREF); - if (ret) - return ret; - /* - * Signal bidirectional data payloads to target-core - */ - if (flags & TARGET_SCF_BIDI_OP) - se_cmd->se_cmd_flags |= SCF_BIDI; + return target_get_sess_cmd(se_cmd, flags & TARGET_SCF_ACK_KREF); +} +EXPORT_SYMBOL_GPL(target_init_cmd); + +/** + * target_submit_prep - prepare cmd for submission + * @se_cmd: command descriptor to prep + * @cdb: pointer to SCSI CDB + * @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 + * + * Returns: + * - less than zero to signal failure. + * - zero on success. + * If failure is returned, lio will the callers queue_status to complete + * the 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) +{ + sense_reason_t rc; rc = target_cmd_init_cdb(se_cmd, cdb); - if (rc) { - transport_send_check_condition_and_sense(se_cmd, rc, 0); - target_put_sess_cmd(se_cmd); - return 0; - } + if (rc) + goto send_cc_direct; /* * Locate se_lun pointer and attach it to struct se_cmd */ rc = transport_lookup_cmd_lun(se_cmd); - if (rc) { - transport_send_check_condition_and_sense(se_cmd, rc, 0); - target_put_sess_cmd(se_cmd); - return 0; - } + if (rc) + goto send_cc_direct; rc = target_cmd_parse_cdb(se_cmd); - if (rc != 0) { - transport_generic_request_failure(se_cmd, rc); - return 0; - } + if (rc != 0) + goto generic_fail; /* * Save pointers for SGLs containing protection information, @@ -1684,6 +1685,41 @@ int target_submit_cmd_map_sgls(struct se_cmd *se_cmd, struct se_session *se_sess if (sgl_count != 0) { BUG_ON(!sgl); + rc = transport_generic_map_mem_to_cmd(se_cmd, sgl, sgl_count, + sgl_bidi, sgl_bidi_count); + if (rc != 0) + goto generic_fail; + } + + return 0; + +send_cc_direct: + transport_send_check_condition_and_sense(se_cmd, rc, 0); + target_put_sess_cmd(se_cmd); + return -EIO; + +generic_fail: + transport_generic_request_failure(se_cmd, rc); + return -EIO; +} +EXPORT_SYMBOL_GPL(target_submit_prep); + +/** + * target_submit - perform final initialization and submit cmd to LIO core + * @se_cmd: command descriptor to submit + * + * target_submit_prep must have been called on the cmd, and this must be + * called from process context. + */ +void target_submit(struct se_cmd *se_cmd) +{ + struct scatterlist *sgl = se_cmd->t_data_sg; + unsigned char *buf = NULL; + + might_sleep(); + + if (se_cmd->t_data_nents != 0) { + BUG_ON(!sgl); /* * A work-around for tcm_loop as some userspace code via * scsi-generic do not memset their associated read buffers, @@ -1694,8 +1730,6 @@ int target_submit_cmd_map_sgls(struct se_cmd *se_cmd, struct se_session *se_sess */ if (!(se_cmd->se_cmd_flags & SCF_SCSI_DATA_CDB) && se_cmd->data_direction == DMA_FROM_DEVICE) { - unsigned char *buf = NULL; - if (sgl) buf = kmap(sg_page(sgl)) + sgl->offset; @@ -1705,12 +1739,6 @@ int target_submit_cmd_map_sgls(struct se_cmd *se_cmd, struct se_session *se_sess } } - rc = transport_generic_map_mem_to_cmd(se_cmd, sgl, sgl_count, - sgl_bidi, sgl_bidi_count); - if (rc != 0) { - transport_generic_request_failure(se_cmd, rc); - return 0; - } } /* @@ -1720,6 +1748,57 @@ int target_submit_cmd_map_sgls(struct se_cmd *se_cmd, struct se_session *se_sess core_alua_check_nonop_delay(se_cmd); transport_handle_cdb_direct(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. + * + * @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 + * @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. + */ +int target_submit_cmd_map_sgls(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) +{ + 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; + + if (target_submit_prep(se_cmd, cdb, sgl, sgl_count, sgl_bidi, + sgl_bidi_count, sgl_prot, sgl_prot_count)) + return 0; + + target_submit(se_cmd); return 0; } EXPORT_SYMBOL(target_submit_cmd_map_sgls); diff --git a/include/target/target_core_fabric.h b/include/target/target_core_fabric.h index 4975c4d2a933..4b5f6687393a 100644 --- a/include/target/target_core_fabric.h +++ b/include/target/target_core_fabric.h @@ -151,6 +151,14 @@ void transport_deregister_session(struct se_session *); void __target_init_cmd(struct se_cmd *, const struct target_core_fabric_ops *, struct se_session *, u32, int, int, unsigned char *, u64); +int target_init_cmd(struct se_cmd *se_cmd, struct se_session *se_sess, + unsigned char *sense, u64 unpacked_lun, u32 data_length, + int task_attr, int data_dir, int flags); +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); +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 *); 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: 12107777 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=ham 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 18F32C433E0 for ; Sat, 27 Feb 2021 17:07:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BB26364E83 for ; Sat, 27 Feb 2021 17:07:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230235AbhB0RFq (ORCPT ); Sat, 27 Feb 2021 12:05:46 -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: target-devel@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:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 12107835 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=ham 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 3A0D1C433E0 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 EF23F64E84 for ; Sat, 27 Feb 2021 17:13:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230235AbhB0RKv (ORCPT ); Sat, 27 Feb 2021 12:10:51 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:47876 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230125AbhB0REG (ORCPT ); Sat, 27 Feb 2021 12:04:06 -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 11RH0OMB034225; Sat, 27 Feb 2021 17:00:24 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=nmNPczwdrWFQufUfS26xsht2CcTvVrMqQOEoCGgZw3A=; b=fOqthph4KKZ5cIHcPZTJ4RfQw+HF4IQa60LlnKzkXWcBy7KGi5Guc/CnPYpPphiWrqNi q7K1bKvWSPxTCXfmz9dmEeUaY1KZaEGdDAg85bZ48QykJINj2YA7HQp7d1huTjCSzV8N gXrOlm2up2/23/VEN+SJH/WDP+V1YDe6z6IFmynqzauji5FHgYK2PAcpyvtMo9sT7MHk iw1fFB8ceEFVDgrJ8VjZFoo+8aIjus/+xYu0Qq6XFasXPwcbI1lBn/2tSwLk7LKF+XdH UUWPPl3R/gL+DiAxmom+mVHy8Xpj+Gq6Nh+sg58T9E01uenGMjagAAPft6JmL8/hDqdI Rw== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by aserp2130.oracle.com with ESMTP id 36ybkb0v3v-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 11RGslmc115709; 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-7 (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=FdLVr/ZzDMnS/0fZy9v63LCAHOVuh8VCdV+CIcCiNOott9BbwuasoPbBZgd57FeH+xdHOg0NY2Ex/qRNnnpDmnDCNhS1bJ2DkL+gsIdcsEPdR2AeswaLnfZCEAN78MpTYcCkm55J1FY5imJBVJBQDZ4hh66rC1/musmAKw8sh/LW+ps5onL+deZQWTopfeG9RcOIAvEx87nYZDOWrE8pAfDNMH9fVZsSm1a31Xj4UlOJdZIF21MB5flNScTSOdrEWpR5zr8S/Z0ZcoKw5/vir9RqZExa6pyyaip/F4env+si7cjoB0+sggaauFuGtdxkCIQui6rbW4bxkCJZyPnjcw== 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=nmNPczwdrWFQufUfS26xsht2CcTvVrMqQOEoCGgZw3A=; b=lYEvgdjm3dzadQeR3k9VmTRKH0CXBJbQ6zWRAby/xDhjsVcOFaIWn3aa6aQ+mkaNcP6d55RJdzfZ+ngho2ru/ec9KUWAsmQbiB7WZdd3E5btr5qte6gD0NzYCs00vjhCw6/AFUMhThS5NsOYedHYuH9iVZO3hgpLdluw8FpP0i81ZE+9zkPFAwpbSAYALATr4JvfMzzCyYE6N12Vh2SNTmw+veTiMzEo/fF4f2bKS2di74VM34RPHl9VUG72eaaDCDSIocgMW/kstP6VUPY8WMuVDkNmA6fCWG4BuqtHwkBGnEqJbMvIS8YTJ2ofnpE1L5/xaoZ48oFI7mczsVPmgA== 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=nmNPczwdrWFQufUfS26xsht2CcTvVrMqQOEoCGgZw3A=; b=HHcd6GKGzo0fJcpbu/6qDP7ETTtf9rkK8hRRMNmWwlzR6f0zDNvxVBBzzoWQ/dCo1cULWMrLWA1cNDczg4AggHDVvJ4eNlNVtFVFesfDAacc+E7LwZBV4gFzjP6YFT4bEyi7dAzwe747DeH2BWi1wHZfneVMZA5BRsqNFO14nx0= 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:21 +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 , Michael Cyr Subject: [PATCH 06/25] ibmvscsi_tgt: Convert to new submission API Date: Sat, 27 Feb 2021 10:59:47 -0600 Message-Id: <20210227170006.5077-7-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: 300dc3d6-8d33-4bab-fa8a-08d8db412a8e X-MS-TrafficTypeDiagnostic: DM6PR10MB3499: 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: E5+8LcJQWAc/R+cBI+l40PX+NFsPorgQzcx2ZxnAMoswZgsebCvMGcxztAsPq7zCedRiAu1DkbljfrxgFCTVsp2jK70HPOPkohxw2wihFzs1bl7i1zfDdeUI8MJc5eeNMDMW0R7N9Ub011+fg2DRQb2E9j+PVRYxsOYICok6XEdmZMYyazviSX31xFRdzRgJCwg/bkutN95d6Kc6dNBuigDbMYWHy/lkYE1d85A4xyyiGUF+EiAPo/X8X8w2S4z9tG51shkfDXmzExlyZkTih2uPm54n5MABVR+x88qDrRswO1vv7JyyHi1kBj/L14zXJaD4YNuhPu4HzRlfiDVqnqG58OzJfXLuXtgb32ADT/NJpDLtPbw6xpdtX/4GBz20irntz6wjaflsd6ruz5/o3I67H8t8K1plClXOuM1yfSyQOlSaRe4bFmYUtQcEGxdubhLpROM5Sf9yJYyoJhu5628MTfqE4cFSTJIgKl7Tr695OsatfGavecSUSIjGStZAJq/9NKJmEko/Q46gEB3urvX1+dxeS6407cDuo4ryoykEmWXq8YtCbnrjvKwgZxmD2QA4Wem6OWksEOFZ+CCD9g== 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: K85nY+YXrO9szeD6AwYEbmUkdrYhiN2EoyDoX0XQH8O5EGL9/+hreChI7kXKbW5BEQhoMq0BpJRC6De773ovSDSziVG5B0hPfen5Js4QVZX9bjpJqSXga0zM71hyfiIlOwGSILTkf0vdMjEnhcSSzvrecTrPJYIxC2u4Ut7SWT3OKE7781nCvrEQSE/N/wVUmiNv1bIvRcGyRobEhTRYNtPCaGNFzlKev/A+IDHEme0/PzalGWlZdqQMAHPP8y1Ma/k1ATP4Vr7vnCEe+ZdQwI3la9n6p3jEpEJJtg9z/gdOvZejhlScvqd42TpoGUnKL/O8jRHh6Gl5QTSZBD7PkDbWV5bwDACQ/lifavHD1bfzT4JZD44obpTemNmfnnV3qm0BvW7ACmQOwlaHEM+T8OMzEPixZnkzmHsfy2hMHewF3CFqLCt+ON322ojod700lGp3kGtxDNKhpdfwJP0Ljw2P2xRMz0DWahtt8T1UW12FqiWvzU8SOsj/6/jEJScI6McapI/d6UOXp7nKGudRiSJEH93hsQJD0Be9Dyr2KuPdSRl0O1ORPWSXVH/8UTwEZOFOs48ITrcdOa+lc81+vbJMeCSp8G0BATmpsnL0GJALGfnhLsWBdlk1iG73SJTqLCB42b7ecUbm1TpSO0FRVOJFXjbehz6Fijg8SExZCe3/3KbOiNhRSgWhkL0Hr3e0FmRTpdZ8Nft6MuKyuFKjZldYYOvZUI3my3X+qx+TYNyVKie6jlLzu3oFGbnRVH2YiQwq4P4D3fA1VtNsskRCCY3aJm1CQTwvKAtDaTEA7WiQGpr3KHhiTR0rf6/79ZfpqR90eV/1rn0UNGTP7TQilUyo48OmktdIMpNzXcLmCiWEczpdR1V1nNU7ajhUzX0TjqJMwjcYSOhUBvTAFkON0T875deP9bNmdCiJhg1x6/zHpLWi5zzVa4M6z6loir2Su0KOqO92iF2boi2YP64SXteYXsKyypdw+dE7rF+ijnDIacXfaRp1Gc73iPmpU97SipWWQzQ9Z5VnXWAb4tSGLHGLre4UPAN0q93qzzQX0KK3xoOQV8pZTelCbjUnretH0EXnRF3o8URxQNmzn8Ba3BB9PEGQzI0Q2bLEvKtLViLixIwCy/yCOxHWXKbZE7QGrV2rPgLEvR/7Xw1dz7lRe4PAFEIAUar7yrTV2BVL8+tt299Xwvr94VmTJUBTiCAhsBdAYAZLAqyaq5G9GdGM+F5bOi/SKnugnq/t7KLV9VDlKp1giiD9G0ImQK5J9IvtFUBXvYTlp3tyPN5qJefCadTgKMRXO6Ga3xI9WUlORX4zr2bOexPVeCVjimHl1vdw X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 300dc3d6-8d33-4bab-fa8a-08d8db412a8e 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:20.8014 (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: 7OpLl8b/3MyUcvyUqZHDbdalGOlfKpzr0eHNiFJV5lbvuZZ0X51KPmY0AEJb0UEumFK3WSyGI10Ljq9Cp48GLizANU+QtJmJ96jZurIQjYg= 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: target-devel@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: Michael Cyr Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig --- drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c b/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c index cc3908c2d2f9..cfc54532402c 100644 --- a/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c +++ b/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c @@ -2670,7 +2670,6 @@ static void ibmvscsis_parse_cmd(struct scsi_info *vscsi, u64 data_len = 0; enum dma_data_direction dir; int attr = 0; - int rc = 0; nexus = vscsi->tport.ibmv_nexus; /* @@ -2725,17 +2724,9 @@ static void ibmvscsis_parse_cmd(struct scsi_info *vscsi, srp->lun.scsi_lun[0] &= 0x3f; - rc = target_submit_cmd(&cmd->se_cmd, nexus->se_sess, srp->cdb, - cmd->sense_buf, scsilun_to_int(&srp->lun), - data_len, attr, dir, 0); - if (rc) { - dev_err(&vscsi->dev, "target_submit_cmd failed, rc %d\n", rc); - spin_lock_bh(&vscsi->intr_lock); - list_del(&cmd->list); - ibmvscsis_free_cmd_resources(vscsi, cmd); - spin_unlock_bh(&vscsi->intr_lock); - goto fail; - } + target_submit_cmd(&cmd->se_cmd, nexus->se_sess, srp->cdb, + cmd->sense_buf, scsilun_to_int(&srp->lun), + data_len, attr, dir, 0); return; fail: 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: 12107781 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=ham 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 6DD0AC433DB for ; Sat, 27 Feb 2021 17:07:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3D43864E84 for ; Sat, 27 Feb 2021 17:07:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230234AbhB0RHN (ORCPT ); Sat, 27 Feb 2021 12:07:13 -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: target-devel@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:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 12107783 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=ham 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 E311EC433E0 for ; Sat, 27 Feb 2021 17:08:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A4D8F64E83 for ; Sat, 27 Feb 2021 17:08:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230303AbhB0RHT (ORCPT ); Sat, 27 Feb 2021 12:07:19 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:47982 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230210AbhB0RCI (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 11RGwf3Z165579; 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=wEzbYzfKix+PmW79toGO7JSjYwGZC/E8Ru7vqxwNZUc=; b=mBEBWaOvsa6IcGWUeBX2zo/2rv0/8MtGrue44Fp4bTSf1cr/pDPtb4YvJSwAg2YSCMlc t45SLdZ7xHUCN5tBFI4aLYJ0fDrX22WMt+Jz2mPBkt7TvviXC9utISZtroqLlZaZYzAc u2MO9MsfztUgXHMlOlt5mxGqfgnz+wDoqD8ealo4NR7iL4+boXydS8dTR45AQdhrTgnC lX46KJABvp3hlU9qA8dtEmd5b2HD8snpRdey4gJJHoEG/MKCKhlqoiEXOc75mMIUexT2 EpMcifk8uq9j65ucKuvYHu8FvFHnu/A1ux8NyDeR/ortZTB3ZaR+O1neyZDUu4Kc49u3 LQ== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2120.oracle.com with ESMTP id 36yeqmrpsw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 27 Feb 2021 17:00:25 +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 11RGslme115709; 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-9 (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=MjksFnBSb+UxBbGUV98/Z5LSaPI0rekkK0GfIN/kHTHqGhmuswG4tk9N2M9tBcFMAL6v/pyjzCr614sVQAY35HuXC3f/c8kVTQNpQALFoaIZqcv0hjUFfnTsFH4ZctnpcSeb7dfTP99hYfEdszwyHfMj3DO+fFtWuh9Ahum+TRd/d7seuqtJ94VNC/WJBV+H/F2HyUmTrDHtzb+QNZCz0w8yzZ/dOZyFBfMEvvTIShXiVlkPRj0pbyz5tYY5wOGBoQRh+M28TispOgTxS0nyKlX90/NGri0z/MiSh7ndsmCI5+go/25TTk5uO6/u/3LVsvKaPwCR/YDW6mYghBRLww== 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=wEzbYzfKix+PmW79toGO7JSjYwGZC/E8Ru7vqxwNZUc=; b=YXAOHjUc91HaJ6TriJ9rXBFWtDDImByVI19oRjKp0qXSKh8/eerYGw4IBSpVWj/DPdOzOKg4SCfGP8dAVVzxdfPqweAmuRWWQUwg0yvwDHqJ5hTFpde03HlSuXWiu7twZCAQm5OUrva3NoOqmsuOKn6H12ZFMji0d8M70btzio249x1t/gHgi6oy53u2TzEyZfKOOY6nJlp8uxC8hmS+Q/HWzt0iyHdyA2N//ENi/xLl1pBxnzILTKPtv19xB/3Dvsv4M53HBEioJIZlWdbaDirleoXPmtGwM6HoN+OkrifhS/Yo54vLw7bydo0/Xxdi83qBbQLtzRlzJkA2qS385g== 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=wEzbYzfKix+PmW79toGO7JSjYwGZC/E8Ru7vqxwNZUc=; b=VV6+e8OrJUEv7C338VUU5SdCe4Hnv1ht7Bk64QdVvBppFF8NyZdOP9D7HtJS5MOU9tVUhvCU8Gm80Hdu01wlLGou1bSX6C1zb1OOEKNyPeTDu3YG+2kqnn19iDnGAnVuWw7DZXDlCJoVrmFwDu6+lpulGKStNiTvHDZtjygB4F0= 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 Subject: [PATCH 08/25] tcm_loop: Convert to new submission API Date: Sat, 27 Feb 2021 10:59:49 -0600 Message-Id: <20210227170006.5077-9-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:21 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 296c87d6-6e28-4dea-4b29-08d8db412ba5 X-MS-TrafficTypeDiagnostic: DM6PR10MB3499: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5516; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TCgI0Lj5fllRNGVy3J/p+f6EO8IjR2CoWbOd1TAxpHKirsuLuCkAjAbsq+FO5POWouy86Fnz/XZIppuYjNih4gVpApdwlzBLmlnPTcTblPKgF9vF4q42Uow2b1FtE6I84ax0u2dj/l9JJX3mqtSIAqGgozD1SFOImzOtWtCclZ++Jcr3mUzSj8wAf7Kp15PT4nbQyrJt/zm/rBH5fof6U9TO99CC81ylRzHqvdFfJsOlulZVHX9SObpcOuRUuv8FTVdhqTsRm/P0q/9CSySm/I1X76bXAePsjO+sNkajwSt8o2eFoEceO2hJGfmZR/jxRMdsUCi8dfjt33IjC2s4i6khPlIOePpdXpZ2Uwg0q2bHdkXXyGpNBlbzhmfAcABCyRO8YOAOCccV7PAlXji28Nko7lorr48Ip8vTp7Y5c2KZUwDFTrV0REs+0CHAPdexu7qLc/OSWpm6VpUeQtr72elQJu1maVlp7P/+3jmWUFEI/J9zf5Eh3xz2Ab1GbgpEXQmniUkbJdH4FFRg4a4DGKjNX3rAiArcPGvJJDRRgB1X3INJhLRKhfovKBOtKoDmjD7Cg0oqoldA71Wd3fW3iw== 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: OMtY3mNfT4qR3OjkYW4AZew1IRnOWaU98RK04mcJAwATEYmPTGyPH1ASMbpb7GoV6vN8VdOHiT8Yatk+R7gxdjBYitkKOAmB7tHaKpvFgJR+G6fzOWZzRyYSJjX/iJRNhaR4KkjuAsmgIspHdD4Wohby9fkgOHrc9hbec3sxYYe75335Lw82jhJi8X8kTPt8YvS9U7N15Ll6o3Asew78f0rrAwBzBgh3y6VM/Es7Peep0c9Dxl3+S/cIuC8Jfwar5Dm2T43f79GV7Xip9EcRDJ5ouZLafqfBp5t9ZwpyI2C6q+GVfoHOkeGQYpBPgv1vl0Zhc+xUrlAzt9CCMR0g/+0kguuAPZGxo28ihXmtpTLSbCts58IsMz4JnY6n7mvlls0uGjX04eDQVuE/JeR+4ypLY6yJY7hw/9cgVlA088ubBmDCPl5Cuz6H5JtgJNbS9IZjikKUue4tXmg8pKlKZ60lOYYZcvZiREdWQMEFv18htLnYoGVivM2zKMxMfXebA4GWe/JpWYuH4dFS9tjBD615fpPM/XPDnePitrEj9eN48O8JWNKfhrPmhTCg3v0/7un5WhFfOOIwlxaBt1rGVKk1fkWsYhej+WayNMYVRNAcQwc4oZgYdPDhQ1LiYpOZtvEkhoCZF/ir5DIstCGw5VVMkcSnYHoMNVb3+t6prYd4duZIjP29HiW10Jx90NNOMP9eO1ch7AmZtXV0mTd52MASNXRo/LyJiGE6fC7Y0AL53xKDydvxRjNjMMwuDOev/87sQWejsH4bxNGElaeszjkK6FgK4QP7npm11rQnufrPBJaqxaaMbiMAkCihZP5TzgCMf7l1D6qMdmv/ZyNbSDRVjq8lsT1mily81bmgFCZ0MaQMgKXSX6nc1ZLQLZunxypzVBVtY6x4RFWxcWby91m7QMpFqMd8Bhu3hByMV2iSiPSac55+AzZyJd5UJnMIhVwFQajDduzr/daJpxVtekS4WjxC2BSsgmdZ45F1EQn9w/2pbAWu0U3wYNMrTiBNFLmbMJ3lNxmf+sWiT9S2+JzUusHcZG2zuQ0kpChsSAvWQBpHr3Kt2Ui9E68j+2/cMupWXlqEYjOEHRiYlWCt3Sc2jUYFdwbhNYFDhBD0uHwtYb3b+BUFOTUG9CIIT7dEj6x+sQyfC/gbsxT9TXVchV2YkqwGZolq/gGOgG09X9sITvcPOp95jgTKrCREU/zU/exOLqi1GbMZ9TPlcJhgSccuvfgr3ZZpwpykgFwrzNntCc1/GUXvLfsluklCR2UCBcM73JM5jKyH2BSXr5maLy0OBF/pmN/03uk1m6RwAr8Vrpkq/CaJ/RhX9DyVaG6V X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 296c87d6-6e28-4dea-4b29-08d8db412ba5 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:22.6484 (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: f1ZPydIdsOYgDFlMGKoOYVR+heVFg4rsb8JfsTOKzD/O2V/JUVwiSplkiPvUMJE8sZrQRyEU2w+1QdCnza4Pxjyi8WjBakElvS8nIY0bsHk= 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: target-devel@vger.kernel.org target_submit_cmd_map_sgls is being removed, so convert loop to the new submission API. Even though loop does its own shutdown sync, this has loop use target_init_cmd/target_submit_prep/target_submit since it needed to map sgls and in the next patches it will use the API to use LIO's workqueue. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig Tested-by: Laurence Oberman --- drivers/target/loopback/tcm_loop.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/drivers/target/loopback/tcm_loop.c b/drivers/target/loopback/tcm_loop.c index badba437e5f9..461f4125fcab 100644 --- a/drivers/target/loopback/tcm_loop.c +++ b/drivers/target/loopback/tcm_loop.c @@ -113,7 +113,6 @@ static void tcm_loop_submission_work(struct work_struct *work) struct tcm_loop_tpg *tl_tpg; struct scatterlist *sgl_bidi = NULL; u32 sgl_bidi_count = 0, transfer_length; - int rc; tl_hba = *(struct tcm_loop_hba **)shost_priv(sc->device->host); tl_tpg = &tl_hba->tl_hba_tpgs[sc->device->id]; @@ -151,17 +150,16 @@ static void tcm_loop_submission_work(struct work_struct *work) } se_cmd->tag = tl_cmd->sc_cmd_tag; - rc = target_submit_cmd_map_sgls(se_cmd, tl_nexus->se_sess, sc->cmnd, - &tl_cmd->tl_sense_buf[0], tl_cmd->sc->device->lun, - transfer_length, TCM_SIMPLE_TAG, - sc->sc_data_direction, 0, - scsi_sglist(sc), scsi_sg_count(sc), - sgl_bidi, sgl_bidi_count, - scsi_prot_sglist(sc), scsi_prot_sg_count(sc)); - if (rc < 0) { - set_host_byte(sc, DID_NO_CONNECT); - goto out_done; - } + target_init_cmd(se_cmd, tl_nexus->se_sess, &tl_cmd->tl_sense_buf[0], + tl_cmd->sc->device->lun, transfer_length, + TCM_SIMPLE_TAG, sc->sc_data_direction, 0); + + 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))) + return; + + target_submit(se_cmd); return; out_done: 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: 12107793 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=ham 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 34DB6C433DB 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 EF0DA64E83 for ; Sat, 27 Feb 2021 17:09:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230210AbhB0RIh (ORCPT ); Sat, 27 Feb 2021 12:08:37 -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: target-devel@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:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 12107779 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=ham 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 12F15C433E0 for ; Sat, 27 Feb 2021 17:07:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D62ED64E84 for ; Sat, 27 Feb 2021 17:07:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230240AbhB0RGQ (ORCPT ); Sat, 27 Feb 2021 12:06:16 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:59270 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230211AbhB0RCH (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 11RH0QV5005424; 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=07JY3KzmlsA2PeJId/YZiQz2bizROuYKAmend1Uxe0g=; b=uGLDOQVnbrLKAHJ/+PQUh8E6wjf2AzlgQ9NA9f16KQ0J7E3QtpPuvZn7SN7TmLSr9gaZ iRvXhmYyMxDSvAoQdqkF2c9SFOCja1skPFeqBkkvKraqFATPafuWj+Nq+oJjlfPsTrwT 8UYmvj0pzZ55ZcR1Cqy3BluQ4qMJyeQSiq0ho7UxghE0vW0Xoet26AETT2+hukcd3zZd bc2fLPYBOfkD96pRx90B5iwFnmZbXpRWxZ2jrV3kac2mnbJPora6Hdh/xfmbH+K1hN0Q I38go9bPQqkuQbV6QbdquWLJ0JU//TxoVBuAdrR6sz/KU2PfF88ZYxrReWitjLx4M12r EA== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by aserp2120.oracle.com with ESMTP id 36ye1m0qp8-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 11RGslmg115709; 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-11 (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=mNYZ3Y+N7vKUUMWLo6RPXde0PH9WL9YBI15KHCM60gyxCFA9zh3zwnBx9+7mQ4hp5TL5RSiiNQksTu/f5/+WmLCMZ0aBoskIggmAdYrBK6cha1CBeljbTxte7xEzXCghaCi7czAGF9m6hrduLwXS0VIZh75AL4TTc4909nuyyHOzJwCAi1cT04Q19zB9fM/TDKlmjEPRcg4Dpmf8SSfrH+GpLh1kmgEAY6+igFKZyCXSRNO4Fm2EWSyF6Wc186tDu+yqFE2iG76FYQPmJ6d1QUA/fM9U79FkM7rikTn8EBXGRzBIsVmm1CHQT81kly3GzOUUdGYNzen+o00AhVdo5Q== 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=07JY3KzmlsA2PeJId/YZiQz2bizROuYKAmend1Uxe0g=; b=CkTAH5sFmG1BLhjPImlN25O2Uzg5qL6ulfu+Jc2XcZmkhqexd3YDjSMW/7LKMnQoNDlcoBm75hEK4IOjAjiwP4IMCG9otCEeneLbdIA7hhUrkrYIf9utllQ1YFRgn+rtoinvRVXHn7CiHF4drBSQ93NPeFzuR4e/BMAquvlYneRbVnRiDio8bunqazbmeTjzrz2HTZi1kfJPRXyBI6LPDRi2tBMn5PnsWvPucBo3IulzV43Vr9ANCz2mXBMi0toM7TAiXbRytSYqr++IytaITJf/eenkaWRuvhCPdk8agV6GO6zzUPOLAHWDutRonarT8jCjWIs5uCAFiVVBAjyNLg== 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=07JY3KzmlsA2PeJId/YZiQz2bizROuYKAmend1Uxe0g=; b=k6qpttGAPf35uMjSRrNU51AW50ckA+YVlfJcpmqdg2tyXgG4iLmWjKGzFKXsZ9hmJNTC2tGQe/L4mZla7igFyjWXL0P1qdUMDFfc0bz8i1toAKp4PxW+iHrYeMdxD4EqJDC6pxUF3/NiVtZy08E5zMS+H2WI1FrPV7cOBBkcg18= 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:24 +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:24 +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 , Felipe Balbi Subject: [PATCH 10/25] usb gadget: Convert to new submission API Date: Sat, 27 Feb 2021 10:59:51 -0600 Message-Id: <20210227170006.5077-11-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:23 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 81df6ec2-c2fd-4dad-b175-08d8db412cba 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: N4v2iqDjHn5pxJREBk+AJlorynjxKokRZ1ErmU1luKvsETIGq6kqpOAJ2qC8ysVjPLU+hopoWg2UzHQWGulPKAiMJFta+J5ZRdib5rlooGNy12h8ZYMQertVWfXkY35rBVYKfkgL9DWXk73VfCky4za/JkblePkhBMuLZFlAIfQI9JmuxLmJuCw6wM1j8M62MpF8hJgnWaMs6I07vKjYw9NMg/iMq6p4JHOV7B9ShRYTLNNveEo5ErfNBCTus5B6bFwNos2c+a53f3THMOy4FpTIWECRs76+PH0k+N1PBSWf4VM1weds9cHbIXiQXsoW0mselZ2xVCdFP4rxxb5bsr1URHGm3Wvw6YBrApAwPBFabFa/bAw/khYoAlf1tgkVRqlQ8H6cH5l9n4Tzv6/6hViDh84PnE56TuFl/plNBM2Kq3axOt/SL1uUYyAwxf2b/3P0LnQlu0sSAP3NlXq30rnzUF/4ba7WDtVcCXIRljBTpV0tU+VWpfSwgnC4ipXhzFKHDwPwkcQtbD/OebILTF/815jRA9e6FfNt0iAopdtq+Y2Coupb7DEa+lknmbRgrOX2986s9k7dG9BaC4KOWA== 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: yB+kmK9y2YVV+pI7tpNI+6XCetQviTZCsFg4KqzJ3dNudnTqVj2aIGMZ0L1AFzfvhxjUIvtkXGSsdFe+4BVSIvgVGptf/kMjpnu0iTuZ8L8jtxj1sr0gC5Gl4HlxvOS+aRuk2/OeuBwaSceyWqaMjyM88h5Hp/+KFbsF12hmvh4oz+e5ssVoZacKDhiRwC1zL/TzJn/E//N/cHqLX/j/aKcuibXrV0dcD4Qa/vOCAqC0BucrvSbKe3WzwPEl36u8C5Jy/i9t5DK3+6PrNo8Wm0ei0Oygz6zYRz3RvLi4N3svh0qnxdDpJJgc98tBi6xLghCBahw5gXKj00z/h7E0kXevIRve28yyDiZ5eYSacbOLTXtx4BAsMw9cL02QmnbOfbnLjYKK4f00n3/Kk9B8cwnocAGl5Vbxql2RB5BeFpjjMM0Xhofmre4bHzdtjdt2iRxOEiT4/+xKOwExQHwWIWOZq/DRhLebSJC7nBsLuhltPwThwCuVFiW1n9YAHzJh74ow5lgC3Gsaac80Lee+blrKky7YRY5DrK/JnSExW6kd163TA/s4P3iB9Mr5fX8dL3z/B1wCfJhpObF4xAJGeplYORGgqcV0IwZRs+xFQ/6Ogm01SbSMd2U12STDCIcM8P/ORBKMo/m7mJOZMtgowJbZBRMgQT65bBw4Y+xAx1gE+AErO987CVNBO3oOQPBR8HAeHIZeHSq+IhLXfI16I038o8WgUr6evLvN7rNMaknW2qepGNE35VaqfhBsnOAqgIrdtzatrKRzGYbuOy4um8QPVwV2weyA/zNmO72xjlH3m54cd9IspvuMBG9R/dKGC1E5OsbwUmsYFhGSm5xLBQy5C2vFwsbd91ttzMt7Ilh7sSYOdNgixzLE3A/O/ZeK6ph9jD19+P8GLUUBHRqiXGZ0YsEF2CR1v1dEjQ5VLgs7gjmxrgw5WdPsD3/1zIJzrLQ/fapsph5meBM/Xl/983IQbn9y2L/hT1/Z5RN0rmQS1TfB/3veXqlnmjZC2hikB5TPWFN//5CgLgZ+zzgh/hEA8kVewRHZ1liTufMAuGQ8vkx5l3AVn+uKTpubG8ZAuelbO2e1B/sS5S0Tv+Qi/1+/e/z4R36MUQ6+uwcVevA7KX6yVv0rP0nvx96kOONblaRhY+PJh7skVZua0D+8BVaqoxsltS5SdlryVkPYO5+mTolt2Zts9xeQ28tn/FLlch3Tzs5WRthjVNU6zSr7h6hEXtBkqdxL5JrMyox9SoQrjpa6R2Xn50083lF7bjHV5tfsl3KBWv4XtabWLE8Hl02JwOmYwdTBt4JibYt8Lo5/Mdv2hgrsntaMXoChbE12 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 81df6ec2-c2fd-4dad-b175-08d8db412cba 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:24.4803 (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: knIkyA9BgnAQ6Dv7/H4mAtdS/hrNRdQNwntVZcGp7SOrlOCsC+Tn0b/kcTdCiU92PN02Xf5UP8KoI2V7t/vz7cEf1YdmhnaNlo5dMs/ZPLU= 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 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: target-devel@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. Note: Before these patches target_submit_cmd would never return an error for usb since it does not use target_stop_session. If it did then we would have hit a refcount error here: transport_send_check_condition_and_sense(se_cmd, TCM_UNSUPPORTED_SCSI_OPCODE, 1); transport_generic_free_cmd(&cmd->se_cmd, 0); transport_send_check_condition_and_sense calls queue_status and the driver can sometimes do transport_generic_free_cmd from there via uasp_status_data_cmpl. In that case, the above transport_generic_free_cmd would then hit a refcount error. So that other use of the above error path in the driver is also probably wrong, but someone with the hardware needs to fix that. Cc: Felipe Balbi Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig --- drivers/usb/gadget/function/f_tcm.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/drivers/usb/gadget/function/f_tcm.c b/drivers/usb/gadget/function/f_tcm.c index dcce6e2605f5..7acb507946e6 100644 --- a/drivers/usb/gadget/function/f_tcm.c +++ b/drivers/usb/gadget/function/f_tcm.c @@ -1058,11 +1058,9 @@ static void usbg_cmd_work(struct work_struct *work) goto out; } - if (target_submit_cmd(se_cmd, tv_nexus->tvn_se_sess, cmd->cmd_buf, - cmd->sense_iu.sense, cmd->unpacked_lun, 0, - cmd->prio_attr, dir, flags) < 0) - goto out; - + target_submit_cmd(se_cmd, tv_nexus->tvn_se_sess, cmd->cmd_buf, + cmd->sense_iu.sense, cmd->unpacked_lun, 0, + cmd->prio_attr, dir, flags); return; out: @@ -1189,11 +1187,9 @@ static void bot_cmd_work(struct work_struct *work) goto out; } - if (target_submit_cmd(se_cmd, tv_nexus->tvn_se_sess, - cmd->cmd_buf, cmd->sense_iu.sense, cmd->unpacked_lun, - cmd->data_len, cmd->prio_attr, dir, 0) < 0) - goto out; - + target_submit_cmd(se_cmd, tv_nexus->tvn_se_sess, + cmd->cmd_buf, cmd->sense_iu.sense, cmd->unpacked_lun, + cmd->data_len, cmd->prio_attr, dir, 0); return; out: 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: 12107811 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=ham 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 0E62BC4332B for ; Sat, 27 Feb 2021 17:11:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E19CF64E85 for ; Sat, 27 Feb 2021 17:11:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230361AbhB0RKk (ORCPT ); Sat, 27 Feb 2021 12:10:40 -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: target-devel@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: 12107787 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=ham 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 5334FC43381 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 2F0A264E83 for ; Sat, 27 Feb 2021 17:08:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230209AbhB0RHd (ORCPT ); Sat, 27 Feb 2021 12:07:33 -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: target-devel@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:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 12107765 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=ham 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 B1992C433DB 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 7235E64E83 for ; Sat, 27 Feb 2021 17:05:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230314AbhB0RFU (ORCPT ); Sat, 27 Feb 2021 12:05:20 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:51256 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230220AbhB0RCH (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 11RH0Gwl079327; 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=1frQuRMui0cZxPjQIOFd5O6A6GKjiwmO7Nx2OJyie0k=; b=B2nxDLf4CzMT4tU98TDuv07IKxxR9MHGiaD8E1CtesMogKVvbPkmWg900xffExrZVQCP 5Al5J6zA5MuaOvHdETVM9fnklMtHO62G+RCAuYB4fjXqjaRyfjg4+Vz8P7fFvPDtpG+P uJ1mgMJsfLsZ3wARgYL2zJJkGhmAGpaU8z+fitDGv2yHzhhd6hp+//9kTeCfTYA19b2R RC92D+zk2mTmY1h492zIQucx01lKaX8akhOiDvPSSIH21tC8V362yPJZXNu1oTEskzPW LG5pik5pWz5e6WsFQpatoSqLgZU9GpkzojolfwBvyEa/ZNsSOpWmOw3LiqxCsqi3cHMJ zw== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2130.oracle.com with ESMTP id 36ydgr0rs5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 27 Feb 2021 17:00:29 +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 11RGsmD7041731; Sat, 27 Feb 2021 17:00:29 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-2 (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=m9liO+wqjs+VVxob8e2RZItgS5dCWMz6bCZhLeCDqs2FlDFiwIxHZ9p9sHZm321tftFR8QhKnAt0MXj76E/tmYOrgEKIiCyoN9E7bRv+V//uMJDcidHW4jkOD16Tp/6iCBwzs5ltwutS4T8lTy+87c1Be6WNdmD+qNShHPzmz0OUS9DeOMVL4tMvXye/QUhe9vWmHwqTR+9UcGU+M2a9KUz2xXR4h7Z8ak2TgZS3VOVthW54PooxQzoy5S9lWT2Jvs8BVULSerh1pkgdXZAgCNCKVAnSOIDA4ZVlDtqTtZ4fiTyqIb//yKZQ1KVK8XcqrvHKrZKiHmppE2LUwFADHQ== 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=1frQuRMui0cZxPjQIOFd5O6A6GKjiwmO7Nx2OJyie0k=; b=P/T/ST2s/U50LIbsbxTf0jIdA8BZnxHJuWyjjnzs+tgQONdYVrOHScg6dmGnEL8rv4TdTlUEQud9YGaZMDH0zbqiYBnix3l1COjv1Fwsgzzlxb8wIPSxZD31Cr/Qr4wkHWS1aav6D63SmTfMhSF47K2KV2v9DgsDcQfbRd5p4E5ZjfH55JZO4s3Vl/Ukkic+jrI9gwI4IYfjqnFdoL71jzEgnPm2DbcUsNGrnXgrfRLrfyRH8PlC4fq/vpX6V3VOIRiq1OrxcU0H6OjhQ821AGgH3FIpdAOH70Xpjzbh9aBCPjhboLfSI2Yqn0JVUl5LlHldtIr+o9ue9DagE26vMA== 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=1frQuRMui0cZxPjQIOFd5O6A6GKjiwmO7Nx2OJyie0k=; b=O/gGg7AJ5WDbDDojtMFrpKRXo7GhV4qSPU+nHM+mNwFDfPBP3ID2Y5nQW/fyZZ4ETIlJ2YBA7CcsF6ikTGfN/8M2039HuOaneGt+kb/cnzwoFMon6/SBAcJaYjVYLEmYqU7xMvGAfAgQz4jnfWjkkS8m0DqiC7cG8yoSIj9fpiU= 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 13/25] tcm_fc: Convert to new submission API Date: Sat, 27 Feb 2021 10:59:54 -0600 Message-Id: <20210227170006.5077-14-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:26 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f5f3d5ce-3bbd-48d0-29f0-08d8db412e42 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: TiF8ph5/lN3dEzz9oZpCiehJNBKViu52xQlbhP1Qh2eG1tVGolsmOiWXQxRopUSwuRcpve2JCYsmumSzrBH9YS0bBEBOx82mMvXQJ8qdCgQ98pX2TrhusMd4hkdwy/nnlL9qxRsbLnQdMQExjXL7I86JivY1YCM8uG+LobyPpYRbWsGLWF4Zgow+BrEDgo93MoeFQ4Q5BCEWBX8llRjxyXxRQoFIQ/KozwnJjsRzA1e1pXfD9te/lPwHTG8cJHDv5jIDOXbl74qTAvp//UlEo/FYMkIdwA6K6bGbv+O+nOD+wQf2SrdyZ8veVuMvGeLtkl8ENZrkbXpC8eO6KclH9HVvNcVjRDGDvOJ8P+9fWRxXJsBe6syITmnwAhPQ9elwtWTP1b/Lx/EyDcKszcv7JqAvrjg7nUxrEIHzefcVzYvGs9nMOFNETvyU/3agMLEh8IwFG//nzXrrDwBZnuz0MjVhqmsr+sCq7IlFLulUqY7wjX7hQa65XBFcDSBzjklQq8O+ZD1shiQ9lTZjsNqmW97qIVXIrfBSgH5i+EtiO8VJD2rUMtovHpKRfrcM+RJAHffjv1HYUmICAJC9YMAd7Q== 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: oX4DTfjSvvJVi0hJCa9EQpmI3OU1UGcetNQTxfPm3Lv2X3NweDkTgqtSZM2WM5gCIaK7F+7IJNyRL8LRYXNqIMLAYUHrUYggZjgYyhYfTFsnAgqg1PzhmgUTb3O4Ao54FqjoTXfzd62sl++uaFA2tBbwKJaKQeYMlFQM3hf0UJBe2HW6C/xyXCzcVF8Q/nL1B0wYpiFyfJZE1mFZ7H0qw0+yVKHUdYkryuzpfJgNa5Zsf9H9a2+U+FSojWZQjWfcmMZ3HZStqQmHBJT0dKs3Z6IgE+sIaS66DKhEevu1T6qbLgWHQehgU4CeBPbpDlOUe7dbHBydFmdPVr0iiwRAfD7HhTM31LGXJAiElDYmNOMPJ/SoU6Rpk8xBNXFnJD89MY9Szmq/SDZM0Am188DZIq+B8+uOCDxnRLe4IjH0V9wo0m2iZuvFvsyaKoOr2rTacs+1e3wr1ZFpldIwjjTB7zOhPc/7phm6Bm0FgctDXDr+hgf0lXndLbkPgWU5xo1yAtsEjGZ7EnR+FYz2H0Hr1Qcl9GOLYQc1z2C4W8MIUsPJWsfdUrVrIjKQC9rYlinqVPMdbbuS5TV+r20L6ZR2smF1BXXdL6a7cal0RcDkGTK54ZUlzHnE32FN2MwxlPo7Ztli108vVEZEObldYuUFCahag/bS7YcW0XFoawamBr4TRzoHgZ0j8IyzRWksM9c5MV0zZMZGeM/ukoDinqtrdFgBbrehCV4MISDiJ+o4r+OglMLn1J9U+m6csFY7MTT2Z8tc3OYfHCH5wv5CamtuzoAx5RhelFd6SZNPEiCkVz4unsCac9GwopSp9UOEod6oloQMnhG9mYo5WNcL3MzMVODDupdKzUARjEVSL1+E/55Mikqp+hcZ6G+AEkgjwN+mDfrJiT4FC/wbIB66hqe2MWRUA31oDDH1F4A942KPwWO2roCFcS8b7+XC26bIPzts8uK9AfADzRwGdetaSL9LDLTSdcpEzzIOF3NdjKhJyTZxcOqYqTC5LaZ/viVnXc6ZQmaQEqNJs7DLdUuu6JMh1eubPKSZZNK4ZSqoVxm85V9I1Y/aMTvDI3eTGyFVckdO69f08ZAUnuM74mz4+PtgirIA4y8IE1AY+rZkaExGIsVy6a1vObQ0oj14mYD0Y8HZZUUUtk7lygxMrzi2Lnkeol+7mDndjLTh7mKjog+3/ZYppdbNrpTsPZjQIVS6H/UsvM8aMMxs1ntyj5W/IEaEDVlSgSlEgb91UVdvVxBgvORCd+MdbWVTtBR4gvRwe7jvgOiQGAMOuGvmU/yKle2UyzxX1Gj2Q4txQJnUuFQFui8IDu0gBv+38KYMg3/eymUE X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: f5f3d5ce-3bbd-48d0-29f0-08d8db412e42 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.0289 (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: NSDZlWDo23+9qGi0R4419MxVPUzRLQ2U/8ZDlzb5LaA5LUx2gokXqwvH0Ktwbr1liE5MQ0KjGiC3DOtYq+gXEtRklJ37dfzvWoW+e2FFbU4= 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: target-devel@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_fc 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 now detect the target_stop_session call and return an error. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig --- drivers/target/tcm_fc/tfc_cmd.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/target/tcm_fc/tfc_cmd.c b/drivers/target/tcm_fc/tfc_cmd.c index 768f250680d9..1376501ee3d0 100644 --- a/drivers/target/tcm_fc/tfc_cmd.c +++ b/drivers/target/tcm_fc/tfc_cmd.c @@ -543,16 +543,22 @@ static void ft_send_work(struct work_struct *work) fc_seq_set_resp(cmd->seq, ft_recv_seq, cmd); cmd->se_cmd.tag = fc_seq_exch(cmd->seq)->rxid; + /* * Use a single se_cmd->cmd_kref as we expect to release se_cmd * directly from ft_check_stop_free callback in response path. */ - if (target_submit_cmd(&cmd->se_cmd, cmd->sess->se_sess, fcp->fc_cdb, - &cmd->ft_sense_buffer[0], scsilun_to_int(&fcp->fc_lun), - ntohl(fcp->fc_dl), task_attr, data_dir, - TARGET_SCF_ACK_KREF)) + if (target_init_cmd(&cmd->se_cmd, cmd->sess->se_sess, + &cmd->ft_sense_buffer[0], + scsilun_to_int(&fcp->fc_lun), ntohl(fcp->fc_dl), + task_attr, data_dir, TARGET_SCF_ACK_KREF)) goto err; + if (target_submit_prep(&cmd->se_cmd, fcp->fc_cdb, NULL, 0, NULL, 0, + NULL, 0)) + return; + + target_submit(&cmd->se_cmd); pr_debug("r_ctl %x target_submit_cmd %p\n", fh->fh_r_ctl, cmd); return; 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: 12107805 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=ham 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 9F4AAC433E0 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 6E21161606 for ; Sat, 27 Feb 2021 17:11:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230350AbhB0RJd (ORCPT ); Sat, 27 Feb 2021 12:09:33 -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: target-devel@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: 12107813 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=ham 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 16833C4332E for ; Sat, 27 Feb 2021 17:11:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 01F2461606 for ; Sat, 27 Feb 2021 17:11:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230163AbhB0RKn (ORCPT ); Sat, 27 Feb 2021 12:10:43 -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: target-devel@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:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 12107809 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=ham 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 E6AD8C43381 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 B866661606 for ; Sat, 27 Feb 2021 17:11:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230348AbhB0RKh (ORCPT ); Sat, 27 Feb 2021 12:10:37 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:47962 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230260AbhB0REI (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 11RGx6Qt032888; 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=xU71cbsajd6EAjkDm/SEEusOTxGkcuJ4ufAFW1Y2p1I=; b=FbsCZO6BWGR58p28Q2MdGy29bNvu06qhFINlBbknStjAy6MTv2jyy4iYfgaEUL7BKf4L +HMP47I36mK9Z6oUrX/usIxQqjGY1hX10yyimx/V/5CJ7bITSesQoEa7+7rVzMIFfTNy M4NO2KdVqB5IzLz6oXaUPXg3L2zqgxS+TtOMECB+mQ9Db0jPxFxRS26XcXfhLpQ2w7dw KcBpjydDhl+rjzFiCSCOySIOrFJT1HajSnPBcxOe1DfWZCePZv0ulyStqO5ddg3Thirj iudWIfGFM+WsmyC2JBfm90xL4Q1O9kJ/lcbCuboUKD8CvTCrpNNgUGbATKsLa4QrhzUW dA== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by aserp2130.oracle.com with ESMTP id 36ybkb0v4b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 27 Feb 2021 17:00:32 +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 11RGsmDB041731; 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-5 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 27 Feb 2021 17:00:31 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=G4QAQCI++bq99OOLcTlN20x4XJnwtKI2UndD0GRipB4zm5YibMtcpC3i6IcI45R9ijNH32P3chZiYirgB7PGDlsYn0l1P3HO6+TWkNkDMQBnc3pdiEK/gpWuWDpM4i9O8E3Bkz5Xs1x7/lIPTyRhQNPQB2KRTUe3kZ8kAsyjtqvs0x4F9uJuXgoNx0UHei7vT8TMGLNFrhb+E5CPJDKQH2/5bdvLg6Ksboi+Q8I/J/qrtljqv+obNH7TcrdbmkHtGs10ba/JejkkOHRnDrsjha8HV3d7FClBSynhksOgdpUH+emOEbNJNxIUDoyTVT21BhbtK/Uvr3kq9jx8MryIdw== 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=xU71cbsajd6EAjkDm/SEEusOTxGkcuJ4ufAFW1Y2p1I=; b=a3e9ZNSB0UcyHfRyYm1AnJQTZA2zMoaEJzEhOMRcPTgizm6QWk+KHbWqon62JjC7FYdOwoU+cNmOq8XIHw0wxCxKPYNFWqefEvB/VO3E4cCUTZH8s5Z1zqv/ZEwWXj4TeZJmGbymU+phWeInQ5K/rmvhqO24BdLa4OH+oCDn68P6wMVYWgtqQcRGAL2SCu1pVlM/6WpiRICb7z1hgt0PRhA4FHIApPKBUkluV51tQxFU8nNcHmR7MufR6cs0JzilJVLz/ucWcub1i14oGr9B1EePzvkrLkYX0AQ10ASiZCEq5NsBR5qNlMmNlfWoV/2djdWP5bvpUs/4gu3kdvWrpA== 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=xU71cbsajd6EAjkDm/SEEusOTxGkcuJ4ufAFW1Y2p1I=; b=aqeHcjqJlXNHJSvJKEbPowSo79bXZdonopcOFQ7GkeuV9GrSO+a6ziJTZEZSJ1giC9XeUF+nIx80qJnjkIAp5AyVSe/9LonUT79j6xpW5lKLq7McmNw2EoNqOwYoT+D5KU8po5aZZIgbv/GhwputZKnMQnVue8DmiG/t3w5TrZY= 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:29 +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:29 +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 16/25] target: add workqueue based cmd submission Date: Sat, 27 Feb 2021 10:59:57 -0600 Message-Id: <20210227170006.5077-17-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: c636e0de-8b66-4882-0e98-08d8db412fce X-MS-TrafficTypeDiagnostic: DM6PR10MB3499: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5516; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: SCDs1AsF3wjdxphN5nZn8qmXe5/qk5Ee5NRW56f8uaHO7PD8mzV7MBEhH8rj30RoYIi5/erX+P0xfU9QTGgIk9EqAVCy0jWUMkEIt2pJaJKVr058YUGQp7YMDvVa0DAp1XLFM/O2TgEZzckM+pNT7ZgtMDez3iNFygmyBeVqNs+RuQ/r1Ik+GAFD3gLUcJ9ekdDh2ryvw2ajhzXoq39ys9yvseICPEav3tcpTYnfWreWaK7xqc1NF1uhyYlenyMNige6Ae2MOZzXxXMIGPnX+h9XLFcbD5gULZyPeCyAdGfZTbo627tpp7kwB5M8PyObcZl9EOcAjtOi1Fmef80tL5EPp3XPqVsp9qA9Ch8qcWNWNMw8VSd+uxKW8Z1jbk+y5lJmKetudLCmu0tLAL47U1XWTn477uC+Zr17Rfl91vbGfkAiGRRBuForNmAe64EHRC3lMao9wnUUesHWDMmrvbt5mrhkvUe9/d1wFcbpHZpiP4dp2G0WjMKRxH2oGba7Md3Uri1MIC86sxhFngvlnWgEipzguNvimQX9s8Jq3+bo2Vozxq/u4k5cFyAKl7qO3d8KZmE3QO8ttBNXOoySqw== 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: 2GM3n+jwXEgc4IglpbhiPGzFqhM7BZyjfyZxnj/6OXHLxnT/0S35zQZQXFmUGchaq+dUiAEMgiXajBGww+PX0yOwkMUckwFWv7Blqx1Y1gyA7tNuF1k6+gzm68nfAWQLHTbrvfFPdxQNgFa8lu3W1VYdPPMkgCEIdZ8LoKr4muSoDEKR4Ogy7MTfwAx4WvU9iwJB3o5xvPHRQ3GHKxujPu5J6yk2XssmihpgYzS+Uq9mhpRRr8JC5GHMIlVa1CTybQuea8gBbPH0TRQ6UEupGil5nswCZyQ5NabzoYh/JfA4OInCMrAYYmrIwedjBAVlpK9oM1fy5sOYPMxaNBgrxVd66lD74lZSaKd5PJWSTNLLBlYf3A3qKl3g/gFjJz/D3mWZ+0iwFGSTdR6G4E5OBP1w2nLLO86d2wA6vhePSvTkoHQtZX/4vu/9B3qmZ1voz8vSz+vbRsQGWYs2hbDdOjdQ+6d5W6HEEoiOE4vcaIRW44eTHPE1nM7vp5svjo9R+ITD0YfwCe/MClCbzYjinY4+f4bQ2/i+1iWBk9Ivg3N567sXcevtdxRKw+u/rLIzJcEcpxrCI4Ux/PGPQ45Pr2a9AOVuuby0xoO+3Ix5YHVfzYXaLUIOqcMxJv9LjU2dNZWo3zCx4ktRx6EA2rGYkRm2+qfuB953Aghm/WLuIFixlPbXd44lELwf27nz/zkr74YFo9+SOo1CnOanmVU8OBeYshM+aYUVJBfoPg6FgkQ15zNkmf/1lGmefxo2LUpjwi4/MKAhKcdZwowCT6QuaBAGhSEoEp2f8hl1NShsOPMgLEISbPehfiM80wCLAfdEuRr9yXFDNaQdPTGp9gA9GKv6nG1Dq9CbjhGFO2x3wCsruKbmhCKWBl92CpnXhABB75HitEjZTI6owtgCVfsE54cdeWx8S7w+rGAP7VP1KQgtaKkSF1vvb+PRtTzQjeu2TRDuc1QrPUskp2LN8+YLfEhiPpcKJ5AAoXQW0dSm2DupACAycIE4K4mT/jWjjOSLP8xfwA9f3HNlLhXUMdb/NdcaV2umOSFaRzriH+ZLwWx32MtGMZV9iSiUqbJ5stHiD2BeayIvkWx8utvwGZfHHmxNC1uvz39/uLDVUHNSKSRofaIEPJS8kVAun1R2kb/ixXy2i+qum32wvxb4eAUTwGCpq6wam68W4P0xxscO5VGI5omFT1dSMGcjpuTMFTXPPBHBjTnLwg8sWgyMZDSJH//jKHS2y3qLxuLxGh0tbJLqdifsxCqUpwyOr5o/yn9mkAPoG/U7iLlI+l3KtEOZWrSyAnUmYHWeRYwLCADKYEHwYizTrn8GNkSjK8pSIfl/ X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: c636e0de-8b66-4882-0e98-08d8db412fce 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:29.6284 (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: yJ+ncXoMhVpGMqwHgUTVXhg+y6pQGAvLOnb/Uow9xqXzJ+EYzLKYKRlA8j9OuQ0cMSIB5pnG2uo7k1hRoUBcYgQ5UWnsHsAExgDZPP9l+gk= 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: target-devel@vger.kernel.org loop and vhost-scsi do their target cmd submission from driver workqueues. This allows them to avoid an issue where the backend may block waiting for resources like tags/requests, mem/locks, etc and that ends up blocking their entire submission path and for the case of vhost-scsi both the submission and completion path. This patch adds a helper drivers can use to submit from a lio workqueue. This code will then be extended in the next patches to fix the plugging of backend devices. Note: I'm only converting vhost/loop initially, but the workqueue based submission will work for other drivers and have similar benefits where the main target loops will not end up blocking one some backend resource. I'll port others when I have more time to test as I think we might want to make it configurable for some drivers. Signed-off-by: Mike Christie Reviewed-by: Bodo Stroesser Tested-by: Laurence Oberman --- drivers/target/target_core_device.c | 10 ++++-- drivers/target/target_core_internal.h | 1 + drivers/target/target_core_transport.c | 42 +++++++++++++++++++++++++- include/target/target_core_base.h | 8 ++++- include/target/target_core_fabric.h | 2 ++ 5 files changed, 59 insertions(+), 4 deletions(-) diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c index 7787c527aad3..74d3a4896588 100644 --- a/drivers/target/target_core_device.c +++ b/drivers/target/target_core_device.c @@ -735,8 +735,14 @@ struct se_device *target_alloc_device(struct se_hba *hba, const char *name) dev->queue_cnt = nr_cpu_ids; for (i = 0; i < dev->queue_cnt; i++) { - INIT_LIST_HEAD(&dev->queues[i].state_list); - spin_lock_init(&dev->queues[i].lock); + struct se_device_queue *q; + + q = &dev->queues[i]; + INIT_LIST_HEAD(&q->state_list); + spin_lock_init(&q->lock); + + init_llist_head(&q->sq.cmd_list); + INIT_WORK(&q->sq.work, target_queued_submit_work); } dev->se_hba = hba; diff --git a/drivers/target/target_core_internal.h b/drivers/target/target_core_internal.h index e7b3c6e5d574..56f841fd7f04 100644 --- a/drivers/target/target_core_internal.h +++ b/drivers/target/target_core_internal.h @@ -153,6 +153,7 @@ void target_qf_do_work(struct work_struct *work); bool target_check_wce(struct se_device *dev); bool target_check_fua(struct se_device *dev); void __target_execute_cmd(struct se_cmd *, bool); +void target_queued_submit_work(struct work_struct *work); /* target_core_stat.c */ void target_stat_setup_dev_default_groups(struct se_device *); diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index 6c88ca832da6..dd63f81bd702 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@ -41,6 +41,7 @@ #include static struct workqueue_struct *target_completion_wq; +static struct workqueue_struct *target_submission_wq; static struct kmem_cache *se_sess_cache; struct kmem_cache *se_ua_cache; struct kmem_cache *t10_pr_reg_cache; @@ -129,8 +130,15 @@ int init_se_kmem_caches(void) if (!target_completion_wq) goto out_free_lba_map_mem_cache; + target_submission_wq = alloc_workqueue("target_submission", + WQ_MEM_RECLAIM, 0); + if (!target_submission_wq) + goto out_free_completion_wq; + return 0; +out_free_completion_wq: + destroy_workqueue(target_completion_wq); out_free_lba_map_mem_cache: kmem_cache_destroy(t10_alua_lba_map_mem_cache); out_free_lba_map_cache: @@ -153,6 +161,7 @@ int init_se_kmem_caches(void) void release_se_kmem_caches(void) { + destroy_workqueue(target_submission_wq); destroy_workqueue(target_completion_wq); kmem_cache_destroy(se_sess_cache); kmem_cache_destroy(se_ua_cache); @@ -1380,7 +1389,6 @@ void __target_init_cmd( { INIT_LIST_HEAD(&cmd->se_delayed_node); INIT_LIST_HEAD(&cmd->se_qf_node); - INIT_LIST_HEAD(&cmd->se_cmd_list); INIT_LIST_HEAD(&cmd->state_list); init_completion(&cmd->t_transport_stop_comp); cmd->free_compl = NULL; @@ -1797,6 +1805,38 @@ void target_submit_cmd(struct se_cmd *se_cmd, struct se_session *se_sess, } EXPORT_SYMBOL(target_submit_cmd); +void target_queued_submit_work(struct work_struct *work) +{ + struct se_cmd_queue *sq = container_of(work, struct se_cmd_queue, work); + struct se_cmd *se_cmd, *next_cmd; + struct llist_node *cmd_list; + + cmd_list = llist_del_all(&sq->cmd_list); + if (!cmd_list) + /* Previous call took what we were queued to submit */ + return; + + cmd_list = llist_reverse_order(cmd_list); + llist_for_each_entry_safe(se_cmd, next_cmd, cmd_list, se_cmd_list) + target_submit(se_cmd); +} + +/** + * target_queue_submission - queue the cmd to run on the LIO workqueue + * @se_cmd: command descriptor to submit + */ +void target_queue_submission(struct se_cmd *se_cmd) +{ + struct se_device *se_dev = se_cmd->se_dev; + int cpu = se_cmd->cpuid; + struct se_cmd_queue *sq; + + sq = &se_dev->queues[cpu].sq; + llist_add(&se_cmd->se_cmd_list, &sq->cmd_list); + queue_work_on(cpu, target_submission_wq, &sq->work); +} +EXPORT_SYMBOL_GPL(target_queue_submission); + static void target_complete_tmr_failure(struct work_struct *work) { struct se_cmd *se_cmd = container_of(work, struct se_cmd, work); diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h index 63dd12124139..815de4c97230 100644 --- a/include/target/target_core_base.h +++ b/include/target/target_core_base.h @@ -487,7 +487,7 @@ struct se_cmd { /* Only used for internal passthrough and legacy TCM fabric modules */ struct se_session *se_sess; struct se_tmr_req *se_tmr_req; - struct list_head se_cmd_list; + struct llist_node se_cmd_list; struct completion *free_compl; struct completion *abrt_compl; const struct target_core_fabric_ops *se_tfo; @@ -764,9 +764,15 @@ struct se_dev_stat_grps { struct config_group scsi_lu_group; }; +struct se_cmd_queue { + struct llist_head cmd_list; + struct work_struct work; +}; + struct se_device_queue { struct list_head state_list; spinlock_t lock; + struct se_cmd_queue sq; }; struct se_device { diff --git a/include/target/target_core_fabric.h b/include/target/target_core_fabric.h index 0543ab107723..3c5ade7a04a6 100644 --- a/include/target/target_core_fabric.h +++ b/include/target/target_core_fabric.h @@ -165,6 +165,8 @@ sense_reason_t target_cmd_init_cdb(struct se_cmd *se_cmd, unsigned char *cdb, 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); +void target_queue_submission(struct se_cmd *se_cmd); + int target_submit_tmr(struct se_cmd *se_cmd, struct se_session *se_sess, unsigned char *sense, u64 unpacked_lun, void *fabric_tmr_ptr, unsigned char tm_type, From patchwork Sat Feb 27 16:59:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 12107791 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=ham 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 C61F4C433E0 for ; Sat, 27 Feb 2021 17:09:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8E37064E83 for ; Sat, 27 Feb 2021 17:09:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230211AbhB0RIY (ORCPT ); Sat, 27 Feb 2021 12:08:24 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:49102 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230264AbhB0REG (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 11RGxMMA178300; Sat, 27 Feb 2021 17:00:34 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=itSJG6yjR1UHZhPl78ExO6tKSVBINoJd8hEnckxtsAo=; b=XTvQJBOCUIaUsKyGalG/LQ0inF71AkHDIYPGCFuNMF+VU00j4z+R6Q+j9lZR/0uK9xdW M0QQLvp8IeamdhN4hS28DFabcGhfnSetJfWu44FblmSdYsecpYw68ITyMQ/aUBDu07Zw 52VnMVbiHou9GQ14zgjnbgBOffexcSP/S9qm2B+u/oivVJrJNGoumcCS+Rrz5Gw37gS3 LsrIuuZAmcKJp6VXSs/FfNBbIZ5WHaDYpbzmiS93cHfdhb4Z+LZ5aeBbZh5L/usAURWb HYHMZC8f+1zf+dWc3uQg2ft5bqcyD6cLPl2zcMBwCIng6dcVMTfXD8eHVYyl09vXe6RS MA== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2120.oracle.com with ESMTP id 36yeqmrpta-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 27 Feb 2021 17:00:33 +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 11RH0MBO173116; Sat, 27 Feb 2021 17:00:33 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-1 (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=XN049TZupGvms0XYSEUc+82JHDzEJqCON3Od+IT8gWkNTBKI2bKZeBXijVDbcK11+FQp/TRG9w9HhXJOzsVQD1CkkDjsk/qDd6v/XZqUYAksaIvudN0WIjUBG4SNutHXVbMbs/p4u+kKNGbRZAFOcqyyUd1lKUOoyS96J/snESN2LjyFSYgXqPdUmcSKDx97Tc0sp5+vQogZV4ObFBsNIAYe01j18dhFASA2V1b/woHzo5zCv4bkC8zmKSR4WPuEzHzglFLSD1pTLtLZkPKLbwoKRpML5WaTMGyo4bZOZ+pkfMlHja0MzIUgGXGLBzckXIgZrjAJ0lTWZXc/GdOiRw== 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=itSJG6yjR1UHZhPl78ExO6tKSVBINoJd8hEnckxtsAo=; b=h0Pc+f1No9rY2ZYd+g2YvGFOgrPUcaX3j41hNSsD3myqjH1fds/Gkl8XY5WD0z2yOHgWrWT0+NTa22QNwvVmYF6n7c4g7oug3l/yXyLDMZ2vkB/nK+jsdvvp8C9MqB4UTM5AWybUIEoP+nFzRn5SbJGZk5/r0fGcKZ/fR/X1ANgBmbPKW7SjFJ/2NYPZXOTZ8xGT6PCUnhYvA4I9QAOSH1fUdM3xJV58bHJayde3B5aNJNceFS2QUlkSfzZtvSCIOQ6PuUtZGzcYIBlI9POSZOV6lxctVbDC5F/aii6rXpE/SyLhiZHaH+UMZc56b5unLiKvHG1rAHHivORt5/g9Tg== 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=itSJG6yjR1UHZhPl78ExO6tKSVBINoJd8hEnckxtsAo=; b=ewf8IN31nl2LgtfueOKbG5t2CvCmEGthghjwrwosRgA7YXgeT5J+X1jd0WL2Sq0GaT6+6zPn14Z08cq6KjEQ3IoMf6wl6LN69X47Y1fq30S7fbPFGVAln3KRdujo7wINhBzMeZlEqtQ/I1tMhi0oXnfX9ycB9hXnWRH6SH1CsAM= 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:30 +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:30 +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 17/25] vhost scsi: use lio wq cmd submission helper Date: Sat, 27 Feb 2021 10:59:58 -0600 Message-Id: <20210227170006.5077-18-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:29 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 979a728a-eada-4302-23fb-08d8db413050 X-MS-TrafficTypeDiagnostic: DM6PR10MB3499: 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: OGe0DcZ45wYle6oZNpuOs+1OSkmiQGxqvEVBJ7UVEsZk0zGb04oVY0l3+ZGcOiWr21icT9RLTU3gZrClDt3ujvqIs+Ue+L93KUWePn93fL2/c8q3HSDKBBXJI2sRrHc92Lvg4xTMWRh6ntQ5kuUo0ZpYMv/Hjf/5n6ZjNDXZQZvjUKalC4pLFnHSabz2NuVIsIJt9z0pX8B9rAtESRbRJiJwvJ7l0Usp7HtIwmgDjZEOKNcIYdRHYI5KXmGrppmCskVL2BI9n1oOKXlx/5/mrCtujNxgapTDJFIKEcj1Hcv/eK1lpFMXyIwzi/gZ87BySe3LRCKZMQzWYKOwKKLDLcwUW6LOJISIjQnuS6XTIBANchEYTBkPyYKCrUj8T5OewjO9ZKzx+2UVy/XfYD/ehnB/KJXy3jIglLgMSW8RGlNtFtm6foAXwzAObaBGkvOVwwqW925K4uhZOnMWokYnCFIenYaLE5zQMcoIuBQpTERfzO1EkDyydKX33F7Q7h1G/NNP1rciXXp5+ti0eJNFa5y2ISpnKczTxwcS1u04tVj/4e0gylTpCamNRbGsm/42IIt6YancuLsyrhXQ1z7LWQ== 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: QhqDRXcMQT+u+OX0vnbRUXO+4vpR2c2V4id2mz5JrvU+BWGHn2YoGA26UCcr5iJBmzm3DXjQQSiX0YNjeZB7gJOxu8PlqGGEMEzNgR3hypnPpFsh2I4aPm/RkFkMmzWse5t6mdHhRy0uEs3TGLJV5bUeS3DoCP6E0fBG/1srPcYq/fQ7IvmuZOsjqM9kpU5aPLSuXorird39MYRmeny/QhoZkkfqn7hYHD75gUZbIKVfkbh2LiA+4F5HtEZUi4UQdKmmOIzcJUHM0ncM1/36DP+4XMcgJ7mCtrHVd8PlsZhXXptPCl7wEjZKWcGRUzMgk1CNVU5xuEARZj6tmalf0LD0BxpfkATt3cWdby1iEd2IjKUnvQSx1+qTU/1ajECbwvJQiEvtsFhT4CSYsu0J7tHl7fHFUaWl0blKeINC9wiGGWQHFILv+QEXjZnu01aGAV07X5RFDAjkwtXLgXgh746pCqbE+sKsHkz+yhZ87NZlfogCJ74L2KMwYga6feaixlSoTfLPdP1tTI7YGOdDn9OWtQVeT0orEm3jqPRVbey2SeebxlDkN58eFSM9zh6uoxrhCTUhG3PQFDoDCd2eomTIHhqUU53NLO6RhuEJ54jKPv3C7fTvNSkaQNQCs8BjZ7I79BRFVwSnFmZwhDqMTD7M+dA4j7wGvv12pnvqYtvZanByx6b+Tz9raI3J16kn4ACxCXQvkizJ8r6HoN0SsfN46FmmMSx5Lrn32XNSKz5jWLoSDfylgQifH05DmE1+TcOTZNbOhXL/UzSbazO8PTlPqNRIGYAEIwQOh0Lb3W0hHBvxHL9QEhfaakh30ZvrSFjsW3LuY/Ihx3eYaSjgwoBKl7NZORUX8LjMq4PBya9IWARoxrzY5x62W5wSTngbk68MF1KAowoHgPlBxvzZ8wSEG3UfxuRFjbAqiorB6NqbE7D2cJ9cg95iPPAI8qwQmlbMV2Lv8liRDOwfBBih7n6FvbCekTClFBT+7HatUxO3/jDUgqhHPCMXoG5dA2LxokvLZnSJCaij+KNHf8MEY+lPn3+x8noYKXHXvOVZ1UqJ1QH2ADLpicegIxxRdt8Hz3Wseb8d+rxerrsxZeG3XTXgGRvlnoSXoFnaUm7LMwkWcZB0HDMnIk+DohJimVWoJ6OZQ1irCG1/rNUmzl2skJtUsUdYm34mSBQYU9D6JJq/bQSF2l6Eq4rC5UjgE8d/LGS3iXBs7+SZ2TJqxBT0jA+krrioFK7375XBJgu7opMaUX9lqyUgEIERD/YXwo6HUrZTB/9FMwN1hg4yiyX059HR/ynkG+/Pnkc+N43LGjYfqA0rOmhukK0RKPj9UdjC X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 979a728a-eada-4302-23fb-08d8db413050 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:30.4619 (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: EhCHarP+LzX/OI6liY9UCFNY9t3iiI47UoOZUk/uMf3OeniwFoaJdBamVSbGacrtPUJs2B5+FoBnm7wgWrOvL/w4sHhdzmw9HROFYP0kODY= 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 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: target-devel@vger.kernel.org Convert vhost-scsi to use the lio wq cmd submission helper. Signed-off-by: Mike Christie --- drivers/vhost/scsi.c | 36 ++++++------------------------------ 1 file changed, 6 insertions(+), 30 deletions(-) diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c index 93f5631b469c..f3448e542965 100644 --- a/drivers/vhost/scsi.c +++ b/drivers/vhost/scsi.c @@ -85,7 +85,7 @@ struct vhost_scsi_cmd { /* The number of scatterlists associated with this cmd */ u32 tvc_sgl_count; u32 tvc_prot_sgl_count; - /* Saved unpacked SCSI LUN for vhost_scsi_submission_work() */ + /* Saved unpacked SCSI LUN for vhost_scsi_target_queue_cmd() */ u32 tvc_lun; /* Pointer to the SGL formatted memory from virtio-scsi */ struct scatterlist *tvc_sgl; @@ -101,8 +101,6 @@ struct vhost_scsi_cmd { struct vhost_scsi_nexus *tvc_nexus; /* The TCM I/O descriptor that is accessed via container_of() */ struct se_cmd tvc_se_cmd; - /* work item used for cmwq dispatch to vhost_scsi_submission_work() */ - struct work_struct work; /* Copy of the incoming SCSI command descriptor block (CDB) */ unsigned char tvc_cdb[VHOST_SCSI_MAX_CDB_SIZE]; /* Sense buffer that will be mapped into outgoing status */ @@ -240,8 +238,6 @@ struct vhost_scsi_ctx { struct iov_iter out_iter; }; -static struct workqueue_struct *vhost_scsi_workqueue; - /* Global spinlock to protect vhost_scsi TPG list for vhost IOCTL access */ static DEFINE_MUTEX(vhost_scsi_mutex); static LIST_HEAD(vhost_scsi_list); @@ -782,12 +778,10 @@ static int vhost_scsi_to_tcm_attr(int attr) return TCM_SIMPLE_TAG; } -static void vhost_scsi_submission_work(struct work_struct *work) +static void vhost_scsi_target_queue_cmd(struct vhost_scsi_cmd *cmd) { - struct vhost_scsi_cmd *cmd = - container_of(work, struct vhost_scsi_cmd, work); - struct vhost_scsi_nexus *tv_nexus; struct se_cmd *se_cmd = &cmd->tvc_se_cmd; + struct vhost_scsi_nexus *tv_nexus; struct scatterlist *sg_ptr, *sg_prot_ptr = NULL; /* FIXME: BIDI operation */ @@ -814,7 +808,7 @@ static void vhost_scsi_submission_work(struct work_struct *work) cmd->tvc_prot_sgl_count, GFP_KERNEL)) return; - target_submit(se_cmd); + target_queue_submission(se_cmd); } static void @@ -1130,14 +1124,7 @@ vhost_scsi_handle_vq(struct vhost_scsi *vs, struct vhost_virtqueue *vq) * vhost_scsi_queue_data_in() and vhost_scsi_queue_status() */ cmd->tvc_vq_desc = vc.head; - /* - * Dispatch cmd descriptor for cmwq execution in process - * context provided by vhost_scsi_workqueue. This also ensures - * cmd is executed on the same kworker CPU as this vhost - * thread to gain positive L2 cache locality effects. - */ - INIT_WORK(&cmd->work, vhost_scsi_submission_work); - queue_work(vhost_scsi_workqueue, &cmd->work); + vhost_scsi_target_queue_cmd(cmd); ret = 0; err: /* @@ -2487,17 +2474,9 @@ static int __init vhost_scsi_init(void) " on "UTS_RELEASE"\n", VHOST_SCSI_VERSION, utsname()->sysname, utsname()->machine); - /* - * Use our own dedicated workqueue for submitting I/O into - * target core to avoid contention within system_wq. - */ - vhost_scsi_workqueue = alloc_workqueue("vhost_scsi", 0, 0); - if (!vhost_scsi_workqueue) - goto out; - ret = vhost_scsi_register(); if (ret < 0) - goto out_destroy_workqueue; + goto out; ret = target_register_template(&vhost_scsi_ops); if (ret < 0) @@ -2507,8 +2486,6 @@ static int __init vhost_scsi_init(void) out_vhost_scsi_deregister: vhost_scsi_deregister(); -out_destroy_workqueue: - destroy_workqueue(vhost_scsi_workqueue); out: return ret; }; @@ -2517,7 +2494,6 @@ static void vhost_scsi_exit(void) { target_unregister_template(&vhost_scsi_ops); vhost_scsi_deregister(); - destroy_workqueue(vhost_scsi_workqueue); }; MODULE_DESCRIPTION("VHOST_SCSI series fabric driver"); 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: 12107763 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,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham 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 89F17C433E6 for ; Sat, 27 Feb 2021 17:05:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5DCE364E7A for ; Sat, 27 Feb 2021 17:05:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230001AbhB0REj (ORCPT ); Sat, 27 Feb 2021 12:04:39 -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: target-devel@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: 12107767 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=ham 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 4A937C433E0 for ; Sat, 27 Feb 2021 17:05:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1915264E24 for ; Sat, 27 Feb 2021 17:05:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230315AbhB0RF0 (ORCPT ); Sat, 27 Feb 2021 12:05:26 -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: target-devel@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:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 12107911 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 D12ACC433DB for ; Sat, 27 Feb 2021 19:07:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8707264E6B for ; Sat, 27 Feb 2021 19:07:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230019AbhB0THU (ORCPT ); Sat, 27 Feb 2021 14:07:20 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:51842 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229999AbhB0THQ (ORCPT ); Sat, 27 Feb 2021 14:07:16 -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 11RGx0ov175562; Sat, 27 Feb 2021 17:00:36 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=E9Wvj0H2DHQ+uysGDfmPsFtvTmQoayJyUcuQ5991k3g=; b=l/5beY5SqA1bYZcQd4yPsfx7bQ4trjfyUzHqagdFR3Mo1RqrhMo4X4/XQFdr2itd6YFr xILjRbNvEO33kNL5vhDPETNwExb7IAp1JxicdR5NVhuSdZbB058KZ5bcOVnHH35w88Od BPUwuoXM8wl22MoNKSK1D+L9o4vCJ+z99U8uHSeXQngWcUfYGpulqArwlTTPFC8L+J0r CzuRRlRf8qRmRlV6hNVUJ2GRX/oyUxlAfTDRVnN9IDDeqAjvy8NnP7fUietKaeoQt0U4 /4G3I08bk0HdqFsjxSLUYKcbsv13PYjeHHlgejOqWr1SO26UTHEd2b+PoeAHSpNJCwI2 Jg== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2120.oracle.com with ESMTP id 36yeqmrptd-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 11RH0Mbh173209; Sat, 27 Feb 2021 17:00:35 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-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 27 Feb 2021 17:00:35 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kQJnsyxqv6y6gOsPcED9ZdUblWW7qPV2TogqZowH97yYAOnefp9WiHoqY2jUCBTxOlvJ041068/UgqLKryAqx+2CHb0KQbTdykWrbl9zonNJ1Yyq2paiRs3LCsTafOiLA3XG43w1NKfvXHTsR/iIGzkbZX5QYQ9wTZxrNAva4NNnmsU4PoduKxx7ibEC0mPa9STiHBAYLSRv5hR8m4GY/TKBai8khKs+CrgU24HqqIFS/zUwhyXrV9j2V4jwveBiGxq6W5u1J4bS5x1gJufvEHQa4xVZmU/tjhrBGt8hUhT3LbrNSsVf3vH3bcjb6YVue/WKLwtHYr0ZwoP9i9JySQ== 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=E9Wvj0H2DHQ+uysGDfmPsFtvTmQoayJyUcuQ5991k3g=; b=d2pcdXQNIVs4T3i5wYgQVPzRNN/GtyYVwn7FlMdr01+z8PlMMHa5Q8G3wNYRaoF+DzZMtrCIsEN+RLcN5pXrnXfYlkq/7AS4D3Dz8E5lNyd/V7uuirk4SkXfDqS4ck///M3RWkFg/YSO/f5QsRovSxBPHq/UwP4Um5sQrfTfgJCoWHyde2g+AqbdSXWvR2FmqVnzDwBe4nS7wYm9suy36MX0tPvpTCjygjPpR2kz5EydfZ2JSJjyNlf11Z/0m7bTzAdeNKb4K9miylttbZtlCc+pYFi2Lcw30HRb3rmKfu/mZrmwe4FDP/bdc17rkMgFd5UfvrJJK24PQtwWyhw0EA== 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=E9Wvj0H2DHQ+uysGDfmPsFtvTmQoayJyUcuQ5991k3g=; b=pnx75hPvOB/uHIh9wVM4atFm3dNSr9z/O8i9B9CfoKKCXWuIepuLZcxcswF2irCcckbbDWR62aSYwZhJI3gnElgy/VEu/fohr6x0Rkew5jNV4ZOmwAxjxUmWK0ohFatKafZCtEfQlikqHj0/9Qibmd2zeT8l2kCj0/fJrhSy9Zk= 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:33 +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:33 +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 , Chaitanya Kulkarni , Himanshu Madhani Subject: [PATCH 20/25] target: cleanup cmd flag bits Date: Sat, 27 Feb 2021 11:00:01 -0600 Message-Id: <20210227170006.5077-21-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:32 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2af9a3c6-4d09-4a88-2197-08d8db4131eb X-MS-TrafficTypeDiagnostic: DM6PR10MB2538: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mNOqb5w0I1yDl+u318JoBsuB4GEGpQ4MlEHx3DVBgfJDdgJsRYCHRdgLAAhQAZY1FdwSVj9YtoqtqT7V7HqO4aiiEVYIkBtGwbeYpoVUuHzesEcqSCsdJOk2FAMJ/+VEdXwkavJjxr07oB2esoxIaL3z2iJ2IN3XYLzJS8tmZDu2Whj0iE+w2vCNrspJvi3ZRznsYEr6S6ae00VyUeY16A0Kd3FDKV0QBu5hqLZpAgF2owcEmmEmCRci7VqrElR/3S+5NcmoeTjjX96qJpouRBo47gPqDg21oaKDfF0k+dopEfils4KjiUESq0Gxdul7PvpMZirZzYVyCtYKJpmJjrctsHD+Yem1kISPX7aeGu/JZD0gidBSMNduyI2khmrrYZc5wTYO+A5izkqqnb5rv+zamUTUHwMott7dFqE01IZTD4hKn54g8MD6s7IDvxl5/n6Ddt7q9lvvQZ5rnSu26OMF6EzX9olbej3rANLxVAfCwYtvrsp0bS0i6UGiQBgyxduejR909ZYTWl+ghidZmgAp0k8gA7LOVTd9tT14NvXT2x7IUZ09Swjb9gGblJeVtnWxFmKFLSjkPzbGJCGUkQ== 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: f1wUxfG17ki3DLUU+rrzRqdh7ZTisz8P2ZtHg93QpFOUA8Dc6FXxCpGCy/oTbXrXhdVlJgMbDu72FxDlQixH6r6U0x0PZjJAgQlov1Gg21xa7iz0fDX2dK681m5+WJU9oiEqlhaxMQj18y6ng5Tdc6zZDDUPPAdeGoUII07WGQjqv89FtaS2mj6u6OEOJEp6LdiFYvd7GRYbmXLt4e4KB//woW+eX8fLIulsnRu5vvGKwSkje0kJoxV+vxYm/gq5uFF0pYfkwSVvL8mRly69ztiQVgGxg2keXoEM88PAQTnZWb13/rk4l6qI0DkDj5eva8jpf1NyG3Yh3CtRLRkVxReWT6nO8qhrkdW9m1PKloRYFpE7l2dltzUmlSuNvPvxZE32WgKuyq+njMXFk4zrwvag+Arr/CdBS1qHP5zxe4thfK7vNgW28iuu7aKqIHf80LryBjv13ASS1rHsi0miAZxVmH8MYFZMZ9iVPEW8HFZ/mcLrIlJ6y5L6TFToW0VV37faKJGXPy//4l710dz49E2x7aSw4PngzdB4edbh9TnU/cR0SG30JBfcl4lAcPQfLz34FdII1tpiweWMQT8No6rBGWQjr6bZRuzLsgrJjEoblaxjxraoPhZJ5gb0KBZJo/xngUhkJrTPa2ejo81hEp1CZ/A5n2P3O5Fj8hSPiNEA7l/p2nNL2XVULqMctJdBP09+j21u2vdHxQjYEh2CbeQ9K32TNWcuazCi6dLVzeELkJTMvN2TwFVjybfUuikR8lfFM4++U/8rX17UX783BIAwljBMdhPoBw+OjUhpD6+X2Nrwn2Y6H7S1yHy1U4+oQsiTmhgZjAplNGyXn+cH3PdfUyMl1eAxoI4Gc544crC9gFQi0Fy//eZpKq/jMLLmkrbPwX263VUHXZZrhPAKfnbWCUBbH40cUYUcp+Ksd20XDHjLZVMOAfi5Y1EGsChD3Y0u146UO5O37CR/nytO5EvGraRAhhbEBdJdMLBJ6IGKUpajRrOcE7Eq42SiRzdRKY32xAwmPWkEIOQCvnQxhZ0gVWezFbJqEw+e/D0/w+rQhgfaVw/Qk7ee026dn0DK5srkrMmFogm4RNsq4MYd4m44faa5AExQswQse2rQ0IOHsR9Au5QxLnsxRBGxf4OZ9C2OeoNY4WDCknF+z4RX3YoEE2ERNoBpo1OduXjr3fHj38lAHrsdznYunvloopMKDWL+z1r+Ce8FIC4g/rYjxFkLAGO74KkwKf33v+ZZNa/PhF5hDiESbTXdydK1/kgdF2hwt083+D3NJg2jPo3jp0gR+q6El0Uhxjl4CsPsDwPKrZzYiY4fH1vneAgaqrMH X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2af9a3c6-4d09-4a88-2197-08d8db4131eb 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:33.1584 (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: 79sOci/vMCI6tbUpYw1T/OrR1OrYDrNPdrl8i3yOCCnEbhodO3nrgF42DE2LhrIQTveqElKvJOBOwb+SMUOXG2yCbK55GrylJRdbdXC02Qk= 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: target-devel@vger.kernel.org We have a couple holes in the cmd flags definitions. This cleans up the definitions to fix that and make it easier to read. Signed-off-by: Mike Christie Reviewed-by: Chaitanya Kulkarni Reviewed-by: Christoph Hellwig Reviewed-by: Himanshu Madhani --- include/target/target_core_base.h | 38 +++++++++++++++---------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h index 815de4c97230..5e6703ca102d 100644 --- a/include/target/target_core_base.h +++ b/include/target/target_core_base.h @@ -127,25 +127,25 @@ enum transport_state_table { /* Used for struct se_cmd->se_cmd_flags */ enum se_cmd_flags_table { - SCF_SUPPORTED_SAM_OPCODE = 0x00000001, - SCF_TRANSPORT_TASK_SENSE = 0x00000002, - SCF_EMULATED_TASK_SENSE = 0x00000004, - SCF_SCSI_DATA_CDB = 0x00000008, - SCF_SCSI_TMR_CDB = 0x00000010, - SCF_FUA = 0x00000080, - SCF_SE_LUN_CMD = 0x00000100, - SCF_BIDI = 0x00000400, - SCF_SENT_CHECK_CONDITION = 0x00000800, - SCF_OVERFLOW_BIT = 0x00001000, - SCF_UNDERFLOW_BIT = 0x00002000, - SCF_ALUA_NON_OPTIMIZED = 0x00008000, - SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC = 0x00020000, - SCF_COMPARE_AND_WRITE = 0x00080000, - SCF_PASSTHROUGH_PROT_SG_TO_MEM_NOALLOC = 0x00200000, - SCF_ACK_KREF = 0x00400000, - SCF_USE_CPUID = 0x00800000, - SCF_TASK_ATTR_SET = 0x01000000, - SCF_TREAT_READ_AS_NORMAL = 0x02000000, + SCF_SUPPORTED_SAM_OPCODE = (1 << 0), + SCF_TRANSPORT_TASK_SENSE = (1 << 1), + SCF_EMULATED_TASK_SENSE = (1 << 2), + SCF_SCSI_DATA_CDB = (1 << 3), + SCF_SCSI_TMR_CDB = (1 << 4), + SCF_FUA = (1 << 5), + SCF_SE_LUN_CMD = (1 << 6), + SCF_BIDI = (1 << 7), + SCF_SENT_CHECK_CONDITION = (1 << 8), + SCF_OVERFLOW_BIT = (1 << 9), + SCF_UNDERFLOW_BIT = (1 << 10), + SCF_ALUA_NON_OPTIMIZED = (1 << 11), + SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC = (1 << 12), + SCF_COMPARE_AND_WRITE = (1 << 13), + SCF_PASSTHROUGH_PROT_SG_TO_MEM_NOALLOC = (1 << 14), + SCF_ACK_KREF = (1 << 15), + SCF_USE_CPUID = (1 << 16), + SCF_TASK_ATTR_SET = (1 << 17), + SCF_TREAT_READ_AS_NORMAL = (1 << 18), }; /* From patchwork Sat Feb 27 17:00:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 12107797 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=ham 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 3E1AEC433DB for ; Sat, 27 Feb 2021 17:10:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 11A2264E84 for ; Sat, 27 Feb 2021 17:10:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230335AbhB0RIz (ORCPT ); Sat, 27 Feb 2021 12:08:55 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:48010 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230267AbhB0REn (ORCPT ); Sat, 27 Feb 2021 12:04:43 -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 11RGwuoP021458; 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=apjPo5XH7dEKoHl7PYYy3A0WZrT0I6GidbxtxtQ0sE0=; b=tfDRvkTAuY4WduvgygdIHdKb+1OiCKNcjv4wSJwOm47u3GvFMGmnHICvYnCsPU2h0w22 c6hkSpPgxMHg4Dz7LdPfsvi+fw4EYDGJjeik4lqdqKzVYsGbzmhKgt/XnW0iaWnSw3C+ Eo8DTzab3voxK90rTfexZw+QftdaFAK96ACt3e5YNnzQzi/0Ck7M8I1pMaTevfrdNopS 9aQRWD4dT+Gijm+pBj9+Ct6pAm4s23RjAYhFlXJ3s3YEZlZXZaWSHp4nmhPDkt0j+ysT wjQeYKovhA7g9B73ndlu1bniSGhjQ0hjMho3sp9hQRqmAH9QTvDwK8u5I+avqtsL/6im LA== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2130.oracle.com with ESMTP id 36ybkb0v4h-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 11RH0Mbj173209; Sat, 27 Feb 2021 17:00:37 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-3 (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=P0dHGrTXDxco/hwoHdRqhAwbaVW3gAIJi5MnCF6q6whD4K3aH//KQsOQh8QRq1U6OWFsNvM4y0+oy/jQ+pazVBYOx/tUaisLqSsGLGjGhzMzlSR1SWrRb/zGpkvO0+Y3GePDhP1ibL8BMQwrcw2fAK6iAdspYeMTdwTdabWdtrMhoPd0V3LvHrfgzAqSGLzwRbgbyWAVQDJPtrLBmLB693JnmSH5KrgG09Mly+QOyebd7vFf7QrKUAo2nUGN46k+wVD2M+TiN0/qqRHSXpsgxF+eKXGsBKsdrdgch0OCcY2/Rq2uMe0YFoAdiNt5Y6Ri65U7iKL6+osaLXr2CZglng== 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=apjPo5XH7dEKoHl7PYYy3A0WZrT0I6GidbxtxtQ0sE0=; b=kX90BWb1/4ryNOOb5hWjNCObcNjsFxJdfQCdn6F06fqYjcoflJmiDZLOUqOeNYfS4HHXcXwyGbYLNDUuQ6Wfmbf6valGE2EwwvQL8uXy/DwCuKMDWh+ZlkudIIf3GgUBA19Bv5ZdtDiNVOorMGekCgGsWkarK2Qluwv837++7BP7U0guUvep+oPvPbs2LVYE2CaRCEsxUbG0q3ye8jp9cWB4DX4WBkUlhzVYwD0lpcWAZaReJfdPpmPp/s/Xomit3jzYQRhnIxsVOhn9WtouDVvrU5f8CIEBjhQBN1ieWSCQ2648+AdiAHitn5PnreRyTUSsgMaSnwzsz9bk4I6aGA== 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=apjPo5XH7dEKoHl7PYYy3A0WZrT0I6GidbxtxtQ0sE0=; b=VxJ/eDyUXH/J6/jIDRSVevWv54iyV0A57okVaQphiaaRz1YEQcI2r6K+R6eiXJjG/yVg4q+TsW4MZS2lNlrdGdAfRv/XAvI+Y4zZ2eJsPRnRCinpHtrPdSucvZo/q/ah/5+R8moWQUyaUUSb/5+kSmPDSrSXrm+kVYOXFRd6jVc= 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:34 +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 21/25] target: fix backend plugging Date: Sat, 27 Feb 2021 11:00:02 -0600 Message-Id: <20210227170006.5077-22-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:33 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3840b06d-57f8-49af-8518-08d8db41326d X-MS-TrafficTypeDiagnostic: DM6PR10MB2538: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4125; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: CGgM3v7X5VsZDhjn7SXLMBVq9qT7ne7RgssOmECCERcHEZc4lgQ8jNgQlg6qygyYJdZREbeEMUm0X7/qY/Hd+rc8YdNLv6HXC6deE+BTdsEm1jGWJKiFyZ+kOD/4lK6Y7fspusVMsNOKDh1ou+B+GdA7DuaxOBk7b8vOYIC9hMo2m+jjyxATdtT5SlyLk+NuL1G+VSkzPaalUDnrFCWjQHaRjEC4Tq7xi21rKkCVYWnRH6NcCxqKur05gBjAK7Tm1QmgocpOOmHHnML0HMojhjJfQjFBs5u+GjtmhxzpLVPqmt9a6rzNz2noeq865WOGGQWzMDLygRZJ29Z9leaCJuCIb85YMDzKTbbeHzVZr8j30SEBmXqL/hzQnpajG6QPahj9+OWBUttb1gIJWIDbeyRYjsj1ncTsTvFFq13Sb7zZeR9+ReEqU9M/w2jVbXVlPbYPRk2hTHMd7Ae/q34RLbd52bpjXQdpqtAPsaFtW1r/fxNklZ65mhVzQouwuNeCCDOChFYnHoKNZFBWRF7xTlxQBsuDdSKLH38gprbS6y+xEnwVhYacTKYYnEOs1E4U3XqrX6ORq+YWH+0vd38gDw== 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: 7x0ih/yGUFAz/CVSjDtQsgmeiAymEzSuhMBm0CEDkKyiSo9NmE3OdU/pxjLL7fDO9FyOuMdzQbVoh5YRZwuIrQu5vtOxXhbUXYg/cyXjT81kNH2qWus6dusTxto2kuHS4cCoNmQ9L0dK8ezSMXg3MTAp14L489N1o4yBKAs+/BvjzZ2xwk3rchevh7vvhR6NL6Epajkow4ji3D4sHFdjj9o4tVdt3AOandWG7OfPkE96ER1zXfLeJKDQSVWTiYe8uCpfiDL2rBbPUZ4DAloDyYe1N+Nnn8ihkJQ3zsGYP9hNUoZ+ODOzV4pWTUynVWbY1Znj2LqyGQUp05ixkTtG17IRF+xCoc5rTWwOSDqhL1rfzzxVQQxTWVoFDX1A/EQ/NrdxYu6Y38E+HKpd8RYm/DztIlKZU3CGWQ9X/2DjntJJ5Qun/G9pv0M3JAc1KJnihcR4qFylATa++xFGPqdfVYB4p9xjPgMnpRz7P7spoAL57y774s3fJLYVya2HMLwmTNFkve8de33LC7NaIDpPM7k0oxAyhgsSjjttbbJkGpsY3knfRJlb94zCvKF1gZKJb4u1G5gyKSKZKlXdFC8sr4o3Sj76FknuRwRh8TPwlcE6SnH1lSSMJNAgJXfZBpyBupHfeWxh1D1aGZgv7SZxt8o8ae566vwKs7ZKybkCRPAuJHjQHhPkty7Y8zk1QkR29UYinJdVHbbTr6AgcELDqtP0EeraUnxpaOIA+HQY1IXxtSoKuM7ilgg2ZMasoPBsNyxw70snoLRgLaxQwx2jyZIjJMbmLLIAAn+NPCM00yJgxvaD47EMCvtMmpKAzvz5DtWQuamcmDxBsCG1qCLaC0D+fsS9/Vm4uFk3uLYVX9QKiETFw2pWTY2hWvdUxMuZmsBr8utSgN5W1nt+u7Qfsu3DGfZe7daoV5KpIfadCIJMqLVlpai2DoqEGxakhaWYKiwmfDyDNNKna6j9Koc1niwvUPwfVqO85pvsB+Wc07bSSNFVmRCRh+AX9SdR5qa65sUl6/XQ9vpenO9+Gfx1qf8FamQ+KL7eR8LQVSJtbCUZdeg0zr8ZnpWhCJlGVAxxB2l7WoDktUkXYgI5p1bMLSramCoXjuhuNHrpIi2HYh/GIjOOgHpY+8jNFiD9EeBRyroo6b1UzCopdSM+wEvzUf28AlA4+BuhrqOQKrAqQdV8CWGXOsSRMFxsMtveuhgnKOtSSFFQE88ebtlunVKQwGsCslzDKGdQtHfZiZPIt7aTDjtv4JRLZyTn+3KXNtas1vnxiPq5lwMm9JoNQiM6+CxbCJYODF6Wtn1Zpt31TKUoNbCEf269zbnBFhgEVnJq X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3840b06d-57f8-49af-8518-08d8db41326d 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.0199 (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: XwdSLkXhlVjIEDxjsytkmfR9Mxl3C0BJsKR5mOiiRUJvfk0qSL0NdQT0xuPs6uByW6GnIn212DmZvYrgU0hYNbLwQQoA2+s4NS9tW62LYNc= 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 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: target-devel@vger.kernel.org target_core_iblock is plugging and unplugging on every command and this is causing perf issues for drivers that prefer batched cmds. With the last patches we can now take multiple cmds from a fabric driver queue and then pass them down the backend drivers in a batch. This patch adds this support by adding 2 callouts to the backend for plugging and unplugging the device. The next 2 patches add support for iblock and tcmu device plugging. Signed-off-by: Mike Christie Reviewed-by: Bodo Stroesser --- drivers/target/target_core_transport.c | 43 +++++++++++++++++++++++++- include/target/target_core_backend.h | 2 ++ include/target/target_core_base.h | 4 +++ 3 files changed, 48 insertions(+), 1 deletion(-) diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index dd63f81bd702..18cb00a1ee2f 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@ -1805,10 +1805,42 @@ void target_submit_cmd(struct se_cmd *se_cmd, struct se_session *se_sess, } EXPORT_SYMBOL(target_submit_cmd); + +static struct se_dev_plug *target_plug_device(struct se_device *se_dev) +{ + struct se_dev_plug *se_plug; + + if (!se_dev->transport->plug_device) + return NULL; + + se_plug = se_dev->transport->plug_device(se_dev); + if (!se_plug) + return NULL; + + se_plug->se_dev = se_dev; + /* + * We have a ref to the lun at this point, but the cmds could + * complete before we unplug, so grab a ref to the se_device so we + * can call back into the backend. + */ + config_group_get(&se_dev->dev_group); + return se_plug; +} + +static void target_unplug_device(struct se_dev_plug *se_plug) +{ + struct se_device *se_dev = se_plug->se_dev; + + se_dev->transport->unplug_device(se_plug); + config_group_put(&se_dev->dev_group); +} + void target_queued_submit_work(struct work_struct *work) { struct se_cmd_queue *sq = container_of(work, struct se_cmd_queue, work); struct se_cmd *se_cmd, *next_cmd; + struct se_dev_plug *se_plug = NULL; + struct se_device *se_dev = NULL; struct llist_node *cmd_list; cmd_list = llist_del_all(&sq->cmd_list); @@ -1817,8 +1849,17 @@ void target_queued_submit_work(struct work_struct *work) return; cmd_list = llist_reverse_order(cmd_list); - llist_for_each_entry_safe(se_cmd, next_cmd, cmd_list, se_cmd_list) + llist_for_each_entry_safe(se_cmd, next_cmd, cmd_list, se_cmd_list) { + if (!se_dev) { + se_dev = se_cmd->se_dev; + se_plug = target_plug_device(se_dev); + } + target_submit(se_cmd); + } + + if (se_plug) + target_unplug_device(se_plug); } /** diff --git a/include/target/target_core_backend.h b/include/target/target_core_backend.h index 6336780d83a7..aa5f83e55501 100644 --- a/include/target/target_core_backend.h +++ b/include/target/target_core_backend.h @@ -34,6 +34,8 @@ struct target_backend_ops { int (*configure_device)(struct se_device *); void (*destroy_device)(struct se_device *); void (*free_device)(struct se_device *device); + struct se_dev_plug *(*plug_device)(struct se_device *se_dev); + void (*unplug_device)(struct se_dev_plug *se_plug); ssize_t (*set_configfs_dev_params)(struct se_device *, const char *, ssize_t); diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h index 5e6703ca102d..b8e0a3250bd0 100644 --- a/include/target/target_core_base.h +++ b/include/target/target_core_base.h @@ -769,6 +769,10 @@ struct se_cmd_queue { struct work_struct work; }; +struct se_dev_plug { + struct se_device *se_dev; +}; + struct se_device_queue { struct list_head state_list; spinlock_t lock; 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: 12107799 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=ham 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 48A79C433E0 for ; Sat, 27 Feb 2021 17:10:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 29F3164E85 for ; Sat, 27 Feb 2021 17:10:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230345AbhB0RJH (ORCPT ); Sat, 27 Feb 2021 12:09:07 -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: target-devel@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:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 12107803 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=ham 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 A8780C433DB for ; Sat, 27 Feb 2021 17:11:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 73E4B64E84 for ; Sat, 27 Feb 2021 17:11:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230315AbhB0RJ2 (ORCPT ); Sat, 27 Feb 2021 12:09:28 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:54112 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230288AbhB0REl (ORCPT ); Sat, 27 Feb 2021 12:04:41 -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 11RH0PmK079924; Sat, 27 Feb 2021 17:00:39 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=IVFd2EElf5yvl+jtYWcVdOrdCKf6CNk255hvy+cM7QQ=; b=rtS//5Ad4YWKJLozLa0lmi/EFsfI9gx5Ba6m9dv0/a4vS56sGykbj+d8lUt1QuK+pzk7 FRnDnYpZvlAA2xB2OeZEzl3cH4YcQCmxwHFbcJiTujRi2XXfr15kzCYLfw7QxcP8fr9o 0pfnI01YaJzcWdLpJpm/Di5mamhZUXA4q/CuK+B7QYVaP2WCcANKEq9DTkqFLtecPZD1 HOyt2sz7a46N6t9AmH0LVQXd/dDkWTjsR2kRtL0w2kPjqwpWceFcwjZJLrYhokOEtE9d k8YJJGP4YeR0ysBgGKydK7Y4in7ObSRiHpxVYkM7v3vTKcRuX90LSMSzHnaxYm/FeE+B kw== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2130.oracle.com with ESMTP id 36ydgr0rs8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 27 Feb 2021 17:00:39 +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 11RH0Mbl173209; 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-5 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 27 Feb 2021 17:00:38 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XecFrSYUhLtxBYmGva7BYBIpAVbsn7hCbvSY5CXCchcu/zUgYpUBCMfiD+1A9GuQLUJZN+L2OurkvxBMN/8ttg0FQr13MIPN70/p3J7MIyrAejVrcv/ybrhGokz/FH0tldqGJ6v2BgC8RJYsi0nUFJH9FlzWDwLMX/f5Mk6l1h1Kynzx/V5PSvm4zXlDSrMwQNWn3skI388lqGU3kdqVxqg9++En6lrkCXOB6yvQ2d+clm0sM3A/zQchuqB62XdRMwWQ7iYLAAwL08ngUqap8/THAO747POnxsCix4iHxeX5xLKAE4Bwa1oloWzn407Nt3wP5ZjJRBRpkBS1UCiYGQ== 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=IVFd2EElf5yvl+jtYWcVdOrdCKf6CNk255hvy+cM7QQ=; b=TtDWo1m266CXZvl9SGLZrcKxcg1bpUMdexVJKIP0byduVxBV80LsotlZOr7z54BBBIS7fXEbQgWN/r7fk2dmWnoqaDCKe515DkkD1maRs/YtNmZWrZ/lTPPPzpTCw8AEmdkk17kT8XqcwdisE1s08hffQ38H2gzXYFo/B3kkVrWuBx9CCyI2Htd18OeVVQEuEIQmuSWqh8BtdpckeW2kBKhUxpcD78TMAmTUjzq2vU2l/mrDHI1GJT3MuDZpAOqPrF71hMqjggfFBQDPHI4fePBcHb/GVqjv3aZS0aTuBIypxT7f/IAZq9jPRG3eGYHnlZqQsT8ghqG7rCiCNY5JXg== 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=IVFd2EElf5yvl+jtYWcVdOrdCKf6CNk255hvy+cM7QQ=; b=Ngo4TIvqltbAak0aMjgPeSDbEg+djUlEZOAhcirXckPQutNgytY3GvbJ4CTI2DxZB5dv7qUMBXxrVcjdsOl3QnUxRrxcEv9cPSjkyAzIB0lfRBny/vO34eT7kJC1PwCIRW+VSzUIxLu3VErikRi2kJxbBYw1omT1Z0R2Wh/IxIg= 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:35 +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 23/25] target_core_user: add backend plug/unplug callouts Date: Sat, 27 Feb 2021 11:00:04 -0600 Message-Id: <20210227170006.5077-24-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: d2b0128e-144f-429c-ec06-08d8db413379 X-MS-TrafficTypeDiagnostic: DM6PR10MB2538: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2000; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: HR5cj+SlyNgC0H/0rl1cxkdp1TahawooP/lLUE8UNdAtJeYu0KHCR34ATqvAicTgf0LaA+7PLc99nzlOpagalTyaRtkIVw+00ARFks4llZCPRL1+ULfa/rKGpy6QPEoxBnhrj229oClVUctJVGsMPqR84/Raz4wYzJieSohsv6Ekl1lIL+CB7Bc46PkV3s8u1gy1fHJLvFLXq8KSRFtnIIENR0iluvpee7Re8kw8JCQWtbi8wZDoo1wtY/ea8L/TqR0X4UoeKnVDX0uQDnRj98ekDFDXws22T2h0BG2L7hmPol8GHYKmRhkWFxzSWD9xBaslPO9hovb5kIIw3yUGkdQKrlhjhoep452p1faII+aBLIz9YbrgQSNCdgOuXPe2D7UbSg/j/+7eUH0W4tYACdrXfjTakC5nKPqg2VZJgHk408WD+vT+IO/eqQRRBjvwQqGK/EEcX4h1/xQggrTSfzuOEkxoBLMtihJ6BVU30roOA3m+gCCMb6QzriXdXkQ6RhofsWbwim1g3fiMMYv0dEOm9KOim0e7Pk27KmVDuq8u1+lb3A1EFTo5gqAQoTACh9Bd1TMBZ/lefig3ShLf6w== 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: kFWNYBojKqI7gLvzCgDAgtUfaPm8U20tTIpaZzy2s3xH1TAsKhj4NJTtZepka0klrNqnNZmQqRgWi5+M1zrCXWUiEGNDVkXGE+iWFSC+oH2XacxhxwQ0KpU48gGVgqDREvgo2qhp5mUgzsDQHsjpzeTxQAFaCb6JswUAJXW5SOa+NJmTeYs6S7dcERJL7L20Rt8BqmnhCi22s3LUtpO4F0iofAcuH43pzwC150Bx0iU8FRlwu6/NE1nnSnER25K40TXh+KpzMk5exu8UhN3yPKRQSpC6Xn2MlCXuBL7h5++a4HgtSBZFgmVYbqG4+EgYC92VXhUvPSC1hBYjBEc5k1axA5dkllC03CpC4vfC5OBTZM8wMSHRwLy7UPYm3ojc/UNyQqJ+wsj4Y4TtLhgcvnhmUezxLKUFYMsRq/LDgPlkOHK+ZRaO7JARuEqUKcjAFHJnXMEWiNAayXRJ2TNTf0SKkefaQ0D6ciFrk5kc7tfUOvdHQ8tGBT8LZzUSUCoP+yZHoaKPxvHlBWN9/2namvVI68qUe/MqiO6phH0nFh4mTtbRgedeEkB5T0lLISin3nWXnUMnkzuWtR4SL/XgkHb+KypMqLk2GTrVLf4LKl6DAt/fJJeZ6pul5mDSYFv0CqWZV9q0HO6gSuimbZ6CRJfou30nnVjS/VJ+CnAt5ebVsp5ayReWMXEqSuznxjiYZINnaCWcRrtcL47QclbTYO8wz8XhTJrPeMWvWRMrjf8pvkOd8J0NO5c2nAIcQVvpcuDNbWMs083qz2zj+0jpxBs5Rn+Vgn63DXMQv5Rv/iwQfukyE62QsNVHSLx2dKVJXjXd6FENpkZoVtvsy00eu1tjz3GOfgeEl7P1sz6zl3FX8lRxbpEOPabucYZOuL3bxgB4AA5uk4/7xcT6hiodMieOatBYqCs92g2f0sk7YQmHWbqkzmzJaaZ05LgWJ2fmbILHmh3c5wEcOwQeXkgJIyKJtwlr5xyAc/69hDzoaPAfLcaWvKyuXGi4dFYQEeLK39KWk9hWvRRb5P4Ay0Cy4UA1s/+lWHHKZzQa/cQRqU7vvgyHOod++2cbZHAyq/L5l1vsi74U9wAHbNF3k4SLYECQ6yrwH79V4eI7rD7/mGWT1ktFfKfYDy/48QhIuM58eZbRspCktRN2EfJUKdZTXFv5bZ/ocwqtqVZT6cmHhibW87jxQYgQ8ZBdhREcz7WPNk9rgBCMMnQMHblO3WntKsyuyeMb/JpCt7L5hoQB44LsL5Q8hPsBz2uqBqViWkIzU+GU6UvMdcoxThyzNmRf6ank3aAUTL82hPrKl4/6zWnFMvaNQJqPMYyWGgf1iqIi X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: d2b0128e-144f-429c-ec06-08d8db413379 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:35.7899 (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: PuaT01kFXyg3prJBXuRjl0MTU6dnbdYmBvyJ1bpkZhrxKJ18sPZBTQ1WogDFqb7gFq8UoFaEZG47SwKl4n3M7i4N3bceNqP2nM5YDSZ6JJg= 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: target-devel@vger.kernel.org This patch adds plug/unplug callouts for tcmu, so we can avoid the number of times we switch to userspace. Using this driver with tcm loop is a common config, and dependng on the nr_hw_queues (nr_hw_queues=1 performs much better) and fio jobs (lower num jobs around 4) this patch can increase IOPs by only around 5-10% because we hit other issues like the big per tcmu device mutex. Signed-off-by: Mike Christie Reviewed-by: Bodo Stroesser --- drivers/target/target_core_user.c | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c index a5991df23581..a433bda56b89 100644 --- a/drivers/target/target_core_user.c +++ b/drivers/target/target_core_user.c @@ -111,6 +111,7 @@ struct tcmu_dev { struct kref kref; struct se_device se_dev; + struct se_dev_plug se_plug; char *name; struct se_hba *hba; @@ -119,6 +120,7 @@ struct tcmu_dev { #define TCMU_DEV_BIT_BROKEN 1 #define TCMU_DEV_BIT_BLOCKED 2 #define TCMU_DEV_BIT_TMR_NOTIFY 3 +#define TCM_DEV_BIT_PLUGGED 4 unsigned long flags; struct uio_info uio_info; @@ -959,6 +961,25 @@ static uint32_t ring_insert_padding(struct tcmu_dev *udev, size_t cmd_size) return cmd_head; } +static void tcmu_unplug_device(struct se_dev_plug *se_plug) +{ + struct se_device *se_dev = se_plug->se_dev; + struct tcmu_dev *udev = TCMU_DEV(se_dev); + + clear_bit(TCM_DEV_BIT_PLUGGED, &udev->flags); + uio_event_notify(&udev->uio_info); +} + +static struct se_dev_plug *tcmu_plug_device(struct se_device *se_dev) +{ + struct tcmu_dev *udev = TCMU_DEV(se_dev); + + if (!test_and_set_bit(TCM_DEV_BIT_PLUGGED, &udev->flags)) + return &udev->se_plug; + + return NULL; +} + /** * queue_cmd_ring - queue cmd to ring or internally * @tcmu_cmd: cmd to queue @@ -1086,8 +1107,8 @@ static int queue_cmd_ring(struct tcmu_cmd *tcmu_cmd, sense_reason_t *scsi_err) list_add_tail(&tcmu_cmd->queue_entry, &udev->inflight_queue); - /* TODO: only if FLUSH and FUA? */ - uio_event_notify(&udev->uio_info); + if (!test_bit(TCM_DEV_BIT_PLUGGED, &udev->flags)) + uio_event_notify(&udev->uio_info); return 0; @@ -2840,6 +2861,8 @@ static struct target_backend_ops tcmu_ops = { .configure_device = tcmu_configure_device, .destroy_device = tcmu_destroy_device, .free_device = tcmu_free_device, + .unplug_device = tcmu_unplug_device, + .plug_device = tcmu_plug_device, .parse_cdb = tcmu_parse_cdb, .tmr_notify = tcmu_tmr_notify, .set_configfs_dev_params = tcmu_set_configfs_dev_params, 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: 12107807 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=ham 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 C9896C433E9 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 A267364E84 for ; Sat, 27 Feb 2021 17:11:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230356AbhB0RK0 (ORCPT ); Sat, 27 Feb 2021 12:10:26 -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: target-devel@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: 12107795 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=ham 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 57CD2C433E9 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 289B264E99 for ; Sat, 27 Feb 2021 17:09:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230334AbhB0RIq (ORCPT ); Sat, 27 Feb 2021 12:08:46 -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: target-devel@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)