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: 384214 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 BF23DC433E6 for ; Wed, 17 Feb 2021 20:29:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 656D664E68 for ; Wed, 17 Feb 2021 20:29:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235038AbhBQU3Y (ORCPT ); Wed, 17 Feb 2021 15:29:24 -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: linux-scsi@vger.kernel.org The kref_get_unless_zero use in target_get_sess_cmd was added in: commit 1b4c59b7a1d0 ("target: fix potential race window in target_sess_cmd_list_waiting()")' but it does not seem to do anything. I think the original patch might have thought we could have added the cmd to the sess_wait_list and then target_wait_for_sess_cmds could do a put before target_get_sess_cmd did it's get. That wouldn't happen because we do the get first then grab the sess lock and put it on the list. It's also not needed now, because the sess_cmd_list does not exist anymore and we instead wait on the session cmd_count. The other problem with the patch is that several target_submit_cmd_map_sgls/ target_submit_cmd callers do not handle the error case properly if it were to ever happen. These drivers think they have their normal refcount on the cmd and in many cases do a transport_generic_free_cmd plus target_put_sess_cmd so they would have fired off the refcount WARN/BUGs. So this patch just changes the kref_get_unless_zero to kref_get. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig 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: 384213 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 806FDC433E0 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 3B65A64E68 for ; Wed, 17 Feb 2021 20:29:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235058AbhBQU32 (ORCPT ); Wed, 17 Feb 2021 15:29:28 -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: linux-scsi@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: 384210 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 40F8BC433E6 for ; Wed, 17 Feb 2021 20:32:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0AAC964E6C for ; Wed, 17 Feb 2021 20:32:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235089AbhBQUcD (ORCPT ); Wed, 17 Feb 2021 15:32:03 -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: linux-scsi@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: 384212 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 2FDDEC433E0 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 CB27464E68 for ; Wed, 17 Feb 2021 20:30:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234276AbhBQU3z (ORCPT ); Wed, 17 Feb 2021 15:29:55 -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: linux-scsi@vger.kernel.org target_submit_cmd_map_sgls is being removed, so convert srpt to the new submission API. srpt uses target_stop_session to sync session shutdown with lio core, so we use target_init_cmd/target_submit_prep/target_submit, because target_init_cmd will detect the target_stop_session call and return an error. Cc: Bart Van Assche Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig Reviewed-by: Bart Van Assche 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: 384211 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 A7CB3C43381 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 6061064DEC for ; Wed, 17 Feb 2021 20:30:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234311AbhBQUaA (ORCPT ); Wed, 17 Feb 2021 15:30:00 -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: linux-scsi@vger.kernel.org target_submit_cmd is now only for simple drivers that do their own sync during shutdown and do not use target_stop_session. It will never return a failure, so we can remove that code from the driver. Cc: 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: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: 384208 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 CC99DC433E6 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 9C66B64E6F for ; Wed, 17 Feb 2021 20:33:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232029AbhBQUdS (ORCPT ); Wed, 17 Feb 2021 15:33:18 -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: linux-scsi@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: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: 384209 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 C73E6C433DB for ; Wed, 17 Feb 2021 20:32:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7E32E64E6F for ; Wed, 17 Feb 2021 20:32:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234349AbhBQUcL (ORCPT ); Wed, 17 Feb 2021 15:32:11 -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: linux-scsi@vger.kernel.org target_submit_cmd_map_sgls is being removed, so convert vhost-scsi to the new submission API. This has it use target_init_cmd/target_submit_prep/target_submit because we need to have lio core map sgls which is now done in target_submit_prep, and in the next patches we will do the target_submit step from the lio workqueue. Note: vhost-scsi never calls target_stop_session so target_submit_cmd_map_sgls never failed (in the new API target_init_cmd handles target_stop_session being called when cmds are being submitted). If it were to have used target_stop_session and got an error, we would have hit a refcount bug like xen and usb, because it does: if (rc < 0) { transport_send_check_condition_and_sense(se_cmd, TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE, 0); transport_generic_free_cmd(se_cmd, 0); } transport_send_check_condition_and_sense calls queue_status which does transport_generic_free_cmd, and then we do an extra transport_generic_free_cmd call above which would have dropped the refcount to -1 and the refcount code would spit out errors. Cc: "Michael S. Tsirkin" Cc: Stefan Hajnoczi Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig --- drivers/vhost/scsi.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c index 4ce9f00ae10e..76508d408bb3 100644 --- a/drivers/vhost/scsi.c +++ b/drivers/vhost/scsi.c @@ -789,7 +789,6 @@ static void vhost_scsi_submission_work(struct work_struct *work) struct vhost_scsi_nexus *tv_nexus; struct se_cmd *se_cmd = &cmd->tvc_se_cmd; struct scatterlist *sg_ptr, *sg_prot_ptr = NULL; - int rc; /* FIXME: BIDI operation */ if (cmd->tvc_sgl_count) { @@ -805,18 +804,17 @@ static void vhost_scsi_submission_work(struct work_struct *work) tv_nexus = cmd->tvc_nexus; se_cmd->tag = 0; - rc = target_submit_cmd_map_sgls(se_cmd, tv_nexus->tvn_se_sess, - cmd->tvc_cdb, &cmd->tvc_sense_buf[0], + target_init_cmd(se_cmd, tv_nexus->tvn_se_sess, &cmd->tvc_sense_buf[0], cmd->tvc_lun, cmd->tvc_exp_data_len, vhost_scsi_to_tcm_attr(cmd->tvc_task_attr), - cmd->tvc_data_direction, TARGET_SCF_ACK_KREF, - sg_ptr, cmd->tvc_sgl_count, NULL, 0, sg_prot_ptr, - cmd->tvc_prot_sgl_count); - if (rc < 0) { - transport_send_check_condition_and_sense(se_cmd, - TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE, 0); - transport_generic_free_cmd(se_cmd, 0); - } + cmd->tvc_data_direction, TARGET_SCF_ACK_KREF); + + if (target_submit_prep(se_cmd, cmd->tvc_cdb, sg_ptr, + cmd->tvc_sgl_count, NULL, 0, sg_prot_ptr, + cmd->tvc_prot_sgl_count)) + return; + + target_submit(se_cmd); } static void From patchwork 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: 384207 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 8BD85C4332E 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 5682664E76 for ; Wed, 17 Feb 2021 20:33:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234427AbhBQUd3 (ORCPT ); Wed, 17 Feb 2021 15:33:29 -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: linux-scsi@vger.kernel.org target_submit_cmd is now only for simple drivers that do their own sync during shutdown and do not use target_stop_session, tcm_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: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: 384205 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 81309C433E6 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 4EE0864DEC for ; Wed, 17 Feb 2021 20:34:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235087AbhBQUdp (ORCPT ); Wed, 17 Feb 2021 15:33:45 -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: linux-scsi@vger.kernel.org loop and vhost-scsi do their target cmd submission from driver workqueues. This allows them to avoid an issue where the backend may block waiting for resources like tags/requests, mem/locks, etc and that ends up blocking their entire submission path and for the case of vhost-scsi both the submission and completion path. This patch adds a helper drivers can use to submit from a lio workqueue. This code will then be extended in the next patches to fix the plugging of backend devices. Note: I'm only converting vhost/loop initially, but the workqueue based submission will work for other drivers and have similar benefits where the main target loops will not end up blocking one some backend resource. I'll port others when I have more time to test as I think we might want to make it configurable for some drivers. Signed-off-by: Mike Christie 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: 384206 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 22119C4321A for ; Wed, 17 Feb 2021 20:33:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F208964E6F for ; Wed, 17 Feb 2021 20:33:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234275AbhBQUdi (ORCPT ); Wed, 17 Feb 2021 15:33:38 -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: linux-scsi@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: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: 384203 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 7B24DC433E0 for ; Wed, 17 Feb 2021 20:35:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 51FE764E15 for ; Wed, 17 Feb 2021 20:35:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235080AbhBQUfI (ORCPT ); Wed, 17 Feb 2021 15:35:08 -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: linux-scsi@vger.kernel.org This patch adds plug/unplug callouts for tcmu, so we can avoid the number of times we switch to userspace. Using this driver with tcm loop is a common config, and dependng on the nr_hw_queues (nr_hw_queues=1 performs much better) and fio jobs (lower num jobs around 4) this patch can increase IOPs by only around 5-10% because we hit other issues like the big per tcmu device mutex. Signed-off-by: Mike Christie 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: 384204 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 5B291C433DB for ; Wed, 17 Feb 2021 20:34:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1C0E064E6F for ; Wed, 17 Feb 2021 20:34:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231286AbhBQUej (ORCPT ); Wed, 17 Feb 2021 15:34:39 -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: linux-scsi@vger.kernel.org If a cmd is on the submission workqueue then the TMR code will miss it, and end up returning task not found or success for lun resets. The fabric driver might then tell the initiator that the running cmds have been handled when they are about to run. This adds a flush when we are processing TMRs to make sure queued cmds do not run after returning the TMR response. Signed-off-by: Mike Christie 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: 384202 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 66787C433E0 for ; Wed, 17 Feb 2021 20:35:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3809D64E42 for ; Wed, 17 Feb 2021 20:35:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234465AbhBQUff (ORCPT ); Wed, 17 Feb 2021 15:35:35 -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: linux-scsi@vger.kernel.org It may not always be best to complete the IO on same CPU as it was submitted on. This allows userspace to config it. 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)