From patchwork Wed Feb 17 20:27:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 12092151 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6AF68C433E9 for ; Wed, 17 Feb 2021 20:29:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 15D4164E76 for ; Wed, 17 Feb 2021 20:29:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235063AbhBQU33 (ORCPT ); Wed, 17 Feb 2021 15:29:29 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:43848 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234953AbhBQU3U (ORCPT ); Wed, 17 Feb 2021 15:29:20 -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 11HKOHWc190368; Wed, 17 Feb 2021 20:28:30 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=YifcLh0il3TAoAtiSTT8Q8kHskbGL/+3duj92Vi8qB4=; b=lJJ4E+mV11Q92pff3rFoVbH6t+ltjIQ0gZzyJloSJsoUiDbKGr64qU/nP2NURdovENA/ 2S6aAPSqFvEI/tY5ctXjI7NPryTLnzf8QNczazJ/VabAS4ILyyVTVzEn2BIPSp46nXrJ YIjy0LtAA+X+hiMlNPgfD5GCDGbs0O2DFaOr6RmNwSKxABTcc3WnDSaO4DGznE+CB/c/ 1XJWRSKa4ERK0hcxF5ATrjUD7MaGImpyFPmq6TFOQQZ74mf/Fkv4jTOxIqRJcvRfEAY5 9UsYd4bCC5wF1kVW9Ne/iatIW8IezMkczEW+EggU8cTRjOupEtlo8vtuNSxE6BuaiTBG Rw== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by aserp2120.oracle.com with ESMTP id 36pd9ab8gf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 Feb 2021 20:28:30 +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 11HKQDug191708; Wed, 17 Feb 2021 20:28:30 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2171.outbound.protection.outlook.com [104.47.58.171]) by aserp3020.oracle.com with ESMTP id 36prp0p656-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 Feb 2021 20:28:30 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=I5+kHW2wVjPKPpSYgsRw99FOg9jDR3ogHuDX7qAYhoKEHjxXxmO+Q5b1WUArzwRpbeIfB1q5N0HWQdGCr2EviNqNdszIoNyFnw4iSdp9FFXpaDhjL7Y9ToBzqZXtf5kdErZuVpWq+v4yWR5ekfvZ/QjDQgymhS0KlF6aPGxp4/VCK8yYmxUkBzHX/G3JjWZRTJKb2EbTapEn7ybQ53ZeDicbY1NAexQa0Ra95KQ/lRLULTH8J5ia3FQ67q1YClJpkNXkgqIfX6B1+QtEZm3AMySopZG+vuQVJJaUoFXKxsYoliahNRrzqT69BHDG1sF7JX88afQXksZgoiW2U5lY8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=YifcLh0il3TAoAtiSTT8Q8kHskbGL/+3duj92Vi8qB4=; b=gKFnJxcuscD8i7Sse9pqx0nTOKfEDN7sXT8+Km7Lbmp83bV/ZoxidgLMrupyqIJQrxp+CjPI95JdT5iAJ1CUWbr73rP+Or7jRob1bMrA55XxrhLNEs6AH2IZFRrlGGb/tt9Tk//YV/AxpjH4nDU2k5gK0jvncYjI4zbjdU46PqbfPgIYsioO3ja5/KJhvGjoJ01xh/mESWDS/WlfhfB7ditd4E9KF2M1OZrJOwFDljPi++DFvxSV35caR2YsjRxXNtwRqUFFBnn0kZARBRMAFc9ukp1At03dUTsebV6PMPr0EqAXnTHgrGCwF1tYvSln3/I4fvVFTeTSwCSb2GwMpg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=YifcLh0il3TAoAtiSTT8Q8kHskbGL/+3duj92Vi8qB4=; b=dMTuGJi13hmAHHGWHNmP2EKmXzAEH0AaWgXq71mtkuaSPZ5JmVC3KU8wAT6XHYexJ7REb+ZeJqzb4KMJBv4TzXi9XRSubCyWmSWrlfQoCjkldMku6/NhwNvyiiQpi/kHCQenl35Uy37hMZp22iqDt5v/r7kt2RryxdoE4RDjPOs= Authentication-Results: gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=none action=none header.from=oracle.com; Received: from BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) by BYAPR10MB2677.namprd10.prod.outlook.com (2603:10b6:a02:b7::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.29; Wed, 17 Feb 2021 20:28:23 +0000 Received: from BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::1d86:b9d7:c9ef:ba20]) by BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::1d86:b9d7:c9ef:ba20%7]) with mapi id 15.20.3846.042; Wed, 17 Feb 2021 20:28:23 +0000 From: Mike Christie To: bostroesser@gmail.com, mst@redhat.com, stefanha@redhat.com, Chaitanya.Kulkarni@wdc.com, hch@lst.de, loberman@redhat.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org Cc: Mike Christie , Himanshu Madhani Subject: [PATCH 01/25] target: move t_task_cdb initialization Date: Wed, 17 Feb 2021 14:27:47 -0600 Message-Id: <20210217202811.5575-2-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210217202811.5575-1-michael.christie@oracle.com> References: <20210217202811.5575-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: CH2PR15CA0001.namprd15.prod.outlook.com (2603:10b6:610:51::11) To BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by CH2PR15CA0001.namprd15.prod.outlook.com (2603:10b6:610:51::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Wed, 17 Feb 2021 20:28:22 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1179c2db-ba2c-45f0-9b49-08d8d38292a7 X-MS-TrafficTypeDiagnostic: BYAPR10MB2677: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6790; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: M/SoyNK1RpYIWZnQ1Ztk6gT/A5vb3+gVCV47yPnf83C3KBoxcVE/LlCUt4T9pNW5C3BTMUYN3kPlLgRYnhoe1thSvpx+y5J/yXwTxWIAoC4NVerwHCSt5P/qA8yvQbhJFFtlVzHJkJuesEDW0WiDhy8iN89Cdj6BMQU1OjhYiE+a9+zYfYwX8XCnLTP985roovQz0M/aIHedpmHHr1s+Hj36Q9D1xqVdsu6d/aK2+Rov2qmuVVcsiSZAmUgsNEpcV3xafh4bCjyDkOmTZFlAY6kjBhUOW2nSsEH09MnW8Pu23deQ9TWxyT6PS8fLaiSEHt4/Qh5GmYM5vs95TPsyLLXxUqjIsI/Q/6hWDTBhFQC/RxU45v3CHyKWi380mEBRiSpSIrQDyriD2Xt1ft9G+aclTWDfDDVtKICfInRynYX9gow/rlPVoa6CZeUKXnhz0KjWnhbFsiqAnQFhXgYxegzLCVWglUryM4Eu8ynnQMLWhBYxbtLY5Z9ye+w56cZ7CMVOC6r+7k2aw69oqMTOzfQdJ+HrOh5fYOv876Z+KShCtloOf7RacSeKpsvdA0mFdJ515/yw5yOOXRxOnupvdg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR10MB3573.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(136003)(346002)(366004)(39860400002)(376002)(396003)(2616005)(8936002)(956004)(54906003)(6486002)(6506007)(6666004)(26005)(316002)(86362001)(107886003)(8676002)(16526019)(478600001)(1076003)(4326008)(52116002)(2906002)(6512007)(66556008)(186003)(83380400001)(36756003)(69590400012)(66476007)(66946007)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: aweNYekFDXsYUgaD+d5qY6+jzJvrFZr7g0lgc1bM+gppFuj2faQqLBiuYGuICID4sDMiO4+S+SzRDJXcCchA8/3ECyYw8zGL5CuiNC3Yjs69lrdfmw4AYf4ZaA4F50LnBHFKHcqMLAoVrZmGcQzt83Z8ukAqHtf43iZGmodilrOu/B7TtVl3dW9gnZ8Dxly7vTvf+Ik+SE1PvAQP4DD2PEwANU5NAlBEZ+hcIoYCETmQj20MXji1hdh7kDKmIAkH9Nec6bL+larFFVGkzrJCyMdYWhMImYOSAyUVPiZG6x7c6fW3dCyiwvHWG45FFWPBGyooUUtEOfcDSpF1usRQ66lk+2G55htW44DzSfomsKXQf7uzbaTY8Rkt6LLCzuNrBcMQa9uhIYSDuJ4vdMIDI1MVBofpMVjVbEMl1Yt5mq3ScuK7+9VEupHtDBPq4Y1ZcBPAS+/BAjgNcZA2VIp8j0a62lrpk+qpI77+ZBi9jVeZHt7qxMSuRTFWYTLSchOEOwy0pyBjaS3Sg9i78wAX5GpST91WrNymHE+2NVTGoOVwrHyskjKGRj5aIhPTudeU2yPaQJY5NzG9bsJpixZ1C2KEaoxOo52qvEcLUEVwASG3eCRYpZ5IH6BXyj1vHls3FfcrTy4Wi/EE9PNu+b40LGX0f7iRf0XdU2B0CX2DnSUY+OrGkEHWFx0zIyRaiILJFiBpk7/lhBMjKlG3bad5NEvp97I1H0slksFoFqzg1EQLKBwF/DK7XMJkJPzzPp6JM+oXsbgchPhPvkUBgU+yFD51meceL2xE9f50/ZbOc2OD0XSEJ/OEKuJ2P28DYgpzrbdhW2vmvJLqPqMwceSDKcUOGlWYao+B5/aikueczXZ+nBeQA0adaDJ+cVkf0fe7jeb296s0zgfT2J++IpSs78IAUThRBa/CoSniFFLJGu1IPOqBXDwhAwwgtwNuGAUP5yJ7t1XsRd7Wza6VRjIrnJNpcg+uCsKzitbMgPtvKMzcsG0JIbOfuUUk7AH16uqTwYc6Lm92Cr5ZFsZz4TcmNtCW2znjxFLjzhW7xkeDkRuWq6pMKr/uu++hKtR4tWVjMVKGnEgNHzbZWH7zS6oCRf8e7fsEFUET/3nPnen9ndjAFbqa3z0RmLkt2JtbNCCkqB2RA6mWMoXElD/2f24USpDKfanzL9HY2zuv2OrfENrvkR372FSMkblGB0W/q8Bz9WVOgMQubbdwGmZRNpDkNo9oLR0vg4qe9A+b7wbxu4eAReL7SQyllW75bhGbgnq5tujFJWFMSi6P500m+nGExPB1TfxWdikuOdh4jXMsMLVzimpB/e4i8KF2H/0/PFYW X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1179c2db-ba2c-45f0-9b49-08d8d38292a7 X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Feb 2021 20:28:23.5710 (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: tyutCLX1AqSHL9T6IlVKl/eZtMsfSXVRcqqIYHOQINdd9m9X8pF+F7S2sxT1UxEqcdjhachTFD1OuMPS3gKUgeUP48/7CJJpl7fBsaizZaY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB2677 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxlogscore=999 bulkscore=0 suspectscore=0 spamscore=0 malwarescore=0 mlxscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102170152 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 clxscore=1015 impostorscore=0 mlxscore=0 phishscore=0 mlxlogscore=999 spamscore=0 bulkscore=0 priorityscore=1501 malwarescore=0 suspectscore=0 adultscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102170152 Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org The next patch splits target_submit_cmd_map_sgls so the initialization and submission part can be called at different times. If the init part fails we can reference the t_task_cdb early in some of the logging and tracing code. This moves it to transport_init_se_cmd so we don't hit NULL pointer crashes. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig Reviewed-by: Himanshu Madhani Tested-by: Laurence Oberman --- drivers/target/target_core_transport.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index d47bfd8b0f87..5c4adde96d5e 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@ -1389,6 +1389,7 @@ void transport_init_se_cmd( INIT_WORK(&cmd->work, NULL); kref_init(&cmd->cmd_kref); + cmd->t_task_cdb = &cmd->__t_task_cdb[0]; cmd->se_tfo = tfo; cmd->se_sess = se_sess; cmd->data_length = data_length; @@ -1430,7 +1431,6 @@ target_cmd_init_cdb(struct se_cmd *cmd, unsigned char *cdb) { sense_reason_t ret; - cmd->t_task_cdb = &cmd->__t_task_cdb[0]; /* * Ensure that the received CDB is less than the max (252 + 8) bytes * for VARIABLE_LENGTH_CMD From patchwork Wed Feb 17 20:27:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 12092147 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A6BEEC433E0 for ; Wed, 17 Feb 2021 20:29:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4D6FD64E68 for ; Wed, 17 Feb 2021 20:29:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234376AbhBQU3X (ORCPT ); Wed, 17 Feb 2021 15:29:23 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:52938 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234055AbhBQU3P (ORCPT ); Wed, 17 Feb 2021 15:29:15 -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 11HKONtg017798; Wed, 17 Feb 2021 20:28:28 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=HfnTdvYNAhZ/V14HKCFNOmSmkSA2UO5nPhFpVFbegJ8=; b=ESoXIMF84FBr72YkXdEXuLUMHtbxZBMY/DK+SNW4RNLSds0YPjZq/Z/3sYthPPkb9w1U 4NirfAeUboWRTQJFpdNVdAfBZ6CL/QYvtmULJlCr+8vfaPFi1W11BMiOZbL816NVWA/Z arZGWMeNvb88REp2sTf8aun0B7xDgm9DWyPWQojSHpKkl5ktZVQgbJheeTjB7qjJu8v5 mOCAoYuR8X8AmraHcYRn7ndPHPPDRJzyBed3Li6AXgExChxQOb2ZgBe5GNhMA380dm8s eH4I45VbKufvv61q0FEZ1sz1vNgtzh0DDQePf6wGIp5WqcgNG74c9rZU24EmrFji23aU Mg== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by aserp2130.oracle.com with ESMTP id 36p49bbwwe-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 Feb 2021 20:28:28 +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 11HKQOlM004067; Wed, 17 Feb 2021 20:28:28 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2173.outbound.protection.outlook.com [104.47.56.173]) by aserp3030.oracle.com with ESMTP id 36prbpwwtn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 Feb 2021 20:28:28 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WoSRoGXVnLj9+gC3mbVq+GLqHJDIpIilU6f47xak8aiw0cE1r8ziSS2Ub7y6PAcYP1/359C+vOsb7AZy/3Jz5Q/YOq5BEsX8nRD26DOQO71JP8m/GfhEw2CpyqhqbchErXtaXaadx+iiqSGoqEvjvEMCTkewhXnblD8Sv8lCHJ1x+qjUGe6aVkS5EaybBHC1ob3j9LdnZ5Hiqlro9EzLIHp1gFbNoIf3t53IMOIRVYWZwWgIEPNclvFJElCzVZppyFwiT60NCIDfDmID1fup74xa0GfDamflQnNqKxQDq2arRMd/2jbrSPQNXmKpCteu2nRqOvRzEnCyan60lZulWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=HfnTdvYNAhZ/V14HKCFNOmSmkSA2UO5nPhFpVFbegJ8=; b=FkVdPw72i1SXwj+3oP8Coi9W8J4iK9WZT4Cxbs6oJHKb011PhKhSgKVbirnc2O55lNfTXuajhUZU/hO0ZcIJ+aJutm6ogQ7dpjp+OFsnwtpDNtAgSiX7OCVEUxE+V0mQPrSBXcoKq0wa7NAoH6mmeNjQk/ZFr6avlRQBjdeneNl+wuhLuAcDkajtTYgK1KCTPPDK8vlHdHGKNDDFZyVVDF3Xu5duYBuiCLMFFL2L/rI1ltZ4icq67dKnBZXe42gPWgd5dpS479JigZFknA6k8LwfAgPs8Ht5zVjulThet+0rWM4oBvWzn7cqd8mVE390BoMNm7W8By8lI5/f+6vyTQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=HfnTdvYNAhZ/V14HKCFNOmSmkSA2UO5nPhFpVFbegJ8=; b=nbLalXOnXqn3dUrNZtd9YWGebpeA1M7/MPwz79X7Srjw/0T0zyFrpJWSbxzbw+oz255flhsd//r0be+4IKcnoAnXoRkK8WlYC+HRnupdO7guCJxptM1gdd30rd7zHV7CwEq6bVmtk2BQW747nfyk1s8JS/TcfCJ6spQRitLYGYs= Authentication-Results: gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=none action=none header.from=oracle.com; Received: from BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) by BYAPR10MB4101.namprd10.prod.outlook.com (2603:10b6:a03:120::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.31; Wed, 17 Feb 2021 20:28:26 +0000 Received: from BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::1d86:b9d7:c9ef:ba20]) by BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::1d86:b9d7:c9ef:ba20%7]) with mapi id 15.20.3846.042; Wed, 17 Feb 2021 20:28:26 +0000 From: Mike Christie To: bostroesser@gmail.com, mst@redhat.com, stefanha@redhat.com, Chaitanya.Kulkarni@wdc.com, hch@lst.de, loberman@redhat.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org Cc: Mike Christie , Himanshu Madhani Subject: [PATCH 02/25] target: drop kref_get_unless_zero in target_get_sess_cmd Date: Wed, 17 Feb 2021 14:27:48 -0600 Message-Id: <20210217202811.5575-3-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210217202811.5575-1-michael.christie@oracle.com> References: <20210217202811.5575-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: CH2PR15CA0001.namprd15.prod.outlook.com (2603:10b6:610:51::11) To BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by CH2PR15CA0001.namprd15.prod.outlook.com (2603:10b6:610:51::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Wed, 17 Feb 2021 20:28:24 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 804c48ec-d067-43bc-9c73-08d8d3829415 X-MS-TrafficTypeDiagnostic: BYAPR10MB4101: 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: 6L3L2O4TFBUcUqW8oUIV91ePO33xuWGRnkO0oM+zrJvQkcsOdPZ0vbtzD6vc9ftXubV29Op5DQCn/zYX+dLhX6tx0Yd6LInXkTT+JF60dv2HiULTMzRrk+NLDNiLR5bzxhkylL0Y6a4yjIuK8leJYRFPC7iJwwXkf+V1mqlAdMi5Phi9nxc9AD5eQp0KsCx5DtiNfsqIVVOQl6zlIHh0akqWEADKrUmMpqyZFtlJpYTve5yjEFoCsGquOZ2bhhD+tyBNEfaUMbUx5p7JdAZnF/Lh6epmOup5r+EbANbTiLIgdq0j/X8/vuebxQGHSx1TnlE3Z3IT2PJKAHbxTzfsuMkjph/nwzWgEjvWR7N39A0iT2Hxj/9Uwils30NY2MG/7Wpv/yAAr087uQjjXliBzC31nb47bbX/Q8TUxd6VJQgOZcKP0Jm0dTs3gRpezbK+czuR32L4WDjhT+SKf2EQEpdewcE2w9lcosYwX78HcBtY92MEPS6kPUBEYmNVHiWD0TJ0Gx7wtzGvFWmXkbWybvMDjRvZHq7mTacQrP3DYbBmCT3dcB8VsQ1+C3+U/OTbASrTiML3gdp46OCWiROF9w== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR10MB3573.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(366004)(376002)(39860400002)(396003)(136003)(346002)(1076003)(107886003)(6486002)(26005)(316002)(54906003)(478600001)(2906002)(186003)(86362001)(6666004)(2616005)(6506007)(52116002)(956004)(36756003)(66946007)(8936002)(6512007)(8676002)(4326008)(66556008)(66476007)(69590400012)(5660300002)(16526019)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: WNKt/fB3wxXpVXoV7KD7xGOw5JwQhMfZqD6NM2eVZIsifx+d1boIBgZ2BjpjD0emqpiuX6c0e3U9SfGGzNEjrXAsEz4GL+fUNoIYYVoLfrYLOtdjWgyEZX8Jz8pDIjaAgJR1BQ1YG/loJr6DWgGkpzAA2/5OoDZtrwZjp1wkzpqFeX4kTbSHzBfWhNm+GhYCM5hlHhqD+VyZuwKMEs2Zfi/nO45A23q7gjfgwpL+mNcIg337A9r/B2V5MPQlgNGyazH8zJqzTy0X5eX9ChqN9h2R/CQReVNmJELXhX9Yydq4Kweafm1pAAdLex05Oxcc6jrENT41sG9n9DLG8Pus9a32nYFLHuTBY4x1uM6DWTKTzGSb0p7w3yAM8cygd+wlGwRTzW1OTJdLkfTKwGC+TFLN6kcmdRQ3iM3nMNL1G4qCm+AglGemNRyD3Myjtze4a9wBXQ5zocIZrJ8FQ1QU+yoqv1VC2NpRaCjra8WnnnZECpJmETeQo5uV7AK++iKrE4f1lgbeVX6H9SyNC4tmGgZrEeReTKB5AWBFoBKi8QZU/LaCQdAg20XCXnNcyyQWO06lesqmEonnFqYI8Q7KEtewbnxVeGpqkMsC2HypK/4VGMBXTm9KmP9FI/HGIreu2xq9QdGg/k9xntZ51YeFZCUpiWe6wfaIiuxBkwZEhVg2G21g3bhT8Z4JVG/MDHjggz1n0iP9U/Yd1bgXhPSPpmjJC+02BM7dY0Tl7sB7ReWEljlRP/jNiveTadkjD85kpHOkw/3pjruH6nZiYePSgrIvCiXBIMIeMj/L/N/iP5F8n7eWql9ptFPP0PY57WAyYCPxUx85nqD51n7f4IAUPe3rHZFWiMOqfDC+w+nCDV9uH73En1JnqzoSeEQs2wiimM9PXDAMEHVsnYuUQjuQ22GfFl9pxMn2IKjvRDAkKn5xdntohpbsUzNq95ocE66mXHmkfgEaBFsCHk/wd0TBpj5Pyl/zUo+TpF3sQQt2i7eTiR0XQI9e99HsSrhq6PFqegT+MNL8opeLTYw1yn99JUEV3cjMLJOTP5mXXwUXbGT7nNIsXPb+rmCwiLsKSavfPyWwv8UkziTRY1ir8UUgJPmatp6ZGUi3NVWFGFstlBgPSiVXmaNe23gINR+J8iEPMNVFWpGpyaOkHxS55J2WSPgOrET06DQvYq9Lk1xLVYOLZ1PZGj/1EJTKCDhoun+Bl+ONwfjU7aAj4BjJq6PLkYkfsAHSmfLMmuLndIePyKgp7MRP97qFZug9e7AyCpGzW6wfyP2UFOUI0ztffB2kHyFchQcLhCP8rg9afh/9njlfzZuvoO0N8ifcl8o7otWH X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 804c48ec-d067-43bc-9c73-08d8d3829415 X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Feb 2021 20:28:25.9027 (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: Cv1IsqVtI7cIy24pzyu4YICJelbEohcr5sqHxq52TSgBI0VaJip59FdmbNDt1XgG8CirRcGoiShaYz4RZu42IiCcjcI0q60wjEbnUimbBok= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB4101 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 spamscore=0 mlxscore=0 phishscore=0 adultscore=0 bulkscore=0 mlxlogscore=999 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102170152 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 priorityscore=1501 lowpriorityscore=0 bulkscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 malwarescore=0 phishscore=0 clxscore=1015 mlxscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102170152 Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org The kref_get_unless_zero use in target_get_sess_cmd was added in: commit 1b4c59b7a1d0 ("target: fix potential race window in target_sess_cmd_list_waiting()")' but it does not seem to do anything. I think the original patch might have thought we could have added the cmd to the sess_wait_list and then target_wait_for_sess_cmds could do a put before target_get_sess_cmd did it's get. That wouldn't happen because we do the get first then grab the sess lock and put it on the list. It's also not needed now, because the sess_cmd_list does not exist anymore and we instead wait on the session cmd_count. The other problem with the patch is that several target_submit_cmd_map_sgls/ target_submit_cmd callers do not handle the error case properly if it were to ever happen. These drivers think they have their normal refcount on the cmd and in many cases do a transport_generic_free_cmd plus target_put_sess_cmd so they would have fired off the refcount WARN/BUGs. So this patch just changes the kref_get_unless_zero to kref_get. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig Reviewed-by: Himanshu Madhani Tested-by: Laurence Oberman --- drivers/target/target_core_transport.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index 5c4adde96d5e..b5427e26187b 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@ -2775,9 +2775,7 @@ int target_get_sess_cmd(struct se_cmd *se_cmd, bool ack_kref) * invocations before se_cmd descriptor release. */ if (ack_kref) { - if (!kref_get_unless_zero(&se_cmd->cmd_kref)) - return -EINVAL; - + kref_get(&se_cmd->cmd_kref); se_cmd->se_cmd_flags |= SCF_ACK_KREF; } From patchwork Wed Feb 17 20:27:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 12092149 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 D921BC433E6 for ; Wed, 17 Feb 2021 20:29:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 98E4564E6C for ; Wed, 17 Feb 2021 20:29:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235047AbhBQU3Y (ORCPT ); Wed, 17 Feb 2021 15:29:24 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:52960 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234337AbhBQU3S (ORCPT ); Wed, 17 Feb 2021 15:29:18 -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 11HKOe5s017886; Wed, 17 Feb 2021 20:28:30 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=tjgPReFSRffGv6tKdFo9A9l/oA1V9dfNKG+TQ18QE4s=; b=vr2C/jOPfX7aMPsri3xoH/RkmbMraheLlfYAxTnHSlIgChx45gKq7x5e8Dv9zmha+6Ne 31n6l0SzkarFKEw2D4QsD2teRT/K5mIVZ+ijYWcVA1YDiN3SbM/zGRClXbpd1cHz/7OB VpPW5ubkw2zq21x1lAKyYqRYYhb5issFzGgdacjtK/z4wyNnJJvWbrmKs6inBVZZVX3C AvZQ941r7U2ww1KWgcDG1C0BGKKJgjULzuOc3b5ZFWWK1EPO4AtBOOuGQF+WhMOZxfxr Uc1QOJUK84ErQ7xt8ctXrMMy5vYtsukfmYchmKFx+hvEbFxTmWM8gzRTgTKCKl5WiUT2 zw== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by aserp2130.oracle.com with ESMTP id 36p49bbwwj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 Feb 2021 20:28:30 +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 11HKQ61d111852; Wed, 17 Feb 2021 20:28:29 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2175.outbound.protection.outlook.com [104.47.56.175]) by userp3030.oracle.com with ESMTP id 36prpykf3p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 Feb 2021 20:28:29 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZEQrZ/f1XVb/ESGmOO5Pz2MpvaZM9zfTDxbMuQaaYNwZVgAgRh9CTRBFs8H2HHurgPS5jW5qxtUGwgWvZiDGleHQEHe+uVbHzai/Mz3PEIeNrLcBmGKr2Pi9w5m4kg0Okdd5fj5b1Mq6Bs+Y9wMEcAl/xEu30sFdk5mEexA9AKDMfWN9j+TyY2tFRid6UFo5qS28Fij0ixf0dYKoTtRPTWP1yPeqrRwdWVjanq3QullK7Ed/hlFw7ljlNAB3tITTKcprWhUi9mZdo4SAqJSL2cnU4lsRYrmnFPYuaptYyEOTEi2a3X7SGNhH3z+rc1vQOL9iAHrW/LqPIUc3jxbhdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tjgPReFSRffGv6tKdFo9A9l/oA1V9dfNKG+TQ18QE4s=; b=DNCoOIGwWkoGNV7ibHkO3ImzYi3e+iAqi1fml/RvYL7rLk2ovqJlm+9sK5X2N9mD4ND8uLTBdCOwwdQwmQUuRVhhA6cuyWtNNd7BuudVxFoEN4skUjlM3PVGeSCX+AnBdseDLanUqhfq8namzHZ+396d+V3iQK86DAJoFALqavVJm98GTRk2KohUp+9Xovf/EWWCLu3/2YxAGF4dbNhDuw/Xnz3hPVS8mveNMPxV0UpWENqn+qnhQ2kdoKjv2ICXrOysiz+YkbJrxwhU2oA8l8BC0Q05Tdn/NmkcTzbfxehVYrHr1z/4k2YFeeF72/e1bkvmDpzMrXjHKa1I28Eyhw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tjgPReFSRffGv6tKdFo9A9l/oA1V9dfNKG+TQ18QE4s=; b=sM8J7FZE4XHUUpVKUMkZvM+MTNeSIMcnmDUSeg2fsBtW5U4CcllrR7usw+ByVspkoCjfR1TzCM8lsBD+mTYW6/jyOpJMtAmDW/VApPA47RER347ZWHfBkZBgF/F1KDW7EUPH7mYdmB/wt1rd3Ib12vmUSk4kQD+LNSldzx3JC9U= Authentication-Results: gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=none action=none header.from=oracle.com; Received: from BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) by BYAPR10MB4101.namprd10.prod.outlook.com (2603:10b6:a03:120::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.31; Wed, 17 Feb 2021 20:28:27 +0000 Received: from BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::1d86:b9d7:c9ef:ba20]) by BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::1d86:b9d7:c9ef:ba20%7]) with mapi id 15.20.3846.042; Wed, 17 Feb 2021 20:28:27 +0000 From: Mike Christie To: bostroesser@gmail.com, mst@redhat.com, stefanha@redhat.com, Chaitanya.Kulkarni@wdc.com, hch@lst.de, loberman@redhat.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org Cc: Mike Christie , Himanshu Madhani Subject: [PATCH 03/25] target: rename transport_init_se_cmd Date: Wed, 17 Feb 2021 14:27:49 -0600 Message-Id: <20210217202811.5575-4-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210217202811.5575-1-michael.christie@oracle.com> References: <20210217202811.5575-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: CH2PR15CA0001.namprd15.prod.outlook.com (2603:10b6:610:51::11) To BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by CH2PR15CA0001.namprd15.prod.outlook.com (2603:10b6:610:51::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Wed, 17 Feb 2021 20:28:26 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 84ba6441-a6d5-4264-81be-08d8d382951e X-MS-TrafficTypeDiagnostic: BYAPR10MB4101: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4941; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kTAkINjX0z5/ymTr3mC+6W9QLZ53nk0NsozxMI1GEDiQ4gFlFNcI+nHN+kkNRulcgyy0jNwh1mBA6sFP9W/6M4uFos40XeZgNnlr44uRyf8gC3aVaCnh7ILbcxduqMj/XrgAomPCVt72rDh8IfpHf0kYUDNyqFrY7+N/H38TkAqHHNhCFEO0FN+NhV4TUXkfKQHwlZN/x6iO/tDtBqZTX6SdG6gcvhl6AYFWQrySXoopcD21+yXqP5zJUO6AgquMJYuuAIyA81ULA4Yk73MQN0EUEQWZf2ctxMoGwdikAaFXtbj383rEe2PGdS/LiZh3NAtrRLydaREX2TS1H/ui9nAaWzkAVXNn+rdKvnOGCGgWZJVM9Cn+IjilRP/RcAGb7SolpUwFXRk7sY8wcYGWiw/M60OjfpzKFjA/aK+VIsNWWtzBPdDOePUS85buxaOX/nEPURLCS+CjJ4kY4/mj2139YsMsAOKzQjVei6FiMM00Tp6Gj0GCDHOsusdl94e7VbxqvQ53ZCbCAc43cQkbznA7Qm4szaSVEfcXKVJrxjK7E7ik+UX4On5oHIgVt8hPOmr/NWq8rIR+W+ITXcfQhQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR10MB3573.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(366004)(376002)(39860400002)(396003)(136003)(346002)(1076003)(107886003)(6486002)(26005)(316002)(54906003)(478600001)(2906002)(186003)(86362001)(6666004)(2616005)(6506007)(52116002)(956004)(36756003)(66946007)(8936002)(6512007)(8676002)(4326008)(66556008)(66476007)(69590400012)(5660300002)(16526019)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: rTONyLHOckUcpuDTwzzAf38lxbYwNU4lhC3BOyVSGcKNwNCpz7uagLvkI00S3+VYjuNe96/JYNJem0bQMsVET8e7iAqQLlfdMmiD426hlzlWXSJiJJIS8eJVlzq7keVcRPzuOFcvsYrXEhpQPOBcpGG6q0dLY2/04qWpIMMrXJU9/Ko6djTpuSNXSGhFQKPmZ8PvtVM9JVuTUk7H1roIagnPe4gkwPOqzs2Av57VnaSeqRORaolu9kvr2AmV1zTocnoyFVjDeGZpljrQl4pal0atEq3YdGLlHgAXUgAkadjpmvKeEP7TvbuVHbynTtwY72Tb+DiBoe4O8fcWRlD0nZinmV5Yjjn5WJtLJA0/teIjxE5skcDLOHCLoOd9Jdb3cwuNay1dPeur5WNpsRqsBmbQjeUymxH5A6/jQ+g6W6OzYxV063gcoEJ4wKLey+8zrnU4NaQn0EfbXPXTqu5ZwLktJlEv1JxWGScgRZIDV+ETA3yBmf8+d9VZmbaP6UZUlk2hxqh5J2DPtADcPeFoR3j7r7/zkkgzBDGIMbVmCbrS8Vqm9MiWCOT5q+OXwnldwr9p0baRvcw3gKPweAGPdFdUz+p/y3pMILN2yDNXD49uTI5IFaoBejmN+asSghLztgfrTytcGRE/dg8yDs1c4+0bkhy0qj03H3vSVxWv5FKg3QrtF3fk2kxlclq8lMDn2dEOyxYQjiR3umy9b4PkVNoTaooxN6GP/FID/nak/Jjg1hd3IEYbt1RUN7EI8vBzX3deoTdc3xhn88ypBrz8YtgoIysDZzCuJkGxHugKcR4gKblrXEPmsg9jwimzhwH+gHM1BmC57QX/1jf0Wy4FBU3r1sZc8HaS4yGjt3YsdpOWXR+eusdF+v0rtQcpbJq8oEKJMryTydZq3hxIH4bii/JGPaLwxAUIyZyyt2PuIVoSa5nb3eIvq4FWCEBgj6aBPPPBvT1FhDNQaBVANJeRm8TRCr2nLugdxVotVJpVana9bA+p9n9/Vlh8Ac0d620nF1NTerWJZUTGHjmysTRIE3vipxQqMlmmEpW9FLFeIHAIzTlSZUchcSthekAV/fYudYc6BinDXv2jQq3yjE9hLE9dEjL82EoPm1n1JdFypCvvjyowaq/iS86boJ54l4IOeg9p//vxrpDKx154igCFF4l5YB2+rmTrRQO/aP9aXhTpKA2dwmnPJTllOPVDO+Qedk3oS9PNh3mdiQWglOiruKTI+MG9L1e7bK9w5JF49gPB9eAisMtTRSTDJU48cvHNmcNlpuPRjhs94GAOKwcV9yHL7WiNi+qkQaZBl42WO24gIfH1e4f6/3AjJ3+BIRUJ X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 84ba6441-a6d5-4264-81be-08d8d382951e X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Feb 2021 20:28:27.6377 (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: QxG6bRiU8e++fUnnp27B488MvDYZRRIvV3ifNfyph7YerGO5MbUMq8WGXidBIU7DCJeYEgSajn8hj13i8OzyshZNV4U493LL/d/t1Kdtbn0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB4101 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 mlxlogscore=999 phishscore=0 adultscore=0 mlxscore=0 suspectscore=0 malwarescore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102170152 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 priorityscore=1501 lowpriorityscore=0 bulkscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 malwarescore=0 phishscore=0 clxscore=1015 mlxscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102170152 Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org Rename transport_init_se_cmd to __target_init_cmd to reflect that it's more of an internal function that drivers should normally not use (usb seems to use it wrong and iscsi is that weird guy), and because we are going to add a new init function in the next patches. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig Reviewed-by: Himanshu Madhani --- drivers/target/iscsi/iscsi_target.c | 16 ++++++++-------- drivers/target/target_core_transport.c | 16 ++++++++-------- drivers/target/target_core_xcopy.c | 8 ++++---- drivers/usb/gadget/function/f_tcm.c | 20 ++++++++++---------- include/target/target_core_fabric.h | 2 +- 5 files changed, 31 insertions(+), 31 deletions(-) diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c index 518fac4864cf..f2107705f2ea 100644 --- a/drivers/target/iscsi/iscsi_target.c +++ b/drivers/target/iscsi/iscsi_target.c @@ -1154,10 +1154,10 @@ int iscsit_setup_scsi_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd, /* * Initialize struct se_cmd descriptor from target_core_mod infrastructure */ - transport_init_se_cmd(&cmd->se_cmd, &iscsi_ops, - conn->sess->se_sess, be32_to_cpu(hdr->data_length), - cmd->data_direction, sam_task_attr, - cmd->sense_buffer + 2, scsilun_to_int(&hdr->lun)); + __target_init_cmd(&cmd->se_cmd, &iscsi_ops, + conn->sess->se_sess, be32_to_cpu(hdr->data_length), + cmd->data_direction, sam_task_attr, + cmd->sense_buffer + 2, scsilun_to_int(&hdr->lun)); pr_debug("Got SCSI Command, ITT: 0x%08x, CmdSN: 0x%08x," " ExpXferLen: %u, Length: %u, CID: %hu\n", hdr->itt, @@ -2013,10 +2013,10 @@ iscsit_handle_task_mgt_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd, buf); } - transport_init_se_cmd(&cmd->se_cmd, &iscsi_ops, - conn->sess->se_sess, 0, DMA_NONE, - TCM_SIMPLE_TAG, cmd->sense_buffer + 2, - scsilun_to_int(&hdr->lun)); + __target_init_cmd(&cmd->se_cmd, &iscsi_ops, + conn->sess->se_sess, 0, DMA_NONE, + TCM_SIMPLE_TAG, cmd->sense_buffer + 2, + scsilun_to_int(&hdr->lun)); target_get_sess_cmd(&cmd->se_cmd, true); diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index b5427e26187b..013f4a5e8972 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@ -1297,7 +1297,7 @@ target_check_max_data_sg_nents(struct se_cmd *cmd, struct se_device *dev, * Compare the data buffer size from the CDB with the data buffer limit from the transport * header. Set @cmd->residual_count and SCF_OVERFLOW_BIT or SCF_UNDERFLOW_BIT if necessary. * - * Note: target drivers set @cmd->data_length by calling transport_init_se_cmd(). + * Note: target drivers set @cmd->data_length by calling __target_init_cmd(). * * Return: TCM_NO_SENSE */ @@ -1369,7 +1369,7 @@ target_cmd_size_check(struct se_cmd *cmd, unsigned int size) * * Preserves the value of @cmd->tag. */ -void transport_init_se_cmd( +void __target_init_cmd( struct se_cmd *cmd, const struct target_core_fabric_ops *tfo, struct se_session *se_sess, @@ -1403,7 +1403,7 @@ void transport_init_se_cmd( cmd->state_active = false; } -EXPORT_SYMBOL(transport_init_se_cmd); +EXPORT_SYMBOL(__target_init_cmd); static sense_reason_t transport_check_alloc_task_attr(struct se_cmd *cmd) @@ -1623,9 +1623,9 @@ int target_submit_cmd_map_sgls(struct se_cmd *se_cmd, struct se_session *se_sess * exceptions are handled by sending exception status via * target_core_fabric_ops->queue_status() callback */ - transport_init_se_cmd(se_cmd, se_tpg->se_tpg_tfo, se_sess, - data_length, data_dir, task_attr, sense, - unpacked_lun); + __target_init_cmd(se_cmd, se_tpg->se_tpg_tfo, se_sess, + data_length, data_dir, task_attr, sense, + unpacked_lun); if (flags & TARGET_SCF_UNKNOWN_SIZE) se_cmd->unknown_data_length = 1; @@ -1797,8 +1797,8 @@ int target_submit_tmr(struct se_cmd *se_cmd, struct se_session *se_sess, se_tpg = se_sess->se_tpg; BUG_ON(!se_tpg); - transport_init_se_cmd(se_cmd, se_tpg->se_tpg_tfo, se_sess, - 0, DMA_NONE, TCM_SIMPLE_TAG, sense, unpacked_lun); + __target_init_cmd(se_cmd, se_tpg->se_tpg_tfo, se_sess, + 0, DMA_NONE, TCM_SIMPLE_TAG, sense, unpacked_lun); /* * FIXME: Currently expect caller to handle se_cmd->se_tmr_req * allocation failure. diff --git a/drivers/target/target_core_xcopy.c b/drivers/target/target_core_xcopy.c index 66d6f1d06f21..e86cc6135587 100644 --- a/drivers/target/target_core_xcopy.c +++ b/drivers/target/target_core_xcopy.c @@ -615,8 +615,8 @@ static int target_xcopy_read_source( pr_debug("XCOPY: Built READ_16: LBA: %llu Sectors: %u Length: %u\n", (unsigned long long)src_lba, src_sectors, length); - transport_init_se_cmd(se_cmd, &xcopy_pt_tfo, &xcopy_pt_sess, length, - DMA_FROM_DEVICE, 0, &xpt_cmd.sense_buffer[0], 0); + __target_init_cmd(se_cmd, &xcopy_pt_tfo, &xcopy_pt_sess, length, + DMA_FROM_DEVICE, 0, &xpt_cmd.sense_buffer[0], 0); rc = target_xcopy_setup_pt_cmd(&xpt_cmd, xop, src_dev, &cdb[0], remote_port); @@ -660,8 +660,8 @@ static int target_xcopy_write_destination( pr_debug("XCOPY: Built WRITE_16: LBA: %llu Sectors: %u Length: %u\n", (unsigned long long)dst_lba, dst_sectors, length); - transport_init_se_cmd(se_cmd, &xcopy_pt_tfo, &xcopy_pt_sess, length, - DMA_TO_DEVICE, 0, &xpt_cmd.sense_buffer[0], 0); + __target_init_cmd(se_cmd, &xcopy_pt_tfo, &xcopy_pt_sess, length, + DMA_TO_DEVICE, 0, &xpt_cmd.sense_buffer[0], 0); rc = target_xcopy_setup_pt_cmd(&xpt_cmd, xop, dst_dev, &cdb[0], remote_port); diff --git a/drivers/usb/gadget/function/f_tcm.c b/drivers/usb/gadget/function/f_tcm.c index 410fa89eae8f..dcce6e2605f5 100644 --- a/drivers/usb/gadget/function/f_tcm.c +++ b/drivers/usb/gadget/function/f_tcm.c @@ -1050,11 +1050,11 @@ static void usbg_cmd_work(struct work_struct *work) tv_nexus = tpg->tpg_nexus; dir = get_cmd_dir(cmd->cmd_buf); if (dir < 0) { - transport_init_se_cmd(se_cmd, - tv_nexus->tvn_se_sess->se_tpg->se_tpg_tfo, - tv_nexus->tvn_se_sess, cmd->data_len, DMA_NONE, - cmd->prio_attr, cmd->sense_iu.sense, - cmd->unpacked_lun); + __target_init_cmd(se_cmd, + tv_nexus->tvn_se_sess->se_tpg->se_tpg_tfo, + tv_nexus->tvn_se_sess, cmd->data_len, DMA_NONE, + cmd->prio_attr, cmd->sense_iu.sense, + cmd->unpacked_lun); goto out; } @@ -1181,11 +1181,11 @@ static void bot_cmd_work(struct work_struct *work) tv_nexus = tpg->tpg_nexus; dir = get_cmd_dir(cmd->cmd_buf); if (dir < 0) { - transport_init_se_cmd(se_cmd, - tv_nexus->tvn_se_sess->se_tpg->se_tpg_tfo, - tv_nexus->tvn_se_sess, cmd->data_len, DMA_NONE, - cmd->prio_attr, cmd->sense_iu.sense, - cmd->unpacked_lun); + __target_init_cmd(se_cmd, + tv_nexus->tvn_se_sess->se_tpg->se_tpg_tfo, + tv_nexus->tvn_se_sess, cmd->data_len, DMA_NONE, + cmd->prio_attr, cmd->sense_iu.sense, + cmd->unpacked_lun); goto out; } diff --git a/include/target/target_core_fabric.h b/include/target/target_core_fabric.h index d60a3eb7517a..4975c4d2a933 100644 --- a/include/target/target_core_fabric.h +++ b/include/target/target_core_fabric.h @@ -148,7 +148,7 @@ void transport_deregister_session_configfs(struct se_session *); void transport_deregister_session(struct se_session *); -void transport_init_se_cmd(struct se_cmd *, +void __target_init_cmd(struct se_cmd *, const struct target_core_fabric_ops *, struct se_session *, u32, int, int, unsigned char *, u64); sense_reason_t transport_lookup_cmd_lun(struct se_cmd *); From patchwork Wed Feb 17 20:27:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 12092185 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 432F8C433E6 for ; Wed, 17 Feb 2021 20:32:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 02EDF64DEC for ; Wed, 17 Feb 2021 20:32:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234318AbhBQUby (ORCPT ); Wed, 17 Feb 2021 15:31:54 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:41136 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235054AbhBQU3l (ORCPT ); Wed, 17 Feb 2021 15:29:41 -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 11HKOK1A146994; Wed, 17 Feb 2021 20:28:34 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=HXHwPn4n49NmRvdLRZ2lIEM+fuQIc1gTrIMasqA08JQ=; b=Z8CClcVorSfOwg7ycKJ5yAe5BnKjMjOhHFi2spfJ+bwUoyXW3FjylOhtaNWo5QGLAbhz 4PIgvc/dJQW21IoAxu5/o5GElYKxAnPnOKmJhCdXSaFU9+8WND5iTK1dUNTazH2kfqwU f35VtSdpcWo55vNSwMqb2DaM7qRm9UTMa2grccOYI1tkf5YD779wKw/emzZHG9rG40sB 0+ddWxym3N5H0iq1eyXHOa5HVt240W1K+ke2fmUT8j/HsfWGL6JExRXbtK4TJSwpDHq8 p4Aw1RWE8z4DRrkWtaoxFVjdqYhZ7QV+pgYHNs8ywGfMlt2U9gm4Pl/8glKr2fO0inLD hA== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2120.oracle.com with ESMTP id 36p7dnkpj9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 Feb 2021 20:28:33 +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 11HKQB6B191515; Wed, 17 Feb 2021 20:28:33 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2169.outbound.protection.outlook.com [104.47.56.169]) by aserp3020.oracle.com with ESMTP id 36prp0p678-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 Feb 2021 20:28:32 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OyiMd5R6cL0sxGjh9nPNqt7S95vu/TlFkB3/Zpc4XD6mpEudKzfxvU5QJ5/X3LvcP0xAKi1x9s07frzGJua7Cl0nz34hH2CXqBC91280+b0ODIiEj5+UC5hwbjQS6mO7RUsfddpfKQJd3OhTSj5HEU3Idr/377C2p0ZQUzvf8PkDCJf7v8Hg7gVkYGLuCfm/qoxxxqcEu1UiWUPG/gVFHp/SYayuOJBfVVFW/uhpaVCDYLg7ssFrw9seelvA3bYnXra2ZSYim98dIWXQEQO1XhjKiNJhbxT/pEAwFpjmKpZjp0pBQdq5ZagLIbhWBWI8/lOxWV1HNliQFtoYRExu6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=HXHwPn4n49NmRvdLRZ2lIEM+fuQIc1gTrIMasqA08JQ=; b=iC4OWCkej8pDmF4o/ixFl1t/N4GeKqHXwoMiL7EURjkfHPG88aHErckqqcjsUYMb06vzg3miZxCooMKiWypoAlvwnCfpeOsjO9X43TWYH1wRxUSpLXIrRe8IIoKiD8b2sAeipwcQxZ6MgO6ge7PfZt7on1vIXixup/NyDHu+a3NJpIqZ8ITKtObNifKjxWo7LWvRRchMvSJq/ZoQAOEz3I5UDv3312qKM15nzeb5HlqfSoS4G/AY4Cpc8BlhXVta2lNhLNJf+bPu9dM5Y+cuNmz1dkCMnnKWNpPl2G0bHZo0Ntde+mVaC7jAy7R2Jq2pZUcw0J8Po/YKg9BmGU8enA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=HXHwPn4n49NmRvdLRZ2lIEM+fuQIc1gTrIMasqA08JQ=; b=H2d61sfjVy1jGgO44od82eiNNvLfABPBfmWNSw9Zawqt/UzLJ5xNVuGePePR+sqw+atNhgmsoPgLELk85q2UUSBE3o4sIQUpPtSh06GJrANqCkrFTdiLfUZdAXjIymPLNVSowo+8QIl+BEzmCojpWpYzwsMSk5LxSr/wBx1irI0= Authentication-Results: gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=none action=none header.from=oracle.com; Received: from BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) by BYAPR10MB4101.namprd10.prod.outlook.com (2603:10b6:a03:120::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.31; Wed, 17 Feb 2021 20:28:30 +0000 Received: from BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::1d86:b9d7:c9ef:ba20]) by BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::1d86:b9d7:c9ef:ba20%7]) with mapi id 15.20.3846.042; Wed, 17 Feb 2021 20:28:30 +0000 From: Mike Christie To: bostroesser@gmail.com, mst@redhat.com, stefanha@redhat.com, Chaitanya.Kulkarni@wdc.com, hch@lst.de, loberman@redhat.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org Cc: Mike Christie , Bart Van Assche , Juergen Gross , Hannes Reinecke , Nilesh Javali , Michael Cyr , Chris Boot , Felipe Balbi , Himanshu Madhani Subject: [PATCH 04/25] target: break up target_submit_cmd_map_sgls Date: Wed, 17 Feb 2021 14:27:50 -0600 Message-Id: <20210217202811.5575-5-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210217202811.5575-1-michael.christie@oracle.com> References: <20210217202811.5575-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: CH2PR15CA0001.namprd15.prod.outlook.com (2603:10b6:610:51::11) To BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by CH2PR15CA0001.namprd15.prod.outlook.com (2603:10b6:610:51::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Wed, 17 Feb 2021 20:28:27 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 977206a9-f79b-4f48-8a9c-08d8d382969a X-MS-TrafficTypeDiagnostic: BYAPR10MB4101: 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: 07o7E+p0/Z/3f7YYQ1nYDj4jA9PUlxu3OUYXulW4vn/za4soFMFx3IOZxnY306vRvPzRAc1evmWgfnH5lABuICzPi8outvOI1xt4uVgdLCg5vbqlW63gWmnBqIJJvXT5U6wtM6ZgFxeMYw58eqB8c8qUBmpGEALd7skOeWugh2vvJMf7RHGi/PN89wGNVd0sQeUwObTUrtn/2q46qr4JWfizsDNdQ4SEmM8z5Z9oNbT81Fkin8ca96vfsOAUvb+lPailoELD2Lu+QmNGg8xCPF8cWfuktG0NrcYta8c+lzdIhL9OcvA04gpPal1sECZA0+/ZKA4/i1kFsFpo1aNIIRvXqRSSVEOBDjgVKklUuKKqUm4P51hyyvxoXXkNspelDRiQUk64rpdzQwB+dYiWeWdPWhActDT/xZkfZxG8CGSpoZQ6kIh0eM07sJ1MBhSHFFFPBO0b2ThYuqTdas3qLyMA340SrHz02QbQP8NpXnl6Slk9ex0xYJR7Qcbk+OBt0nnrJkjmJCbz6qZW5chOSLSV+2eeeV5SyhA35ylXeR+9FmoQdfGJwmo4PUjg5OCbMbnWUNfdhaTT0NdWV+2sMw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR10MB3573.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(366004)(376002)(39860400002)(396003)(136003)(346002)(1076003)(107886003)(6486002)(26005)(316002)(54906003)(7416002)(478600001)(2906002)(186003)(86362001)(6666004)(2616005)(6506007)(52116002)(956004)(36756003)(66946007)(8936002)(30864003)(6512007)(8676002)(4326008)(66556008)(66476007)(69590400012)(5660300002)(16526019)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: Cn1Y00KGZQPMUuByFWLh6ClOCuqRiessTIF9XbQOWQGkpB7gjEfrC+7EV/CyD9oKoXNRNV6o5znMqd1FO3oYgyPASMH57rkymH0Q6sOL5EVxMzBQ2B9X/HD+bUAc5k/Zd/UiUsmFcVqWQu9gW548Sw0fDPgM2G+LCUpaWiXWu7s8f2H45Irqu06sAAGJ0atmVuZn0HyO3kjRsTEd5BQZm7Tid5TaODIVMlZrCwFCpfDamfVeYFzgws5WPKSgwDkFg2Kq8ZMoTujVH18kTFwwpwLeDMVhuv0elaImGUNOSllasXSTpC2JGdq8Dr6Ozh6D/rFRd9rS7oJOF+Hw8F7HoIWgfFiktlul8bqO/YP/4md6/L0hApjjVYWbBBYgPS2NvrJ0LrwEdH67xf8Z8Nulb3RS3lKjpvLxrBQ/Gxc8N0ciqGsj6KqOxDT5wi53cfzB+Y3PfBNGIib3fdObUDmA4dMatwKM6CeB0lwVgSw0tQdaei2goQJd88aSk3jQVFujBCkoW/yg9ot80Y5rXHv1ZLVb7hk/T8ahmzrSPsPC8B6cEPE2BOpCIXiDUATW124pR+FGdD295IIJX3842V0tiuSANvpVa42kH4xhlvVGgolaZ/LCxC/wws7P+N/AEmY2EnaOVLbCPxVAjdUfOpkEH4pLWtNw5onjnrMHhMSa3eB0Vm7QS6s09N3JnZOOjdo/WyeNBSAYD1BevpKWZqMDNNfEIvkh5UuLPzAoSgcJlaoTBw2YXv2DqPn+BTpzeGwphXJ2B7CgwaSjUcoRwdnJuufZUT/S6b0d+N8Wv7Le6wYwnQzbdQvGvC7LJ0SRWbJr0VyaYT5v80+urZoHUCLRI2prITdwHD548jhFXQa9wktj1xj0WUnRE8ZzO4uN8vBFT3ZpdPRDKOcZehAUBIc9yW96J9r6oGhIahr59W92viNKUK6WOPhC3Q6gGJFjly6pcvEBhJoq6z8MiDgJqYZGVjv22yDDDf5vm9PzUVnbicK1gSSNj4gGJgbmpPJqGqH+DafJ5vbLRzyukYHVWQI24Intz46Uxe2NtaoYAP+rH3jizV2Bc54Xx+P72a4mcYAi2+i+z80Y3+mhlN/hUgC8m9fTcWkzryyPQ1BD1/50U+I4H7TOKR2SsHLIJtG3UADGE0k5EUcwoqfTaJURd+lF2MQKzIGh+7wj5jpuQGVSOvymC6i8maF96nH7sV8vwNHp0MciZXGCEldJywTMeQLrzIexRW75b5cbgEKxx3yK3nAyjePhHoO/i2ftZxzW4Z1RBA/ZSbeCbIh4bkhaPkG9rTGPQsuD68j5uosgEZ6n43KL5sDy7lNORF28uMiUGNAn X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 977206a9-f79b-4f48-8a9c-08d8d382969a X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Feb 2021 20:28:30.2162 (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: ZfUvNX7zHKK2AVyNpQkgfFi7X7m0eRSEfMcgTux+LKvBFbUo310AaD3CLkJJw4Pj11++CbknK07oZPfs9KyBZXWE4Gl3tQrSspCEBgbv3AQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB4101 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxlogscore=999 bulkscore=0 suspectscore=0 spamscore=0 malwarescore=0 mlxscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102170152 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 suspectscore=0 mlxscore=0 phishscore=0 spamscore=0 adultscore=0 clxscore=1015 impostorscore=0 priorityscore=1501 lowpriorityscore=0 malwarescore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102170152 Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org This breaks up target_submit_cmd_map_sgls into 3 helpers: - target_init_cmd: Do the basic general setup and get a refcount to the session to make sure the caller can execute the cmd. - target_submit_prep: Do the mapping, cdb processing and get a ref to the lun. - target_submit: Pass the cmd to LIO core for execution. The above functions must be used by drivers that either: 1. rely on lio for session shutdown synchronization by calling target_stop_session. 2. need to map sgls When the next patches are applied then simple drivers that do not need the extra functionality above can use target_submit_cmd and not worry about failures being returned and how to handle them, since many drivers were getting this wrong and would have hit refcount bugs. Also, by breaking target_submit_cmd_map_sgls up into these 3 helper functions, we can allow the later patches to do the init/prep from interrupt context and then do the submission from a workqueue. Cc: Bart Van Assche Cc: Juergen Gross Cc: Hannes Reinecke Cc: Nilesh Javali Cc: Michael Cyr Cc: Chris Boot Cc: Felipe Balbi Cc: "Michael S. Tsirkin" Cc: Stefan Hajnoczi Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig Reviewed-by: Himanshu Madhani Tested-by: Laurence Oberman --- drivers/target/target_core_transport.c | 201 +++++++++++++++++-------- include/target/target_core_fabric.h | 8 + 2 files changed, 148 insertions(+), 61 deletions(-) diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index 013f4a5e8972..8b2b805316dc 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@ -1571,46 +1571,31 @@ transport_generic_map_mem_to_cmd(struct se_cmd *cmd, struct scatterlist *sgl, } /** - * target_submit_cmd_map_sgls - lookup unpacked lun and submit uninitialized - * se_cmd + use pre-allocated SGL memory. - * - * @se_cmd: command descriptor to submit + * target_init_cmd - initialize se_cmd + * @se_cmd: command descriptor to init * @se_sess: associated se_sess for endpoint - * @cdb: pointer to SCSI CDB * @sense: pointer to SCSI sense buffer * @unpacked_lun: unpacked LUN to reference for struct se_lun * @data_length: fabric expected data transfer length * @task_attr: SAM task attribute * @data_dir: DMA data direction * @flags: flags for command submission from target_sc_flags_tables - * @sgl: struct scatterlist memory for unidirectional mapping - * @sgl_count: scatterlist count for unidirectional mapping - * @sgl_bidi: struct scatterlist memory for bidirectional READ mapping - * @sgl_bidi_count: scatterlist count for bidirectional READ mapping - * @sgl_prot: struct scatterlist memory protection information - * @sgl_prot_count: scatterlist count for protection information * * Task tags are supported if the caller has set @se_cmd->tag. * - * Returns non zero to signal active I/O shutdown failure. All other - * setup exceptions will be returned as a SCSI CHECK_CONDITION response, - * but still return zero here. + * Returns: + * - less than zero to signal active I/O shutdown failure. + * - zero on success. * - * This may only be called from process context, and also currently - * assumes internal allocation of fabric payload buffer by target-core. + * If the fabric driver calls target_stop_session, then it must check the + * return code and handle failures. This will never fail for other drivers, + * and the return code can be ignored. */ -int target_submit_cmd_map_sgls(struct se_cmd *se_cmd, struct se_session *se_sess, - unsigned char *cdb, unsigned char *sense, u64 unpacked_lun, - u32 data_length, int task_attr, int data_dir, int flags, - struct scatterlist *sgl, u32 sgl_count, - struct scatterlist *sgl_bidi, u32 sgl_bidi_count, - struct scatterlist *sgl_prot, u32 sgl_prot_count) +int target_init_cmd(struct se_cmd *se_cmd, struct se_session *se_sess, + unsigned char *sense, u64 unpacked_lun, + u32 data_length, int task_attr, int data_dir, int flags) { struct se_portal_group *se_tpg; - sense_reason_t rc; - int ret; - - might_sleep(); se_tpg = se_sess->se_tpg; BUG_ON(!se_tpg); @@ -1618,53 +1603,69 @@ int target_submit_cmd_map_sgls(struct se_cmd *se_cmd, struct se_session *se_sess if (flags & TARGET_SCF_USE_CPUID) se_cmd->se_cmd_flags |= SCF_USE_CPUID; + /* + * Signal bidirectional data payloads to target-core + */ + if (flags & TARGET_SCF_BIDI_OP) + se_cmd->se_cmd_flags |= SCF_BIDI; + + if (flags & TARGET_SCF_UNKNOWN_SIZE) + se_cmd->unknown_data_length = 1; /* * Initialize se_cmd for target operation. From this point * exceptions are handled by sending exception status via * target_core_fabric_ops->queue_status() callback */ - __target_init_cmd(se_cmd, se_tpg->se_tpg_tfo, se_sess, - data_length, data_dir, task_attr, sense, - unpacked_lun); + __target_init_cmd(se_cmd, se_tpg->se_tpg_tfo, se_sess, data_length, + data_dir, task_attr, sense, unpacked_lun); - if (flags & TARGET_SCF_UNKNOWN_SIZE) - se_cmd->unknown_data_length = 1; /* * Obtain struct se_cmd->cmd_kref reference. A second kref_get here is * necessary for fabrics using TARGET_SCF_ACK_KREF that expect a second * kref_put() to happen during fabric packet acknowledgement. */ - ret = target_get_sess_cmd(se_cmd, flags & TARGET_SCF_ACK_KREF); - if (ret) - return ret; - /* - * Signal bidirectional data payloads to target-core - */ - if (flags & TARGET_SCF_BIDI_OP) - se_cmd->se_cmd_flags |= SCF_BIDI; + return target_get_sess_cmd(se_cmd, flags & TARGET_SCF_ACK_KREF); +} +EXPORT_SYMBOL_GPL(target_init_cmd); + +/** + * target_submit_prep - prepare cmd for submission + * @se_cmd: command descriptor to prep + * @cdb: pointer to SCSI CDB + * @sgl: struct scatterlist memory for unidirectional mapping + * @sgl_count: scatterlist count for unidirectional mapping + * @sgl_bidi: struct scatterlist memory for bidirectional READ mapping + * @sgl_bidi_count: scatterlist count for bidirectional READ mapping + * @sgl_prot: struct scatterlist memory protection information + * @sgl_prot_count: scatterlist count for protection information + * + * Returns: + * - less than zero to signal failure. + * - zero on success. + * If failure is returned, lio will the callers queue_status to complete + * the cmd. + */ +int target_submit_prep(struct se_cmd *se_cmd, unsigned char *cdb, + struct scatterlist *sgl, u32 sgl_count, + struct scatterlist *sgl_bidi, u32 sgl_bidi_count, + struct scatterlist *sgl_prot, u32 sgl_prot_count) +{ + sense_reason_t rc; rc = target_cmd_init_cdb(se_cmd, cdb); - if (rc) { - transport_send_check_condition_and_sense(se_cmd, rc, 0); - target_put_sess_cmd(se_cmd); - return 0; - } + if (rc) + goto send_cc_direct; /* * Locate se_lun pointer and attach it to struct se_cmd */ rc = transport_lookup_cmd_lun(se_cmd); - if (rc) { - transport_send_check_condition_and_sense(se_cmd, rc, 0); - target_put_sess_cmd(se_cmd); - return 0; - } + if (rc) + goto send_cc_direct; rc = target_cmd_parse_cdb(se_cmd); - if (rc != 0) { - transport_generic_request_failure(se_cmd, rc); - return 0; - } + if (rc != 0) + goto generic_fail; /* * Save pointers for SGLs containing protection information, @@ -1684,6 +1685,41 @@ int target_submit_cmd_map_sgls(struct se_cmd *se_cmd, struct se_session *se_sess if (sgl_count != 0) { BUG_ON(!sgl); + rc = transport_generic_map_mem_to_cmd(se_cmd, sgl, sgl_count, + sgl_bidi, sgl_bidi_count); + if (rc != 0) + goto generic_fail; + } + + return 0; + +send_cc_direct: + transport_send_check_condition_and_sense(se_cmd, rc, 0); + target_put_sess_cmd(se_cmd); + return -EIO; + +generic_fail: + transport_generic_request_failure(se_cmd, rc); + return -EIO; +} +EXPORT_SYMBOL_GPL(target_submit_prep); + +/** + * target_submit - perform final initialization and submit cmd to LIO core + * @se_cmd: command descriptor to submit + * + * target_submit_prep must have been called on the cmd, and this must be + * called from process context. + */ +void target_submit(struct se_cmd *se_cmd) +{ + struct scatterlist *sgl = se_cmd->t_data_sg; + unsigned char *buf = NULL; + + might_sleep(); + + if (se_cmd->t_data_nents != 0) { + BUG_ON(!sgl); /* * A work-around for tcm_loop as some userspace code via * scsi-generic do not memset their associated read buffers, @@ -1694,8 +1730,6 @@ int target_submit_cmd_map_sgls(struct se_cmd *se_cmd, struct se_session *se_sess */ if (!(se_cmd->se_cmd_flags & SCF_SCSI_DATA_CDB) && se_cmd->data_direction == DMA_FROM_DEVICE) { - unsigned char *buf = NULL; - if (sgl) buf = kmap(sg_page(sgl)) + sgl->offset; @@ -1705,12 +1739,6 @@ int target_submit_cmd_map_sgls(struct se_cmd *se_cmd, struct se_session *se_sess } } - rc = transport_generic_map_mem_to_cmd(se_cmd, sgl, sgl_count, - sgl_bidi, sgl_bidi_count); - if (rc != 0) { - transport_generic_request_failure(se_cmd, rc); - return 0; - } } /* @@ -1720,6 +1748,57 @@ int target_submit_cmd_map_sgls(struct se_cmd *se_cmd, struct se_session *se_sess core_alua_check_nonop_delay(se_cmd); transport_handle_cdb_direct(se_cmd); +} +EXPORT_SYMBOL_GPL(target_submit); + +/** + * target_submit_cmd_map_sgls - lookup unpacked lun and submit uninitialized + * se_cmd + use pre-allocated SGL memory. + * + * @se_cmd: command descriptor to submit + * @se_sess: associated se_sess for endpoint + * @cdb: pointer to SCSI CDB + * @sense: pointer to SCSI sense buffer + * @unpacked_lun: unpacked LUN to reference for struct se_lun + * @data_length: fabric expected data transfer length + * @task_attr: SAM task attribute + * @data_dir: DMA data direction + * @flags: flags for command submission from target_sc_flags_tables + * @sgl: struct scatterlist memory for unidirectional mapping + * @sgl_count: scatterlist count for unidirectional mapping + * @sgl_bidi: struct scatterlist memory for bidirectional READ mapping + * @sgl_bidi_count: scatterlist count for bidirectional READ mapping + * @sgl_prot: struct scatterlist memory protection information + * @sgl_prot_count: scatterlist count for protection information + * + * Task tags are supported if the caller has set @se_cmd->tag. + * + * Returns non zero to signal active I/O shutdown failure. All other + * setup exceptions will be returned as a SCSI CHECK_CONDITION response, + * but still return zero here. + * + * This may only be called from process context, and also currently + * assumes internal allocation of fabric payload buffer by target-core. + */ +int target_submit_cmd_map_sgls(struct se_cmd *se_cmd, struct se_session *se_sess, + unsigned char *cdb, unsigned char *sense, u64 unpacked_lun, + u32 data_length, int task_attr, int data_dir, int flags, + struct scatterlist *sgl, u32 sgl_count, + struct scatterlist *sgl_bidi, u32 sgl_bidi_count, + struct scatterlist *sgl_prot, u32 sgl_prot_count) +{ + int rc; + + rc = target_init_cmd(se_cmd, se_sess, sense, unpacked_lun, + data_length, task_attr, data_dir, flags); + if (rc < 0) + return rc; + + if (target_submit_prep(se_cmd, cdb, sgl, sgl_count, sgl_bidi, + sgl_bidi_count, sgl_prot, sgl_prot_count)) + return 0; + + target_submit(se_cmd); return 0; } EXPORT_SYMBOL(target_submit_cmd_map_sgls); diff --git a/include/target/target_core_fabric.h b/include/target/target_core_fabric.h index 4975c4d2a933..4b5f6687393a 100644 --- a/include/target/target_core_fabric.h +++ b/include/target/target_core_fabric.h @@ -151,6 +151,14 @@ void transport_deregister_session(struct se_session *); void __target_init_cmd(struct se_cmd *, const struct target_core_fabric_ops *, struct se_session *, u32, int, int, unsigned char *, u64); +int target_init_cmd(struct se_cmd *se_cmd, struct se_session *se_sess, + unsigned char *sense, u64 unpacked_lun, u32 data_length, + int task_attr, int data_dir, int flags); +int target_submit_prep(struct se_cmd *se_cmd, unsigned char *cdb, + struct scatterlist *sgl, u32 sgl_count, + struct scatterlist *sgl_bidi, u32 sgl_bidi_count, + struct scatterlist *sgl_prot, u32 sgl_prot_count); +void target_submit(struct se_cmd *se_cmd); sense_reason_t transport_lookup_cmd_lun(struct se_cmd *); sense_reason_t target_cmd_init_cdb(struct se_cmd *, unsigned char *); sense_reason_t target_cmd_parse_cdb(struct se_cmd *); From patchwork Wed Feb 17 20:27:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 12092155 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 A6A97C4332E for ; Wed, 17 Feb 2021 20:29:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 84C8A64E76 for ; Wed, 17 Feb 2021 20:29:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233941AbhBQU3b (ORCPT ); Wed, 17 Feb 2021 15:29:31 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:53060 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235040AbhBQU30 (ORCPT ); Wed, 17 Feb 2021 15:29:26 -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 11HKOW49017856; Wed, 17 Feb 2021 20:28:35 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=IIGvzMJTnj7LCDuzrwvw4HdY5QbD9p3SIVclTcSvc3s=; b=PF1PX0wCh0kwntngZy92HZFaXoDLgx+4betPw1K7DvQqi0hZe9LSQMcM34tFVrC7bIhO euzwf6lMlPZCUN7rzGoKkGehbYqor0RKfHiBOC8HLuWb6pVJBDVFs0EAIFZrJNIrVCMK BSJHlYZhQmpl5/8CJCrXe7ERnW03e7ylxCQjH6qL5HuQCJ8ZCjPYhoSKkyeGVbZOr0X/ VEu8IAu1f9tJMLBbEy9WfpZr50dZ4sdSTY0JCxvsLxlYrnQZoQh27iDadD1dSGlYubFg A8g5PRg98xzkwIaaOPumrcc4iy9zd5iAu2UUnYzHzteVekAzVI0QM6ZtvVZlAIMIYf/d cw== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by aserp2130.oracle.com with ESMTP id 36p49bbwx1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 Feb 2021 20:28:35 +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 11HKQB6C191515; Wed, 17 Feb 2021 20:28:34 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2171.outbound.protection.outlook.com [104.47.58.171]) by aserp3020.oracle.com with ESMTP id 36prp0p684-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 Feb 2021 20:28:34 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Lhgd+dfoFF60sZTHJhVec3pmVb2PeFOcDJTYnH1DBSRVUf9ye03U6PBJXO+9E2+ddRnaDBV0mbCmkUstgPi4yBmttxcdG46WTS4hkWDsBHxfsvbJ9sj6c5DBgVc0EVhSkbJf9PP5JC601JuK9IIEX3lezUl8dMSwdef10FDrO02JrevL2aJsZQrjheqhu3RcVr/rL7fXMTru5TJDyiqdnEvVigvf6ZJwgKr8dCDmyS3Wl75KfVwgQQYfoYDm2LRnJ3ZbYskugPwlj66huP+NgRR55ByVtmmb1AFTsqZjMEsV2VKI1U40KI3EejsKBkga6HYXjb7hKOHhPtB4Z7+MTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=IIGvzMJTnj7LCDuzrwvw4HdY5QbD9p3SIVclTcSvc3s=; b=gXvsBFuWE9THjJawWMSBAatbLyNNZFEctSWkR7svsEQH68iUdpuIrM9NU2nmioNYpR4YRcRfNdjZ4C3erNc3HndhCkooS0SlIJhYoB2Op2xgY1wVrM8jdHdNs3AM9G52P9oj6XV5PYy71nakOotYtIiN3ruNvZBvDUoI54fFix8tR4Z105gNEPQQ2lXoE9FkkWcf2UA5AcR2ux1V3t90UaP/jHYGEZd0mfAWH/l7ax/4QAVHkwoihuveyGU9zqQYjUeYl5Y/KvdJP+/tmhMygDZER3x5Xyq8TY7+4ZHKA/VvvXyV8kFXS2EenH2r0k+wVEvZBXyyG47qNeGZh5LPdA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=IIGvzMJTnj7LCDuzrwvw4HdY5QbD9p3SIVclTcSvc3s=; b=PVzfXRJgqPuOgd5YZm1iNvuTrlABU8lQxpYXRwDFAQleKk+Ff4tFrcF0JTI+aJrW77bLqOdaPWgVbzzVpEkSiAzbMrmg2LhZvkQCMf/xC1lm1/tB5kJxyUwGogUHLov1u+rMEq2BxRSlNji5tg8KrqZn1NpoOmVpl3smR00DxDw= Authentication-Results: gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=none action=none header.from=oracle.com; Received: from BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) by BYAPR10MB4101.namprd10.prod.outlook.com (2603:10b6:a03:120::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.31; Wed, 17 Feb 2021 20:28:32 +0000 Received: from BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::1d86:b9d7:c9ef:ba20]) by BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::1d86:b9d7:c9ef:ba20%7]) with mapi id 15.20.3846.042; Wed, 17 Feb 2021 20:28:32 +0000 From: Mike Christie To: bostroesser@gmail.com, mst@redhat.com, stefanha@redhat.com, Chaitanya.Kulkarni@wdc.com, hch@lst.de, loberman@redhat.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org Cc: Mike Christie , Bart Van Assche Subject: [PATCH 05/25] srpt: Convert to new submission API Date: Wed, 17 Feb 2021 14:27:51 -0600 Message-Id: <20210217202811.5575-6-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210217202811.5575-1-michael.christie@oracle.com> References: <20210217202811.5575-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: CH2PR15CA0001.namprd15.prod.outlook.com (2603:10b6:610:51::11) To BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by CH2PR15CA0001.namprd15.prod.outlook.com (2603:10b6:610:51::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Wed, 17 Feb 2021 20:28:30 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9cccddb8-6436-4911-0ad8-08d8d38297b6 X-MS-TrafficTypeDiagnostic: BYAPR10MB4101: 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: s+iQuBGeaowv/LZa0Xd+pqRCm8gC43/6AkPgsleXcfbd+UmQmA7QcLkmntW5cC1QVJBoi9YhtjB1nx4KPwUWFTReXydKQvKwZGAgW/6CHdnYL9NqM2cC1aDminv/wxzeUyzqhBvz1rsofMHaXNR8JD8NMr3335nTLKeiEy20HnEU1bEXR/WHebp3HlhdXHMit+A60EJZrBPoQ4nAHsgXfr2C5VT1c8EIfhUryYFEeCw7pexCsXei6esWl3LpHPL7oF/xQXYjM1+XDZSD+OxtAjyELDCyK4KcC5ib6gs3nS4SLmi7M8vTn/NA5Yqm3yYZisdJeMLR4AyY7F9BjuTxo9DagZOurzjCpRD7eBeR+mat5BHc7gzrSjQE6CWmgQru3ZFyndKUeiVXOHknGBJw+kKFzjcx5E7ZAZTAWHffirqIsdhs9zLkPilIzR7wQHfxL8f5mEXQ2aXeIpb98fSlfFrXcbcbbXVtywjLkH6J6VG+X779IY9fHtOfBc9EqTRnPxKdchF/V099cFHFTNg7l2KxZm1/ttsqFRqiYw+PXxoY4dYoyOXyipqED0Xq2YNs5jp53QGH1Bx2XW7bEbqdIA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR10MB3573.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(366004)(376002)(39860400002)(396003)(136003)(346002)(1076003)(6486002)(26005)(316002)(54906003)(478600001)(2906002)(186003)(86362001)(6666004)(2616005)(6506007)(52116002)(956004)(36756003)(66946007)(8936002)(6512007)(8676002)(4326008)(66556008)(66476007)(69590400012)(5660300002)(16526019)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: APhCWhYbt6ES9klOuYDLVZpQsBgssqzoNxiYVbb8VMVHx5fIIkGRP/hzZdY16/b7YuGOtbpTW1+BDaSLAEc771HjrNgzRggoGJT6wx7IltB6gBS0MJzIgzO1nEJOIia4mdkWcYCyCWKUJphA96YZ2RiL8gQGJo/jMY9p13vDWuDX6RoiQomWke3LtNfRFErgizONr5nhWxhUdiw9RNpoX++JmrESI3N3zNopaorliFnShImHHim5gMgmoMebE3UTXl9gLt2h6JG3kacCLsN6F9fxmC/Wgd6NNpVjC9SBBbBxEoUD0Lwdgd7yobWn5GZhQp25RpaPlDYrheKUG4ZKsIxoB7sidCajl5qHdIPU5zpOJIC/sDrRMDXBClEn3+rFOqCAkG8ixHMGEzGbPNKb1kGfJKUnysnKWQoRz2/W02h/9q6YLlKs3XLKTLO8U0+bIjxmcccu41gvyb9KcmlF37gOL/yPfOfY+FJiPoiIdq+7fjUXPD+SdT1EC5jWVQ0Iv/is5220uDvGb6hv3bTh2qMwOYDbVqLK+VuT17Oiti0dKOUarg7OLdUNhbz2+zqmsYSigucfccj/G3+TUtjNG09ir9gvOIUXviKrEiQh4/h0T0qfytYTNaPK//W+zuwI3s3SOqI82NRX5Zk41b8Rq6dhEklLfoEDoN+FHm+S+PWFBnnu3Mm0TZmVOpWW9e876um9+nsxynCRjr6kft/a/C1cNtMYOsBkhAx4+0GvplB+FJ67LpI2CND4cCYP5MyErxSPBlfa+kNIl36d503O/gF5VeMY8UMgASfsbU3wHuPKPdXAt6KdGHioH2syFohvh448miV4kp+irt/g3t9aF1bZBtvxNOkBtzdMG+ovFgXyDgeLPfNAEw2QVigV5LBt/inndKch922KBRUxqRjjUx2csLMqWhfd/rwzLD6qjij7sNVtx9ROmZOgi+ir1ok7A4LOf8kqAku5SrnONRrmk8Bysy3RDf9IQEZwaF6g1D47l295jZNoeAvHm835zX/gdnyldX/bRws2JCF6kmk+7Vj2LIlJdwvcCFYL07KmQfqcc5cECXe4BHDTa6jtMg0HsXSf/vsbk0QD7z1DdMjPos9eoKOyNayj6xktujKvmQb3qyP9USKo8v+N/4Qs3BJnSgbC6+zCb9Oz9umUi2ovn43tAZFnzNMkIMPtcsDnC4woYKF+jWkUFeqUXLhuaNpmKzYGJP4725QOoRCNar1kfg3ApaEuy2/i+kdqZKjhCWbXniZcFPcLIYoMZo7NZOb9C7XwrHOl+cJZBk2Hfa4Ubd5PHlmuU/0o3+n0llVtOpguPVgimz71FgA2dRaJOfzD X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9cccddb8-6436-4911-0ad8-08d8d38297b6 X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Feb 2021 20:28:32.7818 (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: TVWd5l2xteNWc2oQinhEsyvOIRlZ79Gbgp8f+3u89n3pIHW+7vCI9a4FmsAcfWTHOS5wFM2wQco2MxblughiAnDv24T4q4qBfmtDHQEC+2s= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB4101 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxlogscore=999 bulkscore=0 suspectscore=0 spamscore=0 malwarescore=0 mlxscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102170152 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 priorityscore=1501 lowpriorityscore=0 bulkscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 malwarescore=0 phishscore=0 clxscore=1015 mlxscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102170152 Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org target_submit_cmd_map_sgls is being removed, so convert srpt to the new submission API. srpt uses target_stop_session to sync session shutdown with lio core, so we use target_init_cmd/target_submit_prep/target_submit, because target_init_cmd will detect the target_stop_session call and return an error. Cc: Bart Van Assche Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig Reviewed-by: Bart Van Assche Reviewed-by: Bart Van Assche --- drivers/infiniband/ulp/srpt/ib_srpt.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c index 6be60aa5ffe2..87741e0b4bca 100644 --- a/drivers/infiniband/ulp/srpt/ib_srpt.c +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c @@ -1528,16 +1528,19 @@ static void srpt_handle_cmd(struct srpt_rdma_ch *ch, goto busy; } - rc = target_submit_cmd_map_sgls(cmd, ch->sess, srp_cmd->cdb, - &send_ioctx->sense_data[0], - scsilun_to_int(&srp_cmd->lun), data_len, - TCM_SIMPLE_TAG, dir, TARGET_SCF_ACK_KREF, - sg, sg_cnt, NULL, 0, NULL, 0); + rc = target_init_cmd(cmd, ch->sess, &send_ioctx->sense_data[0], + scsilun_to_int(&srp_cmd->lun), data_len, + TCM_SIMPLE_TAG, dir, TARGET_SCF_ACK_KREF); if (rc != 0) { pr_debug("target_submit_cmd() returned %d for tag %#llx\n", rc, srp_cmd->tag); goto busy; } + + if (target_submit_prep(cmd, srp_cmd->cdb, sg, sg_cnt, NULL, 0, NULL, 0)) + return; + + target_submit(cmd); return; busy: From patchwork Wed Feb 17 20:27:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 12092157 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 4C203C433DB for ; Wed, 17 Feb 2021 20:30:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0B00E64E6C for ; Wed, 17 Feb 2021 20:30:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235050AbhBQU34 (ORCPT ); Wed, 17 Feb 2021 15:29:56 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:41048 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235051AbhBQU32 (ORCPT ); Wed, 17 Feb 2021 15:29:28 -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 11HKOAa2146945; Wed, 17 Feb 2021 20:28:38 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=nmNPczwdrWFQufUfS26xsht2CcTvVrMqQOEoCGgZw3A=; b=pYVy4rxMS92I4Mgcfd5WJch34bN4mey1sEQ3uwy55LfNf1/o8o3N+fjFPGfczBnqAqid gkYv8H44xKpw4goN2Z9YU+W5P6qzsLH6UMH1gsmlxD/refyqogOV6+95gwfEXOIbED8B 456k5PAC4rpRaqNY+BhD/+eqr0G7Yq/idWyM1HtYkj27Wiv+9Z6VBHT3E331vSxINWCN SpzuNm3xLBM9ys4nUT2aUhBmnyxkJ9BdAjTW4Ywf8wwsLVLAYkwLGmSiih8UOwy3iWzg vEZWCRtwkp5QFqwSCHuUJTGfAWB2VeqIg6v2oGUSSOtBeUdcHZDL651CMa+V4fSo6qBq zg== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2120.oracle.com with ESMTP id 36p7dnkpjk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 Feb 2021 20:28:37 +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 11HKQOlP004067; Wed, 17 Feb 2021 20:28:37 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2173.outbound.protection.outlook.com [104.47.58.173]) by aserp3030.oracle.com with ESMTP id 36prbpwwx0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 Feb 2021 20:28:36 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fKcB4MijxZ7cR3DJQ9q+xVxa84Sf8z4DC0ESoisqTAx+z55K6aZaQQWsDPjU/1mSlRYKiKaFbrtQosDNuWAlLtye+S6lvTfmrQaR72VgI1eSG5jLNMjC1rA/JQvhikVvLKZdMiSHgEgK8YlBuE9iYrJpYBHPkS33rXLtX7hMrSgoBBB+Ek9+XL4nIa4ylUF2EMbWwRYpOf4lCnrOlnP0Oa9kk4+b6BOvDLJK4KV1SJ91i6hq+5SfRY9YywTy3anvat+ycyVrwsdE0TDHHodJqZ+FgPV8FeS8n4f91OBMEN5vQ9Yq8geomemS9k75qP78+agQhinfXELpdPK7kyyCGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nmNPczwdrWFQufUfS26xsht2CcTvVrMqQOEoCGgZw3A=; b=N6ibxl6A4LBKL9DqBkt918jbPkf3NzSoPdx7Vji7U3ucEyF7Dym2/+SCVf87oC98APy1jEBWSz5L2olO+3Aqcd+FdWO6/pUrkX+KZD8rc5blgj1yLwDMjnbG5wUx6QrbsxKxNS01QnDe6fPO56Tfy3x+OP7Wpnu/I/PzorL1V91smYWvSWgSEHxuFmSn3VXIZaUwBevRPQvnmIKnpsspHN7vCt+rEKnC3Pp0A/5Wiey2h4tY2VGdkqOnJSfvecLZO2YZoypoJyVz97NRWQhKMDfpjlwhNUD4T5HLwosKYTJPAmV0qJXH6mKMu5Ldx3hGvNsO1IzIsmpqSHpjDeumeA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nmNPczwdrWFQufUfS26xsht2CcTvVrMqQOEoCGgZw3A=; b=f8AuD+5OhRBcvGyB0HfLB9MxM8n59NUHeVkdZmsp7hB27p0Dv3PutkMFz9l01zUkR5lx0bJDXlyse0bNv5jJQ0aMHvBpkJ9FGQYxxEoEAn7ruSg/OYkYIHh+Pk2YCYMortdV+EfdKkg8cHJEWEgCFQZo9AaH6XyELVK2bAbbQWo= Authentication-Results: gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=none action=none header.from=oracle.com; Received: from BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) by BYAPR10MB4101.namprd10.prod.outlook.com (2603:10b6:a03:120::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.31; Wed, 17 Feb 2021 20:28:34 +0000 Received: from BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::1d86:b9d7:c9ef:ba20]) by BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::1d86:b9d7:c9ef:ba20%7]) with mapi id 15.20.3846.042; Wed, 17 Feb 2021 20:28:34 +0000 From: Mike Christie To: bostroesser@gmail.com, mst@redhat.com, stefanha@redhat.com, Chaitanya.Kulkarni@wdc.com, hch@lst.de, loberman@redhat.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org Cc: Mike Christie , Michael Cyr Subject: [PATCH 06/25] ibmvscsi_tgt: Convert to new submission API Date: Wed, 17 Feb 2021 14:27:52 -0600 Message-Id: <20210217202811.5575-7-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210217202811.5575-1-michael.christie@oracle.com> References: <20210217202811.5575-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: CH2PR15CA0001.namprd15.prod.outlook.com (2603:10b6:610:51::11) To BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by CH2PR15CA0001.namprd15.prod.outlook.com (2603:10b6:610:51::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Wed, 17 Feb 2021 20:28:33 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ec6f3a64-d7ad-444e-4282-08d8d3829940 X-MS-TrafficTypeDiagnostic: BYAPR10MB4101: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5797; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Z4hixpHc7CGAupP6BA2XhGfjU4MuP1b0SYzsKox4huzWnSBi4AACsDceWKblFcPLOJK5SvBYssRPfUbBpbsSnwPUQiShONg0A5NzZrwFV4rXad9b8nUDNE+3vDbpSPna3Lg/OB321Eh7OEetwWh8zzj9kNSNfCU0yWAtcvujJNrigy330X2j26AjMUG5aMRB6tS+2RHLjpTOaEQsXWlssMRuYgBPMb2UDhCChKfXcpWQKF50l5T0sGhy532BVsLsa2QnjFQV+doMJzHqCOyDM9YyJQ20byVZsxqRKL/T7EEpoH9NPAUGsHbDhii5aDYaBzFc1Bont+uyqNdm1VOBi7xW1HKlNW1xfA+5d6AWc8DysYLLeLzy2UeO4i9u0IFb5lhx9dYIbSooyoHeTlyuXg2v7P4Hn7nqxIOMo+2hysPcu2ZnpzlMwa3F1si8HGZ7iIvDvDNJP99InQR+/cVIV6qJFi0KwNGBwnooWHV42eABhdY6QLyEbASYlW3CyOVIsZEgzmMgNeknmlaHQDm8rH5zAeDQvE06jtxkC1qEZAJe93Z+kTUrMtpoV28FDpD5pLiRAjwVE04zKw9qNvCgyg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR10MB3573.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(366004)(376002)(39860400002)(396003)(136003)(346002)(1076003)(6486002)(26005)(316002)(54906003)(478600001)(2906002)(186003)(86362001)(6666004)(2616005)(6506007)(52116002)(956004)(36756003)(66946007)(8936002)(6512007)(8676002)(4326008)(66556008)(66476007)(69590400012)(5660300002)(16526019)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 1Catg4BYUfqymMu4OvNgD5WSptoCcBpDrMdgV/weTcHwAjaquZZ8dlmhXjpdfNDICovTnRxiuiqbkqmMNOepLCldjnBfiEJJXZBT6R0EDO6FFJTVKDSiS5kQTr6/+RNkb/RlKdxMgBgl3iK64ljc3LaZ7ZljBQRBwdWNSdof23o7/eSVlL3lUjlt0Stx1FHa63iZCJ/O5hxamUcv8GSpQ725ectwg1YOVY864GmfoMODO803zLh/s7HUSryZDPb75dAUpWZmnnavU/BzusHUztX/PVOBfvYizIfQqhIQTAdJnrqPVXh0XGYgDGQoy/3RWyAZ6ULvuO3gPERTwUCpPu5baXwI4A3dlSKjmZLK/PfRFX5xjdGZ4YXH9SVAjXZnvE8CIrTPlTSI3PXdZiUvBSNzNwzauZHgsdGwOcuZYPwnVRFS5wR7JSEikdx74wVBrik9ut8C+unGbOHz2M6RszNDYgyC7UX8QLyMLnJpRgV77RzHCnoa2aBVr+Avez6S0DZffF63LkF5udXBXDHjfQonQMJZPntGkzdb0kjhODsaWQ1wwi7rcA4IJWIiNFCK6aKx8bvc8JPRXCkx0vvIiPunXNIQF8U6dR/DfLoFB2zpnKHwfBsZRuSSK7i2e/rW/2yy2cUoFFKKAImd+Pmov+95QXbqQlA+Cjg+a9kvx+T+0kUu3pVuLirwKUv0SQixkGCtcSaLDZ/1talXrZmXEFML5MJ0oGjClELl/h2+qxy1ZPltb/9kifv2usfHEZAUnDIGegvUthPNy692ket1dBfsHSwwpOagjiXKXEDuL+7iyMIBVqn/5Vg1rpZvVMhhkLkiBZg1S1xkXV1vE0p56Y929MknQl1LJ3763aZy2giE/YB6Eixp1MuGzkvJcl20yjT45eOhgVAaA8xwLm9PxOOJc+e4n25/acZK+BPu5IPZzxXRqIMM2w/cEj413orpAeqv7FH/sN7hja0bYwGep4WJ19UL7mX9EbdyGwCVEUX2mlFCgI+4Tw5v73CiIlCDNbfK7GdBxEDFbZfDYTNRuPFlo7mp9BDzpm0PzVqttjQTe1yC+RXL35pkzaH9IrrgOr0863AypIgcOGb4+UjV7qWGY0SnRQR7vaeZwGDGL/G59o/dXZuvMY//EewL6rm+X48g/1/Hyod/ZzlOZSbnHTUMcWyhVxswrgKc+hT/tLKCPnXv2N4o70rswahoIiQ+PzA646NIpLLQtlc5n2kie/hQlD/k05u/iJMN5s2riNqbP8Ddxz5THwIUxAst6RoqDoonxMIpMKDgm4v9ZzAiYKBic+xgmlh397Z3kdKOLt/kY4rCOT1g9R8MZDh/9J1K X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: ec6f3a64-d7ad-444e-4282-08d8d3829940 X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Feb 2021 20:28:34.5188 (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: p6pq7PmxYXu5jZr4uDEcZRpmLFMTd3SOX3ZP0jk0DCOE2opQb+yFOQPx+2BbYGEAnzYR+QZnJzT5gWfT0fbjpV/S46VFEX+h5hgrqGk38hM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB4101 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 spamscore=0 mlxscore=0 phishscore=0 adultscore=0 bulkscore=0 mlxlogscore=999 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102170152 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 suspectscore=0 mlxscore=0 phishscore=0 spamscore=0 adultscore=0 clxscore=1015 impostorscore=0 priorityscore=1501 lowpriorityscore=0 malwarescore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102170152 Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org target_submit_cmd is now only for simple drivers that do their own sync during shutdown and do not use target_stop_session. It will never return a failure, so we can remove that code from the driver. Cc: Michael Cyr Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig --- drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c b/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c index cc3908c2d2f9..cfc54532402c 100644 --- a/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c +++ b/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c @@ -2670,7 +2670,6 @@ static void ibmvscsis_parse_cmd(struct scsi_info *vscsi, u64 data_len = 0; enum dma_data_direction dir; int attr = 0; - int rc = 0; nexus = vscsi->tport.ibmv_nexus; /* @@ -2725,17 +2724,9 @@ static void ibmvscsis_parse_cmd(struct scsi_info *vscsi, srp->lun.scsi_lun[0] &= 0x3f; - rc = target_submit_cmd(&cmd->se_cmd, nexus->se_sess, srp->cdb, - cmd->sense_buf, scsilun_to_int(&srp->lun), - data_len, attr, dir, 0); - if (rc) { - dev_err(&vscsi->dev, "target_submit_cmd failed, rc %d\n", rc); - spin_lock_bh(&vscsi->intr_lock); - list_del(&cmd->list); - ibmvscsis_free_cmd_resources(vscsi, cmd); - spin_unlock_bh(&vscsi->intr_lock); - goto fail; - } + target_submit_cmd(&cmd->se_cmd, nexus->se_sess, srp->cdb, + cmd->sense_buf, scsilun_to_int(&srp->lun), + data_len, attr, dir, 0); return; fail: From patchwork Wed Feb 17 20:27:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 12092159 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 7E577C433E6 for ; Wed, 17 Feb 2021 20:30:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 399F064E6F for ; Wed, 17 Feb 2021 20:30:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234317AbhBQU36 (ORCPT ); Wed, 17 Feb 2021 15:29:58 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:43936 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235055AbhBQU33 (ORCPT ); Wed, 17 Feb 2021 15:29:29 -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 11HKOCQ8190334; Wed, 17 Feb 2021 20:28:39 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=kl/EjnB9ZwBzqtChF9uf2wvKcrv+VSurCwCXDzlG5UY=; b=pIuAmLMYMyBfbI47PxncfBKEuintI2FC2WhTC+3X/Uyc6EF4PXukJRW3b/JllR/U64Sy Yy+k0d5D6yvFzbBdnyS26yTR/0occBQwdKpY85ARaGQxeMxl6XCPqUmtVSiru/tQjMUH ND5dvAVstlcRvFyi3cCPCFgkCmU0BFSHnnnQ+7DjkZ5DzStzAFcNIZaXrXWWg9Q/cerQ FV2ygbLQ/HkQSgw1QdR+5amlOEN2yeXVr9SZNGuMY5jIG5A1cbnLzbyNwg/gGBXFoksR YqNea7JZW0HIB+r0ZtTYQfV7a2CF+oV8pSoYluQbVs9YWN8iZoOZQgMF7wZ1Xy2BAr6E UQ== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by aserp2120.oracle.com with ESMTP id 36pd9ab8h4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 Feb 2021 20:28:39 +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 11HKQB6E191515; Wed, 17 Feb 2021 20:28:39 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2175.outbound.protection.outlook.com [104.47.58.175]) by aserp3020.oracle.com with ESMTP id 36prp0p69p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 Feb 2021 20:28:38 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GFy6JpGzrzH4dqHvqfYA+zKf+MsEeL5fVKh4NOewmjoepilPq9VGublW23bCRWm4QMrBX+PrTQoUZb/uEATy08ccbUMfsJ2Fd31H/Kw0z0eoxTVjquDZQ+EYqipS3L2d3jPwkqRdzLvniMD/PNX2pEfULqRsT/jUpvbrFH6PGTVfbmR7a3lq6ZepZ4268AaVnQ63VbI8RE+NlYaHihHtejUjDYT5cTk7+QF2T5RANEIklZEHTwgGGb+SlrVazSAX4blI/eflFwlf/AbsI4uTJ6KcJNQAg+S3AOkzXnskQ+1rhodKkIrusi6zehQj4zDigzsZOK11LnqRpbfTIpFUNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=kl/EjnB9ZwBzqtChF9uf2wvKcrv+VSurCwCXDzlG5UY=; b=RFoMZYFWfiD/ZwI2S8FGISS/YcA+n4Q04xP6PxY3PvGVw4bqDznptRpKULfd/+6lKKC43dUl/x1LuUZ2ioQWSm+I+rhKZzjVekyiAINssRRU2kemQm3hmNBq+jBchZETRROXGAoda6yxYPjIISVCEGV2bSl8RWZB1RVaVfaoxxouaH+sR1v/blUnQJJwN6W4yZiXJwGT3scy/78GjnXqgK49S0tb0DmuNOLMoOJJ3y5YVm00LVamPCpzXxs3SStUMTxBCHhQAYd0xHFOXwcbVqisx8jlx4KvJyPIpD9ADV8x/i2aDwnsycmRh/MCBAZpIGHAI5Y4pDS980gM3HZZPQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=kl/EjnB9ZwBzqtChF9uf2wvKcrv+VSurCwCXDzlG5UY=; b=prrw09ghFbENake3jl/NEzmUchdC97b5AHRbc/gFzH1gpJP32zemmjsTExIkUKdW18sEunkDmWngygwesgrcdZog/hYZJlkhvlvRs6DA9f/D1RqWnxi2qX1uwiwLCCFNtcOSDwrW0euAF6D3OiO86nBuB3qh/t3RpDkP6DD+6kA= Authentication-Results: gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=none action=none header.from=oracle.com; Received: from BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) by BYAPR10MB4101.namprd10.prod.outlook.com (2603:10b6:a03:120::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.31; Wed, 17 Feb 2021 20:28:36 +0000 Received: from BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::1d86:b9d7:c9ef:ba20]) by BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::1d86:b9d7:c9ef:ba20%7]) with mapi id 15.20.3846.042; Wed, 17 Feb 2021 20:28:36 +0000 From: Mike Christie To: bostroesser@gmail.com, mst@redhat.com, stefanha@redhat.com, Chaitanya.Kulkarni@wdc.com, hch@lst.de, loberman@redhat.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org Cc: Mike Christie , Nilesh Javali , Himanshu Madhani Subject: [PATCH 07/25] qla2xxx: Convert to new submission API Date: Wed, 17 Feb 2021 14:27:53 -0600 Message-Id: <20210217202811.5575-8-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210217202811.5575-1-michael.christie@oracle.com> References: <20210217202811.5575-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: CH2PR15CA0001.namprd15.prod.outlook.com (2603:10b6:610:51::11) To BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by CH2PR15CA0001.namprd15.prod.outlook.com (2603:10b6:610:51::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Wed, 17 Feb 2021 20:28:34 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3ea60b14-0901-4513-6024-08d8d3829a4a X-MS-TrafficTypeDiagnostic: BYAPR10MB4101: 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: 9CVAhEQtv9VPeqTt11r//dHvsjgnkb1orCPcrG3hGlDbrpWmKjqF0UvXdQgi8tk7SkCXKq55aytVtgEyOJS8JvMvi7NwxRGEHmykmaw2jGHKY5USwnwhrKG5HVOAROz3gSPueiipIsaFKihVi37WHoCcH/HY+OYdRJo+d6aE5ggyeYK5UbqaHnCknJs1oAIl7fCVkD/4U5ZP3vD9dDNWbDahNIdwpruvgS37dxVWRXi63rSpDGzsx1wJrcRcITZrjlrhvg1K4muIBhc5kZEe0S8CQdlI60CoMXnfn9beWVcMM0bPdPN2QGBYTtv+apchnkr0D1grFgRuB4f3WAGrfHyvyjgLwm5b0CiDjuIXV8H0JcTfgp8Ee+Buvg4uDGPgZaFNcRbccR1faPhzs1k96qBzZsZtDdjbPKoqo3lt+jm3ewzjfz51qJ231KjeMNXV5cJF6WyTGyBpc4TZw7z/I1B59zH5WXLJhd7WeqNOJo5OQNIpZWFiBG4wE+WCu4kqDOoELfy3A+GKTAmg3cQWLYdqbqHRKifRePoNV+KVwlOW2y6YkIHBClj+ly9zuf1pmJGV5Zmny2diOg+bNhKchg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR10MB3573.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(366004)(376002)(39860400002)(396003)(136003)(346002)(1076003)(107886003)(6486002)(26005)(316002)(54906003)(478600001)(2906002)(186003)(86362001)(6666004)(2616005)(6506007)(52116002)(956004)(36756003)(66946007)(8936002)(6512007)(8676002)(4326008)(66556008)(66476007)(69590400012)(5660300002)(16526019)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: a8SL4giyZj2jEPMRKyugqNtzhaa3qXyyM43pXn81G0jk6IOAKyT7hT6fEbKNZVGgGWEdADvnE07SPzu6cLDsW7neewaAyIW2Npx9ObMcjvXw/d4dTgr8IExW7mwvn+plST9G5N1nSBrCUX9EuLXa/FALyrfi+/RrgI8JpUCTbxIJo76DO9dZ07IWb927yDiYXayeWbq2Q6FMAySbs87HViBlmbYFavQIqTXefKyw/Br6RceK8H+1Od92zwGzrExa2BO9AUEsIens3FqAcWuYhNPaSyAieA9Ttid0v0T9lUQ/jnFtXhHj8HLJjHW0knHCwiuMBbGMrYDpv/+6tIaWx4tQMTazZFFlWQoP8oxv3Q5tq9as0cC6CpfVbZVlBJxK65NiQ921v1gAe9+JWetXVHCdR1Ayp9FdnbBzXxbcfnLmtaKW+l2hCSS5lsnXPTnynoJsLiVRG1iWmZjDrVSOb5GesZsmRWdohWRmfKIUOoTj1uwaBV11ZgrZvd6X3teIUyJJ+5JuPMGVY6Wgpxt6aBakWfrJrA+mBKh1hnN/qM1HFCbyJBbE4p8an5C0dIV71jIC3YWo5Yvwci7Eqooe5MFhYlquQ6T0NRpdtIZd2GYiAkQ4sLP9LHBRQoYyOMGuE//+DEi4v35ucBO8ueN4XDa7Iwqfs/+cQ5f2AW3iwnk6kgTEjGA/XTH4KcFBmADcNGAh+rYnwFP9i6Uitk5e7SF2bniaGIjiO/dKo9/9NTJXZlHcI2nN26YknnhVyhzfdiBsvpo/yMz9vlb/rBa9nOqeNHMO7oM+ftsQqx03fZUnP/Bh53wklBF3DAkozI11ZP4NVHO7/sZxGwevdc0zvvwSDacbOiiWxgiYHBuKmPGi1cQ9HzGVbRVivrkbqy/40WWq4IyzQOK6oOv1wZ2wx67Ra/iVaFUC5Qh3uZf/n4IbHxtcNjgel9cKvBC4STYmhrukzQ81DBuHItB5lyMi02yu6tgoDP/CCYHNOv08D3q+VxEsE1cbHKuaHuzRrn+gznGU1BNSlnqMlgyvC16wVM1l2xKHP8DPCH2NeWF//vL4bwhU1G1tgQfilbJj1XVToSWKDJJ2o9i2RD6cCPf3/63eaboYW9DMz7hwvopDLeSyX2GvfiZGX8rUWuGwkLLrvhlShp0+qy4WRwSK7zv/OXHHhB+Z1UvejTj7XjHV2fMNeGunSw/egmoMhmiV3UQS/wwvO2aBDPruXJGqAAeoUimmkXwLeG2MOB+NzF5yxVeoB8icaN6pHewWgYR3kjkGlRuPkujfzclq3L3ZHvea/LHtLEiYjdWQ3LmTK+eR5W0GBtQBQWQoSrXczD4CdRt1 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3ea60b14-0901-4513-6024-08d8d3829a4a X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Feb 2021 20:28:36.4557 (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: be2lwaZtaSsz1pv5tf5vrLn6YwtM6kItFQXEKnAQAj8+Wp5itXGwMpiUwijqy+29oxmOrDc0p12SVnLFz/UZHYe4aO1Qr5sx9yz2x/a2Nfg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB4101 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxlogscore=999 bulkscore=0 suspectscore=0 spamscore=0 malwarescore=0 mlxscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102170152 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 clxscore=1015 impostorscore=0 mlxscore=0 phishscore=0 mlxlogscore=999 spamscore=0 bulkscore=0 priorityscore=1501 malwarescore=0 suspectscore=0 adultscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102170152 Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org target_submit_cmd is now only for simple drivers that do their own sync during shutdown and do not use target_stop_session. tcm_qla2xxx uses target_stop_session to sync session shutdown with lio core, so we use target_init_cmd/target_submit_prep/target_submit, because target_init_cmd will detect the target_stop_session call and return an error. Cc: Nilesh Javali Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig Reviewed-by: Himanshu Madhani Tested-by: Laurence Oberman --- drivers/scsi/qla2xxx/tcm_qla2xxx.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c b/drivers/scsi/qla2xxx/tcm_qla2xxx.c index b55fc768a2a7..56394d901791 100644 --- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c +++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c @@ -451,7 +451,7 @@ static int tcm_qla2xxx_handle_cmd(scsi_qla_host_t *vha, struct qla_tgt_cmd *cmd, struct se_portal_group *se_tpg; struct tcm_qla2xxx_tpg *tpg; #endif - int target_flags = TARGET_SCF_ACK_KREF; + int rc, target_flags = TARGET_SCF_ACK_KREF; unsigned long flags; if (bidi) @@ -486,9 +486,17 @@ static int tcm_qla2xxx_handle_cmd(scsi_qla_host_t *vha, struct qla_tgt_cmd *cmd, list_add_tail(&cmd->sess_cmd_list, &sess->sess_cmd_list); spin_unlock_irqrestore(&sess->sess_cmd_lock, flags); - return target_submit_cmd(se_cmd, se_sess, cdb, &cmd->sense_buffer[0], - cmd->unpacked_lun, data_length, fcp_task_attr, - data_dir, target_flags); + rc = target_init_cmd(se_cmd, se_sess, &cmd->sense_buffer[0], + cmd->unpacked_lun, data_length, fcp_task_attr, + data_dir, target_flags); + if (rc) + return rc; + + if (target_submit_prep(se_cmd, cdb, NULL, 0, NULL, 0, NULL, 0)) + return 0; + + target_submit(se_cmd); + return 0; } static void tcm_qla2xxx_handle_data_work(struct work_struct *work) From patchwork Wed Feb 17 20:27:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 12092193 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 E1397C433E0 for ; Wed, 17 Feb 2021 20:33:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AA79364E6F for ; Wed, 17 Feb 2021 20:33:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232892AbhBQUdT (ORCPT ); Wed, 17 Feb 2021 15:33:19 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:44994 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235065AbhBQUb2 (ORCPT ); Wed, 17 Feb 2021 15:31:28 -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 11HKNl5l190231; Wed, 17 Feb 2021 20:28:41 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=wEzbYzfKix+PmW79toGO7JSjYwGZC/E8Ru7vqxwNZUc=; b=vZuvKihdkgl5CTOz5TouzYFQ5sdHmBjDkEU29iNi872Mme+LBPViWp6r0gVM+b3btOPI mju0vX8NOmZOkZwFcK0r12ka/MaCNFKyEarZCCmhbi/Ht0zwIeuUgcXqmdipE5z8lNSC RhXvi+iQ/lEZ1uzKh5CIY48Jo4JJDF6Zc8KN15IQ4W7nd6TjEB4Vx1VZVkE+SRtf1ZF4 d76Fa3w7/nzdEk4psGVHxD899yRLtq0EXDYThEvYFJqbXkvXGuorM+iSaCx1OXpd6NoQ O1QJrqzdozAm3UxUsmvdwYBpLJM+dLWRDceaSQ6jSJYN5DuWcNCdMp9+BhsMnlrGwr8r hw== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by aserp2120.oracle.com with ESMTP id 36pd9ab8h6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 Feb 2021 20:28:41 +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 11HKQ6rN111860; Wed, 17 Feb 2021 20:28:40 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2168.outbound.protection.outlook.com [104.47.58.168]) by userp3030.oracle.com with ESMTP id 36prpykf8u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 Feb 2021 20:28:40 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=V26VXiAARiWx62AEOE0s3GAGhsP8oFrDQc/gx1YZ5EkT8dFr/E7WWlXYxzDxW8bQo6uAxcgvFfjcV5Cyki3zC8RX5UDRSMdrVH8CNrndQqRxLnIkZl3cipnFv3+EddwFUk8WfYE7S0m5LiOoWXV7Rtiv2Wk8SEMe6okLmNV2w43sZOIBShIUy5ukHbC9ozBcZmX08TrEY8Em7DZ5QEPhcv1YJoMVMlCGGJEJa12QeZClMs7pGpexoeVYuNyVsb4KdUbBwRLLcqS1o1cX3gtwsA3oQI8uAIJk3ehbGBb78qneDkqcqYur7zLmntZDrID/AmXpa8kFHJPgpfa+EduyOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wEzbYzfKix+PmW79toGO7JSjYwGZC/E8Ru7vqxwNZUc=; b=FSph5Mz8ug7t4W5L9Rk2cb0afOPxER8qGIdaOvYhiGYNMheQvf5WYExOogOfzwSuC8UlN9eQbs3+mjXnq5ozR2rWwbywgv43yRnf5itGl1D58OhK+L6AGdCVIBW5v9krXWTGUesQkt7Z9bXAVr8avIJdNEOAF9/BYFLeKzvicYTYOftiAWx/4R46Cgu8Ds/InySIGD5u4fmVArQlk21x3qPui+w3hcEM13dxJ9mBC04xaPt5jm4AzePv9AjyzVBrfiC2elIB97UYdCZuM4yG+1ikVF9munTxkXiKZi2Wt2xWLxJpE3z1cQISf7Ys4t0ANXsZOlbNklTK9p9vGNiVFQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wEzbYzfKix+PmW79toGO7JSjYwGZC/E8Ru7vqxwNZUc=; b=XlpTnG42g9FAQBCD6ZvmuV8LKS3dJUGpnOEEnYKyyITADaqP+c3rdE3gOnt+H8zfXNMo6qJaVyrx+yvHK+LmOAE8kP5T+p19/oCtACDSf65+ikqAV2DyjA6kRQfvN9VzAJ24Gte9ifEBMYMsS88WpwYC/pMlhhLxWbWJub214Fg= Authentication-Results: gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=none action=none header.from=oracle.com; Received: from BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) by BYAPR10MB4101.namprd10.prod.outlook.com (2603:10b6:a03:120::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.31; Wed, 17 Feb 2021 20:28:38 +0000 Received: from BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::1d86:b9d7:c9ef:ba20]) by BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::1d86:b9d7:c9ef:ba20%7]) with mapi id 15.20.3846.042; Wed, 17 Feb 2021 20:28:38 +0000 From: Mike Christie To: bostroesser@gmail.com, mst@redhat.com, stefanha@redhat.com, Chaitanya.Kulkarni@wdc.com, hch@lst.de, loberman@redhat.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org Cc: Mike Christie Subject: [PATCH 08/25] tcm_loop: Convert to new submission API Date: Wed, 17 Feb 2021 14:27:54 -0600 Message-Id: <20210217202811.5575-9-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210217202811.5575-1-michael.christie@oracle.com> References: <20210217202811.5575-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: CH2PR15CA0001.namprd15.prod.outlook.com (2603:10b6:610:51::11) To BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by CH2PR15CA0001.namprd15.prod.outlook.com (2603:10b6:610:51::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Wed, 17 Feb 2021 20:28:36 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d140a86a-9390-4015-14d2-08d8d3829b60 X-MS-TrafficTypeDiagnostic: BYAPR10MB4101: 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: vFBTSRt93GS28wju/w2n//p0pXDfpjS/S1uDKdvq1hm7QeJCt2Xk+fg5kZ/FGpcFTpVyTeFcqa1anUbpwfbYVqCu6camVC1KmiDqIS4E8UWwk9Grow+13V+o6cd8chZUA+tqwbvFwRyPIcvysjzY7JSs0ZHJ3x8MJGZAbzwAkfWl3krvEzckLXRF+5wz9fu6d93wMd9M4jDrFSkIIILhosvaDdI3z8WyBC8PPUZHC6M4TSqD/iXLBCAyi/n2c4UBHS6hLv09K4GROQUMBR5ePSAJjpjZhVvImwx+Y2oFdvLxTZDOgH6v4kfPxxJQXMYSBC7bM+hPtqHBTcmRuagdqJsayh1HlR6nIDCk58wD01Kcv4zlZWKtzI0awoNSadPbxC2qL9a79L7IsO44IPNRkVzfLQjCMOobkwaYhMn4uVEoUyB6UXSjBZg6MkxqGHux9wuLlNPCuX+vWSa4nkgFIEX3qeCwMcr9CJCD8SFMXYRaycxlJAyj3PEEy3Fa5D6jLmoPbuyL0mnJONJxznAPDWLG5Mw6q2edSSVBUHtEBhaTBhqgrCaNpz1ckh4N1vxE/yVsjqsKysgYD05gggCFdQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR10MB3573.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(366004)(376002)(39860400002)(396003)(136003)(346002)(1076003)(107886003)(6486002)(26005)(316002)(478600001)(2906002)(186003)(86362001)(6666004)(2616005)(6506007)(52116002)(956004)(36756003)(66946007)(8936002)(6512007)(8676002)(4326008)(66556008)(66476007)(69590400012)(5660300002)(16526019)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: S8c+fl7GLYz+jbqCjvKHNABR5OkUxfc7Sr3kOSN1/mze/1IDTXrVnnKOS0EFECDrMg6B3suE5j0N3Jn3cHVxBVi5l8QXSrF1ffzQGqG4nOxOTz8AvK7rc3biTs4uK3UXLk2FADxkCK9uoyf7D21TaYlz/XhV9wMB41ec/e+Qjz5cozuy9sfpb6ZS8SQq4ZFH+fm1+57Ui9V5Wmi4xAjDBLqRtgdufqatuX9MhLlGbMoyKAm1Yzz4w5wbuJ1SLWEEOkpS7gn23PLhU0tqlLzPY8bTKsr4i0vTOGAr2XCWyO0eC2PA9/HWlpbinWbch5bBRlQbSOCMnOG8yWnu0b4glCxeKBxVIaBZJChnzfm73AJZu5w6wkgToGtjAkhbRhA1huAZvTxW+jQaYtXL7nMsTl9wAKl2IrUAsGRjZFy7bRBYzlDa6nryt9YllDW3DtEzMBduO8JykKIV1WIieiR3kk8eOHyrU05yPiVRzATyRogCp0bIK8m9nN4mOG0RNLCwfpKodW/+60jqHYdwtOYvefanEI0wLIR1/xvc6nlskFsrz5eDToK9iKk44d0w+asR3PX6SkylzpxpzHEqj/4UzWdmZNpgZppoGtT7D2IzcZAZbCWQwDjO+y/Ykd3Glo04OdfPhsTFuo8WsQa0zOm5TmlzyamfAUlpk5mFJorwjjYcMAKYCpsk9nwJshQUp0XuKyL6WkHt5p0LCweR2NkhGsRWeZzJakYRIyY7ecOq+pFkTpGEVy3I+WUNzwRaoNUHxlE4ofpAPIIKaoQSe5hpKxsjCYjdd4sjZm65td6fvr4Q6le0+kLvTUBtfwclB4zeIsyU20pFTqKajOEfBCze2Dr/wLNsO7Ic7ZN1l/oYsmoIp3ocO7Ybb04g0TcuwtN0v6cutOfqoyJ3Q6EER0gWnRU4FhFJRE0VRhMWHG5rkwSSUG81tiLt0oRKyyMNHI1atRNH6ptns9z/9ny6H/lGghlExbpm68nKuxhYHnQntrQCasfJbI3Mc3I3g4fBTaMKXVnZI91kOpu5VadsIiUjPjJS/6Brc3br08A7Ge/mjthGwl78UboihDYqDt3oLdhKTuOZ9u2Mz7xE8o2R/ZO/Pk455ktAFH+ZZMSFK90VRVjOXonHc5cp4lzeg+DoMleUFNA8g43JE6IgtCW/oiVV3Wro3RJjSQpw2QmysQ6VlQV6j5+9ORFZuKdQWNtYHuKX3H7BaEFUm8efSYvQ+nacFgXUxMazEWPU/v14U5UAgnFJJN2t7TZBo6yKJQQNw3k254gg9zvrQNUBxxGKDQCjLEjXJJzKEbwgLj/ZijvsvhbXgZmA7rVoZpxRDODYwoGk X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: d140a86a-9390-4015-14d2-08d8d3829b60 X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Feb 2021 20:28:38.5026 (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: XQpNAI8/0YNclj7RYOX+PJWJA1TFGIEcRhRa/SUN1XVTozuQINKjKrhero1Bet1tOEQNbYzh8qLij8kcT1e4KGzykvMW7yHXCizlpyHriwM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB4101 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 mlxlogscore=999 phishscore=0 adultscore=0 mlxscore=0 suspectscore=0 malwarescore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102170152 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 clxscore=1015 impostorscore=0 mlxscore=0 phishscore=0 mlxlogscore=999 spamscore=0 bulkscore=0 priorityscore=1501 malwarescore=0 suspectscore=0 adultscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102170152 Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org target_submit_cmd_map_sgls is being removed, so convert loop to the new submission API. Even though loop does its own shutdown sync, this has loop use target_init_cmd/target_submit_prep/target_submit since it needed to map sgls and in the next patches it will use the API to use LIO's workqueue. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig Tested-by: Laurence Oberman --- drivers/target/loopback/tcm_loop.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/drivers/target/loopback/tcm_loop.c b/drivers/target/loopback/tcm_loop.c index badba437e5f9..461f4125fcab 100644 --- a/drivers/target/loopback/tcm_loop.c +++ b/drivers/target/loopback/tcm_loop.c @@ -113,7 +113,6 @@ static void tcm_loop_submission_work(struct work_struct *work) struct tcm_loop_tpg *tl_tpg; struct scatterlist *sgl_bidi = NULL; u32 sgl_bidi_count = 0, transfer_length; - int rc; tl_hba = *(struct tcm_loop_hba **)shost_priv(sc->device->host); tl_tpg = &tl_hba->tl_hba_tpgs[sc->device->id]; @@ -151,17 +150,16 @@ static void tcm_loop_submission_work(struct work_struct *work) } se_cmd->tag = tl_cmd->sc_cmd_tag; - rc = target_submit_cmd_map_sgls(se_cmd, tl_nexus->se_sess, sc->cmnd, - &tl_cmd->tl_sense_buf[0], tl_cmd->sc->device->lun, - transfer_length, TCM_SIMPLE_TAG, - sc->sc_data_direction, 0, - scsi_sglist(sc), scsi_sg_count(sc), - sgl_bidi, sgl_bidi_count, - scsi_prot_sglist(sc), scsi_prot_sg_count(sc)); - if (rc < 0) { - set_host_byte(sc, DID_NO_CONNECT); - goto out_done; - } + target_init_cmd(se_cmd, tl_nexus->se_sess, &tl_cmd->tl_sense_buf[0], + tl_cmd->sc->device->lun, transfer_length, + TCM_SIMPLE_TAG, sc->sc_data_direction, 0); + + if (target_submit_prep(se_cmd, sc->cmnd, scsi_sglist(sc), + scsi_sg_count(sc), sgl_bidi, sgl_bidi_count, + scsi_prot_sglist(sc), scsi_prot_sg_count(sc))) + return; + + target_submit(se_cmd); return; out_done: From patchwork Wed Feb 17 20:27:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 12092183 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 16837C433DB for ; Wed, 17 Feb 2021 20:32:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DA3B564DEC for ; Wed, 17 Feb 2021 20:32:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234260AbhBQUbv (ORCPT ); Wed, 17 Feb 2021 15:31:51 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:51864 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234170AbhBQU3k (ORCPT ); Wed, 17 Feb 2021 15:29:40 -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 11HKOu4q109320; Wed, 17 Feb 2021 20:28:43 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=Q2XGforPBgHkC4Kv1rEr3Sv69ElSn0Kj2+5SYFzd1TAFvp0uZGYeFNdQ3vztql2nrqHW G1xKO3HwC6YIISTt8fMxO5/x/7QD0Plcmx04aCUYM4FM0zfwnjTazpUBIfb91DLaRbcc 2i9nkRpgpDtf5g5JiaOkKTaVMYYMl5WoGwBMFGehZSIkRBFrhwFuQ7RPeV7Aq4aKED7U cNQ9dnoArKXBNY9j8jhViCRBZ0MylmJPA+UM0oKgBa5G5wjHdcbKs1DD2r8z3pxj8sZp 0C5KaiTD6iB6nn3M6qjH0TgiVSkZ06MED31Bl7Mqpy7Q6dxiSP21vDQbdXhPBNDqlviF og== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2130.oracle.com with ESMTP id 36p66r3s9t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 Feb 2021 20:28:43 +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 11HKQNvS004046; Wed, 17 Feb 2021 20:28:42 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2175.outbound.protection.outlook.com [104.47.58.175]) by aserp3030.oracle.com with ESMTP id 36prbpwwys-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 Feb 2021 20:28:42 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cEqph+j5ykK/VSE8vFJbrjA1pHgKv8Iu15xps4KV8g1R4q7KDOusuPg7h9cRsBXKjatVQTujKmUYH4gWJvUNi/uLgzfQTOVkCbPhyo3Jn3gyIVvw1TVHmjrdJ8iXGtkOwe/pquCQSrGvQUxMGRfaNfLBSoP3+QVDYml2jkee9S2ku2gh73FPSWLogyKmP/i9LLz6fjuUkncquZ4ijVv7SuHwZtu7QkHQXfRSUSL657iw7H1NrdFV8b/CakQueMJVXr/3JJsCZexN08JHnBjQ8PVq2io7EdOOn5rjt/LqZqIk9OLWAM5sKn1f4Abov49sdqo9EsYYLf1gBkXzrfCsHA== 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=TqHUo9oKdMfojeVXPgPaDy0NI3sdnPOGdG92N8sVa3snOO4UKEB72ce2rhIUqJuutaPMI4EcqKDOv93huqClCyNgYADahO+5JUD9eSdm4sVSMxsL+fPqG8pWuNSwEH/dsJxBtTt1JIQ1taPp4r+9/Vh+u8UyMMlXv3PDe9dPAjWfXESzPzDMDM2k6FJxTv/y/sHyQiDTM60TeCx5wrAInDTQKM5TIiqv2KVHiOmgpiWHrarnfR37iLrXe75Az23VRoZN9YR2sJMNJJNyjdmyXb7plbXGCd0ty3C70RLWGcifM0zxueXM33gANj64xKFyEU9GXsGR6SnjBtoFK4L1mw== 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=USy1oKdyvVIzrj/TR5ieWDmKq9tlZsno+6O8NsdWIZgy8/v5IRncHOTsf6OjYMYlE/eSIWjm8RtHKer7LJpRy5rn7avzXZplTz1zLEos0hUUHXtqZ+znVZz6DfTP1J9Z15veqBB2IKKYv4oGrAE2tqJ10L0JOdj2Mxzg/Q4JuK8= Authentication-Results: gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=none action=none header.from=oracle.com; Received: from BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) by BYAPR10MB4101.namprd10.prod.outlook.com (2603:10b6:a03:120::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.31; Wed, 17 Feb 2021 20:28:40 +0000 Received: from BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::1d86:b9d7:c9ef:ba20]) by BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::1d86:b9d7:c9ef:ba20%7]) with mapi id 15.20.3846.042; Wed, 17 Feb 2021 20:28:40 +0000 From: Mike Christie To: bostroesser@gmail.com, mst@redhat.com, stefanha@redhat.com, Chaitanya.Kulkarni@wdc.com, hch@lst.de, loberman@redhat.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org Cc: Mike Christie , Chris Boot Subject: [PATCH 09/25] sbp_target: Convert to new submission API Date: Wed, 17 Feb 2021 14:27:55 -0600 Message-Id: <20210217202811.5575-10-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210217202811.5575-1-michael.christie@oracle.com> References: <20210217202811.5575-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: CH2PR15CA0001.namprd15.prod.outlook.com (2603:10b6:610:51::11) To BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by CH2PR15CA0001.namprd15.prod.outlook.com (2603:10b6:610:51::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Wed, 17 Feb 2021 20:28:38 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c300b55d-b1e6-498a-92a1-08d8d3829c9f X-MS-TrafficTypeDiagnostic: BYAPR10MB4101: 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: DVpn/P15RqCa//Fwax4R435JdyIu0CNSyJCqRyb69Pgehfg/xxNSToblOLz70ANN1w7i0s6lnn72+JRxVJabaRieeV7VG3rxGIDoq1SjPklqWvk8Srd8mbvrySnpsVPpcR6L4CZLhiB1bBM75V7hR63KqZAmD2cIGwQ1kQgyMOEMJucmFwWIzEUIC1HhH97myba2eqn0aTEihjH9Fx9dSmxfr4AJ4YvE8P48RPPvEODVvHgsskOfCQa/C7jL7XWLRPsQN/JDRhumogiLA0VSGcnsvjhmpmjnb/Nvjf/HOZRFDEkeQxGk/rcczMTyKAexODbCDV7qpJ0jKWx2v96iFAXBn2QLqUDUDi76U3qb8XiwTbswpNVvLwa0foo7E1jxVTkWgmBpQxBKMAVf/iAKALdgzcWv2UyrgKrLKogCuGZRP06RTrerDJol2SUbilhFUh5L3NPFcf9QTcFiDNKJnQWLGcZnHZCzqovBO+aHIHdGOfqmJAi0x8Bba8WNG0aXx9ggXd2Mlv3Dum9iFCE9sTBNOWSdFP4IesrTFTsZJ93xFEEcc8KWH4is4s9dLmPtCOSfEKUMxLaTSCjgTpLarg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR10MB3573.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(366004)(376002)(39860400002)(396003)(136003)(346002)(1076003)(6486002)(26005)(316002)(54906003)(478600001)(2906002)(186003)(86362001)(6666004)(2616005)(6506007)(52116002)(956004)(36756003)(66946007)(8936002)(6512007)(8676002)(4326008)(66556008)(66476007)(69590400012)(5660300002)(16526019)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: S7NNSAa5CFO98Qcha8UTWc5by6FpcbWz00HcX07Ql597IrgRfMOE2sVNjM0Qqc/UXs1p1L+1HmQ/DjInLW9R/3mcLHcHzZ2YsFSAYkesU+ug/O1zZlN+T1A+x8KmQrQ0pQ0MkmuUJITok4G5eJWpiBQxoUOpSyLUchTpz6M51H2ZmSAmM7iZ7XqgVRrPFg6Y1DhD/5aO3wAInlOeBntrx8H1MXmJhLvahEaxhHE3UJEXzhU9TaJZ8IAHqcNw9FVadf7Fiq+AcbK6JLr0UtduZhuaq82SJOpVArI4FURLBhVTYaW72d/sVo8IzFIAHUS3nqYO2xRrx2Wk9vmboNBFGuNIwNDgC08azBItmXkUFEYlsnce0SldJ8xTkCFlxsL73g5m7UjouS+ftZCcR9O5mXAyVNy7YruvsoZC81+Uf1V3S8KiivYqxvHSEFhM9ULtuRB608zyPULltrm+1wjORSgM3kxav24GBzuuImN+peJkZVTz4ssLDbeRPugWFfeG4PhwkZctqDLOu8nvkP08M+urnDQ1ljeA9hkdIKN+4TlKwI9vcAKNnzpi7IAL8ASeryIv+l/igvE1U5cS0AMxjcJIwu4exJBOUmuQc9WU4Phmu4lKl3aQP42x8JmozGF7LSJCed0bScpQgmUuqynTgH+480Xo7751cZNZ/sYcEWJACB0ipobpo9GiqVFOntWOve3B8JgNVSKDWAXSdHVXdScKWhyp66cppbEgx1vafokiFyzFCSnh2htliZqGQAbr+yryGvCwpbdMnnG/zkQZVkDRUW+U0hgA8jaLVQH64Qm9NCNJ6Oi3aYHJJnvRuNKpWbORItJECsNG2Wz50GTYypboHTU6hHjKoWAmni0CFTRHStFpQhQ2afnRP/WEputROYXVr85bH0sfbmQkd6AOKTsaAfXcFbbe/JWCujDN57Hwptlnk6l9BLF381IkWkmN4EgfTDF3vYFpFF9s3SiFVE+A39BAoEhBSwt2oLMf472lEChu5fhrnOucXlolu2GIFKFh7QWQBzVHi9DKVboUslZOKZRmyHDGSWjjNUFbjdZ3+F3V5gXlr091h8PsMpN7RSSSZUbz5HRKublI6qP1YR5L6hYHBLsV5FKzdNdlKPXVZHuwHNCrhoR6iR9ylJ0CIGLMlZHEJqxLFs7E8+xW7k84OOBo4KJ/PQeVynu7lGNXUtr+ZKgnDF7zd/lcJykWJQZ+tFmIQtRy1tPUtl4raCGp1qEeLMPkfLQZl5MdNwR09MGOHxuA8XLoGcQ2pY46BPjOPTnhpo25AWORa/2QaD+Rk/BBxo4It2oCTOPZ78lDLM1LlDQapEfn561ivwHH X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: c300b55d-b1e6-498a-92a1-08d8d3829c9f X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Feb 2021 20:28:40.2026 (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: 2JvZy2ILo7Pd1fvqerR+dZMBF8zFRHmCut5lth7DwpxUnWXO7SkAsLlr/1TiuabJOkEJsyXnOrv4lDQCmIklAY5swv5Icg9nxRWlctUPJII= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB4101 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 spamscore=0 mlxscore=0 phishscore=0 adultscore=0 bulkscore=0 mlxlogscore=999 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102170152 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 suspectscore=0 impostorscore=0 priorityscore=1501 clxscore=1015 spamscore=0 mlxscore=0 phishscore=0 malwarescore=0 bulkscore=0 adultscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102170152 Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org target_submit_cmd is now only for simple drivers that do their own sync during shutdown and do not use target_stop_session. It will never return a failure, so we can remove that code from the driver. Cc: Chris Boot Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig --- drivers/target/sbp/sbp_target.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/target/sbp/sbp_target.c b/drivers/target/sbp/sbp_target.c index e4a9b9fe3dfb..f467c50aee08 100644 --- a/drivers/target/sbp/sbp_target.c +++ b/drivers/target/sbp/sbp_target.c @@ -1218,11 +1218,9 @@ static void sbp_handle_command(struct sbp_target_request *req) /* only used for printk until we do TMRs */ req->se_cmd.tag = req->orb_pointer; - if (target_submit_cmd(&req->se_cmd, sess->se_sess, req->cmd_buf, - req->sense_buf, unpacked_lun, data_length, - TCM_SIMPLE_TAG, data_dir, TARGET_SCF_ACK_KREF)) - goto err; - + target_submit_cmd(&req->se_cmd, sess->se_sess, req->cmd_buf, + req->sense_buf, unpacked_lun, data_length, + TCM_SIMPLE_TAG, data_dir, TARGET_SCF_ACK_KREF); return; err: From patchwork Wed Feb 17 20:27:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 12092191 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 3D68CC433E9 for ; Wed, 17 Feb 2021 20:32:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 043AA64E6C for ; Wed, 17 Feb 2021 20:32:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234332AbhBQUcE (ORCPT ); Wed, 17 Feb 2021 15:32:04 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:51848 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235067AbhBQU3m (ORCPT ); Wed, 17 Feb 2021 15:29:42 -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 11HKOx03109375; Wed, 17 Feb 2021 20:28:44 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=07JY3KzmlsA2PeJId/YZiQz2bizROuYKAmend1Uxe0g=; b=tbv4/8x0yQTyhiP5yx7cMkMr2zAOveoOmspuGEoAF/pTv83rSSPa/EIorVeCc6Mc/SME cor+UhEN44u7BPlhyDUgpkcvtLGbCl1XnRZJfxmmSIDRyMKfvIryE4mo2RlhSA8+bUgO 7XxWcaz2aqs4qtmxi1iVuRH3eyCFltXFZrrzr6uCqHWWhYyzybkjiXD9tOVJeXf5ApEH JUxdc7/C7lRp+Wkug29fq01ml6B8f7WDH8UgdOEZpXsHAtLegwoYkC6jTkUKuZhNCEN7 jB98HgmhYCZ8YYecrQiSWwnP4aFgDN7dpqXuc6Gh5NxrF78ol9dN7zTaZiNdEocQut4U 1g== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2130.oracle.com with ESMTP id 36p66r3s9u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 Feb 2021 20:28:44 +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 11HKQNvT004046; Wed, 17 Feb 2021 20:28:43 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2175.outbound.protection.outlook.com [104.47.58.175]) by aserp3030.oracle.com with ESMTP id 36prbpwwys-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 Feb 2021 20:28:43 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KyQl//bcY4ayGVxxAZ/f1Ayy4BMbKuYUZS9e5gZ8Wo1YbVVZ3AqUnTB0yHG1HofjXUwJi1n0G2sA/GGOcMAwQZAxfni8eqrEVqUqtb6gxhrM2il0YGjhZfMN7UZidqT9gDUF2eiV5CH3BR8vWQrxQyQcJNdz4IALYVlTNZc71M/Hzdktd/nswkLNqYMnPMXvF/GvKDBoBldnxAOpKC03nW1AYIO9stX0EK4yHzBM+i8A4F4gyGy1UoNehFBjkz7JEnXVdXqldQ8BwOnCxh/QsY+mrYpwSAq4WrmmZ4rG3Qv0BrMqeBQ2HBtosQDsJslb4kfetvnuR5cuSvpOZnqX8w== 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=gtzT2yYX56Pn/BmlpRyQWSjaOcCnHYEzGB1d+kUP3LrBpz2on9E0AnTYaw1iwinCf5g3tMvWXKORxyOYry0BaSso1O7sMvjGtTRRkrrttjPpRsSYZ6PYceuAV5pUsBwjmavfvTFD6e0/LKMNzK1iyLMD2mUjhEsnJ4C9NWdA57KJt4vvchNYXVe5cLIP/ax/zHWCfv6x1pCJHXPbnpAC7WQ1rs0OPH2bqDCVW/zYB1e/bYkaVCKlCB9Um957Jqmfj3y07aeHuQPK8KwBGPTWjznIvLkH7nNT9iKDIEkAyTujM+7fnPgHP78cO/8XCnravxYR6yIWujA+MjcPq6AwVw== 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=JTndgcRQJIZMdMVfNP26pFMCMJyl17UWXK2etTOZcTcVYpUcxNkvZIFXEHSYTwM+rX2Zx1HNNttyFLH8dHQSsKJIs+8RQWrEKmPJ53fAht+HsKPCuZnqYk5OcHGv3c9WnNUTM61yUn1n0DK4aALvyrJc64431I+jOaLhsCz7yAU= Authentication-Results: gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=none action=none header.from=oracle.com; Received: from BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) by BYAPR10MB4101.namprd10.prod.outlook.com (2603:10b6:a03:120::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.31; Wed, 17 Feb 2021 20:28:42 +0000 Received: from BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::1d86:b9d7:c9ef:ba20]) by BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::1d86:b9d7:c9ef:ba20%7]) with mapi id 15.20.3846.042; Wed, 17 Feb 2021 20:28:42 +0000 From: Mike Christie To: bostroesser@gmail.com, mst@redhat.com, stefanha@redhat.com, Chaitanya.Kulkarni@wdc.com, hch@lst.de, loberman@redhat.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org Cc: Mike Christie , Felipe Balbi Subject: [PATCH 10/25] usb gadget: Convert to new submission API Date: Wed, 17 Feb 2021 14:27:56 -0600 Message-Id: <20210217202811.5575-11-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210217202811.5575-1-michael.christie@oracle.com> References: <20210217202811.5575-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: CH2PR15CA0001.namprd15.prod.outlook.com (2603:10b6:610:51::11) To BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by CH2PR15CA0001.namprd15.prod.outlook.com (2603:10b6:610:51::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Wed, 17 Feb 2021 20:28:40 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8e5e4f0c-7efd-4477-7da1-08d8d3829d94 X-MS-TrafficTypeDiagnostic: BYAPR10MB4101: 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: kvqVbprV7aH4dVcN1aFunjK/kyFez2o0PFPPJKAGc2WvgWElkw5WSvksNZKZZcY/Q5K2mqIYy2RuJGWT1nSaI2CphXTA81+EwAZUwT8SzkHtJe/wIvkdHBNhjd99m/ro1DBQEEfe1t9hjndlLBpoYVSqyQE9y8f8/E5K7mM6nFEZ9F/zU4vl0K5R3eirFVWwQzdb6LZuroQGndBqKnVEODweXuW1ba5/Nee8+0FDZ0GzZg/sP337q0vwzwt8HXAkOQfC0kUtPaWBL/Co9/xYOnlUiuu76fQbbYRKGqBdxDEwCzOSEdwSrWlUXwZEbKUQxRRFPlZ2KLG4Qgkig4EyH8+HMwWCR2jsa38gIlUYH1cyM1Hl1njQ8Rq5EJOygaAh6sSzeq5qC6kor3LedigoZw8y/jSD1V3NYR2umXruCLMaHUI4Wakq67/e1v7WjydGnui0BPRg6vWQCa5VGJwNyWQhwW7n2VxkeNkKCAONbvtnDF9yA+YW4Az2duabczdhzQne6XIcQ4u4mc8aQtBeyRj9YUQ5nIPEmXJqVIeegUyEGd6bPgQsr4x9AM8PzP/vHz6Qc/GF78DPF++CiCwJgw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR10MB3573.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(366004)(376002)(39860400002)(396003)(136003)(346002)(1076003)(6486002)(26005)(316002)(54906003)(478600001)(2906002)(186003)(86362001)(6666004)(2616005)(6506007)(52116002)(956004)(36756003)(66946007)(8936002)(6512007)(8676002)(4326008)(66556008)(66476007)(69590400012)(5660300002)(16526019)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: H+RLMphDTH3gKatkb6o9kbLPTDKtqsD4FEQX3sin37tWTq0AMIDoR3As+e6Jwzb/CMnFvD+yrN+6qF9/1GKMa+J48wL5t07ybuU5YKO6eH2SlP3SnoikjA3lmIy0k2Mag5hhCVWEmQlN5EJoX4Y22xji8tC76oIha7R6g7W3PxTQcYKKT8W3NldyE9kRnx36HFivL1QtNIKPDQcgPShbJhOwLsTeg7fBKDoCoGuiserbrUikfhyXO4pEgPeDZQinseMVw5Ae6Gg7eQzPHQprjDkwbYzzSfsZZcsCNwHOXgjuC4Fq4QGaCOrxHjJ8SRH4vH9/GhCqW69FxbEBd1NeT6Bitji7WKaoi8UWr3bkT5KlVo9RGISOiRNZZw3kjebaWo7vbGHhlwJhuAaattKSwg9Q/xsjaoxKySwQ+rO3LJV0rlJka5IrKnRxKGCvc4OnyzfcR7XZqRHinxmWRtiM56SfiP/Nhja5TtEbTQtgdXOS2y52n6SoNDrL4MDq4GvbIai99jOmVoQinOLBnON3HMi3lZVphdB9mp3oNl51heVCucxWG12Rs7ahKP8DTmgd+6GG4+RBYymJfjudz33n1Lr5guALW+upU5RvHkdh/kN8B7fY2jcqqeev5O6JAbcRHUklfUEC7lSJKDDml3PrHBzJblJionqc9qbJFSrvBiR1L+U6biWTco3IAMQVN63l74Iaa5figpgliZKhay3TNAqlM9jWGuxaAH4xuhMwoVAss4hTbr0XXFuABEM1Jzvyh+HaNS3jaQU6tBIrO334FwSHUfk1FHEZJkyRs5TdlOqes3TQyRarvEGi0yn+n0f/c/GQN/or+Hu8YWeyu02Ze6bbVm9WjFxXzJWIRqv3bsTgNuHZ5mA2wV1b/gQkMQEIbpGra8zv0eLevkew+35vKeoQhUVXN9thMT+5C4CesVd+GVgl3K8tl4eVAC0XpuQryiW5Ctra977nOKmxuZOf2SYkPN8ETLCoONVjbJNBucSuIwRu2GxRK2SKilbDDM11sm/G3z30bPXvDxeh7zXSduRASQF7qhbPiXPE+bzeyBAvcy2JyX8fod5V6Q2SyvjyOMxe+2aRfWltJlq2Nz1wFn8AHjVuomwd/nIT3If88mb1NM8dRgWg24+rP4aU7D4IRuf7mw9gsC1m1As0KLKycJviIEQPzQMYlkabgiBN1DwvyT6PZVC4RIVXqI4DvTPH/wv1kU3Zc9+QaAabEo89KGHsYDS70+2LLfAzz9szTADKRnxElsLym59V3rt0FxvxFihTkpPGdE9YznL7czGiE4XvRAJgYoTAD92KsYJVrwynk0MtKy2W5IXRLCiwQmUH X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8e5e4f0c-7efd-4477-7da1-08d8d3829d94 X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Feb 2021 20:28:41.9556 (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: a8uxpZSPYSzLruwV6P5iUKM8PP08JcWL4XNa9KZh/6Keca7h6CmPGhzh3yldUlNi0WWyjPvV6WFK4JRpGQpj2L4ImQaeZ9+jF54NoWb0Mds= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB4101 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 spamscore=0 mlxscore=0 phishscore=0 adultscore=0 bulkscore=0 mlxlogscore=999 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102170152 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 suspectscore=0 impostorscore=0 priorityscore=1501 clxscore=1015 spamscore=0 mlxscore=0 phishscore=0 malwarescore=0 bulkscore=0 adultscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102170152 Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org target_submit_cmd is now only for simple drivers that do their own sync during shutdown and do not use target_stop_session. It will never return a failure, so we can remove that code from the driver. Note: Before these patches target_submit_cmd would never return an error for usb since it does not use target_stop_session. If it did then we would have hit a refcount error here: transport_send_check_condition_and_sense(se_cmd, TCM_UNSUPPORTED_SCSI_OPCODE, 1); transport_generic_free_cmd(&cmd->se_cmd, 0); transport_send_check_condition_and_sense calls queue_status and the driver can sometimes do transport_generic_free_cmd from there via uasp_status_data_cmpl. In that case, the above transport_generic_free_cmd would then hit a refcount error. So that other use of the above error path in the driver is also probably wrong, but someone with the hardware needs to fix that. Cc: Felipe Balbi Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig --- drivers/usb/gadget/function/f_tcm.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/drivers/usb/gadget/function/f_tcm.c b/drivers/usb/gadget/function/f_tcm.c index dcce6e2605f5..7acb507946e6 100644 --- a/drivers/usb/gadget/function/f_tcm.c +++ b/drivers/usb/gadget/function/f_tcm.c @@ -1058,11 +1058,9 @@ static void usbg_cmd_work(struct work_struct *work) goto out; } - if (target_submit_cmd(se_cmd, tv_nexus->tvn_se_sess, cmd->cmd_buf, - cmd->sense_iu.sense, cmd->unpacked_lun, 0, - cmd->prio_attr, dir, flags) < 0) - goto out; - + target_submit_cmd(se_cmd, tv_nexus->tvn_se_sess, cmd->cmd_buf, + cmd->sense_iu.sense, cmd->unpacked_lun, 0, + cmd->prio_attr, dir, flags); return; out: @@ -1189,11 +1187,9 @@ static void bot_cmd_work(struct work_struct *work) goto out; } - if (target_submit_cmd(se_cmd, tv_nexus->tvn_se_sess, - cmd->cmd_buf, cmd->sense_iu.sense, cmd->unpacked_lun, - cmd->data_len, cmd->prio_attr, dir, 0) < 0) - goto out; - + target_submit_cmd(se_cmd, tv_nexus->tvn_se_sess, + cmd->cmd_buf, cmd->sense_iu.sense, cmd->unpacked_lun, + cmd->data_len, cmd->prio_attr, dir, 0); return; out: From patchwork Wed Feb 17 20:27:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 12092189 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 6D725C433E0 for ; Wed, 17 Feb 2021 20:32:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 37B4464DEC for ; Wed, 17 Feb 2021 20:32:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235088AbhBQUcC (ORCPT ); Wed, 17 Feb 2021 15:32:02 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:41110 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235044AbhBQU3k (ORCPT ); Wed, 17 Feb 2021 15:29:40 -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 11HKOM89147359; Wed, 17 Feb 2021 20:28:47 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=IUNK9kzWw5Lp9c3MgYqKzYs3IW3QY94cy1GUfTpPk78=; b=jL27tC1oTcOoIZgbqToBJenwoXwLyxE+kbNLlByyDDfaTWZfiRAE7Xl8Lqr1ASbjiSOP dj5OBhfDW1azrrUpMOvm66a0/D5QA+Hvm711qgfZdXE2YrFv1pEN42lW+rKKhTzyKeQi dAxwvRH+MhlCShPirjcnL3pO31XICC1c+d6WBXw9y6nESb4foC/zQ8SK1cUePTlxDavP JcYmg77WcMF4Gm73FR1xuqIqtCxYyjQNom0BAa23agx5sjf9CaiP72wGM6/jQoQWq7FQ nwXFJsp4zAkBbswS98VSyVIr4QwswgaGf+iKp/qv7zIGVd4beJAbsJJvc/Um4LEGc217 CQ== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2120.oracle.com with ESMTP id 36p7dnkpju-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 Feb 2021 20:28:46 +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 11HKQ6rn111938; Wed, 17 Feb 2021 20:28:46 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2176.outbound.protection.outlook.com [104.47.58.176]) by userp3030.oracle.com with ESMTP id 36prpykfaj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 Feb 2021 20:28:46 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MxWeuKJ2ObVqV1oQC5g8JZOXEc5qURqEnhnkT3nkNIpfVoJuRgUxJBZrMmBXmZBKFSy6XmV2JTBIfYDlK/BoHfOsGNfKjnxTkcrx4rxs8k/oKcWh1bZqxC1B4gm4rHTfzO+JwATcqYnXy6fuqqErTMR6Q1z5O8TI/F8xvVixoMRFGBOhh+esD0aEj994k2QvY5IN9dnCdnZcsjWRy9y4W6ZtTCd5iGi2J/z0h2GPI0OG09ODK+gGInTG4wtpcq3oiykcB60jfR0DT0OPpXr1GTVhunCJR1sEUawSUG016iddroZnVNtgEP4Bs7Pp90uv1+qosZPOk4B4qaYaUS2t1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=IUNK9kzWw5Lp9c3MgYqKzYs3IW3QY94cy1GUfTpPk78=; b=fYQO+N0dW7WGeG6E9iRZXRCZGV/fxuCOELtrFAeycITFbkJeHlc3WD77mfvZeZ6JB3NrCHVGlgbJlSpHLdEHijjQouWxwOk4ALw+5uA+fyCSmnH7N89XF3Qfl+mKillD/lfIGa+a1SyO68ccSXCYg6XwGkfSDm12fP0OFb5zdxg8qet403YSfbJvGY4NEJZQU73aLPr2weaigIC6Q+p+vh9G5vUPO17SBDICBrd0gHD1hiwIAH8eKzGn4VxVVUgVcrad6mlvOYjiIlBnHM65f9ECDrPn+x9x7owvvJTM64Vxx0xASXWEfNE0dkF1d9EkeLSZCTACvlRbafTn/i4F8w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=IUNK9kzWw5Lp9c3MgYqKzYs3IW3QY94cy1GUfTpPk78=; b=z2Y8jZ3uNE1AOEAR3idMXGtOlWDIiUxYikkrmjci/A9GDLC0aSvbFVPR6zFNmNHVNWtI2gr/nzY99X41gGj0sYZUDaLgrN/z3cqMgGZ1hcsBt0mtGrQxvdeQ4jU5h2hoAUbd8yxAit2KBCdeNPLH/+vRbefzNWYOfYbKmrilr6U= Authentication-Results: gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=none action=none header.from=oracle.com; Received: from BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) by BYAPR10MB4101.namprd10.prod.outlook.com (2603:10b6:a03:120::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.31; Wed, 17 Feb 2021 20:28:43 +0000 Received: from BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::1d86:b9d7:c9ef:ba20]) by BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::1d86:b9d7:c9ef:ba20%7]) with mapi id 15.20.3846.042; Wed, 17 Feb 2021 20:28:43 +0000 From: Mike Christie To: bostroesser@gmail.com, mst@redhat.com, stefanha@redhat.com, Chaitanya.Kulkarni@wdc.com, hch@lst.de, loberman@redhat.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org Cc: Mike Christie Subject: [PATCH 11/25] vhost-scsi: Convert to new submission API Date: Wed, 17 Feb 2021 14:27:57 -0600 Message-Id: <20210217202811.5575-12-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210217202811.5575-1-michael.christie@oracle.com> References: <20210217202811.5575-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: CH2PR15CA0001.namprd15.prod.outlook.com (2603:10b6:610:51::11) To BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by CH2PR15CA0001.namprd15.prod.outlook.com (2603:10b6:610:51::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Wed, 17 Feb 2021 20:28:42 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c0cdc0eb-beea-4c41-78b0-08d8d3829e9c X-MS-TrafficTypeDiagnostic: BYAPR10MB4101: 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: qqcW78AZ7qHa6y7DMUHD05t3VdfZMPL17FFUsJnleVE/tj1wKGG/Qy4thcW4dBqK3wLcV/oOboR5Lez3G9TNoGf//zc2TW8J5NubgMqA892VXEGY56VK6SyeBOPboCJDw3yaQVQjc9ToeDU0DyPb4JuXrJW3fIYu5pxWcdB+6qU/GHHfBnV/tIJXyW5XbtGZDeD8k5mfL5ljpGAj55xogES7Jlyf7jO82qoZmHejpHwED8q/9pGvm/mFnNQmZhC0eSzcaAFCarwQL6Q1qxXDARgLdSsylfYiujX1C1/toZd6JYYjCzHxOpzdEngHKXxe8IdozGG8r+ge16FepqIV8gZSDuW8MLiBHm0G1DygIJ52hLfv00SoxtBBBXZ7VVAz8eQqwinAtAZf4d9BSM662z49MMET6hoSK3KvpL9PcBiVwvUGlTve0FmLqQkRyS9jW+DsPwSGS8ryzCLM8l52V+15WuPucFivb3cgVjwy7/LdqwIMywRFYF1qdnPXw4XN0zeuUD/CI9Hvt7tvTydWRUHnjeVsgsQow4stOg+oTz2xlybMIPIepA+B4/HMrY3Nu6iuEXjfxWws0kXfb0iw3Q== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR10MB3573.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(366004)(376002)(39860400002)(396003)(136003)(346002)(1076003)(107886003)(6486002)(26005)(316002)(478600001)(2906002)(186003)(86362001)(6666004)(2616005)(6506007)(52116002)(956004)(36756003)(66946007)(8936002)(6512007)(8676002)(4326008)(66556008)(66476007)(69590400012)(5660300002)(16526019)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: xBfx3F8zAGLHjDoOMH8SFVQchjbBMZZY9ssO3+s9LUiS/QCH6Q+9dgKCskIWy9atOUcs6Fp5czvTcMO2l94N/RfKbTIsbVyxa0Q+znskNQy7vJNZPZAh/gjnOftGGWbdbq2YINidEO6RketD03jjSyZan/I+i7UxogES+x/gv7VoXrlmMb6NNhMxpqCl9TO6tUsaIATSnx/H9gobc6e13T2E5F1VkthpGr/5HDVIQBq5kV2KmW3Oo+AEqQBrKhas6npXJhg/Lm+qT7A4mH+fkBAe3qYochcWwLb3QSi2mxjUlzLXuQWYW6nvj7e0fp42oCUy0YE77znlL/SSwkzwXRL620znfGrTYAj5bRfSiXschIIiOVIhZMm7Wc44jYcAwU3r+uWPb01KYo3Qw4+EsnkGQQzYYDLk4EHv4K8y5wyxvOpTK2qgONzq+JMvagMMnir0CmQnikyd+xyqD3YeNv+Fua9W7GMC72Yg8FqFZG6CsmKV9/6kJ0c+OMRfrnwHqW7kuqUg7XMAOBGOK0MPG912qyYrLhzvTGo6zJtOJmvtex0y4CENPvCPyDXqmp9jlO5D8WyY2zLmdTjKKeo0fo4ADseuyfUJjDGr46o03fG5DGiO+Do3HvLQ+H1q0GXx6jWYVj61kqXOy01QTDbmm3jR0poEqcP232pptL3fohCjnC5ANQ1lntzybh6xxlRNN/we0CABN49TPp8e7eGzJdEDpGk8/nTKpJ5fHdtjPS6JyEcWRpDVB29vMoMi6ewIruV4zgvrv2RqXvdnBkSslWCmp56hhjWiyjbhSJFprXuY5b4aEgxVpU9cemjEcb3QHfNZ5d+cqMBBxtvBoDR9VbKrHsK9YTgRvBkQdc0CkNhlXxavB1IMXXJ2SZG8+MfzKuwvhtQUC70lIy8DNZK/BIpmAG8Pw2SCjI8x/ffkZA2yPHY+wg3v0g7Xdm3YHGJSLU/DYVDvHOszBCMBR5DGlglIvg0yzfBls9x/ATQbArmIt0xWbQrFheFIi96RcaF6UuvMSGY8LteEH3lUf3U/a14dEoVoz5ACUa9bNbycAGDUa1+gY+28iPE1k8qhnsBd43Rk3dq/+WYwMUv2a3Acj1H72xlRcd3OB/m+67M+91//Wii4NdfTearV4tdKhluRKhvuT8/c3J8cMG27ORqzvfEdP1PcYTrueSbxzNj+IR6FT0r9dGNmIA9z6V3pHX7QnBXpWHH9U1GqL+xDdLRziQgyw+BKeaC0wCd0bkto/sg60iW4QbtrlMziZYdPP1JKjF8VNk71aCBEvCf6Ek6s31ffs4TjHkUsfWuu+ygIaRswK//emT6dcBENkoq7zqlX X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: c0cdc0eb-beea-4c41-78b0-08d8d3829e9c X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Feb 2021 20:28:43.7176 (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: 3O0GmS/QDoBGOeX6d78eCqG8tHBFHGmCXi7Va8jcD9Ta/263AgAfIDjy3DAmGLfzipbmaUpRlIugbiNr9eP/1YauBeAhNSL++puR67psvZw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB4101 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 mlxlogscore=999 phishscore=0 adultscore=0 mlxscore=0 suspectscore=0 malwarescore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102170152 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 suspectscore=0 mlxscore=0 phishscore=0 spamscore=0 adultscore=0 clxscore=1015 impostorscore=0 priorityscore=1501 lowpriorityscore=0 malwarescore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102170152 Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org target_submit_cmd_map_sgls is being removed, so convert vhost-scsi to the new submission API. This has it use target_init_cmd/target_submit_prep/target_submit because we need to have lio core map sgls which is now done in target_submit_prep, and in the next patches we will do the target_submit step from the lio workqueue. Note: vhost-scsi never calls target_stop_session so target_submit_cmd_map_sgls never failed (in the new API target_init_cmd handles target_stop_session being called when cmds are being submitted). If it were to have used target_stop_session and got an error, we would have hit a refcount bug like xen and usb, because it does: if (rc < 0) { transport_send_check_condition_and_sense(se_cmd, TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE, 0); transport_generic_free_cmd(se_cmd, 0); } transport_send_check_condition_and_sense calls queue_status which does transport_generic_free_cmd, and then we do an extra transport_generic_free_cmd call above which would have dropped the refcount to -1 and the refcount code would spit out errors. Cc: "Michael S. Tsirkin" Cc: Stefan Hajnoczi Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig --- drivers/vhost/scsi.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c index 4ce9f00ae10e..76508d408bb3 100644 --- a/drivers/vhost/scsi.c +++ b/drivers/vhost/scsi.c @@ -789,7 +789,6 @@ static void vhost_scsi_submission_work(struct work_struct *work) struct vhost_scsi_nexus *tv_nexus; struct se_cmd *se_cmd = &cmd->tvc_se_cmd; struct scatterlist *sg_ptr, *sg_prot_ptr = NULL; - int rc; /* FIXME: BIDI operation */ if (cmd->tvc_sgl_count) { @@ -805,18 +804,17 @@ static void vhost_scsi_submission_work(struct work_struct *work) tv_nexus = cmd->tvc_nexus; se_cmd->tag = 0; - rc = target_submit_cmd_map_sgls(se_cmd, tv_nexus->tvn_se_sess, - cmd->tvc_cdb, &cmd->tvc_sense_buf[0], + target_init_cmd(se_cmd, tv_nexus->tvn_se_sess, &cmd->tvc_sense_buf[0], cmd->tvc_lun, cmd->tvc_exp_data_len, vhost_scsi_to_tcm_attr(cmd->tvc_task_attr), - cmd->tvc_data_direction, TARGET_SCF_ACK_KREF, - sg_ptr, cmd->tvc_sgl_count, NULL, 0, sg_prot_ptr, - cmd->tvc_prot_sgl_count); - if (rc < 0) { - transport_send_check_condition_and_sense(se_cmd, - TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE, 0); - transport_generic_free_cmd(se_cmd, 0); - } + cmd->tvc_data_direction, TARGET_SCF_ACK_KREF); + + if (target_submit_prep(se_cmd, cmd->tvc_cdb, sg_ptr, + cmd->tvc_sgl_count, NULL, 0, sg_prot_ptr, + cmd->tvc_prot_sgl_count)) + return; + + target_submit(se_cmd); } static void From patchwork Wed Feb 17 20:27:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 12092187 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 B924DC433DB for ; Wed, 17 Feb 2021 20:32:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7774964E6C for ; Wed, 17 Feb 2021 20:32:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235086AbhBQUb7 (ORCPT ); Wed, 17 Feb 2021 15:31:59 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:52000 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234846AbhBQU3p (ORCPT ); Wed, 17 Feb 2021 15:29:45 -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 11HKSusL122843; Wed, 17 Feb 2021 20:28: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=fykfHGcyaFRt5NhIis3zRliEuZ4j2G8ziMADvFSZUI4=; b=awzXv+ANh7ITB8tXDzEV98mPACB4Ubg38R0b0/vcyysIbFlHcRCJWJoj+cKm1HEPMwVD 6BbqonIji8fXMbRUzdT+VDgex0sLVG7qKwOGdESXEWJXfr8zolWLDsQKbhXuq42d6Frz hD7VFSUL2A98RTaiaTyUEa4zP3dj6yWi8H3UFriu8UiDO2UtrVkpHQ+vBnpGEi8W2RNn n3NubqlfaA2RTtkItRP3GK9A4taMlvoUGe5aDp99GXUAyOpEJzWpjq/ZPq0/DURR6tLj 7Q57MERo7yof4M6KIj3KupqPt1LV6hVT99LzgNq1GZ8D+MAyJr+0tAwFjVdidwcIvHN8 MQ== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2130.oracle.com with ESMTP id 36p66r3sa2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 Feb 2021 20:28: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 11HKQCc9191586; Wed, 17 Feb 2021 20:28:50 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2172.outbound.protection.outlook.com [104.47.58.172]) by aserp3020.oracle.com with ESMTP id 36prp0p6cr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 Feb 2021 20:28:50 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VF5/OK2zEv1kl6v4Uugtrhg7HOG6hO/zwIQg8wbkxPZMCrdlu/4Dr/+UTamJbGoYYqlWxpONfP8cJhybLLTbxg+QAiczr0mfy6lA66wasfa/N8C6WP/gNjKbzOO4ZoxdQGYSttGX+qwH+3ISoS4EDEYRNQXGNCLoXWcsgwHnHqHTTdAv/hUus0+qIw6ZKW8qk9ddxUI5vpRO04nss3nzOlFklMSiX07j6OSJoDl9oVMvYzY97R9LT4Z5cpKACrHjysdE6fMljlSyItM2KBFp4rpsCvYbRbYo7G+/MPu+YAFSNyypMnMoc35q74Y0BZNAsj1UiPwF44+ipaT3Hih++g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fykfHGcyaFRt5NhIis3zRliEuZ4j2G8ziMADvFSZUI4=; b=MSOTr3Yr+mL0Eogmvfdz1K9dAaXUlSJRfUJy0QoY8Z31roKE14Yr5wutihaJtg6EQ3Q0xz3Eaa5EHOnsaaSWiadmDkvlumKQB2Ojvdk1u4mIHhKEClE+i2dHryNrdR4JOcz4BMaYXuTmWJmoKxtuPwiZdCWNDf/DASlqM8fPqd1XN0NcoTEeLf3DO1cHnQE9jRoxpp5hH7A98Af2LSAqVY5IS/nxANKSvGvRz21UfHKxy5ESpFOEVMfWrEhTSQjAz9UZoxUgWnZpTzXbOVofsOhb3W3tgWdenhai9S6i0qyF6XeCR3HPgTF+cBqgKa7tEjJn2Y7tsVEHnomWGWUw+w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fykfHGcyaFRt5NhIis3zRliEuZ4j2G8ziMADvFSZUI4=; b=0IUGNExD27vybnuCXWz6O+97EgbaKsQUS0eH3uz8nb1btEp5Y7HAlu6sm7oPdJKuXisYgL7vd8lPDWGCw4SyMHhDJdb4vBln9DI2KeZ5K0P+6TNHs0fvP8nOvXeT/8hw+fX8YcjKyH+DoAPDX0spH5T6bgu1NuRwsTDQvMAcZK4= Authentication-Results: gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=none action=none header.from=oracle.com; Received: from BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) by BYAPR10MB4101.namprd10.prod.outlook.com (2603:10b6:a03:120::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.31; Wed, 17 Feb 2021 20:28:45 +0000 Received: from BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::1d86:b9d7:c9ef:ba20]) by BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::1d86:b9d7:c9ef:ba20%7]) with mapi id 15.20.3846.042; Wed, 17 Feb 2021 20:28:45 +0000 From: Mike Christie To: bostroesser@gmail.com, mst@redhat.com, stefanha@redhat.com, Chaitanya.Kulkarni@wdc.com, hch@lst.de, loberman@redhat.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org Cc: Mike Christie Subject: [PATCH 12/25] xen-scsiback: Convert to new submission API Date: Wed, 17 Feb 2021 14:27:58 -0600 Message-Id: <20210217202811.5575-13-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210217202811.5575-1-michael.christie@oracle.com> References: <20210217202811.5575-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: CH2PR15CA0001.namprd15.prod.outlook.com (2603:10b6:610:51::11) To BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by CH2PR15CA0001.namprd15.prod.outlook.com (2603:10b6:610:51::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Wed, 17 Feb 2021 20:28:43 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e980658a-c36d-4b23-e3cb-08d8d3829faf X-MS-TrafficTypeDiagnostic: BYAPR10MB4101: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:415; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8VOrBcypIz3w8xItLRRDd409dJG2EzTgQUBnQcru2Gz2pQvP4SzishaZVbSs5QE1+Xgz0nyCTPt13Ht5/8tXJw4bJKcHjUp/NauASArYz5vRIBwSfeIuOSKXUgVGXoZDH5VSOSGfH7wonhgHH0GMaUKwZCZAXc5NGgwnzBxqqZwMg47FqTEXFjCeqXdeuh/wqa5T1+gwq3AKfWnb8z5SGM/Fe5AkKUK3RxZQ3/36eYb2Ujw//xZsYY815MtOvV/l5hY6PInf3FGLvWmvqsvYqDWGf9PHtkD7n8Zlh60tz3Bkq4B0Z1fqdPjpPCGASn20g3RUT1HyYDw5hxVnc9YOWxw7aHeWvWltt6Cb1+Cb6IeWLg0q5bPC81wOrx35xokRMIw6pSXljZD3oNhyv4yQ6OB0EBxo/Zmm+Rzi98dp7NoVSUXO4K2VQYgViSgz+7h9DgXOBRUvOCfAzMQCCFNJmW8j3jf5EwkKYewzdYXpsMywVId6tqImNisjXJMonqy+HOWUxLPeyNY0s8tXo/M4nFKpeBtZ/7PPItxEKmBm7Y3Bu7+Fg/FrrXkYDOw/PZL+KE3M1V5vZL47dLd10BGgEg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR10MB3573.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(366004)(376002)(39860400002)(396003)(136003)(346002)(1076003)(107886003)(6486002)(26005)(316002)(478600001)(2906002)(186003)(86362001)(6666004)(2616005)(6506007)(52116002)(956004)(36756003)(66946007)(8936002)(6512007)(8676002)(4326008)(66556008)(66476007)(69590400012)(5660300002)(16526019)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: Obm7ek7SYCApre7zf/nsSmQaesaw8OlCa6LUBKCBPhm8uY+cO6mRgEpFtd1gJ8ubJVkftTEN/YtpbeNhE7rB5n7rrLGF/lIWJ6j5UeMKVxcSxhFPU3lu9RMzKVG5hC/5HqP7CDMtKjv6+EvdLueJRxUKLfFyhd/78xokADEVV40432KC1taQyokLYUq2Vg4qg0PpxtysFEu7LBe93cUzEj1qqbJ33RSEWm5ZERBYHswmmpBXk854W9LoCfGAxGe3uYCJm2Kc/FDbxU4qhQd5396A097R6IFi4RXk0FLRSY6lXhUcSt+s8tjPyy4aVYX0osB5Tn+WwxLRhSJphLQx2HgKDxWPGsA2/QS4D9QNtlr+d28fQob74SSg/6t45rwaLRJjcQPXZhLaiMqw/PYtnryjIqkM5mpDtTS1srqtZjKdXVrYRGUfAO0dq7Djd4Z+XJr8PmNmqwkuyrbmmO39wUDi6lQ/0kLBjlBJJstfyUscvMTw/f7jQvfCWfShL16Xy/8A3FG2qHQX5+/4OyOEVWUs7NzfQBRJNcV+Yb77ARgcDcH51UnhRxFEdB64wSTDAtW6PPgMVFNr196mZmtsk7nC6jgncuS+hZdRmAudsNpcbB/pxoppViyCYo5YIN2HK0MJvyJyHemj+12P6JciSWFIJWSDtaqR40j9IGZDMO1DSzeKE9SkihCrBHG7/z7v8IJ+Xe0WJtc3kkaFgcfR0TPKom+Ery2QDikHZ9tt3N52LCXaPi2igHfEObtkO9xt3vz5bI7e6mswoSaZb6QdVQnvJLZFHsaxqP7TVlIqzK09PvdL/1utJ2Bb+eniih+k83pkFCyIw5OAqg8zERe+PeI0gs2B6yaW2w/4IzYrYA3VlN2QyfMOPELbNXmKdQjF8XG0LeRnMas6vy4BjkmUgl7S38ESX7wrQC4jnqMytQUQ73vEt7NNj23/pGMIpBcm7NdpSNUNjkZWVIaQKi+yeNxeL68xHOU7+5IbbtkiBPnksRbwH+ATCmIpPZwXMPV1G8PcHTA2j0S17Hl8Ag/pgQFVtMZpS+L47pm9K+078C5suNvYWifaIExcPZj5bkwZWYqhWrGqzO6KmEG0RCV41cpZhuJ8Zg0g9POXLVSER3s7+Ac7sw7Z0A3mCVa7JaGbHM8KuwNsQuWpju0UzIvtDRFthcxWUXh+T/Z17hzY463YBm/i11c3QI6dx0avDLOcFF6EnAUDzzitHsGyuNBqPdlsD03elj4Bc1bLQevvtZ4iU3Tm9ae+4EieFTMz1dIr8lEOVGHdpaXH1lYfx4cwVldadlEoiIE1Tq9aJ9PvAlAbra1asbpLTkJmXODip2Ef X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: e980658a-c36d-4b23-e3cb-08d8d3829faf X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Feb 2021 20:28:45.4926 (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: GzfLuw1mYP27+UBPlKC9kBmCSXiyiQ7hfq/93OpD4neZrPM4JZGwA+7GqNsaRWG/Hii37hnURsANSnSaylKoH+ByXD4wKzAFbFdXPK3PJfQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB4101 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxlogscore=999 bulkscore=0 suspectscore=0 spamscore=0 malwarescore=0 mlxscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102170152 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 suspectscore=0 impostorscore=0 priorityscore=1501 clxscore=1015 spamscore=0 mlxscore=0 phishscore=0 malwarescore=0 bulkscore=0 adultscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102170153 Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org target_submit_cmd_map_sgls is being removed, so convert xen to the new submission API. This has it use target_init_cmd/target_submit_prep/target_submit because we need to have lio core map sgls which is now done in target_submit_prep. target_init_cmd will never fail for xen because it does it's own sync during session shutdown, so we can remove that code. Note: xen never calls target_stop_session so target_submit_cmd_map_sgls never failed (in the new API target_init_cmd handles target_stop_session being called when cmds are being submitted). If it were to have used target_stop_session and got an error, we would have hit a refcount bug like xen and usb, because it does: if (rc < 0) { transport_send_check_condition_and_sense(se_cmd, TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE, 0); transport_generic_free_cmd(se_cmd, 0); } transport_send_check_condition_and_sense calls queue_status which calls scsiback_cmd_done->target_put_sess_cmd. We do an extra transport_generic_free_cmd call above which would have dropped the refcount to -1 and the refcount code would spit out errors. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig --- drivers/xen/xen-scsiback.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/drivers/xen/xen-scsiback.c b/drivers/xen/xen-scsiback.c index 862162dca33c..7bf9a6bede6d 100644 --- a/drivers/xen/xen-scsiback.c +++ b/drivers/xen/xen-scsiback.c @@ -360,21 +360,18 @@ static void scsiback_cmd_exec(struct vscsibk_pend *pending_req) { struct se_cmd *se_cmd = &pending_req->se_cmd; struct se_session *sess = pending_req->v2p->tpg->tpg_nexus->tvn_se_sess; - int rc; scsiback_get(pending_req->info); se_cmd->tag = pending_req->rqid; - rc = target_submit_cmd_map_sgls(se_cmd, sess, pending_req->cmnd, - pending_req->sense_buffer, pending_req->v2p->lun, - pending_req->data_len, 0, - pending_req->sc_data_direction, TARGET_SCF_ACK_KREF, - pending_req->sgl, pending_req->n_sg, - NULL, 0, NULL, 0); - if (rc < 0) { - transport_send_check_condition_and_sense(se_cmd, - TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE, 0); - transport_generic_free_cmd(se_cmd, 0); - } + target_init_cmd(se_cmd, sess, pending_req->sense_buffer, + pending_req->v2p->lun, pending_req->data_len, 0, + pending_req->sc_data_direction, TARGET_SCF_ACK_KREF); + + if (target_submit_prep(se_cmd, pending_req->cmnd, pending_req->sgl, + pending_req->n_sg, NULL, 0, NULL, 0)) + return; + + target_submit(se_cmd); } static int scsiback_gnttab_data_map_batch(struct gnttab_map_grant_ref *map, From patchwork Wed Feb 17 20:27:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 12092197 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 3E1B2C4332D for ; Wed, 17 Feb 2021 20:33:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 15A4264E6F for ; Wed, 17 Feb 2021 20:33:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234350AbhBQUd1 (ORCPT ); Wed, 17 Feb 2021 15:33:27 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:42134 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235070AbhBQUbk (ORCPT ); Wed, 17 Feb 2021 15:31:40 -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 11HKOdqK147616; Wed, 17 Feb 2021 20:28:52 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=1frQuRMui0cZxPjQIOFd5O6A6GKjiwmO7Nx2OJyie0k=; b=lWAqmefPxoHVO+eyUSxkFGoEVJIwmHv1D5NKuHU+KLIL6QOM8CwGpC95W3fQyr+jZDUt xgpA23GTTdSf9EYT0CQGkk29KUIYJTnFXKOTzs9V5g3UiuAWXMuI7sIEiDrHNW6+BNMo LIxvjGcSiL5FOfcyMe5sltdTV2bd/7tXYqGhThPmnzRrMuq3ObFCyuiNGvcHI8boB7bn +xovBD1fp4CnxOEhBGgwttGx8Qqnt3KdcD9+etEz7DXn9ER90C2jY+1+8VjIQgXYbMTj EKpkmpINa5CeWcYotCIpuwfa8f6ukBmfPyHshW4ztKKnIBpPktr7wgzohHvrRIGThLbE Ig== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2120.oracle.com with ESMTP id 36p7dnkpk0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 Feb 2021 20:28:51 +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 11HKQCcA191586; Wed, 17 Feb 2021 20:28:51 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2172.outbound.protection.outlook.com [104.47.58.172]) by aserp3020.oracle.com with ESMTP id 36prp0p6cr-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 Feb 2021 20:28:50 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NswLavDKnr5jD20amtxxYfNysRc3f1GJ+cp6R0hPSuHUgb+i2TREq5v3od16xeXbdjySmZaBZXcEPcSo/VE9yUC1vcKelvFwYOl7AwW2Y7h88aMA74JNQX6APJ9w28U6cud6iLrr7F9kpyYnAH1ZCmwmJ7Skkp6p5RB1S3BAJYomArZ9YspLXlGy6niW7ZKxllpQc9OLjdjxNa0tGAjwVrEXIwh3fdJ0h1R8MAVX+DI32Q6sBAyqJOM95r9kMBAQaTh41uTvqnTtRUvAnZY8uhXgMEInckyCrFdd62NGnkpZu5gTvZxL/Aj3up9OrQthvJF3PELSjti5UDSR9SN6Jw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1frQuRMui0cZxPjQIOFd5O6A6GKjiwmO7Nx2OJyie0k=; b=Ml/mg4r3Cl0WMg+VywUBmpEERv9+6uoCVIQ9WcCp7MUvvK4KEOW7em422+n9kNIfF+DfsOftL9U3UFpnKwH0NBynP6/1ZDnmDgwPRCSVKiU2dfeD0icBpGlO3oBMsDDn6ryZHN3tD19zKusL1D4qc/1N8VV71DHI0HqbUJ6WGYJYIKNZ/1OjfmYW9lZu/DrUaXiHnI/WX6pQDVPMxd77pW6zgOcvVfx227GoUdKOJyL7VipmpvKd0zPlpn7kVyBAsarOI+VNY1nGAwRHo31viItsEVppoXjh96hmk8FOq+nHj1u2oCbfbO4XL1OASSBWMHh9sYsvWar23WYpm5pV3Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1frQuRMui0cZxPjQIOFd5O6A6GKjiwmO7Nx2OJyie0k=; b=fzDRqOjk88e86CyEQ0UL0lJMerGKRQWqC62o6ZeHC0tGaVywGvZfaqt1s9nTPWXNAeGyIzLhM0yxDxhtR/fm8O4DuGuFJKyKp84k2vP2j9CaRI4DGmGEJ6FoUjdFdpAqziGG7cmZKo8TClVbS6Pqk05Y8SaPDsuyjvg74Pdn+xc= Authentication-Results: gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=none action=none header.from=oracle.com; Received: from BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) by BYAPR10MB4101.namprd10.prod.outlook.com (2603:10b6:a03:120::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.31; Wed, 17 Feb 2021 20:28:48 +0000 Received: from BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::1d86:b9d7:c9ef:ba20]) by BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::1d86:b9d7:c9ef:ba20%7]) with mapi id 15.20.3846.042; Wed, 17 Feb 2021 20:28:47 +0000 From: Mike Christie To: bostroesser@gmail.com, mst@redhat.com, stefanha@redhat.com, Chaitanya.Kulkarni@wdc.com, hch@lst.de, loberman@redhat.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org Cc: Mike Christie Subject: [PATCH 13/25] tcm_fc: Convert to new submission API Date: Wed, 17 Feb 2021 14:27:59 -0600 Message-Id: <20210217202811.5575-14-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210217202811.5575-1-michael.christie@oracle.com> References: <20210217202811.5575-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: CH2PR15CA0001.namprd15.prod.outlook.com (2603:10b6:610:51::11) To BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by CH2PR15CA0001.namprd15.prod.outlook.com (2603:10b6:610:51::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Wed, 17 Feb 2021 20:28:45 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: edcbab2e-3bc1-4aa4-7691-08d8d382a0ba X-MS-TrafficTypeDiagnostic: BYAPR10MB4101: 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: WsyIN2KK0rsAYx1d/jJ2TVvtffhnmKEsQaElC7WSq1GjVltIvJF2XWAIGaOKPgu7CqCAN/da53hCMAVmmYgfkDrPduauXF6etCm4ZSJyOn37K8J+JdlTB0yvyqtPxXzyhuDd/BbnYGuiIwML1YiXPVoCZ73kUYzBidrKnulzGYUoXhzrFPz5OGyOY24oXQfME9SpCjZ8oDCvILn+WyLtmBeGoeTTPzQ8eEOmam18e6SrRJAcnLSIYWSTCDq03HOrQbxTbdCOi6ACJSVI7dsJMDRDRwjqWrK1EW6JooRGYafcV/6qS7WgCPiUUaYG7Jp+/MMzCXBJQY9GVqBS42zouD5nYBR7ywsg3+WDr8+V9Di3iVXq0nT/fQ9V50iUUIR96TRcQX9QZesgUkVW37u706kHWi1XsmqVZOCwZkyXi/ucIESyuRwMDr7rqHpF/4e2PMH0E+BKy9N9JMtaZK2MmP6E7rmrD4m+rO4HzMx6JtFTKQY9wJHUIpARtgTjXrtD1fubMimT/y5T6udT0Efp0PVrFapS3x+HFN026PXvP8gBb6yeMXGWof1dgnpqyGoUUi1z2qt8cwJUu6He64ts8A== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR10MB3573.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(366004)(376002)(39860400002)(396003)(136003)(346002)(1076003)(107886003)(6486002)(26005)(316002)(478600001)(2906002)(186003)(86362001)(6666004)(2616005)(6506007)(52116002)(956004)(36756003)(66946007)(8936002)(6512007)(8676002)(4326008)(66556008)(66476007)(69590400012)(5660300002)(16526019)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: JvB6dYjtQBZsjdnaZ25xBHd2kAsEZeV5Nx7NBCR7vYBDRtNnZ2R1/MPPlQxFGL2ZMpFCD0KLP1FqXImt4QxHuLMQ+4Iq+vQKn4hBvWGbYKnTznPM8+MJQTb33kA6iGRRU+TnOjUIhlXoio2NzGKK7ULoRd7Com36m3It3Fl+ZNRpjdZ9LFNl52h5jk2tLPeHOVOS2DQMza3vLnyZuvUWAN87bUuViFQTO/SaggkMmv2mBT6LWHPesSWOEbvrPEfeDMzKfMDP6X/P++5afmUEKKztR7ncDyn5blyLW6mu2uIr2z90hwdcvVQ4y9hb6ucB3CvLquofLzeu4BYZjnf76m9fgSt4qgAy9F/4osRfzmskInXrvTxBXiMXrZ36HPLVnuZ2yXWkFZUCWCuV0IhoCIzdtH31kB1jRSSmoU1rBINweHaiFRP+O+2qYBkXhEDCjR7UwDK1rJuzgzsd5dAa+vPzLk/0bRmjpXQQMmWYjPmKHHFkDC2TeHPM1504WlXzcFm22nhOQmFragvUSFRKCXjpxEuTGyZ1fTRxQoZ/jqfJWnYJiPszRBKyLipcSUkb14rUqEh2vSCWfC63E5RpzcmA91YWnqkbyglUMHCcqBNcMhzV2uoSq33BA/QW4WdeIEuOMtc5ux7e85rOB5P9O9votZWhcO9eKiWUbh1GR5WCPmYi8PdeLTYCQIxzolIyKMrG+CtrTrECskH/5t3D24/qZIU5qs2XscCSuhwB1rIPMGpk4cAVv2fH++u1OzU3uNn/hpd5XXl6n0yX1BsgYv63HIGwtCS72jWYPO4IGp/28CMgQ8wwGgKSWpBPO+CaEnjAX0/LY82D/AejiQi048ad9Wupv9vJ9LpmvqhBGG1m10b8Ou03gW26y/Cy3z0s2gGBST/CX1PS7mtIP6aWc3MR6IesI2ZzANe84POnIuJpzR2RniYSJHejNzNDKIdpUsPUKXRvU1ztOHVDVBmg6+sbiK1RtYqPhiQy09mP36i+C1qoVZPnuSPZkRTgXzFenwBwyviNLLEAMoJ2OGSwGhNppZf8WL/50gQz4JJJ9oUME6kNGNYrGtJU1kfcGllbaff+ur4sd9JlTj1ZfNIDv2WneEp+xL9ghIje+Z9GooH8/fFXOnJf4i9qYICauaIv459clvYgz9DOVQmLpoPu9SkHTENI61UWvUv7tH9fKtY5A/wx7cN21hBaDOruW5oN2DRxgOqIerwWRy3Z0f2ycn6WFPGbku8MmD1qhmGo9T8kXqcVSzmJzG178QUCtY5HxYS4r0GkxGtYkwxNwqTQ47eAUxVAfXJFvfBxxZ+q09S0I+2CoswFt96XwZUp8Opi X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: edcbab2e-3bc1-4aa4-7691-08d8d382a0ba X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Feb 2021 20:28:47.1447 (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: IxYjW4xlbhjZFi4T0gRRHgtf0qKAnLlHIRQqE7mbMxJE/wgDQG4pEZ7/7/py6A6GssBfFs3FvgJxsXY4ISi/uX7t/Ps+pCeGGF6wyXRoic4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB4101 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxlogscore=999 bulkscore=0 suspectscore=0 spamscore=0 malwarescore=0 mlxscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102170152 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 suspectscore=0 mlxscore=0 phishscore=0 spamscore=0 adultscore=0 clxscore=1015 impostorscore=0 priorityscore=1501 lowpriorityscore=0 malwarescore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102170152 Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org target_submit_cmd is now only for simple drivers that do their own sync during shutdown and do not use target_stop_session, tcm_fc uses target_stop_session to sync session shutdown with lio core, so we use target_init_cmd/target_submit_prep/target_submit, because target_init_cmd will now detect the target_stop_session call and return an error. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig --- drivers/target/tcm_fc/tfc_cmd.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/target/tcm_fc/tfc_cmd.c b/drivers/target/tcm_fc/tfc_cmd.c index 768f250680d9..1376501ee3d0 100644 --- a/drivers/target/tcm_fc/tfc_cmd.c +++ b/drivers/target/tcm_fc/tfc_cmd.c @@ -543,16 +543,22 @@ static void ft_send_work(struct work_struct *work) fc_seq_set_resp(cmd->seq, ft_recv_seq, cmd); cmd->se_cmd.tag = fc_seq_exch(cmd->seq)->rxid; + /* * Use a single se_cmd->cmd_kref as we expect to release se_cmd * directly from ft_check_stop_free callback in response path. */ - if (target_submit_cmd(&cmd->se_cmd, cmd->sess->se_sess, fcp->fc_cdb, - &cmd->ft_sense_buffer[0], scsilun_to_int(&fcp->fc_lun), - ntohl(fcp->fc_dl), task_attr, data_dir, - TARGET_SCF_ACK_KREF)) + if (target_init_cmd(&cmd->se_cmd, cmd->sess->se_sess, + &cmd->ft_sense_buffer[0], + scsilun_to_int(&fcp->fc_lun), ntohl(fcp->fc_dl), + task_attr, data_dir, TARGET_SCF_ACK_KREF)) goto err; + if (target_submit_prep(&cmd->se_cmd, fcp->fc_cdb, NULL, 0, NULL, 0, + NULL, 0)) + return; + + target_submit(&cmd->se_cmd); pr_debug("r_ctl %x target_submit_cmd %p\n", fh->fh_r_ctl, cmd); return; From patchwork Wed Feb 17 20:28:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 12092195 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 DF926C433E9 for ; Wed, 17 Feb 2021 20:33:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B708964DEC for ; Wed, 17 Feb 2021 20:33:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231879AbhBQUdX (ORCPT ); Wed, 17 Feb 2021 15:33:23 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:45076 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234408AbhBQUbh (ORCPT ); Wed, 17 Feb 2021 15:31:37 -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 11HKOEIE190344; Wed, 17 Feb 2021 20:28:52 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=2f5zpFFRFQNuRa7UaHt8wS2qH8PVV0E4Gv6yWX31Xho=; b=sgcsTVZfmu+VtgwVIIooR+KoT3a3Gvb9uEa9jttha+le4P03WYj1T/t3elYZJRkRJqXh TSCNufezBCeI2aOTpKCH/qrkUxnc/QhWeP8CWxl9LGXdxl+tCOlRG0eqNM0dLEv8ZM6g OBJR/RPty0RyHEjVRNi3TQKb5CMS76edzLYcrNFSIn2glFMTQ+Nuz1wd4e6ZNIz6E0U3 ftEmLgigm5jD83+VtsFpwjy6SWVj60mjWAT7HHlIeQcCavjCBENp4dYk9jgNUH0DHvNi lAada+TiAYtAu3lV5ducZDZQnz6GaiLvdfeac04dQnAqzybbWICUkmw5A5EkDU6PNH1d IA== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by aserp2120.oracle.com with ESMTP id 36pd9ab8hk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 Feb 2021 20:28:52 +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 11HKQCcB191586; Wed, 17 Feb 2021 20:28:51 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2172.outbound.protection.outlook.com [104.47.58.172]) by aserp3020.oracle.com with ESMTP id 36prp0p6cr-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 Feb 2021 20:28:51 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HpQnY3gxdcww5fsm6c7hMPNjDR5ZZOrkqEQqUnIxO15UxQ78dLvR6SG9/xWu1LsArluRDCkdcui90F381nwJ1I7cKDawFQBTFE4udBf1zQ6XpAam68kMJcRenAps3hnuCTrgNCUR8s0YP3XpmI3BvhylC1EY95zJeg9n8TjPvVj+1YBHuwUNQDs0icYTux4ruX2aqTNDguXfT5xlfxto7G0nqvCtr0vAVLGipDVqjoFMWRqOi8+03f0wf+whEBQtlVLWlDiNIomBBq8JjE1CKRtstVZn/8hy4ykAYcSB0NpCQOLxDwA1FjNmLNxDRaEZJehgal9Vew3jQzwjqXk6QA== 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=2f5zpFFRFQNuRa7UaHt8wS2qH8PVV0E4Gv6yWX31Xho=; b=HFUyUOoEMpdBr3EiuugjzGs3hnKtN7NW4+W54sAM0tVlYlUKv41er08f1WAlWxaDaMnttBo2XEahSJHjfz5k26N5cp48x4PcbRkKoJdIgzrcpILg+SU2P5VWf8ayXWr8zgb8A3V904bSEdIRA7JS4gJo4F0GPkW3hxVHj+K2YC6gYZZjw7XKw5LG9XFrndhmoo5wg5gSFa7e1uLmC2dI/fW7Nr9HNbPd1STnNxIFmpkz+DanZGeKvvPNvMaUhqbY+w6tzgU/Qz1YhlB8IpUKuVDJgjhKx2j0zYQZ0xE8mLpagt4B6zKHTKfl2jPsACzAxQ2pfqUjXcAeA0eTWVdvAA== 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=2f5zpFFRFQNuRa7UaHt8wS2qH8PVV0E4Gv6yWX31Xho=; b=tJvMec07YpxfBTqAvkyU5P+ZP5RzUqaQH/D87FjjW1kJ1lJrfi6lMrsv1rk5J0n99MKRQ+ZCVhNJOzHxCB5WO7wMCRqYy1CmYB715IxXbI14rlgyOphJCpCUV9KBYOwfzIZJOto9Qi7mGbWJ9asW7DomKE5YnYErEbiciCwhhfk= Authentication-Results: gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=none action=none header.from=oracle.com; Received: from BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) by BYAPR10MB4101.namprd10.prod.outlook.com (2603:10b6:a03:120::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.31; Wed, 17 Feb 2021 20:28:49 +0000 Received: from BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::1d86:b9d7:c9ef:ba20]) by BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::1d86:b9d7:c9ef:ba20%7]) with mapi id 15.20.3846.042; Wed, 17 Feb 2021 20:28:49 +0000 From: Mike Christie To: bostroesser@gmail.com, mst@redhat.com, stefanha@redhat.com, Chaitanya.Kulkarni@wdc.com, hch@lst.de, loberman@redhat.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org Cc: Mike Christie Subject: [PATCH 14/25] target: remove target_submit_cmd_map_sgls Date: Wed, 17 Feb 2021 14:28:00 -0600 Message-Id: <20210217202811.5575-15-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210217202811.5575-1-michael.christie@oracle.com> References: <20210217202811.5575-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: CH2PR15CA0001.namprd15.prod.outlook.com (2603:10b6:610:51::11) To BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by CH2PR15CA0001.namprd15.prod.outlook.com (2603:10b6:610:51::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Wed, 17 Feb 2021 20:28:47 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a125b09c-782f-4ceb-6e5c-08d8d382a1b2 X-MS-TrafficTypeDiagnostic: BYAPR10MB4101: 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: 18cHG/8uLxAdzd+2sc5Uz0c6LmwMF8h+IR4DjYi8+NKrctvOmVWBolokGo/eKQp4l4/1z4A71nXCOpR6CnVaws8MkAKLte6Z3pew9nx1EL+sT4ouXZhXBZtN1oqpQCIv3XV6OEI+ozboEN2UDS5YlGX0UXn+OhF977qKCc7mMdYMw/UfO6pFC+azR11V9t0eA+KkhYH0cso/cYOgZ6Q8ZjDohr06FySOFWNc5QavWcNIIynXHkK8ARv+LZwNoAir6QMQY+489UgrmjcPXFkd72InQHk0KEtxAuJ4mum17MudYLNjhdLUektHTsPO7gQ/0X2b5lpB0C6bSjzWH2k934aqR5I7FCOxG1agc6C/L+QNI+T1TmJFXPzUasSI1qtKw1kG4yJysqdeTX/s1MxCXBH68cWlPmFk6qmNv37ZYzNb5GmMONl6xNXZrBW1oIDtXgrFBaOXkBnPHb/Jyg1C4YP7yYHJxT32nI3hWEkceo/nQIAN9StDVSG4r5xLICdOrCSpYk32eOUWEzmnrGV8F0b1+45cGVuN+dPkDEmuvAWCHkR9vJRVng/C8v1MrlgHAFn5Mr3w22wrzv1++Xb3rA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR10MB3573.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(366004)(376002)(39860400002)(396003)(136003)(346002)(1076003)(107886003)(6486002)(26005)(316002)(478600001)(2906002)(186003)(86362001)(6666004)(2616005)(6506007)(52116002)(956004)(36756003)(66946007)(8936002)(6512007)(8676002)(4326008)(66556008)(66476007)(69590400012)(5660300002)(16526019)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: c+D96yDE7f+IxNF71QuvleFt8WjotZY9glfHI4UV6o+p6M0INOZDIF5iy8doFxHhAhIUzqbEwVQGgpKhRBOhhch8aasPqsUDeR9cQ4L9ZjH+B9MQZTGaPzxvOSrSY0qfDFJtZkEvb7XnJDMMK1AUUaPmeKZTSaNWpj590AV/ukmGm0m6300GPIdcW52ZVKrpex8nV7TnPEpV7qijyx38Lw1BdRDEj7j/6KLWgZ0eipGdBQmbM922Lo0YJoQd9VXrgjZA0W0G2rysTsBwxTWwFCtq7UmPhzEb76UtzJXGDYlbGzvT4Lyq4vKYM4DficJyC7E99tlwuNumgL5y71CZsbH7scZyG4jZ67iRvmwnFNnr0iGIyuxpkuAmIp4BnuMlS0aAFWra45lqoe34TOaMpb/+2fFkq6S6TqlQ1MJlvUihCIgjN82CdyU5+M3ejsIzUO/VfObOLCFiHFgu4ZXOvauyC2pHsD2suD5N8OZGCWjRPNHFd0TFYL6PgkpvaVSBQ0OPemGkxqAMaPYOJDsqXZWacBBow46wiWiDcgAQerlWyVB6KseOrNnVn7gqwv9akhPetIVxS4+IrizaMpBHmA9WCkHcP7yx7engGoUf6S/iPqxUIzdBY8goHRbBgjWgSsmbBE5BQ+Rznh96Fy4LjkpUUi4fDqxckp2z0jlretBK1Pnt4z5a9QPJptExajX3eBTWr3oLsHkxm/Wy3K1BNEtAXufz52hr1dIFvsQ1qBJuCv6TztcV0A/Wpg+zivNgjHe2Yy1jQ1iVntwTPL2oZouLREP/QGWL0eKh89knZasSV2JPCxYwfk5e2xPD9nSy804tC1Z8NmSDRZxh94LT9n+U+QzRwn6sD+/e/MkyiC1WFB9qfj03YlBNls71vb35NrXEdl5JRDNzF/qWeuIB2wa7gxl5v78p+w4jxBqDw3Kz5nU0sMO1YbmrLj7/xXaGWLVStj2lK0tcJQng79wMKulyUZjmsMc/uR9jVhcExfaETTzIh46DhkKCwA2rypRF2OiFD8EuNlBnzhwkIicKxHrLSyijn7F4ZQFbmeHouUV6mk89nPiTYODClVAcFcUmrv4DcPPmdg11TRH8qtyJEjkiSW3DURwV+DiEaUagnIuDlUjzZMSYIwHjsxQa1yB5xOmoY9wxjBKDhPPhbEcS81PcRJ6uW2h6Yev+ZOSvYNivjTwBsAIUbOoP+cYfcaJ3bSB9FjTLr0GD4Uc9oriMqSFOLVOcaDJiKdvAAMQgyvpcXM3EDALSy7Uc341pg69jgb1nHkPLsXkZdC24mXxU4W5VBq50WWrIfSCCHtNuOvTGawL6wl87Ub/z83/DCZ5W X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: a125b09c-782f-4ceb-6e5c-08d8d382a1b2 X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Feb 2021 20:28:48.7468 (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: bHA01RW8XjRKQbw5ev/qkZdLHX9ACsaPc/YXlxmOGj5l8hrvusHXyuRPU/2HMQJWeR+DiJZO3VzRkjMLDM1gyfRShG5rwNMrP3v5EzpQvKc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB4101 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxlogscore=999 bulkscore=0 suspectscore=0 spamscore=0 malwarescore=0 mlxscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102170152 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 clxscore=1015 impostorscore=0 mlxscore=0 phishscore=0 mlxlogscore=999 spamscore=0 bulkscore=0 priorityscore=1501 malwarescore=0 suspectscore=0 adultscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102170152 Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org Convert target_submit_cmd to do its own calls and then remove target_submit_cmd_map_sgls since no one uses it. Signed-off-by: Mike Christie Tested-by: Laurence Oberman Reviewed-by: Bodo Stroesser --- drivers/target/target_core_transport.c | 76 ++++++-------------------- include/target/target_core_fabric.h | 6 +- 2 files changed, 18 insertions(+), 64 deletions(-) diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index 8b2b805316dc..1f35cce6e92b 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@ -1752,8 +1752,7 @@ void target_submit(struct se_cmd *se_cmd) EXPORT_SYMBOL_GPL(target_submit); /** - * target_submit_cmd_map_sgls - lookup unpacked lun and submit uninitialized - * se_cmd + use pre-allocated SGL memory. + * target_submit_cmd - lookup unpacked lun and submit uninitialized se_cmd * * @se_cmd: command descriptor to submit * @se_sess: associated se_sess for endpoint @@ -1764,76 +1763,35 @@ EXPORT_SYMBOL_GPL(target_submit); * @task_attr: SAM task attribute * @data_dir: DMA data direction * @flags: flags for command submission from target_sc_flags_tables - * @sgl: struct scatterlist memory for unidirectional mapping - * @sgl_count: scatterlist count for unidirectional mapping - * @sgl_bidi: struct scatterlist memory for bidirectional READ mapping - * @sgl_bidi_count: scatterlist count for bidirectional READ mapping - * @sgl_prot: struct scatterlist memory protection information - * @sgl_prot_count: scatterlist count for protection information * * Task tags are supported if the caller has set @se_cmd->tag. * - * Returns non zero to signal active I/O shutdown failure. All other - * setup exceptions will be returned as a SCSI CHECK_CONDITION response, - * but still return zero here. - * * This may only be called from process context, and also currently * assumes internal allocation of fabric payload buffer by target-core. + * + * It also assumes interal target core SGL memory allocation. + * + * This function must only be used by drivers that do their own + * sync during shutdown and does not use target_stop_session. If there + * is a failure this function will call into the fabric driver's + * queue_status with a CHECK_CONDITION. */ -int target_submit_cmd_map_sgls(struct se_cmd *se_cmd, struct se_session *se_sess, +void target_submit_cmd(struct se_cmd *se_cmd, struct se_session *se_sess, unsigned char *cdb, unsigned char *sense, u64 unpacked_lun, - u32 data_length, int task_attr, int data_dir, int flags, - struct scatterlist *sgl, u32 sgl_count, - struct scatterlist *sgl_bidi, u32 sgl_bidi_count, - struct scatterlist *sgl_prot, u32 sgl_prot_count) + u32 data_length, int task_attr, int data_dir, int flags) { int rc; - rc = target_init_cmd(se_cmd, se_sess, sense, unpacked_lun, - data_length, task_attr, data_dir, flags); - if (rc < 0) - return rc; + rc = target_init_cmd(se_cmd, se_sess, sense, unpacked_lun, data_length, + task_attr, data_dir, flags); + WARN(rc, "Invalid target_submit_cmd use. Driver must not use target_stop_session or call target_init_cmd directly.\n"); + if (rc) + return; - if (target_submit_prep(se_cmd, cdb, sgl, sgl_count, sgl_bidi, - sgl_bidi_count, sgl_prot, sgl_prot_count)) - return 0; + if (target_submit_prep(se_cmd, cdb, NULL, 0, NULL, 0, NULL, 0)) + return; target_submit(se_cmd); - return 0; -} -EXPORT_SYMBOL(target_submit_cmd_map_sgls); - -/** - * target_submit_cmd - lookup unpacked lun and submit uninitialized se_cmd - * - * @se_cmd: command descriptor to submit - * @se_sess: associated se_sess for endpoint - * @cdb: pointer to SCSI CDB - * @sense: pointer to SCSI sense buffer - * @unpacked_lun: unpacked LUN to reference for struct se_lun - * @data_length: fabric expected data transfer length - * @task_attr: SAM task attribute - * @data_dir: DMA data direction - * @flags: flags for command submission from target_sc_flags_tables - * - * Task tags are supported if the caller has set @se_cmd->tag. - * - * Returns non zero to signal active I/O shutdown failure. All other - * setup exceptions will be returned as a SCSI CHECK_CONDITION response, - * but still return zero here. - * - * This may only be called from process context, and also currently - * assumes internal allocation of fabric payload buffer by target-core. - * - * It also assumes interal target core SGL memory allocation. - */ -int target_submit_cmd(struct se_cmd *se_cmd, struct se_session *se_sess, - unsigned char *cdb, unsigned char *sense, u64 unpacked_lun, - u32 data_length, int task_attr, int data_dir, int flags) -{ - return target_submit_cmd_map_sgls(se_cmd, se_sess, cdb, sense, - unpacked_lun, data_length, task_attr, data_dir, - flags, NULL, 0, NULL, 0, NULL, 0); } EXPORT_SYMBOL(target_submit_cmd); diff --git a/include/target/target_core_fabric.h b/include/target/target_core_fabric.h index 4b5f6687393a..86b0d4a7df92 100644 --- a/include/target/target_core_fabric.h +++ b/include/target/target_core_fabric.h @@ -162,11 +162,7 @@ void target_submit(struct se_cmd *se_cmd); sense_reason_t transport_lookup_cmd_lun(struct se_cmd *); sense_reason_t target_cmd_init_cdb(struct se_cmd *, unsigned char *); sense_reason_t target_cmd_parse_cdb(struct se_cmd *); -int target_submit_cmd_map_sgls(struct se_cmd *, struct se_session *, - unsigned char *, unsigned char *, u64, u32, int, int, int, - struct scatterlist *, u32, struct scatterlist *, u32, - struct scatterlist *, u32); -int target_submit_cmd(struct se_cmd *, struct se_session *, unsigned char *, +void target_submit_cmd(struct se_cmd *, struct se_session *, unsigned char *, unsigned char *, u64, u32, int, int, int); int target_submit_tmr(struct se_cmd *se_cmd, struct se_session *se_sess, unsigned char *sense, u64 unpacked_lun, From patchwork Wed Feb 17 20:28:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 12092199 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 6B1D2C433E0 for ; Wed, 17 Feb 2021 20:33:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 30CD864DEC for ; Wed, 17 Feb 2021 20:33:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234399AbhBQUd3 (ORCPT ); Wed, 17 Feb 2021 15:33:29 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:45128 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235071AbhBQUbm (ORCPT ); Wed, 17 Feb 2021 15:31:42 -0500 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11HKNeiW190135; Wed, 17 Feb 2021 20:28:52 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=pwXrh1RPob0q+fmPho3+wxeIiNLR1yLsz0TahiOMY10=; b=ulFRFHVE6XmDdL0HMsNQAaSrAIB9nj4JYWwhE/FKUjXy4oQ1YroSDY2Es3gvujqx1JGP WLxcT5U/fZ3KlXCwxuuNyarv5deyCrwk8jtnLHEWP+qOw+jt9TRPGqppV893X1sKKdn5 uuJ3s0P/uc4sH+wUyMJPRVJI3pOMIYiwndqQ+lg9w6zD+FIz9iE/tuk9rXcGZjDRTkX6 RdvpTtdAzGdYeZKk6Z/574sxQE5PEiBjhh02yzACkBWoUGBuvsNCiAwqYCBCOcM9FMqZ kr9KmbXne66H6K4vMvH84bphmL3htPXewhRvv7vmF7l0w3OOnRbt7OI5JIsTp5S0u7+q sQ== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by aserp2120.oracle.com with ESMTP id 36pd9ab8hn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 Feb 2021 20:28:52 +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 11HKQCcC191586; Wed, 17 Feb 2021 20:28:52 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2172.outbound.protection.outlook.com [104.47.58.172]) by aserp3020.oracle.com with ESMTP id 36prp0p6cr-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 Feb 2021 20:28:52 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KAjKS3eulema8IQ5TELMI9ypAUOkNnT7rKxFVmF6bNQals18BROOCefYDiZPpjW6iGCl0HAZTpeDARsnhXx/mqYXknFiT8xhkaJn9lyiMQygR8CUZjjT6Ly1vTUk+Gp0qh2Wwuql2nqAuSx7vZePIPLCCnyRA0Cc1AjCgy397S2pBCossibvSmWNn5AMrmChRO1VW1iXHCiX+fb1qXMJSWIsb8pM6ee63my946/0VeyDQFHnpw6J1nhJFgm+/1hKdL+co46W5vjnVhz046j+Yaegw+MtB5iR5bmsjgrIhBmVJSLupprvHtxTeU5fpW9A2ZX94d9RhBpX9zDeGcUT0A== 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=pwXrh1RPob0q+fmPho3+wxeIiNLR1yLsz0TahiOMY10=; b=Sxzd24dCdikibs/q1LBMtbBzsaumrwmRfwzJpb/pvP4Gm4ePQ8ENexdVn7hmCbhSSelCvFD6qWG6a3KkIpF+EVvJedCTrDCHiHg2D5myXQ0ZaSUa+AQcd1Jc/iOgFAaIzl08/3rLekQksk2572mxqqq26n5SFz8xQ1eTAO5xhg0O6KxJvpzO0i6OzDhhTGdUexyHNGsEpyQsmOg8miHudvvyHk8ci8VXNP8l+EyaQfJdi4aoPM+h5wbgePCo0O78M1CsAgRkuvbDv3uJjI+I6ZI8Ri9hiuOtUHlTjwjyYLwaYkUzI1K8/PDEns8NEy/u1XRNEM8RggHxPdSBDXoy8w== 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=pwXrh1RPob0q+fmPho3+wxeIiNLR1yLsz0TahiOMY10=; b=SAyaTysgBDgQaDJ4e3ha0dub2iwfOkPaFyle+6XqUDe06Pin92dtixOh/RiN0D1yPjkMu7S0AWrzzzPbqWfJfY0UvyF9z/3H6J/+NBo2p4L7ql0p1RSjnp5RKkNuB0ZXcXoFX6iSA7nZOMIjWZLAKrfz1SQo/oMfc+Iy1ucSu0Y= Authentication-Results: gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=none action=none header.from=oracle.com; Received: from BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) by BYAPR10MB4101.namprd10.prod.outlook.com (2603:10b6:a03:120::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.31; Wed, 17 Feb 2021 20:28:50 +0000 Received: from BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::1d86:b9d7:c9ef:ba20]) by BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::1d86:b9d7:c9ef:ba20%7]) with mapi id 15.20.3846.042; Wed, 17 Feb 2021 20:28:50 +0000 From: Mike Christie To: bostroesser@gmail.com, mst@redhat.com, stefanha@redhat.com, Chaitanya.Kulkarni@wdc.com, hch@lst.de, loberman@redhat.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org Cc: Mike Christie Subject: [PATCH 15/25] target: add gfp_t arg to target_cmd_init_cdb Date: Wed, 17 Feb 2021 14:28:01 -0600 Message-Id: <20210217202811.5575-16-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210217202811.5575-1-michael.christie@oracle.com> References: <20210217202811.5575-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: CH2PR15CA0001.namprd15.prod.outlook.com (2603:10b6:610:51::11) To BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by CH2PR15CA0001.namprd15.prod.outlook.com (2603:10b6:610:51::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Wed, 17 Feb 2021 20:28:49 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 83e325f9-06ab-4d8e-4987-08d8d382a2d1 X-MS-TrafficTypeDiagnostic: BYAPR10MB4101: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3513; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: QrTxnxBpB2vkpJLkr7/XTCpYDMphAIuiKpItFU548yXaj14qC1evdbD5VGj2YNxKd2b1VrYn85lsYi1oEjqj+dQhWVAGo/OIjvjj8kFnTa/ao37/oDRJqhcXHq3mDSU2D6RSls9VwOaD4Afh0TINd1FpI2sul8UcaorSc8MAdWTltrZJNXPQpXl2lH6maXCZUUO3WO8ioLEDopWs9N9YoD87u8n1W4nPhV7CdAk4zCpvUm7ORDi6hbUzs7+E9uM19WBQ95GWa1Hd+nI7oOOw3IJhIHrDEIJMs0AvRfVyFsH5Xoa/z1KV+sCt9Cy+/iJI+DwmpZfQJkEt15KAkPiy5oFwWBu0v5WjQMNkn/FcO/u9Q1G0Fe+/nNOskK2RrOJXdYILZMIHhRqerxICpDivtP3AZH+ps+itcgkoQ5ixs8uf3xCsimDIodGddiEUKJEWw9mSNo4pMi4emp38t0CrCcBJsdvrJBmVNS79FeTJJUxgtTiIAbzUuggNWYPYUL238J3RK3rlxLD0zqsDx/qtAt1x2efRxbLvE/6R/b5k8zTTyvH9Mkwde8v5nDEe3487BbSxO45eVUW+oNP0xSQQyA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR10MB3573.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(366004)(376002)(39860400002)(396003)(136003)(346002)(1076003)(107886003)(6486002)(26005)(316002)(478600001)(2906002)(186003)(86362001)(6666004)(2616005)(6506007)(52116002)(956004)(36756003)(66946007)(8936002)(6512007)(8676002)(4326008)(66556008)(66476007)(69590400012)(5660300002)(16526019)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: YGRz6ltCOsYmhm2RjoxUglFsNrx/FL6y6V0gSjEp5C3WNMykmA1iLX5wpRlevXIDn5JfAKR1LbMuISMHL2zKfb9AqKGjpFXwEviKML2yflTZ2/wjVKLxHlNyPp0yr0actAeWFsRF7mMRJgR+Wat9NhoiTs//ossb8Vp469cQLA/mHbh/uJMnrInfTOS6Qc6xrlk6xUqbIsLCzjiGGea3MesZP1qQrOyBqJPNG5QYfpn2Mejq5o69/EqJJUPRdoWmme/QTy1VXjAIleRu1m2Ixh2OdkqauhwyNZTgQn44DEFzR3zSTxN5Z+1M/VfkLffjmkqCCy+i2anDkuldJpoYEw4p0nlTyvkoUlBrk/PEaKYt0Fa8O5JK/DUQCb4ZysYGAAxzLoQNog4l5brosfpNuSnChGxmKC4J+GANA/A3/bOHqYD003lmNxESvrRdWhJ9zOXEtEPMrVlgZ4vshgLQZKs9UvHn8r4FQULqf87YbiwfLAVnzH+SEpNc4I52SwkDsc/77xml6F8IGw6mwv8xOOv371xbmCKgifN6ePxDjHjW4NYQ1Ia1gXYh0FuWYi8CWpHfGBxTai4anE3Vv/fIqF1+bkyUndg5UkdC5Kma7fbLyBHXl2Tb/JFguod61pjCRTeja2VPgo0Y285sVuSCNqyqLiAWjQU7HFtg6/5z1+5+qpvWtmhDKcprIujzxurnNOp7l7sD82HIlLui9nt/06tIjgi/oGC5tJkwkpQrH6Rp1Nidna7IcX9HMy/7bO6HGX7ZtUvEpC0gUvaydI1VErHDwBxXKes8IsHcigFw4DYMe6L1B0DQER0+58RzzXNJVDbSjKTCuVPFDVJiKrEnwXxnbN0fYqgFE5Li1wohfF3QzP7i/QRaASVT7utHHVp2DpCn7Jqoc7dtrElnu7OzGWAv6B+7VdfnaYA3UGL2oVs1Urr5cJtfwFvGkH/vYCHtkLpEr+bsaWjHRKo2VNVpZ4qXm9h/h3sXgeHxOu1XsPs2rJL17cS1vdDlBeDQqHSI76KbOUfNeBTmEswq673bgsNcLDWl0BHIKmUxz6hnmt3XTGLF/Cdt3+AoYyK+U+6k28UZayLTCXsjqNZ5Brd8GOcPmwAhQvlOv7+nrAAbBaL5fmyvgTPrm6nYLLVOPcdOfV40ZzPbgF3svkj+x3GCBEZ3BBGGJr1HkuTGvOFarIVJpqecQ3ccN3sn5q5fcRisymyjTk5STiwZoGmFuGsaBg12Vzoek4OA7QO86itA0dUPPYaHSgcIPKauLrbFwsnZJYumJ5EZkh+ZmleD6xJCljeZg/OKR/PmEqAm7aC2Kp9ry95UGF+PmCxldTFG5ugM X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 83e325f9-06ab-4d8e-4987-08d8d382a2d1 X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Feb 2021 20:28:50.5858 (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: X5gGdU4WXJ2LgthML9sOECtKoOUAmNkg8t0mpXW12fLPc/NDE40ylPN5xDKijMdCU86QROrNdjiLRR9FAyVQloEKr9u6bgV54kMguKLv4WU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB4101 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxlogscore=999 bulkscore=0 suspectscore=0 spamscore=0 malwarescore=0 mlxscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102170152 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 clxscore=1015 impostorscore=0 mlxscore=0 phishscore=0 mlxlogscore=999 spamscore=0 bulkscore=0 priorityscore=1501 malwarescore=0 suspectscore=0 adultscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102170152 Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org tcm_loop could be used like a normal block device, so we can't use GFP_KERNEL. This adds a gfp_t arg to target_cmd_init_cdb and covnerts the users. For every driver but loop I kept GFP_KERNEL. For loop and xcopy I switched to GFP_NOIO. This will also be useful in the later patches where loop needs to do target_submit_prep from interrupt context to get a ref to the se_device, and so it will need to use GFP_ATOMIC. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig Tested-by: Laurence Oberman --- drivers/infiniband/ulp/srpt/ib_srpt.c | 3 ++- drivers/scsi/qla2xxx/tcm_qla2xxx.c | 3 ++- drivers/target/iscsi/iscsi_target.c | 3 ++- drivers/target/loopback/tcm_loop.c | 3 ++- drivers/target/target_core_transport.c | 14 ++++++++------ drivers/target/target_core_xcopy.c | 2 +- drivers/target/tcm_fc/tfc_cmd.c | 2 +- drivers/vhost/scsi.c | 2 +- drivers/xen/xen-scsiback.c | 2 +- include/target/target_core_fabric.h | 5 +++-- 10 files changed, 23 insertions(+), 16 deletions(-) diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c index 87741e0b4bca..51c386a215f5 100644 --- a/drivers/infiniband/ulp/srpt/ib_srpt.c +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c @@ -1537,7 +1537,8 @@ static void srpt_handle_cmd(struct srpt_rdma_ch *ch, goto busy; } - if (target_submit_prep(cmd, srp_cmd->cdb, sg, sg_cnt, NULL, 0, NULL, 0)) + if (target_submit_prep(cmd, srp_cmd->cdb, sg, sg_cnt, NULL, 0, NULL, 0, + GFP_KERNEL)) return; target_submit(cmd); diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c b/drivers/scsi/qla2xxx/tcm_qla2xxx.c index 56394d901791..12a2265eb2de 100644 --- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c +++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c @@ -492,7 +492,8 @@ static int tcm_qla2xxx_handle_cmd(scsi_qla_host_t *vha, struct qla_tgt_cmd *cmd, if (rc) return rc; - if (target_submit_prep(se_cmd, cdb, NULL, 0, NULL, 0, NULL, 0)) + if (target_submit_prep(se_cmd, cdb, NULL, 0, NULL, 0, NULL, 0, + GFP_KERNEL)) return 0; target_submit(se_cmd); diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c index f2107705f2ea..566adfde1661 100644 --- a/drivers/target/iscsi/iscsi_target.c +++ b/drivers/target/iscsi/iscsi_target.c @@ -1166,7 +1166,8 @@ int iscsit_setup_scsi_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd, target_get_sess_cmd(&cmd->se_cmd, true); - cmd->sense_reason = target_cmd_init_cdb(&cmd->se_cmd, hdr->cdb); + cmd->sense_reason = target_cmd_init_cdb(&cmd->se_cmd, hdr->cdb, + GFP_KERNEL); if (cmd->sense_reason) { if (cmd->sense_reason == TCM_OUT_OF_RESOURCES) { return iscsit_add_reject_cmd(cmd, diff --git a/drivers/target/loopback/tcm_loop.c b/drivers/target/loopback/tcm_loop.c index 461f4125fcab..677e4b8f0642 100644 --- a/drivers/target/loopback/tcm_loop.c +++ b/drivers/target/loopback/tcm_loop.c @@ -156,7 +156,8 @@ static void tcm_loop_submission_work(struct work_struct *work) if (target_submit_prep(se_cmd, sc->cmnd, scsi_sglist(sc), scsi_sg_count(sc), sgl_bidi, sgl_bidi_count, - scsi_prot_sglist(sc), scsi_prot_sg_count(sc))) + scsi_prot_sglist(sc), scsi_prot_sg_count(sc), + GFP_NOIO)) return; target_submit(se_cmd); diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index 1f35cce6e92b..6c88ca832da6 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@ -1427,7 +1427,7 @@ transport_check_alloc_task_attr(struct se_cmd *cmd) } sense_reason_t -target_cmd_init_cdb(struct se_cmd *cmd, unsigned char *cdb) +target_cmd_init_cdb(struct se_cmd *cmd, unsigned char *cdb, gfp_t gfp) { sense_reason_t ret; @@ -1448,8 +1448,7 @@ target_cmd_init_cdb(struct se_cmd *cmd, unsigned char *cdb) * setup the pointer from __t_task_cdb to t_task_cdb. */ if (scsi_command_size(cdb) > sizeof(cmd->__t_task_cdb)) { - cmd->t_task_cdb = kzalloc(scsi_command_size(cdb), - GFP_KERNEL); + cmd->t_task_cdb = kzalloc(scsi_command_size(cdb), gfp); if (!cmd->t_task_cdb) { pr_err("Unable to allocate cmd->t_task_cdb" " %u > sizeof(cmd->__t_task_cdb): %lu ops\n", @@ -1638,6 +1637,7 @@ EXPORT_SYMBOL_GPL(target_init_cmd); * @sgl_bidi_count: scatterlist count for bidirectional READ mapping * @sgl_prot: struct scatterlist memory protection information * @sgl_prot_count: scatterlist count for protection information + * @gfp_t: gfp allocation type * * Returns: * - less than zero to signal failure. @@ -1648,11 +1648,12 @@ EXPORT_SYMBOL_GPL(target_init_cmd); int target_submit_prep(struct se_cmd *se_cmd, unsigned char *cdb, struct scatterlist *sgl, u32 sgl_count, struct scatterlist *sgl_bidi, u32 sgl_bidi_count, - struct scatterlist *sgl_prot, u32 sgl_prot_count) + struct scatterlist *sgl_prot, u32 sgl_prot_count, + gfp_t gfp) { sense_reason_t rc; - rc = target_cmd_init_cdb(se_cmd, cdb); + rc = target_cmd_init_cdb(se_cmd, cdb, gfp); if (rc) goto send_cc_direct; @@ -1788,7 +1789,8 @@ void target_submit_cmd(struct se_cmd *se_cmd, struct se_session *se_sess, if (rc) return; - if (target_submit_prep(se_cmd, cdb, NULL, 0, NULL, 0, NULL, 0)) + if (target_submit_prep(se_cmd, cdb, NULL, 0, NULL, 0, NULL, 0, + GFP_KERNEL)) return; target_submit(se_cmd); diff --git a/drivers/target/target_core_xcopy.c b/drivers/target/target_core_xcopy.c index e86cc6135587..d31ed071cb08 100644 --- a/drivers/target/target_core_xcopy.c +++ b/drivers/target/target_core_xcopy.c @@ -554,7 +554,7 @@ static int target_xcopy_setup_pt_cmd( } cmd->se_cmd_flags |= SCF_SE_LUN_CMD; - if (target_cmd_init_cdb(cmd, cdb)) + if (target_cmd_init_cdb(cmd, cdb, GFP_KERNEL)) return -EINVAL; cmd->tag = 0; diff --git a/drivers/target/tcm_fc/tfc_cmd.c b/drivers/target/tcm_fc/tfc_cmd.c index 1376501ee3d0..410b723f9d79 100644 --- a/drivers/target/tcm_fc/tfc_cmd.c +++ b/drivers/target/tcm_fc/tfc_cmd.c @@ -555,7 +555,7 @@ static void ft_send_work(struct work_struct *work) goto err; if (target_submit_prep(&cmd->se_cmd, fcp->fc_cdb, NULL, 0, NULL, 0, - NULL, 0)) + NULL, 0, GFP_KERNEL)) return; target_submit(&cmd->se_cmd); diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c index 76508d408bb3..93f5631b469c 100644 --- a/drivers/vhost/scsi.c +++ b/drivers/vhost/scsi.c @@ -811,7 +811,7 @@ static void vhost_scsi_submission_work(struct work_struct *work) if (target_submit_prep(se_cmd, cmd->tvc_cdb, sg_ptr, cmd->tvc_sgl_count, NULL, 0, sg_prot_ptr, - cmd->tvc_prot_sgl_count)) + cmd->tvc_prot_sgl_count, GFP_KERNEL)) return; target_submit(se_cmd); diff --git a/drivers/xen/xen-scsiback.c b/drivers/xen/xen-scsiback.c index 7bf9a6bede6d..eb3d8e35cbcd 100644 --- a/drivers/xen/xen-scsiback.c +++ b/drivers/xen/xen-scsiback.c @@ -368,7 +368,7 @@ static void scsiback_cmd_exec(struct vscsibk_pend *pending_req) pending_req->sc_data_direction, TARGET_SCF_ACK_KREF); if (target_submit_prep(se_cmd, pending_req->cmnd, pending_req->sgl, - pending_req->n_sg, NULL, 0, NULL, 0)) + pending_req->n_sg, NULL, 0, NULL, 0, GFP_KERNEL)) return; target_submit(se_cmd); diff --git a/include/target/target_core_fabric.h b/include/target/target_core_fabric.h index 86b0d4a7df92..0543ab107723 100644 --- a/include/target/target_core_fabric.h +++ b/include/target/target_core_fabric.h @@ -157,10 +157,11 @@ int target_init_cmd(struct se_cmd *se_cmd, struct se_session *se_sess, int target_submit_prep(struct se_cmd *se_cmd, unsigned char *cdb, struct scatterlist *sgl, u32 sgl_count, struct scatterlist *sgl_bidi, u32 sgl_bidi_count, - struct scatterlist *sgl_prot, u32 sgl_prot_count); + struct scatterlist *sgl_prot, u32 sgl_prot_count, gfp_t gfp); void target_submit(struct se_cmd *se_cmd); sense_reason_t transport_lookup_cmd_lun(struct se_cmd *); -sense_reason_t target_cmd_init_cdb(struct se_cmd *, unsigned char *); +sense_reason_t target_cmd_init_cdb(struct se_cmd *se_cmd, unsigned char *cdb, + gfp_t gfp); sense_reason_t target_cmd_parse_cdb(struct se_cmd *); void target_submit_cmd(struct se_cmd *, struct se_session *, unsigned char *, unsigned char *, u64, u32, int, int, int); From patchwork Wed Feb 17 20:28:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 12092207 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D3610C43333 for ; Wed, 17 Feb 2021 20:33:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B3E6064DEC for ; Wed, 17 Feb 2021 20:33:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235054AbhBQUdf (ORCPT ); Wed, 17 Feb 2021 15:33:35 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:54236 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235072AbhBQUbo (ORCPT ); Wed, 17 Feb 2021 15:31:44 -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 11HKP88p018170; Wed, 17 Feb 2021 20:28:55 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=eL/vLZuKbd01zmFpeZJGdvF0WVzdreipNWoLFunMtPE=; b=oJ5HtaNzkUu9/BmZJx1ijW9aYqYFxWDi5BxorP+vktf+Y/t3Ia4G89zhYJ55lNLVEfxL IXLGpkNy9cPJqjRW3xbPss6ub5ClszSxJbreR/HMo9iUJ2f2DXxxj1wjTdkqZa3pBhWs LKuqqazaJfn8dFlHx1dJRXnh20DjYoP0sMXXLu9wSvwPP/nmP7SOgP4VV/NRvNLFhVZX vYshgS2vmJdSu6c6CesvrpkhspsYppnpQUWvEEKiApGGwTip/O85ElBJnMjWLBiHtHa8 Wmktp1UX7KP0l+m8qUhuekbINX7NeVndq0KtA6hul/fAchrqZaW3xmGoJSkmrzWNTepK sQ== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2130.oracle.com with ESMTP id 36p49bbwxw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 Feb 2021 20:28:55 +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 11HKPbkf113375; Wed, 17 Feb 2021 20:28:54 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2171.outbound.protection.outlook.com [104.47.58.171]) by userp3020.oracle.com with ESMTP id 36prhtb5tg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 Feb 2021 20:28:54 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SGjNcIxUhccs6LQKMSsTBCOjV6uA4+rX9r0o9Ny3vO1N7P4YqfQc9vCT7S0W8Q0KcanEHoX2gmiAmMYQwhudmXL1C1tNEaM4fvreUOix50i8ObD9gtxjKh8xom+BX7Az0lI129lqAx18WXyspWI3I/SKqv6SacpUOJ2jWRl7VYVPTx5axAYJjXLpi3vtfqhxNw+GqDzI6+YSxC9BG5eRjC9qLLJ3wZpi0ObIUgOJzfxXpd8snSnJCpgArUYaVycnaDKR1Tupppi9TTkqPQZwrnJ+w/XqUFb9J23x2mSuPzGQntwBXgBr4XM5Gdf9qzmJUumOuuX/Ru7FsHoEzr1aJA== 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=eL/vLZuKbd01zmFpeZJGdvF0WVzdreipNWoLFunMtPE=; b=AfVZIcefjBoS6b8q3C3hqgmaoHPnuWucyyhmR3UT2QVnvg8KzpAlKvIlrf+GSXjVBEdZ6ZO8C3K7muK4JbGDodjF+Y/GC/NifSAJHpfyoTVAsaciNfINfbsqqllB8A07QlEzSmiZCjEl2guPvX/71Zo4iuLhbka6/PTB8fNk3gC1DKcu7zKcCKfA4Sz8BmDhr7xUmMEvcksn1naR/ek5BOjp+bm9TMwjWT0y63+Wdy+RaZud+9grYDXhs9IjBB+Qzxmv3NMVarjuZS9FeQWZE15Z/oZOch1iVJSOA2Av7x08sTI1sd7T5yGWdabNTOTDnj0mnz+QI98zy5FQpkp7Dw== 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=eL/vLZuKbd01zmFpeZJGdvF0WVzdreipNWoLFunMtPE=; b=vnRnIjfK9IfRl7ydXIa5a5B2lLDz50KWi0SD6S++MWiFddWG+8DHrYZFrELwYGLpVOdw+gdIJDxyD8Gu3gvCTmMKG6EUug+TwywIqsSWgHGp9Y6VtczD7rDSuM0x1M3LXJ2rOM2IMIyuk+z3r5eN9oJszU1Srup08Ib0HmINZ6k= Authentication-Results: gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=none action=none header.from=oracle.com; Received: from BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) by BY5PR10MB3940.namprd10.prod.outlook.com (2603:10b6:a03:1f6::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.29; Wed, 17 Feb 2021 20:28:52 +0000 Received: from BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::1d86:b9d7:c9ef:ba20]) by BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::1d86:b9d7:c9ef:ba20%7]) with mapi id 15.20.3846.042; Wed, 17 Feb 2021 20:28:52 +0000 From: Mike Christie To: bostroesser@gmail.com, mst@redhat.com, stefanha@redhat.com, Chaitanya.Kulkarni@wdc.com, hch@lst.de, loberman@redhat.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org Cc: Mike Christie Subject: [PATCH 16/25] target: add workqueue based cmd submission Date: Wed, 17 Feb 2021 14:28:02 -0600 Message-Id: <20210217202811.5575-17-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210217202811.5575-1-michael.christie@oracle.com> References: <20210217202811.5575-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: CH2PR15CA0001.namprd15.prod.outlook.com (2603:10b6:610:51::11) To BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by CH2PR15CA0001.namprd15.prod.outlook.com (2603:10b6:610:51::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Wed, 17 Feb 2021 20:28:50 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 80f9707e-59e1-4e57-947b-08d8d382a3be X-MS-TrafficTypeDiagnostic: BY5PR10MB3940: 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: gv5c8iYAGJXggPAFEUUCzWJn2/GwzJRH5wYOtqmdw80UpAhKgcQX8RytwNOaDGfASbWzJiPNZXf3cVsdwxrIkufjy9uKHhJoUlcA1aUs3JfZf1X1z3K0/ddR3r52JCZHMIsJxdWZjWuGElFJytxiBddxBKBja24ozk2c2K+vuFPkyXrM+iTjqvCAVSInP27dRiD49x02ziPVBzna8yePRsHzqMwOKGVGJ8stVAesu87Id0vvuG6QJPTfoukwgwZfUa0VHuRkef6qFUa9ZWGqLwDFaTdCjhKh+oseeYGmjayf6B7TWEwmPLf95QMaNOp9B3y1tA/bO+qLoCYqRQgltOs5xlpPcFzj4DzJYNOil4at2qccKr2jLpdNm+9ouuc3Tpiz0O31ECAqg/W87yZCmv2HkLwxWKa0sKgk1YY1pMpgRXvV11zfyOqTbDkOmnFE2wvxUni40wM0EH+iUite9BKNoH5nUR/uhgRTEFj3Qp26QwxwBduSm0Ukz/sueA+DNWvqNxrGAfXmL3oGnCgQIr797qalJ5NLPx/A87UY/ZgCy3i2iYJxL3WLU6X/SsGOrphOrmtofQBbqIxtgbe7Ug== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR10MB3573.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(346002)(366004)(39860400002)(396003)(136003)(376002)(2906002)(6486002)(956004)(86362001)(478600001)(1076003)(69590400012)(52116002)(316002)(6512007)(4326008)(8676002)(83380400001)(66476007)(6666004)(6506007)(8936002)(66946007)(66556008)(2616005)(36756003)(5660300002)(26005)(186003)(16526019)(107886003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: Okj/DE6ft3klbMnslaZw1wOXSSFyDh0cb3tQqpGt9hRDnPcVAFaYiriOLHbt7eCiVOT4qUbqF40rMZ1/3JDx1d1I7hITzhlYaGTAfKnPKVlsDCEJC3bWBCvApI0Wvh10+42J0IqV1sG8BPHpZKjyTDs1xufrfMcQ7qPN2LuzoT8/uBfW4Izcm9B2q3vHs3Wj9BZPynC7ZLQJm7DV4+Oj2gbxzRUwj8u21EFF6uhch/ypv5AKBFMDMUpzhSymoTeyIhObRrXNzlMnoPQPAKIdFAh8wlQT0zRzrlWzG+0+k+60BuAujrpEmcDdViGRNHKU4jKQD1O2haxAKfK5hQsCUi6csXRCqywZnTfOp3aoDdM4OxSqTMw7HvXkP6F+1TbAN8MNtHDRj8FYV1BNiNfU+9Vp9yDvkMBzAL2i3cn73ZzfVqk5DjLa5624Yx+85X442VKf9rqNloomWceRbFa/Z9DtRg8zaCkbGVUrx9esoI/3IMR/x9Tk/xA9V6HySDhfolPhiyR1em6oksTskXxpcwulY45qJabg1Ifa10Zw4ZTeb3jVyf9BK2xMfSURLJBlzO2JZF8yTiGpI1e9cUHyUQXpuZiBAbF844ktNcKomFJP1jBLKyC7dEOqN0NhVJdYv16831cG1kaZzxK0gPU+GEPVdyoWahrjMxtmk1qQH3XKmYsZhxRS/Z02cvK5cMkDJeOOeH6XM11WWIoNcn2qeuxLY8AeU02iqsif7d1V+5wPlMZujWH65BHdRIr9BnU+E788DgDg3E2paKXkpt2NXzbYKLv3Knf7SgJwqnMQgNpYaIZAig1wqdrf4tf7gfupdq4HmM7CaLr3GFQqv5vOD2yjC7PtHbqpFH1mlZ9e1puIBlKOLFkthCklqoUcdYGtY7u/aBCN2coZi21N907L8ph3393/+TKGzvFAQHy7yxUTM4bq9FwxxnwTKkDeofz/32m162k8Kh4SbL+sCS79BUOSyWbeBsE9p9K4CB7SK009rBFs/YgSfqX/8fQfHUW7fQCx1Jp2O0fo6rKqMIElI3Xs7FaNgzoLoiYi3jBrP/oT+N+FLUlxghj5uQjVm5624tsoczIzDoCI9C38SY4VfdfUTGMNsH9rz7zirP8om+tigfKHFrkW+ZyxxDXSgW4afhwL/dW7xHKDKnJ6lttXdpmXV1G4Nt7kORAVwBeYPuKvrQo7kR04eHA2EjoSEDUJTfsFHVmM3hyS2/tm2QBmuZpT3eOv5GPMP+K1FlzqHGLtLdiIbPovhR6xe2ydK7Y2aFWNs9kmk5DjumEJqPMVUPQJlpFhUYazMvf1gIIUzj3v5ekM1SGq9cK7lZK/2ksH X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 80f9707e-59e1-4e57-947b-08d8d382a3be X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Feb 2021 20:28:52.1249 (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: e71jJiSp1Lgb4ZUoCde8XygB/05cIo56UGanCDAZUzUy9XU7rgYIQvT92PjenZqDddjO2c8sDsN0fZVNugokftn/UKnLGITkqSxy2WS2jI8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR10MB3940 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 adultscore=0 mlxscore=0 bulkscore=0 suspectscore=0 malwarescore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102170152 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 priorityscore=1501 lowpriorityscore=0 bulkscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 malwarescore=0 phishscore=0 clxscore=1015 mlxscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102170152 Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org loop and vhost-scsi do their target cmd submission from driver workqueues. This allows them to avoid an issue where the backend may block waiting for resources like tags/requests, mem/locks, etc and that ends up blocking their entire submission path and for the case of vhost-scsi both the submission and completion path. This patch adds a helper drivers can use to submit from a lio workqueue. This code will then be extended in the next patches to fix the plugging of backend devices. Note: I'm only converting vhost/loop initially, but the workqueue based submission will work for other drivers and have similar benefits where the main target loops will not end up blocking one some backend resource. I'll port others when I have more time to test as I think we might want to make it configurable for some drivers. Signed-off-by: Mike Christie Tested-by: Laurence Oberman Reviewed-by: Bodo Stroesser --- drivers/target/target_core_device.c | 10 ++++-- drivers/target/target_core_internal.h | 1 + drivers/target/target_core_transport.c | 42 +++++++++++++++++++++++++- include/target/target_core_base.h | 8 ++++- include/target/target_core_fabric.h | 2 ++ 5 files changed, 59 insertions(+), 4 deletions(-) diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c index 7787c527aad3..74d3a4896588 100644 --- a/drivers/target/target_core_device.c +++ b/drivers/target/target_core_device.c @@ -735,8 +735,14 @@ struct se_device *target_alloc_device(struct se_hba *hba, const char *name) dev->queue_cnt = nr_cpu_ids; for (i = 0; i < dev->queue_cnt; i++) { - INIT_LIST_HEAD(&dev->queues[i].state_list); - spin_lock_init(&dev->queues[i].lock); + struct se_device_queue *q; + + q = &dev->queues[i]; + INIT_LIST_HEAD(&q->state_list); + spin_lock_init(&q->lock); + + init_llist_head(&q->sq.cmd_list); + INIT_WORK(&q->sq.work, target_queued_submit_work); } dev->se_hba = hba; diff --git a/drivers/target/target_core_internal.h b/drivers/target/target_core_internal.h index e7b3c6e5d574..56f841fd7f04 100644 --- a/drivers/target/target_core_internal.h +++ b/drivers/target/target_core_internal.h @@ -153,6 +153,7 @@ void target_qf_do_work(struct work_struct *work); bool target_check_wce(struct se_device *dev); bool target_check_fua(struct se_device *dev); void __target_execute_cmd(struct se_cmd *, bool); +void target_queued_submit_work(struct work_struct *work); /* target_core_stat.c */ void target_stat_setup_dev_default_groups(struct se_device *); diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index 6c88ca832da6..dd63f81bd702 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@ -41,6 +41,7 @@ #include static struct workqueue_struct *target_completion_wq; +static struct workqueue_struct *target_submission_wq; static struct kmem_cache *se_sess_cache; struct kmem_cache *se_ua_cache; struct kmem_cache *t10_pr_reg_cache; @@ -129,8 +130,15 @@ int init_se_kmem_caches(void) if (!target_completion_wq) goto out_free_lba_map_mem_cache; + target_submission_wq = alloc_workqueue("target_submission", + WQ_MEM_RECLAIM, 0); + if (!target_submission_wq) + goto out_free_completion_wq; + return 0; +out_free_completion_wq: + destroy_workqueue(target_completion_wq); out_free_lba_map_mem_cache: kmem_cache_destroy(t10_alua_lba_map_mem_cache); out_free_lba_map_cache: @@ -153,6 +161,7 @@ int init_se_kmem_caches(void) void release_se_kmem_caches(void) { + destroy_workqueue(target_submission_wq); destroy_workqueue(target_completion_wq); kmem_cache_destroy(se_sess_cache); kmem_cache_destroy(se_ua_cache); @@ -1380,7 +1389,6 @@ void __target_init_cmd( { INIT_LIST_HEAD(&cmd->se_delayed_node); INIT_LIST_HEAD(&cmd->se_qf_node); - INIT_LIST_HEAD(&cmd->se_cmd_list); INIT_LIST_HEAD(&cmd->state_list); init_completion(&cmd->t_transport_stop_comp); cmd->free_compl = NULL; @@ -1797,6 +1805,38 @@ void target_submit_cmd(struct se_cmd *se_cmd, struct se_session *se_sess, } EXPORT_SYMBOL(target_submit_cmd); +void target_queued_submit_work(struct work_struct *work) +{ + struct se_cmd_queue *sq = container_of(work, struct se_cmd_queue, work); + struct se_cmd *se_cmd, *next_cmd; + struct llist_node *cmd_list; + + cmd_list = llist_del_all(&sq->cmd_list); + if (!cmd_list) + /* Previous call took what we were queued to submit */ + return; + + cmd_list = llist_reverse_order(cmd_list); + llist_for_each_entry_safe(se_cmd, next_cmd, cmd_list, se_cmd_list) + target_submit(se_cmd); +} + +/** + * target_queue_submission - queue the cmd to run on the LIO workqueue + * @se_cmd: command descriptor to submit + */ +void target_queue_submission(struct se_cmd *se_cmd) +{ + struct se_device *se_dev = se_cmd->se_dev; + int cpu = se_cmd->cpuid; + struct se_cmd_queue *sq; + + sq = &se_dev->queues[cpu].sq; + llist_add(&se_cmd->se_cmd_list, &sq->cmd_list); + queue_work_on(cpu, target_submission_wq, &sq->work); +} +EXPORT_SYMBOL_GPL(target_queue_submission); + static void target_complete_tmr_failure(struct work_struct *work) { struct se_cmd *se_cmd = container_of(work, struct se_cmd, work); diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h index 63dd12124139..815de4c97230 100644 --- a/include/target/target_core_base.h +++ b/include/target/target_core_base.h @@ -487,7 +487,7 @@ struct se_cmd { /* Only used for internal passthrough and legacy TCM fabric modules */ struct se_session *se_sess; struct se_tmr_req *se_tmr_req; - struct list_head se_cmd_list; + struct llist_node se_cmd_list; struct completion *free_compl; struct completion *abrt_compl; const struct target_core_fabric_ops *se_tfo; @@ -764,9 +764,15 @@ struct se_dev_stat_grps { struct config_group scsi_lu_group; }; +struct se_cmd_queue { + struct llist_head cmd_list; + struct work_struct work; +}; + struct se_device_queue { struct list_head state_list; spinlock_t lock; + struct se_cmd_queue sq; }; struct se_device { diff --git a/include/target/target_core_fabric.h b/include/target/target_core_fabric.h index 0543ab107723..3c5ade7a04a6 100644 --- a/include/target/target_core_fabric.h +++ b/include/target/target_core_fabric.h @@ -165,6 +165,8 @@ sense_reason_t target_cmd_init_cdb(struct se_cmd *se_cmd, unsigned char *cdb, sense_reason_t target_cmd_parse_cdb(struct se_cmd *); void target_submit_cmd(struct se_cmd *, struct se_session *, unsigned char *, unsigned char *, u64, u32, int, int, int); +void target_queue_submission(struct se_cmd *se_cmd); + int target_submit_tmr(struct se_cmd *se_cmd, struct se_session *se_sess, unsigned char *sense, u64 unpacked_lun, void *fabric_tmr_ptr, unsigned char tm_type, From patchwork Wed Feb 17 20:28:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 12092201 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A558BC4332B for ; Wed, 17 Feb 2021 20:33:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8879D64DEC for ; Wed, 17 Feb 2021 20:33:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235012AbhBQUdc (ORCPT ); Wed, 17 Feb 2021 15:33:32 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:42168 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235073AbhBQUbo (ORCPT ); Wed, 17 Feb 2021 15:31:44 -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 11HKO95T146933; Wed, 17 Feb 2021 20:28:55 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=itSJG6yjR1UHZhPl78ExO6tKSVBINoJd8hEnckxtsAo=; b=ekfMav46ci47+v0bxCYwyQ8IQASZl1Ar9lY2P9kO5TQ78OqzVDsOioq0GaQz52EOQzkA 11ZdWi7YmAvm0x/GCCaOXc5lw6m/mmbBpFiSKzbSc3s1Li+uha8GRQ9LG9tnX7lvfq2q 4/9aeWLOD1ueAZIQfcl5clmxYLcphb+fxTxIBz4HN9Coq/Bjur3FAI/oePVyugSrDG+i Q56EWYCQa8tYuEIxtZZZ6J5uMaRXzHTwd3PcGPraHvOyaoYfCflTClJt2vq4sAb5WY7Y mBhxS4IE49ztwoPjrqRe77nBV/h4dzSAdfS2VFDG8rObqLfPlTyY2qQvnSBLH7Ma161T pQ== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2120.oracle.com with ESMTP id 36p7dnkpk1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 Feb 2021 20:28:55 +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 11HKPbkg113375; Wed, 17 Feb 2021 20:28:55 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2171.outbound.protection.outlook.com [104.47.58.171]) by userp3020.oracle.com with ESMTP id 36prhtb5tg-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 Feb 2021 20:28:54 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PGkavj1XJdDGi+mgoTNBV+BYIgbZ52G76KoO7ZnG13tzwwl1gLzNvTxMfDckY+w4wNZhseZMjVuBGe3Aobl+VWYeko5aBXUyPYRAxaiXGENkP/fVuCrda8b7WGedvpe2fzIJvOZQNZWnEJZFb3y26KSEUW/FqR56+YqQVCpvrTfJuEr1w3vLt5UFk3SRxPyiKfxa1CjUE2fHQgP3GMr0Gd1peyMlpxJogwc8+jZJLR44F/o9rVkAmzP/3U/bcO8rkWZYBcHsOAZ5vUs5GSWDDAn9pSFCH4duW3Wvyf880WuxiMn2dJU+DPgSKS1L1puaIrI3jgm9Fxc2Zphxg9PgcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=itSJG6yjR1UHZhPl78ExO6tKSVBINoJd8hEnckxtsAo=; b=aipDSqUB2jr7Hugf91KYMprO/z8Phr1MCV/q+wnXSCUa31/wMgdy3ngK7YPOFrdNWCC7IzzJgWrF5JT5/uaJcOQ4rZXfxlKElLi+LjKg4+Xcr19JE01bS+TZx3DVgKmUUGnG65uvX5s1+8QvyMPJNJjj6lECv7lPZzDkGFakx5STrax0svaC7GMec2mYLD/JUT0Lv8Hm9PuTkRmywCNwz+nzV6aMGhYsPvyQkgcp4nXcnl14YTj5DGwJMMli/wm+o4lM/v9Xh44c9THFC4qnjpyz7jcLcAdJaZtc24X//a/vEdCvPyInN5FbdmDZRDXC4/fgdJQ7DEIMZWF2yfICHg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=itSJG6yjR1UHZhPl78ExO6tKSVBINoJd8hEnckxtsAo=; b=nlGdMwNaIewxoR7X8lXILdL0qXEfdIpkEVq4R6zHKGoO2G5cFxird5o/HxCZ4jEIB637BPA6Iio7LIlkkxyT8CkEtRIDXR+BQFNbpYCW9yqmn8sl7tgMLbW81IxSQElT6/J+6ziJcylcX91Bt3XkjJ/9NilF3q7hcdinRdDjPnI= Authentication-Results: gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=none action=none header.from=oracle.com; Received: from BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) by BY5PR10MB3940.namprd10.prod.outlook.com (2603:10b6:a03:1f6::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.29; Wed, 17 Feb 2021 20:28:53 +0000 Received: from BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::1d86:b9d7:c9ef:ba20]) by BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::1d86:b9d7:c9ef:ba20%7]) with mapi id 15.20.3846.042; Wed, 17 Feb 2021 20:28:53 +0000 From: Mike Christie To: bostroesser@gmail.com, mst@redhat.com, stefanha@redhat.com, Chaitanya.Kulkarni@wdc.com, hch@lst.de, loberman@redhat.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org Cc: Mike Christie Subject: [PATCH 17/25] vhost scsi: use lio wq cmd submission helper Date: Wed, 17 Feb 2021 14:28:03 -0600 Message-Id: <20210217202811.5575-18-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210217202811.5575-1-michael.christie@oracle.com> References: <20210217202811.5575-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: CH2PR15CA0001.namprd15.prod.outlook.com (2603:10b6:610:51::11) To BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by CH2PR15CA0001.namprd15.prod.outlook.com (2603:10b6:610:51::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Wed, 17 Feb 2021 20:28:52 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: efb3bd4a-fff1-4c05-3a5e-08d8d382a4af X-MS-TrafficTypeDiagnostic: BY5PR10MB3940: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5797; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9ayGV09OmA/3bDyxzzjBMXsTjl08rHoSoEYbHur6a9cd1QIpkbVO3qB3hNCOw3KEOx41r9gLbXVRYEbCCY9SjgeUDAHNtF25EHAjJZ2adcX43UwRe1mqg+eIOATslT2celUBybf3FDOoB6mAUbUdMwJ5M9Rksk5atPV4hPmr5WXjWIGEV1UpULelx6pO/gaXkJGDJXChKwoyoe9ysgOpnRdmL5exV5M/mYqJ9Ra42SmBS1KAGPAzxgTd1bdBPIU8+F6deqwZDW2um85M+ekGtxt2knkgnPiQgqF3jng+a9carkY+KHdjLHjtmPtcpF8J4qNUSn5rva5THzRrwQhZQWN/CBnBC82UmUDM2t9geQjUV+dcENOwJ0Fa7TG1FebNGKVi1e23b3InTkwqL84TGvD6qAmDesoQHiwKtlEAA8BmmfF23cLkUXFcCMEKjahCCbNKjToetCJK51CnQtdMUHuaBUIdiASlILhPmwyIWWfHDOuHhH30UIah8Zmi3bmqp6awupWUkvglfJS9YaUT8svBDUQBClirStg8ZFSi7d93wfquaranV2RRm+lttpzKCbX0EKig/BIF/xofHjM+tg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR10MB3573.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(346002)(366004)(39860400002)(396003)(136003)(376002)(2906002)(6486002)(956004)(86362001)(478600001)(1076003)(69590400012)(52116002)(316002)(6512007)(4326008)(8676002)(83380400001)(66476007)(6666004)(6506007)(8936002)(66946007)(66556008)(2616005)(36756003)(5660300002)(26005)(186003)(16526019)(107886003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: S67Ep8WT6bkJxYZ6WMO84SM1mxZNaqYsFLUMLaXDPWHs4EWF6q/2nVMHNAL2o7qcLcKWpdi5gjcMaCfyRKTtn5LD7nHuXCwRv/tS7aXRVz6ZRmphBXB5cGguWKIyN8NwRhgLZNZIaogbIg0PEp3VBcBRDCcJvCIqef0E1QcxvrE5SdzchuBLAhNLjjrf5Qu8tpq7cX4wGhvWEOloSCrz5ojjvuy3158noL70MX0beWf1hp8j8R+OY/855SegpfW8TJwQhue7p6p639g9+9maeKYZvDGnxyMa11H+veLMVEQRrAn283AU4WQqmyPs+F+MZ6PpSoIIG7bwSlgAjydWQuFvZiNBTN2oL+hD54fM4L7QJIEgxB385v1CbJ3K04iacm8zH41QxF/+V5sMmYRyGIZead9yVdxEfklAmOW3nFFsgAE7qjNrxLwdZlk38aO6nuL64oI96fNJu7hxI5pBzz3T+mqvayFl6/psvgqhwkegrk7SGN2BFFwNQynHdHBjYGKABtTngM9yhaBFzWuHdhO5tzy+ic3692xnp4GkrSgyZyrtW3wtqw9+41AskLG8Jnn+/AfYAbfpjTUPrWU+Mb7whhSMbuHPu90VWE820vEMRM/TohhwpcQvRk7bdanaU5v47BTg2kb7KIP5Ug4vc//poUuvE3CwzZq4HtXborhkVQ8paYuwjL9j6pFDnekOF7SdEx/QiRD11ppmUhp3TDBqg+1LmN2vT/ZWJnItTiB00zimm5AI7jtDjZsmrdF9dGXRiI/sA3WBEstdZrPJ26Ehsie89Q0Dc0dt7qWBRH9Az6N8k3okGN8+uv4g9jddSIaj6udxaWC8SsgZPO5EJ3qXoO94Y+qhK7MJbiFTNL31OACbApos7JwNzp/COj3XUh/ZSIngSZ7l9+yp9x3yfub390gLtQFs05/hN0ZSujak1dhrEhjSL4JETF+zReItGyC36e2NXvPZeipySTT0ShswZib1BhUOgKbPpAJhaQirLuWTBQTw7jaai54l87WxI3ofJgbDH2qNd0/4HCpfmeDuAblzuXmdW+18oq5W9q91ug/NRbtl8QYSztS83Icx9pGe1dgw3Smz99uKF1jFvMwiHs44VoCtPcjrS+zv5V5JdyuBXF1i7wU2uF0nWSau3cx8k6QEqS1N9250D1WzlltpoFU+GX8WrN61Up9KwAz3rYyyHzDLaxtnNqbJFt5INlkmEhYLjwlquJQRVzRDPdWq8aTyH6zb3fzJkkr8rRv+LwvNH1EpnvjRhOAiHA95JLMJ5VOUQlER5InGzaq7+tijlxcgRnU8mG+uCUK5bkM95wKwQJj8Vf/ORg6jtDQo X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: efb3bd4a-fff1-4c05-3a5e-08d8d382a4af X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Feb 2021 20:28:53.6980 (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: OHEWCNbZ2wb3e8PPX87O9+UOlHuXJtksub+ISCMSTh4rnt+kYWJTEOmsoo3R1CInTKdwvocs9wDr5aXDdYr6aE8AzAiYIA6qBmcZOL+s/qk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR10MB3940 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 adultscore=0 mlxscore=0 bulkscore=0 suspectscore=0 malwarescore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102170152 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 suspectscore=0 mlxscore=0 phishscore=0 spamscore=0 adultscore=0 clxscore=1015 impostorscore=0 priorityscore=1501 lowpriorityscore=0 malwarescore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102170152 Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org Convert vhost-scsi to use the lio wq cmd submission helper. Signed-off-by: Mike Christie --- drivers/vhost/scsi.c | 36 ++++++------------------------------ 1 file changed, 6 insertions(+), 30 deletions(-) diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c index 93f5631b469c..f3448e542965 100644 --- a/drivers/vhost/scsi.c +++ b/drivers/vhost/scsi.c @@ -85,7 +85,7 @@ struct vhost_scsi_cmd { /* The number of scatterlists associated with this cmd */ u32 tvc_sgl_count; u32 tvc_prot_sgl_count; - /* Saved unpacked SCSI LUN for vhost_scsi_submission_work() */ + /* Saved unpacked SCSI LUN for vhost_scsi_target_queue_cmd() */ u32 tvc_lun; /* Pointer to the SGL formatted memory from virtio-scsi */ struct scatterlist *tvc_sgl; @@ -101,8 +101,6 @@ struct vhost_scsi_cmd { struct vhost_scsi_nexus *tvc_nexus; /* The TCM I/O descriptor that is accessed via container_of() */ struct se_cmd tvc_se_cmd; - /* work item used for cmwq dispatch to vhost_scsi_submission_work() */ - struct work_struct work; /* Copy of the incoming SCSI command descriptor block (CDB) */ unsigned char tvc_cdb[VHOST_SCSI_MAX_CDB_SIZE]; /* Sense buffer that will be mapped into outgoing status */ @@ -240,8 +238,6 @@ struct vhost_scsi_ctx { struct iov_iter out_iter; }; -static struct workqueue_struct *vhost_scsi_workqueue; - /* Global spinlock to protect vhost_scsi TPG list for vhost IOCTL access */ static DEFINE_MUTEX(vhost_scsi_mutex); static LIST_HEAD(vhost_scsi_list); @@ -782,12 +778,10 @@ static int vhost_scsi_to_tcm_attr(int attr) return TCM_SIMPLE_TAG; } -static void vhost_scsi_submission_work(struct work_struct *work) +static void vhost_scsi_target_queue_cmd(struct vhost_scsi_cmd *cmd) { - struct vhost_scsi_cmd *cmd = - container_of(work, struct vhost_scsi_cmd, work); - struct vhost_scsi_nexus *tv_nexus; struct se_cmd *se_cmd = &cmd->tvc_se_cmd; + struct vhost_scsi_nexus *tv_nexus; struct scatterlist *sg_ptr, *sg_prot_ptr = NULL; /* FIXME: BIDI operation */ @@ -814,7 +808,7 @@ static void vhost_scsi_submission_work(struct work_struct *work) cmd->tvc_prot_sgl_count, GFP_KERNEL)) return; - target_submit(se_cmd); + target_queue_submission(se_cmd); } static void @@ -1130,14 +1124,7 @@ vhost_scsi_handle_vq(struct vhost_scsi *vs, struct vhost_virtqueue *vq) * vhost_scsi_queue_data_in() and vhost_scsi_queue_status() */ cmd->tvc_vq_desc = vc.head; - /* - * Dispatch cmd descriptor for cmwq execution in process - * context provided by vhost_scsi_workqueue. This also ensures - * cmd is executed on the same kworker CPU as this vhost - * thread to gain positive L2 cache locality effects. - */ - INIT_WORK(&cmd->work, vhost_scsi_submission_work); - queue_work(vhost_scsi_workqueue, &cmd->work); + vhost_scsi_target_queue_cmd(cmd); ret = 0; err: /* @@ -2487,17 +2474,9 @@ static int __init vhost_scsi_init(void) " on "UTS_RELEASE"\n", VHOST_SCSI_VERSION, utsname()->sysname, utsname()->machine); - /* - * Use our own dedicated workqueue for submitting I/O into - * target core to avoid contention within system_wq. - */ - vhost_scsi_workqueue = alloc_workqueue("vhost_scsi", 0, 0); - if (!vhost_scsi_workqueue) - goto out; - ret = vhost_scsi_register(); if (ret < 0) - goto out_destroy_workqueue; + goto out; ret = target_register_template(&vhost_scsi_ops); if (ret < 0) @@ -2507,8 +2486,6 @@ static int __init vhost_scsi_init(void) out_vhost_scsi_deregister: vhost_scsi_deregister(); -out_destroy_workqueue: - destroy_workqueue(vhost_scsi_workqueue); out: return ret; }; @@ -2517,7 +2494,6 @@ static void vhost_scsi_exit(void) { target_unregister_template(&vhost_scsi_ops); vhost_scsi_deregister(); - destroy_workqueue(vhost_scsi_workqueue); }; MODULE_DESCRIPTION("VHOST_SCSI series fabric driver"); From patchwork Wed Feb 17 20:28:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 12092205 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 F23FCC43217 for ; Wed, 17 Feb 2021 20:33:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DD7BE64E76 for ; Wed, 17 Feb 2021 20:33:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235074AbhBQUdj (ORCPT ); Wed, 17 Feb 2021 15:33:39 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:54260 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235076AbhBQUbr (ORCPT ); Wed, 17 Feb 2021 15:31:47 -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 11HKPFAD018342; Wed, 17 Feb 2021 20:28:58 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=9ROJe34rBy+wJHGYiwS9ievWK9z3GgeKUC3bgZLnp7I=; b=kwzC9aP66iNQ+nDR0T9fVHAu4XDhbFYWB223P8zdcn5Oh4jGM+Cn720xPzk+JNaGD7MY 3qKc7WAFZhoeRGpOdKt/3C6U0gXDDJ+vtaVAZNTg9fArRLVFtdBDSuOS6LCMSHbot0ww u3bkCDRLYDkbICe+tCRcUOwJt32YBao6BxgNL6R5zFRSdIribZSS9q/WAuIlBonaxT8d O7rOf6fy2FLSW/8aSvQe6uXUepCQh6WOwm9S/+E+92kT8nubKikShikYaI3CDd3W8jHL GaNKdL+Vzq+2xKq7tXGxr4Nv0Sg1WlnU1MQ6QkW7/oEfhUJFNEJOPS3sFwMLS8g/69oS OA== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2130.oracle.com with ESMTP id 36p49bbwy8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 Feb 2021 20:28:58 +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 11HKPcdd113504; Wed, 17 Feb 2021 20:28:57 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2177.outbound.protection.outlook.com [104.47.58.177]) by userp3020.oracle.com with ESMTP id 36prhtb5ug-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 Feb 2021 20:28:57 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mPSFZGUo1HhegT8zi+79tJ49hmp7vrDTwwDZQhQXEARxf6bcPLX2u+3Yynd6PS6K+sI7u0bffHulLXNG8W7SQlJXhTnFHikLA7CGdgdOUGWb0x3pG23XtR0CtlKFkL9D3ZobEAB0ypisVFPE4v2D1onJVD1i+ne+aCo6/dYO32DbA67LAkQ2Vpooc94+eHTnvhrZyNl3ewSF2Ycr+s/3BS32KoxmJ3yZhU1TpKmKXZcW7632rCC5XBVGpdgxk3ycJMeiZUJrjM3lFFUhNf7mw4LVd2a4UP6J2VcVb8BHEnyDSvxBIGsHwGRjXV+XKMaC7aTW0qTJMCGD/k84W0YbGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9ROJe34rBy+wJHGYiwS9ievWK9z3GgeKUC3bgZLnp7I=; b=HBPjom2MBmdWnzBGfPpjPKFIPM/FxRiUVLExc6jysOUYEyq493c0Vx/w2vtow92vrMcAqwNYJQGFePhJ6CnKvjOOQns1Q/26BJ7K3iTryWBDc/owiZ8fmHG0wIfoVTsNg7sDw6NfXPV9vLk6LZyLxiU6zPI+78C4YlVv3iN57dVed8FBSwKbot+toQO71g7rGiVKZAvnICesORqC2jfOkia3K0OgiTxdA6oDE3K+jRGLGMrEEp6IEZFnP/Iq6jJ7sCRtJt0vdmn4OS2qtmDpbVYxI0Y298x99pc8Zhleb9BylZirOQhSoK1YMJr0DQWcl8GW5ZesZkbVA8Gw1yRfHg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9ROJe34rBy+wJHGYiwS9ievWK9z3GgeKUC3bgZLnp7I=; b=uZwIyznky7h6dOZg495H2C2DwKnJB4eDdOtT6itn/6xzZOoqcefO60Meo9HxhYASN0yAs9gYXOXSn+T3SIYASaUY0tMvqNxBaWs/xdHUS8+6a9B6hjejmahXvU1gOtKP6bN3O0+QzCNTUFuydBEOsnOc9grZyWqooTFv3R83MP8= Authentication-Results: gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=none action=none header.from=oracle.com; Received: from BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) by BY5PR10MB3940.namprd10.prod.outlook.com (2603:10b6:a03:1f6::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.29; Wed, 17 Feb 2021 20:28:55 +0000 Received: from BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::1d86:b9d7:c9ef:ba20]) by BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::1d86:b9d7:c9ef:ba20%7]) with mapi id 15.20.3846.042; Wed, 17 Feb 2021 20:28:55 +0000 From: Mike Christie To: bostroesser@gmail.com, mst@redhat.com, stefanha@redhat.com, Chaitanya.Kulkarni@wdc.com, hch@lst.de, loberman@redhat.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org Cc: Mike Christie Subject: [PATCH 18/25] tcm loop: use blk cmd allocator for se_cmds Date: Wed, 17 Feb 2021 14:28:04 -0600 Message-Id: <20210217202811.5575-19-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210217202811.5575-1-michael.christie@oracle.com> References: <20210217202811.5575-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: CH2PR15CA0001.namprd15.prod.outlook.com (2603:10b6:610:51::11) To BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by CH2PR15CA0001.namprd15.prod.outlook.com (2603:10b6:610:51::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Wed, 17 Feb 2021 20:28:53 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e9de42fa-4caf-4672-dcfd-08d8d382a58f X-MS-TrafficTypeDiagnostic: BY5PR10MB3940: 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: 6Sh2ShNNdFUJOl+XoruHx4dW04xBWC46L7M0esdHaNQV3+hJp2qCci2qGQr8w5jWPvV2v1APru55DH3567tJ+IKgDxYNCRvSPq+3TnbwFcGREpVWS+/qJqAHW+1pyhAoVDaAmlaQ/qlehNhy5CM6a/08DiM9PujYz/DkYw/6FiIt4S2dy8gNVIPJGb+3VioSCvCzRe9VJJiVfHvEGB0gvgWtmc0NZ1uYe/zEKl9crMXo6bdlwnR6i7mGpxmBLsFWqa6d4JGq/owqKHG9x+rnZx2aD+kA9XHIQqm0FXciGMztXra/4XnT+14sqcb6Miw7BAWqCbTZWeQzey3GAHGyh2IomzPDLo17DHcyBnc8mwUtYf84Dze1IWGkLR2qBH0sUQmTyft/cwXGvylYKcOlOMaJtldyb4KaZWiOx2arI1Ug2uWUwjPy5OVebS2pFqhLdfx4CtX3ACIr95VMEacE5J2VlvWP0OJ4U8qzfZVCvPaHs+5Dme/w3zPVHnkwagcb/UbOEckfynRXivY4JQnTgsajyVz3KgGx0Ad2vNV+b6MNN1xS4++BUV3IIi1eCxVeEdCF3c7YxSK5GjEDPO0uPg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR10MB3573.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(346002)(366004)(39860400002)(396003)(136003)(376002)(2906002)(6486002)(956004)(86362001)(478600001)(1076003)(69590400012)(52116002)(316002)(6512007)(4326008)(8676002)(83380400001)(66476007)(6666004)(6506007)(8936002)(66946007)(66556008)(2616005)(36756003)(5660300002)(26005)(186003)(16526019)(107886003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 8gMbSEmwZ4KPxZGLfenRc851AjToEwQw2GkacArHHa+tp39g2VlmFnlro6Ri6ksmoRP1zNYktWalYkdZHUlmuG58n0jaX+2uTz6Q1uYUAmbQZN2IOsMpBfFXGEezKqwgoH/RK8Ix/eJb8RVVhVNGT/GajXJLylsZnZxVo2Ifm21kxdCeVKQH4C4bpCi19PzSUEH/lASXiLNeO3SbhXAf7b4H0b4ap+k3imLT/UzP3gKeCbXsVamiGUDFK03aUhoSk/BVsT/ijZJ0em2sUEmvqUcauUC14YHXP48xBBwJMWSoxwSkqowt3Ws3U+z3u1I/zZkauPYHgClFe900cVpSdfbRH8pESNQ3YnPlMsG6VV3npfeKnwjDhaUn6qJqXOe7ToK8Us2ou2UO8VnGmWHDodwsox9Y9XAWx26ejZinIKGYt1VWT7BB0ET2c4S9zPnwwhs9462OviFGgiChKVd5d5jc0GrM24iV2L56z+dKeKNN2kk/lN/QqzBwSBsb10PpBVIUSGvc3tzX6xhojBdzSt1VypSYA7aicPGS7akIkg6DklqAMRJKWgJNkU/6fAFE+Zb6TjWp5efFtkfUrMprXKujat410tQ3/gHok27aEiCZfo2k6gPI1QM+cjVQrr/WUz8nUTkWReaAin6TNlf0ZwAgIWlj2ZO4TuX89yACyX1xYIB6UmxO4/+O/48CzlwlpvjTNzHUd/ooebPE/xakeDud9HJOoMX8FI0eQdMG4wVR1O9bAMqM0k7Q6TsCxPQbnH/y2FYr1RpSAC+nqU17wN7ovGhBhQOkK3NgQzHRneGHopnPpHaVmLUEJLrWkDUNJyHnXDCdgmMlGUvj+rVleFVDcPvVXVr9UFZl+EiqfNOJtQsWeJWk6Q/ylK+QgQtinWlVYQTF4NbCA8T+haEXW1hj6popldVsW6v4I3PdvbnYUP9bTKUP44W8zVlo7SFTEGmRV52j+oKz8yhfRPubooGHiK7tANlXgAEneWn+WjZwYzMJMZPlNlOg6jGJrtxIkW1pKaHSOm14K2I3YIJPNgxdfl9KPdrsPRxNW6KBd1D/aN9unnuI5TQskNaDapNaoYqEp7H0Eyqht+bb5Bp8u9L+Sj41CxVOjjIfmGJFHKg4UUkaad7zvI6Me2n0NJk4WlBuG7MIcmoPHULd4Qxb4HAEcjS16Avnc8Axov6FNSvkHscy0yVSPtenOoToSMfj03thA3C9CItnX3hc/IeAE/CGdC1tkMhlPwxWztlrdmTHE+A3THE7+sAzSaiwWXV6lPhFUMRm5lvUMbeWIOyZ+ZBMu4/Vhj0TY52XnqvivkANa313O6m+S87D4lJB2Vxv X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: e9de42fa-4caf-4672-dcfd-08d8d382a58f X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Feb 2021 20:28:55.3501 (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: cbhLRwdX4bfS7iK/BExIVvDjZCigHT4cG3e1LUz0yxJM1JuX/LApcM42c5qXCa2ECzWrPPgakUvAjl4RnLETbSA+nUFRI3iVjqBOPTsdeXI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR10MB3940 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 adultscore=0 mlxscore=0 bulkscore=0 suspectscore=0 malwarescore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102170152 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 priorityscore=1501 lowpriorityscore=0 bulkscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 malwarescore=0 phishscore=0 clxscore=1015 mlxscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102170152 Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org This just has tcm loop use the block layer cmd allocator for se_cmds instead of using the tcm_loop_cmd_cache. In future patches when we can use the host tags for internal requests like TMFs we can completely kill the tcm_loop_cmd_cache. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig Tested-by: Laurence Oberman --- drivers/target/loopback/tcm_loop.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/drivers/target/loopback/tcm_loop.c b/drivers/target/loopback/tcm_loop.c index 677e4b8f0642..fb877aec6321 100644 --- a/drivers/target/loopback/tcm_loop.c +++ b/drivers/target/loopback/tcm_loop.c @@ -67,8 +67,12 @@ static void tcm_loop_release_cmd(struct se_cmd *se_cmd) { struct tcm_loop_cmd *tl_cmd = container_of(se_cmd, struct tcm_loop_cmd, tl_se_cmd); + struct scsi_cmnd *sc = tl_cmd->sc; - kmem_cache_free(tcm_loop_cmd_cache, tl_cmd); + if (se_cmd->se_cmd_flags & SCF_SCSI_TMR_CDB) + kmem_cache_free(tcm_loop_cmd_cache, tl_cmd); + else + sc->scsi_done(sc); } static int tcm_loop_show_info(struct seq_file *m, struct Scsi_Host *host) @@ -164,7 +168,6 @@ static void tcm_loop_submission_work(struct work_struct *work) return; out_done: - kmem_cache_free(tcm_loop_cmd_cache, tl_cmd); sc->scsi_done(sc); } @@ -174,20 +177,14 @@ static void tcm_loop_submission_work(struct work_struct *work) */ static int tcm_loop_queuecommand(struct Scsi_Host *sh, struct scsi_cmnd *sc) { - struct tcm_loop_cmd *tl_cmd; + struct tcm_loop_cmd *tl_cmd = scsi_cmd_priv(sc); pr_debug("%s() %d:%d:%d:%llu got CDB: 0x%02x scsi_buf_len: %u\n", __func__, sc->device->host->host_no, sc->device->id, sc->device->channel, sc->device->lun, sc->cmnd[0], scsi_bufflen(sc)); - tl_cmd = kmem_cache_zalloc(tcm_loop_cmd_cache, GFP_ATOMIC); - if (!tl_cmd) { - set_host_byte(sc, DID_ERROR); - sc->scsi_done(sc); - return 0; - } - + memset(tl_cmd, 0, sizeof(*tl_cmd)); tl_cmd->sc = sc; tl_cmd->sc_cmd_tag = sc->request->tag; INIT_WORK(&tl_cmd->work, tcm_loop_submission_work); @@ -319,6 +316,7 @@ static struct scsi_host_template tcm_loop_driver_template = { .dma_boundary = PAGE_SIZE - 1, .module = THIS_MODULE, .track_queue_depth = 1, + .cmd_size = sizeof(struct tcm_loop_cmd), }; static int tcm_loop_driver_probe(struct device *dev) @@ -579,7 +577,6 @@ static int tcm_loop_queue_data_or_status(const char *func, if ((se_cmd->se_cmd_flags & SCF_OVERFLOW_BIT) || (se_cmd->se_cmd_flags & SCF_UNDERFLOW_BIT)) scsi_set_resid(sc, se_cmd->residual_count); - sc->scsi_done(sc); return 0; } From patchwork Wed Feb 17 20:28:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 12092203 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E6E41C432C3 for ; Wed, 17 Feb 2021 20:33:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CA0EC64E6F for ; Wed, 17 Feb 2021 20:33:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235069AbhBQUdh (ORCPT ); Wed, 17 Feb 2021 15:33:37 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:42190 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235075AbhBQUbq (ORCPT ); Wed, 17 Feb 2021 15:31:46 -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 11HKP9xO148121; Wed, 17 Feb 2021 20:28:59 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=/eg8QJ5aV6hrGRyZb+SnIk9I6c1q8Jhcy+lH68YhITI=; b=k0huCKYr2LdPu5bI8k4wpff5HQg7jYAHY0NxnM24NjYnruz+cGxmeEUe+jeLJ0X664Xj LShiFAtBmVz8PCsF9+be60++cKMEY5KGxqzwZ0tUcy1DQMoDPCxRw2vuRQYiPIninUA5 JqUnxb6JU4WdXFcBwNkU3IKBWMheUCKpEBiVzDMdWH2/EBEPgheZ6OoYMWR0Am9xzWve Y++rQF0oKg54bhDcBBvrVLCCPdK/qOcjs0LDm1QM2MOI3k0RzZ7AM7kXoF6bsvWSlcuK FPT1XtpmppRaPXrAipLu9WmWe9Jo4JkR1ckNf8nm+3ynb7ZpuahcpGauzBgLzNXcbHsh 0w== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2120.oracle.com with ESMTP id 36p7dnkpkb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 Feb 2021 20:28:58 +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 11HKPcde113504; Wed, 17 Feb 2021 20:28:58 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2177.outbound.protection.outlook.com [104.47.58.177]) by userp3020.oracle.com with ESMTP id 36prhtb5ug-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 Feb 2021 20:28:58 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dMKqstN4Xl/X9WK0qwICO32C5mRoikF4hmvmoReo99JfKMAKljXokU88EJs5V/DAjq3CnJRPmxHpGhnKPivqYccmvvr3zv6k3IMbfNkXodBO+tB3GGOXUimAkpeKudwHNr4hTzxZpvC0SV2D3fWnoYGPwI4YMM+26dxSIHZU0uBuKa5hFExtd3m9JTLOOHRdUkA9RpFYNRhgPbckMFK3YRtA9SZ4ZQ0omGVSb8qm8BkJwr/TBBjZooTSu7rVjp4Bw1Ovkdr/IrpDVcdej3XDfkQxWOuqUrfHYpU7sy36uKpiEGvz194WPkZi4/7m+jKgoLx/IwXZ9jBTe0dL2MOfCQ== 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=/eg8QJ5aV6hrGRyZb+SnIk9I6c1q8Jhcy+lH68YhITI=; b=itwKHfJgYKIepmPDMrH7gSckUDYACMea3WjOKV/Mccj0cfajGlj4ntgjGgw0+9LM6pGEfGVtdZ123bdAgJ5E4M6XElLBaIqceDidn4+0k+5vchP9ddUx5C9e52Iowc42OxjJ3L8LwnHWbjm9IFIxYYUMK070G/QINZg/Ez1ZULMVvkXO9mOmhED3n2QdmrBMcI2bLDKExUnM3pMySQ3QvhsN/1bPVQr97NX60qktWYHdkRxRsQ6OhbHXe7VYQ4XcA0L+7/d+tw8Kav1yuKpwlpx0O7slgbRU3xrk8aa+hItQ2esGHvwTY8kRzow1TroXJJh3IV7pctjgVG2h6bYndg== 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=/eg8QJ5aV6hrGRyZb+SnIk9I6c1q8Jhcy+lH68YhITI=; b=Hfmz1ZXOvJV6DLVaZXPNh8u0OCZFOVaXKzCz4N+0iXMgJkWCAfrpJd4bn8SqSXDp7yo8AMXqVddmLNLAKvBHIJJFWtVFGkBRS4yHRyN8CikPCciGEXJIp6oA3iSLB2t50OvR7Vg1vumuGCDk5O5/ywJPR/jSS4HyBbW7Y1JHrPg= Authentication-Results: gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=none action=none header.from=oracle.com; Received: from BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) by BY5PR10MB3940.namprd10.prod.outlook.com (2603:10b6:a03:1f6::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.29; Wed, 17 Feb 2021 20:28:57 +0000 Received: from BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::1d86:b9d7:c9ef:ba20]) by BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::1d86:b9d7:c9ef:ba20%7]) with mapi id 15.20.3846.042; Wed, 17 Feb 2021 20:28:57 +0000 From: Mike Christie To: bostroesser@gmail.com, mst@redhat.com, stefanha@redhat.com, Chaitanya.Kulkarni@wdc.com, hch@lst.de, loberman@redhat.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org Cc: Mike Christie Subject: [PATCH 19/25] tcm loop: use lio wq cmd submission helper Date: Wed, 17 Feb 2021 14:28:05 -0600 Message-Id: <20210217202811.5575-20-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210217202811.5575-1-michael.christie@oracle.com> References: <20210217202811.5575-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: CH2PR15CA0001.namprd15.prod.outlook.com (2603:10b6:610:51::11) To BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by CH2PR15CA0001.namprd15.prod.outlook.com (2603:10b6:610:51::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Wed, 17 Feb 2021 20:28:55 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1bb81c92-dfd4-4ed0-36cb-08d8d382a6a2 X-MS-TrafficTypeDiagnostic: BY5PR10MB3940: 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: DQj2KOReF3PmnVXAtl5z9ZKtLCnNFum3H08hmMgn4MXvzkvFj28mlN0ZgTwBn67bEbZ5MGJUucgOXB3PzKycedGE52q+u5jbNgP6pe+H6lWThiYVkZBKUb8ZICtT0E7kCvUcyeOdWWgaVAST/TEoxEnyT/97UbwJGjiqdO1WptayG5D2T/17RgKO8jTxJt7RJnKvG1NGRtMeTi8T8I4trtqInmcPP1LttmGoBKa11a2BExReQ9QiDtkHsUUCobGLXb7XIJRtRIun3v6k6AiMAPsv5xoRIVZ6PREoZ5xVjMVB6ldPTv+elaf0ATZFnKOFQ7XJfIlSJcqsTsbzFSfv0Fg3rLYmBzuRT2KmbR6+79R8JjZWTsiQC41TiXjVZOCG4XWp3iyklrE7wITbS8f2tHMmAdFlYuBHf2wNeqwl3XLpcXi2XhguU730mSFDqSKNnlDYHbLFAmxThdsidA0VCXnVUREWZ5Rf47Lls1MYkwV41te1e+JjNmey3FgHpQJwGBzuig72bKooJgwKhkcjiZbrxVp4ecVTZvhU7VWC9n5LKdsElEnKlPauZUUoTIFOMTm8Fw6Gv7NElJQjVDaqTw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR10MB3573.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(346002)(366004)(39860400002)(396003)(136003)(376002)(2906002)(6486002)(956004)(86362001)(478600001)(1076003)(69590400012)(52116002)(316002)(6512007)(4326008)(8676002)(83380400001)(66476007)(6666004)(6506007)(8936002)(66946007)(66556008)(2616005)(36756003)(5660300002)(26005)(186003)(16526019)(107886003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: KwR5RlO0ZqW6FeR17ZT1FvBO2nSScJhWCqnYolXSD6XDauTwwmT6PcgZtiSbEFIA5ZRPt7/gs9GB4D7Ow+8XFR1GFar4dkOJ43KzIa0Xi+zTbhHLmNbWc2X6MZ77sRzCmclB0npAmT79RqLJkY82Px0ZMiadxjyIM9Pgh9NQLeDRgOdR9+GsSJd2UIAffZ5nQuz/3h/1v8sLtwwXPeh8swJWoIvhgVVwBjeN8G/kNurzoCK02dmTAagpvkCj/D8kTLMBo//muQho56uks4xIQd9e6o+BpKL2ZtlyeemmwvSNSei/kj0efj7Lg4+GJjgIBUNLxBwC5ClCslN+9XdgEq7N7rFJHqL+uLoezi5XXpLtJGwpE9ue8as7ykFuWbn2Gn2GRKvgsJCGwnQk9CeF/VMEV4KSRV+Qi49soa7CviXgiL5MsIC48FESBtfAuvyiiL2P9u4nQA6nhgsAMzn8/WXUn1VE/JDXD//OwniOb6Lx+CLPymjut8NfDEJXjCslnHhlWvPCEj/ynGzo1COA2gG8HBuaEFtm/L0cDAzcScMXQGu5daqYQm5nzJDtnevUH5o6nEHHhdlwvM4HY08zSgbn2IKeoJXN5o8GmbRFYRuhlTXIjJxjowAHHqO6xEQ765QiFORBvgTlBVAQ3b83+CZsFX0G57U7Qd6yZp4zRXTLcTZPhnNgIr51F8Xh/SouY/Mpyrmudd40kRdxMTvP7c1dctTOr1HG7W4bTU3ADs5YV20BuQT/2xAFpgDj7LH84iUS7O6qc581PIDHISc4qpiRvn+9Zd49Fu2gq+n/XzONuM5zStchg5F9dszyyPOLIyxTeINXmARFxu28NbmHz5LPdrXkyLenUXqu3pH0G66BELsgXctyhg3ULLDlZrvnfqLNcFWcLcBfJ9czmrL3riTUBwo796Ek1J+5ZsLQ4g3WJLi/ft0J9UR5ZdmH20qHh1MT94T/s6PNQebgXZm0aQ3x7GfhOeytQF/jAJorI+ka8X2RBCG3pnLSY56n3qoKi2Uxj8TNbx8vdWJ/qUVSsORmj8sxJ5GIdb46EZATbzqYZVZTjAJvRiu2vAZZ4TtJ7JTao+KA5bUZmt8uWMhxfCH/zN9TRkJV2qqBUfeqZ14RkcmUvj5TRogKZC2uiQQfyW4TA/BS8nnSoQT+HctVcUQqJ/RI6ilTePnlj/7mG52Kb5jHMBthL+2+mJDHJX3JezzyqbfgLAzo9nRMu7u+9fC1OjpPLkbFvNq4H0Nr5900wQIgwUpymdgXM35Na39m4ZJyY7wJgZQjsL7/DWx73+Opt0zihK5PBkyTgycNFgOgC96m3JeCtetafvlmJu0S X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1bb81c92-dfd4-4ed0-36cb-08d8d382a6a2 X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Feb 2021 20:28:57.0341 (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: VIAqs0GPBlVRLJvsp5A3tFH3IH7rfymYYANA62TXFZsaWPYewRqd05Kw2LE+Bm5AGYYAYGDYj0H2F8F7XqdycDWSp0kD4p2Rj90N7uD4ilI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR10MB3940 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 adultscore=0 mlxscore=0 bulkscore=0 suspectscore=0 malwarescore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102170152 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 suspectscore=0 mlxscore=0 phishscore=0 spamscore=0 adultscore=0 clxscore=1015 impostorscore=0 priorityscore=1501 lowpriorityscore=0 malwarescore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102170152 Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org Convert loop to use the lio wq cmd submission helper. Signed-off-by: Mike Christie Tested-by: Laurence Oberman Reviewed-by: Bodo Stroesser --- 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 Wed Feb 17 20:28:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 12092219 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 1F0ADC433E0 for ; Wed, 17 Feb 2021 20:34:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E542864DEC for ; Wed, 17 Feb 2021 20:34:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234141AbhBQUeb (ORCPT ); Wed, 17 Feb 2021 15:34:31 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:53980 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235077AbhBQUbt (ORCPT ); Wed, 17 Feb 2021 15:31:49 -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 11HKSusM122843; Wed, 17 Feb 2021 20:29: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=E9Wvj0H2DHQ+uysGDfmPsFtvTmQoayJyUcuQ5991k3g=; b=cBwv51frPbTnrA/ZyLyq3UrXZg4EMD4IxYPEEuDfc2JyyihONBKazvFKWm1VafFEDZLO 3aLHCDz8JGLVtlvdjr8eYDG0J4H3f/dVEVmfVoLQW4bTisMDQQ+RSEqY5XBkwgmRcmZC 9cIe+r3CI7Blm8sF1uqtIHlmC8h33lRtrUFj9zMVJXvDMyexeMPwWPuor/5cqcKXdJ2h BPM8kU9GVgX79Z+Bflu/LiYk2P/BsiE4R2x6dVKR8BXwn+oEPeVDSbxAxXmVeaYTnXxU lXvgAs251+azTB3aj7XUPcz/mvQsiOXTB/lIzEywCZjVtsD/11gjbIWgct6aD3XgV8Fu VA== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2130.oracle.com with ESMTP id 36p66r3sae-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 Feb 2021 20:29:01 +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 11HKQDHk191745; Wed, 17 Feb 2021 20:29:00 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2169.outbound.protection.outlook.com [104.47.58.169]) by aserp3020.oracle.com with ESMTP id 36prp0p6g2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 Feb 2021 20:29:00 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VjiTFmbZSfTodzMNvg+9T1gnwaETrW36D8sDkv4AOGMZbzExLNnLSMfcgXJOIwT998CcDkHTeQmw1FVkXQSD35B/snHvvt14hq956ZIn+E/lhUbheQP6O78alaVYsnqtVB4wTw/vtQ/sCiXJVbCkUttuuNxriQ+FC+LdLKcpEG13Y7svold3oM7VtgUgYYfQ+2sTsVGoTywZtXLFdHosHkMF+IW7Nz6jBPhP1mAilbV6fpJG/FuwKT5aA41Zb+FKHiGeBxFxbx6+x9sPkG8ww2+8CBCpiFFvAz1ccnsyBfudXcBd2VHQo4DtFWapUvUDsUukiQKjXOaeTkndMuOpWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=E9Wvj0H2DHQ+uysGDfmPsFtvTmQoayJyUcuQ5991k3g=; b=QRP1a6oNJBTI/APSpF5wg7uIaoy3gOxGeHeQfuLh2XPbj1C6BucM6d4zGITAsspHlbMODHl9GFMDPNUhudynFmfg55s0mdqC0PFHyKzE2lfuzC02bj3aA317i9HMFvSPG9hNLeU8c58hm5bxTjp7GQQgc8GP5i9TM8B//l1LW2EsurRLminWcyzLnyZuAVo8itUGhQ6LL9LqZueRCgZkNLnDLEamvFct2tSK+uYEeHhtxRhyveTWH8aYixbdxpwTNtml07/6bZndV4aG4y0cBAZBN21Ch+B5w6LiTMBG4m7RpiGmokwla1mkstBhFc+2qgWQgc3jdRrHsaikn/fUWw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=E9Wvj0H2DHQ+uysGDfmPsFtvTmQoayJyUcuQ5991k3g=; b=h98uM/zuHfd6o2SislanQqW0L/0JiL9haf1oU6vRxpPSKUFsdCNT1iHYe11tdJ5V8tlbmbmS1HRh8xuIIRC6VQzFJtf3dskL2iN1BBpYRXqxmmf41xoODsFUMqWxM3bEZmSWZxm8XFemRktoHS7N8TG1Py5Pcd4C8G1PNSIrqac= Authentication-Results: gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=none action=none header.from=oracle.com; Received: from BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) by BY5PR10MB3940.namprd10.prod.outlook.com (2603:10b6:a03:1f6::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.29; Wed, 17 Feb 2021 20:28:59 +0000 Received: from BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::1d86:b9d7:c9ef:ba20]) by BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::1d86:b9d7:c9ef:ba20%7]) with mapi id 15.20.3846.042; Wed, 17 Feb 2021 20:28:59 +0000 From: Mike Christie To: bostroesser@gmail.com, mst@redhat.com, stefanha@redhat.com, Chaitanya.Kulkarni@wdc.com, hch@lst.de, loberman@redhat.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org Cc: Mike Christie , Chaitanya Kulkarni , Himanshu Madhani Subject: [PATCH 20/25] target: cleanup cmd flag bits Date: Wed, 17 Feb 2021 14:28:06 -0600 Message-Id: <20210217202811.5575-21-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210217202811.5575-1-michael.christie@oracle.com> References: <20210217202811.5575-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: CH2PR15CA0001.namprd15.prod.outlook.com (2603:10b6:610:51::11) To BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by CH2PR15CA0001.namprd15.prod.outlook.com (2603:10b6:610:51::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Wed, 17 Feb 2021 20:28:57 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 06fc5207-f442-441f-f8f0-08d8d382a7b1 X-MS-TrafficTypeDiagnostic: BY5PR10MB3940: 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: rpJKhRT1gSGvQkaopZpcXbAvvekuWQhaLRlefB7Xs2YUuMRjQGILArmDpasU1qQnXOlRyNEGEVIO6Tnm3pefz8gAs1b1o9Cb9s1o8Vv8zbFqrXIvp1R1P+b2KPGl+ma5RjTsq2SeAgsa064FUSEZSytF1CTHMD77RzW2zL+S0QH/04zdztTSRXdPgZXw4QXHEZYw3swrqOTJ+nNk5YKNKVC2kRDXKPr622EtP+Ox17CKNDzhNpvsE96M3UXhkE2g8it1Nicoq0GSCyTkir198qoLsHRaxw/Bh/ORdqaEm+e+GPFKgOC5pcAuaGQWm+UBDd0kgXYGb5n9xSlP5ZzWNyA06bMlVnn6NookEmPaJkXncIC3N3uSw1zpb86AcuYq/oTkKI+KVf1u/cq7Q85cTbF51fX7q7xq3E/JHJ8s5uHcmTCDowMw/831sGvCIADQOEjuoAPF3HtqmOaJqK2OKkg8MeXYZkwNYzVG7oE6K6a+QT8PP0lkToYUY0wGOsCjgqdoqEkkBqo4jk+7u2UcFwqbH5e/I6fNtKdMVExyCOr+xOFuWdBJkF3zM7Zaw6sxPXWNZcnipI5Uh4hQ3WQVKA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR10MB3573.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(346002)(366004)(39860400002)(396003)(136003)(376002)(2906002)(6486002)(956004)(86362001)(478600001)(1076003)(54906003)(69590400012)(52116002)(316002)(6512007)(4326008)(8676002)(83380400001)(66476007)(6666004)(6506007)(8936002)(66946007)(66556008)(2616005)(36756003)(5660300002)(26005)(186003)(16526019)(107886003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: SLs7TimWMI8HzS2qik0erdZypOMNBCsSLDYjSgyS45bCqIVLm5fEYZOJ3Gio6UbhwVq+CkN0UzRHEtDdvcSj96bpvzpFWXuCcCmaabnzC6fN0KgygMJhBlxSh8F7BSBp9Fey0Ue3aFA5jiQ7Lc8qjR6utubcL9au6iJ6bNvgaDByA5BAguFRJJqJtrKP/MxrFt/qBk16K0Kt5K1h/AGScyH2rsrU2CCUh+UrUVNEpChHip1iEtNpEg+ZKN58ch2vHA5eo6zszbRC4mkeQfCwRG7TWmotdCYei7MPK7R1H/yLZDakX8ydNGQIy9yAKJO9frZMT/l2hziFSQKUq+1/h+gzKrvVkOqdWW4mAbsfdgiGHdaBm2VXmlqv+xlqI5/Z4toThZ1GDo8bkoLS2TrRw0ST3Lquab7ER/gz798oCqSFy50wQw1Kg79VP5nohy7xHMe6RqalJ948bMAPpKdhKpUVdfzLB0n5P4OKF8Nshjn5fJcn0CbouJEx6wp++YpUU6EozAEyTHmzAenzFB2EDg+F5bGkHDV4icWzTI1f+UcGxbwBasuINaDkPaIKPQ+uDrmHmYNvDadbIsW88rzxppBuhRk2npWQo3rNId8L3f35e+BNwEO9jYs8IAFMibsmNhCFJvI2sx4KdWI8UTr4WaO17wmWJneaNxaUKPTdqRPcUzG6d8QB9XNU4xnHz/YIO7dWPI+R7PtEH9/ugSimlRWHC6HuHxWsCKKyHo0e7hO67jVRQeMRHABwE8hWfgRMh3Xrh+0Z3ocQiNJMfBrJ9yFcTK7LLP7QhD4pdLdPrzC9ELW3yOLBGrWhFcPQcWAWBmigf2Lt34QjQ3JqFehoLBpDkyV85Hm94viY4ccz/utkAaQJz9yloAKfajaRDKplCCarASQ/iOkJpZbdjRAcASH3x9i/wCr62O0UP+hn9Y6vhyn6+7iB4GWbPf0kmN2ANyBR9C4VTdducYrFAUd85amWxG9WDIcXthGwhXH/Xib9HdJ9dtbLwHLA5F5FfoETsvq6YBSlc4SuCAUFOLwxC46FiIST8+0sqYnmxeQQ+j47LNr8kvArtVQH5QHjWNDPSvC7RgGTnX4zL7E4HL7EKJEfUfjikJZtmKou2Cl6nfCsDVT+vSMXzGkOhz475CfeTnXC8qGksgcRSD7htMcAr0G0/cYlg602ebAdbGYdtr4wlKUbdWQosLY054y4BFtXtH+j0dU0XcOD/I5Me5xu9SXtVaQN7iGPnIhN02asvZaF/hC+kGUzF5BFAjoXVKf99WhcBqn6qsRWh8T4RgqdQWtNnGP5JO6/ujQWY7GLCde7GjZmgXW/UFQ+CdI56Xfw X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 06fc5207-f442-441f-f8f0-08d8d382a7b1 X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Feb 2021 20:28:58.8891 (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: WOnHSWsRBgwDED8k1ASw0h9FtYMOlFQfQxEh0R+WewSTMTJ+5u/GpNxnkXAIk8L4Q3eXtsowmCyqj5xqizdLazzogQXg4AvRwKWvr8syopI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR10MB3940 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxlogscore=999 bulkscore=0 suspectscore=0 spamscore=0 malwarescore=0 mlxscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102170152 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 suspectscore=0 impostorscore=0 priorityscore=1501 clxscore=1015 spamscore=0 mlxscore=0 phishscore=0 malwarescore=0 bulkscore=0 adultscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102170153 Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org We have a couple holes in the cmd flags definitions. This cleans up the definitions to fix that and make it easier to read. Signed-off-by: Mike Christie Reviewed-by: Chaitanya Kulkarni Reviewed-by: Christoph Hellwig Reviewed-by: Himanshu Madhani --- include/target/target_core_base.h | 38 +++++++++++++++---------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h index 815de4c97230..5e6703ca102d 100644 --- a/include/target/target_core_base.h +++ b/include/target/target_core_base.h @@ -127,25 +127,25 @@ enum transport_state_table { /* Used for struct se_cmd->se_cmd_flags */ enum se_cmd_flags_table { - SCF_SUPPORTED_SAM_OPCODE = 0x00000001, - SCF_TRANSPORT_TASK_SENSE = 0x00000002, - SCF_EMULATED_TASK_SENSE = 0x00000004, - SCF_SCSI_DATA_CDB = 0x00000008, - SCF_SCSI_TMR_CDB = 0x00000010, - SCF_FUA = 0x00000080, - SCF_SE_LUN_CMD = 0x00000100, - SCF_BIDI = 0x00000400, - SCF_SENT_CHECK_CONDITION = 0x00000800, - SCF_OVERFLOW_BIT = 0x00001000, - SCF_UNDERFLOW_BIT = 0x00002000, - SCF_ALUA_NON_OPTIMIZED = 0x00008000, - SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC = 0x00020000, - SCF_COMPARE_AND_WRITE = 0x00080000, - SCF_PASSTHROUGH_PROT_SG_TO_MEM_NOALLOC = 0x00200000, - SCF_ACK_KREF = 0x00400000, - SCF_USE_CPUID = 0x00800000, - SCF_TASK_ATTR_SET = 0x01000000, - SCF_TREAT_READ_AS_NORMAL = 0x02000000, + SCF_SUPPORTED_SAM_OPCODE = (1 << 0), + SCF_TRANSPORT_TASK_SENSE = (1 << 1), + SCF_EMULATED_TASK_SENSE = (1 << 2), + SCF_SCSI_DATA_CDB = (1 << 3), + SCF_SCSI_TMR_CDB = (1 << 4), + SCF_FUA = (1 << 5), + SCF_SE_LUN_CMD = (1 << 6), + SCF_BIDI = (1 << 7), + SCF_SENT_CHECK_CONDITION = (1 << 8), + SCF_OVERFLOW_BIT = (1 << 9), + SCF_UNDERFLOW_BIT = (1 << 10), + SCF_ALUA_NON_OPTIMIZED = (1 << 11), + SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC = (1 << 12), + SCF_COMPARE_AND_WRITE = (1 << 13), + SCF_PASSTHROUGH_PROT_SG_TO_MEM_NOALLOC = (1 << 14), + SCF_ACK_KREF = (1 << 15), + SCF_USE_CPUID = (1 << 16), + SCF_TASK_ATTR_SET = (1 << 17), + SCF_TREAT_READ_AS_NORMAL = (1 << 18), }; /* From patchwork Wed Feb 17 20:28:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 12092215 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B5577C4332B for ; Wed, 17 Feb 2021 20:34:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9CE7764E6C for ; Wed, 17 Feb 2021 20:34:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234489AbhBQUeF (ORCPT ); Wed, 17 Feb 2021 15:34:05 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:54036 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235079AbhBQUb4 (ORCPT ); Wed, 17 Feb 2021 15:31:56 -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 11HKSusN122843; Wed, 17 Feb 2021 20:29:03 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=T/mfCz2B2yf+pyu0UO8gOcAyTJtfRUnjR5aeIRoe9pA=; b=AMDbxcafbhOKHXBEuKCsuTpVDrNOEVaJB13LwJ37PYNabm0OiPPkAOr+ED1RmgY9IIJC E2s9yjBcDUQ83v1xPxrl8o/iU3Oj2jiJdWftqTgNN5YDm/y5jHrX/dF98xqsTtyTGy7l /QklWo7gdIQ4vtXoRM7OUGINLcxsX+hSIDMyaIJ/5TwUp5hh6G0KQzMU8k4yu9HxPW+r d8TyuERbwwLlP7Mnaq7JAmHCSLl3qwH/CCWkZd0PrlKe7TtJyCqewNTuGHpLb0qRQDl1 qRJHSpCZPETBE7Lju/Z5X+Rpy6BtgmXrXjg7YjQgH611l01+QaN+22gVJ97RthmDoQPn Ig== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2130.oracle.com with ESMTP id 36p66r3sah-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 Feb 2021 20:29:03 +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 11HKPbbj113321; Wed, 17 Feb 2021 20:29:03 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2168.outbound.protection.outlook.com [104.47.58.168]) by userp3020.oracle.com with ESMTP id 36prhtb5x7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 Feb 2021 20:29:03 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jiy6/6Ww4/VUIvQUQMUVX5aui0ZyYE0sD6lM+eOxm1jgg6GK62f0CYQpC1Up/l47njmsICammKqoSq3gj8RyBJKZKWPbuYFkxO/0Uf4x8/c7Lw6dz2FPZoXWJtqktw1XuRmY1cXwD6xroeiIWxXMWvJCYiekxFO/DdF+nFijX3IT6j2HR1srjCoTWixPMoQ5Ta0VLMPmoaZvl0xaDAGTklGVNOPqa/9FIcPK7eqEtXWAeMptbAfI6uXhZyJg7ObJlmmunl/xmA+mOfPAsQQBxg4uj4rOM+9/bVUFlLLsOaOt0ui1U6KZy3JunEtYyYsHGUtM7mqmoYVKoSDwM91PYA== 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=T/mfCz2B2yf+pyu0UO8gOcAyTJtfRUnjR5aeIRoe9pA=; b=brpK5Xl+n3+Ko4B3c7PaiqsriNbPFloTnAhxQKyJN7FAYx1VsBkAAqAWdEbvSmxZ8loOnXH4loKBRvWe59KSewmlUBQkVZ06OWSQ6QdZ0Q3+04oHB37MLXYCQz2Fe7h6rBOp37tWvbqHE+rgPPbl5b2MKX6HdsY/PKYsr3//3HD6HjD2/ltkfjx0NM9xlyHbtGyYHsuKXtxicEsrQ70yc2ArvMEsNarezT4aCuJ1o1PNRXa35vfaOTbeB34uxewBLdZrfPL2i9v/I9uBCIURTTQH9FasLRwd4rnmkJSLM0M8iEb44T9cdT3gThE5yhwATMXpYo/M8bMIraTgqV+b+w== 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=T/mfCz2B2yf+pyu0UO8gOcAyTJtfRUnjR5aeIRoe9pA=; b=OQ2pY0Tn5jNw9sn4Q0j5pQy5BmeuZ9Rm90AGQLJGVqZ2IHfLBZjbLgwJORvTEitAOwy3YGJ98gjhZDWimG4jO7k+bYop963T0panb7L1do+mlLQH79nIAQMJmXRqiHR/Zk8OSAfbaCIFHtHG2Ui2M0BQ7ZiAcl8MdncJPXXfGiU= Authentication-Results: gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=none action=none header.from=oracle.com; Received: from BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) by BY5PR10MB3940.namprd10.prod.outlook.com (2603:10b6:a03:1f6::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.29; Wed, 17 Feb 2021 20:29:00 +0000 Received: from BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::1d86:b9d7:c9ef:ba20]) by BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::1d86:b9d7:c9ef:ba20%7]) with mapi id 15.20.3846.042; Wed, 17 Feb 2021 20:29:00 +0000 From: Mike Christie To: bostroesser@gmail.com, mst@redhat.com, stefanha@redhat.com, Chaitanya.Kulkarni@wdc.com, hch@lst.de, loberman@redhat.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org Cc: Mike Christie Subject: [PATCH 21/25] target: fix backend plugging Date: Wed, 17 Feb 2021 14:28:07 -0600 Message-Id: <20210217202811.5575-22-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210217202811.5575-1-michael.christie@oracle.com> References: <20210217202811.5575-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: CH2PR15CA0001.namprd15.prod.outlook.com (2603:10b6:610:51::11) To BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by CH2PR15CA0001.namprd15.prod.outlook.com (2603:10b6:610:51::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Wed, 17 Feb 2021 20:28:59 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8ed784dd-4af9-4ad5-bb13-08d8d382a8c1 X-MS-TrafficTypeDiagnostic: BY5PR10MB3940: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4125; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: EGTHb10c9rzzmmDo7g0etyF2oV98jCk9LkxTNsTd7XKWrn4LXVcffYVvmb8qYSr8U27rgfxpCuWgONa4JNWCCcUYHIsx5iniJPnnL+1LfuU9aYlrXtxnxaHMLR4UpUqkOHAlbdmw32sjYpyNchu2jJKI4YTmay7rV5fOVsuj+/TfAh4Vemxli5QWLNbpKUle12v4cvDe518o9Sl+uz88Pmr+iXhcK7xqNS6EoaoQMKATJGRXJMFQ88ZzMSC2VJnFKGDz6orBXtRYfY3wxO8LMq+tCiKWR3uxARQF40X9pwpR8nURJySJx1uSyJ1UtN/tUhG2C6y8BlxUwhZ87UoLTHswQNV2gY9/lWJhDghNgFVV2c5yE51OFLr9ZsN+OYyLqpr2qHYb0TRu2f9LejZzl++rn8DvCVbUj0+KVD5BLS43pKpluytZc14exqv4DsmGsJsp3Uk+Ik9OO/awaVTbJFefT5+HGhDgDxsJyIiE087S5JkCAod8LRdvmpAL8YLl6OkjgtEMzcPCH65If2hJPSys7NIXHCgRgP7s8LYzY6yl5kly1J2cQvk6+ZdB9tCy6+MBpAi7ktKf06/YQaN3bw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR10MB3573.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(346002)(366004)(39860400002)(396003)(136003)(376002)(2906002)(6486002)(956004)(86362001)(478600001)(1076003)(69590400012)(52116002)(316002)(6512007)(4326008)(8676002)(83380400001)(66476007)(6666004)(6506007)(8936002)(66946007)(66556008)(2616005)(36756003)(5660300002)(26005)(186003)(16526019)(107886003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: j8NxoP8YwpLezjf5jNeNcokdCbwqdGSNU1si3rCf+t3EG6VXgTc/JkLJ0Gb+I786a5ezLi6aMuIrEr+P6Amh2w5bFJG722u43IJY710ZCHbzbEFFM6xFGAuoXxVa4o4dKLeHeonJrvtwBP9iDx+lNhCROwrQUHVU94swmKZ9AIXPaGfjqsGIkDS7IEOf1WwPowcqs8rfqxT3/jD3NVrgHWOAPx/LbX+JrB3qHRxFpIno6qVpyIDHjt08n3c5oM46a2goaTczdHRfLX8xPbV1EaYjPlUmGYsEUbZwMicgoa4C6mlWdhuJO0cQmG/CTlZX9UfKzv7f5JeZxmkVyamv6gaFi52w3Xa0MJqCpbGn9pS5rGlsDNN/hiY1VF2OHNPcbgEL4CpwcY/+XpvpLQqhwlrFROCB05fqv/0aDovS56tkSRme/ZAiY5AUe7MTqWh/aG8YFDYbm5ATd5L2aIWsykZDaPa+6wIgivFFpd5k1ZdLfuKRshNGnwDsm0lWGRt4SG5K+QinKt5VuKRJIGcC0y7t8rxz3o3dPI8qRrk6Lt2gSDs0ED1l/Z1Pl3OtwWq448H+WvyFI0qsOkq63v0ho+azHPmqqoTOPD6Ar9mxrSQf058qVuhn/AUHUspJm3924G+p6/bisXOzT29YI0BcMAjmpistCV0t1RMtabmnejetKpPGrPao5vC1x5fs9rl09evT0QtN5iM8ZKh6u3x4RttegLA0K5pmBoWRXKboRcXBkBwkykbHGRQCuffeUxm1OI/Hw7QXvH4PNsmHSKZDidqIPdV4zYYf5SAe2wOHnzLt02NWWdA+2632XgX0DcObkTs6nZWejtS/Fe0z3rtO3t8O7wsdWJvT4G5Ru7rEPob4qvnKzKoWwh9V9f1IBDiuQ6DEM3G9S6uHB65TQW/99t76CRupxwSxoibwIXq/aXV2a5mGs6sKCKqnf4CEOJjZdVbo6syh2OvPIMdhsqBajSvTYWnd7DzPqnMxF5P3cxHe3qCx2xYsVNjxg6HI2+8OoMebMZ0a57khQFC0Q7ZXsgkUVK/OKW7cuKuR7u6UNnKwbaWaBUqaN7PNqU75fPk46sfiVTfxAbkTknAvFsy9eZJ0muaYwewVcDyvb0LeGLElzF1qoDhzCmLbdz5Wr4CsWyqOV6vV/lVIvJFZHmG22XC++PAHeGAc9rulpfr14NrOjmml0VOndlwh+rrXJoMW3ItTz5UC5YaD6UZeAntx9Mv7HX7v2kaoyGPp5DkGg+ntQ6hhtLi5udfKaqPtzJkQfhwnW9CdaR/MpVb14JlIp5V65p+SfO2VtV2KoHlG8evTFInqWIKfhFs2zpjK2MI4 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8ed784dd-4af9-4ad5-bb13-08d8d382a8c1 X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Feb 2021 20:29:00.6871 (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: zPxWGdW+ceza0uBPwNcd7H2ssCJNQPb54yOU9w1YyvKJhgYFi8QC4AVlYOYc4mxSM4fXQjU1pynXCWMoOHD+wq65p/JQ4eYXi9ST8CWrz4A= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR10MB3940 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 adultscore=0 mlxscore=0 bulkscore=0 suspectscore=0 malwarescore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102170152 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 suspectscore=0 impostorscore=0 priorityscore=1501 clxscore=1015 spamscore=0 mlxscore=0 phishscore=0 malwarescore=0 bulkscore=0 adultscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102170153 Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org target_core_iblock is plugging and unplugging on every command and this is causing perf issues for drivers that prefer batched cmds. With the last patches we can now take multiple cmds from a fabric driver queue and then pass them down the backend drivers in a batch. This patch adds this support by adding 2 callouts to the backend for plugging and unplugging the device. The next 2 patches add support for iblock and tcmu device plugging. Signed-off-by: Mike Christie Reviewed-by: Bodo Stroesser --- drivers/target/target_core_transport.c | 43 +++++++++++++++++++++++++- include/target/target_core_backend.h | 2 ++ include/target/target_core_base.h | 4 +++ 3 files changed, 48 insertions(+), 1 deletion(-) diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index dd63f81bd702..18cb00a1ee2f 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@ -1805,10 +1805,42 @@ void target_submit_cmd(struct se_cmd *se_cmd, struct se_session *se_sess, } EXPORT_SYMBOL(target_submit_cmd); + +static struct se_dev_plug *target_plug_device(struct se_device *se_dev) +{ + struct se_dev_plug *se_plug; + + if (!se_dev->transport->plug_device) + return NULL; + + se_plug = se_dev->transport->plug_device(se_dev); + if (!se_plug) + return NULL; + + se_plug->se_dev = se_dev; + /* + * We have a ref to the lun at this point, but the cmds could + * complete before we unplug, so grab a ref to the se_device so we + * can call back into the backend. + */ + config_group_get(&se_dev->dev_group); + return se_plug; +} + +static void target_unplug_device(struct se_dev_plug *se_plug) +{ + struct se_device *se_dev = se_plug->se_dev; + + se_dev->transport->unplug_device(se_plug); + config_group_put(&se_dev->dev_group); +} + void target_queued_submit_work(struct work_struct *work) { struct se_cmd_queue *sq = container_of(work, struct se_cmd_queue, work); struct se_cmd *se_cmd, *next_cmd; + struct se_dev_plug *se_plug = NULL; + struct se_device *se_dev = NULL; struct llist_node *cmd_list; cmd_list = llist_del_all(&sq->cmd_list); @@ -1817,8 +1849,17 @@ void target_queued_submit_work(struct work_struct *work) return; cmd_list = llist_reverse_order(cmd_list); - llist_for_each_entry_safe(se_cmd, next_cmd, cmd_list, se_cmd_list) + llist_for_each_entry_safe(se_cmd, next_cmd, cmd_list, se_cmd_list) { + if (!se_dev) { + se_dev = se_cmd->se_dev; + se_plug = target_plug_device(se_dev); + } + target_submit(se_cmd); + } + + if (se_plug) + target_unplug_device(se_plug); } /** diff --git a/include/target/target_core_backend.h b/include/target/target_core_backend.h index 6336780d83a7..aa5f83e55501 100644 --- a/include/target/target_core_backend.h +++ b/include/target/target_core_backend.h @@ -34,6 +34,8 @@ struct target_backend_ops { int (*configure_device)(struct se_device *); void (*destroy_device)(struct se_device *); void (*free_device)(struct se_device *device); + struct se_dev_plug *(*plug_device)(struct se_device *se_dev); + void (*unplug_device)(struct se_dev_plug *se_plug); ssize_t (*set_configfs_dev_params)(struct se_device *, const char *, ssize_t); diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h index 5e6703ca102d..b8e0a3250bd0 100644 --- a/include/target/target_core_base.h +++ b/include/target/target_core_base.h @@ -769,6 +769,10 @@ struct se_cmd_queue { struct work_struct work; }; +struct se_dev_plug { + struct se_device *se_dev; +}; + struct se_device_queue { struct list_head state_list; spinlock_t lock; From patchwork Wed Feb 17 20:28:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 12092211 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 914AAC433E9 for ; Wed, 17 Feb 2021 20:34:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 72A5B64E6F for ; Wed, 17 Feb 2021 20:34:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235090AbhBQUdp (ORCPT ); Wed, 17 Feb 2021 15:33:45 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:54026 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234244AbhBQUby (ORCPT ); Wed, 17 Feb 2021 15:31:54 -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 11HKT4QE122959; Wed, 17 Feb 2021 20:29: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=vkI7pVbjPpUYMdhGnmWZkin4Vzj3OtMnjwsUvl1/w24=; b=RADSiTgy247b4heXs3WDAB428MrpmRqtBp/OVbROoA/RhUHX1rfyHF4NKJlbIibo9rz3 kwonGSareSKNjj9Y/pNpaJYiAv128ulb4uZ7cV5A0FSvY38UFbuW6ZYDSF00PUh+69A9 BufzzJsyHkUdW3EL6PF7UM8W/Ck7mMzWnW761BK6HAhOoabFI0W2oaruep9s+TLMd8QR 4dL20hvyfhBaoptPit+V95HwhvWckzck18FkeN3JN43xTEBY3shwufqdn1iGyWebOYo0 ZJunK+RCf7oTgoBd71vbYmMHes9N7V2DXgGIP81x+Wpsrx0N4lEwuakRzO/YfV2WtaVI Nw== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2130.oracle.com with ESMTP id 36p66r3sak-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 Feb 2021 20:29: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 11HKPbbl113321; Wed, 17 Feb 2021 20:29:04 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2168.outbound.protection.outlook.com [104.47.58.168]) by userp3020.oracle.com with ESMTP id 36prhtb5x7-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 Feb 2021 20:29:03 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=k6pF9u8k5thzbYuyUBqR/eeGXvHQVETMUssutE/QqG9275E1cMRpW4/Fp39IjlnnMrS6LCIHPURbfm+6tbt7thw3PpmcT5LGH2VZCoxSiFrojIwMkXYjNRJJyUgYlda7X5In6RV7nOONhJpYwJQrIFFXS9vlnoFyuxTbaM/eicCqLoRNgTFMbNhTDotLMQhcaVgkXl5A1j4PT2NpXDnWSIlVeQvTzS96INM6WJbZzYirGB41jAzQOp+uRUuBR9uvK/XVPeXNZ7CZqXAIj95K/RHGwqurGDLLorAjlT8syiUysGjOS2FDz38qTo9t2xaxTsVpCVAv72eGlaTnKJf0Gw== 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=PQzwJb2SyeHMmR8cDQlXQ5MOusxqGNNv5Qib2EBsk5uqQYviwrUNecqbnlTQkxUxS7osRebnJZqvYouyeHaI1mWchOpLMBGZF/JkIimMg/sir5qpDl1bdBvbSyO+fiquX7XOFrVjkV1vbIor3Uxu++m9Rn4emtBa0X42F/Gk47DRStHvS0bKngGS6R9xTnk0qYBtapnP5ZAewlJ4kIic0v1bFYTaMgfApUkasYnWRnYqAp1dCO3zSKdvWitdb2ErG6So0uZUUsQrEuGGtHbARqWjqXP1c1firY7GhzLHvcL8VSy3TsIifoGzAFAIVjtLIe27upDY/2wEI0ZVqGkGLw== 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=shkebcU0ap9RWqiPrfoclXgQ/VKEUpzt70z9AHeIS3aILulS4+N6zLcpSiZyvbCdjjPP2ksmd4c8XJdUvWEp48Io3zAJk5GT9+5ukLWdDdmeCgpn5sPCqx/RepeAiB4T50jncBno6nNWp8YVp3lAmWgybRdBAPpb7GOx57YTsJk= Authentication-Results: gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=none action=none header.from=oracle.com; Received: from BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) by BY5PR10MB3940.namprd10.prod.outlook.com (2603:10b6:a03:1f6::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.29; Wed, 17 Feb 2021 20:29:02 +0000 Received: from BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::1d86:b9d7:c9ef:ba20]) by BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::1d86:b9d7:c9ef:ba20%7]) with mapi id 15.20.3846.042; Wed, 17 Feb 2021 20:29:02 +0000 From: Mike Christie To: bostroesser@gmail.com, mst@redhat.com, stefanha@redhat.com, Chaitanya.Kulkarni@wdc.com, hch@lst.de, loberman@redhat.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org Cc: Mike Christie Subject: [PATCH 22/25] target iblock: add backend plug/unplug callouts Date: Wed, 17 Feb 2021 14:28:08 -0600 Message-Id: <20210217202811.5575-23-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210217202811.5575-1-michael.christie@oracle.com> References: <20210217202811.5575-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: CH2PR15CA0001.namprd15.prod.outlook.com (2603:10b6:610:51::11) To BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by CH2PR15CA0001.namprd15.prod.outlook.com (2603:10b6:610:51::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Wed, 17 Feb 2021 20:29:00 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 660e98d2-e01c-4dda-3d22-08d8d382a9c2 X-MS-TrafficTypeDiagnostic: BY5PR10MB3940: 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: HGOyfvMoGzc124xJGBIUUA8D4PWZfrlB9VMrHQaEER8pECtkOkNaz9DjZsLvPgkhK2zMXd+KVLXyn95HG08u//Zp3RyJE4GLcFHK3t/UjE6JqLODXFhaj20FMdGkp5m+qk25nLKEqXDmKFciOfq87DSRfMytr4ppgULvYT51kRxQsP+3Fsqi5J1rkxc/ScyUyXzhGyCrSkPsYD1Oj4fF0kxsHzlpHKrzvelU9IWfKeDgSKhw+/q3NEXsm/85l3BJCpuqgfQHz+iEb/77T8jZSipHbZ9kixfopxu2Mu5yp5Ape9jJE0MOI9uX6vBOe0kDaUtjysV3EonOSCHuM7iWDPKlSOJeb0O9ELpnhRYYrrth9lb09oVQmztFiQ487tkQG/kEuLHt8JPo5apm0XKExxR8iuhBqMl/qJPYNtwgB57Cv/nBAVE2Kd0BkgQR6+Xn7Mz4l89e8B6Z95cU905DfKQfcAXizq030dFGsexsrv34orYvlQoNWa0Y52N6BefRSYlL8sJZ6r0ZzCoGuwPtSogr2BoKJPMO6wdfze1195mmZ2SbUzuBRJJ2n4rBb4Hb3zvym7VfFAag6VO7Gm8rkQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR10MB3573.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(346002)(366004)(39860400002)(396003)(136003)(376002)(2906002)(6486002)(956004)(86362001)(478600001)(1076003)(69590400012)(52116002)(316002)(6512007)(4326008)(8676002)(83380400001)(66476007)(6506007)(8936002)(66946007)(66556008)(2616005)(36756003)(5660300002)(26005)(186003)(16526019)(107886003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: eE4f4PqMK9pTKoG50suNoHrkmGcc+TSAwasjWJC+J1Xy4LndUEw+j3V7iGxE0e6GC8RlAskoVDdEyO/BmYUtUxVZx1tQWcY6uhlsqgNdF7AfgxpQjOeEEaSDDIEuZWv110GwW/CgggtB28fPkyKDiuF7nm5hgxGUjUX40lwKt8gyhkl3S3PAH5KYPqvXXjfoHuxn00E3UEpvx4gN/SygKTYwu7TCbSzO/Xj5EA4pQ60nstz6+CpvzK3tOUe5GuXaE6LNpyeyEKwT5gyG4Qjsi8iIjaSnqCQUKxDlw/6CwNhBK06WAegOqpjgbcxA1NoBPimgg4PSyE8IoPU8o6fqu+mUv/VWZ0fxlryIzl5yxqwS9EqwOMts8zW4ifZ00U7v7EjyLWtfCQDN8Ou71o268JtO443WSPxWy4EO/7GcZ68gCWMuyJ4g8aTbn5rYtqUSOy+JvoIe2nS/7FWKvji8NpbyN98CW/1hBoRlOm34H680Rh4QrsY8+dgEuPD5XD4pYfkDBnClwHqK/foB5AbYdisQc5198FQchaXuRjIhNiTIC05cAEmUYsmNv0FYPt2OmsHy5mJXTowyl20pZ9MaADaRGX8l161J769Hm+Ovro0j/sVTJbvcAzPAASM4LJD1yw923p+ktmuS804HsXvJUv/TkovorOBf2QyG7/KLj9Apqd2sdzl8rg1YfmZGkpUkUpcrRwF77eB7ItK7QQ3YIIVuRy9v93zXbovhqDPE00EYG/OENysW8cYjjB9Hb2coKnwEt4kU4kxHVLMYzvMKuxpCctXr+m1X252HiWgT1CeCU9M5P5OkOTm1/+JLTkBOYfz1MLmFoOZbnz5qhJj+66a0zFYEv2gpbLumSwTXZbp6DrOvVfTQtVM9O85FaEtcEf69K9TdLxSu82oE97WgeVS/tc0IDcKLTB1Qwy3OESj5FtbT9CzdECvzJSxp2LkPM303ouoIah6YcEMJ3rTiCsYtYyilwjl1fPWtDwSclwr5Xpo0rCbor52RWJApChVfkMtiJa8GrTIfgEI7g/lL7d1Zaf2Q7YhOnPw1FIxytfJ0ok7acl4mVK9uHu0UOoubFF4ErXOT0ob6wvso/4MpYkfXsIc1IpPX6jCjylyrv1dznrX+rsSUfEDc6E/rVN3NrjT0Je7P7oI1m63inJ885ui/wFWGJoXbqg43sJXyGWzQ5mjc/s3nXR8PkRmxsXW1UMlrCLKDWLm5He9anMT+2o9w0mCgBYd0QfOadtekaZ3wxf6qkRKMjXu31W6V5El84VHiGmieqvIGphSSG5JSDLQBxS+JTh/x6xfnmt7KB3wH/Iu96+7o46gblevtGLfx X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 660e98d2-e01c-4dda-3d22-08d8d382a9c2 X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Feb 2021 20:29:02.2502 (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: u96NpmzAgBZOm1ORvNOU4Us/69IybpMzfb4gXFztxzdPlwVVh1sOPaHF/CYtBrs9QwOXdNbyFwK9jji3/QE6qQdKuhYkAn9GJhrGVENQSj4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR10MB3940 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 adultscore=0 mlxscore=0 bulkscore=0 suspectscore=0 malwarescore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102170152 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 suspectscore=0 impostorscore=0 priorityscore=1501 clxscore=1015 spamscore=0 mlxscore=0 phishscore=0 malwarescore=0 bulkscore=0 adultscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102170153 Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org This patch adds plug/unplug callouts for iblock. For initiator drivers like iscsi which wants to pass multiple cmds to its xmit thread instead of one cmd at a time, this increases IOPs by around 10% with vhost-scsi (combined with the last patches we can see a total 40-50% increase). For driver combos like tcm_loop and faster drivers like the iser initiator, we can still see IOPs increase by 20-30% when tcm_loop's nr_hw_queues setting is also increased. Signed-off-by: Mike Christie --- drivers/target/target_core_iblock.c | 44 ++++++++++++++++++++++++++++- drivers/target/target_core_iblock.h | 10 +++++++ 2 files changed, 53 insertions(+), 1 deletion(-) diff --git a/drivers/target/target_core_iblock.c b/drivers/target/target_core_iblock.c index 8ed93fd205c7..33c88eca090f 100644 --- a/drivers/target/target_core_iblock.c +++ b/drivers/target/target_core_iblock.c @@ -61,9 +61,18 @@ static struct se_device *iblock_alloc_device(struct se_hba *hba, const char *nam return NULL; } + ib_dev->ibd_plug = kcalloc(nr_cpu_ids, sizeof(*ib_dev->ibd_plug), + GFP_KERNEL); + if (!ib_dev->ibd_plug) + goto free_dev; + pr_debug( "IBLOCK: Allocated ib_dev for %s\n", name); return &ib_dev->dev; + +free_dev: + kfree(ib_dev); + return NULL; } static int iblock_configure_device(struct se_device *dev) @@ -171,6 +180,7 @@ static void iblock_dev_call_rcu(struct rcu_head *p) struct se_device *dev = container_of(p, struct se_device, rcu_head); struct iblock_dev *ib_dev = IBLOCK_DEV(dev); + kfree(ib_dev->ibd_plug); kfree(ib_dev); } @@ -188,6 +198,33 @@ static void iblock_destroy_device(struct se_device *dev) bioset_exit(&ib_dev->ibd_bio_set); } +static struct se_dev_plug *iblock_plug_device(struct se_device *se_dev) +{ + struct iblock_dev *ib_dev = IBLOCK_DEV(se_dev); + struct iblock_dev_plug *ib_dev_plug; + + /* + * Each se_device has a per cpu work this can be run from. Wwe + * shouldn't have multiple threads on the same cpu calling this + * at the same time. + */ + ib_dev_plug = &ib_dev->ibd_plug[smp_processor_id()]; + if (test_and_set_bit(IBD_PLUGF_PLUGGED, &ib_dev_plug->flags)) + return NULL; + + blk_start_plug(&ib_dev_plug->blk_plug); + return &ib_dev_plug->se_plug; +} + +static void iblock_unplug_device(struct se_dev_plug *se_plug) +{ + struct iblock_dev_plug *ib_dev_plug = container_of(se_plug, + struct iblock_dev_plug, se_plug); + + blk_finish_plug(&ib_dev_plug->blk_plug); + clear_bit(IBD_PLUGF_PLUGGED, &ib_dev_plug->flags); +} + static unsigned long long iblock_emulate_read_cap_with_block_size( struct se_device *dev, struct block_device *bd, @@ -337,7 +374,10 @@ static void iblock_submit_bios(struct bio_list *list) { struct blk_plug plug; struct bio *bio; - + /* + * The block layer handles nested plugs, so just plug/unplug to handle + * fabric drivers that didn't support batching and multi bio cmds. + */ blk_start_plug(&plug); while ((bio = bio_list_pop(list))) submit_bio(bio); @@ -870,6 +910,8 @@ static const struct target_backend_ops iblock_ops = { .configure_device = iblock_configure_device, .destroy_device = iblock_destroy_device, .free_device = iblock_free_device, + .plug_device = iblock_plug_device, + .unplug_device = iblock_unplug_device, .parse_cdb = iblock_parse_cdb, .set_configfs_dev_params = iblock_set_configfs_dev_params, .show_configfs_dev_params = iblock_show_configfs_dev_params, diff --git a/drivers/target/target_core_iblock.h b/drivers/target/target_core_iblock.h index cefc641145b3..8c55375d2f75 100644 --- a/drivers/target/target_core_iblock.h +++ b/drivers/target/target_core_iblock.h @@ -4,6 +4,7 @@ #include #include +#include #include #define IBLOCK_VERSION "4.0" @@ -17,6 +18,14 @@ struct iblock_req { #define IBDF_HAS_UDEV_PATH 0x01 +#define IBD_PLUGF_PLUGGED 0x01 + +struct iblock_dev_plug { + struct se_dev_plug se_plug; + struct blk_plug blk_plug; + unsigned long flags; +}; + struct iblock_dev { struct se_device dev; unsigned char ibd_udev_path[SE_UDEV_PATH_LEN]; @@ -24,6 +33,7 @@ struct iblock_dev { struct bio_set ibd_bio_set; struct block_device *ibd_bd; bool ibd_readonly; + struct iblock_dev_plug *ibd_plug; } ____cacheline_aligned; #endif /* TARGET_CORE_IBLOCK_H */ From patchwork Wed Feb 17 20:28:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 12092213 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A3C04C43381 for ; Wed, 17 Feb 2021 20:34:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 893C564DEC for ; Wed, 17 Feb 2021 20:34:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234496AbhBQUdx (ORCPT ); Wed, 17 Feb 2021 15:33:53 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:54028 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235078AbhBQUb4 (ORCPT ); Wed, 17 Feb 2021 15:31:56 -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 11HKT6Us122972; Wed, 17 Feb 2021 20:29: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=1iNoXyoC4xa0O0nQ251es2Dfg6INqaheeFO8Sm6kIQ8=; b=qR/f1F5+v6IHFpPY7E7+iPJtTky8x1LLZgRK+ztCp8i4TzIeUifiqzoF32Umfp1WZdG6 G56Egr4kAU+c2Tf0e+uXJqpQMH9BgKQP01HXUU9i6FodSXjoS9jfy5a2d/a4fEajvikZ 6im0rXJFCvz40NK7Xp9OZYvCj36Fg/Dyu2pxM9xRM9XyAQrQtookU06QOFltC66gbdIP AiLzLld5oEoGvJZfNrDB3LmE+XI8YM9IsSfldWcvP/9bGd7oZ/UbTSXdzjOoeR8zHCHw Zqa6pLPXZjLRyzBAwtfbBo/aljdom0kSPnxtdEUJfdL7HkJMShsIPoLXnClQVjstRll/ RQ== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2130.oracle.com with ESMTP id 36p66r3san-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 Feb 2021 20:29: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 11HKQ6x7111972; Wed, 17 Feb 2021 20:29:06 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2175.outbound.protection.outlook.com [104.47.58.175]) by userp3030.oracle.com with ESMTP id 36prpykfjh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 Feb 2021 20:29:06 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Wa/0xSwsEma1towz2BUL75J2LaFWlF7e/Tde9rZESZi7Xwu2NjCfCdPc0Q7sO31bcp3nHPbI8ZQRtbZm0R7ohA37HRsCh8A373oE8MN83n+dO0zulvUGV9L6mkd0PVhyrE/cCcD/UbX+QU8ba+ncsnF1FHOO2eHV4dijCABbRblwxGmsTYduGbHEUbqbsO+9pFUqs2W/2p58whz/YIYEVou05i79NHfsXXyYNubp1XHUGdbQmodceetq3+cXi8QYnWxixH+QRbpMW9ck3FebyP9BnwMM2MQQ0tpvyYyHo1aNZggJvehJMpZKGlJQTgleG6WGDyZJIMunZvFCdyNKGA== 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=ZKt9/P/jQkCIXDr7tLDE2zSerN5AFLUxAShRkRQpsVPaeTKgfDDWpM9RKLYUxawMj4pBnMdFHGdHWcyVz6hmzv45hfOdYpg0zNPMmDndj0tcnKZCtMfmRQz3pqMNNroWEmtmHgM/hcEh1kVy2P6ngi6ghH3h5/7nlnfHHitV8dO1xFcTJmpSr10qj7Tw0KOi5jJ6tCQk14U4vFqPgJPpR2XfvpENy6pV8a6z9jJnPk//tOuk7x+AkeL6HMFKpGXoVNWKK9U3gY57gsgIJBj8kcyy+84LQV1sXs7FtdnEjHoBOMrLG6+OUHhNilUiLG6QcbX0VTN/kO/Ux2RhSOXLew== 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=etMajaCvMAh5czifdEVMiu/+/EgWTMAFOZqZznbD4iVbitZr57EXX3KcnHuomRhzHDYv5qh/a/vQVcc1uAD8zMBJkMltQ0jDmgbo9VrF1nexhhNLM5Y1+Jdeaf3snVPQU4lsMP39VYnoKVMrS6L8xn+jctIidcurXA+Ll60Rl4s= Authentication-Results: gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=none action=none header.from=oracle.com; Received: from BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) by BY5PR10MB3940.namprd10.prod.outlook.com (2603:10b6:a03:1f6::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.29; Wed, 17 Feb 2021 20:29:04 +0000 Received: from BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::1d86:b9d7:c9ef:ba20]) by BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::1d86:b9d7:c9ef:ba20%7]) with mapi id 15.20.3846.042; Wed, 17 Feb 2021 20:29:03 +0000 From: Mike Christie To: bostroesser@gmail.com, mst@redhat.com, stefanha@redhat.com, Chaitanya.Kulkarni@wdc.com, hch@lst.de, loberman@redhat.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org Cc: Mike Christie Subject: [PATCH 23/25] target_core_user: add backend plug/unplug callouts Date: Wed, 17 Feb 2021 14:28:09 -0600 Message-Id: <20210217202811.5575-24-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210217202811.5575-1-michael.christie@oracle.com> References: <20210217202811.5575-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: CH2PR15CA0001.namprd15.prod.outlook.com (2603:10b6:610:51::11) To BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by CH2PR15CA0001.namprd15.prod.outlook.com (2603:10b6:610:51::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Wed, 17 Feb 2021 20:29:02 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 69bd80a6-b566-4e6d-1f36-08d8d382aabb X-MS-TrafficTypeDiagnostic: BY5PR10MB3940: 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: GrXesSPOH7y5REIDmo5lIGW7eAx1kQa8YGWgFNQtLYQIlhguPk9R/ASpUB6S9UlHU3c+G8B/aK4MSU/jkYi6ELxXfe9Ro2NK3guK3FWarnf771TFMyv78xEgAQlRIf8j6thCQzEvkUQ41kkkLLNpf4QH20y4MsMFXZR+h1rS1TaN+GGBKIyWO8LbjyPU2om758FyBubRbXdflGPagOMhea2yXBUuGcrcTd4PXxa0iapAV12emSiWqOWJ7gJdPg/OiIOxL5J01IoGKtlbqpKoxubhw+W6z5E6LKVpa2SFrM2y2imwDL0uk6NPCpqwEiM/hAmGPG/aX/QoOhS54mriXQjQYxr8YbCQ2ItR6n8XIZ/zoB65pbqyEK/doXV4MXTRRmIRe1sLKQ/fO26N18vfgRmQDmD7M3NNr/gVudFl6xI0FvTVq9JzwLfG7dZHTbUCJTKHaNC+Ah2jGWvuRh895N5dlC4extPr/wPVUkSFtAVZibE6ElfTCd8NS71tcKm6ae1QK1FFJ8bV603XJAGqUF2TUiM28unpawtsTW5UygTkuxPHb3m8lLA7r7hGR2yiDCcARpAcdbL2XxaeS4jqeQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR10MB3573.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(346002)(366004)(39860400002)(396003)(136003)(376002)(2906002)(6486002)(956004)(86362001)(478600001)(1076003)(69590400012)(52116002)(316002)(6512007)(4326008)(8676002)(83380400001)(66476007)(6506007)(8936002)(66946007)(66556008)(2616005)(36756003)(5660300002)(26005)(186003)(16526019)(107886003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 8QbQylbTlHOVvUpPUDrHjWEWmCCkoEkOXDsoOXsef0spnnrcF0I7zVuO/navwJza/QHQzERlDoiuVMc+3Nw8W926EVB+G0iAjJHApe/0LwJHabehbGYSh9an9mUiwuFnODdVmLT7SotGPN1QHkEsEFA4wuBx/9nfnKbRLY/KRp7q0mLtkXm4HN3939WTdeE1k2DF8dk5gxpNGkzWuvjKqNBepL5E7dDWMT3mf0LofIMvcTuAwZ6YRSYP/axxCa4IiLkRVR4klGv4ma7jVOCcI57FgMiZicraBA5s2XQZD/CmMtsF9sHtOx6ocJMGrmuMMLJzwxVAFkSQYny2zmrBTERotcjMxgwYXR2zmrUIeTC7RLmjdCRDs85X7ygMO/fs3E5L0TZWQ2gaUSh9KRLbMupd2CREENDVfDcPjJQ7hobHQZ49EG95NDZ2enAlKKWpgOa9xXOSqg57j6wqN9xdkgQieMP0qPlh5jZL8evMklcpnmkhGZCyDyyvihHaaTzTwO+endrPe6W43ubZmsGkrhokgla1+5ylChO0/hHDH92dUMEDBxgpEDrlzFl6flDj6QyX/T1A3845IOU9d/HAAeeJrXli9p3MzFf1zhXfKpwDGCn62ChBkGBSL9FaD3UXXa1Bq+/IZQdHMfJCg4AAvYM/rUOi9l1V3AUXQrY/ZUHEn046wbSr8u5hHTuh6TAy6Si99dbvGV1VgOFDIzHEfB/03qwWanEO7r2lCGE1x+4UFQ5iY4SByNEWDvZy2X+nxKkqmSyQxCes4pUahS7pp3HRFAbHcZ0lLIE+WCeVlbP/ue2k+IoApBxBNZ3mXS3/rLEfcDrzM0/eJDCsmOIap8MBPPRFqKABRqNDyXDF5JQ8XrbNSJg0hBTF6QUzQGPxAYH6J/+uURi4IQhd8V1l4HmVaBDmbRQFz+dEDWZoCvfP36iUS62x9lVYRzGGws4PRr5Oevm1Py4zLGWdEQgcFuJWPDeJKWFM8xC7Zm0r+Wa3NtlSz/Gu0XgmkR1mOTTtbzr0sB3qkLHAu7b7sVtecRwocGktUcGvXIFVxlp4JonjwpwU/3Y76Lpd4LuXCLJ6kta5BmgjOSw7zL49I0+OeqeMv4rux9YAwvMisQZ41L7KxX5bVvS1QzhGtdItJt81YK2JQXDlGLW3CW2EYCZ/+UTKohYwU/1Yijpgq2mpMM3BPIK0pzczdcPjd8go03hlA3Alk0uWGTFzYjEsmyCoBoTaVKPgl14tA3HlJPHz3toTR0jKaecztrcSTVeF38dwxSPanyRvcI1eZfAdFYYfCZVPx8jvKLiN49jISlaJe/aGPj+khgUCfI9pdsOEynpw X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 69bd80a6-b566-4e6d-1f36-08d8d382aabb X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Feb 2021 20:29:03.8603 (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: LBjCkwnX7WhBBKiRtaFyTLL5Q/CD0jJ/jtJsC+/aNpq7vGnNqIv3RjdUbsAFrXghaU44YyyaeYZ2TLsJ2m0rUDsc7hERsPhl8YnL6AFpAiI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR10MB3940 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 mlxlogscore=999 phishscore=0 adultscore=0 mlxscore=0 suspectscore=0 malwarescore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102170152 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 suspectscore=0 impostorscore=0 priorityscore=1501 clxscore=1015 spamscore=0 mlxscore=0 phishscore=0 malwarescore=0 bulkscore=0 adultscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102170153 Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org This patch adds plug/unplug callouts for tcmu, so we can avoid the number of times we switch to userspace. Using this driver with tcm loop is a common config, and dependng on the nr_hw_queues (nr_hw_queues=1 performs much better) and fio jobs (lower num jobs around 4) this patch can increase IOPs by only around 5-10% because we hit other issues like the big per tcmu device mutex. Signed-off-by: Mike Christie Reviewed-by: Bodo Stroesser --- drivers/target/target_core_user.c | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c index a5991df23581..a433bda56b89 100644 --- a/drivers/target/target_core_user.c +++ b/drivers/target/target_core_user.c @@ -111,6 +111,7 @@ struct tcmu_dev { struct kref kref; struct se_device se_dev; + struct se_dev_plug se_plug; char *name; struct se_hba *hba; @@ -119,6 +120,7 @@ struct tcmu_dev { #define TCMU_DEV_BIT_BROKEN 1 #define TCMU_DEV_BIT_BLOCKED 2 #define TCMU_DEV_BIT_TMR_NOTIFY 3 +#define TCM_DEV_BIT_PLUGGED 4 unsigned long flags; struct uio_info uio_info; @@ -959,6 +961,25 @@ static uint32_t ring_insert_padding(struct tcmu_dev *udev, size_t cmd_size) return cmd_head; } +static void tcmu_unplug_device(struct se_dev_plug *se_plug) +{ + struct se_device *se_dev = se_plug->se_dev; + struct tcmu_dev *udev = TCMU_DEV(se_dev); + + clear_bit(TCM_DEV_BIT_PLUGGED, &udev->flags); + uio_event_notify(&udev->uio_info); +} + +static struct se_dev_plug *tcmu_plug_device(struct se_device *se_dev) +{ + struct tcmu_dev *udev = TCMU_DEV(se_dev); + + if (!test_and_set_bit(TCM_DEV_BIT_PLUGGED, &udev->flags)) + return &udev->se_plug; + + return NULL; +} + /** * queue_cmd_ring - queue cmd to ring or internally * @tcmu_cmd: cmd to queue @@ -1086,8 +1107,8 @@ static int queue_cmd_ring(struct tcmu_cmd *tcmu_cmd, sense_reason_t *scsi_err) list_add_tail(&tcmu_cmd->queue_entry, &udev->inflight_queue); - /* TODO: only if FLUSH and FUA? */ - uio_event_notify(&udev->uio_info); + if (!test_bit(TCM_DEV_BIT_PLUGGED, &udev->flags)) + uio_event_notify(&udev->uio_info); return 0; @@ -2840,6 +2861,8 @@ static struct target_backend_ops tcmu_ops = { .configure_device = tcmu_configure_device, .destroy_device = tcmu_destroy_device, .free_device = tcmu_free_device, + .unplug_device = tcmu_unplug_device, + .plug_device = tcmu_plug_device, .parse_cdb = tcmu_parse_cdb, .tmr_notify = tcmu_tmr_notify, .set_configfs_dev_params = tcmu_set_configfs_dev_params, From patchwork Wed Feb 17 20:28:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 12092209 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 64315C433DB for ; Wed, 17 Feb 2021 20:34:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 32A3964E6F for ; Wed, 17 Feb 2021 20:34:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235084AbhBQUdm (ORCPT ); Wed, 17 Feb 2021 15:33:42 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:54038 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235080AbhBQUby (ORCPT ); Wed, 17 Feb 2021 15:31:54 -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 11HKT7Nm122975; Wed, 17 Feb 2021 20:29:07 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=fEMPY+6qCvH0hiOt12Z4K7ndTKZZbQYi8f7FY3SVpRE=; b=X1qR6S9tEbHzAN1IkXjHYhowYaCatItdQGHpKEv+KBHi3WSr5iwKKeZhmh90/oZX5cWp SSc71MkmTAZWJIr+OsTd3SAfMnjvMPR2sk8QRowsW1r9e6zmlrAvnbxfYL9crnFV+crH Pll+CfiH5W9k3YWDYAajv5YaSm8ga9OTB/UhGuDK8xnSWHJNj+DLK8NzgiwrR9Bkb2Nm +64+q+6ODiGjdQ+xQKnBiWc6IJU4El26WWxchXNEftNekDrafvAYc+0u9bR0RLPOIRzZ 1AmRBOuXanRR/TG0bnwJuDSWYoqAjKnhv4KyqTFJJS9KBNH3sLl/jwujhY6EjYEFrKdf lQ== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2130.oracle.com with ESMTP id 36p66r3sap-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 Feb 2021 20:29:07 +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 11HKQ6x8111972; Wed, 17 Feb 2021 20:29:07 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2175.outbound.protection.outlook.com [104.47.58.175]) by userp3030.oracle.com with ESMTP id 36prpykfjh-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 Feb 2021 20:29:06 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=guJ2w0+g4x+n+MVu1N9gnBX8RR7lRlVum84ZWYE4khfg5ikPs3/igETCynzB4aOIVGVuBjB9xr2mXu8KI9mZULoEPC9R+t/q+4xFkP86f6LzrKHquyeaQX3dpOGMCNoYApqi1wY12iKt5le3OY+meI1NNjLj3C68EF2GIQ8WR7j7gPYOZnAMpuxJBNManl7Ac5YtDP7scYKk5twWbOlbxu33TWzdwRYPVZDdkSBHUsQckKMKF/6ReMLJK4TwqMlyjp8dYlYbLeOndWjEf5a1wQ/X/hW1dhVcoXq5RUQf/yV7B+iUfaomgt18S0RgXo2YcF/gG+aeXkiQ99/lejUCag== 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=fEMPY+6qCvH0hiOt12Z4K7ndTKZZbQYi8f7FY3SVpRE=; b=hBN92pOtev1f6I9+a+t+RtKvrfTtUt3NKO4AlYvwr4DMj0KtGNUQWPzhOVH7Slj+QtJCpsngiXlw2wl5hcQkDPNOZnrGORqTAAHnL8iKTZF0D9RA5RYa0e/eISC3v4cL3Bvb1Cp+/+jV3MhxmcVoJhkyGZWuDJ5cq+EgiH0ttiW+EWgMydkD1QZPeINfyDzKpKZC7RX5Trz6T9Fm2nQ4WMH4f20SgeRAMh8t+0SJUixFxW+NyMwUbK80UvuOOChqQMvRSXBprJtE36yGIX6QacUbJLOM3LBedpiqt4i3DNMpKlMc767Vg4/gKqaWwzAUz3Cv9BBOwQf+52eHyvsvPw== 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=fEMPY+6qCvH0hiOt12Z4K7ndTKZZbQYi8f7FY3SVpRE=; b=pvKUbnSXmswP4C2jrhY0egwrm85fcxpeOua4YKd1JRPx72aDfUj5OF8WawRmJnPFvH8fVpPGT8k8TqSfCJIZKV7yMqwkAVyJJgXUjLwbbWvmABQdupIct3PBBkl1HY636LYF0XkU9WPB1YCkNmTADSaHaqf4KIoMqwSud8oRvm8= Authentication-Results: gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=none action=none header.from=oracle.com; Received: from BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) by BY5PR10MB3940.namprd10.prod.outlook.com (2603:10b6:a03:1f6::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.29; Wed, 17 Feb 2021 20:29:05 +0000 Received: from BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::1d86:b9d7:c9ef:ba20]) by BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::1d86:b9d7:c9ef:ba20%7]) with mapi id 15.20.3846.042; Wed, 17 Feb 2021 20:29:05 +0000 From: Mike Christie To: bostroesser@gmail.com, mst@redhat.com, stefanha@redhat.com, Chaitanya.Kulkarni@wdc.com, hch@lst.de, loberman@redhat.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org Cc: Mike Christie Subject: [PATCH 24/25] target: flush submission work during TMR processing Date: Wed, 17 Feb 2021 14:28:10 -0600 Message-Id: <20210217202811.5575-25-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210217202811.5575-1-michael.christie@oracle.com> References: <20210217202811.5575-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: CH2PR15CA0001.namprd15.prod.outlook.com (2603:10b6:610:51::11) To BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by CH2PR15CA0001.namprd15.prod.outlook.com (2603:10b6:610:51::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Wed, 17 Feb 2021 20:29:04 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c0c421a2-67c9-49d2-e79e-08d8d382abad X-MS-TrafficTypeDiagnostic: BY5PR10MB3940: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5797; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DpEaOnuBWCFE4q9s4oP048ZsvXkh+lN1Z5H1tD0rDawBJrGeUl5TdhifOIagH+nO/nU5mSeVzVaz+MEAy2LwgLOA7BvDeU7CBI7RYU7WcERZ+4Y5HakfmZFe2+M2R6oDjphpj+gU0KjPUdoxSBRGRbwr7TwDMjImxWOG2iC5rJssxsuJl4IEJKrIsW0YKLxHTugYLZINbWkFT0kdWLEcS47lBV9erPVljeXUaU3it++B5bvbVJXWnR8ZhenyFrFArV7b/o298VaLz5whgusH+uSUv1UuIEps62WBLrh2E9+6ej3J6gX/1J9wmo16rG4fRknEiqK+ssQLvfP2ZAQGltqE0dVktlGoQGnkEb+5bxpVrb0rr4U9eybzbtJ+4/td0KtthpJnIxUYCKdNbAgJx5nw+5eiwA+fZ0MMhgUbhV/nEH/nHt8zLFIpdD939/IJ6pH/r8YXpCpgGa/v55qE2kvTZRuB1fEbu034aoGJZKVEINmrcGWI7O+hgi749GFUhdvCugzvP7PkGjiHLs1ByiTHP0dQEC8Un54a6tvIn7HVcUkYcx/RpuOKepRAOFcTyHcqvyE5SlnYb/tUmf/K4Q== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR10MB3573.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(346002)(366004)(39860400002)(396003)(136003)(376002)(2906002)(6486002)(956004)(86362001)(478600001)(1076003)(69590400012)(52116002)(316002)(6512007)(4326008)(8676002)(83380400001)(66476007)(6666004)(6506007)(8936002)(66946007)(66556008)(2616005)(36756003)(5660300002)(26005)(186003)(16526019)(107886003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: d3lLjBMwS2F/0Iz5MnF9wVuwL7WpbFsoSDfj1E7GBMKf+Z1KB8ujVSoyieAusgVYuLcMkWh2XHKY1/rjDNOk/o+BjhQZ1305EnRx1RwEzHWRgfWer47T9vl9A9nwBhburmbP2A8ToenejWc5NqtOrlp7y/7X1Zg5VdpCmdQTs7vvoBbflaErU64IR6YRHNN3oH73Wwzs29bCyYHrdPEibbPHrIFvhzx2ThVohS4hgXa9IuKjlEO6/rHI2iPJgpy8t4utojnLZXMAqN++gP76MxkiHYHieRCfV+5DzGwPu4aeq8Ib5IbPcsRi3dHR0oXFDkDB5ZAvapPXsoZi4ZIXa9n5c64Wkwy7bGleO1KrDxFFldwJqHQtukWEZ6XFCmgT7q+5H0h8m5NfZyXPeezuibuaEiRVWOFiSb7kPXZkJYtuNEGrhLXEUlG973cTckWGcHOlg6GVk+aFRUcbRnTGhTE4U4N98/nAyideeAvozRRDpv1sYxdU+eZQCR/qFFAziWWv2oSyBRK/u9DRaj1MoJLBI8NTqDsRilQKJmQtlGwzcH6apcRKM8bOSEOhXFRo36d721gV1szZJFYSfgY168ZDgMHgshpDTrDucVlb6KweZFkOCxji51KqhlDe/kl7zkG0GFq+tGyrArwFeubNMBxyUQ30X0F3Gr8rK/CunUlVp0JW+mdcs5InYRCDO6AZei9UsPOmF/LidWuXU/8lI65xcdFW4M/1v4HVBtvwM0XOFZQYu6WyITG8bqJdotcA5bnfvohquO4wPdRJcmCuW3k5fWtfnnyGNsdFJ/W8ex6yEgQjJLLDMSbAxQQhDPqsHOF/+zm/gdOXnzJ+HVww48Nnw1Jq2+kig7149SSAOzEbyQGMhxpoQieRLMQBS8YqbzlUO5I3K7WWvB7EuJJTlmR7YDp0+6sh+pKuj8LTvm0ZLCfsfUQOug9q1wM8YqbZftyB9+4rzE0vPRxyzM11SwrztDEooWWoT9BPSF1UTIr4HFOn9tdxao72zOYrcZT/S97muFxjPW50nmZv934b5ZJBp88zEIfPiAoN2i8LdEJzYt4N47MCZF7aE/e67QWBfud20/RIZQ0be99lZ3z4U0IPi2lLWTz9X/6MgULSnzItM6qWiEXljooQkMYF3I/Oe36QPapVb4KAiJ1nl3rU3HK1r0QMBQBG7vp/f5q8ljOaHtLXi29eYa+YCDJuSQ2V1LTUqNIxP3w9ebmxXydKmx+7URIFEekpMUjm1pJB+x532bacHtOp9tn5D17DNAgim//jFWWk9C5p8I9MtibEoSqe1jdDCYM+SiLMn+FrQ/o+O+V2Pm6ZJtGAo4GVXBjr X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: c0c421a2-67c9-49d2-e79e-08d8d382abad X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Feb 2021 20:29:05.4304 (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: QEUTNL2dDDLQ1vqJEvuW9yQ2JpoVPI3ctq/r/l9aAl+Vptcvq3l78PcEPPkNJqic6JDQDhVmLAWG+edrGjPzzV58s5nk2/j8LqyC5xoXvv8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR10MB3940 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 mlxlogscore=999 phishscore=0 adultscore=0 mlxscore=0 suspectscore=0 malwarescore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102170152 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 suspectscore=0 impostorscore=0 priorityscore=1501 clxscore=1015 spamscore=0 mlxscore=0 phishscore=0 malwarescore=0 bulkscore=0 adultscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102170153 Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org If a cmd is on the submission workqueue then the TMR code will miss it, and end up returning task not found or success for lun resets. The fabric driver might then tell the initiator that the running cmds have been handled when they are about to run. This adds a flush when we are processing TMRs to make sure queued cmds do not run after returning the TMR response. Signed-off-by: Mike Christie Tested-by: Laurence Oberman Reviewed-by: Bodo Stroesser --- drivers/target/target_core_tmr.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/target/target_core_tmr.c b/drivers/target/target_core_tmr.c index 7347285471fa..e7fcbc09f9db 100644 --- a/drivers/target/target_core_tmr.c +++ b/drivers/target/target_core_tmr.c @@ -124,6 +124,8 @@ void core_tmr_abort_task( int i; for (i = 0; i < dev->queue_cnt; i++) { + flush_work(&dev->queues[i].sq.work); + spin_lock_irqsave(&dev->queues[i].lock, flags); list_for_each_entry_safe(se_cmd, next, &dev->queues[i].state_list, state_list) { @@ -302,6 +304,8 @@ static void core_tmr_drain_state_list( * in the Control Mode Page. */ for (i = 0; i < dev->queue_cnt; i++) { + flush_work(&dev->queues[i].sq.work); + spin_lock_irqsave(&dev->queues[i].lock, flags); list_for_each_entry_safe(cmd, next, &dev->queues[i].state_list, state_list) { From patchwork Wed Feb 17 20:28:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 12092217 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8DEE8C433E0 for ; Wed, 17 Feb 2021 20:34:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 64AEE64E6C for ; Wed, 17 Feb 2021 20:34:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233589AbhBQUe1 (ORCPT ); Wed, 17 Feb 2021 15:34:27 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:54322 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235039AbhBQUb7 (ORCPT ); Wed, 17 Feb 2021 15:31:59 -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 11HKOLnd017508; Wed, 17 Feb 2021 20:29:09 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=k0100Ow5cTQn4ff5qY3Xp95n20Gv8m4lPJsH8o+ExZ8=; b=NKUruawp9wX9LZnBwbG5LNu8XwesZu1FYu4DAGGLCTJFvgyKCF+fnnRi1S7NpQBJBnxS kTNmqmapYxv7X0YUW62rLQ4K8un7nieDS7SDpEtpsPf2RsTWt0xPO4ovzTu0TQctlBZO ljhgXCybk5jDRV/Ckdi1J+RRlNFNTB/AokHnu0fZCWtYA+H8NNZvIsceMH7gCNRbr/cu PeHUL5/dMZ9P156oFfhEL6aYd1met55tWwXPumSq87iDXtkCbPlWKt03qs58fuT8WaBF W7sIb7SA0lKN2kcGueaubBFLk24f5R71YMG5gZnb9rSK9wP66/FWV3a5cGlGxWHIxSll Vw== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by aserp2130.oracle.com with ESMTP id 36p49bbwyp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 Feb 2021 20:29:09 +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 11HKQO7b004171; Wed, 17 Feb 2021 20:29:09 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2175.outbound.protection.outlook.com [104.47.58.175]) by aserp3030.oracle.com with ESMTP id 36prbpwx9r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 Feb 2021 20:29:09 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jKt9sTl3yKoKwBZe/j4S+AhZAiuih0Htupvm1+d3BUq8O3sYEiOi6veJ7SRGWNNw74gPQVbCdymF1qVl7vazl3qnVmts771izZaYJ4c483hfC8wDssauHlu8sOj33lj2GzfVWfSrP4AX4ZJHHumXZmvCUsH3ZfEpvkCf5uD3LTVErVfzOC4kivNBu1uuTrom2pKhHF45iaJrj3E9hsgrGtwkBMlcI4G5h2w/ZcHCBOzlZxViYxbRpKO8ntlz2pwGAR1Z5S+wY8loSxbTLjbqG0oH2TUm//vOauc6770vHNPmUR7YdzM2HySpAnbIFDnO2dHehxDQQwEj90NUeuWBxg== 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=k0100Ow5cTQn4ff5qY3Xp95n20Gv8m4lPJsH8o+ExZ8=; b=jcmjboy4oRw7Ns2Z1AZyOdCZBi9GkGT+YjCERu5Dmk34EUBD5FKEJse037HYM0FuhJugSRl9IxbKxk1y+8Kdf0xRziDQbY9R3I38XSqx6kvtimLPxPX3Eq5RdHqAJ88bExWjxCo7kOEUPLsla8LRjy0Jp4y7ostwvpbID2qw/wuFDCT17ypp9EPuVRyRuZscZKzo0qCCuqgUIhTNvpk649TJDEdltM1+h5fMwmISUYJfYHDVunv1QA98oSQ91rZQ5eSaPPRw21X1RcTHbOiYNQEuWgulDLnVocbKxsU6/ltTfeXRUcNCxy4RLZp20X4eNsz3HcfCBXcTYCgdNR8HhA== 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=k0100Ow5cTQn4ff5qY3Xp95n20Gv8m4lPJsH8o+ExZ8=; b=EqjTFaVVq7bU6ALUuItA/f/ARgXiWGs5ELINQqyNpHJdTOmpd61R2YI35nf9E0Rbu12rUUqlWzWcrPG3afzBqqfSRQj/He9vHsLhVmQU/sf6+zjr5oXpct+JCFAKMTn/2Muo3EclpYXj4tTA0ngm2o7a5S7pFc+SYyhQLMab8rc= Authentication-Results: gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=none action=none header.from=oracle.com; Received: from BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) by BY5PR10MB3940.namprd10.prod.outlook.com (2603:10b6:a03:1f6::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.29; Wed, 17 Feb 2021 20:29:07 +0000 Received: from BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::1d86:b9d7:c9ef:ba20]) by BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::1d86:b9d7:c9ef:ba20%7]) with mapi id 15.20.3846.042; Wed, 17 Feb 2021 20:29:07 +0000 From: Mike Christie To: bostroesser@gmail.com, mst@redhat.com, stefanha@redhat.com, Chaitanya.Kulkarni@wdc.com, hch@lst.de, loberman@redhat.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org Cc: Mike Christie , Himanshu Madhani Subject: [PATCH 25/25] target: make completion affinity configurable Date: Wed, 17 Feb 2021 14:28:11 -0600 Message-Id: <20210217202811.5575-26-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210217202811.5575-1-michael.christie@oracle.com> References: <20210217202811.5575-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: CH2PR15CA0001.namprd15.prod.outlook.com (2603:10b6:610:51::11) To BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by CH2PR15CA0001.namprd15.prod.outlook.com (2603:10b6:610:51::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Wed, 17 Feb 2021 20:29:05 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6ed24043-6a33-4bfa-f020-08d8d382acaf X-MS-TrafficTypeDiagnostic: BY5PR10MB3940: 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: KtHBLDHzLxjTt422mcjtaXmdL8ps6aOLgzGOad3AU41Rfc+2lj8afeVoLjIJnhQv/BRUuBK/D661jAm9xsYKRsqKlRWXyQ2BX4Bx2zSxN5COojFOZYtOT1FKQ12MOOPojyDOAMk3fsZG9wT9gresxtwLmAlaHUwkCFJd7syVy1m+7LaDo5WA9LZtUC0+7E800igy3RhaQOd/4hMPGeuxE/7luanQsAESY9wc8wRwJ/5LCzmphB28YHvwRv84BSweR4xQEHghINe7GFo6UZU9PJgFSn25c9Pu1blf3i58WEUVrzIBEEV4cr9hsxJJBTDogfSookTf5LrJmH49X1xTAMXv8Gt62autUO8wMTHE3E5Oin7dMw6Qat0igSNlXbKxydSWGXPgTpsGtAJbUDqkj0IgadsnB8rLlLcOHj6bW29uWWwI5xv6T3wO8eXQlrIFqpzzVlKDti7C1gkpUwjlsLQhyscyio7a8cnU8Eh7luPQMTriaRUcP+I1reF5bta3iQeD4yGrLKwEu9i9nntVGHIo8+JpW0v3SiBzftSEFtagPu6Y3ctRi8tGRkqBtTJElYuMHEpz2voVlyIhJyA0RQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR10MB3573.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(346002)(366004)(39860400002)(396003)(136003)(376002)(2906002)(6486002)(956004)(86362001)(478600001)(1076003)(54906003)(69590400012)(52116002)(316002)(6512007)(4326008)(8676002)(83380400001)(66476007)(6666004)(6506007)(8936002)(66946007)(66556008)(2616005)(36756003)(5660300002)(26005)(186003)(16526019)(107886003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 0s7GnYAsDXHtbHE/KSKQjQrx/OKjCEvX1NloieFZegWV7ZP39KnF+Wk1PGMx736x0cC1W4n9XwpWx7GJtQ9RxazekiUoiACt/bYiQJkSIZEIUrdoAatbM6ew50yRNN8fL1J+URz1dsjnaLg3Sa+7qObESMRx6mFuSoEr7/vB4FZ8lbKVhKq7sChbMASqk2o+M7c71Rk76OwnAlzGJLyBnHrEh35C6IqpMBVPpB8IYkq4a/XOtGXs5abBjP+yFPV98JLoHp6eQtNOBSs36YXvhzoWxBGVugivA6NS6UzkMRM5avE6MQQ6KTzcfj4yb3PY0BKv7V4wJGCe9kgm19y/+5fOhL4rzvXfHvJLNXp8sOeJef2S3OIhkOBq6P9kWJLcOPY4IVNKVIXPqZmOAUYLzwiX2S2y3srnlO5MeAPaI4aU9E946BNykTnsPUntEGNqtZV+Pq0sgkscMI8Tv6K/m8rz4STZ2kOIifXvfM4LB5H2wo+sZ8SoMjv/JYx6oJ0w8OqcMZkwgyAGcdSQ6XjN6/BINF9GQ3UHrCE44IicuLYBQOBg6pztySfaPvJnMVoG2V3cTougWvLPOVoxrkd7rf/3k3XPXdo0BDhicIDpqMqyuNo996uxprNw8++D1MaOUcASV8YRilxxTGik/b4acZO0xOE0inoD9GPUVxhESV6L6FPFDO0HomNTMPMvS+kmjrLLEVbza19v1JhJ8hYyErHX9irUSyV+2YgePaLwjLhHVDHVU8Le3shcB+qAwVYkEPE/W6zyRxM39TfgIFzJr0R/dIy0GztfoiDpRUEFzDGRPj2ulOx4Fb8VoWfxnM02G6+H/n3cxTd7mw+2m+luTukIJ/Uk5QrA6YnUiaRSMRU/JA0RGAK7jrQknmJDN5OBt62jATZM9vtCXpw9oSMu3V5GRXbbxDTBAZHf382cOXqd6zfChL4pcmdYvZwDyw11DxA3XBp8eDyM6HInTWVbMHW+lWtsQp5JO89KJ/Iy+Y+QoeGhhG49+ZCIfhebcPnU6cedcbF9dH6RKZeXWPfTL/P3ZKFCYsKfBXOo+fWv3P5HJI46Vm9gNDVYReGA68scNfN+I9CbmM8SYiRvdw2cAppt0irJM15xlu+HeGbeyetJgluiF2NWYWYvws00xstCkiJz3yPo2ad3beK3sCKFyteVP3NTj+zIhaHOtmMcrQGfK+1hnV2YrugTKFROclC1Wz1TWgA1hLzR1tvv8tGUTjWnLoY29H46PLRcLoxs/axUQNIzJ1Nc6WHrdAnAkBPbhQVPXQRQRwKTdSrrRSIBk30NDaGjeg8TwhDmRczETmeQi08rX/VCIslZ95aUwOYV X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6ed24043-6a33-4bfa-f020-08d8d382acaf X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Feb 2021 20:29:07.1794 (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: I+KHnP/dJpms2UJDVJaodxHXy3P8DAvfCGf1Qjcs1e6AogrZY6ZC2RNcz8FWAxO2dS9MWdmQFlc6i/BlSM260BHmf/JgUG4C31anfEg62Ks= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR10MB3940 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 spamscore=0 mlxscore=0 phishscore=0 adultscore=0 bulkscore=0 mlxlogscore=999 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102170152 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 priorityscore=1501 lowpriorityscore=0 bulkscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 malwarescore=0 phishscore=0 clxscore=1015 mlxscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102170152 Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org It may not always be best to complete the IO on same CPU as it was submitted on. This allows userspace to config it. It's useful for vhost-scsi which has the single thread for submissions and completions. Forcing the completion on the submission cpu is not always the best thing to do since the thread could be running on a different CPU now, and it conflicts with what the user has setup in the lower levels with settings like the block layer rq_affinity or for network block devices what the user has setup on their nic. The new setting is in /sys/kernel/config/target/$fabric/$target/param/cmd_completion_affinity Writing 0 gives the current default behavior of completing on the submission CPU. 1 completes the cmd on the CPU the lower layers sent it to us from. Signed-off-by: Mike Christie Reviewed-by: Himanshu Madhani --- drivers/target/target_core_fabric_configfs.c | 49 ++++++++++++++++++++ drivers/target/target_core_internal.h | 1 + drivers/target/target_core_transport.c | 9 +++- include/target/target_core_base.h | 7 +++ 4 files changed, 64 insertions(+), 2 deletions(-) diff --git a/drivers/target/target_core_fabric_configfs.c b/drivers/target/target_core_fabric_configfs.c index ee85602213f7..7ab27580758a 100644 --- a/drivers/target/target_core_fabric_configfs.c +++ b/drivers/target/target_core_fabric_configfs.c @@ -892,6 +892,7 @@ static void target_fabric_release_wwn(struct config_item *item) struct target_fabric_configfs *tf = wwn->wwn_tf; configfs_remove_default_groups(&wwn->fabric_stat_group); + configfs_remove_default_groups(&wwn->param_group); tf->tf_ops->fabric_drop_wwn(wwn); } @@ -918,6 +919,49 @@ TF_CIT_SETUP(wwn_fabric_stats, NULL, NULL, NULL); /* End of tfc_wwn_fabric_stats_cit */ +static ssize_t +target_fabric_wwn_cmd_completion_affinity_show(struct config_item *item, + char *page) +{ + struct se_wwn *wwn = container_of(to_config_group(item), struct se_wwn, + param_group); + return sprintf(page, "%u\n", wwn->cmd_compl_affinity); +} + +static ssize_t +target_fabric_wwn_cmd_completion_affinity_store(struct config_item *item, + const char *page, size_t count) +{ + struct se_wwn *wwn = container_of(to_config_group(item), struct se_wwn, + param_group); + u8 compl_val; + + if (kstrtou8(page, 0, &compl_val)) + return -EINVAL; + + switch (compl_val) { + case SE_COMPL_AFFINITY_CPUID: + case SE_COMPL_AFFINITY_CURR_CPU: + wwn->cmd_compl_affinity = compl_val; + break; + default: + pr_err("Command completion value must be between %d and %d\n", + SE_COMPL_AFFINITY_CPUID, SE_COMPL_AFFINITY_CURR_CPU); + return -EINVAL; + } + + wwn->cmd_compl_affinity = compl_val; + return count; +} +CONFIGFS_ATTR(target_fabric_wwn_, cmd_completion_affinity); + +static struct configfs_attribute *target_fabric_wwn_param_attrs[] = { + &target_fabric_wwn_attr_cmd_completion_affinity, + NULL, +}; + +TF_CIT_SETUP(wwn_param, NULL, NULL, target_fabric_wwn_param_attrs); + /* Start of tfc_wwn_cit */ static struct config_group *target_fabric_make_wwn( @@ -945,6 +989,10 @@ static struct config_group *target_fabric_make_wwn( &tf->tf_wwn_fabric_stats_cit); configfs_add_default_group(&wwn->fabric_stat_group, &wwn->wwn_group); + config_group_init_type_name(&wwn->param_group, "param", + &tf->tf_wwn_param_cit); + configfs_add_default_group(&wwn->param_group, &wwn->wwn_group); + if (tf->tf_ops->add_wwn_groups) tf->tf_ops->add_wwn_groups(wwn); return &wwn->wwn_group; @@ -974,6 +1022,7 @@ int target_fabric_setup_cits(struct target_fabric_configfs *tf) target_fabric_setup_discovery_cit(tf); target_fabric_setup_wwn_cit(tf); target_fabric_setup_wwn_fabric_stats_cit(tf); + target_fabric_setup_wwn_param_cit(tf); target_fabric_setup_tpg_cit(tf); target_fabric_setup_tpg_base_cit(tf); target_fabric_setup_tpg_port_cit(tf); diff --git a/drivers/target/target_core_internal.h b/drivers/target/target_core_internal.h index 56f841fd7f04..a343bcfa2180 100644 --- a/drivers/target/target_core_internal.h +++ b/drivers/target/target_core_internal.h @@ -34,6 +34,7 @@ struct target_fabric_configfs { struct config_item_type tf_discovery_cit; struct config_item_type tf_wwn_cit; struct config_item_type tf_wwn_fabric_stats_cit; + struct config_item_type tf_wwn_param_cit; struct config_item_type tf_tpg_cit; struct config_item_type tf_tpg_base_cit; struct config_item_type tf_tpg_lun_cit; diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index 18cb00a1ee2f..16d1fce86d7f 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@ -857,7 +857,8 @@ static bool target_cmd_interrupted(struct se_cmd *cmd) /* May be called from interrupt context so must not sleep. */ void target_complete_cmd(struct se_cmd *cmd, u8 scsi_status) { - int success; + struct se_wwn *wwn = cmd->se_sess->se_tpg->se_tpg_wwn; + int success, cpu = WORK_CPU_UNBOUND; unsigned long flags; if (target_cmd_interrupted(cmd)) @@ -884,7 +885,11 @@ void target_complete_cmd(struct se_cmd *cmd, u8 scsi_status) INIT_WORK(&cmd->work, success ? target_complete_ok_work : target_complete_failure_work); - queue_work_on(cmd->cpuid, target_completion_wq, &cmd->work); + + if (wwn->cmd_compl_affinity == SE_COMPL_AFFINITY_CPUID) + cpu = cmd->cpuid; + + queue_work_on(cpu, target_completion_wq, &cmd->work); } EXPORT_SYMBOL(target_complete_cmd); diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h index b8e0a3250bd0..4ed385537301 100644 --- a/include/target/target_core_base.h +++ b/include/target/target_core_base.h @@ -943,11 +943,18 @@ static inline struct se_portal_group *param_to_tpg(struct config_item *item) tpg_param_group); } +enum { + SE_COMPL_AFFINITY_CPUID, /* Use se_cmd's cpuid for completion */ + SE_COMPL_AFFINITY_CURR_CPU, /* Complete on current CPU */ +}; + struct se_wwn { struct target_fabric_configfs *wwn_tf; void *priv; struct config_group wwn_group; struct config_group fabric_stat_group; + struct config_group param_group; + u8 cmd_compl_affinity; }; static inline void atomic_inc_mb(atomic_t *v)