From patchwork Fri Feb 12 07:26:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 12084775 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 07866C433E9 for ; Fri, 12 Feb 2021 07:27:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BB0E964E39 for ; Fri, 12 Feb 2021 07:27:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229710AbhBLH1p (ORCPT ); Fri, 12 Feb 2021 02:27:45 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:59526 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229625AbhBLH1n (ORCPT ); Fri, 12 Feb 2021 02:27:43 -0500 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11C7ObY8176673; Fri, 12 Feb 2021 07:26: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=drov18IvbxJcf1RpDKUP9FgkY5cU2xGkcthCPJKMhSQ=; b=pLunrxhbN6CoTYtASY4VmGfeKFVvWNi2wJKaY3f7U+5drkS4OmS+WLSRRgeFOy9UCycA cQ7wNlurpnkD/Ti/dHTg+DEeut8O0tpXu1gSUK+ZzQ1ck1JSnRKx4FQJsdsfCQAHtMVN sQMhHlHP3+BM1A8xOorRhbmxeNUjgTywo0qH2r2N8yJKWFyPA0JdD6aSxEt6H2Qt/uPu EkhR9bdm9fESaceLuKzvAoCT/jNyHdMx98GxakaPxM1RQ4y51Kkms58FntOTHK0ivHqq 7HoixMgm/IgP8KaD4sUE92S9DcD6J/pT5sH4hezJ5V6EaIEMch3IzMiz4dT4L44ppfgW cA== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by aserp2130.oracle.com with ESMTP id 36hgmatavj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Feb 2021 07:26:55 +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 11C7PZdN022757; Fri, 12 Feb 2021 07:26:55 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2170.outbound.protection.outlook.com [104.47.58.170]) by aserp3020.oracle.com with ESMTP id 36j5155a2x-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Feb 2021 07:26:55 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kRfHEcNo8yeCcQi747mBTNgvWwqojC5zGDk/RPl5/dTyNeFlFa6mMWhxNXVfoBOJ2q5cIiVwE6tEKcSSajixCm48T/9zv4HwBF1oNrytPnUYFgRqqVt29qUDHrAS3KgWoVumQfYH1EbHECT3P/NZQFykF/f6qTQiSfWHMfqVRavRp8vjbutwcn0KJB/pzKJ81G+rndGabr+LtzpI8kfZHl5z5y0zwK8oDannFNHasWOrwVVl4mmGE1zgbnjYnDDeAscjB6hDWTnTYYfjshoiMCZW2z757pVs7tn5++RXr6guaJR0Jz6BaF0QBkD39GKrbT1ulJes4xfpTgKwUE/m5g== 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=drov18IvbxJcf1RpDKUP9FgkY5cU2xGkcthCPJKMhSQ=; b=WT0YJGDqe/MtdZqkj55TqYbi7m5wICHnM2lQDiCiFa5oDUl/5SXpTjjTjUvmjycQDnbRJLLNyGmGXNmyzM/KF2X3fKiDDaAnpEwjXLMe3XdtEvzYghnQAYTh2hf5MhO5j2rRpGyNIaQZLQ17DGkFS0tO/U6vic873CA6gcImLP2Cub9ZxmuYv7ng7NhBX4fSYOUT8/p1excIgwOfXoPtLSHjY9ZQ2nHnuEOAnrRwHS+SB6ZQiGE+ss6RSv3CfSmP8v6UxeRDY3DAETYkRr/byl0PAomvuuonmDdFcsSGxY71gVbbvke5tZyY1SjgL1hihMQpgqx8dxZ9clXe4CIryg== 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=drov18IvbxJcf1RpDKUP9FgkY5cU2xGkcthCPJKMhSQ=; b=YlG9Uh7YeY2arGA3zPuzZ6sYzWlNt98kmDoPK5RorTi0rvOZX6J4C2+sH8a2PlwKZBJhGtN5WKNXcRSCcbkNg3KgV1O42WbutC62361BLPCAwYkS5TV3KWXSlCt9zF/uwuryYSk3NOiNrRl4g5ZbWJNKcsekXpKDrmOhHS0Lu+I= Authentication-Results: redhat.com; dkim=none (message not signed) header.d=none;redhat.com; dmarc=none action=none header.from=oracle.com; Received: from BN8PR10MB3570.namprd10.prod.outlook.com (2603:10b6:408:ae::12) by BN0PR10MB5256.namprd10.prod.outlook.com (2603:10b6:408:12f::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.27; Fri, 12 Feb 2021 07:26:52 +0000 Received: from BN8PR10MB3570.namprd10.prod.outlook.com ([fe80::513a:2259:52d5:e495]) by BN8PR10MB3570.namprd10.prod.outlook.com ([fe80::513a:2259:52d5:e495%4]) with mapi id 15.20.3846.027; Fri, 12 Feb 2021 07:26:52 +0000 From: Mike Christie To: mst@redhat.com, stefanha@redhat.com, Chaitanya.Kulkarni@wdc.com, hch@lst.de, loberman@redhat.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org Cc: Mike Christie Subject: [PATCH 01/25] target: move t_task_cdb initialization Date: Fri, 12 Feb 2021 01:26:18 -0600 Message-Id: <20210212072642.17520-2-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210212072642.17520-1-michael.christie@oracle.com> References: <20210212072642.17520-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: CH2PR14CA0050.namprd14.prod.outlook.com (2603:10b6:610:56::30) To BN8PR10MB3570.namprd10.prod.outlook.com (2603:10b6:408:ae::12) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by CH2PR14CA0050.namprd14.prod.outlook.com (2603:10b6:610:56::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.27 via Frontend Transport; Fri, 12 Feb 2021 07:26:51 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 37770d7d-5953-4c7a-8426-08d8cf279120 X-MS-TrafficTypeDiagnostic: BN0PR10MB5256: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6790; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ejj4rh0AV81bBe8jfRxiLBFXjWA85Y+n7X4tSK2FEMGScdl2DJipiHbAjsO+TaPb5iXdCJJYhoM+6qfyl1pV13cjKZkwoG/BVSeI0MfTEUGaYvvzEWRTL/D7GaRLip+mEy7bnM772q/DG+XEW1fNviZLMwwESkg3suVS+SuJkcWsf58Pn9B5VmU8xs/W4aEftPYte5HhdFQPz5ePlwL2VGPzs+nkrmnqtCLgLBCIDQwj9mjzzIAOjSAw8mzKo/FLNBy3VSbno+hfzVv2pkoHxNwBP/7oaS5TAdljAT0xQDcEe+AysbmgyJ9mNOfrSTyfK6JeaUe9KjvQeQ0+DpbwDYP40rdsjw980Dqv3/IRowr//TBd8UdMGh8GzJ6dptyAmf25iOQHzTCVPepSgGGFO7i3xJIkO7YTzpTOHWAhuFGw7FhopBAUoNXVzs0+mGaVhFMEThzp50QMt29q69PgkYkYQPR9iYmWzyMNfvJdremIlCkNbV8M9sJpo32BD5c23FXsTHRtwGESvv0RrMgrJ9T+uQcKo1AFmVL88PpIr8aYVPlyrNS4Y3V+BMrSuCpGNJ3P0ITn9b3hffjoCOlAqQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN8PR10MB3570.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(376002)(346002)(396003)(366004)(39860400002)(136003)(478600001)(1076003)(107886003)(6512007)(83380400001)(8676002)(66556008)(5660300002)(316002)(66476007)(6666004)(8936002)(69590400011)(4326008)(36756003)(86362001)(6506007)(16526019)(2906002)(186003)(2616005)(956004)(6486002)(52116002)(26005)(66946007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: txqG44vguLV8id+UnINMMNEJGQcE9B/5LeVmJYT6F/BVMVpIXsUzbFb53cXQRbGDImHs+b73YK/tEKm3h1st83+HsD87li04x0uqZbFD3Te+zn7s5J9gYsLuWK+nt8E3zx++KoevSZSoFCNwaExzFvRu9AVqKRynuxKKJyH1a9yD4iyH9klkQ9PANg+KEpHkG97tbo6ZgeoB6yaGcaFsxJIwIP4Ij6HckkjX4LRZm9EmpUW6B46V1kOK4D3DiWqy/KzyGzYU3+WvEF6eOjwRuZtvwPyaFdVLfb9FV04vX+Y1wzJSv+nQ8kCY9Eud4Gsa5x22L/B1Y33ncfeCQjeMfZms5VXPwXC6PiRHGvBgApy2owZeehDk1dSm1Hn4l7wfE7U/gIFgulUS4uzRl9LBodmOzuEYrh3RAK4ge5/cbXhNYSEzLZI4UCIpEYKHaLH1MjePwk/IFLuJQQD3c2RZyhriHegLVD0RXTVzx5JD2GGvDrlp4+coh+tg1uMXf+Ij8J4MqVmWgNglfgns3BFOPgRQoDVz3W7T1PdiJ2RSGeAIanNl6yVxoKF9p/rKrhsDGVuqHXmgRdT626BleUATIShhmpqGkqD7aBmNK3HiAfinCTC4p/4/kPzIq+ByCMozw7vkDxiRuS/18C11e8yVx0rpvDvCDTGjGnm1/L4bURjbab13xz2fKct7HnIYigZjpN7b9TBE+3GwdFd/+/VRwZYnopMd2/Sgqu4sWmUf5+3So5rE6bOJrXCCR979OOgxqL46OOpKdpj4VOA6E7GU0amHYmgVFF1YxBNk6ohMpJIRPn8N3KB1jfOgLlO+Au4YEL1PLAbpyQt1MX4DrZniHYDyPFqztYBYWLz1vT0qYFJ83BreJMurDyH6C1XEqa+6IUgIcG0sKNWbNFzDPrVs4PWYhFsT05aqPN2wrOh1noz7715s2/ZBtjgEQ0gmBndNT/2AN4AK0NpWXAy6HCSj/5bso396f64VMJwOsFw+HR+iijrO0bwvQOXl2ozhqhvWQAS4sg35DvmsnYpYLTv7CjPpbWp6WbN7tTVEPcECqeoNHHvmI/JPH+WSMx5Cw+oGT+Ex5jgSbHDvIVJYaef7EsQCiSx7ePs8hQiDgINYPimvJpJT9r0bbXMC95TulXSXM2vzFKDZHPh0cpcgEY+0/Cs/qrPdqtp/phVvKdCgCJofJ+V9cZIL1e3cy6/osImpBvQOX/iqu/sFRvGEdfQLsuo6LyUuUZMu2EFESSnaw7/RyGBvzm7EGTM5ogAcCCptAKCmPPBTLxQ5pn3N+6rqp+IEiRxp94pJZdr3Rvnu24ocBfSZV+NNXDhPGLZcykEG X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 37770d7d-5953-4c7a-8426-08d8cf279120 X-MS-Exchange-CrossTenant-AuthSource: BN8PR10MB3570.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Feb 2021 07:26:52.2644 (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: BGtk1/78iPi6vtcu5EkDuJ2XEsd5GenlHR43wGo0tnL19DESjy1QsYl2/k6eHVecu1WSvhJRZDRej3NZHg6fH8htywUANz3mVVfffECBW5c= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN0PR10MB5256 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9892 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 bulkscore=0 adultscore=0 mlxlogscore=999 phishscore=0 spamscore=0 suspectscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102120053 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9892 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 spamscore=0 lowpriorityscore=0 phishscore=0 adultscore=0 impostorscore=0 suspectscore=0 mlxscore=0 clxscore=1015 mlxlogscore=999 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102120053 Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org The next patch splits target_submit_cmd_map_sgls so the initialization and submission part can be called at different times. If the init part fails we can reference the t_task_cdb early in some of the logging and tracing code. This moves it to transport_init_se_cmd so we don't hit NULL pointer crashes. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig Reviewed-by: Himanshu Madhani --- drivers/target/target_core_transport.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index d47bfd8b0f87..5c4adde96d5e 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@ -1389,6 +1389,7 @@ void transport_init_se_cmd( INIT_WORK(&cmd->work, NULL); kref_init(&cmd->cmd_kref); + cmd->t_task_cdb = &cmd->__t_task_cdb[0]; cmd->se_tfo = tfo; cmd->se_sess = se_sess; cmd->data_length = data_length; @@ -1430,7 +1431,6 @@ target_cmd_init_cdb(struct se_cmd *cmd, unsigned char *cdb) { sense_reason_t ret; - cmd->t_task_cdb = &cmd->__t_task_cdb[0]; /* * Ensure that the received CDB is less than the max (252 + 8) bytes * for VARIABLE_LENGTH_CMD From patchwork Fri Feb 12 07:26:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 12084777 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 58708C433DB for ; Fri, 12 Feb 2021 07:27:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2AA5264E65 for ; Fri, 12 Feb 2021 07:27:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229771AbhBLH1r (ORCPT ); Fri, 12 Feb 2021 02:27:47 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:40238 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229697AbhBLH1n (ORCPT ); Fri, 12 Feb 2021 02:27:43 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11C7OeOD016620; Fri, 12 Feb 2021 07:26:56 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=OPcT//Kq3cYrLapZOgfJNb3G5rpW402u5X2h4TMCZm0=; b=af5yYbgGLisEhkNWvovDuiTLsa1jpTtlXAC5YrExN1+/f1Ju5QzIje2ycCxlLqKl3xne e3GRTHpEsMcmntFaJ+FyLag15pUnVLYXh9T0WcYvB8dvQ4oHaGCQwIjDDdR1xMfpO4TO rO3IabOSwY1mTlPgRvCCVr1wuRWKJZGdEqt5CudxviONyo+mDlgBBIldj5i1bEF5/EH+ y6x4IvYSB1LuqLBEdR8pudbKFW6ZWVQqSn2FcsOPfeDrMZuU5YMNXmD4mVte1slI8DgX yYe/W4DbsTOXuQdoTx8wjenAmGS2m1IlNtsZF1kruj1iueTFsh++clKuWF9fCCD6Lqyx ng== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2130.oracle.com with ESMTP id 36mv9dvcu0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Feb 2021 07:26:56 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11C7PZdO022757; Fri, 12 Feb 2021 07:26:55 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2170.outbound.protection.outlook.com [104.47.58.170]) by aserp3020.oracle.com with ESMTP id 36j5155a2x-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Feb 2021 07:26:55 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aEMBVrYn7sGLOpDzY2Vy/2o3qYFziug4d/w5CJeTfOzqAcXc4hcd2TyLkfknOeY0goaRkSGiXjoFsl0linoBO47NK/m9klONFnQvoYgQEHVsOGrPtW8R1Fx8OEmIlC2Bj3fdZ8aNd+82eXfwwTOMiD+rfL8twsFvgy6CE3iGzPKBNkJNCRJ7Kf7VVvdtk88RMbfZ8FJYYbBk3GiR5RveUDp8X1ApIX/XGqrKG2pJLi931jN0w4xNVrT1AE3y4nVYlZooiIWC3qT+aoN9I0WwBo2K/l2lxG5WhHBHiBIXVVwf78CgmNfLhZxXX1y/d2vrWTPynD8rsA24wmfPbFis6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=OPcT//Kq3cYrLapZOgfJNb3G5rpW402u5X2h4TMCZm0=; b=cfcjwo7uDWjUBb2CEIwQ1Zui/ntPV3AIjyF974Dt/wbmNWypuDN4BfKvTWh5aSV5pWmezb+XcRXgg/mEfIK4jNQj0Hm5hlsTo03IwLxZ29vxrLLrBxDUV6bKWgn5LrDCfjfEzJc7bwuyEyBvy1cnzJj+Kcul+sqaezzoA405u5ixANf5ZCKlLMAZi9qxcEuLXdSEumNmV7bFVUNhrGUl1+kCFOwFUQbHqTrPMwyH1jkuhYhKbOmLpUiaLEbCKR2/Jz9nwahIdMdRhIMiRvvVF25Q9lkLJhKOw4tvpwpy/xzmNx5SwttWB17AcuyxrLyL+kAWSeb2jNnozmgdqQEJPw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=OPcT//Kq3cYrLapZOgfJNb3G5rpW402u5X2h4TMCZm0=; b=MxQXUAQRbRfP/dzT8j7ftnRmyJJh+OFYE0gg9pJbh1t4HL5h3YOC+oyg+O6D7GzvaRqoxuNtXDx9OKZJOed6wHnMpyKGO88S/Pg/K3YrG4S2+akZ1Ve1k0utFUQyDo6uYt9KuLSBz9BJgieocUFeTFcHMpV14lGHdu3hEpEQQrg= Authentication-Results: redhat.com; dkim=none (message not signed) header.d=none;redhat.com; dmarc=none action=none header.from=oracle.com; Received: from BN8PR10MB3570.namprd10.prod.outlook.com (2603:10b6:408:ae::12) by BN0PR10MB5256.namprd10.prod.outlook.com (2603:10b6:408:12f::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.27; Fri, 12 Feb 2021 07:26:54 +0000 Received: from BN8PR10MB3570.namprd10.prod.outlook.com ([fe80::513a:2259:52d5:e495]) by BN8PR10MB3570.namprd10.prod.outlook.com ([fe80::513a:2259:52d5:e495%4]) with mapi id 15.20.3846.027; Fri, 12 Feb 2021 07:26:53 +0000 From: Mike Christie To: mst@redhat.com, stefanha@redhat.com, Chaitanya.Kulkarni@wdc.com, hch@lst.de, loberman@redhat.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org Cc: Mike Christie Subject: [PATCH 02/25] target: drop kref_get_unless_zero in target_get_sess_cmd Date: Fri, 12 Feb 2021 01:26:19 -0600 Message-Id: <20210212072642.17520-3-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210212072642.17520-1-michael.christie@oracle.com> References: <20210212072642.17520-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: CH2PR14CA0050.namprd14.prod.outlook.com (2603:10b6:610:56::30) To BN8PR10MB3570.namprd10.prod.outlook.com (2603:10b6:408:ae::12) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by CH2PR14CA0050.namprd14.prod.outlook.com (2603:10b6:610:56::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.27 via Frontend Transport; Fri, 12 Feb 2021 07:26:52 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: cd50580b-32ab-4d28-c100-08d8cf2791d6 X-MS-TrafficTypeDiagnostic: BN0PR10MB5256: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: en7kcFhbcfJKk09hNOj7A54jaVv9gd8e4nZYc33ArA8lLdsmsZiHMO9ajAbamWBVe/ObamCRTjkYScLc8jjM9ayK/mIypTq23X/iAYl2ucSKSLZdl+YyGYA4NbCiwkwbq3ALi7gkhRZp01gFAc++shTxiDeEtZqx//8cZGxVbhCopWACoeETOGljDhzOiS4DVBvNQlLQG7W4Mk7XFCYZiRHqlk6Awt3jv26AcZnVnvEh706mCMYf2iRh1k9QmTEUvEXJ6bUK81lVeU7AxnGEejjebxKzq4VEnQQ+XWuRHbzBfCVuYTf4brVObVwPUdH+nHHPCX6hEuTDxucaBmQu1gFG36RSyJL0+zIUG27+H6J/Vwiw32eKqu1tETvUGcw0P5T99nGABhJ+0WhMLXKv4lCPPCl8eg+8WlumM07LulajBzWTWGS5z/d8R4//zJMFFLoIPzRkFiJkMU9fSx8gBNbnQwwlpeEdPVVB6Ab/q8RV/nSV9k/8WQH9ATMuRyXgtXIToJa7taEuuFgs5nKAtbOLhqB3Hlmv7eGTIaO4C2xk593RNNt+E+wNw7ir8TDjxWsW7/pYIU67rCtTVNYSHg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN8PR10MB3570.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(376002)(346002)(396003)(366004)(39860400002)(136003)(478600001)(1076003)(107886003)(6512007)(83380400001)(8676002)(66556008)(5660300002)(316002)(66476007)(6666004)(8936002)(69590400011)(4326008)(36756003)(86362001)(6506007)(16526019)(2906002)(186003)(2616005)(956004)(6486002)(52116002)(26005)(66946007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: hZhvFHtSNcYgnukz9aRhCpTmmOvlVYYZ7gYpyO6RFv7+K1YyGyOovEgOoIvyYO2hHJ2wC+o0MXnW0L04F05v6c4bIUtDyp6LfUCckc5YqTRkcMbtcDbiqxV2dqmeOUEN8JCXImw0mERZE3l9wuHB+l9MgE9+EeKSMtSXYKbFctyd0bL0PTxPORzUWexBy6SZ1liD7UYFJowslMMs9MYcGS4dH5eM4WQQAelMuOgcmqesENEc7kdV+sgLXbdyvlmYyzs5Cd23nEPeyDr6lUDle+a7bYSm6DmI1OecQc1Q6Fmy7zaIyxgGbHX1BkZ6QZhrK5tcjk7ENXVzDrNDmmhUvrb8jhCsYAwjJqhGnjpk4Cp0ec+sFNkp2oEU01nAk29exPwGDVj2bk87jJFCEqoup/NeoRL1g6M83QQKzPJTJ/X8SVijnYedxXi6UUghoLqBd/jSkRiRRBRmlg1q5McarQRtk05C4bl6rkrSHEoriDihustk79ScPPxWb6F+WQ3tP6eoVEY1yfIXkR5droIFm9FnOoABZ0kQ2DquSk0f9aM2b2fNvhsw6HwCOjdB0WISa3NXjIN56k+xc4pewW0muNlljcbQq5KlD/l0i8OVBO5WNi5U/QR2V638brYByhKz6b6KPwfLlx+prkSzrztgPu6FbZMccyLYjkd26j5tGR/ILsHslL36KL/NOeHP9oC2VvNrmqE4Yh+4weAmdm//k128IfwNbS67yTWhPg8r0G+kkxQmHv1bkkpMwPNRa+gCP1tR7zrnUgAEYuHCj414WMyKlE6peleAkribJXzQRxlr0FsZZZRcv+1Bfc8F0AF/DJXzDdTCsPO9fksQRFoXiyCEWBK4Zx/rEcqfZO4uTquvZ6KgRihOolHx3i6bKrQRWF47rey9W0UMxL1yJlnDCg1p/xXcyAf+yL2/2ldsRfNczA0SRHrr96zpYT1HBoeutN5aiS3JHwzA5gm2dq1yPfqswlLr2UhzQK4oiIBdcltKxSPfY2iMwDPc9pKj/PNgu3jFXvxMYfcS06kOpqEC9Gp3H/nxKpIyHJ0C+qZkzui7L1FPmkmwRXvBuzlh4tCxiPVKGjAp4zQeCFRBCCWpfqFR+gfDsLNXFKXRMWcKjwCRYkLk4fqTcBSLuRWOoh3kjwblqENpmKq+cr7RlywCOfRxzTVAEPzNn3N6jqAYt6CZhsNg4Ucz7jksi+xZD3J+kYeh65fOPlpwidQrpYN/grrPz0rVk/q/5xEmhLZNRTIZt5aYdSATYccPnsNYlPVgifTSFktkEggge6liHGISlccFcal729ASaxCbJOkdsuu+Ch/IxSt6rNilpXBD8M1K X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: cd50580b-32ab-4d28-c100-08d8cf2791d6 X-MS-Exchange-CrossTenant-AuthSource: BN8PR10MB3570.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Feb 2021 07:26:53.2278 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 0Q7l7Vl9sj+TzXYbttKFtU1EmLsTQ9UksdIH/tEhBrfmZR1sX2C/tMbKJSdxHKmidNYEQmtsc6cC5ONRK5BxZEHArhCS7eMDgcyDGjX3Lx8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN0PR10MB5256 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9892 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 bulkscore=0 adultscore=0 mlxlogscore=999 phishscore=0 spamscore=0 suspectscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102120053 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9892 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 mlxlogscore=999 bulkscore=0 suspectscore=0 phishscore=0 adultscore=0 impostorscore=0 mlxscore=0 clxscore=1015 lowpriorityscore=0 malwarescore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102120053 Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org The kref_get_unless_zero use in target_get_sess_cmd was added in: commit 1b4c59b7a1d0 ("target: fix potential race window in target_sess_cmd_list_waiting()")' but it does not seem to do anything. I think the original patch might have thought we could have added the cmd to the sess_wait_list and then target_wait_for_sess_cmds could do a put before target_get_sess_cmd did it's get. That wouldn't happen because we do the get first then grab the sess lock and put it on the list. It's also not needed now, because the sess_cmd_list does not exist anymore and we instead wait on the session cmd_count. The other problem with the patch is that several target_submit_cmd_map_sgls/ target_submit_cmd callers do not handle the error case properly if it were to ever happen. These drivers think they have their normal refcount on the cmd and in many cases do a transport_generic_free_cmd plus target_put_sess_cmd so they would have fired off the refcount WARN/BUGs. So this patch just changes the kref_get_unless_zero to kref_get. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig Reviewed-by: Himanshu Madhani --- drivers/target/target_core_transport.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index 5c4adde96d5e..b5427e26187b 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@ -2775,9 +2775,7 @@ int target_get_sess_cmd(struct se_cmd *se_cmd, bool ack_kref) * invocations before se_cmd descriptor release. */ if (ack_kref) { - if (!kref_get_unless_zero(&se_cmd->cmd_kref)) - return -EINVAL; - + kref_get(&se_cmd->cmd_kref); se_cmd->se_cmd_flags |= SCF_ACK_KREF; } From patchwork Fri Feb 12 07:26:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 12084779 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 33D56C433E6 for ; Fri, 12 Feb 2021 07:27:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F276F64E39 for ; Fri, 12 Feb 2021 07:27:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229782AbhBLH1s (ORCPT ); Fri, 12 Feb 2021 02:27:48 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:59514 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229608AbhBLH1o (ORCPT ); Fri, 12 Feb 2021 02:27: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 11C7P3mW177047; Fri, 12 Feb 2021 07:26:56 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=PcDMkIOGiiiNNCS4SxqjW648dqtIY2qb3MzjfLpuMXY=; b=qyYlFxbvANLaNVBdlBgZIVS2ByZEOM7VE6TJNorG8se9NgpexpqDJZL1AnE8BN6dHGEQ V+s7DDMlPN5WfbTo6ZgKEKPHLTqQaAm7BSdejHAqwgCKYuF/qg0DhQvqiRG3HVltJxUb VyrbiVSMh53GKtTAwp3l2hVWGEmVyTFiUtw/h/iNL74HS5PzlwiO7kIT6mFG77OFO9+i 9Pj4JZgUJjZz7EIamWMbKACEN7b8D4jpaQEZ+pAUA0HD1lmGEHyaKKXMI6MSwAQ6Idrr J42oucESMQB/DGtudk+QycYX05BZVgg/DPlAS13nO6Mg4PbOzNFxCSND3l8bz8TXePeQ bw== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by aserp2130.oracle.com with ESMTP id 36hgmatavq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Feb 2021 07:26:56 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11C7PZdP022757; Fri, 12 Feb 2021 07:26:56 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2170.outbound.protection.outlook.com [104.47.58.170]) by aserp3020.oracle.com with ESMTP id 36j5155a2x-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Feb 2021 07:26:55 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ecxm1KhLomo3P8wRqY3mJ9yiSjSCq6AzFKlJKWTbtbfHqDAfQ1upB+4FRZHB/RtXGjgoMT21aGoNnPs5k3GdnaHmID+zAEcL/Pihz2GRC0delZR7tFNrsPCXsFSmf0BX+PKg3G7tn0E22UxrfXyVcA30KtPU8XaHNutwbM/GkX7TPCSTfduG4sga9LwTS3ezGKVaHyUValPoFIZ0SWdUxZcmfySFHi1iVqbc7g5TGZinnpAB1tazrB5ltB48Qv6QnVzqnvwczX68WOy8XOXEA4UKoNMYBDYe4ONBC5wlRnVZfTqddCvt/iy4bhyIZiN/xdwKcLOczo+w+fwYL5meAQ== 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=PcDMkIOGiiiNNCS4SxqjW648dqtIY2qb3MzjfLpuMXY=; b=LRR0gjtAG5dL0LRBbngL9/IWtC0ba7cCdTzGVZ7BLJsI3WLUXRyAuUe6ZdGGRpd6uTGtVRDf/5ZQfQmsx4bTSL/h6DoswslzEbLAvqWfhx+qDWiN+BfyRiV/6NeiAMRng7TW0ZqOtVb8WC6U+3S/PBzQdR6rUbfZ1jszuPtSr+6AAZId0NQcSTgQ3y60WXMA0/I5rD5iK3JrbWLaZjbF6HSmc2GQxNYwIZ08CUQXC/sYKhJrWGcjY/qX/Q1D7kliwaKiq+sBs9rXL57sjGXTeeMx3/4YxalIsi4Mnp3IzbrVODyyXuL4bP76omfO/MppA/02Ez5YAqPwPEa37eqkew== 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=PcDMkIOGiiiNNCS4SxqjW648dqtIY2qb3MzjfLpuMXY=; b=RtlvNtVQgji4MH1ES9zqnZhnJYLMKaR4pKUBIhxfZR6+f6cl3jv3iFnW5sqnZuprjjSh5WxK1POhN7RfpeB6E64vi+DI/IHxeMFnlUSKpZvWNDFA9+GMU204W1sGJi/stINl2H/WFFEInV+h4KJetZGEG0uugwFUiC1Bz2A4ldQ= Authentication-Results: redhat.com; dkim=none (message not signed) header.d=none;redhat.com; dmarc=none action=none header.from=oracle.com; Received: from BN8PR10MB3570.namprd10.prod.outlook.com (2603:10b6:408:ae::12) by BN0PR10MB5256.namprd10.prod.outlook.com (2603:10b6:408:12f::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.27; Fri, 12 Feb 2021 07:26:54 +0000 Received: from BN8PR10MB3570.namprd10.prod.outlook.com ([fe80::513a:2259:52d5:e495]) by BN8PR10MB3570.namprd10.prod.outlook.com ([fe80::513a:2259:52d5:e495%4]) with mapi id 15.20.3846.027; Fri, 12 Feb 2021 07:26:54 +0000 From: Mike Christie To: mst@redhat.com, stefanha@redhat.com, Chaitanya.Kulkarni@wdc.com, hch@lst.de, loberman@redhat.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org Cc: Mike Christie Subject: [PATCH 03/25] target: rename transport_init_se_cmd Date: Fri, 12 Feb 2021 01:26:20 -0600 Message-Id: <20210212072642.17520-4-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210212072642.17520-1-michael.christie@oracle.com> References: <20210212072642.17520-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: CH2PR14CA0050.namprd14.prod.outlook.com (2603:10b6:610:56::30) To BN8PR10MB3570.namprd10.prod.outlook.com (2603:10b6:408:ae::12) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by CH2PR14CA0050.namprd14.prod.outlook.com (2603:10b6:610:56::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.27 via Frontend Transport; Fri, 12 Feb 2021 07:26:53 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b0ba6ef5-51fe-41ca-8b3a-08d8cf279268 X-MS-TrafficTypeDiagnostic: BN0PR10MB5256: 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: /S060754TmRc54AQ5Hcu8NpJiq3Yk6sTPYriWNMj6h1+NutAm6Q0eAwnUu+vS+bdT4Eahfn3nGKwjiWP3EHGUeHV7sjTh/8vzgsiKStbOgLY3W/IaGMSNqMFNbHK7wXoPSZqLZt36vjl0pCXeBGGyBflNr8zo04hVmAPEeXzv+rQJ4KJX+NqVd7KS5vRTN8lDnqTPC84lmrUy9A1ictnG76mWer9uIHBHyHkOV+QRdQFEMUyiBLJng8Ba37YMuEvaUkARBBCjBTt+5xPHloL3c84Uqu3gTveepFPiGg3g6xZbuJybIOc4zOrTDjcCRuv20jWoBzz+X2m/FkY3NolSAa4PdCuqMYZUx0GHXNQowqc3v2wHjIT7/uFaBWu2AdzYUFrpS2pz5igLgPXKkt3D1G2XyaGJ0HTK2FLgnkslnSSfrPsNX5u/fQ+BNtH+NUwHwjpuXZ2pBEEie9y+evQe3n25eIE6F5f0jkO+bMQzjodrg1y4HZ+VSZ4rmLZg2LkLBHB5CxWBYxKCJJc69rK55AcCiW+BlVcLSQQYlSEvK/fcVTs2sLDg+lfdMp/HfzrD+lf6g2FPh3T4ioDGxKWog== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN8PR10MB3570.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(376002)(346002)(396003)(366004)(39860400002)(136003)(478600001)(1076003)(107886003)(6512007)(83380400001)(8676002)(66556008)(5660300002)(316002)(66476007)(6666004)(8936002)(69590400011)(4326008)(36756003)(86362001)(6506007)(16526019)(2906002)(186003)(2616005)(956004)(6486002)(52116002)(26005)(66946007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: XnTwPOHA8gl7AQAFNBqbyQ3lHxg9V4YqQDImiyDSOQBFwByTeqk1Q6WulAoS1VVGyqKvwIIFTms55BHEVVS76FbV+p/n33bUqIVKuZsAUunsSCXgt1hxiJQfG3bg5fsAUEnAW8augXRkn5nCvwephqZ4ln4K1nTceoTPtQrmpJPEDJfy2mY3a22Mo8Y9JADNuijHV/1wFobOndTShHTBVmwxIcM4Paxm+I1TO/6A43cUuzMEFbUFId0OSUwRgN2FFkjSp1XSmhhSpW/AhQ75aMepb6QXsBbEHQvsTvJuCIT8mcVaHdvUEMkXHDLBefOlS5U1V4LE++H7qkSjlT4zwSpxOTFosEhd+N9WEdHO0/Q0wc2R4tuoM0OtiIvhaRPjL4T4Emrx0tNJzttHKKxCIncNkTDdxguc0sHsuQqCVfwawSkmFJz/t3GobPfBApZyPhvJRsScEx73ajPMBHCSNhnbpT8jwK3f8oHc7IEEC2/HZliScgIbeDBs86GH1qAQRlJA2VvV+GQhxPntpLtH89bh1xLwJM3ohIEPBeR8yb5wkFU4cJvZTJFJE6NbXmPJ9QCy8mWiRGd2EklYvbP57NDO3s7+UOmfA9IhGs3TkVrAJk89KlDQsYZnVV9aybnenRzrxl5aMcdvi0gFDAW4D9tWb3w7QhKxHDQ7G1YxxevytdH8kf43JbwSbk48e8AnTOUJoIMKvuMx4T3+eSvPDVjapdb61Ig8hV6aFhZDuUvLHnwNNZfyXA4BYrROZx5Q6cl5q/81yCYjiQBKhIqmB2CSPBopKz/SgzgaZNBIztBQJENAj84FSTz7rOzklGWuMYa0bm9lOLf6NyzKOHOhsb0bx+Z4MnFmyxFDfctVLULzCTNZLHjkPgqxR8axZMeuBGzeaQmt5o67jsj7x0Epb03L28rlAW8cHyXdAautBklc7SqPISBQntdit/gyZVwfzcZN51lrCoxAiV5MJBHwXqWjkfwfgHoUXYk5uLetYW7F5a8A/hqMSTDLNSQMwBkwafyiDQFDV33ftQ5NnHqz4N4O0P0Jm49axGPijnOUFvj3jj1RcLV7N6505xUvVm0GadBU8QDqxaVSVbrhWcUFkq0Zz8lA9DYBmh9vHbn59eXIVu7N0XU1NznQfNZh4/giI1cB2yFz7vNGNYfwRbc8hGENKCdUHBrbgs4e0r1fYvpwAoDSAMMqiVT+n0jiII6XFbz2s8VNficWQUhgLhLOA+3j3E00BXf/CzF3FlL2rcpCUOfY2AB1s9JvyXKwgF9kFAWbGPPFmiotI4nxW2SDTvHLxIYS2P5WCfHLv10Jq4IsTUKflF/zuyyDbgPfu23P X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: b0ba6ef5-51fe-41ca-8b3a-08d8cf279268 X-MS-Exchange-CrossTenant-AuthSource: BN8PR10MB3570.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Feb 2021 07:26:54.2602 (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: h7ooEqBaBnaYpJEGbn8Q4RemO4K2NbGYe0vZjbZvrKr3ZpiKNU1YrAcnbBrVOV0a0N1pS2haZsc1NFY3YFXj24//vN6H9a2j+ZsDIvHW9o4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN0PR10MB5256 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9892 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 bulkscore=0 adultscore=0 mlxlogscore=999 phishscore=0 spamscore=0 suspectscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102120053 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9892 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 spamscore=0 lowpriorityscore=0 phishscore=0 adultscore=0 impostorscore=0 suspectscore=0 mlxscore=0 clxscore=1015 mlxlogscore=999 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102120053 Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org Rename transport_init_se_cmd to __target_init_cmd to reflect that it's more of an internal function that drivers should normally not use (usb seems to use it wrong and iscsi is that weird guy), and because we are going to add a new init function in the next patches. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig Reviewed-by: Himanshu Madhani --- drivers/target/iscsi/iscsi_target.c | 16 ++++++++-------- drivers/target/target_core_transport.c | 16 ++++++++-------- drivers/target/target_core_xcopy.c | 8 ++++---- drivers/usb/gadget/function/f_tcm.c | 20 ++++++++++---------- include/target/target_core_fabric.h | 2 +- 5 files changed, 31 insertions(+), 31 deletions(-) diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c index 518fac4864cf..f2107705f2ea 100644 --- a/drivers/target/iscsi/iscsi_target.c +++ b/drivers/target/iscsi/iscsi_target.c @@ -1154,10 +1154,10 @@ int iscsit_setup_scsi_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd, /* * Initialize struct se_cmd descriptor from target_core_mod infrastructure */ - transport_init_se_cmd(&cmd->se_cmd, &iscsi_ops, - conn->sess->se_sess, be32_to_cpu(hdr->data_length), - cmd->data_direction, sam_task_attr, - cmd->sense_buffer + 2, scsilun_to_int(&hdr->lun)); + __target_init_cmd(&cmd->se_cmd, &iscsi_ops, + conn->sess->se_sess, be32_to_cpu(hdr->data_length), + cmd->data_direction, sam_task_attr, + cmd->sense_buffer + 2, scsilun_to_int(&hdr->lun)); pr_debug("Got SCSI Command, ITT: 0x%08x, CmdSN: 0x%08x," " ExpXferLen: %u, Length: %u, CID: %hu\n", hdr->itt, @@ -2013,10 +2013,10 @@ iscsit_handle_task_mgt_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd, buf); } - transport_init_se_cmd(&cmd->se_cmd, &iscsi_ops, - conn->sess->se_sess, 0, DMA_NONE, - TCM_SIMPLE_TAG, cmd->sense_buffer + 2, - scsilun_to_int(&hdr->lun)); + __target_init_cmd(&cmd->se_cmd, &iscsi_ops, + conn->sess->se_sess, 0, DMA_NONE, + TCM_SIMPLE_TAG, cmd->sense_buffer + 2, + scsilun_to_int(&hdr->lun)); target_get_sess_cmd(&cmd->se_cmd, true); diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index b5427e26187b..013f4a5e8972 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@ -1297,7 +1297,7 @@ target_check_max_data_sg_nents(struct se_cmd *cmd, struct se_device *dev, * Compare the data buffer size from the CDB with the data buffer limit from the transport * header. Set @cmd->residual_count and SCF_OVERFLOW_BIT or SCF_UNDERFLOW_BIT if necessary. * - * Note: target drivers set @cmd->data_length by calling transport_init_se_cmd(). + * Note: target drivers set @cmd->data_length by calling __target_init_cmd(). * * Return: TCM_NO_SENSE */ @@ -1369,7 +1369,7 @@ target_cmd_size_check(struct se_cmd *cmd, unsigned int size) * * Preserves the value of @cmd->tag. */ -void transport_init_se_cmd( +void __target_init_cmd( struct se_cmd *cmd, const struct target_core_fabric_ops *tfo, struct se_session *se_sess, @@ -1403,7 +1403,7 @@ void transport_init_se_cmd( cmd->state_active = false; } -EXPORT_SYMBOL(transport_init_se_cmd); +EXPORT_SYMBOL(__target_init_cmd); static sense_reason_t transport_check_alloc_task_attr(struct se_cmd *cmd) @@ -1623,9 +1623,9 @@ int target_submit_cmd_map_sgls(struct se_cmd *se_cmd, struct se_session *se_sess * exceptions are handled by sending exception status via * target_core_fabric_ops->queue_status() callback */ - transport_init_se_cmd(se_cmd, se_tpg->se_tpg_tfo, se_sess, - data_length, data_dir, task_attr, sense, - unpacked_lun); + __target_init_cmd(se_cmd, se_tpg->se_tpg_tfo, se_sess, + data_length, data_dir, task_attr, sense, + unpacked_lun); if (flags & TARGET_SCF_UNKNOWN_SIZE) se_cmd->unknown_data_length = 1; @@ -1797,8 +1797,8 @@ int target_submit_tmr(struct se_cmd *se_cmd, struct se_session *se_sess, se_tpg = se_sess->se_tpg; BUG_ON(!se_tpg); - transport_init_se_cmd(se_cmd, se_tpg->se_tpg_tfo, se_sess, - 0, DMA_NONE, TCM_SIMPLE_TAG, sense, unpacked_lun); + __target_init_cmd(se_cmd, se_tpg->se_tpg_tfo, se_sess, + 0, DMA_NONE, TCM_SIMPLE_TAG, sense, unpacked_lun); /* * FIXME: Currently expect caller to handle se_cmd->se_tmr_req * allocation failure. diff --git a/drivers/target/target_core_xcopy.c b/drivers/target/target_core_xcopy.c index 66d6f1d06f21..e86cc6135587 100644 --- a/drivers/target/target_core_xcopy.c +++ b/drivers/target/target_core_xcopy.c @@ -615,8 +615,8 @@ static int target_xcopy_read_source( pr_debug("XCOPY: Built READ_16: LBA: %llu Sectors: %u Length: %u\n", (unsigned long long)src_lba, src_sectors, length); - transport_init_se_cmd(se_cmd, &xcopy_pt_tfo, &xcopy_pt_sess, length, - DMA_FROM_DEVICE, 0, &xpt_cmd.sense_buffer[0], 0); + __target_init_cmd(se_cmd, &xcopy_pt_tfo, &xcopy_pt_sess, length, + DMA_FROM_DEVICE, 0, &xpt_cmd.sense_buffer[0], 0); rc = target_xcopy_setup_pt_cmd(&xpt_cmd, xop, src_dev, &cdb[0], remote_port); @@ -660,8 +660,8 @@ static int target_xcopy_write_destination( pr_debug("XCOPY: Built WRITE_16: LBA: %llu Sectors: %u Length: %u\n", (unsigned long long)dst_lba, dst_sectors, length); - transport_init_se_cmd(se_cmd, &xcopy_pt_tfo, &xcopy_pt_sess, length, - DMA_TO_DEVICE, 0, &xpt_cmd.sense_buffer[0], 0); + __target_init_cmd(se_cmd, &xcopy_pt_tfo, &xcopy_pt_sess, length, + DMA_TO_DEVICE, 0, &xpt_cmd.sense_buffer[0], 0); rc = target_xcopy_setup_pt_cmd(&xpt_cmd, xop, dst_dev, &cdb[0], remote_port); diff --git a/drivers/usb/gadget/function/f_tcm.c b/drivers/usb/gadget/function/f_tcm.c index 410fa89eae8f..dcce6e2605f5 100644 --- a/drivers/usb/gadget/function/f_tcm.c +++ b/drivers/usb/gadget/function/f_tcm.c @@ -1050,11 +1050,11 @@ static void usbg_cmd_work(struct work_struct *work) tv_nexus = tpg->tpg_nexus; dir = get_cmd_dir(cmd->cmd_buf); if (dir < 0) { - transport_init_se_cmd(se_cmd, - tv_nexus->tvn_se_sess->se_tpg->se_tpg_tfo, - tv_nexus->tvn_se_sess, cmd->data_len, DMA_NONE, - cmd->prio_attr, cmd->sense_iu.sense, - cmd->unpacked_lun); + __target_init_cmd(se_cmd, + tv_nexus->tvn_se_sess->se_tpg->se_tpg_tfo, + tv_nexus->tvn_se_sess, cmd->data_len, DMA_NONE, + cmd->prio_attr, cmd->sense_iu.sense, + cmd->unpacked_lun); goto out; } @@ -1181,11 +1181,11 @@ static void bot_cmd_work(struct work_struct *work) tv_nexus = tpg->tpg_nexus; dir = get_cmd_dir(cmd->cmd_buf); if (dir < 0) { - transport_init_se_cmd(se_cmd, - tv_nexus->tvn_se_sess->se_tpg->se_tpg_tfo, - tv_nexus->tvn_se_sess, cmd->data_len, DMA_NONE, - cmd->prio_attr, cmd->sense_iu.sense, - cmd->unpacked_lun); + __target_init_cmd(se_cmd, + tv_nexus->tvn_se_sess->se_tpg->se_tpg_tfo, + tv_nexus->tvn_se_sess, cmd->data_len, DMA_NONE, + cmd->prio_attr, cmd->sense_iu.sense, + cmd->unpacked_lun); goto out; } diff --git a/include/target/target_core_fabric.h b/include/target/target_core_fabric.h index d60a3eb7517a..4975c4d2a933 100644 --- a/include/target/target_core_fabric.h +++ b/include/target/target_core_fabric.h @@ -148,7 +148,7 @@ void transport_deregister_session_configfs(struct se_session *); void transport_deregister_session(struct se_session *); -void transport_init_se_cmd(struct se_cmd *, +void __target_init_cmd(struct se_cmd *, const struct target_core_fabric_ops *, struct se_session *, u32, int, int, unsigned char *, u64); sense_reason_t transport_lookup_cmd_lun(struct se_cmd *); From patchwork Fri Feb 12 07:26:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 12084795 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1C65CC433DB for ; Fri, 12 Feb 2021 07:28:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D7F5964E57 for ; Fri, 12 Feb 2021 07:28:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229890AbhBLH2u (ORCPT ); Fri, 12 Feb 2021 02:28:50 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:58862 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229861AbhBLH2K (ORCPT ); Fri, 12 Feb 2021 02:28:10 -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 11C7Q13W171560; Fri, 12 Feb 2021 07:27:00 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=ZUJBODL1IXVQSYFfl92SL6pxemZJ3XrNJ7gAgMaSyYE=; b=P58TIr4ooYcFC+a6A3BKyE7jQqhXy8pshKfeIppjhpBy09QUhSp4z05tMcgkg14mo9DY 7EBVaa+dsgpdTHBb97U5ogxbPc8joID8mvJuOTwgXuKBHs9EkZhp/I8iZfFna1GoLWQl fVx8r0sYrGo4WL0/GQxvHZZuIetDIFPU+QFDlfo218BjHTtWNBCMXrYGDYiJCeHrIMDJ zFgclDQc7Cc7bthzb/DCAXnrsIaOzBADz8CEEtRJbw6X7ue4TxYgWghjbn8xfxZQQlOP ifnIDmO3lx8mMWvSJxRnOhJm/mcuMNevNIvgHHMADODIBo1rj7V9czEqvEsdcoGw3OCs MA== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2120.oracle.com with ESMTP id 36hkrna54y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Feb 2021 07:26:59 +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 11C7OnuN012963; Fri, 12 Feb 2021 07:26:59 GMT Received: from nam04-mw2-obe.outbound.protection.outlook.com (mail-mw2nam08lp2171.outbound.protection.outlook.com [104.47.73.171]) by userp3020.oracle.com with ESMTP id 36j4vvcbub-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Feb 2021 07:26:59 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OgUVKcvXHPzf/ve6ZY8TT0VutNHlWwMa4+nhV+BE6/kTD2URWbEFqksVEYcHP4axgl15AhP1XrfEyHPK5TNS+EFvNuvQ+8hfMIaJuYtFfShFEeR+jBsTsrxjpWW02WSHuDG9RcZFa7PgIB49d5t1O8iDCrOvz8oQ99yAFyaSvJ7pzYA6I//g9fkoCdc9MehJQo0Eio8IhnlWnSjvPTGMsQPZe8PdA0WQqiXpkhlZbb8DWhXyQhg+lI17Qznwq/MaUaVRuSPNqPCIRxx2KgthLXQb3QoJ+brf3thRTfzfvz+JUgGD2b1hFoTQ6++upuyKifBp6uX5Y4/02dp/Jq7dnQ== 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=ZUJBODL1IXVQSYFfl92SL6pxemZJ3XrNJ7gAgMaSyYE=; b=V561QaTUu7XupuiVLjFLv20AShwiNx7OeHmhgnnVIBS5D7/woLoOFBtJD64864jDC/7de3T6vmWbbewFlE7nwk90xJ7SjYBNJ4llZJTz0FtTMhgX35bEZNlUXyIM+nJ/5yRfOUUEMKKzg5nXRJhDFE8Op/Yaih/yeVQo4y6ddbP+R0ESinxiFMXSgejDYUqyWUSdiR5l815aHyb9unv9lwMv9UqMs3NQFvBkJReh1iAu1/SwGQidjhHrxhXqr6fcxtonY5CNdFeSaiihMJ74117OjptEkoQFWS6khL2Qj4KwgHuSispsO9e05nl1VrwAtttwMBN6i/I+6aCDnt5JIA== 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=ZUJBODL1IXVQSYFfl92SL6pxemZJ3XrNJ7gAgMaSyYE=; b=xiHVzseNDPYAGK4zaF0eHeSDc8IEoEDDVpu/xyYTx0Mg0FTz/ldeqpujE1+NAcbAloicJXREmq1aLjMKjzpzp6AO1BC2JP9qmtvaHrXzvX3bPgJTvNuNhGPCB2sKd+6rCBLA4dsjsrIGRDrIshyw+sI+ZMfHHTiNhPpvct1F8f0= Authentication-Results: redhat.com; dkim=none (message not signed) header.d=none;redhat.com; dmarc=none action=none header.from=oracle.com; Received: from BN8PR10MB3570.namprd10.prod.outlook.com (2603:10b6:408:ae::12) by BN0PR10MB5254.namprd10.prod.outlook.com (2603:10b6:408:12f::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.25; Fri, 12 Feb 2021 07:26:56 +0000 Received: from BN8PR10MB3570.namprd10.prod.outlook.com ([fe80::513a:2259:52d5:e495]) by BN8PR10MB3570.namprd10.prod.outlook.com ([fe80::513a:2259:52d5:e495%4]) with mapi id 15.20.3846.027; Fri, 12 Feb 2021 07:26:56 +0000 From: Mike Christie To: mst@redhat.com, stefanha@redhat.com, Chaitanya.Kulkarni@wdc.com, hch@lst.de, loberman@redhat.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org Cc: Mike Christie , Bart Van Assche , Juergen Gross , Hannes Reinecke , Nilesh Javali , Michael Cyr , Chris Boot , Felipe Balbi Subject: [PATCH 04/25] target: break up target_submit_cmd_map_sgls Date: Fri, 12 Feb 2021 01:26:21 -0600 Message-Id: <20210212072642.17520-5-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210212072642.17520-1-michael.christie@oracle.com> References: <20210212072642.17520-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: CH2PR14CA0050.namprd14.prod.outlook.com (2603:10b6:610:56::30) To BN8PR10MB3570.namprd10.prod.outlook.com (2603:10b6:408:ae::12) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by CH2PR14CA0050.namprd14.prod.outlook.com (2603:10b6:610:56::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.27 via Frontend Transport; Fri, 12 Feb 2021 07:26:54 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c66f10e9-eb59-45e6-fd41-08d8cf27934c X-MS-TrafficTypeDiagnostic: BN0PR10MB5254: 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: MUgetz7SYkr2G3wq3HBB3hvBYEou5Uk5t6QxLg32WUC0FFtuYhkdReQ21FDbnIXBkLkofrQq0/GGoUL5TFvJKjS5i1/ea2e8oEh2MHE2HCkw8xVvn+afRfulLKCpSzp2lKzYslMhgODW9o0irKOVKkzk483mtVJiUs8B0DvHmLy/o3ES9KMWuOzFkusXqtmy3rEtdXDyry61xolM+4VCS8GyMVEu2lWKt6O54WDB8qVwjMZs/kgxvK+2+nLOImNIoxFbxHZpjGo6Mpqjby6APdG2JOLa3gdbagYYzfaNBVNDSQxz1CuTkP4HKfRx+zGrEpG1MRtSrDCnAvNxz9nDcQ2d/b/lDi0U+pLQxXybRgtFmtDR90d4Pz/yZeimGEBhmh1gpB3vpWRnIAKOOlrQvgr+q3FZFQVH98nK//nL/bAvSokCSsxvkpdPOVs1H6a8dCrlyWfmZfNlm0ZFfATZKVrx21czMkDQw9bQ7RUPEcrjbQC2tT02YRo/O0dN/5AAV4EVcyPvkQ6H8jOPazngWIn6LSV9+OigrpVepqBki/o29wa+AvcN+w2SYQI8CtC24qkknCIkAoq3LhpacFT48g== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN8PR10MB3570.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(396003)(39860400002)(346002)(136003)(366004)(376002)(8676002)(2616005)(4326008)(316002)(8936002)(6512007)(66476007)(16526019)(26005)(956004)(6666004)(54906003)(69590400011)(186003)(83380400001)(36756003)(5660300002)(52116002)(1076003)(66556008)(478600001)(66946007)(86362001)(7416002)(6506007)(30864003)(2906002)(6486002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: rA5+Vwm5i8w0PXe2K59Re+0ZE6RgDD6nkZlXmYK285XZmYtTOxmC5VfJLQlQrVcwHJEOjLmRhQMSJFFLmtSaEZePpDgEGWWwUzMZ9AIr2xnww2LDKinFxhh5eIgTNtD5qLohPJZh4DvOo5O42Y+vo6ni6xsARi9qXxCHenwdlpKlIbc0/EsDiGvRIx/1WrcEmYrDXZqnQtx4fE4SIt6HFlvQPYzKEaSOvxKPiBYU4dzGfRzabFkhwlV3lQw3qrVeEG1FexP/aZLpjfk9lWKwqgVd5KCHNJDOe+ICDqCQ1IHE9Yy588ZD4RvYLZDDNS1g8rrwEYoVCxg0VfKkOSryudKTYSHaBPD0avl4t+cXrOKD+JwjU+K4qCgVtHbCBGoA3R7LrVeFjqeKtY++5ExWdUL+Hpwp2I7g5xbx3Z/yvB3R21P9x6rZN8QFjcp/EbDOb0F8E/QH0y8sOoG3tjBSWW7BLUUaWDUKePXfXFD0eU7pQbQrFlrztMwwtF7ZuMOYiWipUNjWU6aXXCNlnyjU373iTv4yd5DRL9lw9ieCehLOR1YOVv7HHO9SBnlxuZNRXsnDH+WlkDB2P2ZZGYaM1Zkyb2l8XxZCOvMX4gWd+dPrQVg8BMNaLktnuvrWD5xwNiJlIMXKK284WZn/PajNq8xaprnnYOpTSotRyVROMiO+jN+MDvfS+P9qHMYKn7qDrsRE6S2KiFJ2Lbxf6hr+1N0iByC4uCqZlIHXBqibEfzF95PI+m//k2mLuCtswX6OK9KJ4Qc8RswvWrvfFfDoqCheOTF8iYxMhV9yZzJLiEmz7zlIcg3ydOwvc6H05y7dwEIcHeONIbHAqgsxYqp4phEop+VfnAftgRO3DIFHvX8kh3ZinH0FwBohXzU3X2SgvnVOq7StkbL4R4UMPLRdTW4vDJkqXVRsIn6/1UDQYd79fkgecX5nYKSvixiJu0S/McMS1pKIvElcOTkSDxmblNs+bG7fBh5GfrdDgVAR97E+n0u2LVLm2VTNRNSh5ib078lqasTRjsUuD9j2AknURsJo1pPGsV2NyAMyPUd2um+YErmln4mhZAt2Xn1fgSrVk9dkbCI3IO6ux50ICfPNQD6pVcKYCe3Cdobbsg7Ieh+gxpzTWC4UCR5t6mXCMrNC3nqNX0C/LV6ekPYhQJHPANbsPvh1MgBgL7Peuy4el/Hcve4TVYRHQNR9AmdCh9s6pVip/GUQjpjTcCFY6wE0NWSKIuqRnVna+n9Lf03lNH+exVL+H92X5FMuiDeVdah7qe9FZscMNOBgdC2zCyuC3n1NkKonfY/AUT8odxb7IrFbWbsxfoE2Wmhn2oNNoK46 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: c66f10e9-eb59-45e6-fd41-08d8cf27934c X-MS-Exchange-CrossTenant-AuthSource: BN8PR10MB3570.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Feb 2021 07:26:56.5879 (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: 7+nXB3nm8JfyraJCWPpKBZwOCROckV/9trjk5cORZyWgaawgbMB0k4M2AgoHtocScz5InqcEr14VsW6MNwUPK+7FiIDHP1jiR9bUYpbalXs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN0PR10MB5254 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9892 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 adultscore=0 mlxlogscore=999 mlxscore=0 suspectscore=0 malwarescore=0 phishscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102120053 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9892 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 malwarescore=0 priorityscore=1501 bulkscore=0 spamscore=0 impostorscore=0 mlxscore=0 suspectscore=0 mlxlogscore=999 adultscore=0 clxscore=1015 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102120053 Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org This breaks up target_submit_cmd_map_sgls into 3 helpers: - target_init_cmd: Do the basic general setup and get a refcount to the session to make sure the caller can execute the cmd. - target_submit_prep: Do the mapping, cdb processing and get a ref to the lun. - target_submit: Pass the cmd to LIO core for execution. The above functions must be used by drivers that either: 1. rely on lio for session shutdown synchronization by calling target_stop_session. 2. need to map sgls When the next patches are applied then simple drivers that do not need the extra functionality above can use target_submit_cmd and not worry about failures being returned and how to handle them, since many drivers were getting this wrong and would have hit refcount bugs. Also, by breaking target_submit_cmd_map_sgls up into these 3 helper functions, we can allow the later patches to do the init/prep from interrupt context and then do the submission from a workqueue. Cc: Bart Van Assche Cc: Juergen Gross Cc: Hannes Reinecke Cc: Nilesh Javali Cc: Michael Cyr Cc: Chris Boot Cc: Felipe Balbi Cc: "Michael S. Tsirkin" Cc: Stefan Hajnoczi Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig Reviewed-by: Himanshu Madhani --- drivers/target/target_core_transport.c | 200 +++++++++++++++++-------- include/target/target_core_fabric.h | 8 + 2 files changed, 147 insertions(+), 61 deletions(-) diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index 013f4a5e8972..a82b7da09872 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,56 @@ 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; + + + target_submit_prep(se_cmd, cdb, sgl, sgl_count, sgl_bidi, + sgl_bidi_count, sgl_prot, sgl_prot_count); + target_submit(se_cmd); return 0; } EXPORT_SYMBOL(target_submit_cmd_map_sgls); 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 Fri Feb 12 07:26:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 12084781 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 E38EBC433DB for ; Fri, 12 Feb 2021 07:28:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B25A964E65 for ; Fri, 12 Feb 2021 07:28:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229862AbhBLH2J (ORCPT ); Fri, 12 Feb 2021 02:28:09 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:37192 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229756AbhBLH1t (ORCPT ); Fri, 12 Feb 2021 02:27:49 -0500 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11C7PwOk142740; Fri, 12 Feb 2021 07:27:01 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=vBjYjV6LypMJ3C33QDNu+kzrUouI2yGUbgo7dSVDRUQ=; b=eOg/95XOa5maLOI3HYY0zBjGB45FATCGK8rCCqxpFo8uBBDSYu20TDqDgR+JYMdkMvqN T2dr9z1lGkb+nHzVfTmT4PUjbGjhxHFEHfqr+CeJpj/nT5opWusVxhrq488NYTlgaC/P 2RE5zMMVsNN/py9Q6iFR5DRLz1+L2KmqzLc7yMba6Yx3rZ+Tsl6if48TW49Q8ZjhqdO7 KRss/8Q2L1WUCXHEsY1QPtPr8kv1FFczWBIoX53czEPOGOKNzSy4dLv1NMVUUnM6PXzR F094yGBTbmxAscYPOZVW+AEyAtrK+ozfLnHpIKXWgeKH7BEw8p5rLH9GaLg8Ed2FdZLd BQ== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2120.oracle.com with ESMTP id 36m4uq0qm7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Feb 2021 07:27:00 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11C7OnuO012963; Fri, 12 Feb 2021 07:27:00 GMT Received: from nam04-mw2-obe.outbound.protection.outlook.com (mail-mw2nam08lp2171.outbound.protection.outlook.com [104.47.73.171]) by userp3020.oracle.com with ESMTP id 36j4vvcbub-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Feb 2021 07:27:00 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kHsdjsrBSWxeNkcr/KigpBcrpgak01CpYL8sALi1D8/RigfLBwxQN8XbrnM0pkNNA2SA+lY/dcDEJFh9fIhb5C/0mZ8d8HbBnZGxsdSytem8l/3Ylq38bui2pQXu87atNetSRbz+h58ou+seqrI7Tw0gyj6agKSHIGtd7kCJkewcmXS8mIZ/gpByyYrBurkK24qdDEv/fZrOyUPZQ0MbmU/fp/EdHd2qP26gnXmFh3hE7U+FuhBszDBYckZZ3BQJml4C/RUudvFhEha6z2VEBq642HdK+g7PXN9VS7nomahXOAysYeuUayNTawHTqTRfdzK1iVT4b+8eqYi/78eZoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=vBjYjV6LypMJ3C33QDNu+kzrUouI2yGUbgo7dSVDRUQ=; b=bEIPBNWGGUkJyJpCAxapO7TIuuPU6uplJkEmChlxDzQWm4+fOErMVoK+J6kNDlqlHKiyQRKtL29SuVVBZ9/HvHlwaOwq1yg6ogxYgGAgsPuXjt3cYGqJHxWiyMXA9tc8jQyjS2PoNUdHduFIxl8uOKMcBMeeiZnXkKKxmdT+DptkCbZ3xVvyPWsvbb8VqQiLTWe3Z5DbT7XkStKofS2jEtCy+8gGNvtAl4iMXUAITStkYC3OHHg8zUh8b7qSEib7/dtIlQ/JNRoLOKdjNdejXkxULYJZh2bh3s8EUnI5S4k9r5KLA42+0Q2S2M6IgwU8VtH7/gMHDwA6tbU6II5ELA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=vBjYjV6LypMJ3C33QDNu+kzrUouI2yGUbgo7dSVDRUQ=; b=B+dmJ15KhZY5Y8eoiPzAcxr4iTgclGZGkUOL5/1dh4805FX8Iw8nnoOYmj1hf9Qn5mijzJg8X9LCYX2/ikzqQY0ancZzQx0CTPS13EEn/OhSchbhZQatAUJNCZDl5XwVsWiwgiFG1yYWhC5p+N7n2MZ/KC0iJwjg7JfpB4eJJAg= Authentication-Results: redhat.com; dkim=none (message not signed) header.d=none;redhat.com; dmarc=none action=none header.from=oracle.com; Received: from BN8PR10MB3570.namprd10.prod.outlook.com (2603:10b6:408:ae::12) by BN0PR10MB5254.namprd10.prod.outlook.com (2603:10b6:408:12f::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.25; Fri, 12 Feb 2021 07:26:57 +0000 Received: from BN8PR10MB3570.namprd10.prod.outlook.com ([fe80::513a:2259:52d5:e495]) by BN8PR10MB3570.namprd10.prod.outlook.com ([fe80::513a:2259:52d5:e495%4]) with mapi id 15.20.3846.027; Fri, 12 Feb 2021 07:26:57 +0000 From: Mike Christie To: mst@redhat.com, stefanha@redhat.com, Chaitanya.Kulkarni@wdc.com, hch@lst.de, loberman@redhat.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org Cc: Mike Christie , Bart Van Assche Subject: [PATCH 05/25] srpt: Convert to new submission API Date: Fri, 12 Feb 2021 01:26:22 -0600 Message-Id: <20210212072642.17520-6-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210212072642.17520-1-michael.christie@oracle.com> References: <20210212072642.17520-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: CH2PR14CA0050.namprd14.prod.outlook.com (2603:10b6:610:56::30) To BN8PR10MB3570.namprd10.prod.outlook.com (2603:10b6:408:ae::12) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by CH2PR14CA0050.namprd14.prod.outlook.com (2603:10b6:610:56::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.27 via Frontend Transport; Fri, 12 Feb 2021 07:26:56 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 13c3db89-9a97-48db-430c-08d8cf279479 X-MS-TrafficTypeDiagnostic: BN0PR10MB5254: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3276; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9G9T63d4p3AlkDFC4ggFw5S/neohV2fquLz+sAEhAVlcANx/DYIy18dFBcBq5D0SJEjPdqOQ45CNOzJcWQOIuf7MkCZgFRXx/Ec81+KoV4faBKggVwaj1ynfcOx1cjoC/c3iWhHHOmvnw6Q9INT65+5yGR60rngv7Qi7RuPuC3Je/DCOOQcHmqu89kXlMCbtdWKqxQzjuqrSvN+kkCTmaCQjWnd6y4HR37g9EOLY94TvYLZgI/r6EMfiVktJ9Pn/i3qDKE6KhXZC5LMjdmT65gpGigGLk296bYZQNl2uNqUlZ1dlmkAqsAudwa3k7BPZ9xRzhrMB6OS5e7nzI1zhKcDEYz4dfAmzBYvYkYyC2DYiBGyra5lCirJyNLRaT0TrQHYjoiEkv9Hh/jW8Y8jQqyagXEMrC8BKbsLypy2XxvUnKTxlMAMqU7KeiKpY905XZS/NOu4yw4P/mbcdHF5ux+tj6/RzkZ+yHcG7lJEI7IKZN3/87qwh/EvPByYZocrcGQuGqTK72HGJNZvkv9UVF3dfs0hxTvQ8qlTYsB1gNxsTQ3+ycxDTBz1gJ9b3zw5VnAP24YaPKKzr+xxFwlUXPQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN8PR10MB3570.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(396003)(39860400002)(346002)(136003)(366004)(376002)(8676002)(2616005)(4326008)(316002)(8936002)(6512007)(66476007)(16526019)(26005)(956004)(6666004)(54906003)(69590400011)(186003)(83380400001)(36756003)(5660300002)(52116002)(1076003)(66556008)(478600001)(66946007)(86362001)(6506007)(2906002)(6486002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: DsPqbUphN+r5rErralaH9Pm9moNle31uwCp1Dhw3pLZUbce/cvRWk+JgyGaTYTO5+XRk0BSBfFIyPxfRmlIfkSjRYwjBg6xp3mqHi3yicVsaOWPCebGNK9zxMX4NUyCBAvp1ZGKaZpkYzacVnuUhwX6h6TcKXwBR4dijak8eDb5QbiMedErvBqs1BLOKpn5qcEFNAu4nerFfNgTD3y2Ky+RKwH1doojW176xZTNDBjdx55zDS5zvNIrcTEW4hYZJdM11QRsG6wS/J0PIbS3q9upPnBgRna5/ZURI6bwLxqbubgvJMhWaXKktp5rHrGsNof6LJyqP08hW1TSn4pks1nDxIR3Awk1KhbfPif1WTdwf7tBAifz6xATQNsDOGNIpU6SZ9/9HsFJ2iQ2Tfk19LXgvSrat0DsQRmIH6LauH/tDpiDv7Hb3e3sG1zqwFxA1+V+og8zJXEiwPjMqNJ1gTIcGDUyYXjEpwPWmSzCUkHCbM38+5RJTyb6MrzIIEb1rxbzDjiySOAHZkAXRJQx4DX/NPTUcZAkN15PnE3z6GoOCX73B0fevuOxPFtcOfZzzYt2wzz1FLMHBCBKH/nJMbMBv6oKSy0uvktgsUjXcV6SdpUd5P4++cJRcc+yRXK/NYtPUo80Bi8bWPvPG7e01F6nJt18X6UiZpUG6dF2nqXPhrmXgf7FGNyhRhJF2pVcJlGwr1U4q25CjO9HvehCPVRWx3a6352pQQj8nhYGDTvAuS29Nn5/Hyu/3he3AQyu8gJ/Ar00a7FMcencJdCFRrNZsxG6trM2s7ScxrndZSWR3v5Leb9JAP5Yk8cCWV1z5fWVPnu7oVRHufyvbWPkqbIhRcctDSGeL0Wld5JQuQZit0ECZP/yffxyjRqsnaeMeOg1dG0CksH/iFnMyvsYo+YYKgvPL6vHaPm+S4bWR2Zq8IY1U1aE1ItMw0f1h0eXguCNfWC4QS2LB9HyP/zNU0ogIZIpVgxM28BYkr1viXEuv+z8NLExVnzaIcjuiKfCYOutG8J9iyo8YsgcyWZd5bqEwhzYToWZa2qm27JGWswqnH18p6INoXbkC5kLVhuFq5MDREWd2RCFAlkdAFkyavX9/Z7YTowuj6296TOqk3QihOIvQd6WhOuGIezlvsXGVu5UtiZ+u3cK01TQKB6X4I6UC1bnyFEpVLBbWfCQkOYeGxOVG+lPIf5l9U4UPuf0kwr6DQf/LbD418Qk+IEFfFRDlEFcPxhHSKBzzV5KR/QG3E5jO6AE3LHDSFbUHUiCP+T6pbuTGGtP/occnsrNXrtEn5U8M2ukitpp04Rg7rx1nYbgomkXmZORZtcZkMYKq X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 13c3db89-9a97-48db-430c-08d8cf279479 X-MS-Exchange-CrossTenant-AuthSource: BN8PR10MB3570.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Feb 2021 07:26:57.7032 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: T1O9MPl7yFQTM+pceZUEzbdt2inEZKOP5qZlG/JCxsWBPh8FH4mGxpwLbrp7f8HLJAIpNcY30KQE8oEnHT8+oy49iVWNWBg2fwOWCHARZds= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN0PR10MB5254 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9892 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 adultscore=0 mlxlogscore=999 mlxscore=0 suspectscore=0 malwarescore=0 phishscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102120053 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9892 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 mlxscore=0 mlxlogscore=999 spamscore=0 impostorscore=0 malwarescore=0 clxscore=1015 suspectscore=0 adultscore=0 bulkscore=0 lowpriorityscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102120053 Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org target_submit_cmd_map_sgls is being removed, so convert srpt to the new submission API. srpt uses target_stop_session to sync session shutdown with lio core, so we use target_init_cmd/target_submit_prep/target_submit, because target_init_cmd will detect the target_stop_session call and return an error. Cc: Bart Van Assche Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig Reviewed-by: Bart Van Assche --- drivers/infiniband/ulp/srpt/ib_srpt.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c index 6be60aa5ffe2..87741e0b4bca 100644 --- a/drivers/infiniband/ulp/srpt/ib_srpt.c +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c @@ -1528,16 +1528,19 @@ static void srpt_handle_cmd(struct srpt_rdma_ch *ch, goto busy; } - rc = target_submit_cmd_map_sgls(cmd, ch->sess, srp_cmd->cdb, - &send_ioctx->sense_data[0], - scsilun_to_int(&srp_cmd->lun), data_len, - TCM_SIMPLE_TAG, dir, TARGET_SCF_ACK_KREF, - sg, sg_cnt, NULL, 0, NULL, 0); + rc = target_init_cmd(cmd, ch->sess, &send_ioctx->sense_data[0], + scsilun_to_int(&srp_cmd->lun), data_len, + TCM_SIMPLE_TAG, dir, TARGET_SCF_ACK_KREF); if (rc != 0) { pr_debug("target_submit_cmd() returned %d for tag %#llx\n", rc, srp_cmd->tag); goto busy; } + + if (target_submit_prep(cmd, srp_cmd->cdb, sg, sg_cnt, NULL, 0, NULL, 0)) + return; + + target_submit(cmd); return; busy: From patchwork Fri Feb 12 07:26:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 12084783 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 24646C433E9 for ; Fri, 12 Feb 2021 07:28:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E447964E39 for ; Fri, 12 Feb 2021 07:28:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229872AbhBLH2K (ORCPT ); Fri, 12 Feb 2021 02:28:10 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:59580 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229806AbhBLH1u (ORCPT ); Fri, 12 Feb 2021 02:27:50 -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 11C7Ol88176681; Fri, 12 Feb 2021 07:27:01 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=nmNPczwdrWFQufUfS26xsht2CcTvVrMqQOEoCGgZw3A=; b=L691TKSqwFdtKvi9JpXfDGBXjunIXFcTnhZxv1nYKB69MLtOIpofbKGvMigCSw5NxuJj hichvfaenQjfRaOzWPVKM/d31/qAEb4v12q8VDNmk+GCNqLQPP5N6cQTtNTPbLYiaj2P hiAR6aek1m5J7P8oI6OpCQI2RsuHTevfTjfz9opmnlRXwwT9nqiIBQmArHWzdVqEVjF5 JKpr/0Q/TNe7TD9llxtm4FMRD7hLixOzD+I7Q6hRjNqZVd6J71jCP7EhHHyKW1zkvYIe EJ9uykPJ0crzD540OmAEjnJeNy53nI+2mvSfpO/w1mA7vxushvfgUNd7J27Pzvbnh8hO 6g== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2130.oracle.com with ESMTP id 36hgmataw1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Feb 2021 07:27:01 +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 11C7OnuP012963; Fri, 12 Feb 2021 07:27:01 GMT Received: from nam04-mw2-obe.outbound.protection.outlook.com (mail-mw2nam08lp2171.outbound.protection.outlook.com [104.47.73.171]) by userp3020.oracle.com with ESMTP id 36j4vvcbub-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Feb 2021 07:27:00 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=V306aBJtxRKw/wMxXef3RMQuU313yg4HG9t1sQXyCYcaaHt5SVXfldFyiJGcD7cpLG0OiTZfus9s9TEMRkUl3aNx1TmHuqPCY388xOa7LQhsmMastftTwwGT3vO2DTC36FLRDKCJLF/yBEYcxZtOxsFOAYwTk2Pr/sxdis2xdm2sGnImtUmlPiOID4afCz52r25JczuHlYPeOw8BpJRv2EpuARvZlOsYOCzEfyhWe+UkvQP8XaABasJOVLtqy3VIp6guzz90i4ZhLdMB5sTmjyjlaA9NzLoDHCifL4hcpXBLNLcIWfDcg871GZbpjUqCTHp/l2Nw+cz6ZfYSMRRiLA== 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=lb057KmilGMj2og+96SGoZcHGh0qgiDUtXnZlKAmbSAvXtPoVfNFGJUwHq/5HP51OoeIP3iBDUXmTXQOTvQDzVx1fY1+vWqZ7fFtv36PWWM26B+ZDHNeSQGbMs9zObtDh7XWiUjvpDRQBDmbKthBpd3LHTfmpBdBPgPNJWucL4qzYGgKSo4UncGVvKsuQT7OxWX+KUydmcr766h7w++h+dW7i9Li00dA5cra9pYyDyYMqWp40w4Itos/SnkLpYH9f4Dz9ALx2FUJk0AG3BEn33Rsv13fGv0RSqQ/mxFJnhl79om0hmjEkwm9nLSPtInkz+76x2jUc9vO5fjPcfHG0g== 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=er1Qp40+0hT7rtB6YL3NSGLMKh7ETNmPzMaMyfjkAwoXrPpBQZVp4kI9MTnNBymBoFJ2ITf8oW2IZMIlQlVrkJ/c2qbUC3yKi1dh5VdIZY+P4d6VdBH79pF7x5gKI8Cdvj9epluwV/JemafmqNtUKu2k4fUT59t4hliViRR8GjQ= Authentication-Results: redhat.com; dkim=none (message not signed) header.d=none;redhat.com; dmarc=none action=none header.from=oracle.com; Received: from BN8PR10MB3570.namprd10.prod.outlook.com (2603:10b6:408:ae::12) by BN0PR10MB5254.namprd10.prod.outlook.com (2603:10b6:408:12f::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.25; Fri, 12 Feb 2021 07:26:59 +0000 Received: from BN8PR10MB3570.namprd10.prod.outlook.com ([fe80::513a:2259:52d5:e495]) by BN8PR10MB3570.namprd10.prod.outlook.com ([fe80::513a:2259:52d5:e495%4]) with mapi id 15.20.3846.027; Fri, 12 Feb 2021 07:26:59 +0000 From: Mike Christie To: mst@redhat.com, stefanha@redhat.com, Chaitanya.Kulkarni@wdc.com, hch@lst.de, loberman@redhat.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org Cc: Mike Christie , Michael Cyr Subject: [PATCH 06/25] ibmvscsi_tgt: Convert to new submission API Date: Fri, 12 Feb 2021 01:26:23 -0600 Message-Id: <20210212072642.17520-7-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210212072642.17520-1-michael.christie@oracle.com> References: <20210212072642.17520-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: CH2PR14CA0050.namprd14.prod.outlook.com (2603:10b6:610:56::30) To BN8PR10MB3570.namprd10.prod.outlook.com (2603:10b6:408:ae::12) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by CH2PR14CA0050.namprd14.prod.outlook.com (2603:10b6:610:56::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.27 via Frontend Transport; Fri, 12 Feb 2021 07:26:58 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: fcaf64c7-705c-43ec-b5a5-08d8cf279554 X-MS-TrafficTypeDiagnostic: BN0PR10MB5254: 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: 6lWnhRLVuqiSMgs14eERzLy48vOQ/lMA5P3if+hbtVSf5GnyM3HfV4+U/hmM9R86tsY0cfP76fNfACgMBamP7xuKKZYraFAGplPNsjSpkkfwgGc2IoUZ09yaqdeoNP+H5E9BB6HPRUkuQYW5OPijVWGWb299zRzrq+52OqIYQ3flB454NxM3Bi5VMAJhSkb7K+GhoCS3AZsL31cOiIH34pReqy1+0bTSlLXIuh+6uCgh6uGwQ30Gdmda6WP/koUwlBHBeEgYigSiAkjoXmHw6DP15MDa9uTO0vmUlOJbQlTgVIvtNfQe0TtYBBOVZTPw+0WZmh2K5bUxMyTziTXYUJM+guJ3yMO3T2UBQN1K3UMDEYcmHHkDuelX9V0j52UuHF/U0ro9EziE33cnZ7yhfxfW52A/ihH44CfBWdsytmidnZFFnCMl4yq2tc95tDrz35O+XtLvS+wP+H1cH0aO0J8cAEVsBkVygdWGkH5tXvzHwvxnwzqxxzeh7iKPuTmbSGbzj1DcPvE+EGTNRr0gGVqQe8Z9vt3WmZkZGVXuXHidKQqN6cnaGC3Cv2M4vbb1Vrvh83r6azA9Cejpb2inbg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN8PR10MB3570.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(396003)(39860400002)(346002)(136003)(366004)(376002)(8676002)(2616005)(4326008)(316002)(8936002)(6512007)(66476007)(16526019)(26005)(956004)(6666004)(54906003)(69590400011)(186003)(83380400001)(36756003)(5660300002)(52116002)(1076003)(66556008)(478600001)(66946007)(86362001)(6506007)(2906002)(6486002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: Ye6xPk6ECEZ/lw1w4LPvX65MOWWFXu97eI1JCycSSsS9B5Lm2ywcnQMUH43akRe+DvkO/anUSRqd1mCFj2k0FQc1WPgfVSPGeEfe/oHby864DSw5+jEQ4OsPVTc7Ymng07Ux+6W+fgoC8HiFA41nD3TkpFny8/rVqK3aXpTc+u26m+RcQSEakpZYKM0EgUMuZ/ZKskftoZpDBBPPkou3gTwkMFdkcw1LHtDPsQoVMeU/7OdxT0HURH2XJzs/ooJEkJvyygy+XDI1XwNGDNi3yNjenHrAqP7H974Mm+ARy46yhUAniXSv3KYj/cScLccsY99BtS0UXf5jYzT3iVUXlYg3//rLqzplVukZOfPICgwz5PE+HzriRVAU9OUH0RBEYwaWF/R0s8IDsjmnjrIcUo91CZ4iffMiy51zh3XXEM28vGfwPv2A1kU78ZgbepH/g3TA20xKBL1yALRgh/KxxnGz4DoGSspND/P0/pgNnEStBSYYIfPBqvpAYMNtYJgLH2Jfyy41GA2KynmCB1aIlYUCy1SZ8OKTFUthFdYYd+x6HvfsgYcp2TFPyzZt8LA4EHF6LTyuK7RU/NaxRnmJ0ZnJj1cg+DPLPWzw44V1dA8Mm+bKn6YK6ENCXqQceLt+UgNlmHqEKawqSa5QTd2hJhxZCpB0T5cGT0TaiVAfYhfVH4KQ8aAl4oDcwKoCQVbZ49T0mzaWb3wtAqSJLqxgb48QFknjx99+eUHxtm9/2MoVLlHqey4F3qwk5QaKRTfHJ2GPHZa98DfQonZusg1M+i7UnKSMco7P9RaSHNqZBmp29Az9w2xCaBVf/Bqqv60lKP/2asxsWgsUuoyXY5BKlu7owog9d+y3BHsRP/VPSvfVotzvjmw/uyvgje3wj8CNwklG+JR6E5eTqdB3xpEPb2Rx31Vm9bFmeO1QBMNlLZ/jCRpm+66vAMyo9DpuIFAJ8Vw+LUzmCPAxqVONBN91y8Jsu37ztQTGG8Ghu0hiX7T61GzCu3M3z7sOP1HIiICDuPIVnf53NxbuVne236MaXs+LwE3jzMVOsZBHZF4TbwKhuEWf0GaPIWSADxYPBtvH3JqTi0e291Gt7KbFcUYw7ogqVkuxqHjVP4bpb9ynm7Ev0tCkTEQJGRzqyoVWKHjeuJqNy9bGRH6+wQ3bA2VgBsy2YHMhP5udgccvZdyx10mHoCqlRTrlWqeICb6PfPS3I5DC03JnrmV47FMgKaJ+/4lhZAbIWAKYge9UWFFcdhsQmXZe1mds4VpL/TLoXyDNFJCYE/+bwFEReIDPKf2Vu9YVv14Fo0UcSDD58iYlM6JJ4WnP5eZoXBJJEigBBMff X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: fcaf64c7-705c-43ec-b5a5-08d8cf279554 X-MS-Exchange-CrossTenant-AuthSource: BN8PR10MB3570.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Feb 2021 07:26:59.0475 (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: JW+Fu24fRXHA5qTmGuamauo9lxGrE5QjkmjNGXaQ+/k10PTevo2TkeHizYX5TX5u9UvfMoGNT9FYw+rhm2I7UhsXgeEZgMaTsSm/XWmtNSI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN0PR10MB5254 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9892 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 adultscore=0 mlxlogscore=999 mlxscore=0 suspectscore=0 malwarescore=0 phishscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102120053 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9892 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 spamscore=0 lowpriorityscore=0 phishscore=0 adultscore=0 impostorscore=0 suspectscore=0 mlxscore=0 clxscore=1015 mlxlogscore=999 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102120053 Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org target_submit_cmd is now only for simple drivers that do their own sync during shutdown and do not use target_stop_session. It will never return a failure, so we can remove that code from the driver. Cc: Michael Cyr Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig --- drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c b/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c index cc3908c2d2f9..cfc54532402c 100644 --- a/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c +++ b/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c @@ -2670,7 +2670,6 @@ static void ibmvscsis_parse_cmd(struct scsi_info *vscsi, u64 data_len = 0; enum dma_data_direction dir; int attr = 0; - int rc = 0; nexus = vscsi->tport.ibmv_nexus; /* @@ -2725,17 +2724,9 @@ static void ibmvscsis_parse_cmd(struct scsi_info *vscsi, srp->lun.scsi_lun[0] &= 0x3f; - rc = target_submit_cmd(&cmd->se_cmd, nexus->se_sess, srp->cdb, - cmd->sense_buf, scsilun_to_int(&srp->lun), - data_len, attr, dir, 0); - if (rc) { - dev_err(&vscsi->dev, "target_submit_cmd failed, rc %d\n", rc); - spin_lock_bh(&vscsi->intr_lock); - list_del(&cmd->list); - ibmvscsis_free_cmd_resources(vscsi, cmd); - spin_unlock_bh(&vscsi->intr_lock); - goto fail; - } + target_submit_cmd(&cmd->se_cmd, nexus->se_sess, srp->cdb, + cmd->sense_buf, scsilun_to_int(&srp->lun), + data_len, attr, dir, 0); return; fail: From patchwork Fri Feb 12 07:26:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 12084785 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9B1CBC433DB for ; Fri, 12 Feb 2021 07:28:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 62C5664E57 for ; Fri, 12 Feb 2021 07:28:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229806AbhBLH2U (ORCPT ); Fri, 12 Feb 2021 02:28:20 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:37206 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229813AbhBLH1v (ORCPT ); Fri, 12 Feb 2021 02:27:51 -0500 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11C7Phwm142696; Fri, 12 Feb 2021 07:27:02 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=pRdQeo/sTOP/QBzAAVhwIqlkUihfgmwl0EDnTreNh9c=; b=PXPfm96kqRyMb1GaWVu1ciHAnflzpjCu2V9LrPx32gvGoPlU0US/gdaXVhvYvSIgALdZ Jt4hKrRt0UO7Y27gq7WvqOSCVt4Z8ZVrWb1hXgYPDu6M/4PFl3bQJwz5dNIJBxLdks2l 8MjaVjQmtjPKrwa74/VKLOUtc9NCdwboPDimeUQwHNRacK1rB38WW4INQ9aWZ6gnOwZY qMZJrMZcF4ck5BJCyxJt2qRedOPidvNpLWlP2+7CH9JkAze7bXDWWVPpt3BBfYx9AjmE db/9P17wFvWW4iSrn0IzzLaXCBcXTSTFyrOoEY+SEnJToFJOjiilhAcGjupb5ejuirMO 7A== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2120.oracle.com with ESMTP id 36m4uq0qma-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Feb 2021 07:27:02 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11C7OnuQ012963; Fri, 12 Feb 2021 07:27:01 GMT Received: from nam04-mw2-obe.outbound.protection.outlook.com (mail-mw2nam08lp2171.outbound.protection.outlook.com [104.47.73.171]) by userp3020.oracle.com with ESMTP id 36j4vvcbub-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Feb 2021 07:27:01 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=a/gCW0Y8cQHevLd3uC8njisJRsFY5rbabWv9R25G0PRRjCOXf9g8LP+IG8fzGg94FqyB4HsHi83gIV3RPaobmCPf2SqCdHIwKHAbjptl2EoOQ7yLdO8IQfKBQJSDMnfqiqPwgU+i2bXewv+q9soOV99f7g+b+Iwg84+9upa3GEJYQy76z7CCS/xjVZc78pZxM7oJuW4JdibnQ5ZtuCnrc7ckTXDDsbT+IxE4N8C8EQv7K8UTZIvmY4VugOKFF9MI+6atZfkVmRnTlqSjxrXgI1iCLUTbu13LbxOioUldb11WJaf5zHxwklc/2WPOfcMdQCyrAPpTIR5wbltZ3T3Q5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=pRdQeo/sTOP/QBzAAVhwIqlkUihfgmwl0EDnTreNh9c=; b=aq8qiJxtOZaEbsjQlSj/aEbE5GaMWm1RonQ4UvscXnTM245lY09OAIHwUTr798hvufhpeGF6zBOTj3TUzgbB/xzDhc0E+EtvMC3POslpp2sWyD+CarHzQXnm4luwhwBIVLRbKKsgRx6aOgqcVCcNTi7CKDqUiymfnETRqy8hn3/FF5xyddNRBFjcI6ZY8r6cNHZ6YT0QJNgO68XtyGzxiUop7a4w4fXz8G62A5Y56LiiuNCtmLM9NhQtPvxdavfm+36EA5EZzpBiLc0bzZgx/kJoaJ8eW4W2FLs+qfmchUGOAdSDFYSQnmIsYk247N5TOWntC2kwQYnO0Z2C3wMdkQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=pRdQeo/sTOP/QBzAAVhwIqlkUihfgmwl0EDnTreNh9c=; b=ghyHt+cYjXQgRjD+9bauc7bGdj1ShMI4WnM0Gn4LR9ShE0GLRoqzmYdZxtv+OTEWy53lRBi8YQZJHx/uD9rqTtr7vHK3+K+L4r/9Z8r8KYNnMHEq+bbvHImpmCfj0nimOK/ZATPg2qLkQ2eZyA9BROnZC5UtDjY5FK7te8WWJo4= Authentication-Results: redhat.com; dkim=none (message not signed) header.d=none;redhat.com; dmarc=none action=none header.from=oracle.com; Received: from BN8PR10MB3570.namprd10.prod.outlook.com (2603:10b6:408:ae::12) by BN0PR10MB5254.namprd10.prod.outlook.com (2603:10b6:408:12f::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.25; Fri, 12 Feb 2021 07:27:00 +0000 Received: from BN8PR10MB3570.namprd10.prod.outlook.com ([fe80::513a:2259:52d5:e495]) by BN8PR10MB3570.namprd10.prod.outlook.com ([fe80::513a:2259:52d5:e495%4]) with mapi id 15.20.3846.027; Fri, 12 Feb 2021 07:27:00 +0000 From: Mike Christie To: mst@redhat.com, stefanha@redhat.com, Chaitanya.Kulkarni@wdc.com, hch@lst.de, loberman@redhat.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org Cc: Mike Christie , Nilesh Javali Subject: [PATCH 07/25] qla2xxx: Convert to new submission API Date: Fri, 12 Feb 2021 01:26:24 -0600 Message-Id: <20210212072642.17520-8-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210212072642.17520-1-michael.christie@oracle.com> References: <20210212072642.17520-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: CH2PR14CA0050.namprd14.prod.outlook.com (2603:10b6:610:56::30) To BN8PR10MB3570.namprd10.prod.outlook.com (2603:10b6:408:ae::12) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by CH2PR14CA0050.namprd14.prod.outlook.com (2603:10b6:610:56::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.27 via Frontend Transport; Fri, 12 Feb 2021 07:26:59 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: cb60b18a-6362-40e2-ec0f-08d8cf2795ea X-MS-TrafficTypeDiagnostic: BN0PR10MB5254: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2803; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: EiI7YOFdW27R46BLcEhoZpdph044PuDQyXKoMS3JuoYUbrco31V/md3KVp+dZQeQOR/qCxRw6ImCkYs3cxPZp7/z4zeztkfSuZVTMm9mX2nXXcRNTbFN3KLEiJ2MuhbRxJ3O+PNGeummbzob4+TggWp7rq1KY8yN/ke8WzCekA4BBAsqqaSk6eQVYG2ZOXqgotrje4IfGpwn4AtC0qLmvygOLe6Qdb7FgL7XSk8UJJSa93VhmS1uUJFuVhQ36AdaAqnajs51aJ1SCkxwhEkEJjewD+dnHfVOWpEleToGihMAkMwwIkxwU7mrHNDooZ9iLjzv5ag/aACPgTAfkNuMNMQvI51P08Phd+H28OGoNvPxOIq8/8VbP2kbW27YPG557H5sX/O+e/wNq3GFpnsr8jAgCxHRRmocCYnpengEb/YuC2pNMmHXvzni7g5wQr8uYfsLUb9Ufo18pb3U+gedaPy+zotyH46fzaLvNLXf5w88tRMgefzoPNEx5vZSH3wPz3BebmqN8Rfb0ELQcNpb2vmg0WcCe22hbaqK3l1hZ1w+thYRcmaRhsKlLqxEZ+2feJeqQEKb7R/Hw2SdV1Gx+A== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN8PR10MB3570.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(396003)(39860400002)(346002)(136003)(366004)(376002)(8676002)(2616005)(4326008)(316002)(8936002)(6512007)(66476007)(16526019)(26005)(956004)(6666004)(54906003)(69590400011)(186003)(83380400001)(36756003)(5660300002)(52116002)(1076003)(66556008)(478600001)(66946007)(86362001)(6506007)(2906002)(6486002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: ghUwlXkdeGI9m6Ayen3QKdSIimiSRVFPZDiEcurhoyrOoLMH8drpQp/70fdtUuWTpEU8ZVCzZwlnJJnZyGxCMEatReRcONmIVR4+uRStn14RA1ykdg13o/CF/XTlw3lpiaJVdGhV6QpQ2t773iH2nLAhCGV6xsMTJHA5Wfm5mzsQeGHYqrUiNG2OiklvmPgKEDsicvaQzxxnDIduT132BRjLZvHwU/TmHSWMQ/WorjHUTZ1NIXCj8t/s16OtOzWePFlDtquPcpb4M8sR0FmBAKuuIvAV+Zw4/Q87wh7OiON785+QLbzCnjHEzIXygHhjm39pfKFcKpAgr2yA2s0PU4EPCy+bCH4FDoq2GxDbRgdcwFlg3aJWq9iQ9RiqoB10jMjMm3dVDWXhqGYSgF2NHG97AssnUqieyASr5oXeFi/MJL+8zPdBtrQmPSCb4l0m5qY+sERjuelSNRElGUl8pCLwEWz7n0tmdH4DxcEPHn8Lq/4Ig60Bv9YVUuD4f2AaQbfV0lwyDyaSixSq7i6brelxIbf+kUC9BtxQGUHQzcq4Rkr1dAfwhVrlw35eIgDOjaYHoWdO3rnJ2tCQBthqve4PHOncpbYubAKF8lbpShMgHxaEUZS5VI2arfzjwpE74DCC9vuOsPUNFBl5WSgv/OYvmeU2RnOCr+bsCbYLFO/g52Ebq0kA2L4HhqbjSsbHKOaZRsfiA2DWAehf+ZHGWxL9akn00iMRY7hpAaxtBdI2bLDNOzWf5lVJu8c20S9MyTuGC795d/Z2hwB8TZ9iv+hqSKYRTlmBFt7FNXy5ELbIVqTzi9LiR4fLQ8x1IzBhCrGvwRwUHG0KJglOkAGiknCzQa9aiPYZxZoSoQnmUXLwyDbqSySVB+r5+lpHP4O8s8mgr2yZTXX/9+eKqnKvaBGlDP4B/onqqlAM1OtZN3k6GAFDXZT/vPQXvbBpSXz5BsJmH4M5zgcmkn9vA18nxricDk1iDs91aI/veQaRwws3fb1iiXjynKQWenamH6Wh60nuIY0Nhj8ahc5NJhVkkrXp6ta1SQ7KLq8ktG0vK9PjK3I04/ECsIN7EgDjtg6hnpoOjWgaofEF+A5ax47Se6ye72enfj31TnhaqCkausJBvVnTtmmf6Xrlp4o5c9zE08RvSWtiHwX8NKPkSnuKgZH2toQH3Kgd8j9WBHsQXMN9SXIG26jjwlvUUDeZEV+NT+A1+LKHLk3luI1z6YQCi5MoHDi1wXmt1ZkFqKz82BLIEnLL7zSTnDBX+00kcAUIy9ZiOlHEMGOPDnixaNj31dphTgClavC8OaetNw6QYk1o1E+AuGS0ihid707nGosH X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: cb60b18a-6362-40e2-ec0f-08d8cf2795ea X-MS-Exchange-CrossTenant-AuthSource: BN8PR10MB3570.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Feb 2021 07:27:00.0569 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: r8YEWHGiDqpQ9MV0Q7m/EVW9Lj9mjaIAg4voSKD34UNzZM3IANiGSuWGetzUDcDXOQ9RDk3leR/EUAOIJSEAujh/UYwSeHdR3IG7RlnVJ4o= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN0PR10MB5254 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9892 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 adultscore=0 mlxlogscore=999 mlxscore=0 suspectscore=0 malwarescore=0 phishscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102120053 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9892 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 mlxscore=0 mlxlogscore=999 spamscore=0 impostorscore=0 malwarescore=0 clxscore=1015 suspectscore=0 adultscore=0 bulkscore=0 lowpriorityscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102120053 Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org target_submit_cmd is now only for simple drivers that do their own sync during shutdown and do not use target_stop_session. tcm_qla2xxx uses target_stop_session to sync session shutdown with lio core, so we use target_init_cmd/target_submit_prep/target_submit, because target_init_cmd will detect the target_stop_session call and return an error. Cc: Nilesh Javali Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig Reviewed-by: Himanshu Madhani --- drivers/scsi/qla2xxx/tcm_qla2xxx.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c b/drivers/scsi/qla2xxx/tcm_qla2xxx.c index b55fc768a2a7..56394d901791 100644 --- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c +++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c @@ -451,7 +451,7 @@ static int tcm_qla2xxx_handle_cmd(scsi_qla_host_t *vha, struct qla_tgt_cmd *cmd, struct se_portal_group *se_tpg; struct tcm_qla2xxx_tpg *tpg; #endif - int target_flags = TARGET_SCF_ACK_KREF; + int rc, target_flags = TARGET_SCF_ACK_KREF; unsigned long flags; if (bidi) @@ -486,9 +486,17 @@ static int tcm_qla2xxx_handle_cmd(scsi_qla_host_t *vha, struct qla_tgt_cmd *cmd, list_add_tail(&cmd->sess_cmd_list, &sess->sess_cmd_list); spin_unlock_irqrestore(&sess->sess_cmd_lock, flags); - return target_submit_cmd(se_cmd, se_sess, cdb, &cmd->sense_buffer[0], - cmd->unpacked_lun, data_length, fcp_task_attr, - data_dir, target_flags); + rc = target_init_cmd(se_cmd, se_sess, &cmd->sense_buffer[0], + cmd->unpacked_lun, data_length, fcp_task_attr, + data_dir, target_flags); + if (rc) + return rc; + + if (target_submit_prep(se_cmd, cdb, NULL, 0, NULL, 0, NULL, 0)) + return 0; + + target_submit(se_cmd); + return 0; } static void tcm_qla2xxx_handle_data_work(struct work_struct *work) From patchwork Fri Feb 12 07:26:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 12084787 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4FA01C433DB for ; Fri, 12 Feb 2021 07:28:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1E62764E39 for ; Fri, 12 Feb 2021 07:28:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229875AbhBLH2V (ORCPT ); Fri, 12 Feb 2021 02:28:21 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:37214 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229833AbhBLH1w (ORCPT ); Fri, 12 Feb 2021 02:27:52 -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 11C7R3Sl143266; Fri, 12 Feb 2021 07:27:03 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=yirfLel8afeEiDUxMQrMnDE/UbNIEYIy+RRSd7s9DC8=; b=hiY8cdxVJRQzKa2zHsRjgP3PE6wqIrX8a2G1mwmuvaOjvf/qWzlvbiNcWXNi2Uw6VTn9 gUr4sPrUNi3ucR0+tS403AM+5tRfhwfllIRP/9DWindCvA/ic5VJJ5J99CK8Kr8QfoMp ScKItoIrLejBho1jjwYza6u6VilfJkmr8TPiEqLhg0WubC5RhfjH1lhcU4pZniHvuJJv BFgtpXGimdEb11RjOFVJ7d1shJq8iuENne/+vDISVKgyt/Fsuy77zzDfcyuUQqsR8a1o C6XujXeWvsM2ofn353j8/6lUzdP3PGeB/OsjUxDSpe+XDjMxX65PYgoZvniORvnCeazf Lg== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2120.oracle.com with ESMTP id 36m4uq0qmc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Feb 2021 07:27:03 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11C7OnuR012963; Fri, 12 Feb 2021 07:27:02 GMT Received: from nam04-mw2-obe.outbound.protection.outlook.com (mail-mw2nam08lp2171.outbound.protection.outlook.com [104.47.73.171]) by userp3020.oracle.com with ESMTP id 36j4vvcbub-5 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Feb 2021 07:27:02 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kcus7bVlUnA+IleGG9IPgQwJsOwg/oiP5aHIogAVGlEU4r6zoyokVLjXdztUKfpCtkNLmjsULyRNYoOa9wD9RRLRDNb2KFFN86iGl6NXsJRvGPYfqu2via9XJo3Y2lWO82DPq2eN51NZqy5fOrnnRjB0Ekuh4DoKGDnslrTMISLHjY3C75EkZsHHfLRj4dEfSV1pPFMCjlyN9Jof06CGb833BzVa7UhcLLHfn3dMJVaccTSHwroaQDzzFr815JY66rDyd/Kf0M35vkrsNg/yCBhgX3pN1CWULpFc0U6fxuSF8+jLveLUrbA4I4otZfcLDQ90kKcV7G90sBkCvKM70A== 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=yirfLel8afeEiDUxMQrMnDE/UbNIEYIy+RRSd7s9DC8=; b=clhxuleQkk3NWje5p59emzAMMxBbE+QWlZhSoKY8sDQ7W22U8twwAU9t/1zEcAT+6SguzrVaBxPze4rct7SsNiVmWEpD0HG97aNK5zhHAwhsCJ0DoiGqUgE1R5xlSWhXrGjWzf7CSmvi047trY7wd6sFjyjktTZw0Dl9gbYtg7ZdZ+8nZIkfVw64zi+UUMGA38Hy01d+WPru+1+NjLl/uSa05HzDsekIsuMXqYxG75maPwBbSu1xREYiaOW4ZteIEF47AP0fwfWP19MsoG81ICzhBqrrkPxuYQE25m9jCQ31YBahrV0Qg+bEIeKh0+uf6inczGbtXSh/p6+9IP6TJA== 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=yirfLel8afeEiDUxMQrMnDE/UbNIEYIy+RRSd7s9DC8=; b=ePxsnsq3NjpWim66/LGrEeVa5Jy1dJJ4EFyXfKzjD1JNVnB0wW5CTnCf1ZAd8YjqILwHThuwavh315PGmZlgcnzWqhBoUmfxGRSGLSaaaENF1SgWEXcPtKxeFi87A/zxH4rMCz2Wyld/WvRcDMUbowis8h73g0ccgZk5pLDQGjs= Authentication-Results: redhat.com; dkim=none (message not signed) header.d=none;redhat.com; dmarc=none action=none header.from=oracle.com; Received: from BN8PR10MB3570.namprd10.prod.outlook.com (2603:10b6:408:ae::12) by BN0PR10MB5254.namprd10.prod.outlook.com (2603:10b6:408:12f::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.25; Fri, 12 Feb 2021 07:27:01 +0000 Received: from BN8PR10MB3570.namprd10.prod.outlook.com ([fe80::513a:2259:52d5:e495]) by BN8PR10MB3570.namprd10.prod.outlook.com ([fe80::513a:2259:52d5:e495%4]) with mapi id 15.20.3846.027; Fri, 12 Feb 2021 07:27:01 +0000 From: Mike Christie To: mst@redhat.com, stefanha@redhat.com, Chaitanya.Kulkarni@wdc.com, hch@lst.de, loberman@redhat.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org Cc: Mike Christie Subject: [PATCH 08/25] tcm_loop: Convert to new submission API Date: Fri, 12 Feb 2021 01:26:25 -0600 Message-Id: <20210212072642.17520-9-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210212072642.17520-1-michael.christie@oracle.com> References: <20210212072642.17520-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: CH2PR14CA0050.namprd14.prod.outlook.com (2603:10b6:610:56::30) To BN8PR10MB3570.namprd10.prod.outlook.com (2603:10b6:408:ae::12) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by CH2PR14CA0050.namprd14.prod.outlook.com (2603:10b6:610:56::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.27 via Frontend Transport; Fri, 12 Feb 2021 07:27:00 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 223e022e-e910-47e0-d094-08d8cf279679 X-MS-TrafficTypeDiagnostic: BN0PR10MB5254: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5516; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mct6zitxjeSnb06h0sZkvXmC4ZEtW9xl/rtXZoXDp6Dyw4RIdBWJaiV5u0AAGh20a4GNizRglYl/CCfthsSvtnl0fbs8gHAjUhXKbNFe5pJwBEe1QkB/CT3MljX1TSMeK4mJm4mlFD7GWVddfIcOmX/Z/63uK0ZLp//va/Rs2JxOjs8Nn55Jh44eL+ZDyKjgqiEBxkm5xfLkp2PoMT6Zl6A0t1hyaMBk+VwG0ufeqDJvniaN9Sg4wlTrage8wRgvUef5P062YSwS0v0Swt80gplnK0LEnx8KXm9X74KEH2liHdYjR+UmXz7vm4Dh1kkCQKfoK4PQBIU83KIY+xIGkXLyz8ippFtmk3Z39tX7+FnwyNQTfbCi9uMT8hc9QPS5QLDfkcwA+UoGMDUS8MWul5064iOlJqXSmXU9ERNAmv1P6mrful+ebx0BAuAAQRkLqWLykUDu3vqVng2SQnxv4qRdTgmjA097jAwGgdtLnSEpd4GjD+uRBgBeKcRAGjJMLK5k8sfMA8kq5QZbAEWWrzpLZ8efeWrR7p2w27LC15JrlhptAMaQmCpBTzaQR2jpJV6ICXpfR+aICqTDN0uGnw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN8PR10MB3570.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(396003)(39860400002)(346002)(136003)(366004)(376002)(8676002)(2616005)(4326008)(316002)(8936002)(6512007)(66476007)(16526019)(107886003)(26005)(956004)(6666004)(69590400011)(186003)(83380400001)(36756003)(5660300002)(52116002)(1076003)(66556008)(478600001)(66946007)(86362001)(6506007)(2906002)(6486002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: PG3IGTkO13Q743j1C1DPgNP2zy80lk437T+vWVyxgdoz7doU/wL86n5n1Pgv5gZOjacJ0TBqgE30Z7XAo0JAOxqaP1JwfeiXdsrvltV7HBysoa1XCNHgtwSEAhThL3To/tlEVG7OnVD6A710XLJdYws/1IjU9YWyOMRzAfrgfEvpgnvN5MJj9IWJFDl/OWc8J6r9YK4Qw4RL288T7EiJTvdLe+dEtQRanLGeqauIy4FDAtdDrNQ7SUVlMFaygtcL+EGXm49fT8yaZdtVS+1ofRd5OO97ogUyA6QvkXI2JDhQULtRQ7TNDQvoviTX7VyZwyA/EwNoHj45nampxbC2z0qklaHONFk/SYMNhpSClg0Sh47NcvLlkNfglsM/dpReToDKdp2DmpGW//Gf7nd6VN1I5vBLhqRxTXdmCVbkwC3cLo52V/aGfrK4Qsi+9w1mmPxFIdvrdnRAGkUFWVROolItcOlgtsvJLr9/XjagWbEKOcPFHO29BUBx4wT5tUai4LmUPEwi+Mv95EpUT0HUeCISSg/NeWR0GhKmcsMTJziey3FfvKeYa1XqC6DDlX/rSa5UQO5/1a97bcqOF7oKDpNLWrBLgSRZnoEJz1DwMPrTevL7yTql8PiM+DuGv7zwF+onkyIIKT2HPm3Y5mVT9JnybH2vDBUOlE9twA29PjbSJsyIPF0u+wuX+OWdqoBe7LvYRaRh4AAsgIXzn7Wdu38bdLxXj8HKwhwwJwMqTkL5qQ5tDvqgWNbH23FDjgDFLaSxbGC8AZDF8i5sAcWWzhzdYpAY9RsfXdi5L5AZ9n1FHg5XKzazu020OGCyepfQ8tc7oWOB305x8Wn/etD6JibShDMgNxvLYJRmTaM1d9b7tn3kjDE3L4prZcNJW7iHKpFZrrspdVaxfUM9YQNig88PNERQ+htcQ39ylSo2xyOADCmqAtUUWVzY0a/PNqLPPxPM3poIgBnqsRrLUsDZ9LGrLpuuFgfCBoSOG5o2/6XEOLsBc0QdDj/nYQA5RrppLsumprHa+t7dsbKYiLTytXWi0g3l6duxubOR75uzNu9tqGojU8WtVVkCEUHDsPR89Q7aq2qno381a8iX7lJ7zIjODPc1bww2BXtOf0PRqIDQBclz/7+OjqwpQGvHPAL8iWXGtB7VvzFlX0k0lILs9hGmmA+kdKDUQv2ZraIXtnXpeborEMxkcsadVqmD1ayPB/0vZx+N5J4MOS6DRstv1q+bmBniuMGM4/75MsXEA2fQey8iQTpAZzgi8JoGz/1h/MprWL+kBm4ElfmF036CKh/YW6upkLEUfL36glJQPizujbD/+CKj/82wpu8WKsIg X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 223e022e-e910-47e0-d094-08d8cf279679 X-MS-Exchange-CrossTenant-AuthSource: BN8PR10MB3570.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Feb 2021 07:27:01.0673 (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: 27Vji8ppTCy40j7eReYr2Dlw8RSICByOvFxfw3DPxt4a7xVPNHUWnlxE9DH2Ew3zHg1yOUVuyT6b/CNs3mg/QSiEaVhcL+7fY16wZSixvoo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN0PR10MB5254 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9892 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 adultscore=0 mlxlogscore=999 mlxscore=0 suspectscore=0 malwarescore=0 phishscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102120053 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9892 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 mlxscore=0 mlxlogscore=999 spamscore=0 impostorscore=0 malwarescore=0 clxscore=1015 suspectscore=0 adultscore=0 bulkscore=0 lowpriorityscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102120053 Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org target_submit_cmd_map_sgls is being removed, so convert loop to the new submission API. Even though loop does its own shutdown sync, this has loop use target_init_cmd/target_submit_prep/target_submit since it needed to map sgls and in the next patches it will use the API to use LIO's workqueue. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig --- 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 Fri Feb 12 07:26:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 12084797 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 87B40C433E0 for ; Fri, 12 Feb 2021 07:31:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 50E7264E39 for ; Fri, 12 Feb 2021 07:31:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229617AbhBLHa7 (ORCPT ); Fri, 12 Feb 2021 02:30:59 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:60542 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229896AbhBLH3x (ORCPT ); Fri, 12 Feb 2021 02:29:53 -0500 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11C7ODtv176445; Fri, 12 Feb 2021 07:27:04 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=REChbTM+nyS84aN3X8b0x4n2j/YKp8W1E93Zib/qGds=; b=Com9l92nrEWstuwbvXG/f7NfTZYIRBHd8iREgbVeOtj3akMFaBa/9IDXctQu41iTl1SS XurtSE6mW1ACO2T7iBrXs4lFEgk8KguhvV5sDtUN2/n9IFczew1Daft22ZaNYlZ9BUI0 2Pw+Pe/5DRmHPZ/PvFHLjlzn7+dL9lt9qkPipPLeNfUpqqopS0wSwY5M9c16RrDz16ik zcYdFs4O/Gc5F4Pez3dbJ/oaRMD/bXP5cdb3oVvFSjBtlloxz4JIoWitGdd+FQlUsjGa PUpFLYvW+NrOLMpVz1S2aS/iJQ3XWJ+Te4Sci+HS7jGz/PIPiVWmAZAyXu7Fh3iqQ6gX Ig== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2130.oracle.com with ESMTP id 36hgmataw2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Feb 2021 07:27:04 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11C7OnuS012963; Fri, 12 Feb 2021 07:27:03 GMT Received: from nam04-mw2-obe.outbound.protection.outlook.com (mail-mw2nam08lp2171.outbound.protection.outlook.com [104.47.73.171]) by userp3020.oracle.com with ESMTP id 36j4vvcbub-6 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Feb 2021 07:27:03 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=B60Vj0us5trCSBg5wWVCsZF+YLq2YiHlA8yocDd2v73YVR6GUMiYwg1YfQFsYWLXhnKnSZL2VV0ST8DyzlNQQakcxilPzwukh84QOKACrcwTb6f1ukzPN+iB1Sydkwzj+qkjqOGnwfhW1ApbqXg+UwcbpuPab0MbUVherK9zZt7kYrCSY8I+tSVtHfMFlrkeqHlZFJt4tAMTY+xfzPov97RcN9f5xbiG84J39FzdePkg+xPDfXKaH70dragO7XqVOxDlRsGOEkSwmtMeW8vk1soscudekWThb2regF4+FVzASYI6wdVu1+nVYZI1BhLsh7u+FJaQrZr4T3IEaV9V8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=REChbTM+nyS84aN3X8b0x4n2j/YKp8W1E93Zib/qGds=; b=JiehVUFbz9NjZjQvm7AQvaG5UfNTp9UDKd3faov7pE4WBBrNTt0ygX5q400TwK/gnpRFdkeRVUzdWNOqoOQ4q4doSOjAgkArhJ/2YfrFvHuTJSgYOI8fT2xbdg4j2tT9bzhUsFWF32ZdLdtbJVnxAlztkQXuKBvnWdHrBJ4I2c9CTHqDgimo1CsUNSER01PghEQR5raCmctedfkRXw1dr/k/IY317TJT2ZdnqQdWtDwis1OKDT+g2EDYzOD9v5IBW3WSi34IvMRRuQHwa37A/yWRVdsk0+YK+RBX4GyrXpWyIgjcv31i4fOjahOeDkMguwu91sDlLZSqOhafhFp4Rw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=REChbTM+nyS84aN3X8b0x4n2j/YKp8W1E93Zib/qGds=; b=wYCISQJuPTtJRFl+4R9qY2AgH+t6QcnWGIB6REMvbuR89ekzXo3d+3oE6IOaE2QXr/tqKwkZHbok76rE7jCGpcauVXmZYitnyc9q3xuYdconWxidM5vI6HE2AeEngKXr2P//Y9nlajD8iaEvdsZgP7dHXH/BaV6GW0I09YxxAxg= Authentication-Results: redhat.com; dkim=none (message not signed) header.d=none;redhat.com; dmarc=none action=none header.from=oracle.com; Received: from BN8PR10MB3570.namprd10.prod.outlook.com (2603:10b6:408:ae::12) by BN0PR10MB5254.namprd10.prod.outlook.com (2603:10b6:408:12f::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.25; Fri, 12 Feb 2021 07:27:02 +0000 Received: from BN8PR10MB3570.namprd10.prod.outlook.com ([fe80::513a:2259:52d5:e495]) by BN8PR10MB3570.namprd10.prod.outlook.com ([fe80::513a:2259:52d5:e495%4]) with mapi id 15.20.3846.027; Fri, 12 Feb 2021 07:27:02 +0000 From: Mike Christie To: mst@redhat.com, stefanha@redhat.com, Chaitanya.Kulkarni@wdc.com, hch@lst.de, loberman@redhat.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org Cc: Mike Christie , Chris Boot Subject: [PATCH 09/25] sbp_target: Convert to new submission API Date: Fri, 12 Feb 2021 01:26:26 -0600 Message-Id: <20210212072642.17520-10-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210212072642.17520-1-michael.christie@oracle.com> References: <20210212072642.17520-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: CH2PR14CA0050.namprd14.prod.outlook.com (2603:10b6:610:56::30) To BN8PR10MB3570.namprd10.prod.outlook.com (2603:10b6:408:ae::12) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by CH2PR14CA0050.namprd14.prod.outlook.com (2603:10b6:610:56::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.27 via Frontend Transport; Fri, 12 Feb 2021 07:27:01 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 98bc28d9-fa15-4016-e7a6-08d8cf27971d X-MS-TrafficTypeDiagnostic: BN0PR10MB5254: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4303; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gF4FQSqFcb7k6Weg3A/xk1k03GKAGucKDbrbnxmrNHu5x7XUgoAz6pxPzPSuwPe3Namf+KHDCohNq36RPS9tuVnOb+4BpjO0Bn2lki1vOZZX4xuR4si2Hoq5JrCDUVyxgvfu1aoperx6yDtWL0K/mx1kLGerL4BQmkOZ/onimuOcxYurEU00xATPnbpSxiphza2GdkNSwkJ49HPL9qdFLDIxKM7K3X9E0YEsjfQJBS0rGvUdlZrOPlRixOSvv0FHV4bc4HLU9c7il2JIeeJO7dMUtxgIG+cujsgy7KWFivRzCSjI4r5BFip484vhigoyYtK1Vx+O3CalucSaB3/PurjnGq7QAEINzkwe2doPWaUuu0AtonZYrKTW4DPoXM7VHPFATRjHxP/U57a12a+cv+CTu/02s9N2GjBP1YjlOvBp9/g+lmCL7raE6D3fzv68vv1rG3VGaQ5Lra7ri5T5HKiIX38RsS0tdshvRALhhawWKFjpsCliCm+4vkJ+kbEt2CNioJLUr4BQ/mtnpCwTvkOGeUDry/CHjsH+CvYV6POwqOzhf898cWt7nfxRmAtRWDZHsn7YXzkUnnRjJG7Ebw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN8PR10MB3570.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(396003)(39860400002)(346002)(136003)(366004)(376002)(8676002)(2616005)(4326008)(316002)(8936002)(6512007)(66476007)(16526019)(26005)(956004)(6666004)(54906003)(69590400011)(186003)(83380400001)(36756003)(5660300002)(52116002)(1076003)(66556008)(478600001)(66946007)(86362001)(6506007)(2906002)(6486002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: Y3BWqY1qyUpBIoEDE9p2NgVCyVJpB/t2P/rzjjAUT6ek5I8J26zVmpV7sVsUFzaYOug7zZQkOYpbMWL6jt8gQ2mD3quK5VrV7PzipUTHmjkI75VxoRu11d/4dP48s7pWs96mAE/METIvcYO+RuTavzbDdZIbm4IYECdIv65/vdJO0BVw/IqzUjGsOwA9R9LktHyhoE0kfsO6ntq5Gggk1QJQL+lxHrozswNOJXh5DA+E1Ey9ncO8VmbwD1FRkha/1MEzNM1IkCAvBGEiIB4CxldArnLzxOH2BDoTKhgS2Y1g7qkjoJFutUv/bznKmwayGYCAXFXPYocZIjA97HEtZbltNgyKmGFK4kne6JrbgkcIZ1aL4Tuqeqv7ShAfXBUPGYhoLWIqdfRAJv16Ha1/XWQgprfx6SLB/+SWw3k53MOh7x0rvsraXtsP7zo/CBa/dsMJ9fHags1Oq8POA7ZWb9BZv7AzOEyYVnNOp7cyby1i/xuzmwy4F3T44P7le4Xl6KIC8vsnxP6lqMhEh5AnRCQGc2/7c06Gti/Bk/61FNyKR+J2qSEq/zGAIPuq93Cft6gf8mEC1EShr2bBTyN+DSXKd1G2FyaGrW8PBeAcFirGBZCrcugRIYWDYKRRFerjw0AdYTbu89BvFhbD6WKNhZ4M9jTwxnNzbuOCCp+z4PxNSi2fVQc0nNUqdhJeQqyMF7gwnPbkIdjCKn/Rnfe1OLk/TOr/EJ4QBoTJIGojbr6HJha9WD3t5gEzc5NJ1FAnYUspKzF9VmtvM+XgD2fGj2Oh9FSIyqbHKIcW/o5Wj8u8dCjvbRa325c6Ctq+Goi+rfbfzGTTDaqbaBZaHaCLyW4hXukG6IKn+vTsNBv/J4dDYUbe8sBDvgqOb00ui8hQp7zvo1wQLsNRyIF3OFOjRUInZPw7s5zJvA49onk3oU40UQkPJ3amikzWKiwbXq158vGTVYviyPu5zVrcqTWmrSbwdW6x1jTmjl/WkzWcCjic1hJ5yOT63UuNEjBXwOhpYNjXFw/08wfVHDHip8hVY0IyvB9eBCSITKp8JECkoVFQ2uW481F1i1kv/V0hjjSTEMc/wKSJfIYP0TCbLNUtO5OlbUk6xnUlTmz9E1XbUrvnp0Kg531tcN0Dn2gXSSRNwDAD+m4j5esGgddZ8Q78nrtNQWHLlulAzl2y5Oz9jITnRKHe+xdkPOKK0pkUsZv3RMHIgECzIWE0CU24wdzm6XzFFzgp+cghQb5iLdm3C3Murq1AyXSQSnho82sWI+zALZ/Euyivt8u7HS8ePShxRlTAfcsWnU0+FLmGaMdPjkbe6Nm/hN0zqmtE7tG4zuHx X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 98bc28d9-fa15-4016-e7a6-08d8cf27971d X-MS-Exchange-CrossTenant-AuthSource: BN8PR10MB3570.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Feb 2021 07:27:02.0957 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: oVkTJykZvhJrJTLR6tLy4nDywFdo4L4ojLiBJ7mNBxAi5kA67RQAclSMqjL60hVwWILLOto48Z244zybmELH2//G81Z4w5zTbARtmwjyLw0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN0PR10MB5254 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9892 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 adultscore=0 mlxlogscore=999 mlxscore=0 suspectscore=0 malwarescore=0 phishscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102120053 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9892 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 spamscore=0 lowpriorityscore=0 phishscore=0 adultscore=0 impostorscore=0 suspectscore=0 mlxscore=0 clxscore=1015 mlxlogscore=999 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102120053 Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org target_submit_cmd is now only for simple drivers that do their own sync during shutdown and do not use target_stop_session. It will never return a failure, so we can remove that code from the driver. Cc: Chris Boot Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig --- drivers/target/sbp/sbp_target.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/target/sbp/sbp_target.c b/drivers/target/sbp/sbp_target.c index e4a9b9fe3dfb..f467c50aee08 100644 --- a/drivers/target/sbp/sbp_target.c +++ b/drivers/target/sbp/sbp_target.c @@ -1218,11 +1218,9 @@ static void sbp_handle_command(struct sbp_target_request *req) /* only used for printk until we do TMRs */ req->se_cmd.tag = req->orb_pointer; - if (target_submit_cmd(&req->se_cmd, sess->se_sess, req->cmd_buf, - req->sense_buf, unpacked_lun, data_length, - TCM_SIMPLE_TAG, data_dir, TARGET_SCF_ACK_KREF)) - goto err; - + target_submit_cmd(&req->se_cmd, sess->se_sess, req->cmd_buf, + req->sense_buf, unpacked_lun, data_length, + TCM_SIMPLE_TAG, data_dir, TARGET_SCF_ACK_KREF); return; err: From patchwork Fri Feb 12 07:26:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 12084789 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 26E4FC433E9 for ; Fri, 12 Feb 2021 07:28:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EF2B764E39 for ; Fri, 12 Feb 2021 07:28:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229844AbhBLH2W (ORCPT ); Fri, 12 Feb 2021 02:28:22 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:40316 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229608AbhBLH1w (ORCPT ); Fri, 12 Feb 2021 02:27:52 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11C7P959016730; Fri, 12 Feb 2021 07:27:05 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=07JY3KzmlsA2PeJId/YZiQz2bizROuYKAmend1Uxe0g=; b=bhjY+7O+YpSMy5BzTmY8G8z2RPzmG94pATCAVQ3ucWIDwdKN95sziAxxLTynt0xwP+4t aiKbXgoJsTitPwIMcESpR7bAOakeUA1Oxrp9ObHNn3Hhjkh8lkw5b8oDrsqQKeKdBOGG tbcStI3lM1gLRG8RriV9+m/kz7l1UsSEVg04I1hYArbjMuqWwg8PDrh3Qfp1LDmGbSQO /qrVfXe7k8j3egaQb9Cq5XXmteQSparX0QdyOZp7y0KaIjjqSZy847BVI7CVLbnmQXvy zhTZ3SDWGe9jk9QkrlWJRJcKKXOgnzzVT2JeS7tdFfZRD/WeREf2mECNXNuno1ywEsqE YQ== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2130.oracle.com with ESMTP id 36mv9dvcuj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Feb 2021 07:27:05 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11C7P9RM168446; Fri, 12 Feb 2021 07:27:05 GMT Received: from nam04-mw2-obe.outbound.protection.outlook.com (mail-mw2nam08lp2171.outbound.protection.outlook.com [104.47.73.171]) by userp3030.oracle.com with ESMTP id 36j5214tpg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Feb 2021 07:27:04 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=L5fJjscJ46ItLcibkiF2GTfkXA9rtQ4gYnw35Vf3hvV+mI+tG4Dh3opRBwvVnFwClxaNEkIUbrkGbStJSIvygSaQzWrbNjQIE3+rruexXzVjOW59hAsVJSYk+9qtIk9vK1phVaXvkmGOnXyfceilcoMZd7UPYbYyMlqfIDrDFSI6+6RfKkq+unEQmHlnLvnhxo5iqlicVZfOOsqRU4wTCfgQ0Q6zTv2w8iojg9+Ak0UEM6Ongngg2+6H+MgQjrBfWpN6b/vdlvFcdTwq1u3Imhnlg4oVYnjRPfKdoONlg7+a6HLrNJLVlmcf4brvNBA3Vi7aZdZZReQAqhDjZ/Lxvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=07JY3KzmlsA2PeJId/YZiQz2bizROuYKAmend1Uxe0g=; b=DaQrY7Y7bT2QHK+RBHkdjOC9VTVdZ3+BJXGMLaiVwm3EMZcgSyRj0Da0APoN13/X73WSTs5dquItqGZIaUcIVvQhQrJstrOHy0VMJlpsBcUFyCWKmKu7twoAXlXNX/Om4yytOjXoxfwuA9EBYIxXZF3Z5rhX2kuyBP/a35/teJzQYFKLKk63Y7n+qsQaV9m3Po3EvpMWtrMQQ/QbI2tYD/c/35RBvGPUJJbzZy9GenARh9wA4BLTeRYAnsdikr+72O/N3C6VqcolYUrqm9GJgmerERmYiWnMj43SsMXGYQd5jxn8Cm0xUjCkilPBQ4YG71+t8seDSzRV0M7McZNU+A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=07JY3KzmlsA2PeJId/YZiQz2bizROuYKAmend1Uxe0g=; b=Ja4FFaqYX4cmwm+xPKYaiRXEFCPgMCVji22oMoA+M2xdh+KyYZ37Y+MjkSBbtHzfQoMZW4NchY6IrQ2urj+NqoeJXFh9ITSZhFY83PKvtpXb+ce5Z62jLbApqtIF1z2Qr927d039tpPyl3vm/t8ZMXMU2uIIe8Ard1foQ83MOk0= Authentication-Results: redhat.com; dkim=none (message not signed) header.d=none;redhat.com; dmarc=none action=none header.from=oracle.com; Received: from BN8PR10MB3570.namprd10.prod.outlook.com (2603:10b6:408:ae::12) by BN0PR10MB5254.namprd10.prod.outlook.com (2603:10b6:408:12f::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.25; Fri, 12 Feb 2021 07:27:03 +0000 Received: from BN8PR10MB3570.namprd10.prod.outlook.com ([fe80::513a:2259:52d5:e495]) by BN8PR10MB3570.namprd10.prod.outlook.com ([fe80::513a:2259:52d5:e495%4]) with mapi id 15.20.3846.027; Fri, 12 Feb 2021 07:27:03 +0000 From: Mike Christie To: mst@redhat.com, stefanha@redhat.com, Chaitanya.Kulkarni@wdc.com, hch@lst.de, loberman@redhat.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org Cc: Mike Christie , Felipe Balbi Subject: [PATCH 10/25] usb gadget: Convert to new submission API Date: Fri, 12 Feb 2021 01:26:27 -0600 Message-Id: <20210212072642.17520-11-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210212072642.17520-1-michael.christie@oracle.com> References: <20210212072642.17520-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: CH2PR14CA0050.namprd14.prod.outlook.com (2603:10b6:610:56::30) To BN8PR10MB3570.namprd10.prod.outlook.com (2603:10b6:408:ae::12) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by CH2PR14CA0050.namprd14.prod.outlook.com (2603:10b6:610:56::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.27 via Frontend Transport; Fri, 12 Feb 2021 07:27:02 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a29a7093-4ad5-4e7a-5a3e-08d8cf2797bc X-MS-TrafficTypeDiagnostic: BN0PR10MB5254: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ebkDSY3VFNlhpj6Aylr9IZkO+UneAsTHsyWtk1p7WLrEm7V3hkb10kjHkARHoH0fghm1/lUR6uUUNA3AVPYstUbQDT9oPmXG2bSHFCzQ+IF6YKL6yKdmuQ1lohcd426zElVVTB7Xc+8zR4qPKdKY71oqoqwsAJd0R93iq1kdJ/934yJ5jUuVZBG99x5KTC9oogQ9LTWdt3q56LpDSLFrIAnfpQXYT+fFaEX6kX33/MKY7eL5lgZBNlnMSgHxL6CPplPhxI6aMKZY/TG42Wj/29DzyZ4uKHe0PakA3jOHmM0UQP/LmikvbqZVxenMMXi+3R+yubIjCgfj1+C7R3JBZN8SkugE9PLUWBt/owUefWyfheYL29ttJicEnfxq3vA8hsYNVMt4r7IgkqoKRC02AkV07hGNJSxgYlQUwzc+Vld0dFQ1vVyQIfv1GHS9cxOkhi007jNrq1pabaOMzDosjSv2nCL3ZqFMAEqEH+1cpJzbUtt5anLtUXq6GcLv1ZAyjOKkde+hT1QD5sQgC+TAvE9oD4gPo/NTdVN0+SbeDeMEXIJsx34aTNUIgeHPBqeLy7BCP14DlVhllI0MI5aKJA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN8PR10MB3570.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(396003)(39860400002)(346002)(136003)(366004)(376002)(8676002)(2616005)(4326008)(316002)(8936002)(6512007)(66476007)(16526019)(26005)(956004)(6666004)(54906003)(69590400011)(186003)(83380400001)(36756003)(5660300002)(52116002)(1076003)(66556008)(478600001)(66946007)(86362001)(6506007)(2906002)(6486002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: IgAg+hUHXYDi6a1bRHhVj6jQh8+FGkQNgjbchkwKNGSafMAIBkubhWtMShvIqWLbENF01LgDaBK1IiTrh2fiQyDeMuTgeZW/c03qZHw0VZB6AXEgAjmhfw8w8Nsbw0jEk//+LwsyTx9z3pon9BUIEczuIaxZGUsT+p2dNGlvbpM6vGgSut3cfz3BzfPFj/yj0JrFSePYWuc2970RK/q+Zh0oPw0yTv5y2Qvx1SLXGuvdpOfjRaAFom+zzHcMVdgF9gu6sJAmr3exFuqdS7OFSz6GqheGIYSGB5Wn7s77vIEnPm7NnjMvBzCCqhebiC0REQ7Brw//aAjop9ZjOWAtlRtiUUpUFyCb3D4Fxk/l4xY/iZmlUsd/Sx8nYq2xw2vZxh8Zfa4jAkY7qgSkXs4y3w0Dqwvny7B4DsEfIxYfa5wRWcluWD/rrv7K+CJRc7xMeDk0X8kqOSTGDQ6fxysT5DEZKXzN012RFEZKJJ6p3v1TSwPs8dEio00OjjWyCelUhebuL4EW7Bn8BPNqKRsz8EtVLrg9HaU3nRipGbYP6eRrH+DivirwRGFx6J6gBrHhnopCHo8l4gQuNVb4WA7ywNhtsliCprgvVZF4hc1hCaUZhuaGA4Pxm4aJc/8uyJQ/S1nUnqbKbHzdZjHZ6FJX+cublx1gDvOnILPLqmCeBEeMgxUHNcYc24mNl4z5O5zm8C5kjBGs7sPFdVJY0o6QVKM1wG0sP9q5rW4eWfO/b3u2/HJdz88ZY38hB1aMrSEE1gY9fMLEOWUtB02MHEMXZkRJigYGai+cbnYU3tj32L0INLH+LiKonk8BeuWjs2hHhVMSJTXd1zrAbs/RpQCrGqIt1AkYxMl31dHsQIW9JXdEc7NbgsLrR7ZKfnEOXgSABJWFi0nYS3S+8TvOEWcKBbKgN26KnNuFVEGgRJiCfnNu/UxS9ZscoreQfjDhbkZdAy1SNYpJhr6qQZsDSw4PNkvM7JH0D2jWmnLwHdc7K8LIWimq+ozEKBZ0uo6xxW7BDhyNY1JKOFHjRW2yj9Xzfg6vFliTpeTC9II/jbUUmvjIEHAvamaqs72pi6Jwwvn+hr4M2TVDQvYGn9iT5nrNWUNwTQaTljdL/t3T+ILHXKeIyIPemvA41leAgddkLgCdLiI7aSimvMhaXoZmB00U5N6O0LxGWMzFg7Rv3Vp33sFnB1Wlost+tXK25uhsV2ydR82YRvYSiGtQrltQSCBgwhY1SWAWds5P0CIGndiZoVoiqkKToQaflMzrMOmVjNUyDrS/rlPrcnY6oe1vZ6ZF/qPhYqZx0XfF3vq5thufDRTwvbKL/vSe5elcdsRCKLH2 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: a29a7093-4ad5-4e7a-5a3e-08d8cf2797bc X-MS-Exchange-CrossTenant-AuthSource: BN8PR10MB3570.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Feb 2021 07:27:03.1301 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: rTnPwvpMpBcHzVWE0KlYPqrbA5nJSw5sJIFiWqAh0lA2f1q4O2WRTDgEzEf4vKQboSvDw7jwRa+uy65bLoPF9FZgO/AvFnCIAtrsUYP6pKk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN0PR10MB5254 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9892 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 spamscore=0 phishscore=0 mlxscore=0 malwarescore=0 mlxlogscore=999 bulkscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102120053 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9892 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 mlxlogscore=999 bulkscore=0 suspectscore=0 phishscore=0 adultscore=0 impostorscore=0 mlxscore=0 clxscore=1015 lowpriorityscore=0 malwarescore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102120053 Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org target_submit_cmd is now only for simple drivers that do their own sync during shutdown and do not use target_stop_session. It will never return a failure, so we can remove that code from the driver. Note: Before these patches target_submit_cmd would never return an error for usb since it does not use target_stop_session. If it did then we would have hit a refcount error here: transport_send_check_condition_and_sense(se_cmd, TCM_UNSUPPORTED_SCSI_OPCODE, 1); transport_generic_free_cmd(&cmd->se_cmd, 0); transport_send_check_condition_and_sense calls queue_status and the driver can sometimes do transport_generic_free_cmd from there via uasp_status_data_cmpl. In that case, the above transport_generic_free_cmd would then hit a refcount error. So that other use of the above error path in the driver is also probably wrong, but someone with the hardware needs to fix that. Cc: Felipe Balbi Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig --- drivers/usb/gadget/function/f_tcm.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/drivers/usb/gadget/function/f_tcm.c b/drivers/usb/gadget/function/f_tcm.c index dcce6e2605f5..7acb507946e6 100644 --- a/drivers/usb/gadget/function/f_tcm.c +++ b/drivers/usb/gadget/function/f_tcm.c @@ -1058,11 +1058,9 @@ static void usbg_cmd_work(struct work_struct *work) goto out; } - if (target_submit_cmd(se_cmd, tv_nexus->tvn_se_sess, cmd->cmd_buf, - cmd->sense_iu.sense, cmd->unpacked_lun, 0, - cmd->prio_attr, dir, flags) < 0) - goto out; - + target_submit_cmd(se_cmd, tv_nexus->tvn_se_sess, cmd->cmd_buf, + cmd->sense_iu.sense, cmd->unpacked_lun, 0, + cmd->prio_attr, dir, flags); return; out: @@ -1189,11 +1187,9 @@ static void bot_cmd_work(struct work_struct *work) goto out; } - if (target_submit_cmd(se_cmd, tv_nexus->tvn_se_sess, - cmd->cmd_buf, cmd->sense_iu.sense, cmd->unpacked_lun, - cmd->data_len, cmd->prio_attr, dir, 0) < 0) - goto out; - + target_submit_cmd(se_cmd, tv_nexus->tvn_se_sess, + cmd->cmd_buf, cmd->sense_iu.sense, cmd->unpacked_lun, + cmd->data_len, cmd->prio_attr, dir, 0); return; out: From patchwork Fri Feb 12 07:26:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 12084793 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 92332C433E6 for ; Fri, 12 Feb 2021 07:28:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5EFC664E57 for ; Fri, 12 Feb 2021 07:28:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229889AbhBLH2q (ORCPT ); Fri, 12 Feb 2021 02:28:46 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:58772 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229837AbhBLH2J (ORCPT ); Fri, 12 Feb 2021 02:28:09 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11C7NpC3169882; Fri, 12 Feb 2021 07:27:06 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=bBZl6XcBVYvu11vuyYl+TAIQjHs6gWBpMsFsnqKb2cc=; b=B7tKhvwUrrZuuZpIv1BOXoqWYD8Z5z58ZZ8oCxIbR8r1kJKVhi7XrROUyMHlC3izSTs+ xnoFO/QScnN5lyxT6aCgC5lh0iNTrNJ9jXHegCI/mRzfEJbt7giZSMtg4p+ThCv5Uk5p qqeuhgAQy3kxoonaDQzwoOPJChedkRw8FiVQ3pyeJ7XwjpdjGqje/0cHOoDCa3D5lYQS pKqT7xwR57jLgwsEDb5aFxEz+KuUfhTXVmnJIqkBs6ah1+Ue1oNV81k/AsCdAc/SBa9X 1eDXr97CjrfDTS2YpTYxSiN2uUBw9xFmXYyMNRdsFRPZ/ENUQwlGnDrWFFFXKABLR2BC Qg== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2120.oracle.com with ESMTP id 36hkrna555-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Feb 2021 07:27:06 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11C7P9RN168446; Fri, 12 Feb 2021 07:27:05 GMT Received: from nam04-mw2-obe.outbound.protection.outlook.com (mail-mw2nam08lp2171.outbound.protection.outlook.com [104.47.73.171]) by userp3030.oracle.com with ESMTP id 36j5214tpg-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Feb 2021 07:27:05 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dpvBVx0Rngx2/cCu+BVfEXtBh0z3Cx8Qq/xH2CbFBmS8ESW/sU5D5oOezNxmy24L38VgCT6cg52SkuXJ0Wk2snfeRu3tmKtPo4EbaKPss5MmvoNgAdJf49YDVcQjD9/y1bx3kxQ92ZrWo6IXHFUgKz4r76Gbiy8M7Kl8nh5tRT1y0oe7B5VLwH9JSJv529SDg5edU9UrWZvuqXe0D7/uDNlQN5sb2wpr/2z0SpkL5kmvZQ8VlOxyyo5tQ+aCKRhEtY/qBDnTQvL+k9yYzD5rH9PULuBevWrsxWzOf9L+ntMoYcYiHiMdqIDy0OR76DJBvu0FNCngLaGMqSePLLUNkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=bBZl6XcBVYvu11vuyYl+TAIQjHs6gWBpMsFsnqKb2cc=; b=GlOBrXTTJOgDU6Petsdfjibw3tRYTNyh8Fu62Oo2gKbEqK6kEweisQfCthT79Tkp11S6mkjOVy+mCVlJNuSgu0RCG7QP/DtYR2kKz3BmehqUX8iiUmZa0Hgvq7l8RC/pDp7d3deFZXT2lnb22wRjEGqxWqFLJzlAMeJZzS27EAQI+qMltn1lcRrr0mJZL8h/VepHgYI2xhAHZoQvwSnhjMphZcGtIvG4SMiN7toas4h10vABr9TW2DstfBMcQaSJIdUKPM4tOS0iMxdKDdRZTWFIODTWTDX6jOJ1LUPLN4MVtpNAla3+FGifm6+xu5RD6n+lbPcUYSgrFGnHlMQsPA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=bBZl6XcBVYvu11vuyYl+TAIQjHs6gWBpMsFsnqKb2cc=; b=i4LND/z2GboV1hK8OqIiB04GXhdK+uH1fqt9X2Vn7TAsnUXEnrYRc5sWaToSCQQV7RG0UAgnBV99C74TvBLUu5vwddCnwdsyvOUwixMyuSs9gAbcoUFN/xdry+qk6bJ+v4HDgZnWnvAmVFgoKu3gDTnU1clQ7NDFLm/XiGYqyCI= Authentication-Results: redhat.com; dkim=none (message not signed) header.d=none;redhat.com; dmarc=none action=none header.from=oracle.com; Received: from BN8PR10MB3570.namprd10.prod.outlook.com (2603:10b6:408:ae::12) by BN0PR10MB5254.namprd10.prod.outlook.com (2603:10b6:408:12f::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.25; Fri, 12 Feb 2021 07:27:04 +0000 Received: from BN8PR10MB3570.namprd10.prod.outlook.com ([fe80::513a:2259:52d5:e495]) by BN8PR10MB3570.namprd10.prod.outlook.com ([fe80::513a:2259:52d5:e495%4]) with mapi id 15.20.3846.027; Fri, 12 Feb 2021 07:27:04 +0000 From: Mike Christie To: mst@redhat.com, stefanha@redhat.com, Chaitanya.Kulkarni@wdc.com, hch@lst.de, loberman@redhat.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org Cc: Mike Christie Subject: [PATCH 11/25] vhost-scsi: Convert to new submission API Date: Fri, 12 Feb 2021 01:26:28 -0600 Message-Id: <20210212072642.17520-12-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210212072642.17520-1-michael.christie@oracle.com> References: <20210212072642.17520-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: CH2PR14CA0050.namprd14.prod.outlook.com (2603:10b6:610:56::30) To BN8PR10MB3570.namprd10.prod.outlook.com (2603:10b6:408:ae::12) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by CH2PR14CA0050.namprd14.prod.outlook.com (2603:10b6:610:56::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.27 via Frontend Transport; Fri, 12 Feb 2021 07:27:03 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 30efe28f-05c3-4089-53dd-08d8cf279853 X-MS-TrafficTypeDiagnostic: BN0PR10MB5254: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:364; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rou/GGQAm6+1R+pdbplv0J5giN++rFeUHqY3gUPNob0x5l6oqNeHUfGXvWW4av30tDnTf0v3hxsimWSxKbndmIQcTf15/AwNexo396y2H8v7MA6z0AVwnMtz1WqdwOXq7zSo/FKZ0/Gi5URe2E3xFlRaiVbtjl8NfR3eZBwVrHpV8tGriaaD23Vpm7T6LsHCLFXXh2iayz0rEs7xcg72498FUwE6B0TKq62Bd/j7K9xFJNbteQAvGXFuD63RENCZt4G7Ce9iLGznJTyiVjLbNfFPURVIC27G48ZCB6xtKehHuWQd9EZIlZF4QVG6J2W6kKo/Af50Ffx0C81EqNDtDRwWRTYP0u3pMcjFhGkwU3L7UKZOu9z9r3hoy1ceR3w2Tq8fslNiUUAj5T0xNRXUon1ZIeX1j4nvFvLLnH4YCDDWeoTCM/hFMWp6vIGXmEeP3UGJ0H+DkyrzlWbGzG/iyHWUJnmz8qBuRfLyKWaIkV8lizomMXdIwKkn9J37J68tbJgIyw45N1Dipo/AJ7jstwAKTeXwjYwjQ+lEhREKA3NFxGhypGGfG9ElSugEn+2N X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN8PR10MB3570.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(396003)(39860400002)(346002)(136003)(366004)(376002)(8676002)(2616005)(4326008)(316002)(8936002)(6512007)(66476007)(16526019)(107886003)(26005)(956004)(6666004)(69590400011)(186003)(83380400001)(36756003)(5660300002)(52116002)(1076003)(66556008)(478600001)(66946007)(86362001)(6506007)(2906002)(6486002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: T0xuIxxooDr+fT3fleEx5o1jr4mUU2XX2zucHAR3cp6CqFYdiGtDtjoZgD3joJ4j8+NPhCE5xRgclAXsI0M9aoUN5ZaPW3vV0S51YZIUtf9ZMLDHDJhu3gieWz56MWPNaXDPn3U8+YO0O8ppwLHD/iDPCWVLzxi2pUXzSRCFQcWI0erVeDnB48B+Dzh4D8xD2NAmFdGrhhz/gvIZeI4H0R+9kkjhQNgorCNrwTbcCrr4h9W9coE5C5AhD1b3hqdZeuHhIsIfxHN264eRZ+3NMm25bwnCEo9PBaWWCl5NDiyY4WKHnYMzAvYTCNBilKExWdnUQbojYWo+6LukpWMmMoZI210dSVOzkFeGqXsldlpn26TjG1CXOlgGyD/5Me7DVCw4SsjlcDqG+nv0RH4Pt4OG1fExgewNwM/RkJeuA3DnSbPYLfJQOpzt2NJzHw53uXKZi1zdU7i5Qe4YAn4sRVM3cmP2P2MCJ80ULOdC6RzBOEIoL0Knrtd8z2g9gbIIl72hCEbpXaBcM5PB43dt7miBlIy35k8cnyiMGQCGkAJ2JBgIbrJb9ADV7k7BuQ6uhrTw4cJnhAtPGD/940V96uAvfgBY3wbVw38KobVXPfGeay6icyMmYyyUwiDtSDzZ3qDXnpo8xCyNgYu5zH1Run0tyAlHGgjTzJJQk9oNSJZmz8XhpZu6NFTxFxqk8rXoi37ukD6y66Dl6szpTi8qUJDEy3Ld9RzqqQ04eoOV47ltX4h4Wqpi1S3Q5ELHY25nAdXbVUDStUAVeqtfneoqbBFqC4JyxX9V0RxV2SoK8ADpj3m/3MznwDWTRiJEBl3t6pEgyi+yOy35VWc91lZFL8YbhUHkGVbzdp/QvT324pVy0aO31sXBs1c06OWr1CygGJKv5uCjn6BOyQGa3rLn6JTj7mSt4haEeNSr/rCsmwlk6N9aVUvyhOyUe9QqAoDlWbIprN86WLxbRdsS3aeLnlHU927KAn+EIaOQks+l+3R0IJDxBtXmXJvlPcHir+AGAw4Wr9Bpo3Acg3jzrTXbKOvT5ISV5G3JhHoTKhg4WWZyir2xY/uBd+6C6gLzqrsOqdInsBKJSrleZYKcHTe+MbBvn0xJodechkwNv0qgUg43ofSZUiN0lz9+itpeFICh97mvKUS7qWkC3By4t6jDb3oXvZSWCgKPivhHFWrKV21mRJr8xyp58JZaJ/h3t3iQ0s0DFCpb0LirWTpxMvf4l205eKLSP+awUx3yxfJlS7uLSXzIgU8enlAqPHc82IbJRryxJh8iMuEh/OIV3M2/h0U8nw5zVO4Teaga96UOjjFTnBh+gcj7IGpT6pPdDDU7 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 30efe28f-05c3-4089-53dd-08d8cf279853 X-MS-Exchange-CrossTenant-AuthSource: BN8PR10MB3570.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Feb 2021 07:27:04.0756 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: lT1XCV4rMdJjLvHLidbkq2Aj8tl+wlTI/vRmG8jNKCuQ/fhDeYWcIZuu9egH9Pim+iDdZyjpNYZRmJvvLj+H/vQ7eFr2D+G22PFwAF/F32M= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN0PR10MB5254 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9892 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 spamscore=0 phishscore=0 mlxscore=0 malwarescore=0 mlxlogscore=999 bulkscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102120053 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9892 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 malwarescore=0 priorityscore=1501 bulkscore=0 spamscore=0 impostorscore=0 mlxscore=0 suspectscore=0 mlxlogscore=999 adultscore=0 clxscore=1015 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102120053 Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org target_submit_cmd_map_sgls is being removed, so convert vhost-scsi to the new submission API. This has it use target_init_cmd/target_submit_prep/target_submit because we need to have lio core map sgls which is now done in target_submit_prep, and in the next patches we will do the target_submit step from the lio workqueue. Note: vhost-scsi never calls target_stop_session so target_submit_cmd_map_sgls never failed (in the new API target_init_cmd handles target_stop_session being called when cmds are being submitted). If it were to have used target_stop_session and got an error, we would have hit a refcount bug like xen and usb, because it does: if (rc < 0) { transport_send_check_condition_and_sense(se_cmd, TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE, 0); transport_generic_free_cmd(se_cmd, 0); } transport_send_check_condition_and_sense calls queue_status which does transport_generic_free_cmd, and then we do an extra transport_generic_free_cmd call above which would have dropped the refcount to -1 and the refcount code would spit out errors. Cc: "Michael S. Tsirkin" Cc: Stefan Hajnoczi Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig --- drivers/vhost/scsi.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c index 4ce9f00ae10e..76508d408bb3 100644 --- a/drivers/vhost/scsi.c +++ b/drivers/vhost/scsi.c @@ -789,7 +789,6 @@ static void vhost_scsi_submission_work(struct work_struct *work) struct vhost_scsi_nexus *tv_nexus; struct se_cmd *se_cmd = &cmd->tvc_se_cmd; struct scatterlist *sg_ptr, *sg_prot_ptr = NULL; - int rc; /* FIXME: BIDI operation */ if (cmd->tvc_sgl_count) { @@ -805,18 +804,17 @@ static void vhost_scsi_submission_work(struct work_struct *work) tv_nexus = cmd->tvc_nexus; se_cmd->tag = 0; - rc = target_submit_cmd_map_sgls(se_cmd, tv_nexus->tvn_se_sess, - cmd->tvc_cdb, &cmd->tvc_sense_buf[0], + target_init_cmd(se_cmd, tv_nexus->tvn_se_sess, &cmd->tvc_sense_buf[0], cmd->tvc_lun, cmd->tvc_exp_data_len, vhost_scsi_to_tcm_attr(cmd->tvc_task_attr), - cmd->tvc_data_direction, TARGET_SCF_ACK_KREF, - sg_ptr, cmd->tvc_sgl_count, NULL, 0, sg_prot_ptr, - cmd->tvc_prot_sgl_count); - if (rc < 0) { - transport_send_check_condition_and_sense(se_cmd, - TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE, 0); - transport_generic_free_cmd(se_cmd, 0); - } + cmd->tvc_data_direction, TARGET_SCF_ACK_KREF); + + if (target_submit_prep(se_cmd, cmd->tvc_cdb, sg_ptr, + cmd->tvc_sgl_count, NULL, 0, sg_prot_ptr, + cmd->tvc_prot_sgl_count)) + return; + + target_submit(se_cmd); } static void From patchwork Fri Feb 12 07:26:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 12084799 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 B399BC433E9 for ; Fri, 12 Feb 2021 07:31:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 83EAB64DDF for ; Fri, 12 Feb 2021 07:31:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229832AbhBLHbD (ORCPT ); Fri, 12 Feb 2021 02:31:03 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:42340 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229894AbhBLH3x (ORCPT ); Fri, 12 Feb 2021 02:29:53 -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 11C7Pxpi017197; Fri, 12 Feb 2021 07:27: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=fykfHGcyaFRt5NhIis3zRliEuZ4j2G8ziMADvFSZUI4=; b=NjnIVcJukboumay0O4ZB/CRq7wn0wBtoUyZ2yX92WRLdF8tqZxVD/0Tw1kd7pA37vmjw uWlyyT3imZLX4jUYUlGS4aL2hJIGe41DG9lBHOG1n7ZyVDfTwYQbnhZxSsVEyWGkQMYl 1JbyvUsvZ21aAstKA0xPOGsi7B03jH2/9ZJjxoGjLVQFALVnZbgbLTt0/n0YJnQZvdtz NLi/Mq/1e6pa47a9/YtvxK8axtv+5bl1ytooe7KvMXQmLBriTXZ/FVdfVXKDM7vIJGyE I0cxSUy+w5uLraSgkNZCwmKX70S9k/9elDHoZyyzO9SE769Ve4GS5Z7aSJ0lpLY+ZGDv rw== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2130.oracle.com with ESMTP id 36mv9dvcum-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Feb 2021 07:27:06 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11C7P9RO168446; Fri, 12 Feb 2021 07:27:06 GMT Received: from nam04-mw2-obe.outbound.protection.outlook.com (mail-mw2nam08lp2171.outbound.protection.outlook.com [104.47.73.171]) by userp3030.oracle.com with ESMTP id 36j5214tpg-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Feb 2021 07:27:06 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=c7ePDJ7Dgufu/enYxSp2coAJzL8hf/f5V2DIQ3FrYapsaAmjmJlN7ijvFS9e5X05z7zc1G123ZfqGgJqcXFO1v3ngIucYzWTSM2M4uLaBYGN+AY14zYSP/jNX201Y/zSYJ2Z2WW/Ks7NNodvlr8melHcbxu9uehHrMogtGvoKhbe+Muc+jg2RhrW46JsT+Fhi4jp3c8LOX3e5aC8p2b7CcZ1aMBn6VajgL2o7UXGhVMGQO+qX2cnvI3ZAMh/ADtP4QKZDpQhvAlG9v8L2CyuNiOo8OhUDbs5xUggbxV/NjVDwkmSu0AUWo4l4nr/CfhMykpJsvy9TDkorIgdRRyBPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fykfHGcyaFRt5NhIis3zRliEuZ4j2G8ziMADvFSZUI4=; b=m7+EHGczbaVTyf6TFtFHIcLSKlKU8aDPiaHmlkHnTWA3rOIKF5lytm434CvzdCoPUDpCd5ChhO2bx5SRujDuuC8dFe8v2rWJtAzA5gnSo/LEWtfMWYh/T19ydH79cWEVhC5EXc4plJns0P5bT2YxIPOFpyL2qTNLDltmauMi14saO935IazKw4lIklv+coT5ZTTCCaYlNXwzdGKygAJlk7IvjQwg3u8JmwqXMC9/S28hgGPVZVB4+2ubKColl18/R7D4LUI915CojdU47SxrPHLu0+Q/M9IB9MT02LSE0bk9oigdrdFiUe7wZkVTxx1qWR93K37dUo75Lk09I1+QAA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fykfHGcyaFRt5NhIis3zRliEuZ4j2G8ziMADvFSZUI4=; b=QVQR1wJyS2MSnXQUliK6XSFQ7hVMCgI3/751Q7KET+cH7XisuZE1RcuOouy12HrmCyODYH1aHu2WH3B3JYY+CCPEO2bvhaQ95yHyCG+uimdRiYlK3e8BCUGYwFA+BR4jgdPN4Nj1mq5tbyqxL3Ii1fv99PfM1RFiIEFujV+lGLY= Authentication-Results: redhat.com; dkim=none (message not signed) header.d=none;redhat.com; dmarc=none action=none header.from=oracle.com; Received: from BN8PR10MB3570.namprd10.prod.outlook.com (2603:10b6:408:ae::12) by BN0PR10MB5254.namprd10.prod.outlook.com (2603:10b6:408:12f::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.25; Fri, 12 Feb 2021 07:27:05 +0000 Received: from BN8PR10MB3570.namprd10.prod.outlook.com ([fe80::513a:2259:52d5:e495]) by BN8PR10MB3570.namprd10.prod.outlook.com ([fe80::513a:2259:52d5:e495%4]) with mapi id 15.20.3846.027; Fri, 12 Feb 2021 07:27:05 +0000 From: Mike Christie To: mst@redhat.com, stefanha@redhat.com, Chaitanya.Kulkarni@wdc.com, hch@lst.de, loberman@redhat.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org Cc: Mike Christie Subject: [PATCH 12/25] xen-scsiback: Convert to new submission API Date: Fri, 12 Feb 2021 01:26:29 -0600 Message-Id: <20210212072642.17520-13-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210212072642.17520-1-michael.christie@oracle.com> References: <20210212072642.17520-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: CH2PR14CA0050.namprd14.prod.outlook.com (2603:10b6:610:56::30) To BN8PR10MB3570.namprd10.prod.outlook.com (2603:10b6:408:ae::12) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by CH2PR14CA0050.namprd14.prod.outlook.com (2603:10b6:610:56::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.27 via Frontend Transport; Fri, 12 Feb 2021 07:27:04 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5370e664-764f-4b55-d900-08d8cf2798e0 X-MS-TrafficTypeDiagnostic: BN0PR10MB5254: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:415; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: HVQ18sSYv2MNO5mrwsHsrSZw5dG73Ww/TqLLUBYAy7sLTOUdAJQeP5aqxaudOyUWPbPpG7bDZQtU2A38tzdSZJAH6wALlJB1wS9UyS9uBRH5fdfiBvkAqEywB0sViTUFY/4QOZMkn1IUi2YZzpO4ryL3LC0T0Ev8+Fw/EHE44KzfNTVhSnk4OWTGLm445Iau5A5hVRQmwT3DSldP4wt4EgeXR8HfEGT36r1vDFwyuJzw0zhjojHuQXZwMaqwV3KJba2ZMpMJvgnwt7LgMO8ZIntfK4W1+gY6nslG1it8rV884R71BnndObG5BEFhKGqrarkLr6hoELj5mfMJz84XGkSa5xi/5gaBgEERCPKbs8yhi7HN5TJp+mM2dXI8R7JTVKeEPtnkloYf4A/Nuq3e+R3mcsjFS7ZAh+LBjoKJFW4b/2wKoFnyXH1Pz1UWHu59xiTPBGbNAq+yhnu6b9E5xJcqvr2tAg34VGZyzqE5ZD4YNXLGZA7J+cZYE0K5Xg41jvPAT/bdEmcZXTQl/csK+NBUX5XoNmedB3cV3dRlxRAXdtI2N2wVtDtVIYo46UMfk7jC87oRJHeT6HOYRfnfEA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN8PR10MB3570.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(396003)(39860400002)(346002)(136003)(366004)(376002)(8676002)(2616005)(4326008)(316002)(8936002)(6512007)(66476007)(16526019)(107886003)(26005)(956004)(6666004)(69590400011)(186003)(83380400001)(36756003)(5660300002)(52116002)(1076003)(66556008)(478600001)(66946007)(86362001)(6506007)(2906002)(6486002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: NPfrMdncgHHFzC3qDPTxgHbu6P2wGatFxj2mq7kwAdxCnSShgqcmxCijXt7bZwv1XTGgD15J505KFE1C54mZDlEpyNoZp13NUwNIDLKokeo26jXqWXg9xpH/n/bMJHzFqiE4hCviib+0UNGLQ80L7J9YNRgNJ5ZZrEFfGXeVnrQpd/bjQ4a10mkHBEJB1bQRn7CZGa69tmmBFMnfswI4yTKunMsU6MKbXH9GR6WZYRivIB+G5K7lnNJ9ohh/DKDO/MLPv5Rqg6qNVNiqb/9Vw1q0uLF6wTxUwhn9lvfMFHvwDblnq3U2mP4izPvYVnheeZcw1lUIh0PSiNv0g1uwrN3qrQIpjOeZeAAcQQBwNTBJWFMY+t0q2VAOljOGfj5Y6mRNtHX/OWMgDHccOMykiTQggeFJDTj4INYDux3DD10CchiaYe1YG/p5xMssbgSxmPs8TKK9BxcMdMM3iVE2UklmdAJdgPA2KyJWVix4GikFWivhHM970ajOlJBMt8c6aWZxzEo4m8Q3A5wu/ClQgKyHEw0F4Re5GlDGDjsYhm6HI93TegdN76NiR9pLFcepZ4Z3fdUjMfpwzZdjP2A1L+cIuaKL0u9p9JXKKPN/GKoayGIr0eHAbDEOCsP8XDCswPiTNQVkvFpga5NYlTa5pf1hdraBWz4ANL1aATDqlqRuBix36xQC44ZThs3fBxQyaHPB6QSQstmnW9ff3YZy449X+7JjgTdIP7osv17dylNaGUg2lRrz3NnSZT2Grb7gcceGjZcnCMIC49VAndxKMa2Xm43GewzYCbAkr1puLjM/4YryDeB2Mw21FkurOsoPZfWl8eKsf++YQPvTXx3FZxrHsbua3pRtQdVzItrAtK7fp9NU7cbzlPHRoHnnkoyIYL6Fdr4A2c7Owv4v4OReiFOzM2kpzPCix9UsKuL6STJZ8qqOX7T57/QTVr2kJlRctFm3gdK7LqFeG5L6LiGVbNnvpWOu5twd6FMOINT1CeM5BnfIIA1q5rlXmcEu8ZXWow9ZVY2DppNbWGuKzcSrUQv0FYYUbliWS+iFojGr36bNwRDHzkiUkZr7EBYG63JM82LVSuy8EyVoX2JpEtiOS0j0mIvX30q2Gt8dqAKyuLEkbW2BBwaBSUqPRm+m2fkze3CkJzG0k8lqsTOwKmumaCSO+xK3l2VrHB75I5fcyRZT0Pv3MxZg4ac/8ueaUnPkbbki4v5RvOBo7skJoKOOY54We3WWzYfireKxT/6+O+oVrJLuVAhCex+eDsRbT8HNsUxDUeZoJZPXi1DA6U9g7Kz+b39c4fvtqsi4PryC0WL0WZ9038Jo8oXA0dHN4ADG X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5370e664-764f-4b55-d900-08d8cf2798e0 X-MS-Exchange-CrossTenant-AuthSource: BN8PR10MB3570.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Feb 2021 07:27:05.0250 (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: C4IDYSQn24EWPCnSTlKicGZnKMgrmlnml5Ob1xipaeVv2Vkw+Uryr34m0XJrutJSOIslkiKOjG2OVMG9KqjWrDOWwptCx538y/ENkP4JswU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN0PR10MB5254 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9892 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 spamscore=0 phishscore=0 mlxscore=0 malwarescore=0 mlxlogscore=999 bulkscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102120053 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9892 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 mlxlogscore=999 bulkscore=0 suspectscore=0 phishscore=0 adultscore=0 impostorscore=0 mlxscore=0 clxscore=1015 lowpriorityscore=0 malwarescore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102120053 Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org target_submit_cmd_map_sgls is being removed, so convert xen to the new submission API. This has it use target_init_cmd/target_submit_prep/target_submit because we need to have lio core map sgls which is now done in target_submit_prep. target_init_cmd will never fail for xen because it does it's own sync during session shutdown, so we can remove that code. Note: xen never calls target_stop_session so target_submit_cmd_map_sgls never failed (in the new API target_init_cmd handles target_stop_session being called when cmds are being submitted). If it were to have used target_stop_session and got an error, we would have hit a refcount bug like xen and usb, because it does: if (rc < 0) { transport_send_check_condition_and_sense(se_cmd, TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE, 0); transport_generic_free_cmd(se_cmd, 0); } transport_send_check_condition_and_sense calls queue_status which calls scsiback_cmd_done->target_put_sess_cmd. We do an extra transport_generic_free_cmd call above which would have dropped the refcount to -1 and the refcount code would spit out errors. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig --- drivers/xen/xen-scsiback.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/drivers/xen/xen-scsiback.c b/drivers/xen/xen-scsiback.c index 862162dca33c..7bf9a6bede6d 100644 --- a/drivers/xen/xen-scsiback.c +++ b/drivers/xen/xen-scsiback.c @@ -360,21 +360,18 @@ static void scsiback_cmd_exec(struct vscsibk_pend *pending_req) { struct se_cmd *se_cmd = &pending_req->se_cmd; struct se_session *sess = pending_req->v2p->tpg->tpg_nexus->tvn_se_sess; - int rc; scsiback_get(pending_req->info); se_cmd->tag = pending_req->rqid; - rc = target_submit_cmd_map_sgls(se_cmd, sess, pending_req->cmnd, - pending_req->sense_buffer, pending_req->v2p->lun, - pending_req->data_len, 0, - pending_req->sc_data_direction, TARGET_SCF_ACK_KREF, - pending_req->sgl, pending_req->n_sg, - NULL, 0, NULL, 0); - if (rc < 0) { - transport_send_check_condition_and_sense(se_cmd, - TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE, 0); - transport_generic_free_cmd(se_cmd, 0); - } + target_init_cmd(se_cmd, sess, pending_req->sense_buffer, + pending_req->v2p->lun, pending_req->data_len, 0, + pending_req->sc_data_direction, TARGET_SCF_ACK_KREF); + + if (target_submit_prep(se_cmd, pending_req->cmnd, pending_req->sgl, + pending_req->n_sg, NULL, 0, NULL, 0)) + return; + + target_submit(se_cmd); } static int scsiback_gnttab_data_map_batch(struct gnttab_map_grant_ref *map, From patchwork Fri Feb 12 07:26:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 12084791 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EE049C433E0 for ; Fri, 12 Feb 2021 07:28:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B8FAA64E39 for ; Fri, 12 Feb 2021 07:28:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229653AbhBLH2n (ORCPT ); Fri, 12 Feb 2021 02:28:43 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:58802 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229839AbhBLH2I (ORCPT ); Fri, 12 Feb 2021 02:28:08 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11C7NpC4169882; Fri, 12 Feb 2021 07:27: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=1frQuRMui0cZxPjQIOFd5O6A6GKjiwmO7Nx2OJyie0k=; b=Di38g0EU7uFYrb9BtwQ5QOAAxOBV3jvEwwwFZfYEaPSBAK/dKlkNfZwQpzYAkJeZAbKW XNJ4HVUag0G6XNLWbLyVnqSgjqjOApr/uKtEDV8Z107qkMbUlUG1w2w6aYmMGabIrHZK xGynzmYIKxOpvi12SAAE514tu4x7CR2rGmgStYq+jnaD0FUMoTq7ZYqgugNBrDgZExSY K1N7ofVd3hcKFm/sxpc2yIUD8bBjeaP2+/mozj/DpUfnGvg7JAVpaZDKpxJ3gEGHRHEJ rCwf20lkWtEPTL2evHYCpsGqkimap0E6ceC+jmCTZsMXdlhu0rH2KEvcY8Y2ei9ReiJ1 xQ== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2120.oracle.com with ESMTP id 36hkrna556-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Feb 2021 07:27: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 11C7P9RP168446; Fri, 12 Feb 2021 07:27:07 GMT Received: from nam04-mw2-obe.outbound.protection.outlook.com (mail-mw2nam08lp2171.outbound.protection.outlook.com [104.47.73.171]) by userp3030.oracle.com with ESMTP id 36j5214tpg-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Feb 2021 07:27:07 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SOn4g8fZd3u5TTMPXMyjnpGtDOcywwX82now8j16FCyDaiXbvY4Lu0E6AlvSd3z0n/rE1Gx5cn8zSqg7xqvtt2afNrCSHXCyyCdXzLX3cHQkk/KINs47yENAskyj1JUgr/C2/AqcDiK0W+ZVfbYaQoKAehAq6F0s+xuRnXBXQCdyqvcj6jHwjDFzJFhqjpakQGYBYio9/bu5iM9sUCk7pi+Ln5Oe0aPRydck7l2xpzXI4MVI9p1QC2y145AEy7OSBOyicFOwWx5ir5ol7pxPKLkvK0qcfr01kwNHohSMB4vb45HoDWZWMHJpqIfwGOF5UaCaY7g+dM1db/43YUTs4Q== 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=ll5WFSKOrsSAtCQpW4qL66tP2VKcnRi2/k+63fIXkN5mD53a4C/OwbuxDDdR/R/eUg7WEUNN24qrbvEdNKl/mllzRd95Z9AFoX4OF9FmAoUs4pf/F7cJHkXtxUtdTl393tvy4A1qDN75FJvaj0ad5sR4ap4ZT0M3b2eA+g/XWRn1+713nwO/w0u48YYzLPbkfHnWScMhgYW1rB6Q/XjA5zwWoATg7W0HCOmuvdNSHVfnJzM6bqU1kydMutoV0ubMjVx/dSuj1jlQcLXETPk80nF7oSkX0yKI6k9iU9cJa/ADDLXAsXMlsz/cfaIeAbNngAm+tEsX/ijdvxD0lLZ0bg== 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=znpWf2ubT5YYhvnLGh+TeLc5x7DKZZwrbCccHcR146fIAPAimoCr5lsiY8kcnuQG1DGTCs+GIAvscSTnB+FP5WD7Ughu08geMYisUGcDhJH7jPWBm81mF1FmDYgUmLPPrzT2uusCTcePatd5IzTALWJ9a2fOyr22r2+ErCndoTI= Authentication-Results: redhat.com; dkim=none (message not signed) header.d=none;redhat.com; dmarc=none action=none header.from=oracle.com; Received: from BN8PR10MB3570.namprd10.prod.outlook.com (2603:10b6:408:ae::12) by BN0PR10MB5254.namprd10.prod.outlook.com (2603:10b6:408:12f::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.25; Fri, 12 Feb 2021 07:27:06 +0000 Received: from BN8PR10MB3570.namprd10.prod.outlook.com ([fe80::513a:2259:52d5:e495]) by BN8PR10MB3570.namprd10.prod.outlook.com ([fe80::513a:2259:52d5:e495%4]) with mapi id 15.20.3846.027; Fri, 12 Feb 2021 07:27:06 +0000 From: Mike Christie To: mst@redhat.com, stefanha@redhat.com, Chaitanya.Kulkarni@wdc.com, hch@lst.de, loberman@redhat.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org Cc: Mike Christie Subject: [PATCH 13/25] tcm_fc: Convert to new submission API Date: Fri, 12 Feb 2021 01:26:30 -0600 Message-Id: <20210212072642.17520-14-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210212072642.17520-1-michael.christie@oracle.com> References: <20210212072642.17520-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: CH2PR14CA0050.namprd14.prod.outlook.com (2603:10b6:610:56::30) To BN8PR10MB3570.namprd10.prod.outlook.com (2603:10b6:408:ae::12) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by CH2PR14CA0050.namprd14.prod.outlook.com (2603:10b6:610:56::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.27 via Frontend Transport; Fri, 12 Feb 2021 07:27:05 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2080e538-cb08-48aa-b90b-08d8cf279971 X-MS-TrafficTypeDiagnostic: BN0PR10MB5254: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4303; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ehw+zylvly3IUoQmvx1DgW05Rb2wOy9d6jWULC7cme+guOtY8RS6q39dgrwF9iPb84jQkR40e63A+eASL9/o9Ce6aAdm/ES6VxeIqlsDCw6Xzrmv4mSTZM+8Xx8bIY4pjjJ2/Qsyu/ec/3jB8Gzz0IpUD7cG1cxnrnrbARHHK1tjkziTJOA56m7gTuNBJ4cYNmbgFg6FO5L5h+BlHMhOHi7B74IKRr66T+lSZTjsBfnJnFDgnmRNSaU3ueOylv4FXwIQfUC8QgmaK0S8HljKuwseznGT4YkTwgVhlb/b3LJDVvuSb5XAKGXjDhPRanF7IGMtEmT5wuSvOpjY5u6Y4n4uAUUgKGb4XGlS9ZIu32xJlGEYNS5Pq6ltAaLCCzD+Yn0SkU7sae/BGyGxrEVYlu6B1F8GNecml65l2eS9sYP6/YcJkGE61dW0uj5RX+8SMQjB8BBPdXYs6BnXy5asTb6/D+NGo6x+slz7hl+AcphiKW+cLXw9f+kqi4E6J8uk27UBfOm3U2OVZO3L9iHrKVPN7c3ycTrNRWulY7eeqCKWIxScEiX7Du8vUV5Y0EAspo9Pwf2iJeKSFMQjsCu3QA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN8PR10MB3570.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(396003)(39860400002)(346002)(136003)(366004)(376002)(8676002)(2616005)(4326008)(316002)(8936002)(6512007)(66476007)(16526019)(107886003)(26005)(956004)(6666004)(69590400011)(186003)(83380400001)(36756003)(5660300002)(52116002)(1076003)(66556008)(478600001)(66946007)(86362001)(6506007)(2906002)(6486002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: hsYwM9xO98xSBirt6/QqePkGGZdFPAkGwjEXvC7mx86P1XmFyIitksnvQq7HQTAmdLtT0OT2IH32aOMTOqY+OOuU+e5vTZpu51wskA0PXa5W7zpAB9g/93ToAyl5w+GrP7J9jxWemQz65ScPGupzGXGM2gBxCP1KfXDTZ06PKI7LvJad/TDggJik0W0Zhnsg00aDmtBx7vXPtPKGMvTPg1kQ+v3OvVWvsQGTuCio7MVySgMcmJ7ZSOy7IgOz2RdxQ+ApowNITlk/ygPZtsVobyBXwebsymFq/P+3cC+uXIdwVAF6lM2oCkv+mPq/Rnp13qiwAo9tiigwjVgY5Zn+P9reg2Hz6liTGBdrX1WRPnuNWXP31tTnjz95N2lTsUXeCkNMLsw6G2oYxIDrkAhGByCN3gkHr8ccGJTurzJpTh8typeFPx2hYzBWSqMw/qLq1x15Vnbw4xnojRQPRxK0hgT8GESOMO34b5AjnTAwR/LcNAFuHR4JxzSnQkk/hlt6EoZN4OXI55Zm9fefU0bZFmtpxkH71MwIKIUS0AsmJu+mFlUrVTibMtAZD/MdzYRYeDv5VncvyDT5Kueq1gC1IaYI8C9HfrQzppjnHe7/eN6xGikurnudk6z/gJhOUh3vQVI0Yift8GEaoXug/BTvshALA6/83b34XQnCZEeFwNQeheRmNPpGiVkqZMp+6BeT13pvFqgYqNDfgYRfI/p3KrCWy8mKOxP6V/Vca7DZBtAfetGpGf1Wb6my0Wer8U8sQi4fM4U/udtTm2zujLrmsAtaneVtPRqXdoXEA7fwtkOlXUQjTHcOqY6oWZVDXD5qo0wanrGlV67ZIXbSIZo46Y7FWgaagCPz61/SUOb+MX7cmDrnRVot6cQldjqY4I+Ex8ZrK2xkUz+UT6Aq6nEixwtQg+gJ996u1+KltXshyl+W8YpOlhX6NELOyMz7y93ZeO1z1bZfARqsgLIJ6X0OYGqFbsSM0/Ves/WSuTRIVLErKr3e7ZvsEhSc4uvpYeEQzOjaEFC9iU0O+iEiz8HBJyrthu+UwstHmiQU+TvJedaBYqZpRZ2SeN2IESEgw7nE0lpZrLpPcA+kgyyR3rFVmT7AFxUGKA1QE+yaqpZzpPyq3HcwZYpWEp7N7x9YR9roHuSWssbznuYpDWOmshWl+5tCiGfz7QKqg9cgtrTumzcDGY9A5zbGVCaA0cFPDiuF8KzLOaV6LXPfEKxtz+3ru0yEECukOUTg2yjJq9F3IstnPnKxQmxQH/+McxAZIXg3h7BPj4xPkc9McJTyhgCplcZrf5zYkAlvEYQE14aReT4wK9kG2NPnxvNlWl7+ydZP X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2080e538-cb08-48aa-b90b-08d8cf279971 X-MS-Exchange-CrossTenant-AuthSource: BN8PR10MB3570.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Feb 2021 07:27:05.9405 (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: IL5TI7CCOMoOMjyZuWzFwwNoeSdCs9LKSGbEDihWxDLfuDPyCMA2eWPwkGy6cD+DADAYH2kS9C/YE0w+YhDAI0rlbkO+VfmwWClcNxvhBWg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN0PR10MB5254 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9892 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 spamscore=0 phishscore=0 mlxscore=0 malwarescore=0 mlxlogscore=999 bulkscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102120053 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9892 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 malwarescore=0 priorityscore=1501 bulkscore=0 spamscore=0 impostorscore=0 mlxscore=0 suspectscore=0 mlxlogscore=999 adultscore=0 clxscore=1015 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102120053 Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org target_submit_cmd is now only for simple drivers that do their own sync during shutdown and do not use target_stop_session, tcm_fc uses target_stop_session to sync session shutdown with lio core, so we use target_init_cmd/target_submit_prep/target_submit, because target_init_cmd will now detect the target_stop_session call and return an error. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig --- drivers/target/tcm_fc/tfc_cmd.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/target/tcm_fc/tfc_cmd.c b/drivers/target/tcm_fc/tfc_cmd.c index 768f250680d9..1376501ee3d0 100644 --- a/drivers/target/tcm_fc/tfc_cmd.c +++ b/drivers/target/tcm_fc/tfc_cmd.c @@ -543,16 +543,22 @@ static void ft_send_work(struct work_struct *work) fc_seq_set_resp(cmd->seq, ft_recv_seq, cmd); cmd->se_cmd.tag = fc_seq_exch(cmd->seq)->rxid; + /* * Use a single se_cmd->cmd_kref as we expect to release se_cmd * directly from ft_check_stop_free callback in response path. */ - if (target_submit_cmd(&cmd->se_cmd, cmd->sess->se_sess, fcp->fc_cdb, - &cmd->ft_sense_buffer[0], scsilun_to_int(&fcp->fc_lun), - ntohl(fcp->fc_dl), task_attr, data_dir, - TARGET_SCF_ACK_KREF)) + if (target_init_cmd(&cmd->se_cmd, cmd->sess->se_sess, + &cmd->ft_sense_buffer[0], + scsilun_to_int(&fcp->fc_lun), ntohl(fcp->fc_dl), + task_attr, data_dir, TARGET_SCF_ACK_KREF)) goto err; + if (target_submit_prep(&cmd->se_cmd, fcp->fc_cdb, NULL, 0, NULL, 0, + NULL, 0)) + return; + + target_submit(&cmd->se_cmd); pr_debug("r_ctl %x target_submit_cmd %p\n", fh->fh_r_ctl, cmd); return; From patchwork Fri Feb 12 07:26:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 12084801 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C59A2C43381 for ; Fri, 12 Feb 2021 07:31:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AEF4764E65 for ; Fri, 12 Feb 2021 07:31:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229875AbhBLHbE (ORCPT ); Fri, 12 Feb 2021 02:31:04 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:59876 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229690AbhBLH34 (ORCPT ); Fri, 12 Feb 2021 02:29:56 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11C7PPuC171158; Fri, 12 Feb 2021 07:27:10 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=AbZIrydSjLMvWnuKfg9p48xvW3INdg0yTB/7oFfvMKg=; b=MlhN01H/s4oZGkEwJ7bpmYqTDur8i3hRL0RtYzaak7vpNvv3lPT4hcu/3iUEtrExiJJO sOw+eVjvvwW2i3HmzMg43LMp0HOoVYk2N8nKZWx5IZdQLZUS9PtShLUDSGAdSiZkrIgy ARirrdiEOSRHgA4vB7Mojq6EfHKp8AKbd4v0XDv7dVvUjme56gKSiyuiKA2QDWkouOvx mLbKS2e0PxwyWF0kydyKanAXVyGIHhpb2TwERv89lcKo1kjWTlN+zFCqx1kwPCa4FftO DT57Y3u5mjff6yOJNFWr9BfKQvfCcnqI5b/Yx/D639fZ1kQVtIk1VFKX4s0muNm1NJ4W gQ== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2120.oracle.com with ESMTP id 36hkrna557-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Feb 2021 07:27:10 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11C7Q9BS090048; Fri, 12 Feb 2021 07:27:09 GMT Received: from nam04-mw2-obe.outbound.protection.outlook.com (mail-mw2nam08lp2173.outbound.protection.outlook.com [104.47.73.173]) by aserp3030.oracle.com with ESMTP id 36j4psn5st-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Feb 2021 07:27:09 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SwaRkKNnT5uf8EBpEHMHp+A+0mPzy+P3PsmT+ViICknuOpJ5oKfumSHF704sBWvXZ/pohAaFa4HQjZ3dZ9etbk1zO1H7Gc4v+asvUs0snY/gQ2JQFRWardbFZGqaYNTZQmuVFUFzp5IHSIU54t22EANKMPjdi/o82fvLKHE3IHlYKw4I8pB8/iBOl9plW4KQ+PQJSQ/FBwR/TXJI6NK8Rb2SYN0N8LytbgwB/n7laOI1SCFg3Kx/JRlvZDjRecbNrEEW7LLIl2ZV42fQO8khi7yTE6uKAg2Tn8FWw+kcMLnVqqK2POPO5yAgGvxdKqIpSIl+OBtsW8KRNNXhm7TQow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=AbZIrydSjLMvWnuKfg9p48xvW3INdg0yTB/7oFfvMKg=; b=JX42g3aP6gMLIHcl/hI/A95DLaa9mTtb9dVJpKo9YXKXqy1+XOOT9tZWt2si2CHV0j0yLEHdio1c0SXNqvnaIIqeSyNIguNcQeVq8jYy7GVMZJrTaAAB9dmT0rlWJcT5hiS2vCOT5rUwRzT044ZhYAKCTwWhtCP22zPPZtHRRUhpiJE0DNaHg8pqLSFUtOaQWwxBP6RlUhwJoFcx+SjweXocLPB4ZeyvxYRDXm20ussot33Sv6NtpI6XRR8XgQYAhtNE2EHd1M3hM5lVb4C/YvmSBLlqtXfbLxeYU/hCnZcusZEdTlhul949iO/01WmXoWIMZ3A+l4JAbg3tl/HFLA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=AbZIrydSjLMvWnuKfg9p48xvW3INdg0yTB/7oFfvMKg=; b=CRV4pFBfeO7GOnNYcA4h8MAFrTLaLCPL+F8G91UloU+MX49pgXw20ZUk3mYXanLNOfQyC3KZwYpa+K6bIW8ZmsfX04XklbbsveYzegrMaEREkXlOc5PyjTVQhHhvzmmkJqwX1FMg7LOIi5jQkb4kVmV3LiJwgY9bL2xeNDNqKHc= Authentication-Results: redhat.com; dkim=none (message not signed) header.d=none;redhat.com; dmarc=none action=none header.from=oracle.com; Received: from BN8PR10MB3570.namprd10.prod.outlook.com (2603:10b6:408:ae::12) by BN0PR10MB5254.namprd10.prod.outlook.com (2603:10b6:408:12f::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.25; Fri, 12 Feb 2021 07:27:07 +0000 Received: from BN8PR10MB3570.namprd10.prod.outlook.com ([fe80::513a:2259:52d5:e495]) by BN8PR10MB3570.namprd10.prod.outlook.com ([fe80::513a:2259:52d5:e495%4]) with mapi id 15.20.3846.027; Fri, 12 Feb 2021 07:27:07 +0000 From: Mike Christie To: mst@redhat.com, stefanha@redhat.com, Chaitanya.Kulkarni@wdc.com, hch@lst.de, loberman@redhat.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org Cc: Mike Christie Subject: [PATCH 14/25] target: remove target_submit_cmd_map_sgls Date: Fri, 12 Feb 2021 01:26:31 -0600 Message-Id: <20210212072642.17520-15-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210212072642.17520-1-michael.christie@oracle.com> References: <20210212072642.17520-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: CH2PR14CA0050.namprd14.prod.outlook.com (2603:10b6:610:56::30) To BN8PR10MB3570.namprd10.prod.outlook.com (2603:10b6:408:ae::12) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by CH2PR14CA0050.namprd14.prod.outlook.com (2603:10b6:610:56::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.27 via Frontend Transport; Fri, 12 Feb 2021 07:27:06 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2402ff99-008b-4183-9d87-08d8cf279a00 X-MS-TrafficTypeDiagnostic: BN0PR10MB5254: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PHn+RuWfzrG6m4xWW7BO4SYic5jBbMCBO/Fu1CQMmpqeYsT2zBgmPsBD/lOFVzg3PhFIoqoo7tlZO3st9mabepf8Y4eMz7yereSGCSleEnpt0u+0kUowTHv0MIQtmjeu1rYJ7SfJJz4GdAhiXH2uhw0QdlEbgv5Cf3iOU6dw+kh7CdzFy262+PFfr0DnVPr4nxguTFO8j9yciRF2wtuG9M40zty8pTc2Fv+HtI+IMufvw6aaNxX2xn+fqZLLxEbwwqt8kP3bJ6uUFnCfycgPFSGmltQdbWJQ3PgyMDCf5irsYtKLAy9GeiLSZ05CEMsJDRylFSTj88JAgFLhfVeQh+fTpGy4HeilamxFP+F+PooP1exaqGuZ9bnnARXts5UDhfAjLmSMEcg8IYaZxxnWmhXj+YyESSIyFqSfDoJXLR80/U0XqcUz/WNHyG2F6besTuNeacJdY3nt0dfVbNKitcpvPd8CirHXpsShVnxKA7SHEn8geo2XWxXT3gO4n92XjdHExALli/984WIjXoscWxA3ug1ZNv6jARWcb+huehPOsuT2gVTm51JIbye62pzRZctwg28rqopYMx9l3r8PgQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN8PR10MB3570.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(396003)(39860400002)(346002)(136003)(366004)(376002)(8676002)(2616005)(4326008)(316002)(8936002)(6512007)(66476007)(16526019)(107886003)(26005)(956004)(6666004)(69590400011)(186003)(83380400001)(36756003)(5660300002)(52116002)(1076003)(66556008)(478600001)(66946007)(86362001)(6506007)(2906002)(6486002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: sIhxIHqOH83ahCzskrUM7SZ3Ph8yeHYHaX8vGlZS8fUrno3Ju71LnMnNGtQAGg8lhxijb6JIg1BVm3bcUBR/pLCUFbEkpt2PKl4mb2R8N39VqSltJOEBzW6VUX4dgKGyQ6SPGZMr9ItI835qXJdwamuPRd9GxVqgPwFabwhQ+VLHBAvbnbCnO+/IMutjpgpIF556Tnacdq7qL25psm8lVgJNcHcCZAsNnC1NgtBYuZjWsLda1gsiN6EdYTeKxvdqwIu87Rp6oI+yZvOXVgRsvcjRrLtFieq82sdoEU8XGEUfPdsk6SDRTh3i7SGeUi+9X58VXzbxIUcCjPIEH/rK/FHkL2bxtxeq70GU558GB2l8Y+jvj8jZ5GUrG8y2gainLqfuOsrKIz+iYCLdsjmQM6EkC7Cx/CNmDRqdByX1gsirgvM5zZuP37K80Rf5wKVh82UZAoNoTltUcI7115qXi2Phzy7Q3rRsd16aOaQZfp0g4IzaT2CWR4AitrHcuF4WGvv4PC/BUfNHt5SrKHmafncPPRdsHhglHwe6bPwRGoNeL5j75PpR3IV6yfTys/QLwz+LXMk0dsqFSuAQgz7DMOHIyWrIicyKiUEpSLIFL/8aY6fPxzMQBDWxc4q9P32cnal41dCprSYZ+bUBfaRVOrN8RnGrQ4bCeEwJF1w/e5qPEVn9AzMbTXdyatLLi6e90+G0cEsdYIGUWjTcVolAqQFFZFu3mwUHamoRus3qqFbUfc0GA3erjsQGk2ZueCNDwZoWC2DqCsatueElKtW4k/pkIRjr2uK+UYoeivqT1CLYgbcSikkY6rQNrmFtea9RegeqVIDg7VC7IKlaGe2h7YXHKxqY1wr/GKkFwiXsPl/wJdpkRWAugiiKQ+nJ29C98izJTAxpLDB8AisY5IWlbn1cnlV74Yp1diICsrBPUC3Q647RqyQ4vwGp2Cjr57aKEi9kLNzaAl0PkLWKHFSIQwXGQWVfAWeDCQHjCSj73G/HT1ax6fHd5Tu/O9O7BBFPqpe/rfAIL3CjZSdFZTZVUxDcdV2FNxKH/zrKvwAMG4QBNrD2+xHSpSlBtszpKr1FG2eBlMP/3angzjeXJDRI1nJ/UWMYf8JxCjN+A4YGMn1ZLi8jTTeFRUMYFUdin3qqw0c1O8gdJmomRvAv/a4U/b6qAVXDKYSwuFFzQh8sQVtvqdWN4qTGBq8bf0eNuq4D7tYuw2hkqLIcOY3h3AoqDEZRH6F69U5ArXteRCu/J/wECmpe3kg4VINerzwpf9yr7mS+5BjnOLCHGrD5Ey4emLafCG2HI8gieOmwWEIVFDi3id6PrU6wg9G++T4Q6vFs X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2402ff99-008b-4183-9d87-08d8cf279a00 X-MS-Exchange-CrossTenant-AuthSource: BN8PR10MB3570.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Feb 2021 07:27:07.0249 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: iJVLT+n1qOoSOy7ri9x8yRg+Kqu3w1XJl6qUY0K3oH3Z3gsVRk6x28KIzLvMBa6urXie14w6/ZGNdHMTt+k2GlBGl6s+OSDpNXUgiQ9DZHc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN0PR10MB5254 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9892 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 adultscore=0 mlxlogscore=999 malwarescore=0 bulkscore=0 phishscore=0 spamscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102120053 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9892 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 malwarescore=0 priorityscore=1501 bulkscore=0 spamscore=0 impostorscore=0 mlxscore=0 suspectscore=0 mlxlogscore=999 adultscore=0 clxscore=1015 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102120053 Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org Convert target_submit_cmd to do its own calls and then remove target_submit_cmd_map_sgls since no one uses it. Signed-off-by: Mike Christie --- drivers/target/target_core_transport.c | 69 ++++---------------------- include/target/target_core_fabric.h | 6 +-- 2 files changed, 11 insertions(+), 64 deletions(-) diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index a82b7da09872..ad30a99a5cb2 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@ -1751,57 +1751,6 @@ void target_submit(struct se_cmd *se_cmd) } EXPORT_SYMBOL_GPL(target_submit); -/** - * target_submit_cmd_map_sgls - lookup unpacked lun and submit uninitialized - * se_cmd + use pre-allocated SGL memory. - * - * @se_cmd: command descriptor to submit - * @se_sess: associated se_sess for endpoint - * @cdb: pointer to SCSI CDB - * @sense: pointer to SCSI sense buffer - * @unpacked_lun: unpacked LUN to reference for struct se_lun - * @data_length: fabric expected data transfer length - * @task_attr: SAM task attribute - * @data_dir: DMA data direction - * @flags: flags for command submission from target_sc_flags_tables - * @sgl: struct scatterlist memory for unidirectional mapping - * @sgl_count: scatterlist count for unidirectional mapping - * @sgl_bidi: struct scatterlist memory for bidirectional READ mapping - * @sgl_bidi_count: scatterlist count for bidirectional READ mapping - * @sgl_prot: struct scatterlist memory protection information - * @sgl_prot_count: scatterlist count for protection information - * - * Task tags are supported if the caller has set @se_cmd->tag. - * - * Returns non zero to signal active I/O shutdown failure. All other - * setup exceptions will be returned as a SCSI CHECK_CONDITION response, - * but still return zero here. - * - * This may only be called from process context, and also currently - * assumes internal allocation of fabric payload buffer by target-core. - */ -int target_submit_cmd_map_sgls(struct se_cmd *se_cmd, struct se_session *se_sess, - unsigned char *cdb, unsigned char *sense, u64 unpacked_lun, - u32 data_length, int task_attr, int data_dir, int flags, - struct scatterlist *sgl, u32 sgl_count, - struct scatterlist *sgl_bidi, u32 sgl_bidi_count, - struct scatterlist *sgl_prot, u32 sgl_prot_count) -{ - int rc; - - rc = target_init_cmd(se_cmd, se_sess, sense, unpacked_lun, - data_length, task_attr, data_dir, flags); - if (rc < 0) - return rc; - - - target_submit_prep(se_cmd, cdb, sgl, sgl_count, sgl_bidi, - sgl_bidi_count, sgl_prot, sgl_prot_count); - target_submit(se_cmd); - return 0; -} -EXPORT_SYMBOL(target_submit_cmd_map_sgls); - /** * target_submit_cmd - lookup unpacked lun and submit uninitialized se_cmd * @@ -1817,22 +1766,24 @@ EXPORT_SYMBOL(target_submit_cmd_map_sgls); * * Task tags are supported if the caller has set @se_cmd->tag. * - * Returns non zero to signal active I/O shutdown failure. All other - * setup exceptions will be returned as a SCSI CHECK_CONDITION response, - * but still return zero here. - * * This may only be called from process context, and also currently * assumes internal allocation of fabric payload buffer by target-core. * * It also assumes interal target core SGL memory allocation. + * + * This function must only be used by drivers that do their own + * sync during shutdown and does not use target_stop_session. If there + * is a failure this function will call into the fabric driver's + * queue_status with a CHECK_CONDITION. */ -int target_submit_cmd(struct se_cmd *se_cmd, struct se_session *se_sess, +void target_submit_cmd(struct se_cmd *se_cmd, struct se_session *se_sess, unsigned char *cdb, unsigned char *sense, u64 unpacked_lun, u32 data_length, int task_attr, int data_dir, int flags) { - return target_submit_cmd_map_sgls(se_cmd, se_sess, cdb, sense, - unpacked_lun, data_length, task_attr, data_dir, - flags, NULL, 0, NULL, 0, NULL, 0); + target_init_cmd(se_cmd, se_sess, sense, unpacked_lun, data_length, + task_attr, data_dir, flags); + target_submit_prep(se_cmd, cdb, NULL, 0, NULL, 0, NULL, 0); + target_submit(se_cmd); } EXPORT_SYMBOL(target_submit_cmd); diff --git a/include/target/target_core_fabric.h b/include/target/target_core_fabric.h index 4b5f6687393a..86b0d4a7df92 100644 --- a/include/target/target_core_fabric.h +++ b/include/target/target_core_fabric.h @@ -162,11 +162,7 @@ void target_submit(struct se_cmd *se_cmd); sense_reason_t transport_lookup_cmd_lun(struct se_cmd *); sense_reason_t target_cmd_init_cdb(struct se_cmd *, unsigned char *); sense_reason_t target_cmd_parse_cdb(struct se_cmd *); -int target_submit_cmd_map_sgls(struct se_cmd *, struct se_session *, - unsigned char *, unsigned char *, u64, u32, int, int, int, - struct scatterlist *, u32, struct scatterlist *, u32, - struct scatterlist *, u32); -int target_submit_cmd(struct se_cmd *, struct se_session *, unsigned char *, +void target_submit_cmd(struct se_cmd *, struct se_session *, unsigned char *, unsigned char *, u64, u32, int, int, int); int target_submit_tmr(struct se_cmd *se_cmd, struct se_session *se_sess, unsigned char *sense, u64 unpacked_lun, From patchwork Fri Feb 12 07:26:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 12084805 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E569AC4332D for ; Fri, 12 Feb 2021 07:31:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C525964DDF for ; Fri, 12 Feb 2021 07:31:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229674AbhBLHbG (ORCPT ); Fri, 12 Feb 2021 02:31:06 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:42390 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229907AbhBLH36 (ORCPT ); Fri, 12 Feb 2021 02:29:58 -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 11C7QtM2017743; Fri, 12 Feb 2021 07:27:11 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=GhyWGuoV+KoSqPLT7zg0QiTLKCf26fujLsoSMvcwwMQ=; b=JE+456zy5Hjc6jY1HiphaCl+4+SpSy2zrCkS32FkCdQrwlBGYx6JL4CklMML1HFRUOIN Cy7AJnoCN7EgW40RLNBgej3NHiYs7YQnAgHqYS176bNhV5IcJFNAkGLOO5HMlKZldP2B ZTF8MtUz7H9sImVlSu8wNcNnocaudyA5h+9D/34hg3xMzhc+P8U3lZeztiuFFN+uySD+ iEW/HBZkz+NbtkaUN6vWZ9npQychS3OQ9DlyM67YrcSqeObM4ISEv9wWCoGQBs3dZ1mP ePjJLo2KA6qUKQ49kmRooKg40npzcIxMx5gDJ2+Q3HiSIy9Tj9Yrvs2PRHAp1jzo72Hw 3g== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2130.oracle.com with ESMTP id 36mv9dvcup-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Feb 2021 07:27:10 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11C7Q9BT090048; Fri, 12 Feb 2021 07:27:10 GMT Received: from nam04-mw2-obe.outbound.protection.outlook.com (mail-mw2nam08lp2173.outbound.protection.outlook.com [104.47.73.173]) by aserp3030.oracle.com with ESMTP id 36j4psn5st-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Feb 2021 07:27:09 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WsdarwYqRWIx7iDCtn2eb9Xu1nBxG+fHYdrShSG0Qqee9UJQj55HaqPBSYq8bpJAY+mNsEK2P/1TpOeGN1saFMBiqYHlYOvQBRWhe/SOtETIWwqvtpMu9F8vzDfdwUhU7Rna/0QCmiLnG7cDkz8NicoTBopeYnqo8qpwYKn95Nsg+D4nNop7NuSz0oiNtSWhEPPxn3cO/rIF5k0isXU9dAhnXquVDdoEzlneVjjEg/vBI/N/TH0GVEB6VvGt+0lWkzszd6gl/cT+MGeU+b2ACHa8ngXn9KquhhwtbXRSYDXEL6w2z+xiF5X8GlRBe9G1fcCO9SP9T4GqMRi8qb92Bg== 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=GhyWGuoV+KoSqPLT7zg0QiTLKCf26fujLsoSMvcwwMQ=; b=ipwR7Mc2MZNXt73sA22Y7eHSl1WrEk1ItiyGosUy4UhtEg92mmylnGmbd9ROVU6ikSZKGJ9kHVubZ6hK98XL4g1FVjnVS+3C6UEsBG5Y8FKVq3yBYalHiZI4nDSLjW84p2t2QlVxslN7atPvk0uWC5Wsiom9dWI3AonKqe1DSZaHtjEDOgfa4UoxMmeF8GadqZc9o6HuZ/DG3fklyGx1/6U3TCG4fs89vqe/ZGA8v/wQ3l/Swl91QQLdvKP5IguSCb88wizvG2kVMAdybWedmcsptELQj/6ZeZI5ZIy1dE+tBgp3GEHl7p1c9mGX5k0MEqsdax9BM/2FfkaKTuRlqw== 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=GhyWGuoV+KoSqPLT7zg0QiTLKCf26fujLsoSMvcwwMQ=; b=xPtT1DkW6lf8Vua2r4fe/B885O1bmbLD5hF8ZeuEgUCuX4r95JsoKayip53jNITF2mOQ6hFyefxnirLla204CwlzfsZMmi2TeeacASXbLF7wixtJlslP1ute6uboUhGr82hhVDr2Khx55uekhxsem3u3ZGpXFSsCYoMVfJWo1xo= Authentication-Results: redhat.com; dkim=none (message not signed) header.d=none;redhat.com; dmarc=none action=none header.from=oracle.com; Received: from BN8PR10MB3570.namprd10.prod.outlook.com (2603:10b6:408:ae::12) by BN0PR10MB5254.namprd10.prod.outlook.com (2603:10b6:408:12f::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.25; Fri, 12 Feb 2021 07:27:08 +0000 Received: from BN8PR10MB3570.namprd10.prod.outlook.com ([fe80::513a:2259:52d5:e495]) by BN8PR10MB3570.namprd10.prod.outlook.com ([fe80::513a:2259:52d5:e495%4]) with mapi id 15.20.3846.027; Fri, 12 Feb 2021 07:27:08 +0000 From: Mike Christie To: mst@redhat.com, stefanha@redhat.com, Chaitanya.Kulkarni@wdc.com, hch@lst.de, loberman@redhat.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org Cc: Mike Christie Subject: [PATCH 15/25] target: add gfp_t arg to target_cmd_init_cdb Date: Fri, 12 Feb 2021 01:26:32 -0600 Message-Id: <20210212072642.17520-16-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210212072642.17520-1-michael.christie@oracle.com> References: <20210212072642.17520-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: CH2PR14CA0050.namprd14.prod.outlook.com (2603:10b6:610:56::30) To BN8PR10MB3570.namprd10.prod.outlook.com (2603:10b6:408:ae::12) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by CH2PR14CA0050.namprd14.prod.outlook.com (2603:10b6:610:56::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.27 via Frontend Transport; Fri, 12 Feb 2021 07:27:07 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 80af52b2-d7e0-4ccc-f174-08d8cf279aa3 X-MS-TrafficTypeDiagnostic: BN0PR10MB5254: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3513; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Fa+TwBzfGygiBbV61L2w34VqtoBo8ZS9ZIVCcz5amukd+mOP3uzSYBlv8hYZ+OMpuQ5s2OIpno7YhxXId+8tuaS3wUTQ4JNxIBA3hu0zD8XdAuV/3iH0hzGVfNKwDkBFu098JFfUjN8A//3fwfheGWBu0yY4inPwAX3CZqDoVB5t6zxB5eUCSiENFqvHlFCN9ZuwTLmcl1Bbwji1gP/PXR6msxyFqhNFfI30OvBo8US7nQyrI55KbzF3odF8BjbpXlcCNIYBl/rVrFtPnQpSiqCLguvvxoS6jHfHbUzHeN/Yln5npXYL+03TuiOfpF6WjTxY/8HEYGuSR7fyfp4KUCIeSjOAX9CUc5LY8cwlDIT9SgKH0/5Buf2NMVnQ/oUp3W0e+3w0TbVqhRaTWl+G1Buqf2akfdyQwoq47HXZQreJqNYtv2Vfz8QbYOfhX26XN/eumR46bmdnu72IJiw40VfMFqneSGT0CbpVRMUOvlGMxz1lIA9Sp+YRxqVkEEJhe1u3pGgnCUHE/A3CmePs/ty3+yGGjZLBsRO+ZQ6CFEliC2ZczxDHV9v1MPP4O6a3+JyzPBGqVruBtHVoH7efEA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN8PR10MB3570.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(396003)(39860400002)(346002)(136003)(366004)(376002)(8676002)(2616005)(4326008)(316002)(8936002)(6512007)(66476007)(16526019)(107886003)(26005)(956004)(6666004)(69590400011)(186003)(83380400001)(36756003)(5660300002)(52116002)(1076003)(66556008)(478600001)(66946007)(86362001)(6506007)(2906002)(6486002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: Vm0egfoX7C7xHIXXewsncSdrQu7gv3rsylBNTJQNMdcg5OW+pVcZNowralCLvd0nLsQs+JwhXOD8dCnNCiKNbvrYizzAYt0edysarG4WAtpf5p5DmHSoQVmGj7FB9HbZQ0WOTUu8GzQD0tdq1LNEsBibG6cSMvCAkIo6Rng7sk8eia3ikl/otd+rgZO6GjxRESrfgt6yC9mBHb35NwJG0lbXI/U4xqODIjg+aS/J30OWzyE94Xu9UBjzLSSWGbArPs6aTF/l+aBecpj4ZY7VYngeJsqljTaoEjuWup9pa9xtxCd9A18Y2/fXopbh2y7zs2+S6pvtvBjCzEf62WoFZs48JAjOK1ygyMGAI1fO+c80+YiZRC87voZhZWHrMhoKs4ZnGl9SZmD+VF49ZCW/xd4c7xwNy2mCr1d9jLsKLLzPYdVi7MXybNMzI9XuAY99of3iXadJbhAonAUPBX0Yu5BdEWOVZn76F6A3ZgOZLTH8nvCswZ+MSI4hFsYhq2NOUh35i1UEobsXH6CGhSwFWW0UZv9m5TrPfJlYzAnI6aBd8hkwUpyvP0pBmWgp+ST07YDcNiMhKG1n5JZpGAbSnH070nVmkYXWrXA3VJgBXt7mT3S/DD9DRbpdjVTjKqCduLHrdObJP45mzBcgnVkS53Qa/1541UVzilrfJywXsad3UWXgyfrnbr3uRCarpDqLo76NcC8JH8HElAsr2MoneiJY5ZJ9G4dUyesyEB+g1F3vhR3vvj4Z/vXCSTauexFQm6BUOndM3TGW/kLJZZ0qPYOr4mTXgX2iC6Hc0DB1/CrYFeac9stAtqctqkby6+SqJR8hK2R6n42bAmsCNEtIEZlfQSLCd/qYXEj6FZT8bzuVnhxj6ZS5ID4niAU67atFUWoRhTviJ+KaMXWvw5+LDh4Dr0psMlwxsubI0oenec/UNnnQ5ga6s6QZLqiRkIn5beuD5qjAURXqDv5s0344Wc5E+QN/l4I924r+6CvLxwNZ5Sg4UBuc/kfbpDDKf4jvGyO7nr4mtT/wwswhDai2Xc2clcpzTwjnM1vPTptz8mYGZ/2GVlIQiV7GvdU2puwnsfqCV24xBbW7krnU1sHp/ZYvHIvx2KBWuctoQo3CZebW6HI+PAz2dc+fCRXfZO238zQ60G9ESo/bZccPgr/wf8Br0UH/4utQ2l3M5v30TW+o6MznirtNjRioVg4ypMmbsnlyJ+SQPLBSzCBiqWcxS4JTx5umThozIrHKVs65BgDJV5B21P/TpIgN9TDMF3vgk5ad3utdTLMpWjSVSTrwoABY0TQe8F+6n/nhUzAMCE1iN5hZJQya5ESL8f58fuSp X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 80af52b2-d7e0-4ccc-f174-08d8cf279aa3 X-MS-Exchange-CrossTenant-AuthSource: BN8PR10MB3570.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Feb 2021 07:27:08.1482 (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: A4PNm+/nqIbBEOtEL+EfUvWO/R09nSNqEl6nSHdPhPJH6eZP35iwTOnxV+IoLHi3IG0W8emOUrU9lmIO5gCSx5FtlzgB3GGFTycmYKxEgsE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN0PR10MB5254 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9892 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 adultscore=0 mlxlogscore=999 malwarescore=0 bulkscore=0 phishscore=0 spamscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102120053 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9892 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 mlxlogscore=999 bulkscore=0 suspectscore=0 phishscore=0 adultscore=0 impostorscore=0 mlxscore=0 clxscore=1015 lowpriorityscore=0 malwarescore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102120053 Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org tcm_loop could be used like a normal block device, so we can't use GFP_KERNEL. This adds a gfp_t arg to target_cmd_init_cdb and covnerts the users. For every driver but loop I kept GFP_KERNEL. For loop and xcopy I switched to GFP_NOIO. This will also be useful in the later patches where loop needs to do target_submit_prep from interrupt context to get a ref to the se_device, and so it will need to use GFP_ATOMIC. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig --- drivers/infiniband/ulp/srpt/ib_srpt.c | 3 ++- drivers/scsi/qla2xxx/tcm_qla2xxx.c | 3 ++- drivers/target/iscsi/iscsi_target.c | 3 ++- drivers/target/loopback/tcm_loop.c | 3 ++- drivers/target/target_core_transport.c | 13 +++++++------ drivers/target/target_core_xcopy.c | 2 +- drivers/target/tcm_fc/tfc_cmd.c | 2 +- drivers/vhost/scsi.c | 2 +- drivers/xen/xen-scsiback.c | 2 +- include/target/target_core_fabric.h | 5 +++-- 10 files changed, 22 insertions(+), 16 deletions(-) diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c index 87741e0b4bca..51c386a215f5 100644 --- a/drivers/infiniband/ulp/srpt/ib_srpt.c +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c @@ -1537,7 +1537,8 @@ static void srpt_handle_cmd(struct srpt_rdma_ch *ch, goto busy; } - if (target_submit_prep(cmd, srp_cmd->cdb, sg, sg_cnt, NULL, 0, NULL, 0)) + if (target_submit_prep(cmd, srp_cmd->cdb, sg, sg_cnt, NULL, 0, NULL, 0, + GFP_KERNEL)) return; target_submit(cmd); diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c b/drivers/scsi/qla2xxx/tcm_qla2xxx.c index 56394d901791..12a2265eb2de 100644 --- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c +++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c @@ -492,7 +492,8 @@ static int tcm_qla2xxx_handle_cmd(scsi_qla_host_t *vha, struct qla_tgt_cmd *cmd, if (rc) return rc; - if (target_submit_prep(se_cmd, cdb, NULL, 0, NULL, 0, NULL, 0)) + if (target_submit_prep(se_cmd, cdb, NULL, 0, NULL, 0, NULL, 0, + GFP_KERNEL)) return 0; target_submit(se_cmd); diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c index f2107705f2ea..566adfde1661 100644 --- a/drivers/target/iscsi/iscsi_target.c +++ b/drivers/target/iscsi/iscsi_target.c @@ -1166,7 +1166,8 @@ int iscsit_setup_scsi_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd, target_get_sess_cmd(&cmd->se_cmd, true); - cmd->sense_reason = target_cmd_init_cdb(&cmd->se_cmd, hdr->cdb); + cmd->sense_reason = target_cmd_init_cdb(&cmd->se_cmd, hdr->cdb, + GFP_KERNEL); if (cmd->sense_reason) { if (cmd->sense_reason == TCM_OUT_OF_RESOURCES) { return iscsit_add_reject_cmd(cmd, diff --git a/drivers/target/loopback/tcm_loop.c b/drivers/target/loopback/tcm_loop.c index 461f4125fcab..677e4b8f0642 100644 --- a/drivers/target/loopback/tcm_loop.c +++ b/drivers/target/loopback/tcm_loop.c @@ -156,7 +156,8 @@ static void tcm_loop_submission_work(struct work_struct *work) if (target_submit_prep(se_cmd, sc->cmnd, scsi_sglist(sc), scsi_sg_count(sc), sgl_bidi, sgl_bidi_count, - scsi_prot_sglist(sc), scsi_prot_sg_count(sc))) + scsi_prot_sglist(sc), scsi_prot_sg_count(sc), + GFP_NOIO)) return; target_submit(se_cmd); diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index ad30a99a5cb2..4723cc6abf61 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@ -1427,7 +1427,7 @@ transport_check_alloc_task_attr(struct se_cmd *cmd) } sense_reason_t -target_cmd_init_cdb(struct se_cmd *cmd, unsigned char *cdb) +target_cmd_init_cdb(struct se_cmd *cmd, unsigned char *cdb, gfp_t gfp) { sense_reason_t ret; @@ -1448,8 +1448,7 @@ target_cmd_init_cdb(struct se_cmd *cmd, unsigned char *cdb) * setup the pointer from __t_task_cdb to t_task_cdb. */ if (scsi_command_size(cdb) > sizeof(cmd->__t_task_cdb)) { - cmd->t_task_cdb = kzalloc(scsi_command_size(cdb), - GFP_KERNEL); + cmd->t_task_cdb = kzalloc(scsi_command_size(cdb), gfp); if (!cmd->t_task_cdb) { pr_err("Unable to allocate cmd->t_task_cdb" " %u > sizeof(cmd->__t_task_cdb): %lu ops\n", @@ -1638,6 +1637,7 @@ EXPORT_SYMBOL_GPL(target_init_cmd); * @sgl_bidi_count: scatterlist count for bidirectional READ mapping * @sgl_prot: struct scatterlist memory protection information * @sgl_prot_count: scatterlist count for protection information + * @gfp_t: gfp allocation type * * Returns: * - less than zero to signal failure. @@ -1648,11 +1648,12 @@ EXPORT_SYMBOL_GPL(target_init_cmd); int target_submit_prep(struct se_cmd *se_cmd, unsigned char *cdb, struct scatterlist *sgl, u32 sgl_count, struct scatterlist *sgl_bidi, u32 sgl_bidi_count, - struct scatterlist *sgl_prot, u32 sgl_prot_count) + struct scatterlist *sgl_prot, u32 sgl_prot_count, + gfp_t gfp) { sense_reason_t rc; - rc = target_cmd_init_cdb(se_cmd, cdb); + rc = target_cmd_init_cdb(se_cmd, cdb, gfp); if (rc) goto send_cc_direct; @@ -1782,7 +1783,7 @@ void target_submit_cmd(struct se_cmd *se_cmd, struct se_session *se_sess, { target_init_cmd(se_cmd, se_sess, sense, unpacked_lun, data_length, task_attr, data_dir, flags); - target_submit_prep(se_cmd, cdb, NULL, 0, NULL, 0, NULL, 0); + target_submit_prep(se_cmd, cdb, NULL, 0, NULL, 0, NULL, 0, GFP_KERNEL); target_submit(se_cmd); } EXPORT_SYMBOL(target_submit_cmd); diff --git a/drivers/target/target_core_xcopy.c b/drivers/target/target_core_xcopy.c index e86cc6135587..d31ed071cb08 100644 --- a/drivers/target/target_core_xcopy.c +++ b/drivers/target/target_core_xcopy.c @@ -554,7 +554,7 @@ static int target_xcopy_setup_pt_cmd( } cmd->se_cmd_flags |= SCF_SE_LUN_CMD; - if (target_cmd_init_cdb(cmd, cdb)) + if (target_cmd_init_cdb(cmd, cdb, GFP_KERNEL)) return -EINVAL; cmd->tag = 0; diff --git a/drivers/target/tcm_fc/tfc_cmd.c b/drivers/target/tcm_fc/tfc_cmd.c index 1376501ee3d0..410b723f9d79 100644 --- a/drivers/target/tcm_fc/tfc_cmd.c +++ b/drivers/target/tcm_fc/tfc_cmd.c @@ -555,7 +555,7 @@ static void ft_send_work(struct work_struct *work) goto err; if (target_submit_prep(&cmd->se_cmd, fcp->fc_cdb, NULL, 0, NULL, 0, - NULL, 0)) + NULL, 0, GFP_KERNEL)) return; target_submit(&cmd->se_cmd); diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c index 76508d408bb3..93f5631b469c 100644 --- a/drivers/vhost/scsi.c +++ b/drivers/vhost/scsi.c @@ -811,7 +811,7 @@ static void vhost_scsi_submission_work(struct work_struct *work) if (target_submit_prep(se_cmd, cmd->tvc_cdb, sg_ptr, cmd->tvc_sgl_count, NULL, 0, sg_prot_ptr, - cmd->tvc_prot_sgl_count)) + cmd->tvc_prot_sgl_count, GFP_KERNEL)) return; target_submit(se_cmd); diff --git a/drivers/xen/xen-scsiback.c b/drivers/xen/xen-scsiback.c index 7bf9a6bede6d..eb3d8e35cbcd 100644 --- a/drivers/xen/xen-scsiback.c +++ b/drivers/xen/xen-scsiback.c @@ -368,7 +368,7 @@ static void scsiback_cmd_exec(struct vscsibk_pend *pending_req) pending_req->sc_data_direction, TARGET_SCF_ACK_KREF); if (target_submit_prep(se_cmd, pending_req->cmnd, pending_req->sgl, - pending_req->n_sg, NULL, 0, NULL, 0)) + pending_req->n_sg, NULL, 0, NULL, 0, GFP_KERNEL)) return; target_submit(se_cmd); diff --git a/include/target/target_core_fabric.h b/include/target/target_core_fabric.h index 86b0d4a7df92..0543ab107723 100644 --- a/include/target/target_core_fabric.h +++ b/include/target/target_core_fabric.h @@ -157,10 +157,11 @@ int target_init_cmd(struct se_cmd *se_cmd, struct se_session *se_sess, int target_submit_prep(struct se_cmd *se_cmd, unsigned char *cdb, struct scatterlist *sgl, u32 sgl_count, struct scatterlist *sgl_bidi, u32 sgl_bidi_count, - struct scatterlist *sgl_prot, u32 sgl_prot_count); + struct scatterlist *sgl_prot, u32 sgl_prot_count, gfp_t gfp); void target_submit(struct se_cmd *se_cmd); sense_reason_t transport_lookup_cmd_lun(struct se_cmd *); -sense_reason_t target_cmd_init_cdb(struct se_cmd *, unsigned char *); +sense_reason_t target_cmd_init_cdb(struct se_cmd *se_cmd, unsigned char *cdb, + gfp_t gfp); sense_reason_t target_cmd_parse_cdb(struct se_cmd *); void target_submit_cmd(struct se_cmd *, struct se_session *, unsigned char *, unsigned char *, u64, u32, int, int, int); From patchwork Fri Feb 12 07:26:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 12084853 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D9DA9C433E0 for ; Fri, 12 Feb 2021 07:32:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AA24464E57 for ; Fri, 12 Feb 2021 07:32:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229939AbhBLHbz (ORCPT ); Fri, 12 Feb 2021 02:31:55 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:59912 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229918AbhBLHaD (ORCPT ); Fri, 12 Feb 2021 02:30:03 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11C7Ounu170946; Fri, 12 Feb 2021 07:27:12 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=x3Ewt12IExJayKPDZZ4tEdHTL6r2juFdsMgtEah1atQ=; b=vnw9SItCIHtwI036uYrcRz8wI/KaFrtInltKR3WXPYWHiNr9Pr7upeGJp9LLOO9BrBOb R9X3bhqaxwp5kU1xUGHrrUaN1UcuhZm8p4pjiPDElu34eG66uKF79XtsiIVUf0HvJQP7 SyejLc1d7+RLTRvxvZX78/VqyhqUIP1kXlKqjnFpAgRmkcDdYEe7G5iFn3n6ja04A29W w5cwu7oeOZw0fUHhaCNQefIQcMv/R6jbB1Ofp1Ks8VR2P2+M8dl7rEvNWQOg4DAT9wSL fms3kmTQQAa4jcTKq3dnaTawGh4C6olz77cUnSxk3zVLp+KqcnJJB3f8cADUvtHGxFoj zQ== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2120.oracle.com with ESMTP id 36hkrna559-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Feb 2021 07:27:11 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11C7Q9BU090048; Fri, 12 Feb 2021 07:27:11 GMT Received: from nam04-mw2-obe.outbound.protection.outlook.com (mail-mw2nam08lp2173.outbound.protection.outlook.com [104.47.73.173]) by aserp3030.oracle.com with ESMTP id 36j4psn5st-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Feb 2021 07:27:10 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=naEbuHQtUc/SO049MqnLm39RtjsgLB/9NhHvwrtnIVh9Xj4GFQzM7TULEzI1oRSKeI2pt7QWuEXHSC0ux8/nIGtvGv3gyAQYPr19eS6p+RU8K+mu+x6KfiEF38PFO90jf5Mdzl1NF/oVD231pquc7HrKDErOwAMQEbrQG2Wy0eM3T4zbDzD59pISRG8HJFJwAythpRXqK61/mx17ZgH9B22AV2OK+Aomb1e1TVAMjhKJ5adNbgz9vtRW95WfrEFzm9zMhweDrWSgtBtjdGrHSl+kD3z2twKwCNOU66SZP4mqeeN62YXfEVUkd66REn8ax962KwBSBW6BPTsjm8mfkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=x3Ewt12IExJayKPDZZ4tEdHTL6r2juFdsMgtEah1atQ=; b=BjtqrjjHx7Il7ADZLKUAMm6/8iY0WC5GhwoSkN54h62WO7vWkCfPkHlp2tP/yttLyUGAPS5BFIIWytWx1WiS2PZYJK6Sxcr3chzXJtVBsp3+c7NyQM5sQAfD9xbvdqKTQz0YPZCrn84Y2um9G3ni+mduVY1/DzW7E3s6tckuxn1OlKLkr/Hl+VTDEsUd4lAFgIqlL4Dynhh8I9Z4p26tAptLSDuu13xLeyRGJSmSaXfCzDg6pELeqP4aGv/CiSpPi9vU9rfVXIcKNbJS0wB2EyyV85FEmpTUOtB64oYdi+eqC7J6w3Zf51gJ/nvxHXMPUkZ7TBiIoc/pYRunWCnIbQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=x3Ewt12IExJayKPDZZ4tEdHTL6r2juFdsMgtEah1atQ=; b=SmT9zYcmJ6/FqviiBL6lHyYTsKPrQbt5uaJH7PtszV98wW2OlPjFtnBpYtgMua2y/4ILxiasjHd0aLCf/cOCdsIRWCCyP9KkBvlI1oXVeKSSBx4PKiJFfIFOEzKmXAHnNLlFY5huToxA9V8kV8UJBCbcruX+RBqmUIpzJ0wypLs= Authentication-Results: redhat.com; dkim=none (message not signed) header.d=none;redhat.com; dmarc=none action=none header.from=oracle.com; Received: from BN8PR10MB3570.namprd10.prod.outlook.com (2603:10b6:408:ae::12) by BN0PR10MB5254.namprd10.prod.outlook.com (2603:10b6:408:12f::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.25; Fri, 12 Feb 2021 07:27:09 +0000 Received: from BN8PR10MB3570.namprd10.prod.outlook.com ([fe80::513a:2259:52d5:e495]) by BN8PR10MB3570.namprd10.prod.outlook.com ([fe80::513a:2259:52d5:e495%4]) with mapi id 15.20.3846.027; Fri, 12 Feb 2021 07:27:09 +0000 From: Mike Christie To: mst@redhat.com, stefanha@redhat.com, Chaitanya.Kulkarni@wdc.com, hch@lst.de, loberman@redhat.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org Cc: Mike Christie Subject: [PATCH 16/25] target: add workqueue based cmd submission Date: Fri, 12 Feb 2021 01:26:33 -0600 Message-Id: <20210212072642.17520-17-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210212072642.17520-1-michael.christie@oracle.com> References: <20210212072642.17520-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: CH2PR14CA0050.namprd14.prod.outlook.com (2603:10b6:610:56::30) To BN8PR10MB3570.namprd10.prod.outlook.com (2603:10b6:408:ae::12) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by CH2PR14CA0050.namprd14.prod.outlook.com (2603:10b6:610:56::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.27 via Frontend Transport; Fri, 12 Feb 2021 07:27:08 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8e362ae6-faf6-4ad4-f216-08d8cf279b51 X-MS-TrafficTypeDiagnostic: BN0PR10MB5254: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5516; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: O03mQklX0nXZcKCv8It5FmBRnb4qmTJEPPCKvrJ9ZxWcA/omh+CgzT9CeqKNMQjZbrMq6M3u8t3mIJjcxGiA8YHDZbjnnr8+8mERkFazIro4J1Kpfnm07WrbapEVz9VWdmNp44kWnT1yLYf0zWmJNgXM6cPk3eo41WpW90svBL1L6lQBdoNGYx1yNaXjIioEBstfLHrw2QqzxT3bERv+BuRWvg4RXelcTVv8q7xSx1RN0gxqMCzcA4kS+0GQ8SIc61tiRRvAN/sdON8Kj2jj8N1UA7DdE1u5JdKTwkuxfc14CwzJz53iLecJhtMo8D/jfnVu60De1xwJjnM0pg0qVRYy1OIGK0rWoFVSh+2ffLdMy1pvFaYdCDj7j72QBCwRmbaYU+HMa9diQ3DKiP0oDqPzy/mu2RZq92/XscFqRRnEelUI3dRQDl/6gj5om+tXKJ6daXjvKW6wGXywJtjS/eE4MxhSWaoKjt9+I39de82ev1g5LZ+09w3r9yKoUgw+W8TVKFP7mFsc4w5N0V0IzifEXRpUL7AuWRNmKdTtL6B31X1T7jJfqxPRuaM9MX1BD43rwJnCrbgF9jtVkzf2tQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN8PR10MB3570.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(396003)(39860400002)(346002)(136003)(366004)(376002)(8676002)(2616005)(4326008)(316002)(8936002)(6512007)(66476007)(16526019)(107886003)(26005)(956004)(6666004)(69590400011)(186003)(83380400001)(36756003)(5660300002)(52116002)(1076003)(66556008)(478600001)(66946007)(86362001)(6506007)(2906002)(6486002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: bvKWDeAaR9vLo/kPCr57faAuuSs4X7/mXGwnFmG3tdYtJtXesqCYAnAkD4rlk+iOsUITNqIeGCUPCFdTUft3oK+OTApaW5KZORkKhmm84pHk/WMcDc+v0B6g6dBcGrNStdjCmGa+W78MBdz03f5xm+1B4gPkqEM2rcQ2GVSjolg6MxUgkueofRTsvfFwMj/nqkl1Ttufzn/1JqOV9AetDBIzLETAAgcd1prCvjTRAql2L1W2rGBoNleYc9HU8lhMy94uRtOXwkJMzNSkeYxYBbQY4uLA2PN+aw6+peHR5/kw3HLEf2SwXfF9loYiIh/jnCx4ftLAm8fxRfXgw056LtnGFxCk+MsSaBBYM6hXZsTt7WCiFPg9ex7dWVpfBzhn8tH4qfTw0eUOOch/tFjUp6eBe3ZvoLrbC+69ayUo3pB+JONTNB6rdhXvtd/78GJ/PRJ8/akNUoW2WyvNqpB9mrcBwy79vc8aEpwzT0ewMa9PgN77vwLEd9NDPvYoiB5S3zVd5b0ZnhkGgBLhqg4c71VZ72L5n95SVx8QU164PtA0UcBJneo7DNLJlV5fSNzZWVsc3T2Cl2ONwZVjmYtMK8SF5ie0wi/lBJXA+YUGmurlBcX/Ao80ww1ZFd+shJHQE6RtD4SF7hRp8UGEc6QOkCruPnEDQaX3oA5q1bAkQzkQand+8/zBsDNk3w8SChXLzLaawJDg+zEOODttY2dw79wx4FgNBazcXAZSCgwC4R1QWWzPzKh0dW9mLDlRzBJj1umiXwgvbKu2MnvCUi+1irMXZ3GnN5NsWSR1mgEXaFiFzvp08u5OtFbQMhxwiGaeaqwstqH4EWUTZ7VkmXXKUtgnZDK8aHxgRgPdWt99q+sSq+jUHhb//dIzccRvMjPc5ZgBH6bFQI6fNHjKuR2E0/j5W+Tdqzk1aTxzVziUn1W2186/nUAI2Qkh8uXZ3ozsCwut59BuMT0O+M9PcQsL5v1vuVWqBjWLifI7VDl7pl9Tz8Ch9AolfSg8+pVT53X5mvGLszhoFdNeaXqQkRSaJsxcnpiGCJFTE8kB7MuGge+fLRpl2rBSMHU1GLUaoNkCLgQHzpHrYgmLXbTb+KO/+5NVO17bXp2L+1CvfHNFSUyqp/5lVMVFU9OvNBRYKN/sqlYDny6oQ/mAlmLN3+Ug3ujGbtJbuSaJMpxwh5jsm7kAuS58gDKgu688awbsVzowc7D/8TO37+yZquS2GETHgcBgYj4Q5Jc1TGufaIT4yHs1rKhdURFdDhZsSDCrp6iEQk0vERwxw3C6qJCFHdRARbw/OF6eTQYdxaA5+GUP9i8aJ6n+h8gucJ//wURR73Q+ X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8e362ae6-faf6-4ad4-f216-08d8cf279b51 X-MS-Exchange-CrossTenant-AuthSource: BN8PR10MB3570.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Feb 2021 07:27:09.1197 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 30FUW0kha3r25sqiqJecw/eVInf9NyULNeaEIRjY2LjduLBZkLxFMm8posKj8kYQw9S7KJMi3Dc/zweCVM+WdRjXQzKcjO/4uIeY+abuXX0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN0PR10MB5254 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9892 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 adultscore=0 mlxlogscore=999 malwarescore=0 bulkscore=0 phishscore=0 spamscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102120053 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9892 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 malwarescore=0 priorityscore=1501 bulkscore=0 spamscore=0 impostorscore=0 mlxscore=0 suspectscore=0 mlxlogscore=999 adultscore=0 clxscore=1015 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102120053 Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org loop and vhost-scsi do their target cmd submission from driver workqueues. This allows them to avoid an issue where the backend may block waiting for resources like tags/requests, mem/locks, etc and that ends up blocking their entire submission path and for the case of vhost-scsi both the submission and completion path. This patch adds a helper drivers can use to submit from a lio workqueue. This code will then be extended in the next patches to fix the plugging of backend devices. Note: I'm only converting vhost/loop initially, but the workqueue based submission will work for other drivers and have similar benefits where the main target loops will not end up blocking one some backend resource. I'll port others when I have more time to test as I think we might want to make it configurable for some drivers. Signed-off-by: Mike Christie --- drivers/target/target_core_device.c | 10 ++++-- drivers/target/target_core_internal.h | 1 + drivers/target/target_core_transport.c | 42 +++++++++++++++++++++++++- include/target/target_core_base.h | 8 ++++- include/target/target_core_fabric.h | 2 ++ 5 files changed, 59 insertions(+), 4 deletions(-) diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c index 7787c527aad3..74d3a4896588 100644 --- a/drivers/target/target_core_device.c +++ b/drivers/target/target_core_device.c @@ -735,8 +735,14 @@ struct se_device *target_alloc_device(struct se_hba *hba, const char *name) dev->queue_cnt = nr_cpu_ids; for (i = 0; i < dev->queue_cnt; i++) { - INIT_LIST_HEAD(&dev->queues[i].state_list); - spin_lock_init(&dev->queues[i].lock); + struct se_device_queue *q; + + q = &dev->queues[i]; + INIT_LIST_HEAD(&q->state_list); + spin_lock_init(&q->lock); + + init_llist_head(&q->sq.cmd_list); + INIT_WORK(&q->sq.work, target_queued_submit_work); } dev->se_hba = hba; diff --git a/drivers/target/target_core_internal.h b/drivers/target/target_core_internal.h index e7b3c6e5d574..56f841fd7f04 100644 --- a/drivers/target/target_core_internal.h +++ b/drivers/target/target_core_internal.h @@ -153,6 +153,7 @@ void target_qf_do_work(struct work_struct *work); bool target_check_wce(struct se_device *dev); bool target_check_fua(struct se_device *dev); void __target_execute_cmd(struct se_cmd *, bool); +void target_queued_submit_work(struct work_struct *work); /* target_core_stat.c */ void target_stat_setup_dev_default_groups(struct se_device *); diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index 4723cc6abf61..d782d3a0f9d5 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@ -41,6 +41,7 @@ #include static struct workqueue_struct *target_completion_wq; +static struct workqueue_struct *target_submission_wq; static struct kmem_cache *se_sess_cache; struct kmem_cache *se_ua_cache; struct kmem_cache *t10_pr_reg_cache; @@ -129,8 +130,15 @@ int init_se_kmem_caches(void) if (!target_completion_wq) goto out_free_lba_map_mem_cache; + target_submission_wq = alloc_workqueue("target_submission", + WQ_MEM_RECLAIM, 0); + if (!target_submission_wq) + goto out_free_completion_wq; + return 0; +out_free_completion_wq: + destroy_workqueue(target_completion_wq); out_free_lba_map_mem_cache: kmem_cache_destroy(t10_alua_lba_map_mem_cache); out_free_lba_map_cache: @@ -153,6 +161,7 @@ int init_se_kmem_caches(void) void release_se_kmem_caches(void) { + destroy_workqueue(target_submission_wq); destroy_workqueue(target_completion_wq); kmem_cache_destroy(se_sess_cache); kmem_cache_destroy(se_ua_cache); @@ -1380,7 +1389,6 @@ void __target_init_cmd( { INIT_LIST_HEAD(&cmd->se_delayed_node); INIT_LIST_HEAD(&cmd->se_qf_node); - INIT_LIST_HEAD(&cmd->se_cmd_list); INIT_LIST_HEAD(&cmd->state_list); init_completion(&cmd->t_transport_stop_comp); cmd->free_compl = NULL; @@ -1788,6 +1796,38 @@ void target_submit_cmd(struct se_cmd *se_cmd, struct se_session *se_sess, } EXPORT_SYMBOL(target_submit_cmd); +void target_queued_submit_work(struct work_struct *work) +{ + struct se_cmd_queue *sq = container_of(work, struct se_cmd_queue, work); + struct se_cmd *se_cmd, *next_cmd; + struct llist_node *cmd_list; + + cmd_list = llist_del_all(&sq->cmd_list); + if (!cmd_list) + /* Previous call took what we were queued to submit */ + return; + + cmd_list = llist_reverse_order(cmd_list); + llist_for_each_entry_safe(se_cmd, next_cmd, cmd_list, se_cmd_list) + target_submit(se_cmd); +} + +/** + * target_queue_submission - queue the cmd to run on the LIO workqueue + * @se_cmd: command descriptor to submit + */ +void target_queue_submission(struct se_cmd *se_cmd) +{ + struct se_device *se_dev = se_cmd->se_dev; + int cpu = se_cmd->cpuid; + struct se_cmd_queue *sq; + + sq = &se_dev->queues[cpu].sq; + llist_add(&se_cmd->se_cmd_list, &sq->cmd_list); + queue_work_on(cpu, target_submission_wq, &sq->work); +} +EXPORT_SYMBOL_GPL(target_queue_submission); + static void target_complete_tmr_failure(struct work_struct *work) { struct se_cmd *se_cmd = container_of(work, struct se_cmd, work); diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h index 63dd12124139..815de4c97230 100644 --- a/include/target/target_core_base.h +++ b/include/target/target_core_base.h @@ -487,7 +487,7 @@ struct se_cmd { /* Only used for internal passthrough and legacy TCM fabric modules */ struct se_session *se_sess; struct se_tmr_req *se_tmr_req; - struct list_head se_cmd_list; + struct llist_node se_cmd_list; struct completion *free_compl; struct completion *abrt_compl; const struct target_core_fabric_ops *se_tfo; @@ -764,9 +764,15 @@ struct se_dev_stat_grps { struct config_group scsi_lu_group; }; +struct se_cmd_queue { + struct llist_head cmd_list; + struct work_struct work; +}; + struct se_device_queue { struct list_head state_list; spinlock_t lock; + struct se_cmd_queue sq; }; struct se_device { diff --git a/include/target/target_core_fabric.h b/include/target/target_core_fabric.h index 0543ab107723..3c5ade7a04a6 100644 --- a/include/target/target_core_fabric.h +++ b/include/target/target_core_fabric.h @@ -165,6 +165,8 @@ sense_reason_t target_cmd_init_cdb(struct se_cmd *se_cmd, unsigned char *cdb, sense_reason_t target_cmd_parse_cdb(struct se_cmd *); void target_submit_cmd(struct se_cmd *, struct se_session *, unsigned char *, unsigned char *, u64, u32, int, int, int); +void target_queue_submission(struct se_cmd *se_cmd); + int target_submit_tmr(struct se_cmd *se_cmd, struct se_session *se_sess, unsigned char *sense, u64 unpacked_lun, void *fabric_tmr_ptr, unsigned char tm_type, From patchwork Fri Feb 12 07:26:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 12084807 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BFFD6C433DB for ; Fri, 12 Feb 2021 07:31:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9828664E39 for ; Fri, 12 Feb 2021 07:31:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229719AbhBLHbk (ORCPT ); Fri, 12 Feb 2021 02:31:40 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:60586 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229908AbhBLHaA (ORCPT ); Fri, 12 Feb 2021 02:30:00 -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 11C7Ov9A176822; Fri, 12 Feb 2021 07:27:12 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=C8+cdTPDKRcoXR+WyGc/w4I0aeNtYx+XJrKdZwce5U8=; b=eA3ZUp2qc9ay06W6xWlyirSLLAWYF04J27CmEGbS0NQGGwZLy306FKnISrQTCL3k5gND TWlR6wwTd2PU7MpG6uXztST73KhvyXmja5l1Nc0J6UH2HQooepqqyL+RFICjDurKOEGt g0zKDFs6YbKpAtIrjvq10L2SKAK4fvQfHWug9/I8vM2M/pud0XTDQ03KxG8z4m5UqlRF wajlm6QNYB71lfgtdmUGMjshS8Xb29tTWeK7AFI7K2yNvUk02jbS/GXSQtJHxCCQyYvA 3of1JmqGC8NvKc6+ponddyBsqogLzkR7KT0xZAmFAzr7f8WW4oAC0C62B8mrnXotEmqw YQ== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by aserp2130.oracle.com with ESMTP id 36hgmataw8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Feb 2021 07:27:12 +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 11C7Q9BV090048; Fri, 12 Feb 2021 07:27:11 GMT Received: from nam04-mw2-obe.outbound.protection.outlook.com (mail-mw2nam08lp2173.outbound.protection.outlook.com [104.47.73.173]) by aserp3030.oracle.com with ESMTP id 36j4psn5st-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Feb 2021 07:27:11 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nscgNV93LqgrZTJmR/do4tg4A695e7k2YRxgm2Mc5h8/uV3Y5tggnOudYY8ZplAosLqNDvsottDwQuGBEi9txJcTCc/OrCy0AUan0BttWx738cBAHPMud4sCAfwPjI+OfivniCrPKRmjm25k/QiJsPJGb4RVpJfiIe2maDoWff+5UlzSZHZMwOGKk9ZOcQq5c5KHkjLdwZAABJ8Nio7drZOfiKOQHoZl113owXrwPL2L+Hnu0j0X7u2iRz9TewuyOvYtZ2/VsRDA5p8/FdB+cyJcBrDHbB6z8RV+sYHO4Y6QaQuYGn2tcDZi3TYBjpF2UdgKcP8EvIRp9KQq+6oBGA== 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=C8+cdTPDKRcoXR+WyGc/w4I0aeNtYx+XJrKdZwce5U8=; b=fYGcY7PL7t2PL6K9NgCOQ9KqmaQhrmhAyC76oPWQ5cFnQJeWwiqUmqIThrHjJvf142hDs1opAyIQN4eiG1Q+XLBjlCf2YceE5zuqDLdeSaMlo+G9lIprhQJ+3Wez2H4psRtsd7wi34nODQyO8GtQKCjOeDfounn49UEE8ChWqZM3l5Ai3KFemLBLJZ/AQNT4NP7H4i7rqQtEeGSQ+5p6C/NP6S7oJjkEf+5igJuVoHNmFKjA7PAHdZ6NUiDvIPKtHWPL2bX6PSye6cPQ4bZIXZmxLSGPdIgCKpgyF6rr+U33uXgCfXF1X52+zY/9g3WyIy/JynDaYflIuTSEDbnTUA== 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=C8+cdTPDKRcoXR+WyGc/w4I0aeNtYx+XJrKdZwce5U8=; b=D1gvzbfCim9npFXReuegWz5cZ/dQB3oz6G+86FpW155Rzi/Rs+DFqxPGI27woM18DZKMSSfzBjZUnf/nDmaeht5njaXksA7XiWzglg4CDDdlxfM6ibCITvsv9a4tA410JZObJ2a31u+w+CHUrKasUjc9QL6nGqL64RUIz49MXso= Authentication-Results: redhat.com; dkim=none (message not signed) header.d=none;redhat.com; dmarc=none action=none header.from=oracle.com; Received: from BN8PR10MB3570.namprd10.prod.outlook.com (2603:10b6:408:ae::12) by BN0PR10MB5254.namprd10.prod.outlook.com (2603:10b6:408:12f::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.25; Fri, 12 Feb 2021 07:27:10 +0000 Received: from BN8PR10MB3570.namprd10.prod.outlook.com ([fe80::513a:2259:52d5:e495]) by BN8PR10MB3570.namprd10.prod.outlook.com ([fe80::513a:2259:52d5:e495%4]) with mapi id 15.20.3846.027; Fri, 12 Feb 2021 07:27:10 +0000 From: Mike Christie To: mst@redhat.com, stefanha@redhat.com, Chaitanya.Kulkarni@wdc.com, hch@lst.de, loberman@redhat.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org Cc: Mike Christie Subject: [PATCH 17/25] vhost scsi: use lio wq cmd submission helper Date: Fri, 12 Feb 2021 01:26:34 -0600 Message-Id: <20210212072642.17520-18-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210212072642.17520-1-michael.christie@oracle.com> References: <20210212072642.17520-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: CH2PR14CA0050.namprd14.prod.outlook.com (2603:10b6:610:56::30) To BN8PR10MB3570.namprd10.prod.outlook.com (2603:10b6:408:ae::12) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by CH2PR14CA0050.namprd14.prod.outlook.com (2603:10b6:610:56::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.27 via Frontend Transport; Fri, 12 Feb 2021 07:27:09 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 135a3ca7-0d8f-4e42-2888-08d8cf279be8 X-MS-TrafficTypeDiagnostic: BN0PR10MB5254: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ARYsssfHnsk2UWdntGZ8Bm8mqQnB3LpfTSzADOOMdzYeqy5kdLBsiO11J8aJtMz1U7dGAkK5NLF1/KMAzCWEBzfSKWC/+m6U6DmExxCwNq4edVtxgLvxq0X7DowWjaAk9bv29El6qY/4DnEzJChZwNDCMksjCBugmf34HgDY4oirL/Z/00V2d+ykejoCp+5HrHKBT6ZuzVWFwnN6TJ3lliMz9dc8zwM7qjdaU+WhzYXACri9lo6c2nF/Wp9dFiEuxxGRbjuAagxkFOAm4ZBsYz6643lDcue1JsVI1TtRnxxTY9Z41xt2V7GxU5294jkii88v0GJfybJtkLJuK2cBr4B2FNtP4alirGLMe+PIu5r6WbTH8pz2LVow7EXLC6RgfgyCD4aXewnK0lPwZOLQQBuxvnu4TFPJWn5r1JGafjtH6IwUKMq/OQmu7QqejeTR0JI5AaO2nItDf91YDrhR2sB5aDE2/wSZikQQM2fgwlDfjXx3aP4SgXF5arpXGf7aHuVxfP6q2PhIcVyjLaEr+7LdBhMB+0ogDGB2lD3z5JZ84KZcr7NHcQBTTnECwd9fl+BKu0yGqxIaiRN8b3ByYg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN8PR10MB3570.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(396003)(39860400002)(346002)(136003)(366004)(376002)(8676002)(2616005)(4326008)(316002)(8936002)(6512007)(66476007)(16526019)(107886003)(26005)(956004)(6666004)(69590400011)(186003)(83380400001)(36756003)(5660300002)(52116002)(1076003)(66556008)(478600001)(66946007)(86362001)(6506007)(2906002)(6486002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: SKxq18jC+2RMhBcLAxFwGwA5wZd4jncV5tzP5vqch+kXUiAMr52JVApnhhQ0xvkF5kYhjh5huZTYIO0Cle7C0Fdv7+htk/d7bsGUc2kCxWmBDIsFzOXBpTDJppkeKqUNxz8pu0BcrWEfBSsuja2pn+03yIhcIW+WaCTLR7bvuGfs5YJh80I4bNEEoYtHZxcB9JrFIT1CTERJaNxruGU3PkCY4Sk2KycCza3MdRagnjYjFD4aHEfhHfpX94/oR3stN9nBC74aIDWJ3YmFpu+QvvhtLPW9ht21yJGWzsxc/7jQn3aOn+l5NoukOUGWF8V26UYmxnlAzhkkBcSq4d9OJN8mNkp4RrBt/Jcdj6c4Bpv6POmT9ndK5fFkchJLZeHFeCrwa39ZpV33pFRYKy19l2s7uHPXI9gtBVlgvc+zCGbu1fSFqGCzWHt1uHs+qP+qrcvTfVx9SMlH+OMDi5fa9QFvIkoH72A7uc7L4zsPfK31a9lcG98lbKokXW4ZF7TWzhHHO7FFa7Gc1zGQEgoiEL0/X/7rlGZm5lkyT9vn1FBgJFmtk2cBhFb8LzBcxiTobx0ron8bNPZ6dQz6Km4O7k3ERFtr0bNO1uZYZNuVKXHrqbRiq9J1BRcHhWxj6IU7EYCy1/mqoM6h83YgTSjfSLBwGF/9IW/EbnUBHcjw+SafnANJdNs/qmOwICPWdlLv786zieemm5mMcKrxaovWRjGJPQjUmlh4EIUKCQLymxDlNlST2OqdI3dAhqcHthMcoTD2z4qobDxgLnNJ5SnxtZ+H5L5DoIZe5nKKiIVWD8erhReNs5rkc6Qy1YXkTvMa2ntDmChxJqnZLY5opI7pAi62ELAXzTjTjGDpqFDlDpuzuxTZgcKnAS23IgqfyzEMHokTgz2vNapQxC4KkHPqIoUJ6w0Bv294PROVXAe8skeXnQmSlMox6nvhetAWCd86xzK5bvMsdB+82g4pdKRvqeUVoEtAYt7gzIKWiOzBUr0/dQC6KSqj7rks9RrkJBbGKbdvltZelHAibHrQuLD0JltAXJQnxtMHmZ5D2mYsFlG6gCoNKzj7CCQC576gVkV8+MQFBXl7bJP9hNH+f00D+VHf0Dwf2UplL3elk4Bh7rLa61UsdshBfhR7VutO8M3mNfI9JzFXwI3Zoe9Ipc0bLJLlZ4tPLXrHepIdSEa5tqbbtSl6AfrVVkDccKc9CVpc76o6VKR+E83jzomPP12i+/s8cvNSWv/dSBZtt7TXmXmf/Hp8KseLQIhSECoyZfSNRPXrOYqLZ6fE055I9PUsYvk5sZEy2O+22wD9/2iUP6TxdfknZCUY+Ef8Y/DXF56y X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 135a3ca7-0d8f-4e42-2888-08d8cf279be8 X-MS-Exchange-CrossTenant-AuthSource: BN8PR10MB3570.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Feb 2021 07:27:10.0911 (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: gIqiR8JuUQke4l7Ej1FlHn8eqjOA0HFp9iI4dzD8fPP2lqnd3UrI4yyIg9W5kVMa7ASS0rz0p+TXAuitI/Q72Iy1kEIZtoiVFgTW420WTy4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN0PR10MB5254 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9892 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 adultscore=0 mlxlogscore=999 malwarescore=0 bulkscore=0 phishscore=0 spamscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102120053 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9892 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 spamscore=0 lowpriorityscore=0 phishscore=0 adultscore=0 impostorscore=0 suspectscore=0 mlxscore=0 clxscore=1015 mlxlogscore=999 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102120053 Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org Convert vhost-scsi to use the lio wq cmd submission helper. Signed-off-by: Mike Christie --- V4: MST and Stefan, I dropped your signed off's for this patch because it has changed. It's really close to what you saw before but I was not sure, so do be safe I removed them. 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 Fri Feb 12 07:26:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 12084803 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0264DC4332B for ; Fri, 12 Feb 2021 07:31:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D996B64E39 for ; Fri, 12 Feb 2021 07:31:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229870AbhBLHbH (ORCPT ); Fri, 12 Feb 2021 02:31:07 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:59902 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229912AbhBLHaA (ORCPT ); Fri, 12 Feb 2021 02:30:00 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11C7O1ZA169926; Fri, 12 Feb 2021 07:27:13 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=wYnbMINgEO0lpQsQZ8oqujXyqlQ+qKigdJjFNWv2M7Q=; b=N6JcEPhFcNvK/600pQHAHbe90n52LnBN3lF/7odIa2DybWKwOWyymVthV/musWtxPYJM VYIoYaxUBPXXfnAGlr861WhGJlKWuia9j3A3Xv9+Q358JyRtLW+raatjhfoBAusBJgpv x8J81QnDK8OU64gho0TCCVzb4IB4HNtb935Af6U2PTAstoQSfJ3UI8KXa3wpqXTn0ZUr B5bwFIE1n53jt/nShtJ5BCXD6fCVqDJ69wrtCFJBfelKy9E+xAcWd7HyvmK3YK4+LfvL wyAUYJiMXlFOQ/eBvIpDRFCC1okhp8cO1zut4vsVtIo/ZAAsnoA8UjIVP77TrQe2vPy3 8w== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2120.oracle.com with ESMTP id 36hkrna55b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Feb 2021 07:27:13 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11C7Q9BX090048; Fri, 12 Feb 2021 07:27:12 GMT Received: from nam04-mw2-obe.outbound.protection.outlook.com (mail-mw2nam08lp2173.outbound.protection.outlook.com [104.47.73.173]) by aserp3030.oracle.com with ESMTP id 36j4psn5st-5 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Feb 2021 07:27:12 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kB7U+qPWxLJtfTkRWjG2XxJeAGI2kOBeAjk1rYwE96Io46/tYG9yWpGLRalSrEzdxr5VT9KULFOxhDwrggYO0UanidNzUYoZ20zZy4i5DaRmaWNsmYJuVg8SsxKpLlCjGQ1j4YyXQ91UpiFZ/CB3m2IclTMrWSUit0/cyzpj+MBhKOMqx7Wt9+gW7fyAvVtkFJlICTMq/io6G2O/lkknDwOHCpk7JnaC68PtL79hsKAo5RZKl55nVCdLOCW+SsaCn/5xbH7Jf38d7+afgLH8nzOb1OAj2umGRIvIq0P1Uc8Smr9HkJdDn0ojwE4yXjz+ki/X3BLRX0eO9Q+t3b0sEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wYnbMINgEO0lpQsQZ8oqujXyqlQ+qKigdJjFNWv2M7Q=; b=H3OTP7OCiEFV/7LPSUzBy5y7prqj0Ss6vbnZXKWXnJcDvqLYetYvHHuk+0ZFFYq87vTeUIfYvMWWOG2G/CRxbGVTGMJbI68zHIfCcZ7vK1Pvl7MI/ldsyukUsN1nGPlSeqEAtjSuK0nvkfy1Q0TLpAhtaUf/KCHKZBUCZUIGxHXAZ3XxQCZZw+f2BpXGRQLBynBsIpRgmooR09X3N1W2hKYl/GCM3blZEjTV7G3zNGwvhsS0vYbKpbzOswPa2yWkIpS69ah7/W4a5a0t2ZmVf3YkiB9GYeySC1ieXGiwS5nFQp87eq9onpoir4dw7nefv5UG0UkLcU20OuuBSz3wcg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wYnbMINgEO0lpQsQZ8oqujXyqlQ+qKigdJjFNWv2M7Q=; b=FSJWxBvE1fXEPsr34salXbelIPt7ZkWmjmxJf8oJmByiZVI6kAGFySgLWbQXjF1XLyEtCTrLiXeTHnRQQ4O5/O5i/3TQvYpN6MDrF3gS1Jm9LzhahAaAuERmFT59q5/raL8V+S82cYKjo/DkuSZv0bcUMMnEqWjwcIZjAL4ZJuE= Authentication-Results: redhat.com; dkim=none (message not signed) header.d=none;redhat.com; dmarc=none action=none header.from=oracle.com; Received: from BN8PR10MB3570.namprd10.prod.outlook.com (2603:10b6:408:ae::12) by BN0PR10MB5254.namprd10.prod.outlook.com (2603:10b6:408:12f::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.25; Fri, 12 Feb 2021 07:27:11 +0000 Received: from BN8PR10MB3570.namprd10.prod.outlook.com ([fe80::513a:2259:52d5:e495]) by BN8PR10MB3570.namprd10.prod.outlook.com ([fe80::513a:2259:52d5:e495%4]) with mapi id 15.20.3846.027; Fri, 12 Feb 2021 07:27:11 +0000 From: Mike Christie To: mst@redhat.com, stefanha@redhat.com, Chaitanya.Kulkarni@wdc.com, hch@lst.de, loberman@redhat.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org Cc: Mike Christie Subject: [PATCH 18/25] tcm loop: use blk cmd allocator for se_cmds Date: Fri, 12 Feb 2021 01:26:35 -0600 Message-Id: <20210212072642.17520-19-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210212072642.17520-1-michael.christie@oracle.com> References: <20210212072642.17520-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: CH2PR14CA0050.namprd14.prod.outlook.com (2603:10b6:610:56::30) To BN8PR10MB3570.namprd10.prod.outlook.com (2603:10b6:408:ae::12) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by CH2PR14CA0050.namprd14.prod.outlook.com (2603:10b6:610:56::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.27 via Frontend Transport; Fri, 12 Feb 2021 07:27:10 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 31902733-1aa1-426e-ba7d-08d8cf279c78 X-MS-TrafficTypeDiagnostic: BN0PR10MB5254: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1002; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3TCfOG7rNi0wki4DvYz0dct3aL/aaMVjb00j9aAG3IysM70BqizuIukSuqcMbNITrNz6FMbAPr6JUSmPLKysq7yIK2sFypPb+rl57ZHFVj7gleFKgVzoEXKVWFi9sG1yfvsxWyuANmjpxJ61t0HSinPQQE2bidnCLMp9syG3Fjr8VZYXi0i7N9W8QFZ8TF7dJQ/vwbS89+aZ4YzMf7isR+IF5MI5UtjiP+mf4+BnTpzmgjfn+iFzn+9rC9u+MVAVV7Z74gop9gYop3ExHealJcuDcYH8jrr2Tk8ls/PNQvZPlb6gtCHlP8n9DcFMzl9zBW58fnySEHM9hZl6MVF3XNFk7x6uGbVbddoUcKlkB1amar28dADbUUJWPR05PQ+eckzh4Hx9vphBvj9Ftc5/XNORVhTzTjImXGb6BqJIn4xwbyQCA4W+kZ4UG/pjusRfqNd8mf8pzUWyotDoR3fdwOWpIlrkHP4qGxXhk5xF8CRfOJ+jAVAo1CN7JxrXBzA3ju6xx4KqkaZSYP6VWw9J24USpoDF6PR+ALe8RPIFXi+73rCcXl8MoPIkenqy2L1hgRA1rN/r2dQlEjCSB/gWBw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN8PR10MB3570.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(396003)(39860400002)(346002)(136003)(366004)(376002)(8676002)(2616005)(4326008)(316002)(8936002)(6512007)(66476007)(16526019)(107886003)(26005)(956004)(6666004)(69590400011)(186003)(83380400001)(36756003)(5660300002)(52116002)(1076003)(66556008)(478600001)(66946007)(86362001)(6506007)(2906002)(6486002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: OlpQPKGVDYH8xiFHX/yw27Se1ryS6jUuX0Mwl3mAzxE2ij2AFmarclo3oHMBi2NZa9XJFU+XTk237QlK+8ugL40C4DrRyu1cK4RYknEPdmBucPaICGkPoqHjLH+vvtfgiV9EUrl2gAYttT0ItP/Lvxx30UxKidXRom5ZTxNNsMifLufZUZaAGidWGVAd6a4CTDs9JYL4ZR+Eci+Kl8n23fSpnLJhmkwoEOLReCsUkE6Fgs1MSGz+3pWhva08XYjFivj2C4wSGahVh+kTzs9uzResLoInB/X9Lo/Qs2U026D2DDj0HPk3FaoBUu8cryWh075qoQWlsZ6bVuhq+iHfGGrSyDygFI9K3bDGJE56IxqQIsIIZRCFez2YdO8fbFaGBdquZxRzAsq86nN+bOXjOhEv5qxsXE47hyXWWE59FWXSQMckcAN0fGEhwYFLJkk0ChE7j198CUpL2bqOoWvaHqJnWz3CtHPO6+zFn47iiNk7+EhvGNtVrxbyY6YiXGk+RyHX4g1udDd/rt88axiTHtHeFrpM0daHj/PteDtWDMXTun6uA69ZVUYFLd+NQV5uVw0VT8u+bDPZcNr1KHfzmpJtmKtbPDEi5futd287mHV2UohArZ+h1hM8tttZbkFmOft1/5URGG/FdFlwWFWFlNCUAPWwTxj722Ap6zZ56y1qt/voSXrrJTXbzlMWG0S7kgHe393mHtExrllLVHWmZQkUVvdBRXRunxgQISsoXOt80vanY/tsqwLDa3FC6P79TSGZ/RfJSzNRIRHB47gkUPdgrs38Usb6HP71qbFrlyQ3adZUQraHQWRoMnX5AptD9IYT+w71KvLGXDsMZpY/Z3WCnqfTJq7OlPYT3uz3tswPhS83QG7gye/6Ndg7Iw0J2nEEVsHvHboP4e5ujVQkVBmPob0qTa2n9WuYWe27Nk03BRm4aWmXwkPVAxukxj6eUnOImfI9tIrEPObbczi7jGRxIPFJAP1R7Zy9lgHNAtzRfp0ERcmwRu7TvNk6IhcwXp1/s5wbLR7mOeUw5FRaSBe6exG61gEdFCbn1YJ+I4Z91DyEChhdWPzxMQAMdNhXOV1r1IM4GKid43Yl7mB6Am4bPuMvZRfyvAvWdFMyuVzhhxj8uxM/8tlGh5dwo/K1KryQFfOoKpcBoEZCszmxtePD8tKetg/63kEQBagIzkS2cMpl/YIA4T16WdEx3iI6zA76lxi/qyC7z5kD3gwT/NRLorQ4d53puGKq3FqYn57+AGxNqcZkoIW10NMPcfbt+85w9DnNCmbjyS+nBOvRvzZ/HEDC5uf4jettUhTcKupbm1t1k6QBLJZHxKPnj5Ah X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 31902733-1aa1-426e-ba7d-08d8cf279c78 X-MS-Exchange-CrossTenant-AuthSource: BN8PR10MB3570.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Feb 2021 07:27:11.0396 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: FXkCi7XxWoQvL0CL17mSxV5MBCjfzajj6cX4y1Eut9ySXZifK5/SFoWD+xSa3zyK1gxgEQg0/a2E0EkmH6oMh+riu6U/W7L7CHbE71cr9yk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN0PR10MB5254 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9892 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 adultscore=0 mlxlogscore=999 malwarescore=0 bulkscore=0 phishscore=0 spamscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102120053 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9892 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 malwarescore=0 priorityscore=1501 bulkscore=0 spamscore=0 impostorscore=0 mlxscore=0 suspectscore=0 mlxlogscore=999 adultscore=0 clxscore=1015 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102120053 Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org This just has tcm loop use the block layer cmd allocator for se_cmds instead of using the tcm_loop_cmd_cache. In future patches when we can use the host tags for internal requests like TMFs we can completely kill the tcm_loop_cmd_cache. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig --- drivers/target/loopback/tcm_loop.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/drivers/target/loopback/tcm_loop.c b/drivers/target/loopback/tcm_loop.c index 677e4b8f0642..fb877aec6321 100644 --- a/drivers/target/loopback/tcm_loop.c +++ b/drivers/target/loopback/tcm_loop.c @@ -67,8 +67,12 @@ static void tcm_loop_release_cmd(struct se_cmd *se_cmd) { struct tcm_loop_cmd *tl_cmd = container_of(se_cmd, struct tcm_loop_cmd, tl_se_cmd); + struct scsi_cmnd *sc = tl_cmd->sc; - kmem_cache_free(tcm_loop_cmd_cache, tl_cmd); + if (se_cmd->se_cmd_flags & SCF_SCSI_TMR_CDB) + kmem_cache_free(tcm_loop_cmd_cache, tl_cmd); + else + sc->scsi_done(sc); } static int tcm_loop_show_info(struct seq_file *m, struct Scsi_Host *host) @@ -164,7 +168,6 @@ static void tcm_loop_submission_work(struct work_struct *work) return; out_done: - kmem_cache_free(tcm_loop_cmd_cache, tl_cmd); sc->scsi_done(sc); } @@ -174,20 +177,14 @@ static void tcm_loop_submission_work(struct work_struct *work) */ static int tcm_loop_queuecommand(struct Scsi_Host *sh, struct scsi_cmnd *sc) { - struct tcm_loop_cmd *tl_cmd; + struct tcm_loop_cmd *tl_cmd = scsi_cmd_priv(sc); pr_debug("%s() %d:%d:%d:%llu got CDB: 0x%02x scsi_buf_len: %u\n", __func__, sc->device->host->host_no, sc->device->id, sc->device->channel, sc->device->lun, sc->cmnd[0], scsi_bufflen(sc)); - tl_cmd = kmem_cache_zalloc(tcm_loop_cmd_cache, GFP_ATOMIC); - if (!tl_cmd) { - set_host_byte(sc, DID_ERROR); - sc->scsi_done(sc); - return 0; - } - + memset(tl_cmd, 0, sizeof(*tl_cmd)); tl_cmd->sc = sc; tl_cmd->sc_cmd_tag = sc->request->tag; INIT_WORK(&tl_cmd->work, tcm_loop_submission_work); @@ -319,6 +316,7 @@ static struct scsi_host_template tcm_loop_driver_template = { .dma_boundary = PAGE_SIZE - 1, .module = THIS_MODULE, .track_queue_depth = 1, + .cmd_size = sizeof(struct tcm_loop_cmd), }; static int tcm_loop_driver_probe(struct device *dev) @@ -579,7 +577,6 @@ static int tcm_loop_queue_data_or_status(const char *func, if ((se_cmd->se_cmd_flags & SCF_OVERFLOW_BIT) || (se_cmd->se_cmd_flags & SCF_UNDERFLOW_BIT)) scsi_set_resid(sc, se_cmd->residual_count); - sc->scsi_done(sc); return 0; } From patchwork Fri Feb 12 07:26:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 12084809 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 862C1C433E6 for ; Fri, 12 Feb 2021 07:31:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5DF7364DDF for ; Fri, 12 Feb 2021 07:31:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229912AbhBLHbn (ORCPT ); Fri, 12 Feb 2021 02:31:43 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:42408 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229913AbhBLHaB (ORCPT ); Fri, 12 Feb 2021 02:30:01 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11C7QtM3017743; Fri, 12 Feb 2021 07:27:14 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=Ex2GluAq8WqejZjlnAkklhC4NkokkfCGFh3SuxU4/ZY=; b=yrOWbscFYw56OqfRkWc35EWnGx+Lohyu1aMKaxlPGmRPJGqslEos3AZBitWXo/IErlN6 t/n59RFHQi5DQYQ5rYagTA6ZviS0v7uerKcl4un/0MQ5Dk11Ep+MAasvzP6yuQySI/z4 WwUJr6KLWhanAGStKMs3PgERd4el6GwCjce22vFUpLruFLZCo7vAvu0998I1j8eVTA3T IYh/lInBKO9HkkwqiHtQ6ofgGMNBc28xMteGrwWOLD1Vr/xfK7VkfNW5nlS7zZY0xLSv vDX1+byeEeEkiGGVRbiV1msT/XenUrLdJjzTnXHgSeO93oVNSRRIfHJJfiavJB5uEVYe VQ== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2130.oracle.com with ESMTP id 36mv9dvcur-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Feb 2021 07:27:14 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11C7Q9BY090048; Fri, 12 Feb 2021 07:27:13 GMT Received: from nam04-mw2-obe.outbound.protection.outlook.com (mail-mw2nam08lp2173.outbound.protection.outlook.com [104.47.73.173]) by aserp3030.oracle.com with ESMTP id 36j4psn5st-6 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Feb 2021 07:27:13 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hrH2NUr8HJfrFUgC+MTI5ZfahVOcJzXj6iRyEawzaQYR+u6qdbdeZ4b8CLEaVTpuOD2qV1FkAcTzwt/+OD/ShSWcIJbtnu+3lwxA4BQSwQmF/OFAxpK0FnmRzVxvbMChSuBdp0IQnB5luaZnvwODdT/2zyHnykOHlpJ6C7qBAd4eD5FNNmRQYU0KotB0LoqPh1X9DbE2NDwJeJ6CoZ9o8mMz6TYymHwLo79S7Z2tME5sty1+LWZYK8G1IdB0se8BX2Q5eXM2y3yAMgIl94OW4MMNmewZuBqNmFleU1k/5wXJm/Kd/C5+RaprCUbdplfaXaPHm0/sAjCXEoMayimgLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Ex2GluAq8WqejZjlnAkklhC4NkokkfCGFh3SuxU4/ZY=; b=ONKbwYlYfG+MVeDabh5IeZxSKq5oLoNa8VYvdmkIsfJCn+pe5e+s/SyijqOA0EEK8NyZyPJk1aroRrQwS4+y3XiUeFzuP9Opvk8wZMv+7NqjzcxdZgKw5YGMhKVVNoTn0s7JBVSws6lkqbkmJslC4iINMmMdzE/NyzwGu8Fv+fPHDUjPNErkZaqqwdgKBWrF6Xko2LdNhmzlkDoRrU8o9lKJ6fBOdxy91XV8iwQVr3jBVxWq/om3yazKF4diV5sRZN1s0ua44qV4QaocUjylgQ9oi/++swZ1IHAqD+Yj5kIZkuKlW+hx1wkgt6Wx0R3oRiLBJyIFs0KjYxJqj+8uAw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Ex2GluAq8WqejZjlnAkklhC4NkokkfCGFh3SuxU4/ZY=; b=bvotWRPwecI+Xl1jzKC29PkWj+JFVoym32zcJZn78oetPf145iIZKWpHfQFmjkTvw1cfvhhJjOqYu0tqSqsULYd7pWay03AzVpIM1OAngPQloszFHZ6ZFotlnGYHyueE3b4oZITOPp+6SHrIHsFK0sw+gtAr4vOxoZu8Cj7/YhE= Authentication-Results: redhat.com; dkim=none (message not signed) header.d=none;redhat.com; dmarc=none action=none header.from=oracle.com; Received: from BN8PR10MB3570.namprd10.prod.outlook.com (2603:10b6:408:ae::12) by BN0PR10MB5254.namprd10.prod.outlook.com (2603:10b6:408:12f::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.25; Fri, 12 Feb 2021 07:27:12 +0000 Received: from BN8PR10MB3570.namprd10.prod.outlook.com ([fe80::513a:2259:52d5:e495]) by BN8PR10MB3570.namprd10.prod.outlook.com ([fe80::513a:2259:52d5:e495%4]) with mapi id 15.20.3846.027; Fri, 12 Feb 2021 07:27:12 +0000 From: Mike Christie To: mst@redhat.com, stefanha@redhat.com, Chaitanya.Kulkarni@wdc.com, hch@lst.de, loberman@redhat.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org Cc: Mike Christie Subject: [PATCH 19/25] tcm loop: use lio wq cmd submission helper Date: Fri, 12 Feb 2021 01:26:36 -0600 Message-Id: <20210212072642.17520-20-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210212072642.17520-1-michael.christie@oracle.com> References: <20210212072642.17520-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: CH2PR14CA0050.namprd14.prod.outlook.com (2603:10b6:610:56::30) To BN8PR10MB3570.namprd10.prod.outlook.com (2603:10b6:408:ae::12) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by CH2PR14CA0050.namprd14.prod.outlook.com (2603:10b6:610:56::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.27 via Frontend Transport; Fri, 12 Feb 2021 07:27:11 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 08d5a009-5964-43f0-66ae-08d8cf279d06 X-MS-TrafficTypeDiagnostic: BN0PR10MB5254: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2449; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: h4TkR0RuxiK13MchnbWhNbW/x4nzYjRXvKFmiH+dgv2AL0dEPWzAkAeT6vv270vD3rokMrZCf1OHqJ8ilASVTMNCmbcwFDEZ/MPK2qOs8PFf0VLOC3bZ6miwrcrtnThPkMKLJGjTwl/JFn1zf/wK/H35c/gjz1ztLU8fnS/Gp+kEZDLeDUCIiwk1CNfzDv5tzYzeVMj8VfoLN/CBYogpBoshsw0C25vgxaFZORquo6DWwmxmJwmjxKNWccWSHMCL/tTiQ/VMXJN4eqBLsMpNOy14Nr15PqQhZG+ATiydZ7ATgjsHX867N6Pdnhxe0Rc/CchGE+pL5N93ata3jVOahJOl9916bN60Yg6iStZp1k7lYeINi5i93zM7cq3gSBO2wkFtyH/660EVuzQnM9Z3jg+rhUTaAAwhUg3Lnt7tGLt25mbFrbO0OsaPUNZQGPU2NYIwY62osRcpUPvhXPI5CKTEt8iyzugs+L/ao0QdipGwtA1szp/zIDW1KaEMu2TPmByKBZx46RlLkxk2jxa/DzllglyKcQ2r9J+z2IfRRbORoTabZK7Yl74miRH3XF+kUfPGydnwuZN7Haj2ghc2tQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN8PR10MB3570.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(396003)(39860400002)(346002)(136003)(366004)(376002)(8676002)(2616005)(4326008)(316002)(8936002)(6512007)(66476007)(16526019)(107886003)(26005)(956004)(6666004)(69590400011)(186003)(83380400001)(36756003)(5660300002)(52116002)(1076003)(66556008)(478600001)(66946007)(86362001)(6506007)(2906002)(6486002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: x24nKjTAp3Whc6hGrzIz24FFdHCGsH4f20/Fh9omc2npvANjU5lWsuTFj/Rw0s3EH6MHN1hiEUgK0pBKABK5PNeCqYTxltrixvG4cg7hh5i88eBklK+Ar5nXLxCw24z54TH42I9Umh0PYXfGY0nZOWooFO2Jn0C8DMkrrbXgXo5Yua10z7D5Yum4VjG5I/aoaOIOer1pE+14mXNnS0eJV1TzxyiobvMZwsZfeGPxk8yxw9wZ/WXbDX4sGXG+9kmlA0f2suSHu915lSQOXsYt+kZ8nuoewMD147hiJPl9FH9rgUAAtv7hrZCvjpFaG98NQHtvY1HjDOTKNg9PuZakYp7+daLeTnlddkdw9M0y5ELQIff3dAwXs62p9LRGnwaVEzO9uPM5W18v3tw6Zz4ajL5Dw2fz3cMSUJ/DM/QO2Er63+eDMjVMwUG+eKIdQkG/XJOahF74QdlBGmeOGKtvS0nPwM905Onkiucyztz2tLmVhIiCCVA+TCtc4meZInMzNLTG3eL4Jrhl4teK9VVeAmr5JY8+kcdcvPwZx5YyoaUKLmObkcuplpKsL3uvQLh2pAN44YW+XBFy7hxGYqxttTbrUkbsRzg97gHeErWGWx+kK4Ir/lXP+nZDfWNotv69p8QwLkeMOikIhCxKVRqm++6Jx8OkPrW/VjKPKrfBaDVm2F4OubvWBob+f1owjhjqGp9DZR8/hwqhbMv62LGe6fMi2bIjCKirnOuHO/xflJe9N3PrMbErxAJKT95kM1hcmMLafzSKyi7DTEIcg0u2BD6AILpO+rQi9lRmkZxa637vNiMnEPOMR6725C7v8VHZEhYimjuaXLAn7uA+ZOVUQ6shefBUH6R9vq6uw/RoragjIeTkoYHUip1GyPNYMJVXTGHcPEsc5QPmSNt6AeySJYI75wMOA0KkxY1scImDwaR5QgR0pu8vHpaEU+C8C0p0k0aVKM5g7Lv0H2lQw+wFSuzvEf9oQ64zrWumvbNrE9FxZ8UE2+y6mqppf9VqX87EM+9Qpb/UpwCzSm12fH1SToKyg9bdq3AlNUc29tDsQZMHFh9xXxdohHBcF89DKqyCs7IkUwi0dXGNa2SFVVjeIS3xrWeSSXIY5Y8RH4ntqFNzXD0cWoyeq/EfH+KEHJ5lHiCjHsRh4KGBI91V07QYyPosw+S171Wrh9ykaOptD2SrZhT9mbULqOKNGUib20UTcXQOmnoPylGJORuB+Sqp5j8aUO+lSh0GeH7Zjde1IUC4i68snRpEa4jNGHZUsvhB3nTd6Fz1xIZr/GFE30TaKS6uopb4G7PwIfMQMPeY6QPx8KrI5KFbYidUwQGs0UuA X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 08d5a009-5964-43f0-66ae-08d8cf279d06 X-MS-Exchange-CrossTenant-AuthSource: BN8PR10MB3570.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Feb 2021 07:27:11.9850 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 7Fb/YhR1FlbZFwSvviLf+EMk+nDkB15t2dlBU9N3fix34aVQB97OZHK+/HnwMtt2BZE1+u5p3YkDJkyoHNeMcql130T5uYIDploWzpKIhT8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN0PR10MB5254 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9892 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 adultscore=0 mlxlogscore=999 malwarescore=0 bulkscore=0 phishscore=0 spamscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102120053 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9892 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 mlxlogscore=999 bulkscore=0 suspectscore=0 phishscore=0 adultscore=0 impostorscore=0 mlxscore=0 clxscore=1015 lowpriorityscore=0 malwarescore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102120053 Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org Convert loop to use the lio wq cmd submission helper. Signed-off-by: Mike Christie --- drivers/target/loopback/tcm_loop.c | 22 ++++++---------------- drivers/target/loopback/tcm_loop.h | 1 - 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/drivers/target/loopback/tcm_loop.c b/drivers/target/loopback/tcm_loop.c index fb877aec6321..2687fd7d45db 100644 --- a/drivers/target/loopback/tcm_loop.c +++ b/drivers/target/loopback/tcm_loop.c @@ -39,7 +39,6 @@ #define to_tcm_loop_hba(hba) container_of(hba, struct tcm_loop_hba, dev) -static struct workqueue_struct *tcm_loop_workqueue; static struct kmem_cache *tcm_loop_cmd_cache; static int tcm_loop_hba_no_cnt; @@ -106,10 +105,8 @@ static struct device_driver tcm_loop_driverfs = { */ static struct device *tcm_loop_primary; -static void tcm_loop_submission_work(struct work_struct *work) +static void tcm_loop_target_queue_cmd(struct tcm_loop_cmd *tl_cmd) { - struct tcm_loop_cmd *tl_cmd = - container_of(work, struct tcm_loop_cmd, work); struct se_cmd *se_cmd = &tl_cmd->tl_se_cmd; struct scsi_cmnd *sc = tl_cmd->sc; struct tcm_loop_nexus *tl_nexus; @@ -161,10 +158,10 @@ static void tcm_loop_submission_work(struct work_struct *work) if (target_submit_prep(se_cmd, sc->cmnd, scsi_sglist(sc), scsi_sg_count(sc), sgl_bidi, sgl_bidi_count, scsi_prot_sglist(sc), scsi_prot_sg_count(sc), - GFP_NOIO)) + GFP_ATOMIC)) return; - target_submit(se_cmd); + target_queue_submission(se_cmd); return; out_done: @@ -187,8 +184,8 @@ static int tcm_loop_queuecommand(struct Scsi_Host *sh, struct scsi_cmnd *sc) memset(tl_cmd, 0, sizeof(*tl_cmd)); tl_cmd->sc = sc; tl_cmd->sc_cmd_tag = sc->request->tag; - INIT_WORK(&tl_cmd->work, tcm_loop_submission_work); - queue_work(tcm_loop_workqueue, &tl_cmd->work); + + tcm_loop_target_queue_cmd(tl_cmd); return 0; } @@ -1160,17 +1157,13 @@ static int __init tcm_loop_fabric_init(void) { int ret = -ENOMEM; - tcm_loop_workqueue = alloc_workqueue("tcm_loop", 0, 0); - if (!tcm_loop_workqueue) - goto out; - tcm_loop_cmd_cache = kmem_cache_create("tcm_loop_cmd_cache", sizeof(struct tcm_loop_cmd), __alignof__(struct tcm_loop_cmd), 0, NULL); if (!tcm_loop_cmd_cache) { pr_debug("kmem_cache_create() for tcm_loop_cmd_cache failed\n"); - goto out_destroy_workqueue; + goto out; } ret = tcm_loop_alloc_core_bus(); @@ -1187,8 +1180,6 @@ static int __init tcm_loop_fabric_init(void) tcm_loop_release_core_bus(); out_destroy_cache: kmem_cache_destroy(tcm_loop_cmd_cache); -out_destroy_workqueue: - destroy_workqueue(tcm_loop_workqueue); out: return ret; } @@ -1198,7 +1189,6 @@ static void __exit tcm_loop_fabric_exit(void) target_unregister_template(&loop_ops); tcm_loop_release_core_bus(); kmem_cache_destroy(tcm_loop_cmd_cache); - destroy_workqueue(tcm_loop_workqueue); } MODULE_DESCRIPTION("TCM loopback virtual Linux/SCSI fabric module"); diff --git a/drivers/target/loopback/tcm_loop.h b/drivers/target/loopback/tcm_loop.h index d3110909a213..437663b3905c 100644 --- a/drivers/target/loopback/tcm_loop.h +++ b/drivers/target/loopback/tcm_loop.h @@ -16,7 +16,6 @@ struct tcm_loop_cmd { struct scsi_cmnd *sc; /* The TCM I/O descriptor that is accessed via container_of() */ struct se_cmd tl_se_cmd; - struct work_struct work; struct completion tmr_done; /* Sense buffer that will be mapped into outgoing status */ unsigned char tl_sense_buf[TRANSPORT_SENSE_BUFFER]; From patchwork Fri Feb 12 07:26:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 12084851 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 69F09C433DB for ; Fri, 12 Feb 2021 07:32:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3DC8F64E57 for ; Fri, 12 Feb 2021 07:32:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229935AbhBLHbw (ORCPT ); Fri, 12 Feb 2021 02:31:52 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:42436 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229919AbhBLHaC (ORCPT ); Fri, 12 Feb 2021 02:30:02 -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 11C7PdPd017139; Fri, 12 Feb 2021 07:27:16 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=QDy8hj3yRDluwHoSztDRMd1wA0TD7pqfHS9AOJWkYnA=; b=GeXXZG5lbmSOQxB9SHRa5AhoXjkmlIJTSlUc17xGlY+iWrm62Si1WoXBfLzdWIASx0LE tEN+DQ2jZq1qAv2exWYcllujRMtKm/+IgqJXzI8LYCRkov2AYNlx9FV5qZlmx5+19Yw4 Jc+RLJ9CTYyJYkejX+p3oAi4f/qgJIx4IrBMN11VXjge3LI0Rb1xhZ/LbQZUPLtbusoO FbGNO7ymEKD7kKLfAZ1xINPkz0sO4jc9LdN00ttC59f2mJL1JpvCR6IJCktTOrXujZsA mpRnVW7Bulq/FZYOpDfPaCcy3PzRvwLHS98SE0T6tBgXpVBv+I0ElYsak/ws+cZJArad ww== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2130.oracle.com with ESMTP id 36mv9dvcut-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Feb 2021 07:27:16 +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 11C7QA0U090287; Fri, 12 Feb 2021 07:27:15 GMT Received: from nam04-mw2-obe.outbound.protection.outlook.com (mail-mw2nam08lp2171.outbound.protection.outlook.com [104.47.73.171]) by aserp3030.oracle.com with ESMTP id 36j4psn5w4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Feb 2021 07:27:15 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jBk0qOWvYd+ciD62UjZd2IO9UPyQiO2hQmSoUUH2dxLd8Nl9CbtZ/cqZYuLKFoyhENwUU42duBi+6pH0Bk4px0JgLeESsXKJjSlr258qJiGkT5mu8hxgv6T1V2KXsX3dK297KfnU6o5wA0KwAWQJSlkkbac7WfnpdyRdTdCMunJbcdTwsMw4tRC6B/QZ6j8g9RNfx6QTL7iNH6AH3OBOjZ5kDQewcj587Q2H/aleE0cpC+3fNiBgBlSwKrHkc0UYLoZxvBQvLwVZNeMTw8lc5whZcibZxyLlWhunovrMjcAzTwjQKWNb4jRzXGJ3uQWUJlcaK17xMvX0QdPBeMy7nw== 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=QDy8hj3yRDluwHoSztDRMd1wA0TD7pqfHS9AOJWkYnA=; b=QKjJ8A4ZEAKOQ5zRbP2O9xGAX6d9IPFybLY/iDbrPldy7aqSQk/W9KRF1Y42gvpv17TBeNHLEwPpKNVlu819aOVQpd+oeHJQsSGySLeEv1N69HfXptZMRcNoDmy6Fa6dxulEaz7pHxHUK7m/MXz8Ir1Lsx0kAW3ca/QSwy5+8akZhKjQIDQShJzhO+gwQSIme4EEcFP5K8ljiMdH5MZpq8UsuhHpCGLdYu3OnTYBvaIBZpvMF1yO+N3ndqn3PJLB3sHHvQDrNu09/ORzJmXIyAFThe5Ih62bbMTiRMwAyfDYwtP3Pok5NKB3GOdoBBXIQc30WMDq2wmgVpFk4jFi/g== 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=QDy8hj3yRDluwHoSztDRMd1wA0TD7pqfHS9AOJWkYnA=; b=TpfG6djtGoRx88AqVRPllOJXi7WXtmYky0xj8Uq/V9DXoJ40EcIDmoKwQGe65r5Bs/3HHCaIHiqx0v4E+nK6Kk9qjAR32jf+7RdP8q2IZMA0Hlu3lp3tBh835x9+mpMSeZ2WcRwZWME+aMmxXNEZ2/FpgRpOavxqGzCtNy2nPDc= Authentication-Results: redhat.com; dkim=none (message not signed) header.d=none;redhat.com; dmarc=none action=none header.from=oracle.com; Received: from BN8PR10MB3570.namprd10.prod.outlook.com (2603:10b6:408:ae::12) by BN0PR10MB5254.namprd10.prod.outlook.com (2603:10b6:408:12f::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.25; Fri, 12 Feb 2021 07:27:13 +0000 Received: from BN8PR10MB3570.namprd10.prod.outlook.com ([fe80::513a:2259:52d5:e495]) by BN8PR10MB3570.namprd10.prod.outlook.com ([fe80::513a:2259:52d5:e495%4]) with mapi id 15.20.3846.027; Fri, 12 Feb 2021 07:27:13 +0000 From: Mike Christie To: mst@redhat.com, stefanha@redhat.com, Chaitanya.Kulkarni@wdc.com, hch@lst.de, loberman@redhat.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org Cc: Mike Christie , Chaitanya Kulkarni Subject: [PATCH 20/25] target: cleanup cmd flag bits Date: Fri, 12 Feb 2021 01:26:37 -0600 Message-Id: <20210212072642.17520-21-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210212072642.17520-1-michael.christie@oracle.com> References: <20210212072642.17520-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: CH2PR14CA0050.namprd14.prod.outlook.com (2603:10b6:610:56::30) To BN8PR10MB3570.namprd10.prod.outlook.com (2603:10b6:408:ae::12) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by CH2PR14CA0050.namprd14.prod.outlook.com (2603:10b6:610:56::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.27 via Frontend Transport; Fri, 12 Feb 2021 07:27:12 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0b5f2265-c0c7-4e51-ddc1-08d8cf279da2 X-MS-TrafficTypeDiagnostic: BN0PR10MB5254: 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: leFa/LYQ3ORGqes9EInLd5iQJ2F5CK953BwnxKINLztg+fMJaSG4gxTloLaTczYftRsEBCg6Tfl0dFGpQ/cRFiapOKcsYLREPQjjZlO2EkLhcDwoq7qXz6/9iUydYBBf6EFcOGJHaWPAq0vjeAXXqb/BNGGpL8XIobcQ5y7VIL4O4UpOgeEjWVIG0V6kHNPlyvSjTjKoGC27gwtgqPh/YANbqoKlAaRh6+6PtFyneZorUVmoRtgE38fWjAEOGeckw7Q+V5clgPmbzrsCtw7WcogrkomxbSKI2LAyXPPtc2Ku/3zIg64zIhNF4EZWsPiUN+QmCiDp3GCG0qZlasgjpZCLxAEZqqlZ7JqdlVpMekMzOG0eDkhkZ1bHlzfmVub2fqI5mGFw88hP7Sd9fuZ8Sm2VsD0V5RPM03rVuTtp7JV8GT0fHoC8zuJSKSppujEqHqn7nGn614ttVHniGueePp59H3cow5GiH1T3+pZ4fzCtDAT0qrZPbFJtj9SH6Urp7yjdU6rIgBgbiUPKN3Y6+DnicvWa6XQ7wJOBsEFVvl8hVROZ46qkZO3n7rYKbT3SLUCGdKuErRWOOLXsD5198g== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN8PR10MB3570.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(396003)(39860400002)(346002)(136003)(366004)(376002)(8676002)(2616005)(4326008)(316002)(8936002)(6512007)(66476007)(16526019)(26005)(956004)(6666004)(54906003)(69590400011)(186003)(83380400001)(36756003)(5660300002)(52116002)(1076003)(66556008)(478600001)(66946007)(86362001)(6506007)(2906002)(6486002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 7/ZUTd4hr9EJsC1yF82K9MfE7xiYdZezDY4b20pBl68kTIqRPYWOUx/CG2b2TwZ46xFwobH0tPXg+d423VwB4lp4+z3LUhK08/kVY+/ZSPTYyMBV4E2BGs8ZIPpJdC1x0tCma5mNg7LlzUCxHsVhfL9S0JhwWcIGYsuanmnbH1rW4SwxKfjFx+56BK9+jQo6FDXnd3RnV/a66KylrmZV9590mLS/Dg47QzShwwYLClPNnNxmHb4iHfKwZtQk8ybGJifSckC8AOtDBUJjnkn7lObZlU3T8mZ/YobJhXjGxTHfhWrSLcLdLRtEAFHNAEGZzr/vcvW8PECePa4iD0Tg235FXOBZ0h0lQieAzx8XtAabu+F/uYfuhrE5Vpfx408RNybLpcspvHr2mHwyZ4jz4okota6X/HAsea79c5U12S+DkJjJ7XH26UVZk9hjvFbojhJl9YM0iWFYlquEnw211mzG0dKgBwrS9XbAfq6ljSNKPVbglQGupBKhxJH2CxcZxgQBnZ2BnyyGWwPS+0gcYA1MNvChfVqq+2aOnsg5DCUBTBv840PZ7TTZgePuqTwUd2xr0VmvpYaIYfpbtU7HR7JW7Mn33y6nwamtWOgOapHHEm8T/etx1KHtW2G+id3ZbTBuVcRT3rHWMTOjbO6HmKvPHytp7xgLxFYlK3OfkqvnoGpIYbkVPcsOfw9ZIT9iSthhM3oRfv+XS2MZYWdsV7vnodE6HvxzNc9TcLcLdbzTwKesDStAYxtysuJXrLlHfSQbarozpyJLI3Ed44cpfe2HkuiEi4krKfxgozrHdPDkBsVLT1NGFuabZpev6tOJBRfWxm6f6zs3Ki2uif9xdjSd/alnq80vaEYliRIRYneIR2jl6QqJ3yZ3pFjVRjV5VxjFdvzNVMMIEoic9iZ+mcX3iE/cE1DV+lv1IVEtlv8gf0Xm8GPXuAvydpUYC1rgkKggt2oOT7kaJ5FrW0Pmcfd8vRgC+8VdcxtdsCiAUTFoMFw+eyLh8f6Z0ybwl5FGlSUoRIYzrmYa/tnGNn1H8OtsBX4Cd8O2kUV6ifUDGjR3b+EucWSTcAujQf3xXSyeU67ttHiOztYV2IEw88V0qw04l3DX/xnYB/GxcClmF4N1RPd2RP9ytckRpeMkG95J84jjr45AyxgXjzADoQO2GfIr8Fe64SBQv1HhALz+YW6cPD7a5AdSO/7/qEWjgY37AhV1On8vR/t1PjQZr92BZ+teLiWBU3OcA3Hx4tQJHFnbawQrlG8c+IDgK+shNJpqcPM99zTDzQJg7t20Wv6Pjxbc4UsozGwf1lOHm72KG7QWiDaQw8GU62BBwu6AvVGB X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0b5f2265-c0c7-4e51-ddc1-08d8cf279da2 X-MS-Exchange-CrossTenant-AuthSource: BN8PR10MB3570.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Feb 2021 07:27:13.0594 (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: YGuL/6I3AHPl6hViyoXooloJjaRQPOxfhp35x1DXlQXIXXYYZHCWmXVAUQxN1xqdCEQvdWZ9pxX5a0ql7sFpQem1vACvwXVFHvsoMqJewT0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN0PR10MB5254 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9892 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 adultscore=0 mlxlogscore=999 malwarescore=0 bulkscore=0 phishscore=0 spamscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102120053 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9892 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 mlxlogscore=999 bulkscore=0 suspectscore=0 phishscore=0 adultscore=0 impostorscore=0 mlxscore=0 clxscore=1015 lowpriorityscore=0 malwarescore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102120053 Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org We have a couple holes in the cmd flags definitions. This cleans up the definitions to fix that and make it easier to read. Signed-off-by: Mike Christie Reviewed-by: Chaitanya Kulkarni Reviewed-by: Christoph Hellwig Reviewed-by: Himanshu Madhani Reviewed-by: Christoph Hellwig --- include/target/target_core_base.h | 38 +++++++++++++++---------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h index 815de4c97230..5e6703ca102d 100644 --- a/include/target/target_core_base.h +++ b/include/target/target_core_base.h @@ -127,25 +127,25 @@ enum transport_state_table { /* Used for struct se_cmd->se_cmd_flags */ enum se_cmd_flags_table { - SCF_SUPPORTED_SAM_OPCODE = 0x00000001, - SCF_TRANSPORT_TASK_SENSE = 0x00000002, - SCF_EMULATED_TASK_SENSE = 0x00000004, - SCF_SCSI_DATA_CDB = 0x00000008, - SCF_SCSI_TMR_CDB = 0x00000010, - SCF_FUA = 0x00000080, - SCF_SE_LUN_CMD = 0x00000100, - SCF_BIDI = 0x00000400, - SCF_SENT_CHECK_CONDITION = 0x00000800, - SCF_OVERFLOW_BIT = 0x00001000, - SCF_UNDERFLOW_BIT = 0x00002000, - SCF_ALUA_NON_OPTIMIZED = 0x00008000, - SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC = 0x00020000, - SCF_COMPARE_AND_WRITE = 0x00080000, - SCF_PASSTHROUGH_PROT_SG_TO_MEM_NOALLOC = 0x00200000, - SCF_ACK_KREF = 0x00400000, - SCF_USE_CPUID = 0x00800000, - SCF_TASK_ATTR_SET = 0x01000000, - SCF_TREAT_READ_AS_NORMAL = 0x02000000, + SCF_SUPPORTED_SAM_OPCODE = (1 << 0), + SCF_TRANSPORT_TASK_SENSE = (1 << 1), + SCF_EMULATED_TASK_SENSE = (1 << 2), + SCF_SCSI_DATA_CDB = (1 << 3), + SCF_SCSI_TMR_CDB = (1 << 4), + SCF_FUA = (1 << 5), + SCF_SE_LUN_CMD = (1 << 6), + SCF_BIDI = (1 << 7), + SCF_SENT_CHECK_CONDITION = (1 << 8), + SCF_OVERFLOW_BIT = (1 << 9), + SCF_UNDERFLOW_BIT = (1 << 10), + SCF_ALUA_NON_OPTIMIZED = (1 << 11), + SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC = (1 << 12), + SCF_COMPARE_AND_WRITE = (1 << 13), + SCF_PASSTHROUGH_PROT_SG_TO_MEM_NOALLOC = (1 << 14), + SCF_ACK_KREF = (1 << 15), + SCF_USE_CPUID = (1 << 16), + SCF_TASK_ATTR_SET = (1 << 17), + SCF_TREAT_READ_AS_NORMAL = (1 << 18), }; /* From patchwork Fri Feb 12 07:26:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 12084855 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3A9DBC433DB for ; Fri, 12 Feb 2021 07:32:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F08A264DDF for ; Fri, 12 Feb 2021 07:32:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229771AbhBLHcJ (ORCPT ); Fri, 12 Feb 2021 02:32:09 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:38364 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229922AbhBLHaD (ORCPT ); Fri, 12 Feb 2021 02:30:03 -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 11C7PcMd142684; Fri, 12 Feb 2021 07:27:16 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=3YwrrI48piCWmPGHNGt2oLCbfb2qcf+tlmtt1i6T680=; b=O0inMzozyteLK6fSMMYskxVroY6jxC2FPPww4721v6peBFddLMfX3da+2uaSlxhQ06Qq VaxVCD6agm8vDjZhIt3+s6aUg7vMComv3MQ0gA2iKu+dYtSSMwXq2A7Kty7xKaYZiTP8 zXzIosAtUQdbSguJZ1IHT/97wAu78IPuxmH4AtFur2hHloCup4ojVMosxdGuWOC6wrPp AnxFzT9f7cubx6bXi36Xpwr3hP5wphuZRIjcCGWN1lHdcQ+Q+LNGEULKM9ZcZrJhTkxA P8g154DXhB4JoEGY4VG9C6S6mdlp52hiEgXra9IO8khmBGN6WuDTChQMAO1WpzGjxaB7 qA== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by aserp2120.oracle.com with ESMTP id 36m4uq0qmm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Feb 2021 07:27:16 +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 11C7QA0V090287; Fri, 12 Feb 2021 07:27:16 GMT Received: from nam04-mw2-obe.outbound.protection.outlook.com (mail-mw2nam08lp2171.outbound.protection.outlook.com [104.47.73.171]) by aserp3030.oracle.com with ESMTP id 36j4psn5w4-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Feb 2021 07:27:15 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KGepODoIjOvRP3w1/O3DjQ6p7LMA2ra3MjzjmPEuIsQO4b6Bq4CDSlBlBKUZ1f6O4gdYNRbPmZV6gJCQwiO05BwuyvRTxp8peNZDuNdP53ZfZrfQSSDJmf92edFnjoa2R3ufHpelTJGDKA95Ha8WSjrQwqNah7qMpMusvNTQK8NVwrDmzU2+ocnOaoNzQ8/PyXJY2HVS8IHMx6f9XebncgOXLK6pCEdUbmGgBxdX92JD6q8WZYCKVh6USGue3WZDPq+TUdd2jKu8xkGIvMsYDIkobgjeESN3c19LADmMpfqJNu8avz6J0if3pkylF8r1nlyYUqXDy+18AVoaP98N+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3YwrrI48piCWmPGHNGt2oLCbfb2qcf+tlmtt1i6T680=; b=GpSHtt5h41N6ot3Zh1/MOud3d15WWHoWZAOAElmOrutB6k2m0iTBdKg3odIBaXsOkfLubHWc8K8HuSc+BK0AQzstrU3Y0GkjMx+X+tpTODYmRwplBw5hstBxuefYAxdaBTzZ95MAWogm6yovN2Nd91992NsIJw25TYMF5HpKXQuKSi58MDzLVZ3gvYVheGywriKmsb2OBdY0nrDyeSjMh730jzOxZr+rIcYkhUX/iNCh3//kWmgyF2ciETs1+1cSGPs3sGrxflXrzwSRy9ypzVdrh1NrOvnk/TU8e1VFpPdRf+esmd7bxGd0MCXkHyWD4AF6E0S0lqb+9DvuMcFfrA== 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=3YwrrI48piCWmPGHNGt2oLCbfb2qcf+tlmtt1i6T680=; b=dwMw3rv3ge6ct3yQbJOFb8w1SJFDzJNaDJImBsKCX2nhvjY0qj2sL8ddzPd5ABh17J+8G8li7nU+TbYgfnWMjshwMKCE5w7k1Ox/xuMjlEEiO6nqjC/i4DqIA8EPxvvdGIlXJj/tFIzQE8mD0rmAuPkygRingSLczWPsTioq7wQ= Authentication-Results: redhat.com; dkim=none (message not signed) header.d=none;redhat.com; dmarc=none action=none header.from=oracle.com; Received: from BN8PR10MB3570.namprd10.prod.outlook.com (2603:10b6:408:ae::12) by BN0PR10MB5254.namprd10.prod.outlook.com (2603:10b6:408:12f::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.25; Fri, 12 Feb 2021 07:27:14 +0000 Received: from BN8PR10MB3570.namprd10.prod.outlook.com ([fe80::513a:2259:52d5:e495]) by BN8PR10MB3570.namprd10.prod.outlook.com ([fe80::513a:2259:52d5:e495%4]) with mapi id 15.20.3846.027; Fri, 12 Feb 2021 07:27:14 +0000 From: Mike Christie To: mst@redhat.com, stefanha@redhat.com, Chaitanya.Kulkarni@wdc.com, hch@lst.de, loberman@redhat.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org Cc: Mike Christie Subject: [PATCH 21/25] target: fix backend plugging Date: Fri, 12 Feb 2021 01:26:38 -0600 Message-Id: <20210212072642.17520-22-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210212072642.17520-1-michael.christie@oracle.com> References: <20210212072642.17520-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: CH2PR14CA0050.namprd14.prod.outlook.com (2603:10b6:610:56::30) To BN8PR10MB3570.namprd10.prod.outlook.com (2603:10b6:408:ae::12) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by CH2PR14CA0050.namprd14.prod.outlook.com (2603:10b6:610:56::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.27 via Frontend Transport; Fri, 12 Feb 2021 07:27:13 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ffd2f892-d1ef-4dea-c9ee-08d8cf279e3f X-MS-TrafficTypeDiagnostic: BN0PR10MB5254: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4125; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: or9ksZJ6440hp3BruX7ICh2UYH38LQk2UAOnKKWNnRNqvhClyXiqtoC/UbbApPUSDxCzf0qWt/4MYYmbSJmv5kRM3jngVmMyjTIyw/vwupbvT3lLqii5AiwwMRjDtGDkLZG29LzONNZGuyrh+UlWvS1yIm0n38/A94vMxf2obYcEJL9IVsoJhLR8BlF9pl/melgUqi+gjhu78gbVKI1oXrZiYy/BFuP60y5iC5olH7FJDDP0c6sJHsw5kjl6gvrsj9Gp/ubM97QOS8aVE75Qr+qZl2DgzXUtWDhXEOSyk0A5OK39nbsseyP56H/rbuwdlC1qxyiyqbYirFICIsLm7uyZHtpvgpFMI0fn7+eMeCA1+DVHq1qX4q8eW2it+VDrgfWqeEllNVOEOlpOyPnj9+V/ks52nw6hYcbJYzdZSKHB6u/AHLtdi8Tsf1j1bWPGrswHWQ0ACMKyWnzEyKaXcVPvGKIPCFkejALH0HNtapbqJ8mNrZRXwOJgNyn70Mv5m0Hm0Mzjp/cxet8Kle1bbjgnkFYBPteiBi1A2bFZuEM5vB45qQqv+yUWnO1WgIokQdCLx9hVBbhyZxQ4UCA+bg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN8PR10MB3570.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(396003)(39860400002)(346002)(136003)(366004)(376002)(8676002)(2616005)(4326008)(316002)(8936002)(6512007)(66476007)(16526019)(107886003)(26005)(956004)(6666004)(69590400011)(186003)(83380400001)(36756003)(5660300002)(52116002)(1076003)(66556008)(478600001)(66946007)(86362001)(6506007)(2906002)(6486002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: +jDzY+8ds7f4nWEWKVgtYWZ9fDunJ9Rt2rvjw0cn2tDnK7f6WaNa96Xz4ViEBkUydPXt1N6VRiuKvCHMsXL6LH9y4wwLz6j21xdqIN0Lh5iLkAyyt3ysvFpnHrghDF2N++G7TwNw8J/d2JiIRrNyYux7A7HpjaqdATMG23SNg/OxhvTo/Lvg2wQ/WQcFEJjoJK5LpfWAPQSwRvraNRT4be8FAtFNRN/G4mROgw6AWJO8biejqiMxRarWfpM23ZeDlnivnJGEGYTyPpX71YPzS6HVT3hM5RAoa6hYUWFhk9+CdTkP2oSzuOvDrC46AqcyneFoS/860P/U/hp6rc3gbW7/mvRzdQnYGbRsHL2CAUc28odwPn4fazi2RTPaFNoGsuMZL4mllJHquJghTQ4H5cVvxcGFVB6vMG6+9R3SCqNVSxeqsSJvZlctTTM8/Bfrncd3oidScI7p7hWa//zMhi+H4lCF1vO5sbWFTuN1evtxpt89JZzoflXPgf2ZAAmjZDHArocuRd1a9DzvZOVwZ12quw3fUXZdd0279NQSJMM+6LudABkUpOutNTZtlq8G9XwUrIEyAOEnnH8LHn3eByxpPWW5/fvJGW9VoVk5xB9DaSF22fPUtNlhT9WcaxoR0Bo70Bgu09YxJgS5pihpcMl9Diut22JET3boG6gG+EIG9QAFRZDQatfttvA83XiMX5mRf/GzrQoRWeDA1xyQTodokJns4as5IgGCkNstjq/zd3yGlb2p2PP7v1WQZA2Vc7ZMScP408hPiFqZtivrHGH3CGZagjWKvn4Cp18AylaxyyYBRHptwzncpZrSpbJ0YCM8pEyFS+W3fCe5QVO0tTfByqkokZJzDW+XECGgZ1WRXg/RD6sOoVr+CTOZFy49XKSHbFxga2M2y7/NwIFSH5NNzlPGowXfqMCwA7Ch85aAV21jEm+ABjzNMT7LjzvICLnTS9BOVMoo4iO8vqiVqn4hdDJaPOvCN/SuZzvVgUvexFwUnKn3SmM5JzGT/iKMPCvY6fU6llNpb+W4ntbMy4w++TXS+PANqHMkNo+Ps71fi4d/dmHkdhqJlUqLt3dRMdObhXueUYInZYebKmxt805FxliIRB1HnuHCP5H75qqwlyxzMwhmgZEkUHubqQNQf6MNYfz6xkGn6m1rKXoalukxB1WMPQ9CG0Rw/3qcquMpRoqC8kwRvlluA/d0667ugJAU4VGEd0eqI2/w6qy8Dt25XQ5pBBr3FrL/wvcpS4vQTu2lGmwVqBjCIs1wmUj3CnQxs6Xce30BSUtDKCBORQ4geSUnONtMfjopi/Lp+AHX7nMZz/5Cryk49FVLf2eJ X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: ffd2f892-d1ef-4dea-c9ee-08d8cf279e3f X-MS-Exchange-CrossTenant-AuthSource: BN8PR10MB3570.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Feb 2021 07:27:14.0129 (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: mUOeK3ISzpWovoxN4PZ1sQcikhEw5Fxf6NVJQyg+ayCyx9PFA1f1NltjkwcZ/ErO8UhF5g96YBe5ThEnmY1Dv0oMU6fA7aMz75PdfMNEZBE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN0PR10MB5254 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9892 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 adultscore=0 mlxlogscore=999 malwarescore=0 bulkscore=0 phishscore=0 spamscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102120053 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9892 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 mlxscore=0 mlxlogscore=999 spamscore=0 impostorscore=0 malwarescore=0 clxscore=1015 suspectscore=0 adultscore=0 bulkscore=0 lowpriorityscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102120053 Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org target_core_iblock is plugging and unplugging on every command and this is causing perf issues for drivers that prefer batched cmds. With the last patches we can now take multiple cmds from a fabric driver queue and then pass them down the backend drivers in a batch. This patch adds this support by adding 2 callouts to the backend for plugging and unplugging the device. The next 2 patches add support for iblock and tcmu device plugging. Signed-off-by: Mike Christie --- drivers/target/target_core_transport.c | 43 +++++++++++++++++++++++++- include/target/target_core_backend.h | 2 ++ include/target/target_core_base.h | 4 +++ 3 files changed, 48 insertions(+), 1 deletion(-) diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index d782d3a0f9d5..45bb5253461a 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@ -1796,10 +1796,42 @@ void target_submit_cmd(struct se_cmd *se_cmd, struct se_session *se_sess, } EXPORT_SYMBOL(target_submit_cmd); + +static struct se_dev_plug *target_plug_device(struct se_device *se_dev) +{ + struct se_dev_plug *se_plug; + + if (!se_dev->transport->plug_device) + return NULL; + + se_plug = se_dev->transport->plug_device(se_dev); + if (!se_plug) + return NULL; + + se_plug->se_dev = se_dev; + /* + * We have a ref to the lun at this point, but the cmds could + * complete before we unplug, so grab a ref to the se_device so we + * can call back into the backend. + */ + config_group_get(&se_dev->dev_group); + return se_plug; +} + +static void target_unplug_device(struct se_dev_plug *se_plug) +{ + struct se_device *se_dev = se_plug->se_dev; + + se_dev->transport->unplug_device(se_plug); + config_group_put(&se_dev->dev_group); +} + void target_queued_submit_work(struct work_struct *work) { struct se_cmd_queue *sq = container_of(work, struct se_cmd_queue, work); struct se_cmd *se_cmd, *next_cmd; + struct se_dev_plug *se_plug = NULL; + struct se_device *se_dev = NULL; struct llist_node *cmd_list; cmd_list = llist_del_all(&sq->cmd_list); @@ -1808,8 +1840,17 @@ void target_queued_submit_work(struct work_struct *work) return; cmd_list = llist_reverse_order(cmd_list); - llist_for_each_entry_safe(se_cmd, next_cmd, cmd_list, se_cmd_list) + llist_for_each_entry_safe(se_cmd, next_cmd, cmd_list, se_cmd_list) { + if (!se_dev) { + se_dev = se_cmd->se_dev; + se_plug = target_plug_device(se_dev); + } + target_submit(se_cmd); + } + + if (se_plug) + target_unplug_device(se_plug); } /** diff --git a/include/target/target_core_backend.h b/include/target/target_core_backend.h index 6336780d83a7..aa5f83e55501 100644 --- a/include/target/target_core_backend.h +++ b/include/target/target_core_backend.h @@ -34,6 +34,8 @@ struct target_backend_ops { int (*configure_device)(struct se_device *); void (*destroy_device)(struct se_device *); void (*free_device)(struct se_device *device); + struct se_dev_plug *(*plug_device)(struct se_device *se_dev); + void (*unplug_device)(struct se_dev_plug *se_plug); ssize_t (*set_configfs_dev_params)(struct se_device *, const char *, ssize_t); diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h index 5e6703ca102d..b8e0a3250bd0 100644 --- a/include/target/target_core_base.h +++ b/include/target/target_core_base.h @@ -769,6 +769,10 @@ struct se_cmd_queue { struct work_struct work; }; +struct se_dev_plug { + struct se_device *se_dev; +}; + struct se_device_queue { struct list_head state_list; spinlock_t lock; From patchwork Fri Feb 12 07:26:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 12084857 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C8DADC433E0 for ; Fri, 12 Feb 2021 07:32:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9CCE864E65 for ; Fri, 12 Feb 2021 07:32:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229959AbhBLHcN (ORCPT ); Fri, 12 Feb 2021 02:32:13 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:42450 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229924AbhBLHaD (ORCPT ); Fri, 12 Feb 2021 02:30:03 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11C7P57A016723; Fri, 12 Feb 2021 07:27:17 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=vkI7pVbjPpUYMdhGnmWZkin4Vzj3OtMnjwsUvl1/w24=; b=RMKUP9acNwEt8OiYbdJELk4qwh1hItm/OpETMB3QN4lHoy94Tye9l+C80H6Tdnjl+EE3 /BBbKkEcfYuXam3nl5E6uxS99jxiwHbirmwD5Qm49nvXwCW2vw7lPmyx3P1NgwTFf01N Y0TdiIYgNYeuKK3VzxJBF5+FzVoHsWQHa1Km4nnlu/ALDT7cherxk+So4yg7jI/NbvWe YiBRteE3k6bnGPIBkVeIRr7Kw2z7Vhy5QNmI/aPoF3zUoSHCHWa4faxRuA2LpJ8Ku80Z c6vG4RaMsf1NgOjhAP/JqZrorwhTgwg+0ARwu0xNba2KCa3DElfArwogIRGZx3q1seve OQ== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2130.oracle.com with ESMTP id 36mv9dvcuw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Feb 2021 07:27:17 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11C7QA0W090287; Fri, 12 Feb 2021 07:27:16 GMT Received: from nam04-mw2-obe.outbound.protection.outlook.com (mail-mw2nam08lp2171.outbound.protection.outlook.com [104.47.73.171]) by aserp3030.oracle.com with ESMTP id 36j4psn5w4-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Feb 2021 07:27:16 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CpVePgyJFJSlnoXjIckIeTo54U9rleEgIVX7iNULYPdtKAhjTIZP/ZDyvkA55Dn8Aj8oqkQ0NcoMFrT7vNqjJNdlZEo28BQTuEQm5LEnhJshE3l1HJims5v6jPDRP4Ga0BlsKEo3TirVlHnCa1Up9SxOSTRQLzOJcpsdf9dpzly2cpQdoOPZFoaRghWuRmrcMBG+1uB/af902OXBRWO+k6WjlG2fUp+tf67XdaYwVs6p/Gvrvehu+OJ+9wd+NUU56Xq1HNcn5ZBHG1wzaDoRxu+WbXj5oIBNAMJfPpQOf25tsgx2umMDNMpl+5eCn5rWquktsF8gBZwiPprQbxdIqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=vkI7pVbjPpUYMdhGnmWZkin4Vzj3OtMnjwsUvl1/w24=; b=X8b2xVSK5pWWL+3SwMbwQc8sl0AdHh7cz3zuuxGftiTTuTjFUrNa6hVA1Qvo/4nFr4ykbdy3m7e7p/cLTpdwukRC6G77OzkSJclXN/Z4TPzUk4fbjZOQQrnUGTc49DJi2b0GOGPk58ECQMJO++uIMww537tZHCiY/2ESPdiuzsCVs6h7oSzAn9CARdalmHpDo6pwHFeQobj+TvpGe63hrAjSK7C6bjpl0qbdPAV3tsDeIDK1k/QBS2Ug2/OBRuuIOMztroLplvAudysx3pZFp/RAMXO/sG0MDe2nmPrMiKxSMbRI7RjcaQb42Gb9aRqNHO/QqxoGmlbI0Ft3/o/OtA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=vkI7pVbjPpUYMdhGnmWZkin4Vzj3OtMnjwsUvl1/w24=; b=W7JA9dvGNJAQDasJLFyRTH0Z1SxSwF0DOVkrhUem7JzaUv/aWd4C/4Xx8rxnYPyC+eeEndzSr/9cWPYvOvIQ9Sp5uUPdFFF0YD73BIOrFXpo3XAQjrHJraPh6qmzJ7LuzB7A7oPp3UlhsVohubAZq8/bbvkxG4Vyn+DgTX1tJmA= Authentication-Results: redhat.com; dkim=none (message not signed) header.d=none;redhat.com; dmarc=none action=none header.from=oracle.com; Received: from BN8PR10MB3570.namprd10.prod.outlook.com (2603:10b6:408:ae::12) by BN0PR10MB5254.namprd10.prod.outlook.com (2603:10b6:408:12f::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.25; Fri, 12 Feb 2021 07:27:15 +0000 Received: from BN8PR10MB3570.namprd10.prod.outlook.com ([fe80::513a:2259:52d5:e495]) by BN8PR10MB3570.namprd10.prod.outlook.com ([fe80::513a:2259:52d5:e495%4]) with mapi id 15.20.3846.027; Fri, 12 Feb 2021 07:27:15 +0000 From: Mike Christie To: mst@redhat.com, stefanha@redhat.com, Chaitanya.Kulkarni@wdc.com, hch@lst.de, loberman@redhat.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org Cc: Mike Christie Subject: [PATCH 22/25] target iblock: add backend plug/unplug callouts Date: Fri, 12 Feb 2021 01:26:39 -0600 Message-Id: <20210212072642.17520-23-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210212072642.17520-1-michael.christie@oracle.com> References: <20210212072642.17520-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: CH2PR14CA0050.namprd14.prod.outlook.com (2603:10b6:610:56::30) To BN8PR10MB3570.namprd10.prod.outlook.com (2603:10b6:408:ae::12) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by CH2PR14CA0050.namprd14.prod.outlook.com (2603:10b6:610:56::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.27 via Frontend Transport; Fri, 12 Feb 2021 07:27:14 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 97ee0b81-b974-419a-7624-08d8cf279ecd X-MS-TrafficTypeDiagnostic: BN0PR10MB5254: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4714; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JmyaP7XudJQHJEB2ZdGn/SbjeGP3xAaJNUn3XAaR97oo5tgWIs2yxlUwGBJtk0qpbCtCgOfY6JCBJPvyavhrx+s2c1AJGU0zZFiTjmd+Bl9vKvEYQ/NG+kULiTTHmM540F4MrDGU9cfXLGheuGvSVRIJ12+CeJwmIqXSXISELybdbTOnPoMdTjZFofWEwfdbGICZcwbE3aWKCS/v9VW+BY8LmHDzYu4C8Ml6wSmjHfNqrk5QZgYLZQrtBtW+1oKN7tRQMYyiv+48TxJY6kbCI+i43+GuYYD5R9FF2LZYUYJE+clnyj5DXTSZPB1AvR9VyxebD0fmgQDcZv6BH1Rj4/2a9RClUmUy/gI3tu5TbDvGepsvAnpNm0TxVat1/lItq6XDO45vcbEzCLeyebiD0r6gt4w5IJ0utrp8fv3clzt0Uk5qOQjXBTUIRzRpZCcHkRVi+drj6zZQlBANGa2AzYpQaxduy8l+nwBM6hLRFp56KDjjl+w0h3o58b64Xpqi/qHZUV+CS/f0t277aMx1yzUVj4YwveKZfU8ZHRNTpCv+2M0kJX4yRMM5HvXE0xDu83MyqEQxrQ19ByOdFicLuQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN8PR10MB3570.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(396003)(39860400002)(346002)(136003)(366004)(376002)(8676002)(2616005)(4326008)(316002)(8936002)(6512007)(66476007)(16526019)(107886003)(26005)(956004)(6666004)(69590400011)(186003)(83380400001)(36756003)(5660300002)(52116002)(1076003)(66556008)(478600001)(66946007)(86362001)(6506007)(2906002)(6486002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 1fhuh6yrO3lzYnQNIibBYIqoXmh5xI0WrVuSDRkCuxq1QmNnBuXwt6vmQrBO7XA/vKELz5Vvgdc+Q+GQEAfAlaTH652UlCC6Iv1glGW2sbIC9Xge3lRygjChQ2Zw+60c2+IXVT0oPflKpZc+DKMaf0lJgUO9Rml8GIbAJCJz1+cJ8R2keL7s9tPAhwlLT+DJXcewXbZtWPDd2hgNNDUifoeb+U85mlopur1h4MCinjLPcNT4z0pRUjzO5aqlrklNFuNqQwDhNORQf101aZMHHAB7vCyUFh13s0ir0rtTCWDBGbts+J+vlmzGeQKEqXumC3IIbo3CYxm2KigefoWvmQKU6FtQUmAUpZpfjBlaEvQdBNG9FkqHVJBvyhnIggTHhd8T+zbJIK5XWjmOrDM4OwhRCevkv7EvYVs5h9xLDf9lukDf9EfPkpHZEfShtdcKroJKSCLvQ/EUfqSaJmJr+ba6yYdNlY4zv82JOIwtL1d2vNvcBLq+VK08uK1v9C493LpWU75US1nugUh4cuIen3twdSgQPAVugiQDSi1rQipxutZrrv9Tw7WChH5UDqVbc7W+OY9lfbFZ2H5+ely000TE6+dqXEeN85xlpJ3e/s2wKyYZfqf42mPgtVfWMWiiaTnXX6S4aMCzidvYobugy5fyTAIN34HHJ9Ls3aS+pfQkNrRKO2lbzT+1+5ifYraoO2WMtg5NAy00+SXqVDFdO1HvSOpxISR6u+eJ0LpLS/NWmDCzvBgrztt7JivAwRpgfoQF4nzXSRsdahidw70y+yzMLUYvHWWkKWxNyzRlMA5bDmc+ISzFMDgMmAVRdjWJLorkcuCDYfZrfdzqwI24vgpZspqSS4gyKigP1tV4S71Y1dvaS+A+hy0r7639gyyxm1sZUIFBvrI1Ohm51gbUjXvArYN8xW024NOWvLaaDW6Ej95ShLKsX4txRKhOz0iAmDGJWYpB2QQIRksuziaIlv18V8jqiuA8xrzLiUf8e8W+yrqPojIcidOeMKhaxuJi9JxdLwn/DmwEMgZjgw0n+bPp6fqhcid31/krgdDhYnPr5jejq6LXI3A61WArCI47sENO/28b0edJNkKHf6JUiKOD2BMPpHRgmThUwVfgDt8B2AM+qQJLI9A1c3t04dU6IXHMi18ldAuSmPBp4PFJe0unY6ZU9ziaQjmIFg8wMWgOo/xfx87pQlJvY2W1ouI1ZAjcVd18zpVJbBxLyRpmady2OxgfhykDfVyhYGxRodbvIMNC0ZKIePiEuxl7ZKs+8PqPdt6PiVyuuRVgKIoNFefe81EjnTOiW6QyRfeAh00JvZ/IaTw1q61u2qhJWYXn X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 97ee0b81-b974-419a-7624-08d8cf279ecd X-MS-Exchange-CrossTenant-AuthSource: BN8PR10MB3570.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Feb 2021 07:27:15.0123 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Cpy8qxPGbsIlyEyzBQJ7jjb1mshjHRgjxy9TaKyxw30mdApppNRoLjPurzJfYxfJiYqW8v08ZLpfHK8Ihizra8nVVRM7uSLSH8hUkaiUZjw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN0PR10MB5254 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9892 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 adultscore=0 mlxlogscore=999 malwarescore=0 bulkscore=0 phishscore=0 spamscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102120053 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9892 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 mlxlogscore=999 bulkscore=0 suspectscore=0 phishscore=0 adultscore=0 impostorscore=0 mlxscore=0 clxscore=1015 lowpriorityscore=0 malwarescore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102120053 Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org This patch adds plug/unplug callouts for iblock. For initiator drivers like iscsi which wants to pass multiple cmds to its xmit thread instead of one cmd at a time, this increases IOPs by around 10% with vhost-scsi (combined with the last patches we can see a total 40-50% increase). For driver combos like tcm_loop and faster drivers like the iser initiator, we can still see IOPs increase by 20-30% when tcm_loop's nr_hw_queues setting is also increased. Signed-off-by: Mike Christie --- drivers/target/target_core_iblock.c | 44 ++++++++++++++++++++++++++++- drivers/target/target_core_iblock.h | 10 +++++++ 2 files changed, 53 insertions(+), 1 deletion(-) diff --git a/drivers/target/target_core_iblock.c b/drivers/target/target_core_iblock.c index 8ed93fd205c7..33c88eca090f 100644 --- a/drivers/target/target_core_iblock.c +++ b/drivers/target/target_core_iblock.c @@ -61,9 +61,18 @@ static struct se_device *iblock_alloc_device(struct se_hba *hba, const char *nam return NULL; } + ib_dev->ibd_plug = kcalloc(nr_cpu_ids, sizeof(*ib_dev->ibd_plug), + GFP_KERNEL); + if (!ib_dev->ibd_plug) + goto free_dev; + pr_debug( "IBLOCK: Allocated ib_dev for %s\n", name); return &ib_dev->dev; + +free_dev: + kfree(ib_dev); + return NULL; } static int iblock_configure_device(struct se_device *dev) @@ -171,6 +180,7 @@ static void iblock_dev_call_rcu(struct rcu_head *p) struct se_device *dev = container_of(p, struct se_device, rcu_head); struct iblock_dev *ib_dev = IBLOCK_DEV(dev); + kfree(ib_dev->ibd_plug); kfree(ib_dev); } @@ -188,6 +198,33 @@ static void iblock_destroy_device(struct se_device *dev) bioset_exit(&ib_dev->ibd_bio_set); } +static struct se_dev_plug *iblock_plug_device(struct se_device *se_dev) +{ + struct iblock_dev *ib_dev = IBLOCK_DEV(se_dev); + struct iblock_dev_plug *ib_dev_plug; + + /* + * Each se_device has a per cpu work this can be run from. Wwe + * shouldn't have multiple threads on the same cpu calling this + * at the same time. + */ + ib_dev_plug = &ib_dev->ibd_plug[smp_processor_id()]; + if (test_and_set_bit(IBD_PLUGF_PLUGGED, &ib_dev_plug->flags)) + return NULL; + + blk_start_plug(&ib_dev_plug->blk_plug); + return &ib_dev_plug->se_plug; +} + +static void iblock_unplug_device(struct se_dev_plug *se_plug) +{ + struct iblock_dev_plug *ib_dev_plug = container_of(se_plug, + struct iblock_dev_plug, se_plug); + + blk_finish_plug(&ib_dev_plug->blk_plug); + clear_bit(IBD_PLUGF_PLUGGED, &ib_dev_plug->flags); +} + static unsigned long long iblock_emulate_read_cap_with_block_size( struct se_device *dev, struct block_device *bd, @@ -337,7 +374,10 @@ static void iblock_submit_bios(struct bio_list *list) { struct blk_plug plug; struct bio *bio; - + /* + * The block layer handles nested plugs, so just plug/unplug to handle + * fabric drivers that didn't support batching and multi bio cmds. + */ blk_start_plug(&plug); while ((bio = bio_list_pop(list))) submit_bio(bio); @@ -870,6 +910,8 @@ static const struct target_backend_ops iblock_ops = { .configure_device = iblock_configure_device, .destroy_device = iblock_destroy_device, .free_device = iblock_free_device, + .plug_device = iblock_plug_device, + .unplug_device = iblock_unplug_device, .parse_cdb = iblock_parse_cdb, .set_configfs_dev_params = iblock_set_configfs_dev_params, .show_configfs_dev_params = iblock_show_configfs_dev_params, diff --git a/drivers/target/target_core_iblock.h b/drivers/target/target_core_iblock.h index cefc641145b3..8c55375d2f75 100644 --- a/drivers/target/target_core_iblock.h +++ b/drivers/target/target_core_iblock.h @@ -4,6 +4,7 @@ #include #include +#include #include #define IBLOCK_VERSION "4.0" @@ -17,6 +18,14 @@ struct iblock_req { #define IBDF_HAS_UDEV_PATH 0x01 +#define IBD_PLUGF_PLUGGED 0x01 + +struct iblock_dev_plug { + struct se_dev_plug se_plug; + struct blk_plug blk_plug; + unsigned long flags; +}; + struct iblock_dev { struct se_device dev; unsigned char ibd_udev_path[SE_UDEV_PATH_LEN]; @@ -24,6 +33,7 @@ struct iblock_dev { struct bio_set ibd_bio_set; struct block_device *ibd_bd; bool ibd_readonly; + struct iblock_dev_plug *ibd_plug; } ____cacheline_aligned; #endif /* TARGET_CORE_IBLOCK_H */ From patchwork Fri Feb 12 07:26:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 12084861 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8EF7CC433E0 for ; Fri, 12 Feb 2021 07:32:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5B7D164E57 for ; Fri, 12 Feb 2021 07:32:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229931AbhBLHca (ORCPT ); Fri, 12 Feb 2021 02:32:30 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:38378 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229927AbhBLHaF (ORCPT ); Fri, 12 Feb 2021 02:30:05 -0500 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11C7PnUu142718; Fri, 12 Feb 2021 07:27:18 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=1iNoXyoC4xa0O0nQ251es2Dfg6INqaheeFO8Sm6kIQ8=; b=CG2Tjt85LbT5MAwQAdvr8l39TDwjJB2U/+clnJ4pRLBILFNGvms4ZT2WwPeieJ/IYQyQ 3qqRdYvqe91TtOO4NIonvSyhvG5otQ/PLJfbPr+P0x8o4XSWw9r4VKa59f9vGIF5XP/8 7kz+qnPAh3Q2ZMttBHQI3C7KlLrNkVEgnytzPR9zdRTkDEwoNjYa+7XN8XnEel8bITQK QH/hfAO/a/sA8/b6JV/O6xsL0HfoYcX+NH+1fvJEvx9TndABK8KbM9Cj1qmieBYCGL/Q TrDiJUnGMFsujhiyG482al3hf2FYNvPqjsgBDRbjTdFsybJ3zTDW+mjT/Q7Bl2O9IBll NQ== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by aserp2120.oracle.com with ESMTP id 36m4uq0qmn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Feb 2021 07:27:17 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11C7QA0X090287; Fri, 12 Feb 2021 07:27:17 GMT Received: from nam04-mw2-obe.outbound.protection.outlook.com (mail-mw2nam08lp2171.outbound.protection.outlook.com [104.47.73.171]) by aserp3030.oracle.com with ESMTP id 36j4psn5w4-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Feb 2021 07:27:17 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KbhUW76vMqVEDctUcoeZudGCDfxkNjoJqTWg1CJG1H0Pw4c67jFlM6C0uSMmeiPue5U5W0Zw4JR3WU26HDDb+OXTpOLPaStJV4TTQg+pUWsSmeiCI62OLlTepZq/3/MmCW1+AiBO0O3omSUoS+wDnAH4SH1GOSR35hrGFdaBtR089x9Ek0v0UMEYNIF+gjo3rlb+pL6uP/AUCtEPAR26OJxLN3QiRwxvdLeDV/juG6vuA3d2zsUS5k3hPFhYUcGxheRozEBrhZywgBtBK5SUyycT3NvL5GNirEsMYYrHkiNyV78yPrhvxbRDr0dzqKbUbv+UtDUzlGXj5985SJnngw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1iNoXyoC4xa0O0nQ251es2Dfg6INqaheeFO8Sm6kIQ8=; b=S9nahK9TqXd6cQfu7iKWGsIc6KwHM2AWYY2OI0hI4L91pyPnU4RKkaaa3njGSO/YLJvG+FXXU2NBED8D/UNrHO+FlUVSnzYlGs2DhXS5R/h3sJpeM1Nq8VmGtjpheEDdUWPv6b/CxSb43cSB0fQKDdDFKtJj/gtAAGk21hFbAkgQnxpvtgP1fMbRe1ZmKvBquhlz5ctT5WUzdZW4pOiF33XwKvCRflBzSwR7QRqE63BA2cGYJ1S+UJ7LHPItGgLRLo2yJ+0LhwMZM4E9yAOjRQxBLECWF7NwfQPql6Nctw54jAUxZozKlTQBdj0FiOdi7iZZHGn3+rnrnJTR/Ynlqw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1iNoXyoC4xa0O0nQ251es2Dfg6INqaheeFO8Sm6kIQ8=; b=efOlhJG1Yg5G+2cmLNQwT2QskBtYuLTIocvdJlPbkvut7IommX8n8WHoSIUCaacdAVh43TFWHKQDAPEm1Q/P0xC52MGvGyrzFVyXnAkmQqEbUYjcuNwvmW0QHCOu90YzM8gAmZhGw3TaBeu+P/bTroU/+UfsBk7vjdvEWCi+sVM= Authentication-Results: redhat.com; dkim=none (message not signed) header.d=none;redhat.com; dmarc=none action=none header.from=oracle.com; Received: from BN8PR10MB3570.namprd10.prod.outlook.com (2603:10b6:408:ae::12) by BN0PR10MB5254.namprd10.prod.outlook.com (2603:10b6:408:12f::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.25; Fri, 12 Feb 2021 07:27:16 +0000 Received: from BN8PR10MB3570.namprd10.prod.outlook.com ([fe80::513a:2259:52d5:e495]) by BN8PR10MB3570.namprd10.prod.outlook.com ([fe80::513a:2259:52d5:e495%4]) with mapi id 15.20.3846.027; Fri, 12 Feb 2021 07:27:16 +0000 From: Mike Christie To: mst@redhat.com, stefanha@redhat.com, Chaitanya.Kulkarni@wdc.com, hch@lst.de, loberman@redhat.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org Cc: Mike Christie Subject: [PATCH 23/25] target_core_user: add backend plug/unplug callouts Date: Fri, 12 Feb 2021 01:26:40 -0600 Message-Id: <20210212072642.17520-24-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210212072642.17520-1-michael.christie@oracle.com> References: <20210212072642.17520-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: CH2PR14CA0050.namprd14.prod.outlook.com (2603:10b6:610:56::30) To BN8PR10MB3570.namprd10.prod.outlook.com (2603:10b6:408:ae::12) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by CH2PR14CA0050.namprd14.prod.outlook.com (2603:10b6:610:56::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.27 via Frontend Transport; Fri, 12 Feb 2021 07:27:15 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9261523e-d005-4c7d-510b-08d8cf279f69 X-MS-TrafficTypeDiagnostic: BN0PR10MB5254: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2000; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: O761EKvGCnfzyXokc5CLuwoeYSneh2upsmrVHl6lnZlqZSumbEEo8I1RiTUOcvCaB7kW9ZFgygRH/W63PV0eOJ5tGbNGvL6krl5su4rMmYTZshuJH1gW/6Eu/3+X2N9HSCQq0PEkBP12r2y5g1RAdOgMKD5dgOk5+m4xhaWPm+RXjv84vKWKwx4c0NSXtfGjR82oa7F6BSyvItZ96UTU4kGwlcj0H2OXEyfW4mpEiDAcqA2YGCBczBDTWHArlDUuT5ZfaoB3qlv41bGLGK4n1CI+LfC18yEWdGoUy8FVkpyzHDUPHHkaf4nZmDzsoqBi4bJ6VYlabyx0Lm8uh374Ln5EMfw2c9cJT4q+UpUzNedbPnTxBjsDRvCNTY+HbDgtj7nvgo0SrrFmxRM7h5s9YRiIkdbIguj/mtK+YyXQXt4fC0D7yJQjsUKkV7RWCoYjDRx8Ug71zbMx+X8+gW9EjnkiNL81sEDH2WQMcUQ/j5vdccGlIxH7UEiUgk6jTMAF6UCIiC5kgc7nO91Cgn5s6bTMGsO0ZH/3teigwDcyKvz6djxrpNN02+ogWHCdlP6W4wPynu/mYlanJD1Xbo3O1w== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN8PR10MB3570.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(396003)(39860400002)(346002)(136003)(366004)(376002)(8676002)(2616005)(4326008)(316002)(8936002)(6512007)(66476007)(16526019)(107886003)(26005)(956004)(6666004)(69590400011)(186003)(83380400001)(36756003)(5660300002)(52116002)(1076003)(66556008)(478600001)(66946007)(86362001)(6506007)(2906002)(6486002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: kGfNDJ/pxX+TsuQQKKkCm78VdB5iUqERC5UTstO4MY3gqTx90tej+DA0zrDjUswbWwFPcutxd7hs1b+6SRXt036Y48SOzUvu5LxU0ksaN1YmfMfK4+IdtBw6iiAIwy2ObjbMp6ECpd3TbdGFpEt5rpzYf0cNiO7ixklDnpvZlp9Pj0KaRVr9Em5P6MrNVMNDWuGfyIie2cKd5xR7eM2dTxZE4BldlACdd/XGNP6MEyO9s5wZpYHIAXs6i806d6nHnV8pRlClBCv8mXkBIFqJKNC10S2QbEsy59IT4v5e6dxp2ed2PKj4PpPcYBjW1Ld7G9kx99BT4GJ1KMEpoNWUFr9s5DrnQUrxD88bT1jtYL9dE6D3Vdmsi5j/s/p3McWbq8HsCWlouOVaTwi8z2ooZtouby4we0m3OkgY96ikdr1Vca+VgE52X/EBO2YnTiKSL2EJuJMBxnniRYyu67zy+Xzn4gPe7YCM3aMAozjaaBoMplKx5De9NGG534JjaC09mfgBvK7msZHNYzuCygphIXeeBmVP7XYLw3xy5Nae5U/CJeXpYKgVs7D1lwj7ueSGq7B45KB3rseLkGfpfGMTZ1kd2d44yMbJTQoVvFLFkz+pMagZrRLfKsG1+z4Ol8UdllGQDcgg/hESxfB90ouM4CY/Kvixbh/DeWEtegII86gqbZToH2NZQV4WllobeHyuF21a49afSS3XR8gYX42VDqyu/m3jBH+4grVTtJgK4Wtvtwe5qgJnyfwcZhpuGJbrHKzRCI+SLA64SBFdzuMt8Vby+YVfL6AwOjxngWQVAwXmB7ves2K+u6wkixDcT7enbHjacIH79+p/q4qH0S/1ldPInqsTbYy5wf4NHaeBVnHb1Zm/lNQoW7S4a2Vw0Qk7sE9ryXefNIxHmdef8yVx/WqI9aCEiUBhxQ73mio2nS8TgACytPHxApuDPjCE92iSsiEmFDQn7gkrFe2Erxf0M0x5DWIDM7jmERJUUR3sjALKynK1IBJeLVpDPt0RYMjzA7lC5R5JtoYzowSoKut6wNu+DQke+6cPcS4b5UC2Pl5NvFkWr5qyGAr9bdowxa8tFCg1/AoXYltW+jzCP9G6C7DQWVEMi9xeRm2szA1o5W/ReKEJrLU/CjnQP+J9zLfm7pAPIhYfik+4utpkCvK8Jc6pv1q2rG+lsw3RlZfTJXEMpskUZSNm334rb1qbRzIJZiwJNfIa5J/KR35LwukMCFeiNUpxvRRJkkiHKLoWQdZEonG2RHTnFdfXAr1wALK3SOyl7dAeKr2Amg3mjKyEqnzX3uwNYWeNKHbxQkeC1v6PVGZsRUxLZLIPv4eB/qMy X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9261523e-d005-4c7d-510b-08d8cf279f69 X-MS-Exchange-CrossTenant-AuthSource: BN8PR10MB3570.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Feb 2021 07:27:15.9627 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 1tPr+OtcFT8h43sxbJ7YaHll3E24fJXJGCgmEUZMmcIm6Dq8aXF0N1LMc2ODNwjyisKa0Z0Wx0jtW8hARKLgiiqEMT5v3535Vz4S+c7grGw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN0PR10MB5254 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9892 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 adultscore=0 mlxlogscore=999 malwarescore=0 bulkscore=0 phishscore=0 spamscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102120053 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9892 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 mlxscore=0 mlxlogscore=999 spamscore=0 impostorscore=0 malwarescore=0 clxscore=1015 suspectscore=0 adultscore=0 bulkscore=0 lowpriorityscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102120053 Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org This patch adds plug/unplug callouts for tcmu, so we can avoid the number of times we switch to userspace. Using this driver with tcm loop is a common config, and dependng on the nr_hw_queues (nr_hw_queues=1 performs much better) and fio jobs (lower num jobs around 4) this patch can increase IOPs by only around 5-10% because we hit other issues like the big per tcmu device mutex. Signed-off-by: Mike Christie --- 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 Fri Feb 12 07:26:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 12084859 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 F1BDCC433E9 for ; Fri, 12 Feb 2021 07:32:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CD37864E57 for ; Fri, 12 Feb 2021 07:32:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229718AbhBLHcY (ORCPT ); Fri, 12 Feb 2021 02:32:24 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:42472 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229928AbhBLHaF (ORCPT ); Fri, 12 Feb 2021 02:30:05 -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 11C7P3HK016717; Fri, 12 Feb 2021 07:27:20 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=nE7X6Y2WJE8jMeetfbralCqoYoDOSmH6oPGYGkLKl6o=; b=Gptjn7KJ9N7PszkHE1dggjs54H23vhlxJp7xjxpm3pWRUgkLQ0wrEWfhicSDCJrGVXBC /OvE89gHI6dAeqBespuj89QfLA/McAK8mHRSVtE9UQ/bFAooeQJe7UARG7LgyWyrU/Q1 4GclLagKTz0RlIfW4A5wu+q/8qkDJD5rVlMIQQjewkR5dGk7Pcn1Cc5wCaAXorrf2uc/ 7XWGfIE4Rr8FNXlOQGztVOfg7JCAczaUWLgdiYLfLXk54xvIIBHqeTCQ/6SGYQ7xU7Uj XX23IibEiJU0+DyJZB/bC5SyQQtzu9jeRFuXXT/+d8gJTAET0V6J+DSaMCcK55RTS9NP ig== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2130.oracle.com with ESMTP id 36mv9dvcuy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Feb 2021 07:27:20 +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 11C7PZdW022757; Fri, 12 Feb 2021 07:27:19 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2104.outbound.protection.outlook.com [104.47.55.104]) by aserp3020.oracle.com with ESMTP id 36j5155aeq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Feb 2021 07:27:19 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LOfk5BlkiTP3Saj4QdBlUujDTPHI7H+Moj0b2p8G9ggSsUrcW/LRfOCos+v0kNQXUSkSp8+VA7jp5IZO55JW/Fj6LeggGCaOG7NtHdNcyEvV6/929MfdsWg/9KwFLbam+x8NcsO/PDkIY18SlsKDB9+W9Puf1q2MK9nlhZJ8PCBURBIl88sr8Kghdxlo6bse9Pbt/FJ3e0DVLbGJBbbIeLrPlQf2LfYiwxftJ0slpvq/t1HjaviZUMF5aUBnRundOzR9JvmY36EVCw7z+54PrvRizpoG+IB28Ujkq4t8K6dM8fMdU2iACv/3IgKSRiTobY6O5mIKf/S0P4AXFbo1ug== 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=nE7X6Y2WJE8jMeetfbralCqoYoDOSmH6oPGYGkLKl6o=; b=g8SY1d659TM3ojVSiIkxAyR/9GIDXurW96NGbcInm7mDRJdWDHIV+I9mGDR/keL2xjhCcTkXUYT/B63gmH4jlcuHUm1Iv3oBKMMmcHYJPWDH0bFAGnW4cYiFUFA6Q7vBQ7XePgZW5SNAu2Is4MulwMnyPeA5IiMrJbDqN0rkNVRPjAhoWvKkSfsTMS52aw4mRudiUhn64jl1qQNG6JBI8wN20xK6e9fStMWnG0WEVH1tsrSZokPV0ZUmsFGv/fI55kLBbUk4cXe3mMPV36WoLMYPIV8ASKFMBkWi6+Lj+0uhlB302SsE6OE5B5u8Y7IJvyaTf1tZAZq4eJw43x33iA== 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=nE7X6Y2WJE8jMeetfbralCqoYoDOSmH6oPGYGkLKl6o=; b=rpX8KYuAOmO/Z/sN9piVK9JsfXr9tZl90DhqCJbJAoG8VwyLu/MPahX/W6R/vTGrlcvLN5qotK7fDaVmiKVdoJRAVYd4HT0HAIkcKQ4Y/xY+wO55/K1q58EJ6W/up+366tXmWn1PmsHF59/iHwvlqWghAr0YQKnX0+OigQcD9AI= Authentication-Results: redhat.com; dkim=none (message not signed) header.d=none;redhat.com; dmarc=none action=none header.from=oracle.com; Received: from BN8PR10MB3570.namprd10.prod.outlook.com (2603:10b6:408:ae::12) by BN6PR10MB1940.namprd10.prod.outlook.com (2603:10b6:404:ff::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.31; Fri, 12 Feb 2021 07:27:17 +0000 Received: from BN8PR10MB3570.namprd10.prod.outlook.com ([fe80::513a:2259:52d5:e495]) by BN8PR10MB3570.namprd10.prod.outlook.com ([fe80::513a:2259:52d5:e495%4]) with mapi id 15.20.3846.027; Fri, 12 Feb 2021 07:27:17 +0000 From: Mike Christie To: mst@redhat.com, stefanha@redhat.com, Chaitanya.Kulkarni@wdc.com, hch@lst.de, loberman@redhat.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org Cc: Mike Christie Subject: [PATCH 24/25] target: flush submission work during TMR processing Date: Fri, 12 Feb 2021 01:26:41 -0600 Message-Id: <20210212072642.17520-25-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210212072642.17520-1-michael.christie@oracle.com> References: <20210212072642.17520-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: CH2PR14CA0050.namprd14.prod.outlook.com (2603:10b6:610:56::30) To BN8PR10MB3570.namprd10.prod.outlook.com (2603:10b6:408:ae::12) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by CH2PR14CA0050.namprd14.prod.outlook.com (2603:10b6:610:56::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.27 via Frontend Transport; Fri, 12 Feb 2021 07:27:16 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 15345588-e9d7-40dc-da00-08d8cf279ffd X-MS-TrafficTypeDiagnostic: BN6PR10MB1940: 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: bNly+06Y3i0LDK+ICFiz/GmqqGfCOvyIihkcJ3dCDjBgrKL/z8I+RwhWsAB00j8ht8f9HN3Yz1Ipt53Fa7Mei9WGN1A306kvZC4gipKuRfvrtAS3duOUmc9LWBsH6dnoEwTWYMSwn1/MNFGhWe9wpfw6gMj+wXTYBrHN/hAsFBlxiyqMVayH7Urk7YHXvMDZCymqeAjtSTo/blgWpoh6h5yTjplIkdMZ7G8si02nJyi/cKt0LYd4B2CQjTYlJE12WO7kl3o2EQePVZODNwrvhwe/MBVjpSlFg8ES6Y2mDblDWkCu18WHwKoXZr6VoMBJzL4OqvGlMQu9H/fB31WPkMwFMHtVjxTBLXfta/JOYh0Gzo1QQJQsgEc1XPaf7YFXm17IeeHLr4E1FNR6pXmsza0b/Zuc1iMIoWNzW98G2ii5MPt0DHff3QC+wHV/roTy2GUwGHk6duiqC23FxlTmWhV3nwBN893x0ouIsiZqKKQuyh8W52oeCtHAEYvdbsh21vm+7gca+BSH7t6FNHQ946jW/+27bjYq3e8ayYiYay9n+z0RNUed7U7SppOqVSsTLhfZtMlHCf4Ja+OVB1uAUQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN8PR10MB3570.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(376002)(39860400002)(396003)(346002)(136003)(366004)(66476007)(66556008)(69590400011)(6506007)(4326008)(1076003)(2906002)(5660300002)(86362001)(66946007)(2616005)(26005)(8936002)(6666004)(478600001)(83380400001)(52116002)(186003)(16526019)(36756003)(956004)(6512007)(8676002)(6486002)(316002)(107886003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: ianREo9lIATaImCcltiNG+yS0afkf/tWjl55NC7pba4fg7gWazIKghSSvFvJL0nSAgp0xo9t+Qb8tUT4EgH2itPDJtrT4Fyubzl8TZajvmVHAsDPNEH3scoxMB/dhELaIUmmv2jQNS7dJVUpe4FWRljIe0pRClGkigu2CLjvVagH5FHuj390FF6N8QR88VYnhX7qTW4jt1uwJr96FspGEMM6TJx4gzbzaBFIv0U3mNAhzghOOcvxzOGmoANGT893ltJEIgktLMMwwnUWVDH1RJMowzeC2432oHCd0WJuYaD8VEphK74WoaIU+ZzeF060CwKuLdt9lGYJ9PkoDt8kDj2cv3BR9BSQUa1FnSe123wzG9EgwmRYAc433gZ4r4dN/XRplc583+Jl1wM/27X5hgk8VOHkt0f+jf2HOxyInv+XPpDXf8ADAjusknyFbowu+6mLPDbBNmsvetNX0khZ8KTcUeSqZs7I6Np0RZ0dy4Ur4Wv/cy0ayQW6/hUsQJEcXvP5jB2l9DDgpdDJs9H9k6UADnxieyXA+7Y3EqqREuCBKS1RL1ihtATRuSlHm6kUxArAqeDf0DIJ6Ad9pb6RBnGyicSJuwc3oVqePvNB2i0oNRhdoTaTi6AYSpIxeYJReQ8AX1P7ILlWTN39cLLsc65puRfGtOVEOVuz7jXo4xB0RCi9OYvZWeMKHng+6V/3jblU/ErMTCQ7hP4vKSuN1zvXALy2tJt5aH9ZnxhXec1TZGw670zknDf0m7fANn5MceWeizYQy8ncUo9RM18DNgCVANMCp+awzUIvQVyvYa7okTDaWbQZxFo3ZK2jxg74nFR0OWvRtGRI34t1rdqeqpPjrjLNy7ey1XrXYn1jaPWL9eHvggFwL1XgZXOIMPq13Ivlnbj260vG5XPQyD7Z0l3BTPirKxNVMKIhZkH7cgISmq1vGMv6tJ7CM/cimes1pW8jHykZMmkc0LXxLrVgVvnp/tQnU1Z79FRh4P/+maolS4nXpXoluaAW3ruzvn/TjHf8VN+gdA4E+fZxPCkF8xMdVT/1R02CsVc+HqgKUzT32u94ETaenr0DKU5OF//JswDgh/QwVDVdVa83c+j7LRZkU+Dd8hDkcM78DWptaYIFcYbmbY9r8WlKX8n3fy2tvQdBucExpdpJJwELy/M/jQQFGcKbBRLLweKl75zRxeKyG2ThVUfSGihL79sWCo5C45stuNbyouo7Fd5hfLEBU8+ye+5NQIHocYZbpzfsbKPrDNCwM4rGKpIRB3NApnMSVk8rlt0AdvAw6QP25qBBzHYQHhE/WXhoVBJ1IyEHl5HPEymG/Lav74j1B8I1XwVP X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 15345588-e9d7-40dc-da00-08d8cf279ffd X-MS-Exchange-CrossTenant-AuthSource: BN8PR10MB3570.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Feb 2021 07:27:16.9881 (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: 3Ybge9Oeg/gWhyygbYtn7qDqOz4QT31O7B8P2tuTDApnpwPas5u1MkJO1IkY9uc5qh+QVZgve5EuMW5SfRfuUziE6O1vmpV+1eCa0Ya+96w= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR10MB1940 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9892 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 bulkscore=0 adultscore=0 mlxlogscore=999 phishscore=0 spamscore=0 suspectscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102120053 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9892 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 mlxlogscore=999 bulkscore=0 suspectscore=0 phishscore=0 adultscore=0 impostorscore=0 mlxscore=0 clxscore=1015 lowpriorityscore=0 malwarescore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102120053 Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org If a cmd is on the submission workqueue then the TMR code will miss it, and end up returning task not found or success for lun resets. The fabric driver might then tell the initiator that the running cmds have been handled when they are about to run. This adds a flush when we are processing TMRs to make sure queued cmds do not run after returning the TMR response. Signed-off-by: Mike Christie --- 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 Fri Feb 12 07:26:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 12084863 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E2E25C433E9 for ; Fri, 12 Feb 2021 07:32:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BD04F64E57 for ; Fri, 12 Feb 2021 07:32:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230014AbhBLHcf (ORCPT ); Fri, 12 Feb 2021 02:32:35 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:38400 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229929AbhBLHaH (ORCPT ); Fri, 12 Feb 2021 02:30:07 -0500 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11C7QP6W143145; Fri, 12 Feb 2021 07:27:20 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=mPXo06X4W85AeXegWWjF7yJgVmVCDbvA6sxjbWjsI+M=; b=io94zVX2S+zZynf5ItVY4FitEjrxPyAzWAgAKAt7SNnP/qPMj1aU4Q3Pppm5j5jhuq/W f8t53ZZ8lntiGKgzR52zYEkqLaRdh3T3aL33I25gAuH6kDreRewNhuT2NM7QnZmy0+vI wguC1CjM6ccTH/qBYsA58jrf2a3/RMEpO06STHD6u8u4ManplfWJkyUjVxHqUClgSlWM MVRZ1GgOyG+PlgKNWCbsArZy9o9BMMzW22URB65Ea+kxlA/LH1qaifC9uxXKnTcU1Rdl w6n35hb6kR6IygAHirWCEaxaZiL9+HsNKkNbjhAtZ9IvbtE6J7Cte3t4dIT94oGjVK15 WQ== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by aserp2120.oracle.com with ESMTP id 36m4uq0qmq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Feb 2021 07:27:20 +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 11C7PZdX022757; Fri, 12 Feb 2021 07:27:20 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2104.outbound.protection.outlook.com [104.47.55.104]) by aserp3020.oracle.com with ESMTP id 36j5155aeq-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Feb 2021 07:27:20 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=m0GVI9GMiRSgiqSHsqB5iX4DgAHP9wFcZnyZzLTjopIRjTpuQJd4s6FbvAdtuz5jvLbKo91WBMtyPUE+DFXVDFYzFBjR62eCDb/YxUocMbPzVOD4vgb29pP5qlUUGLEzxmF/qWGAB8N7cDy3tnUXCaIUJxRx3JI8rlgsgb+ThnVpq2Obn5lPOWLrmavSKM0/FmTrO9m364lB5HUEdVoCDnF3RmpR+Qmwh+d2rE2aSNDrkVMq/Pfqh8J32sQIHWb/RjeF6jtYQ8+1+J/J/4i+xGib/jP9DN9J7/2jucvOs15K1mzfbnTzYU3WykZag2TRMH3VICFEPVpUloTjJGHP7g== 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=mPXo06X4W85AeXegWWjF7yJgVmVCDbvA6sxjbWjsI+M=; b=gEyYqMnJ1ZCPVVyiO38+gqDNIYNh52VuL+ED8XUlwgUm/tl18DBIV2kz+fE3kFoFjPZkgQdknvs6lFuphpqymQNnI8nCkQZxFKStdFrRQBgpfoHLKRadeSmVTUzwoJx2KgUNzVfalXDryn3Nxv+Snh8as4exx3T+Wn19LkWyWVbOMiTYkq2cWgy4OTSDhee0qmDvAa0okqehlq0EZ6eqV18gvwJWgBisvKGvzoN8WTe1p4G1dHAsEv8OVF5GONjaxcUJhRHg39CusQMFy6v+5aUgeR8CxSewt6VXT5J1gbMmgDdrl905HmpK0XPPCkLlo7P8NjzhaFjmj+VzhB+1nQ== 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=mPXo06X4W85AeXegWWjF7yJgVmVCDbvA6sxjbWjsI+M=; b=bpTD9clxdrGF9HxCQB7bef4UHo0BVYUkGuWBrXiWbogPvX3ZjjXwplkhMYPVaqXEhw36f7FJNNHCxbYibRfXZTXxVhl316eOWTaTnMXylSqpBhxEIvsAUtzEKCu0vOGuNeL6WhT2ubASxfj8b+dLCuCw0tFQnyxxyQe9zBev2gY= Authentication-Results: redhat.com; dkim=none (message not signed) header.d=none;redhat.com; dmarc=none action=none header.from=oracle.com; Received: from BN8PR10MB3570.namprd10.prod.outlook.com (2603:10b6:408:ae::12) by BN6PR10MB1940.namprd10.prod.outlook.com (2603:10b6:404:ff::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.31; Fri, 12 Feb 2021 07:27:18 +0000 Received: from BN8PR10MB3570.namprd10.prod.outlook.com ([fe80::513a:2259:52d5:e495]) by BN8PR10MB3570.namprd10.prod.outlook.com ([fe80::513a:2259:52d5:e495%4]) with mapi id 15.20.3846.027; Fri, 12 Feb 2021 07:27:18 +0000 From: Mike Christie To: mst@redhat.com, stefanha@redhat.com, Chaitanya.Kulkarni@wdc.com, hch@lst.de, loberman@redhat.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org Cc: Mike Christie Subject: [PATCH 25/25] target: make completion affinity configurable Date: Fri, 12 Feb 2021 01:26:42 -0600 Message-Id: <20210212072642.17520-26-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210212072642.17520-1-michael.christie@oracle.com> References: <20210212072642.17520-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: CH2PR14CA0050.namprd14.prod.outlook.com (2603:10b6:610:56::30) To BN8PR10MB3570.namprd10.prod.outlook.com (2603:10b6:408:ae::12) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by CH2PR14CA0050.namprd14.prod.outlook.com (2603:10b6:610:56::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.27 via Frontend Transport; Fri, 12 Feb 2021 07:27:17 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 85defd71-741a-4f23-fab2-08d8cf27a094 X-MS-TrafficTypeDiagnostic: BN6PR10MB1940: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: S+kty8AYSwqW5WQw1SsM2BI/kh3H7B2L859A8pksMUuEUzOG3wc4UJ5Su3zwGbZRmRes9HEuiglzsk4IaW+PXj1RCFyozEaY4BBogurmk0rhpf998GdIGCFFa+bkQtO+DFfGCVLS3TMHbAd888EuAUtNsjlIqcL5fl5+6XhFRnVaa1cMXvDQozNoZxhCoCcJWkCdP4odqiKsWceeKSh2qWFVtpLGp74LQ82U2+UcVD+Wu2blK2/q8rFbFCOQh/Dpf6w9GP0cfzwSb9qaC4DSiKQ/yclqJ97dOw3wTO8ROOGXYiyHpkbhpKsZHFAVBU8HmqbiFfnVJ7ECrum65M5N+w3W+A9P9s4GP0rUgRmyFm02o0wsjZLI51wWSR+SZDBRINUNbXJgZxjos38gfB8D7vLQP9cyp+qJ1a7rvxPupBrZkojxvHXsEYTTHRpXKxco7HY9Ni72YtmFKInVAF9NhLH/1YS26vWxW7FkyOrzk2IKnQJc8S9HvUpMXBR9nq0d+MbcJOYKzwk+u2ysXZX4LzUIEwuhhGhGe2+AmcACpg3wV8Rg8jA39LqGve5k4Q1pMeO7m/NR1O25VDKfEL3cqQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN8PR10MB3570.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(376002)(39860400002)(396003)(346002)(136003)(366004)(66476007)(66556008)(69590400011)(6506007)(4326008)(1076003)(2906002)(5660300002)(86362001)(66946007)(2616005)(26005)(8936002)(6666004)(478600001)(83380400001)(52116002)(186003)(16526019)(36756003)(956004)(6512007)(8676002)(6486002)(316002)(107886003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: unz0NiM4ff4lB7Efr5Z6c5XNRvxkoGD+3knqWV063kW4tQ8v1iEZEzO1FHLecuHwISZO77B2+DjQXkfP4N7RFCL143t+yc0kgs8Iu4tY3nIMfZ9YmKTr+vchjBExsdfHcG1Yd9Hs98hRETm62mf5FkYG7dTwgwgkuZOyD4Chpo2YnRdxTvbOkvEljGG6z+cNyDcnoNLaJ73tVV9/14F25WAb1YeXa6FUZLYZWG3mJ0G4Wn6e0CdPV7dquMY4/jGHlVRcpwTZQup9IEEc5nbxTsVx++pGeG1/P9a+pvPMTTWhlX/TTo6zf+ORClDuZgkv73N6dFlnPeyg0pwlpn4WXKTNxI03Qi96hWa/wnmcJJd6E9pAu/V0Qys1/vl5q6g/fpx8SNQYLz2W3ApY3cwb2KKve9qRIPTlK9LrARkhh9elubkykpizVW6Dxum5v5z45+2joHcbksXjTc5I1fWvDh2I/C+PqRGZeyEK1X+vvQaBmdBO3hX8U/B262aeqc2NyrHqUGvN8CKW1BiEAkZ00dqeAC7pemeZxWFtkvuYpA2DlmTPjHDq16ed5fauLsgZvqKezT4mQyX0g59D5BQLzOUPbO3dw1szbnlvRzSHeWkufr4d3ETd3IwYGHfZFy7Qf8fh9mjxp/2kEXMxgQb6yBKEVlwIX1HCpHPxf7Kb8jZ+3VPQN5X1SvifE8VacAeRCwdygyIR5FskB9AOJ7exk7mVclJ03qXoQt8kksSiCZAAmKQyEz/XZXtyogU/DbRqXEnGN8lyFuFSo9+7+pTKar7u/0vb6RkDiudTY0Y11HUP+OHP/SNbGM0+qPOBpBmxiP5ZsV3Vn7/MfT/jO3qeTyZ6sQd3FRJsvSQOAFlLZ5Da1n97w6B3tkczFhsj4r3GnCM1SbQDheGPGssc0zKHdx23rycGBNyQ9iNDRM2i0IFNpU8wnlNTJSsMdIDiMIkOCpA0rMqJZSd+squJs7S+x2ThyjP6VD7lSu4lKk7auEL0us3EDJwk8e60bhOQyv9GjD+3/lTb8c7XuKNAZsCPzuxMyNqQnw5TnfPqUmDjzBCwOYXpfYUe4tmpBj60NrJWRYTU3WEry2Z+nYCycmjcWWK6oatL6hZHeUN547sUYT6EaWprpmoIWuO/LA8Ngfu7OZglOS5fVZ63iqWkqLTBDJrE59obzdKjdHbEJt5w23/jvzWfUbhZP5OeyS5cbIVID6cPqvXWUosCK3SV1L+ovh/Xx3f9R82UUP7fG2Jp3yjpzKFx6cVUiCA/6L5wGGAzY3cAoUiCFx6PeI2SaFz67FGTNlg17kgASmyVyVm0vZTd0+zccrSDwj1X8wsmKt4P X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 85defd71-741a-4f23-fab2-08d8cf27a094 X-MS-Exchange-CrossTenant-AuthSource: BN8PR10MB3570.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Feb 2021 07:27:17.9686 (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: C8jyhg9who/lt2xyVgWlqT06gYhygIkhvxm9VTYed4V/J5GmeKQEJPTmra4pV4oPP0BQLkyE/NWgswqUvWC6uwPBbeVMVPqCWGx+SKV1ZNk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR10MB1940 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9892 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 bulkscore=0 adultscore=0 mlxlogscore=999 phishscore=0 spamscore=0 suspectscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102120053 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9892 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 mlxscore=0 mlxlogscore=999 spamscore=0 impostorscore=0 malwarescore=0 clxscore=1015 suspectscore=0 adultscore=0 bulkscore=0 lowpriorityscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102120053 Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org It may not always be best to complete the IO on same CPU as it was submitted on. This allows userspace to config it. It's useful for vhost-scsi which has the single thread for submissions and completions. Forcing the completion on the submission cpu is not always the best thing to do since the thread could be running on a different CPU now, and it conflicts with what the user has setup in the lower levels with settings like the block layer rq_affinity or for network block devices what the user has setup on their nic. The new setting is in /sys/kernel/config/target/$fabric/$target/param/cmd_completion_affinity Writing 0 gives the current default behavior of completing on the submission CPU. 1 completes the cmd on the CPU the lower layers sent it to us from. Signed-off-by: Mike Christie Reviewed-by: Himanshu Madhani --- Note: Christoph, in basically the previous version of this patch which had vhost-scsi hard coding the behavior you asked if we could set cmd->cpuid to the WORK UNBOUND value. I could not do this because code uses the cmd->cpuid to access per cpu structs. 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 45bb5253461a..cf3d916dd612 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)