From patchwork Thu Feb 4 11:35:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 376652 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 A325AC433E0 for ; Thu, 4 Feb 2021 11:38:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 744BA64E50 for ; Thu, 4 Feb 2021 11:38:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235637AbhBDLiO (ORCPT ); Thu, 4 Feb 2021 06:38:14 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:39886 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235734AbhBDLgM (ORCPT ); Thu, 4 Feb 2021 06:36:12 -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 114BZ8e0072968; Thu, 4 Feb 2021 11:35:26 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=J7EsSQpFvTzHYGuBhsrKHKMLJzLhhWIXETntUpwDzDc=; b=PjApFA6elHkZX2JO5rxe0TY9CO7eltpPRk2/sxcD88MFUeW6e5OcU/r87FImg1KNhLB7 3cCSAF0iUW+4tA9/RIAnLA4PAvvE1BAFkh0Rc2hUQ3UOcQOxGTIa+g/MpGuStV7spJYY cd3nCMg7yjs3uIqJ/55cGXD63OJBFyFKG9qTkdxWH9j3LxGHOgi2OezzH7ngAnwWO6g+ Krmr42OTbpVkhaLQvr2iTUa37HvJCzeb27FQ+bd9FXksyox6Ai1UcoRgzDqikEtqOWGK 66Ul/24njm/JMPr85zxclXqMozMZjz/PDu2ocE8+a5t3kH+n3Rml0y5+617DpyE/mjmR uA== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2130.oracle.com with ESMTP id 36cxvr7h02-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 04 Feb 2021 11:35:26 +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 114BYfbP134905; Thu, 4 Feb 2021 11:35:26 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2174.outbound.protection.outlook.com [104.47.59.174]) by userp3030.oracle.com with ESMTP id 36dhd187nn-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 04 Feb 2021 11:35:25 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aOnMnWM0llpJGpLtavQFx40FOMpVBzjsGiPI80qDJyHBo5C+bKDhkATBFnrPv/1v77S/mQ+4u6TSDpZt2J69o8Q8nJrXD+OUAsEgiPvrPckK1gb/ygvRcGFkTU5XzYOZypA6Lg1D6auayuaCKFlO4Lxwgd34if12jgaFE9oat/GELqO4AIUvdOEws/YViJepslmjmOdbNwfbz+5mxf4zDSW1fVSiqhec+Y7kwrFZm50mGYBcEYspbm7BMBEEu3r5FwayEc19cEpqSaKoMJ3TNC5fbXNoz53yVJ62+gbuoCNnFqg6qL50BSVrchJrTcrzBjeifWBdSFZ1j6Y8S7lrwg== 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=J7EsSQpFvTzHYGuBhsrKHKMLJzLhhWIXETntUpwDzDc=; b=Z+Jvdn0PA/UG055GIjk0/CDmFd8n03FJ8QBBquxTaOnhikKtDakn/DvOeGGqbgUJN+i6h5dRM0uoin7blgz2BSwqp+4lqltU6kkKNTHu821Ow7+Ehwa/MjxXo+issDKBOvp6mGvIpW9MnyEcreD4O19Quzwzd/owGE+aZYfx/JD7ml1/FnefURYYuQx0zkUT41+vQZ4jBClfImbqGfM2r9ymL2ZT6TvE8GykP/3MI62o9P7dg22ZhPfTwHiyu6swpQ7aayNzRkLM6K6GiZPMed4qkcW2Nm9RlpKMLY4bxU2Ccka0YDWPqtfRJuwinYmbQ6yPMdypnwrg82G+8nW6BQ== 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=J7EsSQpFvTzHYGuBhsrKHKMLJzLhhWIXETntUpwDzDc=; b=lnapzayk5hhhIS3/od3of7FFHlrNfHxJtCb/tsVqZOg7aWGWnMD2h6JgrNFZDrZcDKrTUqZiuGY6ZduvGGZx89tl4iYqTcVZqEjc+0ipDWCqqzG6tTJ/my/aADZ9qhmSZWtlkHdSrrO0BL6WEZ7qcxQdG1la3uv9RTu8cYefS+E= Received: from BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) by SJ0PR10MB4480.namprd10.prod.outlook.com (2603:10b6:a03:2d7::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3825.17; Thu, 4 Feb 2021 11:35:24 +0000 Received: from BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::1d86:b9d7:c9ef:ba20]) by BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::1d86:b9d7:c9ef:ba20%7]) with mapi id 15.20.3805.028; Thu, 4 Feb 2021 11:35:24 +0000 From: Mike Christie To: martin.petersen@oracle.com, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, mst@redhat.com, jasowang@redhat.com, stefanha@redhat.com, virtualization@lists.linux-foundation.org Cc: Mike Christie Subject: [PATCH 01/11] target: pass in fabric ops to session creation Date: Thu, 4 Feb 2021 05:35:03 -0600 Message-Id: <20210204113513.93204-2-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210204113513.93204-1-michael.christie@oracle.com> References: <20210204113513.93204-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: CH0PR03CA0084.namprd03.prod.outlook.com (2603:10b6:610:cc::29) To BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by CH0PR03CA0084.namprd03.prod.outlook.com (2603:10b6:610:cc::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3825.17 via Frontend Transport; Thu, 4 Feb 2021 11:35:23 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4978084f-07b0-4ae2-d2d9-08d8c900f643 X-MS-TrafficTypeDiagnostic: SJ0PR10MB4480: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3968; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: s3HtciQc+k7nhcUjvQNnxWMVcFX7GaAUjkMGeWvzSI/cQ9N7NWNUA10JA+QH3BXVy2D0626fMnBfL7ggp/2BKHceAx4MjLYhsj8lkVuKzExvX0KZCogJUBwQyGEUO0CzypHflvhX6coq+/BNGCuEbNjRrcL45H7oRj9YxWzZ7gbTI6n/zmEFmGsP9m2ATGlhcjG7XaKk3VGq/HKctWnomJrxg29QnrzKtZtepnA6D9TXDw/fmH4sxj2iB44koYTZ3jZmP8edHihkPfEgxh9KXaCZD0xupugqu0mXHslVtul/bHr+JxDHMKCW3vrM1fXM0dZWcfXa9lg0YWdpxyr3ftELrlbrEgUzwpMAyvW1gOTeKHgjpdj8zaxgq5W8FTlMxXDw7aNhoojNjuTId3ijd6VsRLEk0FqN+E2SpSeZsQMD0yXPA4l8IIgE/X5Rr2W1CkVkg/pVpCVMn1eiqFY9YUaRmRmURbmAPQpCkNstkdsKVuihNzC9uZyJpop+e4G9GlXmROvWRoNbs6ucNSnnVwCUo4PDIFYgeAvFYJS+DJT6OgOLQcW+MpZcTqHzSA9a5ybd8/pr7foP5iBs618nFw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR10MB3573.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(39860400002)(136003)(346002)(376002)(396003)(366004)(52116002)(66946007)(66476007)(66556008)(26005)(6512007)(478600001)(16526019)(6486002)(8676002)(107886003)(8936002)(4326008)(186003)(2906002)(6506007)(5660300002)(6666004)(2616005)(1076003)(956004)(316002)(36756003)(86362001)(69590400011)(83380400001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: r1IbtGSXMzYbMwpW01/yJpN6vHqQXv6uBcyroXMFATs4lGJ6TUPWfagbMbgnauLzbsFGuhwJuy1hKB8rhJzQ9ugmHxkOOSDYE85Eey5VCcFMbRhMoz3SqzaFm/U5nYJqvHm+7QdF7j5UGgp7dky8yQ2yFdltEew6tqz5jxxl2FqOvDQ1C1vaKU0CYT68FfFqSN0OYXwbHlU9WQTZvoN78mve2M10JR80XiEVdFqFXh7cXSpwyGEEceGcc30ufENOpCew5NQEzAozCB0XQKycH79AIvw05jaOAML6r1Zq9wKGO/Lp7jf+mEhaRTkPe8N+vTUtk9ghrIjNZgNYb9v5HcixGDq7yR6jVhasDe1isk5IbLwIqpj3zIzFGWPp7Bf3udba6yLQeZRit7FnbQR1PNKACPtygsr+Zua2gYOeyCOd1ihrtrpd7dKisWPpVQC+M7WgUBuFZzXeV/bp5MEguWfmOWqsF5V/teBNESIXE6gLhVrA8Up76YHZvdwkfvQPzJ3uWrA+g6N+WL885MbIxOHYWcQE1BUe/7R5L82s5L0yEr+rIthzalaa1eQajy+Yv/drt7FNigA09G21jXEntFJxYtNrcGDwNtdVmyiCaHSBKcbUDEm6TZZjfiGgdN1dCsHVHvtOMXmtI6ggwvQLU6l8b4FAwIygNMBUTgBG6g6tkv3RhulzNt1ZVvLPE7ygxbyqoFEAWIVpv+dFC5GTy8Mp5ynkK4mFd7CXTrdXIFE1InsQAZMFzsQUIhWApDeNCkgtTu5i22yD5CYgmfgZ8sSuPCDBp92VlcqhJ7j8WZn3Q4DJ+dL3YaoAZGKwNHHtcytdk/2Rne954L4seZVArRA7/Y4kDAodEhxFqmpY442Un+CvI4Nas1rS4uwzt9tAT56pbgdr6q3FpGNsRp/eOxjFejEY9Wg/k6VGBH2hYX0G9U9RrQbH8jmj/MiLpbZffIljHtFKPJ2EcUNtjdX3x1hj0Xbw1/ngRGkdR0DdPrN8VRdVhfQg+XnS6CGDSrAchkPmi+dqzQ6Hqsv6oyiiHTt/L5Kcr2gr4NU+G14DgIE1GvphbyY5yss/ANP8AWU+ZDnDx5UMT8LEnE2S+ThPG0TjLfSwA/H9Xul2dkPRB+Pf5pvJB3EU4R1EK9BhfaqSA10nP0oz5JghCdVbrCEEen/upphp7Zrh28Twy9ugJdq6nt3c6l9A8Yx41WEM6GYnroz0XRmrZkINpk0knJu1rLPIZoqqlOm8ceKs2OM7HhduZUjQ3Qcr4PbyBO4JMAK73QeEOfSZJarS6Mt+EQabzqhipyjt61d2O7LZ8NwvaQsblEDPePrgyDweHmEIh60V X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4978084f-07b0-4ae2-d2d9-08d8c900f643 X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Feb 2021 11:35:24.4616 (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: Hi59y60ORK06jnkDOO8xcncjYPWOHjUQbVlSahgenbMu8mFcvGqmDWTSFnv9kl807GqxHJ8LUT7psnSXPStHjjLbG/0LKte9AOjKhzrKAP8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB4480 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9884 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 mlxlogscore=999 phishscore=0 spamscore=0 suspectscore=0 malwarescore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102040073 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9884 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxlogscore=999 mlxscore=0 priorityscore=1501 spamscore=0 impostorscore=0 clxscore=1015 suspectscore=0 lowpriorityscore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102040073 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org The next patch will create a session level submission work queue if the drivers fabric ops implements a new callout. This patch just converts the target code to take the new fabric ops arg so we can check if the callout is implemented and then call it in other functions when we have only the se_session available to us. Signed-off-by: Mike Christie --- drivers/target/iscsi/iscsi_target_login.c | 2 +- drivers/target/target_core_transport.c | 24 ++++++++++++++++------- drivers/target/target_core_xcopy.c | 2 +- include/target/target_core_base.h | 1 + include/target/target_core_fabric.h | 6 ++++-- 5 files changed, 24 insertions(+), 11 deletions(-) diff --git a/drivers/target/iscsi/iscsi_target_login.c b/drivers/target/iscsi/iscsi_target_login.c index 1a9c50401bdb..ddf0c3b13671 100644 --- a/drivers/target/iscsi/iscsi_target_login.c +++ b/drivers/target/iscsi/iscsi_target_login.c @@ -317,7 +317,7 @@ static int iscsi_login_zero_tsih_s1( goto free_id; } - sess->se_sess = transport_alloc_session(TARGET_PROT_NORMAL); + sess->se_sess = transport_alloc_session(&iscsi_ops, TARGET_PROT_NORMAL); if (IS_ERR(sess->se_sess)) { iscsit_tx_login_rsp(conn, ISCSI_STATUS_CLS_TARGET_ERR, ISCSI_LOGIN_STATUS_NO_RESOURCES); diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index 93ea17cbad79..7c5d37bac561 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@ -220,11 +220,13 @@ static void target_release_sess_cmd_refcnt(struct percpu_ref *ref) /** * transport_init_session - initialize a session object + * @tfo: target core fabric ops * @se_sess: Session object pointer. * * The caller must have zero-initialized @se_sess before calling this function. */ -int transport_init_session(struct se_session *se_sess) +int transport_init_session(const struct target_core_fabric_ops *tfo, + struct se_session *se_sess) { INIT_LIST_HEAD(&se_sess->sess_list); INIT_LIST_HEAD(&se_sess->sess_acl_list); @@ -232,6 +234,7 @@ int transport_init_session(struct se_session *se_sess) init_waitqueue_head(&se_sess->cmd_count_wq); init_completion(&se_sess->stop_done); atomic_set(&se_sess->stopped, 0); + se_sess->tfo = tfo; return percpu_ref_init(&se_sess->cmd_count, target_release_sess_cmd_refcnt, 0, GFP_KERNEL); } @@ -252,9 +255,12 @@ void transport_uninit_session(struct se_session *se_sess) /** * transport_alloc_session - allocate a session object and initialize it + * @tfo: target core fabric ops * @sup_prot_ops: bitmask that defines which T10-PI modes are supported. */ -struct se_session *transport_alloc_session(enum target_prot_op sup_prot_ops) +struct se_session * +transport_alloc_session(const struct target_core_fabric_ops *tfo, + enum target_prot_op sup_prot_ops) { struct se_session *se_sess; int ret; @@ -265,7 +271,8 @@ struct se_session *transport_alloc_session(enum target_prot_op sup_prot_ops) " se_sess_cache\n"); return ERR_PTR(-ENOMEM); } - ret = transport_init_session(se_sess); + + ret = transport_init_session(tfo, se_sess); if (ret < 0) { kmem_cache_free(se_sess_cache, se_sess); return ERR_PTR(ret); @@ -311,13 +318,15 @@ EXPORT_SYMBOL(transport_alloc_session_tags); /** * transport_init_session_tags - allocate a session and target driver private data + * @tfo: target core fabric ops * @tag_num: Maximum number of in-flight commands between initiator and target. * @tag_size: Size in bytes of the private data a target driver associates with * each command. * @sup_prot_ops: bitmask that defines which T10-PI modes are supported. */ static struct se_session * -transport_init_session_tags(unsigned int tag_num, unsigned int tag_size, +transport_init_session_tags(const struct target_core_fabric_ops *tfo, + unsigned int tag_num, unsigned int tag_size, enum target_prot_op sup_prot_ops) { struct se_session *se_sess; @@ -334,7 +343,7 @@ transport_init_session_tags(unsigned int tag_num, unsigned int tag_size, return ERR_PTR(-EINVAL); } - se_sess = transport_alloc_session(sup_prot_ops); + se_sess = transport_alloc_session(tfo, sup_prot_ops); if (IS_ERR(se_sess)) return se_sess; @@ -442,9 +451,10 @@ target_setup_session(struct se_portal_group *tpg, * of I/O descriptor tags, go ahead and perform that setup now.. */ if (tag_num != 0) - sess = transport_init_session_tags(tag_num, tag_size, prot_op); + sess = transport_init_session_tags(tpg->se_tpg_tfo, tag_num, + tag_size, prot_op); else - sess = transport_alloc_session(prot_op); + sess = transport_alloc_session(tpg->se_tpg_tfo, prot_op); if (IS_ERR(sess)) return sess; diff --git a/drivers/target/target_core_xcopy.c b/drivers/target/target_core_xcopy.c index 44e15d7fb2f0..a7553712da25 100644 --- a/drivers/target/target_core_xcopy.c +++ b/drivers/target/target_core_xcopy.c @@ -472,7 +472,7 @@ int target_xcopy_setup_pt(void) INIT_LIST_HEAD(&xcopy_pt_nacl.acl_list); INIT_LIST_HEAD(&xcopy_pt_nacl.acl_sess_list); memset(&xcopy_pt_sess, 0, sizeof(struct se_session)); - ret = transport_init_session(&xcopy_pt_sess); + ret = transport_init_session(&xcopy_pt_tfo, &xcopy_pt_sess); if (ret < 0) goto destroy_wq; diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h index 54dcc0eb25fa..50103a22b0e2 100644 --- a/include/target/target_core_base.h +++ b/include/target/target_core_base.h @@ -628,6 +628,7 @@ struct se_session { struct completion stop_done; void *sess_cmd_map; struct sbitmap_queue sess_tag_pool; + const struct target_core_fabric_ops *tfo; }; struct se_device; diff --git a/include/target/target_core_fabric.h b/include/target/target_core_fabric.h index d60a3eb7517a..cdf610838ba5 100644 --- a/include/target/target_core_fabric.h +++ b/include/target/target_core_fabric.h @@ -132,8 +132,10 @@ struct se_session *target_setup_session(struct se_portal_group *, struct se_session *, void *)); void target_remove_session(struct se_session *); -int transport_init_session(struct se_session *se_sess); -struct se_session *transport_alloc_session(enum target_prot_op); +int transport_init_session(const struct target_core_fabric_ops *tfo, + struct se_session *se_sess); +struct se_session *transport_alloc_session(const struct target_core_fabric_ops *tfo, + enum target_prot_op); int transport_alloc_session_tags(struct se_session *, unsigned int, unsigned int); void __transport_register_session(struct se_portal_group *, From patchwork Thu Feb 4 11:35:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 376651 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 214EEC433DB for ; Thu, 4 Feb 2021 11:39:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E672C64F44 for ; Thu, 4 Feb 2021 11:39:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236008AbhBDLjW (ORCPT ); Thu, 4 Feb 2021 06:39:22 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:39714 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236093AbhBDLiO (ORCPT ); Thu, 4 Feb 2021 06:38:14 -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 114BZ0o4122037; Thu, 4 Feb 2021 11:37:29 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=AakTnBcU2oH3AQ71ZMPcSB4AA5mBPEJzCX8nCoSYz1U=; b=eo3sU2Ca9/if7bP/nX05oZpZ3m086iarrYcEYw2UUhd96Y2ieNhvDyuiGzFOjS9v4Hje CJ23N0S9nbWr+Mv9KhoWNAQJLj3BVylBKdcKHvxtoowTA61YsqUYyOLQI5wdkhpOZ84U YFyY09N0/SBWTqsL1MDLqbs05XmrWaWqP+nGn4typMJcCWVIw4vNdKJw9zMtd+jpYcRE UOkLxoqkgewE15KMeAuIz0QT9ggB5PH3/RAOEh9W8OlkORGnkW5kq4SnJfCensjwmgrv 0BDLKvwpv7qc9sMeyWegNDHB1PjDafi4NujETkqiUV4JeFwUNo+8RgJmbepUGSPh/OkS aQ== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by aserp2120.oracle.com with ESMTP id 36cydm4rcm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 04 Feb 2021 11:37:29 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 114BYfUL134930; Thu, 4 Feb 2021 11:35:28 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2168.outbound.protection.outlook.com [104.47.59.168]) by userp3030.oracle.com with ESMTP id 36dhd187r2-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 04 Feb 2021 11:35:28 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dPvYoJjxvx6kDjyQMh+EHfQHk/DvQIX4J4ahMDy/ZhO6q1adpszGsEeYHhnKA5ZWassw1eEq3TLRYsHjzZh7n9bS2Maafdb3hWhM4MFdHjAy2X3o0gwoW9WCjJpHnTIbYcEAsuNGny93Dfl2sntI1V2Z6lhH79BCLnMFba2i2iRCZ3cAIwhs/8tiZMdSSHgaAzrZdI4ZzD2WQPQsA9XZeuQYHRgVSd8hlTWOcwis0wMDhNvmyo3o5syCHV2i+p3rM0kk956j7Vg6SlAhgjlybr6egOKG4CpSjxe46s35y4e/2P50tiAmhm1c1+jdRBXberrk+fWD6i95woO09UJV8A== 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=AakTnBcU2oH3AQ71ZMPcSB4AA5mBPEJzCX8nCoSYz1U=; b=DyuIZKN21MRO9cJ5XAH0EOWGTTGrPWcdwvEmbX8t5jd/OOh2Mgt5T01bRjFK08UQNzJYk0tSic00dEcAU0awXiLWUrP6rv0pBSaw3qUueXsSRWvXQ9IbyRklkzsK3XTvwsZo6J9to1mwyKCpywNJLussWLqneCuVtQMddP61QPqv/AnusgNTfRuf1QYow9461w9UV3hUDtcdkaRLqQGeEp5d18TS2zb5Lsmbi6BobD4QkqRye/c86KWsmVtuHCNjyJvnCzAQTy015eoX/oefPtN6UXsEK5cOcmkIRzBCBS7mpHw9tmYhro2Wk/5oyIiRrFSxHZbKkSN/0Uq5djKZSw== 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=AakTnBcU2oH3AQ71ZMPcSB4AA5mBPEJzCX8nCoSYz1U=; b=F8sNNQs4A4cgfVqEUphBs4n0WzEgpykoEsYxU0OGdI8h/Oh7L69bvHGeNNyHw+unUnmdgKJyo9F6eb3Xy9U1aS6+KpMwTPfuAz3jEfxAzouc3lqns5iexbn/uromwfEaff3zQhL5bAY693ybMY2XocDynUYsZavXs+/7JJgDBXE= Received: from BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) by SJ0PR10MB4480.namprd10.prod.outlook.com (2603:10b6:a03:2d7::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3825.17; Thu, 4 Feb 2021 11:35:27 +0000 Received: from BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::1d86:b9d7:c9ef:ba20]) by BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::1d86:b9d7:c9ef:ba20%7]) with mapi id 15.20.3805.028; Thu, 4 Feb 2021 11:35:27 +0000 From: Mike Christie To: martin.petersen@oracle.com, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, mst@redhat.com, jasowang@redhat.com, stefanha@redhat.com, virtualization@lists.linux-foundation.org Cc: Mike Christie Subject: [PATCH 03/11] tcm loop: use blk cmd allocator for se_cmds Date: Thu, 4 Feb 2021 05:35:05 -0600 Message-Id: <20210204113513.93204-4-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210204113513.93204-1-michael.christie@oracle.com> References: <20210204113513.93204-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: CH0PR03CA0084.namprd03.prod.outlook.com (2603:10b6:610:cc::29) To BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by CH0PR03CA0084.namprd03.prod.outlook.com (2603:10b6:610:cc::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3825.17 via Frontend Transport; Thu, 4 Feb 2021 11:35:25 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 505a757f-4949-4dc8-d740-08d8c900f7c1 X-MS-TrafficTypeDiagnostic: SJ0PR10MB4480: 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: Ye0LNNLif47aFUDq8zf9Vpimm+8edXoSWlkE9BnvSCQqC9qtftI6M6XEmTD7WQ8BD3uXVbPgDWoVIXlnGy+fTl5MvOSf5z/EW+pnMf6U5RhNieCB9QIQhnOH3HayrtrF4WeSnFu7h8tBnRKIAoYFp0jVQylKeKJrxOpPdBHlsC7QAiWSXyi1RrXwmTXkho3wv6T7uiFiSuAHR+V9MpxMPdUFcuqh1ep1+ERgG4/0LIHxJhimEadqB8lrz0Nf+ohQ/gy0mtIhUwRFDlZzsBXSz9xnHBJLVu5UHzzpvbKAHE4WZDXuH9CutTbOnvnhNHX+eweQJNmabYEKW3pljx3c6cKXZqaNYLG4pXVTdDhlbMqgY35zHHvJlsoPqwpPbtMdupqWFflbeJ1qT9LGAE2LQ80XzxlmroCy9HzR3Ahpe6TisaBDV3PBTsV9RVhcWGFABHanqWzliBeKmz+Tk66o4LzLc5vEFKoVU/zEvOXXrowzF4NK9B77VmXbaRBYbjNtByk339JH6tjhZf/Drpg+4FgcbdS1mNJViWgs6YC8/Eqr2PirtPmAg3yIZHc1CDdRDOo6S3a3X3OOJAPuAiig+Q== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR10MB3573.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(39860400002)(136003)(346002)(376002)(396003)(366004)(52116002)(66946007)(66476007)(66556008)(26005)(6512007)(478600001)(16526019)(6486002)(8676002)(107886003)(8936002)(4326008)(186003)(2906002)(6506007)(5660300002)(6666004)(2616005)(1076003)(956004)(316002)(36756003)(86362001)(69590400011)(83380400001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: qE8iDmUoS+wRtCaMK4/uQ1dwsrEMMzIXwsEfyWD7ZCYIa2F+XNHjc5w/w4c8L30OJ5XAk9XX5WCN2E6W18I7mY7eCc91fH1NTnfQfpKAOtS8+T8XkSam1SiaePES3ieMEpWkggltvDeZC583EiY2wR6CKgE7qEWZl1nJf3+4doCrnyMpYi+Zx2LLPBvEDQE3ZW9OMnBfH/4vPeWxiI0kefN77EbhoBDuHTZQf+7cUg/WPYqv4CovfDyuAsNS6GBFsBJtCpO25J9uPNZtRya4sQsUp1A8tyvP85bYcaGTG2ZrzBqmMvH+mQwENDggZxYuvaJW4jM8dOBcPOp05cz8e47iI9Yr2VwrwdaM+K2sAEC9KXSb29nekcEiNEAJDJOM64QJiy9gZxRQzboirrOZsu5ad0+wVQm6K0CvawHJ4VFxV9gcKeoUgVM9DYoJS2HVX0djycK3p3hDTCbU+d4JARuPl7nZZar7F3eL2pzBcu/w9LrfXiDuo2/KKrgY00NtHlBCIBCRXv1RLIG7HeBcjrZP/rSVe43mFoxdo6YNPCinvteBqS/mSyEPyfOiQSGt1In/DR+RS368IK8GIRkY1SmXZhSZ27YPbTaxKnMW+Hw8IlzCQkz9xnrfqrVpBDWa78THcBaUbx8LdFSDB3mp1r7GgoW7uLzc6zwucoNL8Jvj+6an7xTjnnoJZfcF4w+Acd8RFiaBbcXB5hQMKtlYc2CeaRhJDafkMvA3HDfwYQ7RaYcILQh7H/ct5mUaS/jtPFkoAyJVk9jpNCfVBKQFG2QDD4hy6EX+ccucxooCHghP0yqN4z562LfSRVQukilSCsT+kLpldlm3IWmoVIP2Es8aeNSS9pgta+Nmi8xz50h2ToKUo0FJRU5fhwK2QA5XYgX4As2qvUHIOot45pInUlY/uFLGyDia32qZsNDY6xngVOIMjbDje6OkSOVGOwVt25ul/7WnOsFK1wKow4QYohQN5qRWXbJ7YMeSvKGfKEAS0VD4y6kejHQXqitdSy67zDAKkBFfihYbhOdv4gXSZEsU8RmuAGuwLMnREFOmsQXdTz00M2PnNn8BT8kMMb5TxaGzgyMlSajWkhq3S1wuBEGwzyByesO/jvMjRo3e0LicGkR80uHbXQoWqTaFq6uzCKfDPQBu1wr1FgDFrifwxfJMf4z7vmQz8gw4cQQEv8R4jwW0y7m9YBG7g4J5nkbhVC2q0CUFkqwGEAqs2t6ZoHUmt8kLDeSI0r/Bq3QEZWyzzPqP9pIYf8HoLZdB39mVC+00tWTuvNvgJCrxOtW4ji8GLRkzAG3qLR+JnA+AWcIRJFIjVoMhdf+8SjoeeXM3 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 505a757f-4949-4dc8-d740-08d8c900f7c1 X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Feb 2021 11:35:27.0142 (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: Vd/ikbbaatLQi6HtV8G9OW75xmYVfzNQtz7dZpVUp8sC64EzWFydZWrCmcBLcYnepJail+6pNxuwKQNml1+yTiFk3vEjVhNMYuz8/92gcN8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB4480 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9884 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 mlxlogscore=999 phishscore=0 spamscore=0 suspectscore=0 malwarescore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102040073 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9884 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 adultscore=0 priorityscore=1501 impostorscore=0 malwarescore=0 clxscore=1015 spamscore=0 lowpriorityscore=0 phishscore=0 mlxlogscore=999 mlxscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102040073 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This just has tcm loop use the block layer cmd allocator for se_cmds instead of using the tcm_loop_cmd_cache. In future patches when we can use the host tags for internal requests like TMFs we can completely kill the tcm_loop_cmd_cache. Signed-off-by: Mike Christie --- 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 badba437e5f9..274826a2b0bd 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) @@ -165,7 +169,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); } @@ -175,20 +178,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); @@ -320,6 +317,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) @@ -580,7 +578,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 Thu Feb 4 11:35:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 376656 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 27108C433E6 for ; Thu, 4 Feb 2021 11:37:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EC4D964F7C for ; Thu, 4 Feb 2021 11:37:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236079AbhBDLhj (ORCPT ); Thu, 4 Feb 2021 06:37:39 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:54354 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235770AbhBDLgT (ORCPT ); Thu, 4 Feb 2021 06:36:19 -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 114BXcLu123054; Thu, 4 Feb 2021 11:35:30 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=ffy4bpgrlTcrpZiC6UPE4q+MkX+KHRubtnCayUI06Ns=; b=KCxupqKRtB2frU+dp5EJtyQZvh53WrlyRjAjLX1AzlMng1XasDsPdY5MHGuVI6TqeMkh LyOGKpAEERWgwzXw65KczJpfTJz52QJHVGD6EoyvgIngyJrlnbknjyznD8qa3kYzhH/G rbJ83DPrgB2dkWW0B5YYON0ti7aoEkQ3SM2zR6NW/xBNLR7ep97WggYrCWyJI4RIXz/s awcLqndxyRUFEnO5FdOpi1QsJVes+lZjWrvnZe6YHYMCKZknzl96PB4kV/Qdn1DOKH7x oIxXT0Wodd5PkMCsmosX27gid3Ktt2Vom56W9jibJWJoUnYwlXzNb+TFYt0dIBkEksij cQ== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by aserp2130.oracle.com with ESMTP id 36cvyb4xrv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 04 Feb 2021 11:35:30 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 114BZ5jk187745; Thu, 4 Feb 2021 11:35:30 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2173.outbound.protection.outlook.com [104.47.59.173]) by aserp3020.oracle.com with ESMTP id 36dhc2jep9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 04 Feb 2021 11:35:29 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KSC5aTcuQ3NH4s3MHmKqubWs25HvaC2wtbv/M0yGbHshBAGnihDfyiG646SZUJh71JEXkrrt6OpHIxZD016DnEWQXH8MPbXg2F/DYWU9LcMzOBJ8Xessr044Va+TkWB+EDND/PuvyTs1319X6PoFULDL0RH2HtIFg8BsmaqKlZGBuA6reyfwV1DkvFp2qNA3KTh5QijS7ucQw/h6eJIWM32t+B1AIXvHcfzY/iiOhPT8G1hKIq0FFBfKVSDBGIIJlHtO9IWL0Up4NzhEplrHybr9gI1igHk0CBeZM+kU5Fvg/9+cWlbILN8auoCiff/GsrfH7gmdkR3r/ZlhoG7jWw== 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=ffy4bpgrlTcrpZiC6UPE4q+MkX+KHRubtnCayUI06Ns=; b=ZJ0FBvUS//5Hvt+DU/oJLu0Ets/urc8irAeYGUtwcKI+gwq3iYZl/jpycVXNsT8dLC3Swoa0zQClI71EvgKeJJ+asLzoK4+qR/UNXefFRoPhDXGM0j8GvV9Ij0Q4LRE//Qh81b5cB5OzMPNpDV7U40WCeDwpGBolaahTt1KC0i0h0rF1/kSL7ZhAeURtz/kBzEw8ceqlToLv/2kbaCo9j5O+TDmEzkZQ9p9TXCjHzMqFrnOBRpHzsktWlGLPDt4jXcKvq0PswdULH/O5McORWT3JCrYX0KVhO3qzPOPfUWvvXNFDqPu7gcaL31kTzO6sTKhgfki5SldMjpvbUw2FZg== 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=ffy4bpgrlTcrpZiC6UPE4q+MkX+KHRubtnCayUI06Ns=; b=VD6rNMBNJVsVGl1dv0Pb+sD8n5US+q83mgg0JbutMgRH6SVny/ZHybzNI26dA4crFzcgT5wFPm06hPQQ+pxWbTgOgDDM7wW1bRszSVwOs4YYsxk2bXNB0Uau5LVnc5z8uFU+GYrMqI46wO9+fw28C43LstwoucfuiSLe6L5uny4= Received: from BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) by SJ0PR10MB4480.namprd10.prod.outlook.com (2603:10b6:a03:2d7::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3825.17; Thu, 4 Feb 2021 11:35:28 +0000 Received: from BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::1d86:b9d7:c9ef:ba20]) by BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::1d86:b9d7:c9ef:ba20%7]) with mapi id 15.20.3805.028; Thu, 4 Feb 2021 11:35:28 +0000 From: Mike Christie To: martin.petersen@oracle.com, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, mst@redhat.com, jasowang@redhat.com, stefanha@redhat.com, virtualization@lists.linux-foundation.org Cc: Mike Christie Subject: [PATCH 04/11] tcm loop: use lio wq cmd submission helper Date: Thu, 4 Feb 2021 05:35:06 -0600 Message-Id: <20210204113513.93204-5-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210204113513.93204-1-michael.christie@oracle.com> References: <20210204113513.93204-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: CH0PR03CA0084.namprd03.prod.outlook.com (2603:10b6:610:cc::29) To BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by CH0PR03CA0084.namprd03.prod.outlook.com (2603:10b6:610:cc::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3825.17 via Frontend Transport; Thu, 4 Feb 2021 11:35:27 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 58a7e1e9-869c-46a3-a695-08d8c900f88e X-MS-TrafficTypeDiagnostic: SJ0PR10MB4480: 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: uQXgiW+ObgknjzFrJOare6an7rwwJCix1vk1NVbuY3rMSQuC+eigFgEiU4v3mcC1G5PQZsLLPfQ9E1OaqovnVUsCPkeTp4i7mftU22iKPDkRkt/tFLrWFbsUqtQDOPVo3P+eLdqtONSIPSZ1pMRVR5W4a/EqaJC0eMDrlNk/OQYuvX4sO5F0gaTlaKkzKW6rhzSHhbSANF5HELgBjddtxMe3YTPdxTHt7RFmdh04GdNBA7AxIWnfcRy85fEulBGe9P34hjPKB4JdxQNitWjDmO+05ZnqnXQ+4VRPfOS1V+ff8Zv5QgXWRXHPYULyfHt8gdnBEMqBK7DI2j5F00f9qyAGy9t/IeMxRN3RZlLsQXXibkIFmhKQUo+If5zoRgx30WeVCK6U0EEUDU120kAATRiQIU2YQjoGkFMYhrr4R2bOA7HFp6y4ouInzdg9qM2dhqEZJGY5JASsG80UzoqB9QCnNR2VjQlSS/vpn6YGMbp73AHoT/u9/iX79Bpy9fcngx3yibhPf1bwW04EKU778Rg+mXp2tR9TQ9rOY+ph8nhSq5FRIRlCGI+NUSNv66KEplT4VOtQQZBexQiJyZ2AHw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR10MB3573.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(39860400002)(136003)(346002)(376002)(396003)(366004)(52116002)(66946007)(66476007)(66556008)(26005)(6512007)(478600001)(16526019)(6486002)(8676002)(107886003)(8936002)(4326008)(186003)(2906002)(6506007)(5660300002)(6666004)(2616005)(1076003)(956004)(316002)(36756003)(86362001)(69590400011)(83380400001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: Gp4s5c7+X8LT6Uzf/0zn5kfxNGgeJjEs8fhMLrd3FvOU3vorxP+HQ9ZtKzxXZjqyFXH0NCnp18gjJ7RcohgD8/cWXcNnJ1qt/2QCOuIrZdjFKitlVdsEK7aHTEjI3SbOCIPh+8MXGwBqWXeJEqeF74J7MIxG9CO2fh1K6bvGXyybb5fRD+J2DTLvxbntRGWMff7tzy0MHJpYbZrtYTipwZ7wkB13yz6YEEW/QA45fVMwXG5IzjYjGjYJBAtsebcb4DfLX4l0exYWkFYcQaGxMoWTXkLYAclextG64d2mFDTi6BuBg9an0FkLW0mL0TJa6AVr6NxlorJAr3L4aDomCtliubMt9LiN4TP4SphfjKFeLy3beqqtf4X9izd+upZvlp6auCkHma358WLw5QbZpF0hQz07bjCnp90kDXj5+dZlGBmH4A+sXcVXBqAsjKeHoXUwyud5H46ILBYiKMjuxH5h3VpA208tH8zUTxn8I2uUqwfpOyB4IorhZ8Xaa/+g4C18+5nUnTvR/Y80yBgdfxg6TOULFKvFDeUz5R9M7jl5C6EZS8eCN24NkofM5MNC5QvvoN+ZLIyKg5TckjHkboCUQLrdxlDp4heq9S8SzZN83BwGv3GrFfsUJLvQXyorGZI2nVVA53dHE6Qjf96kNuibvrbGiKIsNy+I8kr3CF94WQhrxqhJ65g4OvClkgs7rPMarickzdxroZOTUuZ0pK69ahsJrrfkRTqrUBA4o2EPU5q5ZeAGDxoP9dHrBebvvouvPZFMHCYUq+dV0lexOe10YCiGdmgRyjJxvir+rUze3G/SE8s4D4HnnF0BHzLb7P/Gxn4KmLd9T/nEwBF3EAF+QyKXEssUc3NXKbX8Qh1Msstd1bBvW4JhkfJcQnKtVe3K83Rz65Zu+XZywOQnJooAr2QVQLqZKZWCaE6ruOYHKUR4gnuwN9K1iQCIZz0Y0CwOywPh3KXnBIVysF+wtYRZD/7/LRYUBBjewqTR3Z2yOfXxaCFvbWExDErk3B/quSs7AvtwzApbF3VsJG4+TRiqDuaI+Gm3TEj4HQ87IKLsu8GPRtuH7ulsus+w28UMM43bxqvxveFyruXNALTSTzQoWk7l/y12bN2b0EBAmDscE23Ye/X6+hWf/jsYMi4q8v2wTH4E9zISWqCgqSNrguq6K1Ag+f1dYy1VYIASBY7ylh0HTiQUA8kd06jET3arnG9NpRkAej/xUpx1cqqvCweGa0L2CnfjpHnn6snTjcZVtl7VAXZ2RawVPvle+saBSDRumK1huXU+BTVQ49+SLVmCjpMmYWNyr5wUw2eiNobEdd0MDkdWOmiAosFpwyjK X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 58a7e1e9-869c-46a3-a695-08d8c900f88e X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Feb 2021 11:35:28.1695 (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: yzQNtnswciFxKqx1ra7nHxn29Xxoqvk4AmGl7gqDL1CdpLXFdmqqPTiU6It0ethJ3/aIpV8+nb77J0anOV9rzl0pg9X5Vi1mbXLKbXIuWNI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB4480 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9884 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 adultscore=0 suspectscore=0 spamscore=0 mlxscore=0 malwarescore=0 mlxlogscore=999 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102040073 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9884 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 clxscore=1015 impostorscore=0 mlxscore=0 spamscore=0 bulkscore=0 priorityscore=1501 adultscore=0 lowpriorityscore=0 malwarescore=0 phishscore=0 mlxlogscore=999 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102040073 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Convert loop to use the lio wq cmd submission helper. Signed-off-by: Mike Christie --- drivers/target/loopback/tcm_loop.c | 25 +++++++++++-------------- drivers/target/loopback/tcm_loop.h | 1 - 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/drivers/target/loopback/tcm_loop.c b/drivers/target/loopback/tcm_loop.c index 274826a2b0bd..8dc45165d33b 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,11 +105,10 @@ 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_submit_queued_cmd(struct se_cmd *se_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; + container_of(se_cmd, struct tcm_loop_cmd, tl_se_cmd); struct scsi_cmnd *sc = tl_cmd->sc; struct tcm_loop_nexus *tl_nexus; struct tcm_loop_hba *tl_hba; @@ -179,6 +177,11 @@ 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 = scsi_cmd_priv(sc); + struct tcm_loop_hba *tl_hba; + struct tcm_loop_tpg *tl_tpg; + + tl_hba = *(struct tcm_loop_hba **)shost_priv(sc->device->host); + tl_tpg = &tl_hba->tl_hba_tpgs[sc->device->id]; 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, @@ -188,8 +191,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); + + target_queue_cmd_submit(tl_tpg->tl_nexus->se_sess, &tl_cmd->tl_se_cmd); return 0; } @@ -1146,6 +1149,7 @@ static const struct target_core_fabric_ops loop_ops = { .queue_status = tcm_loop_queue_status, .queue_tm_rsp = tcm_loop_queue_tm_rsp, .aborted_task = tcm_loop_aborted_task, + .submit_queued_cmd = tcm_loop_submit_queued_cmd, .fabric_make_wwn = tcm_loop_make_scsi_hba, .fabric_drop_wwn = tcm_loop_drop_scsi_hba, .fabric_make_tpg = tcm_loop_make_naa_tpg, @@ -1161,17 +1165,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(); @@ -1188,8 +1188,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; } @@ -1199,7 +1197,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 Thu Feb 4 11:35:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 376655 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 22A0DC43332 for ; Thu, 4 Feb 2021 11:37:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E41E364F44 for ; Thu, 4 Feb 2021 11:37:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236086AbhBDLhv (ORCPT ); Thu, 4 Feb 2021 06:37:51 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:40240 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235952AbhBDLgS (ORCPT ); Thu, 4 Feb 2021 06:36:18 -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 114BYqI4072846; Thu, 4 Feb 2021 11:35:33 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=UIG79us5tdcxA1pQAmmj93qpmV8RiUwAZv7vyNg/YH4=; b=Hn0n9IgkNXo3aDymRwbez3nnYo9+UVKeAyR6MPL7pxVEyO+e3Vv/KVdv2cKhyIiFgROT /7UFjR1pfBS4Ckgexs0Ai8zbCGgur8WHgj4NHzG3uzcyos6Gd3jBNXY2kqYbRiXOZng4 Y4Brynb0SN4D41hBuqf4bTvarZw5YAInQ99dktb0/oPunF3qEwND2XBpc1U7Tx4lrFB9 GcQdrFDHec97xXX0zZCxsnMZWp8r5MRwXRFhd/jzZZtqt3OWouKpkIdKSTJDHlEWW5Rd kDDWKmuld5voj5fCI2ybk7dku1Fuy7fxAmGrXhejAA5f6uDZiLF/tORW22pyfQA1eBr1 pQ== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2130.oracle.com with ESMTP id 36cxvr7h0j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 04 Feb 2021 11:35:33 +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 114BYfZX134897; Thu, 4 Feb 2021 11:35:32 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2172.outbound.protection.outlook.com [104.47.59.172]) by userp3030.oracle.com with ESMTP id 36dhd187uh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 04 Feb 2021 11:35:32 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LFAe+GffOYx2PGm65Up/VE4laqdS8LHl65NsGdK86R6hpsmumJfseiqdseKIprwi3KfPig2Hzyw2saM3m4JxRrnZL5qwjn1GVM+NvfFczDiXdOqbLh2b2JYosMWT+YL8VpSGp8HOF7Iz0DXeh6jBE/QCbGOmd5sYbXrhK9coF+UXfZplRB7UrxbZV5XgBTNc8qLFv5mjxWfLqqpLvStpn7nID4KZGluJfWC8uSpvMjBPrZ43IK9ERFF+rVoFfks7VEA2v7SQrUofaBOE05Gm6xwJhMZNHZ7IeMO1/xQs9Vb5ISIVBEs3vsqy9I00lNyRJyWCxNy3G3Xdj/DIN1yT5g== 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=UIG79us5tdcxA1pQAmmj93qpmV8RiUwAZv7vyNg/YH4=; b=O18/nDtZ8hV0lew2fKV9FMDFXpuQFndxTBGb5L6ZLA2RuzonUJlMUO+e2ZAV7XFSJVGClKG5saVskDKgdwkXDTpbVU96MILMpEI+98878Mktf9FEUg09oU+UTY7NS/UNI8tk4gbQQLaxkV2mPYheISBLF5lsQ3tmrvbRP4mlxRIoELu21xX39M/IFaRt/LSaCB59XL61zkd1KADMzriiN9t4WpTMzh8dSXkW4y3VndeeP5f+KN9AFiw1f27pl7YFr3ExwPFETQc5vi0DAX2hoNayFL02G7LI8m2W5XVSqmgrxuGdJ+yW7GHHl2DnidPJQkHER7amnkld3idLRjfTGw== 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=UIG79us5tdcxA1pQAmmj93qpmV8RiUwAZv7vyNg/YH4=; b=lqmEx9DxJ36908r6yYlUV6vdUN1sOoS8QYhpLl5zkJvrEgmbu4l65I4NUSBHI2ZVZnk0AEdj+egvLdS0T1eawRwLk3ehG/M2BxIJk0orxAyG05Y5FXY17uw/vGPdTsxs88hwih8sTK3f2V+SjW7gyFQmgDBKjLAq7DdLF+8MCZA= Received: from BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) by SJ0PR10MB4480.namprd10.prod.outlook.com (2603:10b6:a03:2d7::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3825.17; Thu, 4 Feb 2021 11:35:31 +0000 Received: from BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::1d86:b9d7:c9ef:ba20]) by BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::1d86:b9d7:c9ef:ba20%7]) with mapi id 15.20.3805.028; Thu, 4 Feb 2021 11:35:31 +0000 From: Mike Christie To: martin.petersen@oracle.com, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, mst@redhat.com, jasowang@redhat.com, stefanha@redhat.com, virtualization@lists.linux-foundation.org Cc: Mike Christie Subject: [PATCH 06/11] target: cleanup cmd flag bits Date: Thu, 4 Feb 2021 05:35:08 -0600 Message-Id: <20210204113513.93204-7-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210204113513.93204-1-michael.christie@oracle.com> References: <20210204113513.93204-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: CH0PR03CA0084.namprd03.prod.outlook.com (2603:10b6:610:cc::29) To BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by CH0PR03CA0084.namprd03.prod.outlook.com (2603:10b6:610:cc::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3825.17 via Frontend Transport; Thu, 4 Feb 2021 11:35:29 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6702da38-a0ed-4506-80ae-08d8c900f9fc X-MS-TrafficTypeDiagnostic: SJ0PR10MB4480: 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: QP/G9CYjkWKHxIG7q9oFr6Qc3ZDnVCgH9rWiojsmEWqXTxBoe07rwr70ZcoSkdi2Um87y6bQr35IqLbBZ/sIOcAWH+jNsUTwBNgTSaQYsuMTHt5bnYD1fNJLv/jIBbJQgJHRLYgcT8NlnQA3iguj28b9axIslYc+5w1uzza5+caSgasguBUeS7Ux6TVNAdlHHVBghzsgCxbkQnPCyS2IVLz5pcbRcbUeX7VA6Ul4KLytjYIPrP8m/dkV08S7789UEP6M/e0WDsP0pmN+On0QJHvldoutpmoY1hZjfEDREeEKIaFF/mHQe4zkk3Q1rfVwCBQbwhvv7X9dxpPaDYyv3CPu6VZo3FG4VyF+u4W93+4DGEP1d63pT1cE3st7NHnkN8/yajSU9EA8Gazy9UyHNUoQ4MKBHKhAq1F+9R/0WlJUvLmR0pvCcip1VoIxTH1C09wBFwevozCOlfV+PjUsalkRr5kJohN1io/RDEGmzguSR0k6dl+DsbHyDjxkN3sUmKOs9KPFJBfbuLV8uXc+ef0H2jIU0Ktc15idg1n79r11P36nKhfyHO4Z2kfcmrnVitjFN5xOktw7rNzOSwTpEw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR10MB3573.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(39860400002)(136003)(346002)(376002)(396003)(366004)(52116002)(66946007)(66476007)(66556008)(26005)(6512007)(478600001)(16526019)(6486002)(8676002)(107886003)(8936002)(4326008)(186003)(2906002)(6506007)(5660300002)(6666004)(2616005)(1076003)(956004)(316002)(36756003)(86362001)(69590400011)(83380400001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: GSxU/IzpEYjXdCO8prjhE0PWiBM7tfsZ+LaCrv2kkbX5EKtrcuePPZtW7n/HLQ/LxUPVijxU3fth8hjTh9gLQsuym6m/Yz5deF2Utw0PhxluKFoeBHyaOlzVppA9JiRWbFdni6qCLQr/zqLXEngM/y60xRbcBJfHTbsmZYy8apx16J9sKC+WePZUCa3CLCVtIijAaI84m6ug4xzYJCmoAzYub5YL91Gt2ilXTyxJRgmPKEM/BouAWpCCaiFcye9wVAT/+VWXZKxg9UpZoMrrKGSxIbkFzpzUTlCk4kBRxV/4tx6ApBlrRu6MbDlshaox+uBSw6ZrmNuCaBhpaMBLKKVp36/f+RPrbmInV3tcHjcTJ22qzjLNX6MtpobPqaJ6HTKkfeYyi2MQ1JmyDSf48kFgpD3xplAVFdRMUnclaA+DnHqnNrHSwlkZzgdTbT9yYOlhdTLmrqGSDxKkD9U+KlnZSFlkOuQMRQlkyAQJR7+MbDAr+vW5RdkLheqefnp6NaQGeamGd0wb+lgXuhUiA2kgiGq3GUramKLHQcMncnMt0uBfub9a+5aftQ2WlfsHowf0k8FCGBo321zx4nqiJXnFVJD/c3q+XLcHI4pUa+zdrcJa2Hq9YtWARcAAtJSCtPGFyTa2x0mpst2h4vuU/a3Uv8RR/V+0J9/8nObNqE+GHLB5jjaGAfON9qC3vKyU2dn+v41K93VBR9Co8AVG+iNei7uT2jIkNa+YzSBaqcSXljihgLhvznBgvce2/mNeOPHJ6puk/1r3U4oBOxad9qC+4r8zQfuec4Hy2i1wTuqCLWVQ+k64F9lMeLNKuTj2yCoMen3ddyZr0ecZmVt7sWUOeHYRflBYqeibor4jF0dQ9vq8tsu9py5hk+xSnlj/vYz6qYzb81HfRkhM8ZskK2QAgVAX6m04upPeIlYYNs2cA5u7gnP8SaCgMBKBkgf/daL9GAJF9NpjNUiD8oGnBdesqNkwVYxujHs/dVSpDG9sN8EJNj4f0ypRegRIS+0COBlCihMG4pbd1r9Rsp5dKjNrLgXl3jmQEs1y2u2umphoOTgu1rAfr2AdlM6QLmnwcGwoE3tMiL5UlzPabu24h8w+lB1/8KZgdPcGV669mtOLh9Z2Fm64drA78V/RrldTdpAo4wIzKg0SRQpnTSDTx0Zin1SyiP5u+0T1UXVmtFOh8FkaMiQFwyhB9PoJKYDHWHCLOti5tKCy/A+sFH3A/ijBb4l75KYt1X36Ej/ySyMYv9PFv5iFlpQG7BlKb15c3+GI6JvRClbYu4elf6+6HQVQ2Z4aau+4GcvUTlEVjP/uI6R9e889TlBTY4rurmr9 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6702da38-a0ed-4506-80ae-08d8c900f9fc X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Feb 2021 11:35:30.9699 (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: wGR2l910axstBY9JouWG/E2ieA/9Dh+iI/15SosIfGyIZzCDR4OvHbuXmcZrxlqCzDMHCNzEiyUvbMRF5UBCb+aPp3KULEz2ONZh6ChL4xg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB4480 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9884 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 mlxlogscore=999 phishscore=0 spamscore=0 suspectscore=0 malwarescore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102040073 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9884 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxlogscore=999 mlxscore=0 priorityscore=1501 spamscore=0 impostorscore=0 clxscore=1015 suspectscore=0 lowpriorityscore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102040073 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@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 --- 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 97138bff14d1..b7f92a15cd1c 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 Thu Feb 4 11:35:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 376653 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 01D44C433E0 for ; Thu, 4 Feb 2021 11:38:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AD0DE64F45 for ; Thu, 4 Feb 2021 11:38:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235978AbhBDLiA (ORCPT ); Thu, 4 Feb 2021 06:38:00 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:40286 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235780AbhBDLgX (ORCPT ); Thu, 4 Feb 2021 06:36:23 -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 114BYHmt072673; Thu, 4 Feb 2021 11:35:37 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=mHGGgG2d53MLyUkuEIqroziYw7ExnQ/ohqpxpxpOr4M=; b=Y0hCE+2i8jxU3+8q/GAjPCfXQPIbpRPmDpqoph4SWO/bMCb6qj1KaRl5GSuL+pGJ1sOM 0c0q5Ps4Ol3nABL165+caOv488u71K7bJgC3ScZf1SUBHxO27h3yYnhWJt7KCxS8J+Zr tHoESsJwHHyAhuISC68Dbx0TtcAl53jhX4nJSR3fgkuTE3azgmcqRmmlyhsE4vH8LSap w5a+ORNdlyQQ7IyAVQFtX/Tfp6IiLOGwUP/6GXG18ex4q6ZALCGZ14wnaBl+Ssmpfhfs URdDznIJH2J0B8S2ulTpRBKw6HEpVlPa9knDOwGT6rK3myvYXIdOb+TtBDAjTtvWiVAc iQ== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2130.oracle.com with ESMTP id 36cxvr7h0q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 04 Feb 2021 11:35:37 +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 114BULCS037141; Thu, 4 Feb 2021 11:35:37 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2175.outbound.protection.outlook.com [104.47.59.175]) by userp3020.oracle.com with ESMTP id 36dh7v17ss-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 04 Feb 2021 11:35:36 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cobSs7SZBWKX5B5lej4kREK8pqJR+W/5rzlOkp5i0QpUIOzneaFYw5fqaCMzfXwCnnqDAmtxQBtOH7slY4OPKY+6hNK/ZH5WykEa4PdnpEQRFkOsgFmDrX0zF+Bc0GHaBjrDZORw5RTtD9wgsuqFuD1NjNl6jb2UFbVXVTTnpw2BklbffjmGp+5SZ8y44rH9HP+D+GXItdV+ylwrYR/oECsuflqlMyh39ShOY5btG+cXhByLIqoKlThZj61Mp5oecVwkPuw8PPUhn0T9AlWMzfwQ0YT/0ec6pSCqCRN7qwGR7cavwCuHAT8uXOJ3yXYpPDWjoMfF8Eddc7udOqjeBg== 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=mHGGgG2d53MLyUkuEIqroziYw7ExnQ/ohqpxpxpOr4M=; b=b0t5Om45b9FOdq/W4LzSnhDidZUIYZ70CNvIRPIzUSXUALvQXarHakRBnpnmuhoBYL3E6kGAuFIROudkfaltgBy/xH06trHcADHo8AuxxSeHFe2DbA+ztT+OlkaU2Fm+qF/B6jLnBiG06QBCAoRfdEvvv1mZr36w/UvpnPY0KKDGWaTuaPjWawZbKoKa08bgMp12pXLes4DAdliWyi5EJh8ErCRweROIqkqjnBhOr40VAmH+2jTIISy8RnbS201LC4oJbk28lNo9AdP1WuMAz7c8N51fPzJYmXh9x+iEcPjbLNS50l+jpca7E6VvhM7CyN1nyCK54jeZcgAEo/vBpg== 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=mHGGgG2d53MLyUkuEIqroziYw7ExnQ/ohqpxpxpOr4M=; b=ysKWWMogR1zXgXT/L54rDpOU0Lo9q3Jqdv2TUUJxd3TdbrFhQRreFJpDILNlZJtbJOPSgK0wsaTIUPxOmlMG3owHfE6hauKSygr5k4+0AsOgz3/3hYWTRnOg6W5uNCiBtYgO9LuWQ3tGw8z9zsL8O/f0KD5HsMo8i3BdjIVN61M= Received: from BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) by SJ0PR10MB4480.namprd10.prod.outlook.com (2603:10b6:a03:2d7::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3825.17; Thu, 4 Feb 2021 11:35:35 +0000 Received: from BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::1d86:b9d7:c9ef:ba20]) by BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::1d86:b9d7:c9ef:ba20%7]) with mapi id 15.20.3805.028; Thu, 4 Feb 2021 11:35:34 +0000 From: Mike Christie To: martin.petersen@oracle.com, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, mst@redhat.com, jasowang@redhat.com, stefanha@redhat.com, virtualization@lists.linux-foundation.org Cc: Mike Christie Subject: [PATCH 09/11] target_core_user: add backend plug/unplug callouts Date: Thu, 4 Feb 2021 05:35:11 -0600 Message-Id: <20210204113513.93204-10-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210204113513.93204-1-michael.christie@oracle.com> References: <20210204113513.93204-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: CH0PR03CA0084.namprd03.prod.outlook.com (2603:10b6:610:cc::29) To BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by CH0PR03CA0084.namprd03.prod.outlook.com (2603:10b6:610:cc::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3825.17 via Frontend Transport; Thu, 4 Feb 2021 11:35:33 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 85368185-bd7d-4c7f-a5ed-08d8c900fc94 X-MS-TrafficTypeDiagnostic: SJ0PR10MB4480: 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: qpwvW8mTZhWIkEU/tkov5jxDX41FhgnWviEoMYKFv49xbJ5WDAnR3jqhvbal5sz8SixbFmhZFdgT+Q9Imx8kPZArmSJlQqS/v+/zTm3WFzKZ72JG6Ri+ndnLPEIsWOC7kWA8IBQL2OmmYledg8ttyb0TnLqLLDhLAdKTAO+Rn3zCtaTCnPBn6otZl2vlbNTSpgNAwXSt8W9Rj9J8C7ytesyG6gv4MQPKiZl/0D6saG42IaihJXIXNcPqKHkWKjqoctCT9RCFzw3Xs6/ZwC3e/ZdvQpQI2NdzEK0Si+PsaWB6r/ROOKzE0STypcvxMxCOLLiRz4N/4rsKEEAH4kjtRKK7C4Z1oo1csdudWigPZyEste2ddNTci/hFQ7ca2jSxJYBKqNnuapyztt3p/Dv0CeLqb6pkVuaIY607xdt52SwkShQaNEqb+EpweLlXc3XUOjT5cK/Yo+ssDhnhSjDAge3IQdwbSsryHRok1fQ3dk4/TTM27nyWRrQbGTS1A2GDRHJQ+cAKjbDr8lhXegquovtiM+jwpLaNcX9osPndMQvuiJxQa4jojBzLs+GB+iw4I2PBp+Z+lyq4JvGMHRbNBQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR10MB3573.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(39860400002)(136003)(346002)(376002)(396003)(366004)(52116002)(66946007)(66476007)(66556008)(26005)(6512007)(478600001)(16526019)(6486002)(8676002)(107886003)(8936002)(4326008)(186003)(2906002)(6506007)(5660300002)(6666004)(2616005)(1076003)(956004)(316002)(36756003)(86362001)(69590400011)(83380400001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: rMu3Kf2HX01WWPrGJtazTCsUx091Em46nxn7TPcengAzfmS4feEk3FKAv1PK8cBJSRePMjQ2MvztRxp4xXbKeOeht2NX+MorZ3iDmeFpgZNT570NPS94iFjXp3waTP/HJLfNON8hCxGz8GYmnhkpvvVXbfGahWADe0WyHvIme61xoVUHcvvL56ykolGQxwtuuvCCP+euzvNpaeJq5rjREQeYIMOGld5ySn4iiot8nQh3U1kyxx5lX5lUF6Xlua64o8Tt9bgxLS72WwaRJ5gRqk4HznvuPQLBDx07hJ0SPZvKeGvHlqKfoodr54f1t6Fp8YTGM1o+1J0sEtyPr4dcqtEAtGc+r+Upta45hnDU3VOK7xHmE2c2KsGDJlliDpYj8ELnpLbuADAwcJCzpJ0krKXCMVd66RbZ1SO6qALE1D7bMQiJaEuToWlKRfOhjWaZXgL/LLb7d4ot6nQFCen6Jyr4RkfwDYJi2R6Hw4358klSPKad/szCZh5XGh/BRreVKiitcGqnRmLoEcTvFrVJi1xR97otJpDOIoayV2OT2FI4k3j2KGnksfMOIZZM4Ou1HlB4p42p+tSRgXj2zepQtNgKTTAyVKZnYXQUGXO94gCL1xnAgsF+73Oir1m9Av1szUM4VRCwqvXtroI6qNJmkdEQX3q8+2UdE4KyEtaLxCTTpJgFr/v/jnVWv1yeCKRFFDzPqms/DSpXtx+LgqFnvAd5CLR2kc24FibgnoajXG3z6Vfczeb7BU4qM8JbkwDjTXGYjMUzfwtbuFsoBLmuhNFV3p5tCojVVzirtHq56r2en1SY74oY7LTkBnVqmuJA1xcb0csEm0w4beRFwd9T7+6nLghOqZApf9LGGl6qFt/U9HKIemnLQgEE2o09TpVi6/SvXxPoni6D2pFH6OurlAA/B/jugLEG3KLuRNg+MGz41Kmte13Jy6Ztl3T/1WybL/RlchMPbtj77XFpi/GT/qvEBgVlDUfu0I238QUcUE21HnQ3w1nRtUJS6EmnlzC68O/WYUmRFfqwax9tuMUq1g4u2CCbQCa0ZPBmgXjyR5yQIyDXKeFTB/chLrDK1k9sgRou5IWpyqK9/81ENNfaHFnKqsDQz/3BKU6QUywt1P1M7lNt/8avgNFU8IQy/nZNCkTYqoFaUicUOpFVZIDWhi2kMGx7bwI/q0md4vHKuCRYVYoc0ncMsVKer2IO0pvwg8rjZmgYUeIU8PVY0uTTfyojK9qVjFlnpByilBNU1XhsWUIPxTYDvXK1r0KfSr5ISGbKr1MOxDwm1BnpW65yJaWJnMGbKiiK509vRe6hbuJeercdKx2nfiJZP8eimxMe X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 85368185-bd7d-4c7f-a5ed-08d8c900fc94 X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Feb 2021 11:35:34.9007 (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: EyzAYovtk6GNOHJuyQ2JiO1US8y/ZVz9IYYpFcp1aY8kK3v2Is68LBRLAC4XGe3iq3wrwZoDObS7euyEJNVm942e+5b49TL0whtLN9NcQ6E= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB4480 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9884 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxscore=0 suspectscore=0 spamscore=0 mlxlogscore=999 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102040072 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9884 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxlogscore=999 mlxscore=0 priorityscore=1501 spamscore=0 impostorscore=0 clxscore=1015 suspectscore=0 lowpriorityscore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102040073 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This patch adds plug/unplug callouts for tcmu, so we can avoid the number of times we switch to userspace. Using this driver with tcm loop is a common config, and dependng on the nr_hw_queues and fio jobs this patch can increase IOPs by only around 5% because we hit other issues like the big per tcmu device mutex. Bodo, because the improvement is so small I'm not sure if we want this patch. I was thinking when you fix those other issues you've been working on then it might be more useful. Signed-off-by: Mike Christie --- drivers/target/target_core_user.c | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c index a5991df23581..d67be2f959b9 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,26 @@ 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); + + uio_event_notify(&udev->uio_info); + clear_bit(TCM_DEV_BIT_PLUGGED, &udev->flags); +} + +static struct se_dev_plug *tcmu_plug_device(struct se_cmd *se_cmd) +{ + struct se_device *se_dev = se_cmd->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 +1108,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 +2862,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,