From patchwork Fri Feb 12 07:26:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 382140 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=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 52480C4332B for ; Fri, 12 Feb 2021 07:27:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 20C0064E57 for ; Fri, 12 Feb 2021 07:27:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229788AbhBLH1s (ORCPT ); Fri, 12 Feb 2021 02:27:48 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:40238 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229697AbhBLH1n (ORCPT ); Fri, 12 Feb 2021 02:27:43 -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 11C7OeOD016620; Fri, 12 Feb 2021 07:26:56 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=OPcT//Kq3cYrLapZOgfJNb3G5rpW402u5X2h4TMCZm0=; b=af5yYbgGLisEhkNWvovDuiTLsa1jpTtlXAC5YrExN1+/f1Ju5QzIje2ycCxlLqKl3xne e3GRTHpEsMcmntFaJ+FyLag15pUnVLYXh9T0WcYvB8dvQ4oHaGCQwIjDDdR1xMfpO4TO rO3IabOSwY1mTlPgRvCCVr1wuRWKJZGdEqt5CudxviONyo+mDlgBBIldj5i1bEF5/EH+ y6x4IvYSB1LuqLBEdR8pudbKFW6ZWVQqSn2FcsOPfeDrMZuU5YMNXmD4mVte1slI8DgX yYe/W4DbsTOXuQdoTx8wjenAmGS2m1IlNtsZF1kruj1iueTFsh++clKuWF9fCCD6Lqyx ng== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2130.oracle.com with ESMTP id 36mv9dvcu0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Feb 2021 07:26:56 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11C7PZdO022757; Fri, 12 Feb 2021 07:26:55 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2170.outbound.protection.outlook.com [104.47.58.170]) by aserp3020.oracle.com with ESMTP id 36j5155a2x-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Feb 2021 07:26:55 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aEMBVrYn7sGLOpDzY2Vy/2o3qYFziug4d/w5CJeTfOzqAcXc4hcd2TyLkfknOeY0goaRkSGiXjoFsl0linoBO47NK/m9klONFnQvoYgQEHVsOGrPtW8R1Fx8OEmIlC2Bj3fdZ8aNd+82eXfwwTOMiD+rfL8twsFvgy6CE3iGzPKBNkJNCRJ7Kf7VVvdtk88RMbfZ8FJYYbBk3GiR5RveUDp8X1ApIX/XGqrKG2pJLi931jN0w4xNVrT1AE3y4nVYlZooiIWC3qT+aoN9I0WwBo2K/l2lxG5WhHBHiBIXVVwf78CgmNfLhZxXX1y/d2vrWTPynD8rsA24wmfPbFis6w== 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=OPcT//Kq3cYrLapZOgfJNb3G5rpW402u5X2h4TMCZm0=; b=cfcjwo7uDWjUBb2CEIwQ1Zui/ntPV3AIjyF974Dt/wbmNWypuDN4BfKvTWh5aSV5pWmezb+XcRXgg/mEfIK4jNQj0Hm5hlsTo03IwLxZ29vxrLLrBxDUV6bKWgn5LrDCfjfEzJc7bwuyEyBvy1cnzJj+Kcul+sqaezzoA405u5ixANf5ZCKlLMAZi9qxcEuLXdSEumNmV7bFVUNhrGUl1+kCFOwFUQbHqTrPMwyH1jkuhYhKbOmLpUiaLEbCKR2/Jz9nwahIdMdRhIMiRvvVF25Q9lkLJhKOw4tvpwpy/xzmNx5SwttWB17AcuyxrLyL+kAWSeb2jNnozmgdqQEJPw== 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=OPcT//Kq3cYrLapZOgfJNb3G5rpW402u5X2h4TMCZm0=; b=MxQXUAQRbRfP/dzT8j7ftnRmyJJh+OFYE0gg9pJbh1t4HL5h3YOC+oyg+O6D7GzvaRqoxuNtXDx9OKZJOed6wHnMpyKGO88S/Pg/K3YrG4S2+akZ1Ve1k0utFUQyDo6uYt9KuLSBz9BJgieocUFeTFcHMpV14lGHdu3hEpEQQrg= Authentication-Results: redhat.com; dkim=none (message not signed) header.d=none; redhat.com; dmarc=none action=none header.from=oracle.com; Received: from BN8PR10MB3570.namprd10.prod.outlook.com (2603:10b6:408:ae::12) by BN0PR10MB5256.namprd10.prod.outlook.com (2603:10b6:408:12f::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.27; Fri, 12 Feb 2021 07:26:54 +0000 Received: from BN8PR10MB3570.namprd10.prod.outlook.com ([fe80::513a:2259:52d5:e495]) by BN8PR10MB3570.namprd10.prod.outlook.com ([fe80::513a:2259:52d5:e495%4]) with mapi id 15.20.3846.027; Fri, 12 Feb 2021 07:26:53 +0000 From: Mike Christie To: 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 02/25] target: drop kref_get_unless_zero in target_get_sess_cmd Date: Fri, 12 Feb 2021 01:26:19 -0600 Message-Id: <20210212072642.17520-3-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210212072642.17520-1-michael.christie@oracle.com> References: <20210212072642.17520-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: CH2PR14CA0050.namprd14.prod.outlook.com (2603:10b6:610:56::30) To BN8PR10MB3570.namprd10.prod.outlook.com (2603:10b6:408:ae::12) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by CH2PR14CA0050.namprd14.prod.outlook.com (2603:10b6:610:56::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.27 via Frontend Transport; Fri, 12 Feb 2021 07:26:52 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: cd50580b-32ab-4d28-c100-08d8cf2791d6 X-MS-TrafficTypeDiagnostic: BN0PR10MB5256: 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: en7kcFhbcfJKk09hNOj7A54jaVv9gd8e4nZYc33ArA8lLdsmsZiHMO9ajAbamWBVe/ObamCRTjkYScLc8jjM9ayK/mIypTq23X/iAYl2ucSKSLZdl+YyGYA4NbCiwkwbq3ALi7gkhRZp01gFAc++shTxiDeEtZqx//8cZGxVbhCopWACoeETOGljDhzOiS4DVBvNQlLQG7W4Mk7XFCYZiRHqlk6Awt3jv26AcZnVnvEh706mCMYf2iRh1k9QmTEUvEXJ6bUK81lVeU7AxnGEejjebxKzq4VEnQQ+XWuRHbzBfCVuYTf4brVObVwPUdH+nHHPCX6hEuTDxucaBmQu1gFG36RSyJL0+zIUG27+H6J/Vwiw32eKqu1tETvUGcw0P5T99nGABhJ+0WhMLXKv4lCPPCl8eg+8WlumM07LulajBzWTWGS5z/d8R4//zJMFFLoIPzRkFiJkMU9fSx8gBNbnQwwlpeEdPVVB6Ab/q8RV/nSV9k/8WQH9ATMuRyXgtXIToJa7taEuuFgs5nKAtbOLhqB3Hlmv7eGTIaO4C2xk593RNNt+E+wNw7ir8TDjxWsW7/pYIU67rCtTVNYSHg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BN8PR10MB3570.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(376002)(346002)(396003)(366004)(39860400002)(136003)(478600001)(1076003)(107886003)(6512007)(83380400001)(8676002)(66556008)(5660300002)(316002)(66476007)(6666004)(8936002)(69590400011)(4326008)(36756003)(86362001)(6506007)(16526019)(2906002)(186003)(2616005)(956004)(6486002)(52116002)(26005)(66946007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: hZhvFHtSNcYgnukz9aRhCpTmmOvlVYYZ7gYpyO6RFv7+K1YyGyOovEgOoIvyYO2hHJ2wC+o0MXnW0L04F05v6c4bIUtDyp6LfUCckc5YqTRkcMbtcDbiqxV2dqmeOUEN8JCXImw0mERZE3l9wuHB+l9MgE9+EeKSMtSXYKbFctyd0bL0PTxPORzUWexBy6SZ1liD7UYFJowslMMs9MYcGS4dH5eM4WQQAelMuOgcmqesENEc7kdV+sgLXbdyvlmYyzs5Cd23nEPeyDr6lUDle+a7bYSm6DmI1OecQc1Q6Fmy7zaIyxgGbHX1BkZ6QZhrK5tcjk7ENXVzDrNDmmhUvrb8jhCsYAwjJqhGnjpk4Cp0ec+sFNkp2oEU01nAk29exPwGDVj2bk87jJFCEqoup/NeoRL1g6M83QQKzPJTJ/X8SVijnYedxXi6UUghoLqBd/jSkRiRRBRmlg1q5McarQRtk05C4bl6rkrSHEoriDihustk79ScPPxWb6F+WQ3tP6eoVEY1yfIXkR5droIFm9FnOoABZ0kQ2DquSk0f9aM2b2fNvhsw6HwCOjdB0WISa3NXjIN56k+xc4pewW0muNlljcbQq5KlD/l0i8OVBO5WNi5U/QR2V638brYByhKz6b6KPwfLlx+prkSzrztgPu6FbZMccyLYjkd26j5tGR/ILsHslL36KL/NOeHP9oC2VvNrmqE4Yh+4weAmdm//k128IfwNbS67yTWhPg8r0G+kkxQmHv1bkkpMwPNRa+gCP1tR7zrnUgAEYuHCj414WMyKlE6peleAkribJXzQRxlr0FsZZZRcv+1Bfc8F0AF/DJXzDdTCsPO9fksQRFoXiyCEWBK4Zx/rEcqfZO4uTquvZ6KgRihOolHx3i6bKrQRWF47rey9W0UMxL1yJlnDCg1p/xXcyAf+yL2/2ldsRfNczA0SRHrr96zpYT1HBoeutN5aiS3JHwzA5gm2dq1yPfqswlLr2UhzQK4oiIBdcltKxSPfY2iMwDPc9pKj/PNgu3jFXvxMYfcS06kOpqEC9Gp3H/nxKpIyHJ0C+qZkzui7L1FPmkmwRXvBuzlh4tCxiPVKGjAp4zQeCFRBCCWpfqFR+gfDsLNXFKXRMWcKjwCRYkLk4fqTcBSLuRWOoh3kjwblqENpmKq+cr7RlywCOfRxzTVAEPzNn3N6jqAYt6CZhsNg4Ucz7jksi+xZD3J+kYeh65fOPlpwidQrpYN/grrPz0rVk/q/5xEmhLZNRTIZt5aYdSATYccPnsNYlPVgifTSFktkEggge6liHGISlccFcal729ASaxCbJOkdsuu+Ch/IxSt6rNilpXBD8M1K X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: cd50580b-32ab-4d28-c100-08d8cf2791d6 X-MS-Exchange-CrossTenant-AuthSource: BN8PR10MB3570.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Feb 2021 07:26:53.2278 (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: 0Q7l7Vl9sj+TzXYbttKFtU1EmLsTQ9UksdIH/tEhBrfmZR1sX2C/tMbKJSdxHKmidNYEQmtsc6cC5ONRK5BxZEHArhCS7eMDgcyDGjX3Lx8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN0PR10MB5256 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9892 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 bulkscore=0 adultscore=0 mlxlogscore=999 phishscore=0 spamscore=0 suspectscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102120053 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9892 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 mlxlogscore=999 bulkscore=0 suspectscore=0 phishscore=0 adultscore=0 impostorscore=0 mlxscore=0 clxscore=1015 lowpriorityscore=0 malwarescore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102120053 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@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 --- 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 Fri Feb 12 07:26:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 382139 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 40282C433E0 for ; Fri, 12 Feb 2021 07:28:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 09B9964E57 for ; Fri, 12 Feb 2021 07:28:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229870AbhBLH2K (ORCPT ); Fri, 12 Feb 2021 02:28:10 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:37192 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229756AbhBLH1t (ORCPT ); Fri, 12 Feb 2021 02:27:49 -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 11C7PwOk142740; Fri, 12 Feb 2021 07:27:01 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=vBjYjV6LypMJ3C33QDNu+kzrUouI2yGUbgo7dSVDRUQ=; b=eOg/95XOa5maLOI3HYY0zBjGB45FATCGK8rCCqxpFo8uBBDSYu20TDqDgR+JYMdkMvqN T2dr9z1lGkb+nHzVfTmT4PUjbGjhxHFEHfqr+CeJpj/nT5opWusVxhrq488NYTlgaC/P 2RE5zMMVsNN/py9Q6iFR5DRLz1+L2KmqzLc7yMba6Yx3rZ+Tsl6if48TW49Q8ZjhqdO7 KRss/8Q2L1WUCXHEsY1QPtPr8kv1FFczWBIoX53czEPOGOKNzSy4dLv1NMVUUnM6PXzR F094yGBTbmxAscYPOZVW+AEyAtrK+ozfLnHpIKXWgeKH7BEw8p5rLH9GaLg8Ed2FdZLd BQ== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2120.oracle.com with ESMTP id 36m4uq0qm7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Feb 2021 07:27:00 +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 11C7OnuO012963; Fri, 12 Feb 2021 07:27:00 GMT Received: from nam04-mw2-obe.outbound.protection.outlook.com (mail-mw2nam08lp2171.outbound.protection.outlook.com [104.47.73.171]) by userp3020.oracle.com with ESMTP id 36j4vvcbub-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Feb 2021 07:27:00 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kHsdjsrBSWxeNkcr/KigpBcrpgak01CpYL8sALi1D8/RigfLBwxQN8XbrnM0pkNNA2SA+lY/dcDEJFh9fIhb5C/0mZ8d8HbBnZGxsdSytem8l/3Ylq38bui2pQXu87atNetSRbz+h58ou+seqrI7Tw0gyj6agKSHIGtd7kCJkewcmXS8mIZ/gpByyYrBurkK24qdDEv/fZrOyUPZQ0MbmU/fp/EdHd2qP26gnXmFh3hE7U+FuhBszDBYckZZ3BQJml4C/RUudvFhEha6z2VEBq642HdK+g7PXN9VS7nomahXOAysYeuUayNTawHTqTRfdzK1iVT4b+8eqYi/78eZoQ== 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=vBjYjV6LypMJ3C33QDNu+kzrUouI2yGUbgo7dSVDRUQ=; b=bEIPBNWGGUkJyJpCAxapO7TIuuPU6uplJkEmChlxDzQWm4+fOErMVoK+J6kNDlqlHKiyQRKtL29SuVVBZ9/HvHlwaOwq1yg6ogxYgGAgsPuXjt3cYGqJHxWiyMXA9tc8jQyjS2PoNUdHduFIxl8uOKMcBMeeiZnXkKKxmdT+DptkCbZ3xVvyPWsvbb8VqQiLTWe3Z5DbT7XkStKofS2jEtCy+8gGNvtAl4iMXUAITStkYC3OHHg8zUh8b7qSEib7/dtIlQ/JNRoLOKdjNdejXkxULYJZh2bh3s8EUnI5S4k9r5KLA42+0Q2S2M6IgwU8VtH7/gMHDwA6tbU6II5ELA== 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=vBjYjV6LypMJ3C33QDNu+kzrUouI2yGUbgo7dSVDRUQ=; b=B+dmJ15KhZY5Y8eoiPzAcxr4iTgclGZGkUOL5/1dh4805FX8Iw8nnoOYmj1hf9Qn5mijzJg8X9LCYX2/ikzqQY0ancZzQx0CTPS13EEn/OhSchbhZQatAUJNCZDl5XwVsWiwgiFG1yYWhC5p+N7n2MZ/KC0iJwjg7JfpB4eJJAg= Authentication-Results: redhat.com; dkim=none (message not signed) header.d=none; redhat.com; dmarc=none action=none header.from=oracle.com; Received: from BN8PR10MB3570.namprd10.prod.outlook.com (2603:10b6:408:ae::12) by BN0PR10MB5254.namprd10.prod.outlook.com (2603:10b6:408:12f::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.25; Fri, 12 Feb 2021 07:26:57 +0000 Received: from BN8PR10MB3570.namprd10.prod.outlook.com ([fe80::513a:2259:52d5:e495]) by BN8PR10MB3570.namprd10.prod.outlook.com ([fe80::513a:2259:52d5:e495%4]) with mapi id 15.20.3846.027; Fri, 12 Feb 2021 07:26:57 +0000 From: Mike Christie To: 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: Fri, 12 Feb 2021 01:26:22 -0600 Message-Id: <20210212072642.17520-6-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210212072642.17520-1-michael.christie@oracle.com> References: <20210212072642.17520-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: CH2PR14CA0050.namprd14.prod.outlook.com (2603:10b6:610:56::30) To BN8PR10MB3570.namprd10.prod.outlook.com (2603:10b6:408:ae::12) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by CH2PR14CA0050.namprd14.prod.outlook.com (2603:10b6:610:56::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.27 via Frontend Transport; Fri, 12 Feb 2021 07:26:56 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 13c3db89-9a97-48db-430c-08d8cf279479 X-MS-TrafficTypeDiagnostic: BN0PR10MB5254: 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: 9G9T63d4p3AlkDFC4ggFw5S/neohV2fquLz+sAEhAVlcANx/DYIy18dFBcBq5D0SJEjPdqOQ45CNOzJcWQOIuf7MkCZgFRXx/Ec81+KoV4faBKggVwaj1ynfcOx1cjoC/c3iWhHHOmvnw6Q9INT65+5yGR60rngv7Qi7RuPuC3Je/DCOOQcHmqu89kXlMCbtdWKqxQzjuqrSvN+kkCTmaCQjWnd6y4HR37g9EOLY94TvYLZgI/r6EMfiVktJ9Pn/i3qDKE6KhXZC5LMjdmT65gpGigGLk296bYZQNl2uNqUlZ1dlmkAqsAudwa3k7BPZ9xRzhrMB6OS5e7nzI1zhKcDEYz4dfAmzBYvYkYyC2DYiBGyra5lCirJyNLRaT0TrQHYjoiEkv9Hh/jW8Y8jQqyagXEMrC8BKbsLypy2XxvUnKTxlMAMqU7KeiKpY905XZS/NOu4yw4P/mbcdHF5ux+tj6/RzkZ+yHcG7lJEI7IKZN3/87qwh/EvPByYZocrcGQuGqTK72HGJNZvkv9UVF3dfs0hxTvQ8qlTYsB1gNxsTQ3+ycxDTBz1gJ9b3zw5VnAP24YaPKKzr+xxFwlUXPQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BN8PR10MB3570.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(396003)(39860400002)(346002)(136003)(366004)(376002)(8676002)(2616005)(4326008)(316002)(8936002)(6512007)(66476007)(16526019)(26005)(956004)(6666004)(54906003)(69590400011)(186003)(83380400001)(36756003)(5660300002)(52116002)(1076003)(66556008)(478600001)(66946007)(86362001)(6506007)(2906002)(6486002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: DsPqbUphN+r5rErralaH9Pm9moNle31uwCp1Dhw3pLZUbce/cvRWk+JgyGaTYTO5+XRk0BSBfFIyPxfRmlIfkSjRYwjBg6xp3mqHi3yicVsaOWPCebGNK9zxMX4NUyCBAvp1ZGKaZpkYzacVnuUhwX6h6TcKXwBR4dijak8eDb5QbiMedErvBqs1BLOKpn5qcEFNAu4nerFfNgTD3y2Ky+RKwH1doojW176xZTNDBjdx55zDS5zvNIrcTEW4hYZJdM11QRsG6wS/J0PIbS3q9upPnBgRna5/ZURI6bwLxqbubgvJMhWaXKktp5rHrGsNof6LJyqP08hW1TSn4pks1nDxIR3Awk1KhbfPif1WTdwf7tBAifz6xATQNsDOGNIpU6SZ9/9HsFJ2iQ2Tfk19LXgvSrat0DsQRmIH6LauH/tDpiDv7Hb3e3sG1zqwFxA1+V+og8zJXEiwPjMqNJ1gTIcGDUyYXjEpwPWmSzCUkHCbM38+5RJTyb6MrzIIEb1rxbzDjiySOAHZkAXRJQx4DX/NPTUcZAkN15PnE3z6GoOCX73B0fevuOxPFtcOfZzzYt2wzz1FLMHBCBKH/nJMbMBv6oKSy0uvktgsUjXcV6SdpUd5P4++cJRcc+yRXK/NYtPUo80Bi8bWPvPG7e01F6nJt18X6UiZpUG6dF2nqXPhrmXgf7FGNyhRhJF2pVcJlGwr1U4q25CjO9HvehCPVRWx3a6352pQQj8nhYGDTvAuS29Nn5/Hyu/3he3AQyu8gJ/Ar00a7FMcencJdCFRrNZsxG6trM2s7ScxrndZSWR3v5Leb9JAP5Yk8cCWV1z5fWVPnu7oVRHufyvbWPkqbIhRcctDSGeL0Wld5JQuQZit0ECZP/yffxyjRqsnaeMeOg1dG0CksH/iFnMyvsYo+YYKgvPL6vHaPm+S4bWR2Zq8IY1U1aE1ItMw0f1h0eXguCNfWC4QS2LB9HyP/zNU0ogIZIpVgxM28BYkr1viXEuv+z8NLExVnzaIcjuiKfCYOutG8J9iyo8YsgcyWZd5bqEwhzYToWZa2qm27JGWswqnH18p6INoXbkC5kLVhuFq5MDREWd2RCFAlkdAFkyavX9/Z7YTowuj6296TOqk3QihOIvQd6WhOuGIezlvsXGVu5UtiZ+u3cK01TQKB6X4I6UC1bnyFEpVLBbWfCQkOYeGxOVG+lPIf5l9U4UPuf0kwr6DQf/LbD418Qk+IEFfFRDlEFcPxhHSKBzzV5KR/QG3E5jO6AE3LHDSFbUHUiCP+T6pbuTGGtP/occnsrNXrtEn5U8M2ukitpp04Rg7rx1nYbgomkXmZORZtcZkMYKq X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 13c3db89-9a97-48db-430c-08d8cf279479 X-MS-Exchange-CrossTenant-AuthSource: BN8PR10MB3570.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Feb 2021 07:26:57.7032 (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: T1O9MPl7yFQTM+pceZUEzbdt2inEZKOP5qZlG/JCxsWBPh8FH4mGxpwLbrp7f8HLJAIpNcY30KQE8oEnHT8+oy49iVWNWBg2fwOWCHARZds= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN0PR10MB5254 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9892 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 adultscore=0 mlxlogscore=999 mlxscore=0 suspectscore=0 malwarescore=0 phishscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102120053 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9892 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 mlxscore=0 mlxlogscore=999 spamscore=0 impostorscore=0 malwarescore=0 clxscore=1015 suspectscore=0 adultscore=0 bulkscore=0 lowpriorityscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102120053 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org target_submit_cmd_map_sgls is being removed, so convert srpt to the new submission API. srpt uses target_stop_session to sync session shutdown with lio core, so we use target_init_cmd/target_submit_prep/target_submit, because target_init_cmd will detect the target_stop_session call and return an error. Cc: Bart Van Assche Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig --- 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 Fri Feb 12 07:26:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 382138 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=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 54AD5C433E6 for ; Fri, 12 Feb 2021 07:28:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 20E9764E39 for ; Fri, 12 Feb 2021 07:28:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229871AbhBLH2U (ORCPT ); Fri, 12 Feb 2021 02:28:20 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:37206 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229813AbhBLH1v (ORCPT ); Fri, 12 Feb 2021 02:27:51 -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 11C7Phwm142696; Fri, 12 Feb 2021 07:27:02 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=pRdQeo/sTOP/QBzAAVhwIqlkUihfgmwl0EDnTreNh9c=; b=PXPfm96kqRyMb1GaWVu1ciHAnflzpjCu2V9LrPx32gvGoPlU0US/gdaXVhvYvSIgALdZ Jt4hKrRt0UO7Y27gq7WvqOSCVt4Z8ZVrWb1hXgYPDu6M/4PFl3bQJwz5dNIJBxLdks2l 8MjaVjQmtjPKrwa74/VKLOUtc9NCdwboPDimeUQwHNRacK1rB38WW4INQ9aWZ6gnOwZY qMZJrMZcF4ck5BJCyxJt2qRedOPidvNpLWlP2+7CH9JkAze7bXDWWVPpt3BBfYx9AjmE db/9P17wFvWW4iSrn0IzzLaXCBcXTSTFyrOoEY+SEnJToFJOjiilhAcGjupb5ejuirMO 7A== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2120.oracle.com with ESMTP id 36m4uq0qma-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Feb 2021 07:27:02 +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 11C7OnuQ012963; Fri, 12 Feb 2021 07:27:01 GMT Received: from nam04-mw2-obe.outbound.protection.outlook.com (mail-mw2nam08lp2171.outbound.protection.outlook.com [104.47.73.171]) by userp3020.oracle.com with ESMTP id 36j4vvcbub-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Feb 2021 07:27:01 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=a/gCW0Y8cQHevLd3uC8njisJRsFY5rbabWv9R25G0PRRjCOXf9g8LP+IG8fzGg94FqyB4HsHi83gIV3RPaobmCPf2SqCdHIwKHAbjptl2EoOQ7yLdO8IQfKBQJSDMnfqiqPwgU+i2bXewv+q9soOV99f7g+b+Iwg84+9upa3GEJYQy76z7CCS/xjVZc78pZxM7oJuW4JdibnQ5ZtuCnrc7ckTXDDsbT+IxE4N8C8EQv7K8UTZIvmY4VugOKFF9MI+6atZfkVmRnTlqSjxrXgI1iCLUTbu13LbxOioUldb11WJaf5zHxwklc/2WPOfcMdQCyrAPpTIR5wbltZ3T3Q5Q== 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=pRdQeo/sTOP/QBzAAVhwIqlkUihfgmwl0EDnTreNh9c=; b=aq8qiJxtOZaEbsjQlSj/aEbE5GaMWm1RonQ4UvscXnTM245lY09OAIHwUTr798hvufhpeGF6zBOTj3TUzgbB/xzDhc0E+EtvMC3POslpp2sWyD+CarHzQXnm4luwhwBIVLRbKKsgRx6aOgqcVCcNTi7CKDqUiymfnETRqy8hn3/FF5xyddNRBFjcI6ZY8r6cNHZ6YT0QJNgO68XtyGzxiUop7a4w4fXz8G62A5Y56LiiuNCtmLM9NhQtPvxdavfm+36EA5EZzpBiLc0bzZgx/kJoaJ8eW4W2FLs+qfmchUGOAdSDFYSQnmIsYk247N5TOWntC2kwQYnO0Z2C3wMdkQ== 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=pRdQeo/sTOP/QBzAAVhwIqlkUihfgmwl0EDnTreNh9c=; b=ghyHt+cYjXQgRjD+9bauc7bGdj1ShMI4WnM0Gn4LR9ShE0GLRoqzmYdZxtv+OTEWy53lRBi8YQZJHx/uD9rqTtr7vHK3+K+L4r/9Z8r8KYNnMHEq+bbvHImpmCfj0nimOK/ZATPg2qLkQ2eZyA9BROnZC5UtDjY5FK7te8WWJo4= Authentication-Results: redhat.com; dkim=none (message not signed) header.d=none; redhat.com; dmarc=none action=none header.from=oracle.com; Received: from BN8PR10MB3570.namprd10.prod.outlook.com (2603:10b6:408:ae::12) by BN0PR10MB5254.namprd10.prod.outlook.com (2603:10b6:408:12f::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.25; Fri, 12 Feb 2021 07:27:00 +0000 Received: from BN8PR10MB3570.namprd10.prod.outlook.com ([fe80::513a:2259:52d5:e495]) by BN8PR10MB3570.namprd10.prod.outlook.com ([fe80::513a:2259:52d5:e495%4]) with mapi id 15.20.3846.027; Fri, 12 Feb 2021 07:27:00 +0000 From: Mike Christie To: 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 Subject: [PATCH 07/25] qla2xxx: Convert to new submission API Date: Fri, 12 Feb 2021 01:26:24 -0600 Message-Id: <20210212072642.17520-8-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210212072642.17520-1-michael.christie@oracle.com> References: <20210212072642.17520-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: CH2PR14CA0050.namprd14.prod.outlook.com (2603:10b6:610:56::30) To BN8PR10MB3570.namprd10.prod.outlook.com (2603:10b6:408:ae::12) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by CH2PR14CA0050.namprd14.prod.outlook.com (2603:10b6:610:56::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.27 via Frontend Transport; Fri, 12 Feb 2021 07:26:59 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: cb60b18a-6362-40e2-ec0f-08d8cf2795ea X-MS-TrafficTypeDiagnostic: BN0PR10MB5254: 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: EiI7YOFdW27R46BLcEhoZpdph044PuDQyXKoMS3JuoYUbrco31V/md3KVp+dZQeQOR/qCxRw6ImCkYs3cxPZp7/z4zeztkfSuZVTMm9mX2nXXcRNTbFN3KLEiJ2MuhbRxJ3O+PNGeummbzob4+TggWp7rq1KY8yN/ke8WzCekA4BBAsqqaSk6eQVYG2ZOXqgotrje4IfGpwn4AtC0qLmvygOLe6Qdb7FgL7XSk8UJJSa93VhmS1uUJFuVhQ36AdaAqnajs51aJ1SCkxwhEkEJjewD+dnHfVOWpEleToGihMAkMwwIkxwU7mrHNDooZ9iLjzv5ag/aACPgTAfkNuMNMQvI51P08Phd+H28OGoNvPxOIq8/8VbP2kbW27YPG557H5sX/O+e/wNq3GFpnsr8jAgCxHRRmocCYnpengEb/YuC2pNMmHXvzni7g5wQr8uYfsLUb9Ufo18pb3U+gedaPy+zotyH46fzaLvNLXf5w88tRMgefzoPNEx5vZSH3wPz3BebmqN8Rfb0ELQcNpb2vmg0WcCe22hbaqK3l1hZ1w+thYRcmaRhsKlLqxEZ+2feJeqQEKb7R/Hw2SdV1Gx+A== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BN8PR10MB3570.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(396003)(39860400002)(346002)(136003)(366004)(376002)(8676002)(2616005)(4326008)(316002)(8936002)(6512007)(66476007)(16526019)(26005)(956004)(6666004)(54906003)(69590400011)(186003)(83380400001)(36756003)(5660300002)(52116002)(1076003)(66556008)(478600001)(66946007)(86362001)(6506007)(2906002)(6486002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: ghUwlXkdeGI9m6Ayen3QKdSIimiSRVFPZDiEcurhoyrOoLMH8drpQp/70fdtUuWTpEU8ZVCzZwlnJJnZyGxCMEatReRcONmIVR4+uRStn14RA1ykdg13o/CF/XTlw3lpiaJVdGhV6QpQ2t773iH2nLAhCGV6xsMTJHA5Wfm5mzsQeGHYqrUiNG2OiklvmPgKEDsicvaQzxxnDIduT132BRjLZvHwU/TmHSWMQ/WorjHUTZ1NIXCj8t/s16OtOzWePFlDtquPcpb4M8sR0FmBAKuuIvAV+Zw4/Q87wh7OiON785+QLbzCnjHEzIXygHhjm39pfKFcKpAgr2yA2s0PU4EPCy+bCH4FDoq2GxDbRgdcwFlg3aJWq9iQ9RiqoB10jMjMm3dVDWXhqGYSgF2NHG97AssnUqieyASr5oXeFi/MJL+8zPdBtrQmPSCb4l0m5qY+sERjuelSNRElGUl8pCLwEWz7n0tmdH4DxcEPHn8Lq/4Ig60Bv9YVUuD4f2AaQbfV0lwyDyaSixSq7i6brelxIbf+kUC9BtxQGUHQzcq4Rkr1dAfwhVrlw35eIgDOjaYHoWdO3rnJ2tCQBthqve4PHOncpbYubAKF8lbpShMgHxaEUZS5VI2arfzjwpE74DCC9vuOsPUNFBl5WSgv/OYvmeU2RnOCr+bsCbYLFO/g52Ebq0kA2L4HhqbjSsbHKOaZRsfiA2DWAehf+ZHGWxL9akn00iMRY7hpAaxtBdI2bLDNOzWf5lVJu8c20S9MyTuGC795d/Z2hwB8TZ9iv+hqSKYRTlmBFt7FNXy5ELbIVqTzi9LiR4fLQ8x1IzBhCrGvwRwUHG0KJglOkAGiknCzQa9aiPYZxZoSoQnmUXLwyDbqSySVB+r5+lpHP4O8s8mgr2yZTXX/9+eKqnKvaBGlDP4B/onqqlAM1OtZN3k6GAFDXZT/vPQXvbBpSXz5BsJmH4M5zgcmkn9vA18nxricDk1iDs91aI/veQaRwws3fb1iiXjynKQWenamH6Wh60nuIY0Nhj8ahc5NJhVkkrXp6ta1SQ7KLq8ktG0vK9PjK3I04/ECsIN7EgDjtg6hnpoOjWgaofEF+A5ax47Se6ye72enfj31TnhaqCkausJBvVnTtmmf6Xrlp4o5c9zE08RvSWtiHwX8NKPkSnuKgZH2toQH3Kgd8j9WBHsQXMN9SXIG26jjwlvUUDeZEV+NT+A1+LKHLk3luI1z6YQCi5MoHDi1wXmt1ZkFqKz82BLIEnLL7zSTnDBX+00kcAUIy9ZiOlHEMGOPDnixaNj31dphTgClavC8OaetNw6QYk1o1E+AuGS0ihid707nGosH X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: cb60b18a-6362-40e2-ec0f-08d8cf2795ea X-MS-Exchange-CrossTenant-AuthSource: BN8PR10MB3570.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Feb 2021 07:27:00.0569 (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: r8YEWHGiDqpQ9MV0Q7m/EVW9Lj9mjaIAg4voSKD34UNzZM3IANiGSuWGetzUDcDXOQ9RDk3leR/EUAOIJSEAujh/UYwSeHdR3IG7RlnVJ4o= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN0PR10MB5254 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9892 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 adultscore=0 mlxlogscore=999 mlxscore=0 suspectscore=0 malwarescore=0 phishscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102120053 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9892 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 mlxscore=0 mlxlogscore=999 spamscore=0 impostorscore=0 malwarescore=0 clxscore=1015 suspectscore=0 adultscore=0 bulkscore=0 lowpriorityscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102120053 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org target_submit_cmd is now only for simple drivers that do their own sync during shutdown and do not use target_stop_session. tcm_qla2xxx uses target_stop_session to sync session shutdown with lio core, so we use target_init_cmd/target_submit_prep/target_submit, because target_init_cmd will detect the target_stop_session call and return an error. Cc: Nilesh Javali Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig Reviewed-by: Himanshu Madhani --- 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 Fri Feb 12 07:26:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 382135 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 97390C433E6 for ; Fri, 12 Feb 2021 07:31:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6F11564E57 for ; Fri, 12 Feb 2021 07:31:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229730AbhBLHbB (ORCPT ); Fri, 12 Feb 2021 02:31:01 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:60542 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229896AbhBLH3x (ORCPT ); Fri, 12 Feb 2021 02:29:53 -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 11C7ODtv176445; Fri, 12 Feb 2021 07:27:04 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=Com9l92nrEWstuwbvXG/f7NfTZYIRBHd8iREgbVeOtj3akMFaBa/9IDXctQu41iTl1SS XurtSE6mW1ACO2T7iBrXs4lFEgk8KguhvV5sDtUN2/n9IFczew1Daft22ZaNYlZ9BUI0 2Pw+Pe/5DRmHPZ/PvFHLjlzn7+dL9lt9qkPipPLeNfUpqqopS0wSwY5M9c16RrDz16ik zcYdFs4O/Gc5F4Pez3dbJ/oaRMD/bXP5cdb3oVvFSjBtlloxz4JIoWitGdd+FQlUsjGa PUpFLYvW+NrOLMpVz1S2aS/iJQ3XWJ+Te4Sci+HS7jGz/PIPiVWmAZAyXu7Fh3iqQ6gX Ig== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2130.oracle.com with ESMTP id 36hgmataw2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Feb 2021 07:27:04 +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 11C7OnuS012963; Fri, 12 Feb 2021 07:27:03 GMT Received: from nam04-mw2-obe.outbound.protection.outlook.com (mail-mw2nam08lp2171.outbound.protection.outlook.com [104.47.73.171]) by userp3020.oracle.com with ESMTP id 36j4vvcbub-6 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Feb 2021 07:27:03 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=B60Vj0us5trCSBg5wWVCsZF+YLq2YiHlA8yocDd2v73YVR6GUMiYwg1YfQFsYWLXhnKnSZL2VV0ST8DyzlNQQakcxilPzwukh84QOKACrcwTb6f1ukzPN+iB1Sydkwzj+qkjqOGnwfhW1ApbqXg+UwcbpuPab0MbUVherK9zZt7kYrCSY8I+tSVtHfMFlrkeqHlZFJt4tAMTY+xfzPov97RcN9f5xbiG84J39FzdePkg+xPDfXKaH70dragO7XqVOxDlRsGOEkSwmtMeW8vk1soscudekWThb2regF4+FVzASYI6wdVu1+nVYZI1BhLsh7u+FJaQrZr4T3IEaV9V8w== 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=JiehVUFbz9NjZjQvm7AQvaG5UfNTp9UDKd3faov7pE4WBBrNTt0ygX5q400TwK/gnpRFdkeRVUzdWNOqoOQ4q4doSOjAgkArhJ/2YfrFvHuTJSgYOI8fT2xbdg4j2tT9bzhUsFWF32ZdLdtbJVnxAlztkQXuKBvnWdHrBJ4I2c9CTHqDgimo1CsUNSER01PghEQR5raCmctedfkRXw1dr/k/IY317TJT2ZdnqQdWtDwis1OKDT+g2EDYzOD9v5IBW3WSi34IvMRRuQHwa37A/yWRVdsk0+YK+RBX4GyrXpWyIgjcv31i4fOjahOeDkMguwu91sDlLZSqOhafhFp4Rw== 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=wYCISQJuPTtJRFl+4R9qY2AgH+t6QcnWGIB6REMvbuR89ekzXo3d+3oE6IOaE2QXr/tqKwkZHbok76rE7jCGpcauVXmZYitnyc9q3xuYdconWxidM5vI6HE2AeEngKXr2P//Y9nlajD8iaEvdsZgP7dHXH/BaV6GW0I09YxxAxg= Authentication-Results: redhat.com; dkim=none (message not signed) header.d=none; redhat.com; dmarc=none action=none header.from=oracle.com; Received: from BN8PR10MB3570.namprd10.prod.outlook.com (2603:10b6:408:ae::12) by BN0PR10MB5254.namprd10.prod.outlook.com (2603:10b6:408:12f::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.25; Fri, 12 Feb 2021 07:27:02 +0000 Received: from BN8PR10MB3570.namprd10.prod.outlook.com ([fe80::513a:2259:52d5:e495]) by BN8PR10MB3570.namprd10.prod.outlook.com ([fe80::513a:2259:52d5:e495%4]) with mapi id 15.20.3846.027; Fri, 12 Feb 2021 07:27:02 +0000 From: Mike Christie To: 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: Fri, 12 Feb 2021 01:26:26 -0600 Message-Id: <20210212072642.17520-10-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210212072642.17520-1-michael.christie@oracle.com> References: <20210212072642.17520-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: CH2PR14CA0050.namprd14.prod.outlook.com (2603:10b6:610:56::30) To BN8PR10MB3570.namprd10.prod.outlook.com (2603:10b6:408:ae::12) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by CH2PR14CA0050.namprd14.prod.outlook.com (2603:10b6:610:56::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.27 via Frontend Transport; Fri, 12 Feb 2021 07:27:01 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 98bc28d9-fa15-4016-e7a6-08d8cf27971d X-MS-TrafficTypeDiagnostic: BN0PR10MB5254: 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: gF4FQSqFcb7k6Weg3A/xk1k03GKAGucKDbrbnxmrNHu5x7XUgoAz6pxPzPSuwPe3Namf+KHDCohNq36RPS9tuVnOb+4BpjO0Bn2lki1vOZZX4xuR4si2Hoq5JrCDUVyxgvfu1aoperx6yDtWL0K/mx1kLGerL4BQmkOZ/onimuOcxYurEU00xATPnbpSxiphza2GdkNSwkJ49HPL9qdFLDIxKM7K3X9E0YEsjfQJBS0rGvUdlZrOPlRixOSvv0FHV4bc4HLU9c7il2JIeeJO7dMUtxgIG+cujsgy7KWFivRzCSjI4r5BFip484vhigoyYtK1Vx+O3CalucSaB3/PurjnGq7QAEINzkwe2doPWaUuu0AtonZYrKTW4DPoXM7VHPFATRjHxP/U57a12a+cv+CTu/02s9N2GjBP1YjlOvBp9/g+lmCL7raE6D3fzv68vv1rG3VGaQ5Lra7ri5T5HKiIX38RsS0tdshvRALhhawWKFjpsCliCm+4vkJ+kbEt2CNioJLUr4BQ/mtnpCwTvkOGeUDry/CHjsH+CvYV6POwqOzhf898cWt7nfxRmAtRWDZHsn7YXzkUnnRjJG7Ebw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BN8PR10MB3570.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(396003)(39860400002)(346002)(136003)(366004)(376002)(8676002)(2616005)(4326008)(316002)(8936002)(6512007)(66476007)(16526019)(26005)(956004)(6666004)(54906003)(69590400011)(186003)(83380400001)(36756003)(5660300002)(52116002)(1076003)(66556008)(478600001)(66946007)(86362001)(6506007)(2906002)(6486002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: Y3BWqY1qyUpBIoEDE9p2NgVCyVJpB/t2P/rzjjAUT6ek5I8J26zVmpV7sVsUFzaYOug7zZQkOYpbMWL6jt8gQ2mD3quK5VrV7PzipUTHmjkI75VxoRu11d/4dP48s7pWs96mAE/METIvcYO+RuTavzbDdZIbm4IYECdIv65/vdJO0BVw/IqzUjGsOwA9R9LktHyhoE0kfsO6ntq5Gggk1QJQL+lxHrozswNOJXh5DA+E1Ey9ncO8VmbwD1FRkha/1MEzNM1IkCAvBGEiIB4CxldArnLzxOH2BDoTKhgS2Y1g7qkjoJFutUv/bznKmwayGYCAXFXPYocZIjA97HEtZbltNgyKmGFK4kne6JrbgkcIZ1aL4Tuqeqv7ShAfXBUPGYhoLWIqdfRAJv16Ha1/XWQgprfx6SLB/+SWw3k53MOh7x0rvsraXtsP7zo/CBa/dsMJ9fHags1Oq8POA7ZWb9BZv7AzOEyYVnNOp7cyby1i/xuzmwy4F3T44P7le4Xl6KIC8vsnxP6lqMhEh5AnRCQGc2/7c06Gti/Bk/61FNyKR+J2qSEq/zGAIPuq93Cft6gf8mEC1EShr2bBTyN+DSXKd1G2FyaGrW8PBeAcFirGBZCrcugRIYWDYKRRFerjw0AdYTbu89BvFhbD6WKNhZ4M9jTwxnNzbuOCCp+z4PxNSi2fVQc0nNUqdhJeQqyMF7gwnPbkIdjCKn/Rnfe1OLk/TOr/EJ4QBoTJIGojbr6HJha9WD3t5gEzc5NJ1FAnYUspKzF9VmtvM+XgD2fGj2Oh9FSIyqbHKIcW/o5Wj8u8dCjvbRa325c6Ctq+Goi+rfbfzGTTDaqbaBZaHaCLyW4hXukG6IKn+vTsNBv/J4dDYUbe8sBDvgqOb00ui8hQp7zvo1wQLsNRyIF3OFOjRUInZPw7s5zJvA49onk3oU40UQkPJ3amikzWKiwbXq158vGTVYviyPu5zVrcqTWmrSbwdW6x1jTmjl/WkzWcCjic1hJ5yOT63UuNEjBXwOhpYNjXFw/08wfVHDHip8hVY0IyvB9eBCSITKp8JECkoVFQ2uW481F1i1kv/V0hjjSTEMc/wKSJfIYP0TCbLNUtO5OlbUk6xnUlTmz9E1XbUrvnp0Kg531tcN0Dn2gXSSRNwDAD+m4j5esGgddZ8Q78nrtNQWHLlulAzl2y5Oz9jITnRKHe+xdkPOKK0pkUsZv3RMHIgECzIWE0CU24wdzm6XzFFzgp+cghQb5iLdm3C3Murq1AyXSQSnho82sWI+zALZ/Euyivt8u7HS8ePShxRlTAfcsWnU0+FLmGaMdPjkbe6Nm/hN0zqmtE7tG4zuHx X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 98bc28d9-fa15-4016-e7a6-08d8cf27971d X-MS-Exchange-CrossTenant-AuthSource: BN8PR10MB3570.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Feb 2021 07:27:02.0957 (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: oVkTJykZvhJrJTLR6tLy4nDywFdo4L4ojLiBJ7mNBxAi5kA67RQAclSMqjL60hVwWILLOto48Z244zybmELH2//G81Z4w5zTbARtmwjyLw0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN0PR10MB5254 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9892 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 adultscore=0 mlxlogscore=999 mlxscore=0 suspectscore=0 malwarescore=0 phishscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102120053 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9892 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 spamscore=0 lowpriorityscore=0 phishscore=0 adultscore=0 impostorscore=0 suspectscore=0 mlxscore=0 clxscore=1015 mlxlogscore=999 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102120053 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org target_submit_cmd is now only for simple drivers that do their own sync during shutdown and do not use target_stop_session. It will never return a failure, so we can remove that code from the driver. Cc: Chris Boot Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig --- drivers/target/sbp/sbp_target.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/target/sbp/sbp_target.c b/drivers/target/sbp/sbp_target.c index e4a9b9fe3dfb..f467c50aee08 100644 --- a/drivers/target/sbp/sbp_target.c +++ b/drivers/target/sbp/sbp_target.c @@ -1218,11 +1218,9 @@ static void sbp_handle_command(struct sbp_target_request *req) /* only used for printk until we do TMRs */ req->se_cmd.tag = req->orb_pointer; - if (target_submit_cmd(&req->se_cmd, sess->se_sess, req->cmd_buf, - req->sense_buf, unpacked_lun, data_length, - TCM_SIMPLE_TAG, data_dir, TARGET_SCF_ACK_KREF)) - goto err; - + target_submit_cmd(&req->se_cmd, sess->se_sess, req->cmd_buf, + req->sense_buf, unpacked_lun, data_length, + TCM_SIMPLE_TAG, data_dir, TARGET_SCF_ACK_KREF); return; err: From patchwork Fri Feb 12 07:26:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 382137 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=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 F2905C433DB for ; Fri, 12 Feb 2021 07:28:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CC75C64E65 for ; Fri, 12 Feb 2021 07:28:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229881AbhBLH2X (ORCPT ); Fri, 12 Feb 2021 02:28:23 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:40316 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229608AbhBLH1w (ORCPT ); Fri, 12 Feb 2021 02:27:52 -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 11C7P959016730; Fri, 12 Feb 2021 07:27:05 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=bhjY+7O+YpSMy5BzTmY8G8z2RPzmG94pATCAVQ3ucWIDwdKN95sziAxxLTynt0xwP+4t aiKbXgoJsTitPwIMcESpR7bAOakeUA1Oxrp9ObHNn3Hhjkh8lkw5b8oDrsqQKeKdBOGG tbcStI3lM1gLRG8RriV9+m/kz7l1UsSEVg04I1hYArbjMuqWwg8PDrh3Qfp1LDmGbSQO /qrVfXe7k8j3egaQb9Cq5XXmteQSparX0QdyOZp7y0KaIjjqSZy847BVI7CVLbnmQXvy zhTZ3SDWGe9jk9QkrlWJRJcKKXOgnzzVT2JeS7tdFfZRD/WeREf2mECNXNuno1ywEsqE YQ== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2130.oracle.com with ESMTP id 36mv9dvcuj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Feb 2021 07:27:05 +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 11C7P9RM168446; Fri, 12 Feb 2021 07:27:05 GMT Received: from nam04-mw2-obe.outbound.protection.outlook.com (mail-mw2nam08lp2171.outbound.protection.outlook.com [104.47.73.171]) by userp3030.oracle.com with ESMTP id 36j5214tpg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Feb 2021 07:27:04 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=L5fJjscJ46ItLcibkiF2GTfkXA9rtQ4gYnw35Vf3hvV+mI+tG4Dh3opRBwvVnFwClxaNEkIUbrkGbStJSIvygSaQzWrbNjQIE3+rruexXzVjOW59hAsVJSYk+9qtIk9vK1phVaXvkmGOnXyfceilcoMZd7UPYbYyMlqfIDrDFSI6+6RfKkq+unEQmHlnLvnhxo5iqlicVZfOOsqRU4wTCfgQ0Q6zTv2w8iojg9+Ak0UEM6Ongngg2+6H+MgQjrBfWpN6b/vdlvFcdTwq1u3Imhnlg4oVYnjRPfKdoONlg7+a6HLrNJLVlmcf4brvNBA3Vi7aZdZZReQAqhDjZ/Lxvg== 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=DaQrY7Y7bT2QHK+RBHkdjOC9VTVdZ3+BJXGMLaiVwm3EMZcgSyRj0Da0APoN13/X73WSTs5dquItqGZIaUcIVvQhQrJstrOHy0VMJlpsBcUFyCWKmKu7twoAXlXNX/Om4yytOjXoxfwuA9EBYIxXZF3Z5rhX2kuyBP/a35/teJzQYFKLKk63Y7n+qsQaV9m3Po3EvpMWtrMQQ/QbI2tYD/c/35RBvGPUJJbzZy9GenARh9wA4BLTeRYAnsdikr+72O/N3C6VqcolYUrqm9GJgmerERmYiWnMj43SsMXGYQd5jxn8Cm0xUjCkilPBQ4YG71+t8seDSzRV0M7McZNU+A== 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=Ja4FFaqYX4cmwm+xPKYaiRXEFCPgMCVji22oMoA+M2xdh+KyYZ37Y+MjkSBbtHzfQoMZW4NchY6IrQ2urj+NqoeJXFh9ITSZhFY83PKvtpXb+ce5Z62jLbApqtIF1z2Qr927d039tpPyl3vm/t8ZMXMU2uIIe8Ard1foQ83MOk0= Authentication-Results: redhat.com; dkim=none (message not signed) header.d=none; redhat.com; dmarc=none action=none header.from=oracle.com; Received: from BN8PR10MB3570.namprd10.prod.outlook.com (2603:10b6:408:ae::12) by BN0PR10MB5254.namprd10.prod.outlook.com (2603:10b6:408:12f::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.25; Fri, 12 Feb 2021 07:27:03 +0000 Received: from BN8PR10MB3570.namprd10.prod.outlook.com ([fe80::513a:2259:52d5:e495]) by BN8PR10MB3570.namprd10.prod.outlook.com ([fe80::513a:2259:52d5:e495%4]) with mapi id 15.20.3846.027; Fri, 12 Feb 2021 07:27:03 +0000 From: Mike Christie To: 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: Fri, 12 Feb 2021 01:26:27 -0600 Message-Id: <20210212072642.17520-11-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210212072642.17520-1-michael.christie@oracle.com> References: <20210212072642.17520-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: CH2PR14CA0050.namprd14.prod.outlook.com (2603:10b6:610:56::30) To BN8PR10MB3570.namprd10.prod.outlook.com (2603:10b6:408:ae::12) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by CH2PR14CA0050.namprd14.prod.outlook.com (2603:10b6:610:56::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.27 via Frontend Transport; Fri, 12 Feb 2021 07:27:02 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a29a7093-4ad5-4e7a-5a3e-08d8cf2797bc X-MS-TrafficTypeDiagnostic: BN0PR10MB5254: 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: ebkDSY3VFNlhpj6Aylr9IZkO+UneAsTHsyWtk1p7WLrEm7V3hkb10kjHkARHoH0fghm1/lUR6uUUNA3AVPYstUbQDT9oPmXG2bSHFCzQ+IF6YKL6yKdmuQ1lohcd426zElVVTB7Xc+8zR4qPKdKY71oqoqwsAJd0R93iq1kdJ/934yJ5jUuVZBG99x5KTC9oogQ9LTWdt3q56LpDSLFrIAnfpQXYT+fFaEX6kX33/MKY7eL5lgZBNlnMSgHxL6CPplPhxI6aMKZY/TG42Wj/29DzyZ4uKHe0PakA3jOHmM0UQP/LmikvbqZVxenMMXi+3R+yubIjCgfj1+C7R3JBZN8SkugE9PLUWBt/owUefWyfheYL29ttJicEnfxq3vA8hsYNVMt4r7IgkqoKRC02AkV07hGNJSxgYlQUwzc+Vld0dFQ1vVyQIfv1GHS9cxOkhi007jNrq1pabaOMzDosjSv2nCL3ZqFMAEqEH+1cpJzbUtt5anLtUXq6GcLv1ZAyjOKkde+hT1QD5sQgC+TAvE9oD4gPo/NTdVN0+SbeDeMEXIJsx34aTNUIgeHPBqeLy7BCP14DlVhllI0MI5aKJA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BN8PR10MB3570.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(396003)(39860400002)(346002)(136003)(366004)(376002)(8676002)(2616005)(4326008)(316002)(8936002)(6512007)(66476007)(16526019)(26005)(956004)(6666004)(54906003)(69590400011)(186003)(83380400001)(36756003)(5660300002)(52116002)(1076003)(66556008)(478600001)(66946007)(86362001)(6506007)(2906002)(6486002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: IgAg+hUHXYDi6a1bRHhVj6jQh8+FGkQNgjbchkwKNGSafMAIBkubhWtMShvIqWLbENF01LgDaBK1IiTrh2fiQyDeMuTgeZW/c03qZHw0VZB6AXEgAjmhfw8w8Nsbw0jEk//+LwsyTx9z3pon9BUIEczuIaxZGUsT+p2dNGlvbpM6vGgSut3cfz3BzfPFj/yj0JrFSePYWuc2970RK/q+Zh0oPw0yTv5y2Qvx1SLXGuvdpOfjRaAFom+zzHcMVdgF9gu6sJAmr3exFuqdS7OFSz6GqheGIYSGB5Wn7s77vIEnPm7NnjMvBzCCqhebiC0REQ7Brw//aAjop9ZjOWAtlRtiUUpUFyCb3D4Fxk/l4xY/iZmlUsd/Sx8nYq2xw2vZxh8Zfa4jAkY7qgSkXs4y3w0Dqwvny7B4DsEfIxYfa5wRWcluWD/rrv7K+CJRc7xMeDk0X8kqOSTGDQ6fxysT5DEZKXzN012RFEZKJJ6p3v1TSwPs8dEio00OjjWyCelUhebuL4EW7Bn8BPNqKRsz8EtVLrg9HaU3nRipGbYP6eRrH+DivirwRGFx6J6gBrHhnopCHo8l4gQuNVb4WA7ywNhtsliCprgvVZF4hc1hCaUZhuaGA4Pxm4aJc/8uyJQ/S1nUnqbKbHzdZjHZ6FJX+cublx1gDvOnILPLqmCeBEeMgxUHNcYc24mNl4z5O5zm8C5kjBGs7sPFdVJY0o6QVKM1wG0sP9q5rW4eWfO/b3u2/HJdz88ZY38hB1aMrSEE1gY9fMLEOWUtB02MHEMXZkRJigYGai+cbnYU3tj32L0INLH+LiKonk8BeuWjs2hHhVMSJTXd1zrAbs/RpQCrGqIt1AkYxMl31dHsQIW9JXdEc7NbgsLrR7ZKfnEOXgSABJWFi0nYS3S+8TvOEWcKBbKgN26KnNuFVEGgRJiCfnNu/UxS9ZscoreQfjDhbkZdAy1SNYpJhr6qQZsDSw4PNkvM7JH0D2jWmnLwHdc7K8LIWimq+ozEKBZ0uo6xxW7BDhyNY1JKOFHjRW2yj9Xzfg6vFliTpeTC9II/jbUUmvjIEHAvamaqs72pi6Jwwvn+hr4M2TVDQvYGn9iT5nrNWUNwTQaTljdL/t3T+ILHXKeIyIPemvA41leAgddkLgCdLiI7aSimvMhaXoZmB00U5N6O0LxGWMzFg7Rv3Vp33sFnB1Wlost+tXK25uhsV2ydR82YRvYSiGtQrltQSCBgwhY1SWAWds5P0CIGndiZoVoiqkKToQaflMzrMOmVjNUyDrS/rlPrcnY6oe1vZ6ZF/qPhYqZx0XfF3vq5thufDRTwvbKL/vSe5elcdsRCKLH2 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: a29a7093-4ad5-4e7a-5a3e-08d8cf2797bc X-MS-Exchange-CrossTenant-AuthSource: BN8PR10MB3570.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Feb 2021 07:27:03.1301 (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: rTnPwvpMpBcHzVWE0KlYPqrbA5nJSw5sJIFiWqAh0lA2f1q4O2WRTDgEzEf4vKQboSvDw7jwRa+uy65bLoPF9FZgO/AvFnCIAtrsUYP6pKk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN0PR10MB5254 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9892 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 spamscore=0 phishscore=0 mlxscore=0 malwarescore=0 mlxlogscore=999 bulkscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102120053 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9892 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 mlxlogscore=999 bulkscore=0 suspectscore=0 phishscore=0 adultscore=0 impostorscore=0 mlxscore=0 clxscore=1015 lowpriorityscore=0 malwarescore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102120053 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org target_submit_cmd is now only for simple drivers that do their own sync during shutdown and do not use target_stop_session. It will never return a failure, so we can remove that code from the driver. 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 Fri Feb 12 07:26:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 382136 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 6B3F0C43381 for ; Fri, 12 Feb 2021 07:28:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3FF0B64E57 for ; Fri, 12 Feb 2021 07:28:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229892AbhBLH2u (ORCPT ); Fri, 12 Feb 2021 02:28:50 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:58772 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229837AbhBLH2J (ORCPT ); Fri, 12 Feb 2021 02:28:09 -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 11C7NpC3169882; Fri, 12 Feb 2021 07:27:06 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=bBZl6XcBVYvu11vuyYl+TAIQjHs6gWBpMsFsnqKb2cc=; b=B7tKhvwUrrZuuZpIv1BOXoqWYD8Z5z58ZZ8oCxIbR8r1kJKVhi7XrROUyMHlC3izSTs+ xnoFO/QScnN5lyxT6aCgC5lh0iNTrNJ9jXHegCI/mRzfEJbt7giZSMtg4p+ThCv5Uk5p qqeuhgAQy3kxoonaDQzwoOPJChedkRw8FiVQ3pyeJ7XwjpdjGqje/0cHOoDCa3D5lYQS pKqT7xwR57jLgwsEDb5aFxEz+KuUfhTXVmnJIqkBs6ah1+Ue1oNV81k/AsCdAc/SBa9X 1eDXr97CjrfDTS2YpTYxSiN2uUBw9xFmXYyMNRdsFRPZ/ENUQwlGnDrWFFFXKABLR2BC Qg== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2120.oracle.com with ESMTP id 36hkrna555-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Feb 2021 07:27:06 +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 11C7P9RN168446; Fri, 12 Feb 2021 07:27:05 GMT Received: from nam04-mw2-obe.outbound.protection.outlook.com (mail-mw2nam08lp2171.outbound.protection.outlook.com [104.47.73.171]) by userp3030.oracle.com with ESMTP id 36j5214tpg-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Feb 2021 07:27:05 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dpvBVx0Rngx2/cCu+BVfEXtBh0z3Cx8Qq/xH2CbFBmS8ESW/sU5D5oOezNxmy24L38VgCT6cg52SkuXJ0Wk2snfeRu3tmKtPo4EbaKPss5MmvoNgAdJf49YDVcQjD9/y1bx3kxQ92ZrWo6IXHFUgKz4r76Gbiy8M7Kl8nh5tRT1y0oe7B5VLwH9JSJv529SDg5edU9UrWZvuqXe0D7/uDNlQN5sb2wpr/2z0SpkL5kmvZQ8VlOxyyo5tQ+aCKRhEtY/qBDnTQvL+k9yYzD5rH9PULuBevWrsxWzOf9L+ntMoYcYiHiMdqIDy0OR76DJBvu0FNCngLaGMqSePLLUNkw== 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=bBZl6XcBVYvu11vuyYl+TAIQjHs6gWBpMsFsnqKb2cc=; b=GlOBrXTTJOgDU6Petsdfjibw3tRYTNyh8Fu62Oo2gKbEqK6kEweisQfCthT79Tkp11S6mkjOVy+mCVlJNuSgu0RCG7QP/DtYR2kKz3BmehqUX8iiUmZa0Hgvq7l8RC/pDp7d3deFZXT2lnb22wRjEGqxWqFLJzlAMeJZzS27EAQI+qMltn1lcRrr0mJZL8h/VepHgYI2xhAHZoQvwSnhjMphZcGtIvG4SMiN7toas4h10vABr9TW2DstfBMcQaSJIdUKPM4tOS0iMxdKDdRZTWFIODTWTDX6jOJ1LUPLN4MVtpNAla3+FGifm6+xu5RD6n+lbPcUYSgrFGnHlMQsPA== 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=bBZl6XcBVYvu11vuyYl+TAIQjHs6gWBpMsFsnqKb2cc=; b=i4LND/z2GboV1hK8OqIiB04GXhdK+uH1fqt9X2Vn7TAsnUXEnrYRc5sWaToSCQQV7RG0UAgnBV99C74TvBLUu5vwddCnwdsyvOUwixMyuSs9gAbcoUFN/xdry+qk6bJ+v4HDgZnWnvAmVFgoKu3gDTnU1clQ7NDFLm/XiGYqyCI= Authentication-Results: redhat.com; dkim=none (message not signed) header.d=none; redhat.com; dmarc=none action=none header.from=oracle.com; Received: from BN8PR10MB3570.namprd10.prod.outlook.com (2603:10b6:408:ae::12) by BN0PR10MB5254.namprd10.prod.outlook.com (2603:10b6:408:12f::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.25; Fri, 12 Feb 2021 07:27:04 +0000 Received: from BN8PR10MB3570.namprd10.prod.outlook.com ([fe80::513a:2259:52d5:e495]) by BN8PR10MB3570.namprd10.prod.outlook.com ([fe80::513a:2259:52d5:e495%4]) with mapi id 15.20.3846.027; Fri, 12 Feb 2021 07:27:04 +0000 From: Mike Christie To: 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: Fri, 12 Feb 2021 01:26:28 -0600 Message-Id: <20210212072642.17520-12-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210212072642.17520-1-michael.christie@oracle.com> References: <20210212072642.17520-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: CH2PR14CA0050.namprd14.prod.outlook.com (2603:10b6:610:56::30) To BN8PR10MB3570.namprd10.prod.outlook.com (2603:10b6:408:ae::12) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by CH2PR14CA0050.namprd14.prod.outlook.com (2603:10b6:610:56::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.27 via Frontend Transport; Fri, 12 Feb 2021 07:27:03 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 30efe28f-05c3-4089-53dd-08d8cf279853 X-MS-TrafficTypeDiagnostic: BN0PR10MB5254: 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: rou/GGQAm6+1R+pdbplv0J5giN++rFeUHqY3gUPNob0x5l6oqNeHUfGXvWW4av30tDnTf0v3hxsimWSxKbndmIQcTf15/AwNexo396y2H8v7MA6z0AVwnMtz1WqdwOXq7zSo/FKZ0/Gi5URe2E3xFlRaiVbtjl8NfR3eZBwVrHpV8tGriaaD23Vpm7T6LsHCLFXXh2iayz0rEs7xcg72498FUwE6B0TKq62Bd/j7K9xFJNbteQAvGXFuD63RENCZt4G7Ce9iLGznJTyiVjLbNfFPURVIC27G48ZCB6xtKehHuWQd9EZIlZF4QVG6J2W6kKo/Af50Ffx0C81EqNDtDRwWRTYP0u3pMcjFhGkwU3L7UKZOu9z9r3hoy1ceR3w2Tq8fslNiUUAj5T0xNRXUon1ZIeX1j4nvFvLLnH4YCDDWeoTCM/hFMWp6vIGXmEeP3UGJ0H+DkyrzlWbGzG/iyHWUJnmz8qBuRfLyKWaIkV8lizomMXdIwKkn9J37J68tbJgIyw45N1Dipo/AJ7jstwAKTeXwjYwjQ+lEhREKA3NFxGhypGGfG9ElSugEn+2N X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BN8PR10MB3570.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(396003)(39860400002)(346002)(136003)(366004)(376002)(8676002)(2616005)(4326008)(316002)(8936002)(6512007)(66476007)(16526019)(107886003)(26005)(956004)(6666004)(69590400011)(186003)(83380400001)(36756003)(5660300002)(52116002)(1076003)(66556008)(478600001)(66946007)(86362001)(6506007)(2906002)(6486002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: T0xuIxxooDr+fT3fleEx5o1jr4mUU2XX2zucHAR3cp6CqFYdiGtDtjoZgD3joJ4j8+NPhCE5xRgclAXsI0M9aoUN5ZaPW3vV0S51YZIUtf9ZMLDHDJhu3gieWz56MWPNaXDPn3U8+YO0O8ppwLHD/iDPCWVLzxi2pUXzSRCFQcWI0erVeDnB48B+Dzh4D8xD2NAmFdGrhhz/gvIZeI4H0R+9kkjhQNgorCNrwTbcCrr4h9W9coE5C5AhD1b3hqdZeuHhIsIfxHN264eRZ+3NMm25bwnCEo9PBaWWCl5NDiyY4WKHnYMzAvYTCNBilKExWdnUQbojYWo+6LukpWMmMoZI210dSVOzkFeGqXsldlpn26TjG1CXOlgGyD/5Me7DVCw4SsjlcDqG+nv0RH4Pt4OG1fExgewNwM/RkJeuA3DnSbPYLfJQOpzt2NJzHw53uXKZi1zdU7i5Qe4YAn4sRVM3cmP2P2MCJ80ULOdC6RzBOEIoL0Knrtd8z2g9gbIIl72hCEbpXaBcM5PB43dt7miBlIy35k8cnyiMGQCGkAJ2JBgIbrJb9ADV7k7BuQ6uhrTw4cJnhAtPGD/940V96uAvfgBY3wbVw38KobVXPfGeay6icyMmYyyUwiDtSDzZ3qDXnpo8xCyNgYu5zH1Run0tyAlHGgjTzJJQk9oNSJZmz8XhpZu6NFTxFxqk8rXoi37ukD6y66Dl6szpTi8qUJDEy3Ld9RzqqQ04eoOV47ltX4h4Wqpi1S3Q5ELHY25nAdXbVUDStUAVeqtfneoqbBFqC4JyxX9V0RxV2SoK8ADpj3m/3MznwDWTRiJEBl3t6pEgyi+yOy35VWc91lZFL8YbhUHkGVbzdp/QvT324pVy0aO31sXBs1c06OWr1CygGJKv5uCjn6BOyQGa3rLn6JTj7mSt4haEeNSr/rCsmwlk6N9aVUvyhOyUe9QqAoDlWbIprN86WLxbRdsS3aeLnlHU927KAn+EIaOQks+l+3R0IJDxBtXmXJvlPcHir+AGAw4Wr9Bpo3Acg3jzrTXbKOvT5ISV5G3JhHoTKhg4WWZyir2xY/uBd+6C6gLzqrsOqdInsBKJSrleZYKcHTe+MbBvn0xJodechkwNv0qgUg43ofSZUiN0lz9+itpeFICh97mvKUS7qWkC3By4t6jDb3oXvZSWCgKPivhHFWrKV21mRJr8xyp58JZaJ/h3t3iQ0s0DFCpb0LirWTpxMvf4l205eKLSP+awUx3yxfJlS7uLSXzIgU8enlAqPHc82IbJRryxJh8iMuEh/OIV3M2/h0U8nw5zVO4Teaga96UOjjFTnBh+gcj7IGpT6pPdDDU7 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 30efe28f-05c3-4089-53dd-08d8cf279853 X-MS-Exchange-CrossTenant-AuthSource: BN8PR10MB3570.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Feb 2021 07:27:04.0756 (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: lT1XCV4rMdJjLvHLidbkq2Aj8tl+wlTI/vRmG8jNKCuQ/fhDeYWcIZuu9egH9Pim+iDdZyjpNYZRmJvvLj+H/vQ7eFr2D+G22PFwAF/F32M= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN0PR10MB5254 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9892 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 spamscore=0 phishscore=0 mlxscore=0 malwarescore=0 mlxlogscore=999 bulkscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102120053 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9892 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 malwarescore=0 priorityscore=1501 bulkscore=0 spamscore=0 impostorscore=0 mlxscore=0 suspectscore=0 mlxlogscore=999 adultscore=0 clxscore=1015 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102120053 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org target_submit_cmd_map_sgls is being removed, so convert vhost-scsi to the new submission API. This has it use target_init_cmd/target_submit_prep/target_submit because we need to have lio core map sgls which is now done in target_submit_prep, and in the next patches we will do the target_submit step from the lio workqueue. Note: vhost-scsi never calls target_stop_session so target_submit_cmd_map_sgls never failed (in the new API target_init_cmd handles target_stop_session being called when cmds are being submitted). If it were to have used target_stop_session and got an error, we would have hit a refcount bug like xen and usb, because it does: if (rc < 0) { transport_send_check_condition_and_sense(se_cmd, TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE, 0); transport_generic_free_cmd(se_cmd, 0); } transport_send_check_condition_and_sense calls queue_status which does transport_generic_free_cmd, and then we do an extra transport_generic_free_cmd call above which would have dropped the refcount to -1 and the refcount code would spit out errors. Cc: "Michael S. Tsirkin" Cc: Stefan Hajnoczi Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig --- drivers/vhost/scsi.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c index 4ce9f00ae10e..76508d408bb3 100644 --- a/drivers/vhost/scsi.c +++ b/drivers/vhost/scsi.c @@ -789,7 +789,6 @@ static void vhost_scsi_submission_work(struct work_struct *work) struct vhost_scsi_nexus *tv_nexus; struct se_cmd *se_cmd = &cmd->tvc_se_cmd; struct scatterlist *sg_ptr, *sg_prot_ptr = NULL; - int rc; /* FIXME: BIDI operation */ if (cmd->tvc_sgl_count) { @@ -805,18 +804,17 @@ static void vhost_scsi_submission_work(struct work_struct *work) tv_nexus = cmd->tvc_nexus; se_cmd->tag = 0; - rc = target_submit_cmd_map_sgls(se_cmd, tv_nexus->tvn_se_sess, - cmd->tvc_cdb, &cmd->tvc_sense_buf[0], + target_init_cmd(se_cmd, tv_nexus->tvn_se_sess, &cmd->tvc_sense_buf[0], cmd->tvc_lun, cmd->tvc_exp_data_len, vhost_scsi_to_tcm_attr(cmd->tvc_task_attr), - cmd->tvc_data_direction, TARGET_SCF_ACK_KREF, - sg_ptr, cmd->tvc_sgl_count, NULL, 0, sg_prot_ptr, - cmd->tvc_prot_sgl_count); - if (rc < 0) { - transport_send_check_condition_and_sense(se_cmd, - TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE, 0); - transport_generic_free_cmd(se_cmd, 0); - } + cmd->tvc_data_direction, TARGET_SCF_ACK_KREF); + + if (target_submit_prep(se_cmd, cmd->tvc_cdb, sg_ptr, + cmd->tvc_sgl_count, NULL, 0, sg_prot_ptr, + cmd->tvc_prot_sgl_count)) + return; + + target_submit(se_cmd); } static void From patchwork Fri Feb 12 07:26:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 382134 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 3A8C5C433E0 for ; Fri, 12 Feb 2021 07:31:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F33D564E6B for ; Fri, 12 Feb 2021 07:31:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229788AbhBLHbI (ORCPT ); Fri, 12 Feb 2021 02:31:08 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:59876 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229690AbhBLH34 (ORCPT ); Fri, 12 Feb 2021 02:29:56 -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 11C7PPuC171158; Fri, 12 Feb 2021 07:27:10 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=AbZIrydSjLMvWnuKfg9p48xvW3INdg0yTB/7oFfvMKg=; b=MlhN01H/s4oZGkEwJ7bpmYqTDur8i3hRL0RtYzaak7vpNvv3lPT4hcu/3iUEtrExiJJO sOw+eVjvvwW2i3HmzMg43LMp0HOoVYk2N8nKZWx5IZdQLZUS9PtShLUDSGAdSiZkrIgy ARirrdiEOSRHgA4vB7Mojq6EfHKp8AKbd4v0XDv7dVvUjme56gKSiyuiKA2QDWkouOvx mLbKS2e0PxwyWF0kydyKanAXVyGIHhpb2TwERv89lcKo1kjWTlN+zFCqx1kwPCa4FftO DT57Y3u5mjff6yOJNFWr9BfKQvfCcnqI5b/Yx/D639fZ1kQVtIk1VFKX4s0muNm1NJ4W gQ== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2120.oracle.com with ESMTP id 36hkrna557-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Feb 2021 07:27:10 +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 11C7Q9BS090048; Fri, 12 Feb 2021 07:27:09 GMT Received: from nam04-mw2-obe.outbound.protection.outlook.com (mail-mw2nam08lp2173.outbound.protection.outlook.com [104.47.73.173]) by aserp3030.oracle.com with ESMTP id 36j4psn5st-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Feb 2021 07:27:09 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SwaRkKNnT5uf8EBpEHMHp+A+0mPzy+P3PsmT+ViICknuOpJ5oKfumSHF704sBWvXZ/pohAaFa4HQjZ3dZ9etbk1zO1H7Gc4v+asvUs0snY/gQ2JQFRWardbFZGqaYNTZQmuVFUFzp5IHSIU54t22EANKMPjdi/o82fvLKHE3IHlYKw4I8pB8/iBOl9plW4KQ+PQJSQ/FBwR/TXJI6NK8Rb2SYN0N8LytbgwB/n7laOI1SCFg3Kx/JRlvZDjRecbNrEEW7LLIl2ZV42fQO8khi7yTE6uKAg2Tn8FWw+kcMLnVqqK2POPO5yAgGvxdKqIpSIl+OBtsW8KRNNXhm7TQow== 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=AbZIrydSjLMvWnuKfg9p48xvW3INdg0yTB/7oFfvMKg=; b=JX42g3aP6gMLIHcl/hI/A95DLaa9mTtb9dVJpKo9YXKXqy1+XOOT9tZWt2si2CHV0j0yLEHdio1c0SXNqvnaIIqeSyNIguNcQeVq8jYy7GVMZJrTaAAB9dmT0rlWJcT5hiS2vCOT5rUwRzT044ZhYAKCTwWhtCP22zPPZtHRRUhpiJE0DNaHg8pqLSFUtOaQWwxBP6RlUhwJoFcx+SjweXocLPB4ZeyvxYRDXm20ussot33Sv6NtpI6XRR8XgQYAhtNE2EHd1M3hM5lVb4C/YvmSBLlqtXfbLxeYU/hCnZcusZEdTlhul949iO/01WmXoWIMZ3A+l4JAbg3tl/HFLA== 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=AbZIrydSjLMvWnuKfg9p48xvW3INdg0yTB/7oFfvMKg=; b=CRV4pFBfeO7GOnNYcA4h8MAFrTLaLCPL+F8G91UloU+MX49pgXw20ZUk3mYXanLNOfQyC3KZwYpa+K6bIW8ZmsfX04XklbbsveYzegrMaEREkXlOc5PyjTVQhHhvzmmkJqwX1FMg7LOIi5jQkb4kVmV3LiJwgY9bL2xeNDNqKHc= Authentication-Results: redhat.com; dkim=none (message not signed) header.d=none; redhat.com; dmarc=none action=none header.from=oracle.com; Received: from BN8PR10MB3570.namprd10.prod.outlook.com (2603:10b6:408:ae::12) by BN0PR10MB5254.namprd10.prod.outlook.com (2603:10b6:408:12f::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.25; Fri, 12 Feb 2021 07:27:07 +0000 Received: from BN8PR10MB3570.namprd10.prod.outlook.com ([fe80::513a:2259:52d5:e495]) by BN8PR10MB3570.namprd10.prod.outlook.com ([fe80::513a:2259:52d5:e495%4]) with mapi id 15.20.3846.027; Fri, 12 Feb 2021 07:27:07 +0000 From: Mike Christie To: 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: Fri, 12 Feb 2021 01:26:31 -0600 Message-Id: <20210212072642.17520-15-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210212072642.17520-1-michael.christie@oracle.com> References: <20210212072642.17520-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: CH2PR14CA0050.namprd14.prod.outlook.com (2603:10b6:610:56::30) To BN8PR10MB3570.namprd10.prod.outlook.com (2603:10b6:408:ae::12) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by CH2PR14CA0050.namprd14.prod.outlook.com (2603:10b6:610:56::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.27 via Frontend Transport; Fri, 12 Feb 2021 07:27:06 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2402ff99-008b-4183-9d87-08d8cf279a00 X-MS-TrafficTypeDiagnostic: BN0PR10MB5254: 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: PHn+RuWfzrG6m4xWW7BO4SYic5jBbMCBO/Fu1CQMmpqeYsT2zBgmPsBD/lOFVzg3PhFIoqoo7tlZO3st9mabepf8Y4eMz7yereSGCSleEnpt0u+0kUowTHv0MIQtmjeu1rYJ7SfJJz4GdAhiXH2uhw0QdlEbgv5Cf3iOU6dw+kh7CdzFy262+PFfr0DnVPr4nxguTFO8j9yciRF2wtuG9M40zty8pTc2Fv+HtI+IMufvw6aaNxX2xn+fqZLLxEbwwqt8kP3bJ6uUFnCfycgPFSGmltQdbWJQ3PgyMDCf5irsYtKLAy9GeiLSZ05CEMsJDRylFSTj88JAgFLhfVeQh+fTpGy4HeilamxFP+F+PooP1exaqGuZ9bnnARXts5UDhfAjLmSMEcg8IYaZxxnWmhXj+YyESSIyFqSfDoJXLR80/U0XqcUz/WNHyG2F6besTuNeacJdY3nt0dfVbNKitcpvPd8CirHXpsShVnxKA7SHEn8geo2XWxXT3gO4n92XjdHExALli/984WIjXoscWxA3ug1ZNv6jARWcb+huehPOsuT2gVTm51JIbye62pzRZctwg28rqopYMx9l3r8PgQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BN8PR10MB3570.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(396003)(39860400002)(346002)(136003)(366004)(376002)(8676002)(2616005)(4326008)(316002)(8936002)(6512007)(66476007)(16526019)(107886003)(26005)(956004)(6666004)(69590400011)(186003)(83380400001)(36756003)(5660300002)(52116002)(1076003)(66556008)(478600001)(66946007)(86362001)(6506007)(2906002)(6486002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: sIhxIHqOH83ahCzskrUM7SZ3Ph8yeHYHaX8vGlZS8fUrno3Ju71LnMnNGtQAGg8lhxijb6JIg1BVm3bcUBR/pLCUFbEkpt2PKl4mb2R8N39VqSltJOEBzW6VUX4dgKGyQ6SPGZMr9ItI835qXJdwamuPRd9GxVqgPwFabwhQ+VLHBAvbnbCnO+/IMutjpgpIF556Tnacdq7qL25psm8lVgJNcHcCZAsNnC1NgtBYuZjWsLda1gsiN6EdYTeKxvdqwIu87Rp6oI+yZvOXVgRsvcjRrLtFieq82sdoEU8XGEUfPdsk6SDRTh3i7SGeUi+9X58VXzbxIUcCjPIEH/rK/FHkL2bxtxeq70GU558GB2l8Y+jvj8jZ5GUrG8y2gainLqfuOsrKIz+iYCLdsjmQM6EkC7Cx/CNmDRqdByX1gsirgvM5zZuP37K80Rf5wKVh82UZAoNoTltUcI7115qXi2Phzy7Q3rRsd16aOaQZfp0g4IzaT2CWR4AitrHcuF4WGvv4PC/BUfNHt5SrKHmafncPPRdsHhglHwe6bPwRGoNeL5j75PpR3IV6yfTys/QLwz+LXMk0dsqFSuAQgz7DMOHIyWrIicyKiUEpSLIFL/8aY6fPxzMQBDWxc4q9P32cnal41dCprSYZ+bUBfaRVOrN8RnGrQ4bCeEwJF1w/e5qPEVn9AzMbTXdyatLLi6e90+G0cEsdYIGUWjTcVolAqQFFZFu3mwUHamoRus3qqFbUfc0GA3erjsQGk2ZueCNDwZoWC2DqCsatueElKtW4k/pkIRjr2uK+UYoeivqT1CLYgbcSikkY6rQNrmFtea9RegeqVIDg7VC7IKlaGe2h7YXHKxqY1wr/GKkFwiXsPl/wJdpkRWAugiiKQ+nJ29C98izJTAxpLDB8AisY5IWlbn1cnlV74Yp1diICsrBPUC3Q647RqyQ4vwGp2Cjr57aKEi9kLNzaAl0PkLWKHFSIQwXGQWVfAWeDCQHjCSj73G/HT1ax6fHd5Tu/O9O7BBFPqpe/rfAIL3CjZSdFZTZVUxDcdV2FNxKH/zrKvwAMG4QBNrD2+xHSpSlBtszpKr1FG2eBlMP/3angzjeXJDRI1nJ/UWMYf8JxCjN+A4YGMn1ZLi8jTTeFRUMYFUdin3qqw0c1O8gdJmomRvAv/a4U/b6qAVXDKYSwuFFzQh8sQVtvqdWN4qTGBq8bf0eNuq4D7tYuw2hkqLIcOY3h3AoqDEZRH6F69U5ArXteRCu/J/wECmpe3kg4VINerzwpf9yr7mS+5BjnOLCHGrD5Ey4emLafCG2HI8gieOmwWEIVFDi3id6PrU6wg9G++T4Q6vFs X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2402ff99-008b-4183-9d87-08d8cf279a00 X-MS-Exchange-CrossTenant-AuthSource: BN8PR10MB3570.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Feb 2021 07:27:07.0249 (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: iJVLT+n1qOoSOy7ri9x8yRg+Kqu3w1XJl6qUY0K3oH3Z3gsVRk6x28KIzLvMBa6urXie14w6/ZGNdHMTt+k2GlBGl6s+OSDpNXUgiQ9DZHc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN0PR10MB5254 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9892 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 adultscore=0 mlxlogscore=999 malwarescore=0 bulkscore=0 phishscore=0 spamscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102120053 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9892 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 malwarescore=0 priorityscore=1501 bulkscore=0 spamscore=0 impostorscore=0 mlxscore=0 suspectscore=0 mlxlogscore=999 adultscore=0 clxscore=1015 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102120053 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Convert target_submit_cmd to do its own calls and then remove target_submit_cmd_map_sgls since no one uses it. Signed-off-by: Mike Christie --- drivers/target/target_core_transport.c | 69 ++++---------------------- include/target/target_core_fabric.h | 6 +-- 2 files changed, 11 insertions(+), 64 deletions(-) diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index a82b7da09872..ad30a99a5cb2 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@ -1751,57 +1751,6 @@ 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. - * - * @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; - - - target_submit_prep(se_cmd, cdb, sgl, sgl_count, sgl_bidi, - sgl_bidi_count, sgl_prot, sgl_prot_count); - target_submit(se_cmd); - return 0; -} -EXPORT_SYMBOL(target_submit_cmd_map_sgls); - /** * target_submit_cmd - lookup unpacked lun and submit uninitialized se_cmd * @@ -1817,22 +1766,24 @@ EXPORT_SYMBOL(target_submit_cmd_map_sgls); * * 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(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) { - 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); + target_init_cmd(se_cmd, se_sess, sense, unpacked_lun, data_length, + task_attr, data_dir, flags); + target_submit_prep(se_cmd, cdb, NULL, 0, NULL, 0, NULL, 0); + target_submit(se_cmd); } 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 Fri Feb 12 07:26:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 382131 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 5F752C433E0 for ; Fri, 12 Feb 2021 07:32:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3882964E65 for ; Fri, 12 Feb 2021 07:32:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229958AbhBLHcI (ORCPT ); Fri, 12 Feb 2021 02:32:08 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:59912 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229918AbhBLHaD (ORCPT ); Fri, 12 Feb 2021 02:30:03 -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 11C7Ounu170946; Fri, 12 Feb 2021 07:27:12 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=x3Ewt12IExJayKPDZZ4tEdHTL6r2juFdsMgtEah1atQ=; b=vnw9SItCIHtwI036uYrcRz8wI/KaFrtInltKR3WXPYWHiNr9Pr7upeGJp9LLOO9BrBOb R9X3bhqaxwp5kU1xUGHrrUaN1UcuhZm8p4pjiPDElu34eG66uKF79XtsiIVUf0HvJQP7 SyejLc1d7+RLTRvxvZX78/VqyhqUIP1kXlKqjnFpAgRmkcDdYEe7G5iFn3n6ja04A29W w5cwu7oeOZw0fUHhaCNQefIQcMv/R6jbB1Ofp1Ks8VR2P2+M8dl7rEvNWQOg4DAT9wSL fms3kmTQQAa4jcTKq3dnaTawGh4C6olz77cUnSxk3zVLp+KqcnJJB3f8cADUvtHGxFoj zQ== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2120.oracle.com with ESMTP id 36hkrna559-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Feb 2021 07:27:11 +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 11C7Q9BU090048; Fri, 12 Feb 2021 07:27:11 GMT Received: from nam04-mw2-obe.outbound.protection.outlook.com (mail-mw2nam08lp2173.outbound.protection.outlook.com [104.47.73.173]) by aserp3030.oracle.com with ESMTP id 36j4psn5st-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Feb 2021 07:27:10 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=naEbuHQtUc/SO049MqnLm39RtjsgLB/9NhHvwrtnIVh9Xj4GFQzM7TULEzI1oRSKeI2pt7QWuEXHSC0ux8/nIGtvGv3gyAQYPr19eS6p+RU8K+mu+x6KfiEF38PFO90jf5Mdzl1NF/oVD231pquc7HrKDErOwAMQEbrQG2Wy0eM3T4zbDzD59pISRG8HJFJwAythpRXqK61/mx17ZgH9B22AV2OK+Aomb1e1TVAMjhKJ5adNbgz9vtRW95WfrEFzm9zMhweDrWSgtBtjdGrHSl+kD3z2twKwCNOU66SZP4mqeeN62YXfEVUkd66REn8ax962KwBSBW6BPTsjm8mfkQ== 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=x3Ewt12IExJayKPDZZ4tEdHTL6r2juFdsMgtEah1atQ=; b=BjtqrjjHx7Il7ADZLKUAMm6/8iY0WC5GhwoSkN54h62WO7vWkCfPkHlp2tP/yttLyUGAPS5BFIIWytWx1WiS2PZYJK6Sxcr3chzXJtVBsp3+c7NyQM5sQAfD9xbvdqKTQz0YPZCrn84Y2um9G3ni+mduVY1/DzW7E3s6tckuxn1OlKLkr/Hl+VTDEsUd4lAFgIqlL4Dynhh8I9Z4p26tAptLSDuu13xLeyRGJSmSaXfCzDg6pELeqP4aGv/CiSpPi9vU9rfVXIcKNbJS0wB2EyyV85FEmpTUOtB64oYdi+eqC7J6w3Zf51gJ/nvxHXMPUkZ7TBiIoc/pYRunWCnIbQ== 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=x3Ewt12IExJayKPDZZ4tEdHTL6r2juFdsMgtEah1atQ=; b=SmT9zYcmJ6/FqviiBL6lHyYTsKPrQbt5uaJH7PtszV98wW2OlPjFtnBpYtgMua2y/4ILxiasjHd0aLCf/cOCdsIRWCCyP9KkBvlI1oXVeKSSBx4PKiJFfIFOEzKmXAHnNLlFY5huToxA9V8kV8UJBCbcruX+RBqmUIpzJ0wypLs= Authentication-Results: redhat.com; dkim=none (message not signed) header.d=none; redhat.com; dmarc=none action=none header.from=oracle.com; Received: from BN8PR10MB3570.namprd10.prod.outlook.com (2603:10b6:408:ae::12) by BN0PR10MB5254.namprd10.prod.outlook.com (2603:10b6:408:12f::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.25; Fri, 12 Feb 2021 07:27:09 +0000 Received: from BN8PR10MB3570.namprd10.prod.outlook.com ([fe80::513a:2259:52d5:e495]) by BN8PR10MB3570.namprd10.prod.outlook.com ([fe80::513a:2259:52d5:e495%4]) with mapi id 15.20.3846.027; Fri, 12 Feb 2021 07:27:09 +0000 From: Mike Christie To: 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: Fri, 12 Feb 2021 01:26:33 -0600 Message-Id: <20210212072642.17520-17-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210212072642.17520-1-michael.christie@oracle.com> References: <20210212072642.17520-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: CH2PR14CA0050.namprd14.prod.outlook.com (2603:10b6:610:56::30) To BN8PR10MB3570.namprd10.prod.outlook.com (2603:10b6:408:ae::12) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by CH2PR14CA0050.namprd14.prod.outlook.com (2603:10b6:610:56::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.27 via Frontend Transport; Fri, 12 Feb 2021 07:27:08 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8e362ae6-faf6-4ad4-f216-08d8cf279b51 X-MS-TrafficTypeDiagnostic: BN0PR10MB5254: 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: O03mQklX0nXZcKCv8It5FmBRnb4qmTJEPPCKvrJ9ZxWcA/omh+CgzT9CeqKNMQjZbrMq6M3u8t3mIJjcxGiA8YHDZbjnnr8+8mERkFazIro4J1Kpfnm07WrbapEVz9VWdmNp44kWnT1yLYf0zWmJNgXM6cPk3eo41WpW90svBL1L6lQBdoNGYx1yNaXjIioEBstfLHrw2QqzxT3bERv+BuRWvg4RXelcTVv8q7xSx1RN0gxqMCzcA4kS+0GQ8SIc61tiRRvAN/sdON8Kj2jj8N1UA7DdE1u5JdKTwkuxfc14CwzJz53iLecJhtMo8D/jfnVu60De1xwJjnM0pg0qVRYy1OIGK0rWoFVSh+2ffLdMy1pvFaYdCDj7j72QBCwRmbaYU+HMa9diQ3DKiP0oDqPzy/mu2RZq92/XscFqRRnEelUI3dRQDl/6gj5om+tXKJ6daXjvKW6wGXywJtjS/eE4MxhSWaoKjt9+I39de82ev1g5LZ+09w3r9yKoUgw+W8TVKFP7mFsc4w5N0V0IzifEXRpUL7AuWRNmKdTtL6B31X1T7jJfqxPRuaM9MX1BD43rwJnCrbgF9jtVkzf2tQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BN8PR10MB3570.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(396003)(39860400002)(346002)(136003)(366004)(376002)(8676002)(2616005)(4326008)(316002)(8936002)(6512007)(66476007)(16526019)(107886003)(26005)(956004)(6666004)(69590400011)(186003)(83380400001)(36756003)(5660300002)(52116002)(1076003)(66556008)(478600001)(66946007)(86362001)(6506007)(2906002)(6486002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: bvKWDeAaR9vLo/kPCr57faAuuSs4X7/mXGwnFmG3tdYtJtXesqCYAnAkD4rlk+iOsUITNqIeGCUPCFdTUft3oK+OTApaW5KZORkKhmm84pHk/WMcDc+v0B6g6dBcGrNStdjCmGa+W78MBdz03f5xm+1B4gPkqEM2rcQ2GVSjolg6MxUgkueofRTsvfFwMj/nqkl1Ttufzn/1JqOV9AetDBIzLETAAgcd1prCvjTRAql2L1W2rGBoNleYc9HU8lhMy94uRtOXwkJMzNSkeYxYBbQY4uLA2PN+aw6+peHR5/kw3HLEf2SwXfF9loYiIh/jnCx4ftLAm8fxRfXgw056LtnGFxCk+MsSaBBYM6hXZsTt7WCiFPg9ex7dWVpfBzhn8tH4qfTw0eUOOch/tFjUp6eBe3ZvoLrbC+69ayUo3pB+JONTNB6rdhXvtd/78GJ/PRJ8/akNUoW2WyvNqpB9mrcBwy79vc8aEpwzT0ewMa9PgN77vwLEd9NDPvYoiB5S3zVd5b0ZnhkGgBLhqg4c71VZ72L5n95SVx8QU164PtA0UcBJneo7DNLJlV5fSNzZWVsc3T2Cl2ONwZVjmYtMK8SF5ie0wi/lBJXA+YUGmurlBcX/Ao80ww1ZFd+shJHQE6RtD4SF7hRp8UGEc6QOkCruPnEDQaX3oA5q1bAkQzkQand+8/zBsDNk3w8SChXLzLaawJDg+zEOODttY2dw79wx4FgNBazcXAZSCgwC4R1QWWzPzKh0dW9mLDlRzBJj1umiXwgvbKu2MnvCUi+1irMXZ3GnN5NsWSR1mgEXaFiFzvp08u5OtFbQMhxwiGaeaqwstqH4EWUTZ7VkmXXKUtgnZDK8aHxgRgPdWt99q+sSq+jUHhb//dIzccRvMjPc5ZgBH6bFQI6fNHjKuR2E0/j5W+Tdqzk1aTxzVziUn1W2186/nUAI2Qkh8uXZ3ozsCwut59BuMT0O+M9PcQsL5v1vuVWqBjWLifI7VDl7pl9Tz8Ch9AolfSg8+pVT53X5mvGLszhoFdNeaXqQkRSaJsxcnpiGCJFTE8kB7MuGge+fLRpl2rBSMHU1GLUaoNkCLgQHzpHrYgmLXbTb+KO/+5NVO17bXp2L+1CvfHNFSUyqp/5lVMVFU9OvNBRYKN/sqlYDny6oQ/mAlmLN3+Ug3ujGbtJbuSaJMpxwh5jsm7kAuS58gDKgu688awbsVzowc7D/8TO37+yZquS2GETHgcBgYj4Q5Jc1TGufaIT4yHs1rKhdURFdDhZsSDCrp6iEQk0vERwxw3C6qJCFHdRARbw/OF6eTQYdxaA5+GUP9i8aJ6n+h8gucJ//wURR73Q+ X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8e362ae6-faf6-4ad4-f216-08d8cf279b51 X-MS-Exchange-CrossTenant-AuthSource: BN8PR10MB3570.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Feb 2021 07:27:09.1197 (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: 30FUW0kha3r25sqiqJecw/eVInf9NyULNeaEIRjY2LjduLBZkLxFMm8posKj8kYQw9S7KJMi3Dc/zweCVM+WdRjXQzKcjO/4uIeY+abuXX0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN0PR10MB5254 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9892 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 adultscore=0 mlxlogscore=999 malwarescore=0 bulkscore=0 phishscore=0 spamscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102120053 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9892 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 malwarescore=0 priorityscore=1501 bulkscore=0 spamscore=0 impostorscore=0 mlxscore=0 suspectscore=0 mlxlogscore=999 adultscore=0 clxscore=1015 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102120053 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@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 --- 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 4723cc6abf61..d782d3a0f9d5 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; @@ -1788,6 +1796,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 Fri Feb 12 07:26:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 382133 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=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 5CCEFC433E0 for ; Fri, 12 Feb 2021 07:31:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2FE4364E6B for ; Fri, 12 Feb 2021 07:31:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229892AbhBLHb3 (ORCPT ); Fri, 12 Feb 2021 02:31:29 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:59902 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229912AbhBLHaA (ORCPT ); Fri, 12 Feb 2021 02:30:00 -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 11C7O1ZA169926; Fri, 12 Feb 2021 07:27:13 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=wYnbMINgEO0lpQsQZ8oqujXyqlQ+qKigdJjFNWv2M7Q=; b=N6JcEPhFcNvK/600pQHAHbe90n52LnBN3lF/7odIa2DybWKwOWyymVthV/musWtxPYJM VYIoYaxUBPXXfnAGlr861WhGJlKWuia9j3A3Xv9+Q358JyRtLW+raatjhfoBAusBJgpv x8J81QnDK8OU64gho0TCCVzb4IB4HNtb935Af6U2PTAstoQSfJ3UI8KXa3wpqXTn0ZUr B5bwFIE1n53jt/nShtJ5BCXD6fCVqDJ69wrtCFJBfelKy9E+xAcWd7HyvmK3YK4+LfvL wyAUYJiMXlFOQ/eBvIpDRFCC1okhp8cO1zut4vsVtIo/ZAAsnoA8UjIVP77TrQe2vPy3 8w== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2120.oracle.com with ESMTP id 36hkrna55b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Feb 2021 07:27:13 +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 11C7Q9BX090048; Fri, 12 Feb 2021 07:27:12 GMT Received: from nam04-mw2-obe.outbound.protection.outlook.com (mail-mw2nam08lp2173.outbound.protection.outlook.com [104.47.73.173]) by aserp3030.oracle.com with ESMTP id 36j4psn5st-5 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Feb 2021 07:27:12 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kB7U+qPWxLJtfTkRWjG2XxJeAGI2kOBeAjk1rYwE96Io46/tYG9yWpGLRalSrEzdxr5VT9KULFOxhDwrggYO0UanidNzUYoZ20zZy4i5DaRmaWNsmYJuVg8SsxKpLlCjGQ1j4YyXQ91UpiFZ/CB3m2IclTMrWSUit0/cyzpj+MBhKOMqx7Wt9+gW7fyAvVtkFJlICTMq/io6G2O/lkknDwOHCpk7JnaC68PtL79hsKAo5RZKl55nVCdLOCW+SsaCn/5xbH7Jf38d7+afgLH8nzOb1OAj2umGRIvIq0P1Uc8Smr9HkJdDn0ojwE4yXjz+ki/X3BLRX0eO9Q+t3b0sEQ== 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=wYnbMINgEO0lpQsQZ8oqujXyqlQ+qKigdJjFNWv2M7Q=; b=H3OTP7OCiEFV/7LPSUzBy5y7prqj0Ss6vbnZXKWXnJcDvqLYetYvHHuk+0ZFFYq87vTeUIfYvMWWOG2G/CRxbGVTGMJbI68zHIfCcZ7vK1Pvl7MI/ldsyukUsN1nGPlSeqEAtjSuK0nvkfy1Q0TLpAhtaUf/KCHKZBUCZUIGxHXAZ3XxQCZZw+f2BpXGRQLBynBsIpRgmooR09X3N1W2hKYl/GCM3blZEjTV7G3zNGwvhsS0vYbKpbzOswPa2yWkIpS69ah7/W4a5a0t2ZmVf3YkiB9GYeySC1ieXGiwS5nFQp87eq9onpoir4dw7nefv5UG0UkLcU20OuuBSz3wcg== 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=wYnbMINgEO0lpQsQZ8oqujXyqlQ+qKigdJjFNWv2M7Q=; b=FSJWxBvE1fXEPsr34salXbelIPt7ZkWmjmxJf8oJmByiZVI6kAGFySgLWbQXjF1XLyEtCTrLiXeTHnRQQ4O5/O5i/3TQvYpN6MDrF3gS1Jm9LzhahAaAuERmFT59q5/raL8V+S82cYKjo/DkuSZv0bcUMMnEqWjwcIZjAL4ZJuE= Authentication-Results: redhat.com; dkim=none (message not signed) header.d=none; redhat.com; dmarc=none action=none header.from=oracle.com; Received: from BN8PR10MB3570.namprd10.prod.outlook.com (2603:10b6:408:ae::12) by BN0PR10MB5254.namprd10.prod.outlook.com (2603:10b6:408:12f::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.25; Fri, 12 Feb 2021 07:27:11 +0000 Received: from BN8PR10MB3570.namprd10.prod.outlook.com ([fe80::513a:2259:52d5:e495]) by BN8PR10MB3570.namprd10.prod.outlook.com ([fe80::513a:2259:52d5:e495%4]) with mapi id 15.20.3846.027; Fri, 12 Feb 2021 07:27:11 +0000 From: Mike Christie To: 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: Fri, 12 Feb 2021 01:26:35 -0600 Message-Id: <20210212072642.17520-19-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210212072642.17520-1-michael.christie@oracle.com> References: <20210212072642.17520-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: CH2PR14CA0050.namprd14.prod.outlook.com (2603:10b6:610:56::30) To BN8PR10MB3570.namprd10.prod.outlook.com (2603:10b6:408:ae::12) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by CH2PR14CA0050.namprd14.prod.outlook.com (2603:10b6:610:56::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.27 via Frontend Transport; Fri, 12 Feb 2021 07:27:10 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 31902733-1aa1-426e-ba7d-08d8cf279c78 X-MS-TrafficTypeDiagnostic: BN0PR10MB5254: 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: 3TCfOG7rNi0wki4DvYz0dct3aL/aaMVjb00j9aAG3IysM70BqizuIukSuqcMbNITrNz6FMbAPr6JUSmPLKysq7yIK2sFypPb+rl57ZHFVj7gleFKgVzoEXKVWFi9sG1yfvsxWyuANmjpxJ61t0HSinPQQE2bidnCLMp9syG3Fjr8VZYXi0i7N9W8QFZ8TF7dJQ/vwbS89+aZ4YzMf7isR+IF5MI5UtjiP+mf4+BnTpzmgjfn+iFzn+9rC9u+MVAVV7Z74gop9gYop3ExHealJcuDcYH8jrr2Tk8ls/PNQvZPlb6gtCHlP8n9DcFMzl9zBW58fnySEHM9hZl6MVF3XNFk7x6uGbVbddoUcKlkB1amar28dADbUUJWPR05PQ+eckzh4Hx9vphBvj9Ftc5/XNORVhTzTjImXGb6BqJIn4xwbyQCA4W+kZ4UG/pjusRfqNd8mf8pzUWyotDoR3fdwOWpIlrkHP4qGxXhk5xF8CRfOJ+jAVAo1CN7JxrXBzA3ju6xx4KqkaZSYP6VWw9J24USpoDF6PR+ALe8RPIFXi+73rCcXl8MoPIkenqy2L1hgRA1rN/r2dQlEjCSB/gWBw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BN8PR10MB3570.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(396003)(39860400002)(346002)(136003)(366004)(376002)(8676002)(2616005)(4326008)(316002)(8936002)(6512007)(66476007)(16526019)(107886003)(26005)(956004)(6666004)(69590400011)(186003)(83380400001)(36756003)(5660300002)(52116002)(1076003)(66556008)(478600001)(66946007)(86362001)(6506007)(2906002)(6486002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: OlpQPKGVDYH8xiFHX/yw27Se1ryS6jUuX0Mwl3mAzxE2ij2AFmarclo3oHMBi2NZa9XJFU+XTk237QlK+8ugL40C4DrRyu1cK4RYknEPdmBucPaICGkPoqHjLH+vvtfgiV9EUrl2gAYttT0ItP/Lvxx30UxKidXRom5ZTxNNsMifLufZUZaAGidWGVAd6a4CTDs9JYL4ZR+Eci+Kl8n23fSpnLJhmkwoEOLReCsUkE6Fgs1MSGz+3pWhva08XYjFivj2C4wSGahVh+kTzs9uzResLoInB/X9Lo/Qs2U026D2DDj0HPk3FaoBUu8cryWh075qoQWlsZ6bVuhq+iHfGGrSyDygFI9K3bDGJE56IxqQIsIIZRCFez2YdO8fbFaGBdquZxRzAsq86nN+bOXjOhEv5qxsXE47hyXWWE59FWXSQMckcAN0fGEhwYFLJkk0ChE7j198CUpL2bqOoWvaHqJnWz3CtHPO6+zFn47iiNk7+EhvGNtVrxbyY6YiXGk+RyHX4g1udDd/rt88axiTHtHeFrpM0daHj/PteDtWDMXTun6uA69ZVUYFLd+NQV5uVw0VT8u+bDPZcNr1KHfzmpJtmKtbPDEi5futd287mHV2UohArZ+h1hM8tttZbkFmOft1/5URGG/FdFlwWFWFlNCUAPWwTxj722Ap6zZ56y1qt/voSXrrJTXbzlMWG0S7kgHe393mHtExrllLVHWmZQkUVvdBRXRunxgQISsoXOt80vanY/tsqwLDa3FC6P79TSGZ/RfJSzNRIRHB47gkUPdgrs38Usb6HP71qbFrlyQ3adZUQraHQWRoMnX5AptD9IYT+w71KvLGXDsMZpY/Z3WCnqfTJq7OlPYT3uz3tswPhS83QG7gye/6Ndg7Iw0J2nEEVsHvHboP4e5ujVQkVBmPob0qTa2n9WuYWe27Nk03BRm4aWmXwkPVAxukxj6eUnOImfI9tIrEPObbczi7jGRxIPFJAP1R7Zy9lgHNAtzRfp0ERcmwRu7TvNk6IhcwXp1/s5wbLR7mOeUw5FRaSBe6exG61gEdFCbn1YJ+I4Z91DyEChhdWPzxMQAMdNhXOV1r1IM4GKid43Yl7mB6Am4bPuMvZRfyvAvWdFMyuVzhhxj8uxM/8tlGh5dwo/K1KryQFfOoKpcBoEZCszmxtePD8tKetg/63kEQBagIzkS2cMpl/YIA4T16WdEx3iI6zA76lxi/qyC7z5kD3gwT/NRLorQ4d53puGKq3FqYn57+AGxNqcZkoIW10NMPcfbt+85w9DnNCmbjyS+nBOvRvzZ/HEDC5uf4jettUhTcKupbm1t1k6QBLJZHxKPnj5Ah X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 31902733-1aa1-426e-ba7d-08d8cf279c78 X-MS-Exchange-CrossTenant-AuthSource: BN8PR10MB3570.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Feb 2021 07:27:11.0396 (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: FXkCi7XxWoQvL0CL17mSxV5MBCjfzajj6cX4y1Eut9ySXZifK5/SFoWD+xSa3zyK1gxgEQg0/a2E0EkmH6oMh+riu6U/W7L7CHbE71cr9yk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN0PR10MB5254 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9892 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 adultscore=0 mlxlogscore=999 malwarescore=0 bulkscore=0 phishscore=0 spamscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102120053 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9892 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 malwarescore=0 priorityscore=1501 bulkscore=0 spamscore=0 impostorscore=0 mlxscore=0 suspectscore=0 mlxlogscore=999 adultscore=0 clxscore=1015 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102120053 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This just has tcm loop use the block layer cmd allocator for se_cmds instead of using the tcm_loop_cmd_cache. In future patches when we can use the host tags for internal requests like TMFs we can completely kill the tcm_loop_cmd_cache. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig --- 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 Fri Feb 12 07:26:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 382132 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 BB460C433DB for ; Fri, 12 Feb 2021 07:32:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8B05B64E65 for ; Fri, 12 Feb 2021 07:32:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229934AbhBLHbv (ORCPT ); Fri, 12 Feb 2021 02:31:51 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:42408 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229913AbhBLHaB (ORCPT ); Fri, 12 Feb 2021 02:30:01 -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 11C7QtM3017743; Fri, 12 Feb 2021 07:27:14 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=Ex2GluAq8WqejZjlnAkklhC4NkokkfCGFh3SuxU4/ZY=; b=yrOWbscFYw56OqfRkWc35EWnGx+Lohyu1aMKaxlPGmRPJGqslEos3AZBitWXo/IErlN6 t/n59RFHQi5DQYQ5rYagTA6ZviS0v7uerKcl4un/0MQ5Dk11Ep+MAasvzP6yuQySI/z4 WwUJr6KLWhanAGStKMs3PgERd4el6GwCjce22vFUpLruFLZCo7vAvu0998I1j8eVTA3T IYh/lInBKO9HkkwqiHtQ6ofgGMNBc28xMteGrwWOLD1Vr/xfK7VkfNW5nlS7zZY0xLSv vDX1+byeEeEkiGGVRbiV1msT/XenUrLdJjzTnXHgSeO93oVNSRRIfHJJfiavJB5uEVYe VQ== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2130.oracle.com with ESMTP id 36mv9dvcur-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Feb 2021 07:27:14 +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 11C7Q9BY090048; Fri, 12 Feb 2021 07:27:13 GMT Received: from nam04-mw2-obe.outbound.protection.outlook.com (mail-mw2nam08lp2173.outbound.protection.outlook.com [104.47.73.173]) by aserp3030.oracle.com with ESMTP id 36j4psn5st-6 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Feb 2021 07:27:13 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hrH2NUr8HJfrFUgC+MTI5ZfahVOcJzXj6iRyEawzaQYR+u6qdbdeZ4b8CLEaVTpuOD2qV1FkAcTzwt/+OD/ShSWcIJbtnu+3lwxA4BQSwQmF/OFAxpK0FnmRzVxvbMChSuBdp0IQnB5luaZnvwODdT/2zyHnykOHlpJ6C7qBAd4eD5FNNmRQYU0KotB0LoqPh1X9DbE2NDwJeJ6CoZ9o8mMz6TYymHwLo79S7Z2tME5sty1+LWZYK8G1IdB0se8BX2Q5eXM2y3yAMgIl94OW4MMNmewZuBqNmFleU1k/5wXJm/Kd/C5+RaprCUbdplfaXaPHm0/sAjCXEoMayimgLg== 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=Ex2GluAq8WqejZjlnAkklhC4NkokkfCGFh3SuxU4/ZY=; b=ONKbwYlYfG+MVeDabh5IeZxSKq5oLoNa8VYvdmkIsfJCn+pe5e+s/SyijqOA0EEK8NyZyPJk1aroRrQwS4+y3XiUeFzuP9Opvk8wZMv+7NqjzcxdZgKw5YGMhKVVNoTn0s7JBVSws6lkqbkmJslC4iINMmMdzE/NyzwGu8Fv+fPHDUjPNErkZaqqwdgKBWrF6Xko2LdNhmzlkDoRrU8o9lKJ6fBOdxy91XV8iwQVr3jBVxWq/om3yazKF4diV5sRZN1s0ua44qV4QaocUjylgQ9oi/++swZ1IHAqD+Yj5kIZkuKlW+hx1wkgt6Wx0R3oRiLBJyIFs0KjYxJqj+8uAw== 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=Ex2GluAq8WqejZjlnAkklhC4NkokkfCGFh3SuxU4/ZY=; b=bvotWRPwecI+Xl1jzKC29PkWj+JFVoym32zcJZn78oetPf145iIZKWpHfQFmjkTvw1cfvhhJjOqYu0tqSqsULYd7pWay03AzVpIM1OAngPQloszFHZ6ZFotlnGYHyueE3b4oZITOPp+6SHrIHsFK0sw+gtAr4vOxoZu8Cj7/YhE= Authentication-Results: redhat.com; dkim=none (message not signed) header.d=none; redhat.com; dmarc=none action=none header.from=oracle.com; Received: from BN8PR10MB3570.namprd10.prod.outlook.com (2603:10b6:408:ae::12) by BN0PR10MB5254.namprd10.prod.outlook.com (2603:10b6:408:12f::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.25; Fri, 12 Feb 2021 07:27:12 +0000 Received: from BN8PR10MB3570.namprd10.prod.outlook.com ([fe80::513a:2259:52d5:e495]) by BN8PR10MB3570.namprd10.prod.outlook.com ([fe80::513a:2259:52d5:e495%4]) with mapi id 15.20.3846.027; Fri, 12 Feb 2021 07:27:12 +0000 From: Mike Christie To: 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: Fri, 12 Feb 2021 01:26:36 -0600 Message-Id: <20210212072642.17520-20-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210212072642.17520-1-michael.christie@oracle.com> References: <20210212072642.17520-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: CH2PR14CA0050.namprd14.prod.outlook.com (2603:10b6:610:56::30) To BN8PR10MB3570.namprd10.prod.outlook.com (2603:10b6:408:ae::12) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by CH2PR14CA0050.namprd14.prod.outlook.com (2603:10b6:610:56::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.27 via Frontend Transport; Fri, 12 Feb 2021 07:27:11 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 08d5a009-5964-43f0-66ae-08d8cf279d06 X-MS-TrafficTypeDiagnostic: BN0PR10MB5254: 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: h4TkR0RuxiK13MchnbWhNbW/x4nzYjRXvKFmiH+dgv2AL0dEPWzAkAeT6vv270vD3rokMrZCf1OHqJ8ilASVTMNCmbcwFDEZ/MPK2qOs8PFf0VLOC3bZ6miwrcrtnThPkMKLJGjTwl/JFn1zf/wK/H35c/gjz1ztLU8fnS/Gp+kEZDLeDUCIiwk1CNfzDv5tzYzeVMj8VfoLN/CBYogpBoshsw0C25vgxaFZORquo6DWwmxmJwmjxKNWccWSHMCL/tTiQ/VMXJN4eqBLsMpNOy14Nr15PqQhZG+ATiydZ7ATgjsHX867N6Pdnhxe0Rc/CchGE+pL5N93ata3jVOahJOl9916bN60Yg6iStZp1k7lYeINi5i93zM7cq3gSBO2wkFtyH/660EVuzQnM9Z3jg+rhUTaAAwhUg3Lnt7tGLt25mbFrbO0OsaPUNZQGPU2NYIwY62osRcpUPvhXPI5CKTEt8iyzugs+L/ao0QdipGwtA1szp/zIDW1KaEMu2TPmByKBZx46RlLkxk2jxa/DzllglyKcQ2r9J+z2IfRRbORoTabZK7Yl74miRH3XF+kUfPGydnwuZN7Haj2ghc2tQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BN8PR10MB3570.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(396003)(39860400002)(346002)(136003)(366004)(376002)(8676002)(2616005)(4326008)(316002)(8936002)(6512007)(66476007)(16526019)(107886003)(26005)(956004)(6666004)(69590400011)(186003)(83380400001)(36756003)(5660300002)(52116002)(1076003)(66556008)(478600001)(66946007)(86362001)(6506007)(2906002)(6486002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: x24nKjTAp3Whc6hGrzIz24FFdHCGsH4f20/Fh9omc2npvANjU5lWsuTFj/Rw0s3EH6MHN1hiEUgK0pBKABK5PNeCqYTxltrixvG4cg7hh5i88eBklK+Ar5nXLxCw24z54TH42I9Umh0PYXfGY0nZOWooFO2Jn0C8DMkrrbXgXo5Yua10z7D5Yum4VjG5I/aoaOIOer1pE+14mXNnS0eJV1TzxyiobvMZwsZfeGPxk8yxw9wZ/WXbDX4sGXG+9kmlA0f2suSHu915lSQOXsYt+kZ8nuoewMD147hiJPl9FH9rgUAAtv7hrZCvjpFaG98NQHtvY1HjDOTKNg9PuZakYp7+daLeTnlddkdw9M0y5ELQIff3dAwXs62p9LRGnwaVEzO9uPM5W18v3tw6Zz4ajL5Dw2fz3cMSUJ/DM/QO2Er63+eDMjVMwUG+eKIdQkG/XJOahF74QdlBGmeOGKtvS0nPwM905Onkiucyztz2tLmVhIiCCVA+TCtc4meZInMzNLTG3eL4Jrhl4teK9VVeAmr5JY8+kcdcvPwZx5YyoaUKLmObkcuplpKsL3uvQLh2pAN44YW+XBFy7hxGYqxttTbrUkbsRzg97gHeErWGWx+kK4Ir/lXP+nZDfWNotv69p8QwLkeMOikIhCxKVRqm++6Jx8OkPrW/VjKPKrfBaDVm2F4OubvWBob+f1owjhjqGp9DZR8/hwqhbMv62LGe6fMi2bIjCKirnOuHO/xflJe9N3PrMbErxAJKT95kM1hcmMLafzSKyi7DTEIcg0u2BD6AILpO+rQi9lRmkZxa637vNiMnEPOMR6725C7v8VHZEhYimjuaXLAn7uA+ZOVUQ6shefBUH6R9vq6uw/RoragjIeTkoYHUip1GyPNYMJVXTGHcPEsc5QPmSNt6AeySJYI75wMOA0KkxY1scImDwaR5QgR0pu8vHpaEU+C8C0p0k0aVKM5g7Lv0H2lQw+wFSuzvEf9oQ64zrWumvbNrE9FxZ8UE2+y6mqppf9VqX87EM+9Qpb/UpwCzSm12fH1SToKyg9bdq3AlNUc29tDsQZMHFh9xXxdohHBcF89DKqyCs7IkUwi0dXGNa2SFVVjeIS3xrWeSSXIY5Y8RH4ntqFNzXD0cWoyeq/EfH+KEHJ5lHiCjHsRh4KGBI91V07QYyPosw+S171Wrh9ykaOptD2SrZhT9mbULqOKNGUib20UTcXQOmnoPylGJORuB+Sqp5j8aUO+lSh0GeH7Zjde1IUC4i68snRpEa4jNGHZUsvhB3nTd6Fz1xIZr/GFE30TaKS6uopb4G7PwIfMQMPeY6QPx8KrI5KFbYidUwQGs0UuA X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 08d5a009-5964-43f0-66ae-08d8cf279d06 X-MS-Exchange-CrossTenant-AuthSource: BN8PR10MB3570.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Feb 2021 07:27:11.9850 (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: 7Fb/YhR1FlbZFwSvviLf+EMk+nDkB15t2dlBU9N3fix34aVQB97OZHK+/HnwMtt2BZE1+u5p3YkDJkyoHNeMcql130T5uYIDploWzpKIhT8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN0PR10MB5254 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9892 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 adultscore=0 mlxlogscore=999 malwarescore=0 bulkscore=0 phishscore=0 spamscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102120053 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9892 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 mlxlogscore=999 bulkscore=0 suspectscore=0 phishscore=0 adultscore=0 impostorscore=0 mlxscore=0 clxscore=1015 lowpriorityscore=0 malwarescore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102120053 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Convert loop to use the lio wq cmd submission helper. Signed-off-by: Mike Christie --- 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 Fri Feb 12 07:26:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 382130 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 E3257C433DB for ; Fri, 12 Feb 2021 07:32:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B88A164E6C for ; Fri, 12 Feb 2021 07:32:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229983AbhBLHcZ (ORCPT ); Fri, 12 Feb 2021 02:32:25 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:42450 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229924AbhBLHaD (ORCPT ); Fri, 12 Feb 2021 02:30:03 -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 11C7P57A016723; Fri, 12 Feb 2021 07:27:17 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=RMKUP9acNwEt8OiYbdJELk4qwh1hItm/OpETMB3QN4lHoy94Tye9l+C80H6Tdnjl+EE3 /BBbKkEcfYuXam3nl5E6uxS99jxiwHbirmwD5Qm49nvXwCW2vw7lPmyx3P1NgwTFf01N Y0TdiIYgNYeuKK3VzxJBF5+FzVoHsWQHa1Km4nnlu/ALDT7cherxk+So4yg7jI/NbvWe YiBRteE3k6bnGPIBkVeIRr7Kw2z7Vhy5QNmI/aPoF3zUoSHCHWa4faxRuA2LpJ8Ku80Z c6vG4RaMsf1NgOjhAP/JqZrorwhTgwg+0ARwu0xNba2KCa3DElfArwogIRGZx3q1seve OQ== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2130.oracle.com with ESMTP id 36mv9dvcuw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Feb 2021 07:27:17 +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 11C7QA0W090287; Fri, 12 Feb 2021 07:27:16 GMT Received: from nam04-mw2-obe.outbound.protection.outlook.com (mail-mw2nam08lp2171.outbound.protection.outlook.com [104.47.73.171]) by aserp3030.oracle.com with ESMTP id 36j4psn5w4-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Feb 2021 07:27:16 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CpVePgyJFJSlnoXjIckIeTo54U9rleEgIVX7iNULYPdtKAhjTIZP/ZDyvkA55Dn8Aj8oqkQ0NcoMFrT7vNqjJNdlZEo28BQTuEQm5LEnhJshE3l1HJims5v6jPDRP4Ga0BlsKEo3TirVlHnCa1Up9SxOSTRQLzOJcpsdf9dpzly2cpQdoOPZFoaRghWuRmrcMBG+1uB/af902OXBRWO+k6WjlG2fUp+tf67XdaYwVs6p/Gvrvehu+OJ+9wd+NUU56Xq1HNcn5ZBHG1wzaDoRxu+WbXj5oIBNAMJfPpQOf25tsgx2umMDNMpl+5eCn5rWquktsF8gBZwiPprQbxdIqg== 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=X8b2xVSK5pWWL+3SwMbwQc8sl0AdHh7cz3zuuxGftiTTuTjFUrNa6hVA1Qvo/4nFr4ykbdy3m7e7p/cLTpdwukRC6G77OzkSJclXN/Z4TPzUk4fbjZOQQrnUGTc49DJi2b0GOGPk58ECQMJO++uIMww537tZHCiY/2ESPdiuzsCVs6h7oSzAn9CARdalmHpDo6pwHFeQobj+TvpGe63hrAjSK7C6bjpl0qbdPAV3tsDeIDK1k/QBS2Ug2/OBRuuIOMztroLplvAudysx3pZFp/RAMXO/sG0MDe2nmPrMiKxSMbRI7RjcaQb42Gb9aRqNHO/QqxoGmlbI0Ft3/o/OtA== 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=W7JA9dvGNJAQDasJLFyRTH0Z1SxSwF0DOVkrhUem7JzaUv/aWd4C/4Xx8rxnYPyC+eeEndzSr/9cWPYvOvIQ9Sp5uUPdFFF0YD73BIOrFXpo3XAQjrHJraPh6qmzJ7LuzB7A7oPp3UlhsVohubAZq8/bbvkxG4Vyn+DgTX1tJmA= Authentication-Results: redhat.com; dkim=none (message not signed) header.d=none; redhat.com; dmarc=none action=none header.from=oracle.com; Received: from BN8PR10MB3570.namprd10.prod.outlook.com (2603:10b6:408:ae::12) by BN0PR10MB5254.namprd10.prod.outlook.com (2603:10b6:408:12f::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.25; Fri, 12 Feb 2021 07:27:15 +0000 Received: from BN8PR10MB3570.namprd10.prod.outlook.com ([fe80::513a:2259:52d5:e495]) by BN8PR10MB3570.namprd10.prod.outlook.com ([fe80::513a:2259:52d5:e495%4]) with mapi id 15.20.3846.027; Fri, 12 Feb 2021 07:27:15 +0000 From: Mike Christie To: 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: Fri, 12 Feb 2021 01:26:39 -0600 Message-Id: <20210212072642.17520-23-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210212072642.17520-1-michael.christie@oracle.com> References: <20210212072642.17520-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: CH2PR14CA0050.namprd14.prod.outlook.com (2603:10b6:610:56::30) To BN8PR10MB3570.namprd10.prod.outlook.com (2603:10b6:408:ae::12) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by CH2PR14CA0050.namprd14.prod.outlook.com (2603:10b6:610:56::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.27 via Frontend Transport; Fri, 12 Feb 2021 07:27:14 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 97ee0b81-b974-419a-7624-08d8cf279ecd X-MS-TrafficTypeDiagnostic: BN0PR10MB5254: 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: JmyaP7XudJQHJEB2ZdGn/SbjeGP3xAaJNUn3XAaR97oo5tgWIs2yxlUwGBJtk0qpbCtCgOfY6JCBJPvyavhrx+s2c1AJGU0zZFiTjmd+Bl9vKvEYQ/NG+kULiTTHmM540F4MrDGU9cfXLGheuGvSVRIJ12+CeJwmIqXSXISELybdbTOnPoMdTjZFofWEwfdbGICZcwbE3aWKCS/v9VW+BY8LmHDzYu4C8Ml6wSmjHfNqrk5QZgYLZQrtBtW+1oKN7tRQMYyiv+48TxJY6kbCI+i43+GuYYD5R9FF2LZYUYJE+clnyj5DXTSZPB1AvR9VyxebD0fmgQDcZv6BH1Rj4/2a9RClUmUy/gI3tu5TbDvGepsvAnpNm0TxVat1/lItq6XDO45vcbEzCLeyebiD0r6gt4w5IJ0utrp8fv3clzt0Uk5qOQjXBTUIRzRpZCcHkRVi+drj6zZQlBANGa2AzYpQaxduy8l+nwBM6hLRFp56KDjjl+w0h3o58b64Xpqi/qHZUV+CS/f0t277aMx1yzUVj4YwveKZfU8ZHRNTpCv+2M0kJX4yRMM5HvXE0xDu83MyqEQxrQ19ByOdFicLuQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BN8PR10MB3570.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(396003)(39860400002)(346002)(136003)(366004)(376002)(8676002)(2616005)(4326008)(316002)(8936002)(6512007)(66476007)(16526019)(107886003)(26005)(956004)(6666004)(69590400011)(186003)(83380400001)(36756003)(5660300002)(52116002)(1076003)(66556008)(478600001)(66946007)(86362001)(6506007)(2906002)(6486002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 1fhuh6yrO3lzYnQNIibBYIqoXmh5xI0WrVuSDRkCuxq1QmNnBuXwt6vmQrBO7XA/vKELz5Vvgdc+Q+GQEAfAlaTH652UlCC6Iv1glGW2sbIC9Xge3lRygjChQ2Zw+60c2+IXVT0oPflKpZc+DKMaf0lJgUO9Rml8GIbAJCJz1+cJ8R2keL7s9tPAhwlLT+DJXcewXbZtWPDd2hgNNDUifoeb+U85mlopur1h4MCinjLPcNT4z0pRUjzO5aqlrklNFuNqQwDhNORQf101aZMHHAB7vCyUFh13s0ir0rtTCWDBGbts+J+vlmzGeQKEqXumC3IIbo3CYxm2KigefoWvmQKU6FtQUmAUpZpfjBlaEvQdBNG9FkqHVJBvyhnIggTHhd8T+zbJIK5XWjmOrDM4OwhRCevkv7EvYVs5h9xLDf9lukDf9EfPkpHZEfShtdcKroJKSCLvQ/EUfqSaJmJr+ba6yYdNlY4zv82JOIwtL1d2vNvcBLq+VK08uK1v9C493LpWU75US1nugUh4cuIen3twdSgQPAVugiQDSi1rQipxutZrrv9Tw7WChH5UDqVbc7W+OY9lfbFZ2H5+ely000TE6+dqXEeN85xlpJ3e/s2wKyYZfqf42mPgtVfWMWiiaTnXX6S4aMCzidvYobugy5fyTAIN34HHJ9Ls3aS+pfQkNrRKO2lbzT+1+5ifYraoO2WMtg5NAy00+SXqVDFdO1HvSOpxISR6u+eJ0LpLS/NWmDCzvBgrztt7JivAwRpgfoQF4nzXSRsdahidw70y+yzMLUYvHWWkKWxNyzRlMA5bDmc+ISzFMDgMmAVRdjWJLorkcuCDYfZrfdzqwI24vgpZspqSS4gyKigP1tV4S71Y1dvaS+A+hy0r7639gyyxm1sZUIFBvrI1Ohm51gbUjXvArYN8xW024NOWvLaaDW6Ej95ShLKsX4txRKhOz0iAmDGJWYpB2QQIRksuziaIlv18V8jqiuA8xrzLiUf8e8W+yrqPojIcidOeMKhaxuJi9JxdLwn/DmwEMgZjgw0n+bPp6fqhcid31/krgdDhYnPr5jejq6LXI3A61WArCI47sENO/28b0edJNkKHf6JUiKOD2BMPpHRgmThUwVfgDt8B2AM+qQJLI9A1c3t04dU6IXHMi18ldAuSmPBp4PFJe0unY6ZU9ziaQjmIFg8wMWgOo/xfx87pQlJvY2W1ouI1ZAjcVd18zpVJbBxLyRpmady2OxgfhykDfVyhYGxRodbvIMNC0ZKIePiEuxl7ZKs+8PqPdt6PiVyuuRVgKIoNFefe81EjnTOiW6QyRfeAh00JvZ/IaTw1q61u2qhJWYXn X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 97ee0b81-b974-419a-7624-08d8cf279ecd X-MS-Exchange-CrossTenant-AuthSource: BN8PR10MB3570.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Feb 2021 07:27:15.0123 (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: Cpy8qxPGbsIlyEyzBQJ7jjb1mshjHRgjxy9TaKyxw30mdApppNRoLjPurzJfYxfJiYqW8v08ZLpfHK8Ihizra8nVVRM7uSLSH8hUkaiUZjw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN0PR10MB5254 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9892 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 adultscore=0 mlxlogscore=999 malwarescore=0 bulkscore=0 phishscore=0 spamscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102120053 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9892 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 mlxlogscore=999 bulkscore=0 suspectscore=0 phishscore=0 adultscore=0 impostorscore=0 mlxscore=0 clxscore=1015 lowpriorityscore=0 malwarescore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102120053 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This patch adds plug/unplug callouts for iblock. For initiator drivers like iscsi which wants to pass multiple cmds to its xmit thread instead of one cmd at a time, this increases IOPs by around 10% with vhost-scsi (combined with the last patches we can see a total 40-50% increase). For driver combos like tcm_loop and faster drivers like the iser initiator, we can still see IOPs increase by 20-30% when tcm_loop's nr_hw_queues setting is also increased. Signed-off-by: Mike Christie --- drivers/target/target_core_iblock.c | 44 ++++++++++++++++++++++++++++- drivers/target/target_core_iblock.h | 10 +++++++ 2 files changed, 53 insertions(+), 1 deletion(-) diff --git a/drivers/target/target_core_iblock.c b/drivers/target/target_core_iblock.c index 8ed93fd205c7..33c88eca090f 100644 --- a/drivers/target/target_core_iblock.c +++ b/drivers/target/target_core_iblock.c @@ -61,9 +61,18 @@ static struct se_device *iblock_alloc_device(struct se_hba *hba, const char *nam return NULL; } + ib_dev->ibd_plug = kcalloc(nr_cpu_ids, sizeof(*ib_dev->ibd_plug), + GFP_KERNEL); + if (!ib_dev->ibd_plug) + goto free_dev; + pr_debug( "IBLOCK: Allocated ib_dev for %s\n", name); return &ib_dev->dev; + +free_dev: + kfree(ib_dev); + return NULL; } static int iblock_configure_device(struct se_device *dev) @@ -171,6 +180,7 @@ static void iblock_dev_call_rcu(struct rcu_head *p) struct se_device *dev = container_of(p, struct se_device, rcu_head); struct iblock_dev *ib_dev = IBLOCK_DEV(dev); + kfree(ib_dev->ibd_plug); kfree(ib_dev); } @@ -188,6 +198,33 @@ static void iblock_destroy_device(struct se_device *dev) bioset_exit(&ib_dev->ibd_bio_set); } +static struct se_dev_plug *iblock_plug_device(struct se_device *se_dev) +{ + struct iblock_dev *ib_dev = IBLOCK_DEV(se_dev); + struct iblock_dev_plug *ib_dev_plug; + + /* + * Each se_device has a per cpu work this can be run from. Wwe + * shouldn't have multiple threads on the same cpu calling this + * at the same time. + */ + ib_dev_plug = &ib_dev->ibd_plug[smp_processor_id()]; + if (test_and_set_bit(IBD_PLUGF_PLUGGED, &ib_dev_plug->flags)) + return NULL; + + blk_start_plug(&ib_dev_plug->blk_plug); + return &ib_dev_plug->se_plug; +} + +static void iblock_unplug_device(struct se_dev_plug *se_plug) +{ + struct iblock_dev_plug *ib_dev_plug = container_of(se_plug, + struct iblock_dev_plug, se_plug); + + blk_finish_plug(&ib_dev_plug->blk_plug); + clear_bit(IBD_PLUGF_PLUGGED, &ib_dev_plug->flags); +} + static unsigned long long iblock_emulate_read_cap_with_block_size( struct se_device *dev, struct block_device *bd, @@ -337,7 +374,10 @@ static void iblock_submit_bios(struct bio_list *list) { struct blk_plug plug; struct bio *bio; - + /* + * The block layer handles nested plugs, so just plug/unplug to handle + * fabric drivers that didn't support batching and multi bio cmds. + */ blk_start_plug(&plug); while ((bio = bio_list_pop(list))) submit_bio(bio); @@ -870,6 +910,8 @@ static const struct target_backend_ops iblock_ops = { .configure_device = iblock_configure_device, .destroy_device = iblock_destroy_device, .free_device = iblock_free_device, + .plug_device = iblock_plug_device, + .unplug_device = iblock_unplug_device, .parse_cdb = iblock_parse_cdb, .set_configfs_dev_params = iblock_set_configfs_dev_params, .show_configfs_dev_params = iblock_show_configfs_dev_params, diff --git a/drivers/target/target_core_iblock.h b/drivers/target/target_core_iblock.h index cefc641145b3..8c55375d2f75 100644 --- a/drivers/target/target_core_iblock.h +++ b/drivers/target/target_core_iblock.h @@ -4,6 +4,7 @@ #include #include +#include #include #define IBLOCK_VERSION "4.0" @@ -17,6 +18,14 @@ struct iblock_req { #define IBDF_HAS_UDEV_PATH 0x01 +#define IBD_PLUGF_PLUGGED 0x01 + +struct iblock_dev_plug { + struct se_dev_plug se_plug; + struct blk_plug blk_plug; + unsigned long flags; +}; + struct iblock_dev { struct se_device dev; unsigned char ibd_udev_path[SE_UDEV_PATH_LEN]; @@ -24,6 +33,7 @@ struct iblock_dev { struct bio_set ibd_bio_set; struct block_device *ibd_bd; bool ibd_readonly; + struct iblock_dev_plug *ibd_plug; } ____cacheline_aligned; #endif /* TARGET_CORE_IBLOCK_H */ From patchwork Fri Feb 12 07:26:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 382129 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 BD554C433DB for ; Fri, 12 Feb 2021 07:32:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9074C64E65 for ; Fri, 12 Feb 2021 07:32:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230007AbhBLHcf (ORCPT ); Fri, 12 Feb 2021 02:32:35 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:38378 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229927AbhBLHaF (ORCPT ); Fri, 12 Feb 2021 02:30:05 -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 11C7PnUu142718; Fri, 12 Feb 2021 07:27:18 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=1iNoXyoC4xa0O0nQ251es2Dfg6INqaheeFO8Sm6kIQ8=; b=CG2Tjt85LbT5MAwQAdvr8l39TDwjJB2U/+clnJ4pRLBILFNGvms4ZT2WwPeieJ/IYQyQ 3qqRdYvqe91TtOO4NIonvSyhvG5otQ/PLJfbPr+P0x8o4XSWw9r4VKa59f9vGIF5XP/8 7kz+qnPAh3Q2ZMttBHQI3C7KlLrNkVEgnytzPR9zdRTkDEwoNjYa+7XN8XnEel8bITQK QH/hfAO/a/sA8/b6JV/O6xsL0HfoYcX+NH+1fvJEvx9TndABK8KbM9Cj1qmieBYCGL/Q TrDiJUnGMFsujhiyG482al3hf2FYNvPqjsgBDRbjTdFsybJ3zTDW+mjT/Q7Bl2O9IBll NQ== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by aserp2120.oracle.com with ESMTP id 36m4uq0qmn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Feb 2021 07:27:17 +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 11C7QA0X090287; Fri, 12 Feb 2021 07:27:17 GMT Received: from nam04-mw2-obe.outbound.protection.outlook.com (mail-mw2nam08lp2171.outbound.protection.outlook.com [104.47.73.171]) by aserp3030.oracle.com with ESMTP id 36j4psn5w4-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Feb 2021 07:27:17 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KbhUW76vMqVEDctUcoeZudGCDfxkNjoJqTWg1CJG1H0Pw4c67jFlM6C0uSMmeiPue5U5W0Zw4JR3WU26HDDb+OXTpOLPaStJV4TTQg+pUWsSmeiCI62OLlTepZq/3/MmCW1+AiBO0O3omSUoS+wDnAH4SH1GOSR35hrGFdaBtR089x9Ek0v0UMEYNIF+gjo3rlb+pL6uP/AUCtEPAR26OJxLN3QiRwxvdLeDV/juG6vuA3d2zsUS5k3hPFhYUcGxheRozEBrhZywgBtBK5SUyycT3NvL5GNirEsMYYrHkiNyV78yPrhvxbRDr0dzqKbUbv+UtDUzlGXj5985SJnngw== 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=1iNoXyoC4xa0O0nQ251es2Dfg6INqaheeFO8Sm6kIQ8=; b=S9nahK9TqXd6cQfu7iKWGsIc6KwHM2AWYY2OI0hI4L91pyPnU4RKkaaa3njGSO/YLJvG+FXXU2NBED8D/UNrHO+FlUVSnzYlGs2DhXS5R/h3sJpeM1Nq8VmGtjpheEDdUWPv6b/CxSb43cSB0fQKDdDFKtJj/gtAAGk21hFbAkgQnxpvtgP1fMbRe1ZmKvBquhlz5ctT5WUzdZW4pOiF33XwKvCRflBzSwR7QRqE63BA2cGYJ1S+UJ7LHPItGgLRLo2yJ+0LhwMZM4E9yAOjRQxBLECWF7NwfQPql6Nctw54jAUxZozKlTQBdj0FiOdi7iZZHGn3+rnrnJTR/Ynlqw== 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=1iNoXyoC4xa0O0nQ251es2Dfg6INqaheeFO8Sm6kIQ8=; b=efOlhJG1Yg5G+2cmLNQwT2QskBtYuLTIocvdJlPbkvut7IommX8n8WHoSIUCaacdAVh43TFWHKQDAPEm1Q/P0xC52MGvGyrzFVyXnAkmQqEbUYjcuNwvmW0QHCOu90YzM8gAmZhGw3TaBeu+P/bTroU/+UfsBk7vjdvEWCi+sVM= Authentication-Results: redhat.com; dkim=none (message not signed) header.d=none; redhat.com; dmarc=none action=none header.from=oracle.com; Received: from BN8PR10MB3570.namprd10.prod.outlook.com (2603:10b6:408:ae::12) by BN0PR10MB5254.namprd10.prod.outlook.com (2603:10b6:408:12f::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.25; Fri, 12 Feb 2021 07:27:16 +0000 Received: from BN8PR10MB3570.namprd10.prod.outlook.com ([fe80::513a:2259:52d5:e495]) by BN8PR10MB3570.namprd10.prod.outlook.com ([fe80::513a:2259:52d5:e495%4]) with mapi id 15.20.3846.027; Fri, 12 Feb 2021 07:27:16 +0000 From: Mike Christie To: 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: Fri, 12 Feb 2021 01:26:40 -0600 Message-Id: <20210212072642.17520-24-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210212072642.17520-1-michael.christie@oracle.com> References: <20210212072642.17520-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: CH2PR14CA0050.namprd14.prod.outlook.com (2603:10b6:610:56::30) To BN8PR10MB3570.namprd10.prod.outlook.com (2603:10b6:408:ae::12) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by CH2PR14CA0050.namprd14.prod.outlook.com (2603:10b6:610:56::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.27 via Frontend Transport; Fri, 12 Feb 2021 07:27:15 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9261523e-d005-4c7d-510b-08d8cf279f69 X-MS-TrafficTypeDiagnostic: BN0PR10MB5254: 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: O761EKvGCnfzyXokc5CLuwoeYSneh2upsmrVHl6lnZlqZSumbEEo8I1RiTUOcvCaB7kW9ZFgygRH/W63PV0eOJ5tGbNGvL6krl5su4rMmYTZshuJH1gW/6Eu/3+X2N9HSCQq0PEkBP12r2y5g1RAdOgMKD5dgOk5+m4xhaWPm+RXjv84vKWKwx4c0NSXtfGjR82oa7F6BSyvItZ96UTU4kGwlcj0H2OXEyfW4mpEiDAcqA2YGCBczBDTWHArlDUuT5ZfaoB3qlv41bGLGK4n1CI+LfC18yEWdGoUy8FVkpyzHDUPHHkaf4nZmDzsoqBi4bJ6VYlabyx0Lm8uh374Ln5EMfw2c9cJT4q+UpUzNedbPnTxBjsDRvCNTY+HbDgtj7nvgo0SrrFmxRM7h5s9YRiIkdbIguj/mtK+YyXQXt4fC0D7yJQjsUKkV7RWCoYjDRx8Ug71zbMx+X8+gW9EjnkiNL81sEDH2WQMcUQ/j5vdccGlIxH7UEiUgk6jTMAF6UCIiC5kgc7nO91Cgn5s6bTMGsO0ZH/3teigwDcyKvz6djxrpNN02+ogWHCdlP6W4wPynu/mYlanJD1Xbo3O1w== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BN8PR10MB3570.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(396003)(39860400002)(346002)(136003)(366004)(376002)(8676002)(2616005)(4326008)(316002)(8936002)(6512007)(66476007)(16526019)(107886003)(26005)(956004)(6666004)(69590400011)(186003)(83380400001)(36756003)(5660300002)(52116002)(1076003)(66556008)(478600001)(66946007)(86362001)(6506007)(2906002)(6486002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: kGfNDJ/pxX+TsuQQKKkCm78VdB5iUqERC5UTstO4MY3gqTx90tej+DA0zrDjUswbWwFPcutxd7hs1b+6SRXt036Y48SOzUvu5LxU0ksaN1YmfMfK4+IdtBw6iiAIwy2ObjbMp6ECpd3TbdGFpEt5rpzYf0cNiO7ixklDnpvZlp9Pj0KaRVr9Em5P6MrNVMNDWuGfyIie2cKd5xR7eM2dTxZE4BldlACdd/XGNP6MEyO9s5wZpYHIAXs6i806d6nHnV8pRlClBCv8mXkBIFqJKNC10S2QbEsy59IT4v5e6dxp2ed2PKj4PpPcYBjW1Ld7G9kx99BT4GJ1KMEpoNWUFr9s5DrnQUrxD88bT1jtYL9dE6D3Vdmsi5j/s/p3McWbq8HsCWlouOVaTwi8z2ooZtouby4we0m3OkgY96ikdr1Vca+VgE52X/EBO2YnTiKSL2EJuJMBxnniRYyu67zy+Xzn4gPe7YCM3aMAozjaaBoMplKx5De9NGG534JjaC09mfgBvK7msZHNYzuCygphIXeeBmVP7XYLw3xy5Nae5U/CJeXpYKgVs7D1lwj7ueSGq7B45KB3rseLkGfpfGMTZ1kd2d44yMbJTQoVvFLFkz+pMagZrRLfKsG1+z4Ol8UdllGQDcgg/hESxfB90ouM4CY/Kvixbh/DeWEtegII86gqbZToH2NZQV4WllobeHyuF21a49afSS3XR8gYX42VDqyu/m3jBH+4grVTtJgK4Wtvtwe5qgJnyfwcZhpuGJbrHKzRCI+SLA64SBFdzuMt8Vby+YVfL6AwOjxngWQVAwXmB7ves2K+u6wkixDcT7enbHjacIH79+p/q4qH0S/1ldPInqsTbYy5wf4NHaeBVnHb1Zm/lNQoW7S4a2Vw0Qk7sE9ryXefNIxHmdef8yVx/WqI9aCEiUBhxQ73mio2nS8TgACytPHxApuDPjCE92iSsiEmFDQn7gkrFe2Erxf0M0x5DWIDM7jmERJUUR3sjALKynK1IBJeLVpDPt0RYMjzA7lC5R5JtoYzowSoKut6wNu+DQke+6cPcS4b5UC2Pl5NvFkWr5qyGAr9bdowxa8tFCg1/AoXYltW+jzCP9G6C7DQWVEMi9xeRm2szA1o5W/ReKEJrLU/CjnQP+J9zLfm7pAPIhYfik+4utpkCvK8Jc6pv1q2rG+lsw3RlZfTJXEMpskUZSNm334rb1qbRzIJZiwJNfIa5J/KR35LwukMCFeiNUpxvRRJkkiHKLoWQdZEonG2RHTnFdfXAr1wALK3SOyl7dAeKr2Amg3mjKyEqnzX3uwNYWeNKHbxQkeC1v6PVGZsRUxLZLIPv4eB/qMy X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9261523e-d005-4c7d-510b-08d8cf279f69 X-MS-Exchange-CrossTenant-AuthSource: BN8PR10MB3570.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Feb 2021 07:27:15.9627 (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: 1tPr+OtcFT8h43sxbJ7YaHll3E24fJXJGCgmEUZMmcIm6Dq8aXF0N1LMc2ODNwjyisKa0Z0Wx0jtW8hARKLgiiqEMT5v3535Vz4S+c7grGw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN0PR10MB5254 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9892 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 adultscore=0 mlxlogscore=999 malwarescore=0 bulkscore=0 phishscore=0 spamscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102120053 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9892 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 mlxscore=0 mlxlogscore=999 spamscore=0 impostorscore=0 malwarescore=0 clxscore=1015 suspectscore=0 adultscore=0 bulkscore=0 lowpriorityscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102120053 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@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 --- 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,