From patchwork Sun Mar 20 00:43:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 553864 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A7910C433EF for ; Sun, 20 Mar 2022 00:44:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244489AbiCTApo (ORCPT ); Sat, 19 Mar 2022 20:45:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244482AbiCTApm (ORCPT ); Sat, 19 Mar 2022 20:45:42 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 842E7241A0A for ; Sat, 19 Mar 2022 17:44:20 -0700 (PDT) Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 22JEhZuu012459; Sun, 20 Mar 2022 00:44:15 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-2021-07-09; bh=8Jy/+JVXk9IAC7M0AaOgj6YuDq7rEotAwYIHeNzP9lw=; b=laFuP7eiZ2Y4odBSF+YuasJxM+Qlw1TFNgVUfIj+em2idGvWvE+Oc766yWAOis0Cjqef T+jbhkPSlHoi2M54ngqvO9zg6GXefrNw27rplh5N5DMXp6dmsznBvLzS7YZc247Q5vgQ LbkI+GykifN111lq+WGxjh5bW9u1RoL4Nccyeuk3ZFW5OzJU54bvQZce+8Djso5fBNrj wJ2ZzqkMNmBmHKXdGtPNtD3pAkY+lRyQGGRYr1inG7fXUlMJoqRUClTXZR6LrC0QFgSR NqeHdL5HnSJu8V9P45HoSvo9hwGkdy88JGftaCdxDxFKBTEl9KsF0tXv1hkhw7Piwa91 Pw== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by mx0b-00069f02.pphosted.com with ESMTP id 3ew6ss0uwy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 20 Mar 2022 00:44:15 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.1.2/8.16.1.2) with SMTP id 22K0ffag137063; Sun, 20 Mar 2022 00:44:14 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2169.outbound.protection.outlook.com [104.47.55.169]) by userp3020.oracle.com with ESMTP id 3ew8mg6mq1-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 20 Mar 2022 00:44:14 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KkH9/Yqb1GuvHB8o0wiV2sRWPPUTKkCPprb3IDlZ/yGT8xe+kwKwZUdP5yLpKis8OFmj8kmTrEo8hNLRnr8maDCfn25CPTlhhfKg37ErZh5LAKfZlzWudwXAQCRp4rlWz5XohkcR8ITXSbrqU+pCToxMoEVZNbSbK0H3hhNR1S/lWiAHV5P0fSEq+b4x9sQEj8Uq1YZbLUr7rfAnwBMRaVM/O/bGVOviYzXmR48IxwUtClk4wY9NC0FmQ1s1/ay5v/fN1T1FlVd9nU/oByOZLN+qVSCWWTboObR2IEYn2NCELApEk7yd+Wx2WAKM8r9CAN0c7Tj7xJugc7hfscEh7Q== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=8Jy/+JVXk9IAC7M0AaOgj6YuDq7rEotAwYIHeNzP9lw=; b=VhUpZTgo39WEkDqACMIoiIJCSUo1drCJ5399iM2t78ltfxJLUxl0EJXCN4gTIhWu5TyeYi1+m45Au7zvPE805J1VgTLH4/yNe4g4F60xh8QJEl4f8ootURL7MJ9+/VfZytPTUvxdYPUaFQDcDtrsVjJoqu+pTl9B4Uov5CpnEpOQxSkRSPaai959eORZqzXhP3Myepzw9SFyqFbaWxWIlQ/7zLF+QyV40lweWlV8aul0O9tIOcucRGNVbh0tGm1TYVDxtxNlDyHDyWetz5uHrtNsevD+UTq0kWUmwkeReHFNyOhunvov1poBXlSlnIptNYJ0BjSPyVofOg0IUvZmNA== 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=8Jy/+JVXk9IAC7M0AaOgj6YuDq7rEotAwYIHeNzP9lw=; b=wRArBEb7Gy2J7noahicjBe4cI4Ej7El6DDNIz3m8TuI1SlGaamkLfT3VA2fztP6HZy00Vzw6XBm4oRDCNgyo1qGQwLwqj+9xgrLEmlvMtYoJxi7RwYHi3RcgiCzW5WgEVz1vzVcBW+OEQnAKFJvU69Q8YEfKXb0jBiiRvSJjHIQ= Received: from CY4PR10MB1463.namprd10.prod.outlook.com (2603:10b6:903:2b::12) by CH2PR10MB3992.namprd10.prod.outlook.com (2603:10b6:610:9::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5081.17; Sun, 20 Mar 2022 00:44:12 +0000 Received: from CY4PR10MB1463.namprd10.prod.outlook.com ([fe80::78b1:38c1:cfb8:537f]) by CY4PR10MB1463.namprd10.prod.outlook.com ([fe80::78b1:38c1:cfb8:537f%11]) with mapi id 15.20.5081.022; Sun, 20 Mar 2022 00:44:12 +0000 From: Mike Christie To: lduncan@suse.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, jejb@linux.ibm.com Cc: Mike Christie Subject: [PATCH V2 01/12] scsi: iscsi: Merge suspend fields Date: Sat, 19 Mar 2022 19:43:51 -0500 Message-Id: <20220320004402.6707-2-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220320004402.6707-1-michael.christie@oracle.com> References: <20220320004402.6707-1-michael.christie@oracle.com> X-ClientProxiedBy: DM5PR18CA0065.namprd18.prod.outlook.com (2603:10b6:3:22::27) To CY4PR10MB1463.namprd10.prod.outlook.com (2603:10b6:903:2b::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5be6b446-e14e-41b5-1c62-08da0a0ac03f X-MS-TrafficTypeDiagnostic: CH2PR10MB3992:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5QD+slie23M0sUO+rnJL+RHmQDgdjvfQZJBhrxdzUTBp9+1gbADI+oQhc3pvlwMFYHFvZ9wCvvHa4Y6+RcZJqpYMnUNr0aDx33az4txscFE/mGlZZQKYHr1NAH8GoNCbVnnTVtz5B8RLNFuHCirNyNfgsHF5qlBViyyZitKZEnQ9Fsfx8q25LN/ZODYfyD8qNUcFIcomZVsfWsn8HR0/7dibBlkgcxA1R+PPs50QBc+c0L1ibc8XG3rM22y0Ih9nv7uymiasaj6Fwy9my40WeJPn42c85KNDVB2D2kPWzs5WsM9WQ6IVS7qK718vIjsPJU+SKm2lkdu41ucK8N/8VmkA/gGmrenPAGE1hCkH8Uy7/myX6W1JRErCZLz/TTbSPRAnsC2VxFBPo3jsOJa6OWsYP9ibE6rNDkUrzMziaPD8xUJyDyW0Vh0MbBpF6HfHWMMixS8s4n4BicZCt2V7ueR+aPZtoCbjIMn231Ddf81UnP02ZuMQfxF9R9CKhgAZydoZdubt91Tyx+xFKJjgil11SOIvtVUlKR2+OHB7AQ8xt9wBiE3RqLYF49ieetamI86Wz9FMImeIBtwDhxzJb6Yotj4hAwB6UNirmSuC6STDIYW599aQNZUxQRPtMF4FsE3cMsHHnHn92vQczRPeI34e7d7UXk5GI3DM5F4CjX9CCuWaxugU7ovFLP7apLM9N4qgo2Bj0A1uuODHUAUI9g== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY4PR10MB1463.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(15650500001)(508600001)(66946007)(66556008)(66476007)(4326008)(8676002)(86362001)(83380400001)(5660300002)(6486002)(6506007)(6512007)(6666004)(107886003)(36756003)(26005)(186003)(1076003)(2616005)(8936002)(316002)(2906002)(38100700002)(38350700002)(52116002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: TZP5HKZeW0M6g9xGg4AnL4nNfxYfC0CuShxyyJsyFWYav+bOG2JoifRvBZO58Zfn5FCtzoDG6IUtVXRcM1cinu2t0aFNUgDy9z+Ge9LeHuax3h6kxqTzc2ZEwV9cNx72+R7KAYpp6xpFDfLvZcAg9NslAECphKxTxL/UuuyxPFuY01ik22XytvuNJN+jugCYNDGYLJmS0ELpGqqRSZtZ20KZ4Odgq3E7Wdt0VpxQnreaB0tfVylZPUnt9B7xY4HKZAobryXzzMsQFMEfCAf83KnpWILZrnpuoCQHS4otp1HOpuR24XFs10XQEe73CRpGEJOh9+eX8WKT370HW+GbGfyZOoKLpiAVbettxAv6nV//DcYhX4Fnep/Twg3UgvIMK0dMoAD/vps2LTUpHzmF3C0wnz0vqMFHUS1kEwIlY0JMOAmLRoID1NpdJW+lIEg0xG71ZF9Ek89r3Hd8veAFZp6mYhjILzHOES/qcuoIpC5Oic0raYcBxkDDcNDYNnuEe0esl98F6cT8eabLiVd5ZAiEcXXmxIK9zHEY+1pM1xM6heP7UKQOKot/j/VtqeVIF987gqxQ+yokGT++UhgHjm1gk9Mvq4eoOv+8oRXPbd1R8PQOUHeuDKj+L5K3J7UC9tERXK3DoRP7VmWEDyOvo9/z4C5VBg/Yw8zyKUgdx/Lz+ihy4uIs2poROMY7qOoEKpcYDl4I6O3mYdXY0nC/9cfF47B6mz4IylspyZNVQlkMgwiV1FcCGTwg04b/f07rwf64APYKdqD0UknTYW2PhL+XxME6QcsXbqsLRMLYmIiBD83E+r3CA3m+UeJ9c+lTn/Y/J6FWf6+2zMwYLxqF4gzUDe8wO1AQddVjVooOfm2MXWIBkfVKbyVObEpJ+WH+29PkRFf7igIfmE/LifIuntsk+1DgDsXExRa9TV8f+ktJ6Z/h2wK9sqcn/24X0wXpOK2DmSMoP5w4XZ5FgL1ynScJQaTHxTgXhCJU2yNpp+jgcXb9Rh+Bt/0UhA885gGuGUFmxXKBGTwtzHhCEfXaRdf8EqtgMPyhRVbfD/3oQOUUebgALyidK+94YsCy/WNXGBOngEcC8rM15uWeGNT8a4Yw0z5jTTZhMsWjlKhU+PyFZbfPPSc8uoWPlVwH6N7IaMvDKlI6fcaPWuogd07cA3pvIpnNOvUDfDz4UKe0gfgMDQ7HdF6hU0grCXIxiSWkzv1aloV6I8R1+qab8Vgq1DQiAuBYt79JB64yin8qIvJ3JF9jfFFYmn/vbqIjT1pXQWmp0hbIQlBenAWKYGggr6k5/3dDZqjh+Oaej8pUxOmkmfgFmusPoVn7nV6MpwvPTD8BoXl2EYMqg+zLVbDdbSdMZIdiqhicHvfRLGVhBBX6Y+xn+d/qzTOsdbaote+6uV9kz0TwdhItMnHvIeYnzGPMfmEK31TkNfIcnE5JDmcYAFFn+7gFe2eR7K7RaDnH5TS32RddhzGfqm1Fb1eaOw== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5be6b446-e14e-41b5-1c62-08da0a0ac03f X-MS-Exchange-CrossTenant-AuthSource: CY4PR10MB1463.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Mar 2022 00:44:12.0158 (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: ee8zHRJASz9oPwb9OUbkqxt+iW3sV2DJZwtsGZ8UdmJtDRz/61MuMkdib3Vtdygvp1Bigp5Z2KeHCkti8W6Q3LCXb3Z6tRzlAzQ0CQ8uzME= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR10MB3992 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10291 signatures=694221 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 adultscore=0 bulkscore=0 malwarescore=0 mlxlogscore=999 phishscore=0 spamscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2203200003 X-Proofpoint-ORIG-GUID: ruRqb7-MBGMh3DQ8-8_mLyBjo-rSzv4D X-Proofpoint-GUID: ruRqb7-MBGMh3DQ8-8_mLyBjo-rSzv4D Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Move the tx and rx suspend fields into one flags field. Reviewed-by: Lee Duncan Signed-off-by: Mike Christie --- drivers/scsi/bnx2i/bnx2i_hwi.c | 2 +- drivers/scsi/bnx2i/bnx2i_iscsi.c | 2 +- drivers/scsi/cxgbi/libcxgbi.c | 6 +++--- drivers/scsi/libiscsi.c | 20 ++++++++++---------- drivers/scsi/libiscsi_tcp.c | 2 +- include/scsi/libiscsi.h | 9 +++++---- 6 files changed, 21 insertions(+), 20 deletions(-) diff --git a/drivers/scsi/bnx2i/bnx2i_hwi.c b/drivers/scsi/bnx2i/bnx2i_hwi.c index 5521469ce678..e16327a4b4c9 100644 --- a/drivers/scsi/bnx2i/bnx2i_hwi.c +++ b/drivers/scsi/bnx2i/bnx2i_hwi.c @@ -1977,7 +1977,7 @@ static int bnx2i_process_new_cqes(struct bnx2i_conn *bnx2i_conn) if (nopin->cq_req_sn != qp->cqe_exp_seq_sn) break; - if (unlikely(test_bit(ISCSI_SUSPEND_BIT, &conn->suspend_rx))) { + if (unlikely(test_bit(ISCSI_CONN_FLAG_SUSPEND_RX, &conn->flags))) { if (nopin->op_code == ISCSI_OP_NOOP_IN && nopin->itt == (u16) RESERVED_ITT) { printk(KERN_ALERT "bnx2i: Unsolicited " diff --git a/drivers/scsi/bnx2i/bnx2i_iscsi.c b/drivers/scsi/bnx2i/bnx2i_iscsi.c index e21b053b4f3e..a592ca8602f9 100644 --- a/drivers/scsi/bnx2i/bnx2i_iscsi.c +++ b/drivers/scsi/bnx2i/bnx2i_iscsi.c @@ -1721,7 +1721,7 @@ static int bnx2i_tear_down_conn(struct bnx2i_hba *hba, struct iscsi_conn *conn = ep->conn->cls_conn->dd_data; /* Must suspend all rx queue activity for this ep */ - set_bit(ISCSI_SUSPEND_BIT, &conn->suspend_rx); + set_bit(ISCSI_CONN_FLAG_SUSPEND_RX, &conn->flags); } /* CONN_DISCONNECT timeout may or may not be an issue depending * on what transcribed in TCP layer, different targets behave diff --git a/drivers/scsi/cxgbi/libcxgbi.c b/drivers/scsi/cxgbi/libcxgbi.c index 8c7d4dda4cf2..4365d52c6430 100644 --- a/drivers/scsi/cxgbi/libcxgbi.c +++ b/drivers/scsi/cxgbi/libcxgbi.c @@ -1634,11 +1634,11 @@ void cxgbi_conn_pdu_ready(struct cxgbi_sock *csk) log_debug(1 << CXGBI_DBG_PDU_RX, "csk 0x%p, conn 0x%p.\n", csk, conn); - if (unlikely(!conn || conn->suspend_rx)) { + if (unlikely(!conn || test_bit(ISCSI_CONN_FLAG_SUSPEND_RX, &conn->flags))) { log_debug(1 << CXGBI_DBG_PDU_RX, - "csk 0x%p, conn 0x%p, id %d, suspend_rx %lu!\n", + "csk 0x%p, conn 0x%p, id %d, conn flags 0x%lx!\n", csk, conn, conn ? conn->id : 0xFF, - conn ? conn->suspend_rx : 0xFF); + conn ? conn->flags : 0xFF); return; } diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index a75b85f0a189..14f5737429cf 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c @@ -1392,8 +1392,8 @@ static bool iscsi_set_conn_failed(struct iscsi_conn *conn) if (conn->stop_stage == 0) session->state = ISCSI_STATE_FAILED; - set_bit(ISCSI_SUSPEND_BIT, &conn->suspend_tx); - set_bit(ISCSI_SUSPEND_BIT, &conn->suspend_rx); + set_bit(ISCSI_CONN_FLAG_SUSPEND_TX, &conn->flags); + set_bit(ISCSI_CONN_FLAG_SUSPEND_RX, &conn->flags); return true; } @@ -1454,7 +1454,7 @@ static int iscsi_xmit_task(struct iscsi_conn *conn, struct iscsi_task *task, * Do this after dropping the extra ref because if this was a requeue * it's removed from that list and cleanup_queued_task would miss it. */ - if (test_bit(ISCSI_SUSPEND_BIT, &conn->suspend_tx)) { + if (test_bit(ISCSI_CONN_FLAG_SUSPEND_TX, &conn->flags)) { /* * Save the task and ref in case we weren't cleaning up this * task and get woken up again. @@ -1532,7 +1532,7 @@ static int iscsi_data_xmit(struct iscsi_conn *conn) int rc = 0; spin_lock_bh(&conn->session->frwd_lock); - if (test_bit(ISCSI_SUSPEND_BIT, &conn->suspend_tx)) { + if (test_bit(ISCSI_CONN_FLAG_SUSPEND_TX, &conn->flags)) { ISCSI_DBG_SESSION(conn->session, "Tx suspended!\n"); spin_unlock_bh(&conn->session->frwd_lock); return -ENODATA; @@ -1746,7 +1746,7 @@ int iscsi_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *sc) goto fault; } - if (test_bit(ISCSI_SUSPEND_BIT, &conn->suspend_tx)) { + if (test_bit(ISCSI_CONN_FLAG_SUSPEND_TX, &conn->flags)) { reason = FAILURE_SESSION_IN_RECOVERY; sc->result = DID_REQUEUE << 16; goto fault; @@ -1935,7 +1935,7 @@ static void fail_scsi_tasks(struct iscsi_conn *conn, u64 lun, int error) void iscsi_suspend_queue(struct iscsi_conn *conn) { spin_lock_bh(&conn->session->frwd_lock); - set_bit(ISCSI_SUSPEND_BIT, &conn->suspend_tx); + set_bit(ISCSI_CONN_FLAG_SUSPEND_TX, &conn->flags); spin_unlock_bh(&conn->session->frwd_lock); } EXPORT_SYMBOL_GPL(iscsi_suspend_queue); @@ -1953,7 +1953,7 @@ void iscsi_suspend_tx(struct iscsi_conn *conn) struct Scsi_Host *shost = conn->session->host; struct iscsi_host *ihost = shost_priv(shost); - set_bit(ISCSI_SUSPEND_BIT, &conn->suspend_tx); + set_bit(ISCSI_CONN_FLAG_SUSPEND_TX, &conn->flags); if (ihost->workq) flush_workqueue(ihost->workq); } @@ -1961,7 +1961,7 @@ EXPORT_SYMBOL_GPL(iscsi_suspend_tx); static void iscsi_start_tx(struct iscsi_conn *conn) { - clear_bit(ISCSI_SUSPEND_BIT, &conn->suspend_tx); + clear_bit(ISCSI_CONN_FLAG_SUSPEND_TX, &conn->flags); iscsi_conn_queue_work(conn); } @@ -3321,8 +3321,8 @@ int iscsi_conn_bind(struct iscsi_cls_session *cls_session, /* * Unblock xmitworker(), Login Phase will pass through. */ - clear_bit(ISCSI_SUSPEND_BIT, &conn->suspend_rx); - clear_bit(ISCSI_SUSPEND_BIT, &conn->suspend_tx); + clear_bit(ISCSI_CONN_FLAG_SUSPEND_RX, &conn->flags); + clear_bit(ISCSI_CONN_FLAG_SUSPEND_TX, &conn->flags); return 0; } EXPORT_SYMBOL_GPL(iscsi_conn_bind); diff --git a/drivers/scsi/libiscsi_tcp.c b/drivers/scsi/libiscsi_tcp.c index 2e9ffe3d1a55..883005757ddb 100644 --- a/drivers/scsi/libiscsi_tcp.c +++ b/drivers/scsi/libiscsi_tcp.c @@ -927,7 +927,7 @@ int iscsi_tcp_recv_skb(struct iscsi_conn *conn, struct sk_buff *skb, */ conn->last_recv = jiffies; - if (unlikely(conn->suspend_rx)) { + if (unlikely(test_bit(ISCSI_CONN_FLAG_SUSPEND_RX, &conn->flags))) { ISCSI_DBG_TCP(conn, "Rx suspended!\n"); *status = ISCSI_TCP_SUSPENDED; return 0; diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h index 2d85810d1929..10a9b89b7448 100644 --- a/include/scsi/libiscsi.h +++ b/include/scsi/libiscsi.h @@ -52,8 +52,10 @@ enum { #define ISID_SIZE 6 -/* Connection suspend "bit" */ -#define ISCSI_SUSPEND_BIT 1 +/* Connection flags */ +#define ISCSI_CONN_FLAG_SUSPEND_TX BIT(0) +#define ISCSI_CONN_FLAG_SUSPEND_RX BIT(1) + #define ISCSI_ITT_MASK 0x1fff #define ISCSI_TOTAL_CMDS_MAX 4096 @@ -199,8 +201,7 @@ struct iscsi_conn { struct list_head cmdqueue; /* data-path cmd queue */ struct list_head requeue; /* tasks needing another run */ struct work_struct xmitwork; /* per-conn. xmit workqueue */ - unsigned long suspend_tx; /* suspend Tx */ - unsigned long suspend_rx; /* suspend Rx */ + unsigned long flags; /* ISCSI_CONN_FLAGs */ /* negotiated params */ unsigned max_recv_dlength; /* initiator_max_recv_dsl*/ From patchwork Sun Mar 20 00:43:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 553286 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A80DAC4332F for ; Sun, 20 Mar 2022 00:44:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244506AbiCTAqE (ORCPT ); Sat, 19 Mar 2022 20:46:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42764 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244484AbiCTAps (ORCPT ); Sat, 19 Mar 2022 20:45:48 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C6C0241A14 for ; Sat, 19 Mar 2022 17:44:25 -0700 (PDT) Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 22JNXM2i017596; Sun, 20 Mar 2022 00:44: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-2021-07-09; bh=MPAHj8opUt8ttBPOP/UarocMIbLF3o2V57d4W0jh+zs=; b=FWMiJhDcD5Ce3FlrSh9lRPrwhfAa+aenanmo+PdzhW/zcR6o2cheLny31FQZ+sS72TJC EUHhokShd3/BRgw2nOhiG3VTj1Lph/K227ooL2k5iec1rW1wxSUDnMlT8W7nkSQc6NVQ wLUtnttG2nqTGcapUbHeemJK+oFnLYRt/s135nnCzj0jpgfDT0Xo9y7AvD0WOgMu4nBa 0lRDFN7rMbc6m4XmLpk4NDOPr/p0jTCH9eC0aBiugdvg3pfQrSFDaP4Kry3BECOz1qq7 PwkIkAN0UphllyrDhfTw19o+6Kjy51NMFzMNcan290CtE7BvFhbD0jGCNaMvjr+S3P4y Jw== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by mx0b-00069f02.pphosted.com with ESMTP id 3ew72a8vrj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 20 Mar 2022 00:44:16 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.1.2/8.16.1.2) with SMTP id 22K0ffah137063; Sun, 20 Mar 2022 00:44:15 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2169.outbound.protection.outlook.com [104.47.55.169]) by userp3020.oracle.com with ESMTP id 3ew8mg6mq1-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 20 Mar 2022 00:44:14 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OajxQ3mLKiAZGcsNVl+Xn81Zs/8YzcS6YoiusE9/r1TvugvLeYykyHk/S55ENVhlD9zFtw++OdCUQapYFp/pbBxYS/IPWl+4zayrAQL1kUuXh4UhI2bLscZ+gAOnzEp1XS+Wus5rZ9koyb4Kd22HmByFJELrCpXH8k+hxg4KUJEpQ46GImkFRL34p6oL3NqSU3ee2+md4spTQXCbf8Fd53Gi1Gq02KEWTzFI7TAydSjOx24GiJLfY+t21kg/BYapfaN4ukXXNjToKRvHX0kt4a0QKVhGP0SolMTRRboMnvu38L3v5U0IuEHppBIC/eAKfeoG3Kaa5wh4jmOD+SlUuQ== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=MPAHj8opUt8ttBPOP/UarocMIbLF3o2V57d4W0jh+zs=; b=PyLXFHmJdUYBzLlQkuXh2A0eFtoXjhsLlUC9ngQTW2E0VAiKMuud2zMLIg8B6/UQ/Ufg6lpMHlZicjORun9lQU5Z5B3UtbzokwSYPOHWVTYnL7G1gTuHAK7Vj4YjEU5gP1eul2UeIJSZj/OXmN3UKaq8qCjDav/8v2Fo24z68Qv+2ca9LMDvW+22UjofS760x3UpmyfsLbXhdhR/DQjGPyAQFogAeGLZYQ9SSD8ITYkLIROgeE4BitN5cmDThroRxeyMtrG59wBTXJPfA1XXX3tSpMcENjwO0TnAPRrgL/jaH/VmJdWw+iFgh2+dHEdSBQaaTvIS78aCpfKA7G/W2Q== 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=MPAHj8opUt8ttBPOP/UarocMIbLF3o2V57d4W0jh+zs=; b=lsQd/zWrEVqyIKhWPmsQrH8HSIC8MmZAyQ6jl4ZpsiRa+ydX0kmKP35apxUc2bnkQJpUNdo0yXrBkeJcDItVUXURyU02Medae9/OTZsczv2EH4XxEf46cePs3/Kosq/mOV9wALQSAD/nJZqylIthO00LsY/szmqQfM3x4wj1t0g= Received: from CY4PR10MB1463.namprd10.prod.outlook.com (2603:10b6:903:2b::12) by CH2PR10MB3992.namprd10.prod.outlook.com (2603:10b6:610:9::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5081.17; Sun, 20 Mar 2022 00:44:13 +0000 Received: from CY4PR10MB1463.namprd10.prod.outlook.com ([fe80::78b1:38c1:cfb8:537f]) by CY4PR10MB1463.namprd10.prod.outlook.com ([fe80::78b1:38c1:cfb8:537f%11]) with mapi id 15.20.5081.022; Sun, 20 Mar 2022 00:44:13 +0000 From: Mike Christie To: lduncan@suse.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, jejb@linux.ibm.com Cc: Mike Christie , Wu Bo Subject: [PATCH V2 02/12] scsi: iscsi: Rename iscsi_conn_queue_work Date: Sat, 19 Mar 2022 19:43:52 -0500 Message-Id: <20220320004402.6707-3-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220320004402.6707-1-michael.christie@oracle.com> References: <20220320004402.6707-1-michael.christie@oracle.com> X-ClientProxiedBy: DM5PR18CA0065.namprd18.prod.outlook.com (2603:10b6:3:22::27) To CY4PR10MB1463.namprd10.prod.outlook.com (2603:10b6:903:2b::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 79fa92e6-dd07-4480-c627-08da0a0ac0ac X-MS-TrafficTypeDiagnostic: CH2PR10MB3992:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: il9vqnIDbFUexR5t39Mjd9Bj9huDIXUd76Cp7+L1EL8iLeCwXRn9ptm4mFi8uFqwXSw6jtBG1EabfesYXjubIUCn5zuntz5IPQyrrRw7j3tavG+rEOssv8tKE+et3+puiRBR85TchLgmhsuMaVXRBLyjSSLjNvNEZAhGM53Gq/0YoXbj3HSpETFrPFpYw0zCD1fMii0w1Rk1LeNq10KnzembBlhJ7IVHdYyOgH78VBsVKrI677glcM8aBtr14K3UcYiot8o5QLeoSGh5FiivN3s6cwSJlWIVii88mM4zOJ2545kWzVMWTykznehiSaR7Na2r4S21QE3h6NDx7g0mq6TrgqPLtMJC8cOTGJNBd4kRcrtyiUh33yYY2pVH3MTR9ayCdCFcU4IiKjUEMIiGYyLRvLT/MHEtO6+u9Dq3Ts3BYBFU9eGIzgWcCSaARAFB4lPZespiieyy68asQN64UU7qvXRRkLZjNWgAYP5xssF4rva39V0aJfp9IKBU1Ql6c3k4DIen4ujS8LrIMYX3iTWUXc/q1rmsVNld4JjuL5j6KKDlGpSCFkrgeI1RB6ROP/+V3WNc6G+IGC/rGbGJkhXlUJIEDFuDEFwW/axyleVXAjr09tctpPTZf7+P6/N9/kWLmkXfTKgDA3/ZhyahwALYmpLMBw/q0i+loPFMC1a6aS8V24ltmW0V9GdgbqbveX0MHRlkzOEiopHzEThsyg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY4PR10MB1463.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(508600001)(66946007)(66556008)(66476007)(4326008)(8676002)(86362001)(83380400001)(5660300002)(6486002)(6506007)(6512007)(6666004)(36756003)(26005)(186003)(1076003)(2616005)(8936002)(54906003)(316002)(2906002)(38100700002)(38350700002)(52116002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: dNWXYJl2CAqzJ3tOisil9x35ZnAWNUpBuhSXeeiU6i7lqYbHPHeHZ71CQmVzzin44ZtItjtfYhnceIg5pOilkl/j6pCSMIoMsqRX648recWmkp3OgCxh07indjG/KkRZfGOwbo9vS+3UJjuuZMZSH58E8Mjj3Q9EPdii5nzNlohbnzsoWebCtBqUUDxUzTQflsUOYjiHdAUBCqN1kC8h8+jj17434/gW9q93zU35ODZPTJiBMTPEiX0BIbH3mcHbvDHL+pggGkDyz1oWbogt3zbrnbAPrAlYcFdKkWcWTqNnLFqjYO+1BLF3TI70/07v5U4FtuCEhP2xv33UVyzOLG5EjqGT9c06t8rELPID6mGp8xNci5FfwjmINQJtAaWbUKyy5RG7cPeYe2Tdj09CgYvdUG5cCjf9l09vQnexR3n6CT0lEDTmw3Ypnh+Lmg4WMYsqrkMSKgoHoVepBGYFZTE09O+X1dAB+uf5A/h2CalC9lzc4vj+m93+TPCGPonMqU1f5TBroFmj2hCeLe6+63Oxz1HehrKO58xgcSkVPr/SEeZ3Dkw2wnOmGd/LVuSQWLX6bC8o1OrpCjAUeRJeXqjNil50SBPKoPttCZt5Lru2NY1a/JkNzYD+26/evx9pPpteG/xOoGHQNDTrVAM40YHMvHU2Fup/RAWHz4o25S5FxZtDeTVNKmjBXgMGUaIjmFl+oIuXO4qQj50107GA4Nki3FiK67re476jPjXLdWI7agfTEb3O/9Ppyze/bCGlxnIhMjYGginNghDPwVZP3XeQ1A6O/gooqH5hA9QCuSczpgCRNm4m90YuY7CBy90g1CDbs2jOm2mXBxpo3hgyPNBeVshB6fUT8j7vcq+O0HyIY7ufVs5H8tH1hvCQtZaQWjiT4zQxChsJrd6moI0ccnKNv+Izu1bHTDmeWU0t44LHPkNmq0h4RzKP7xlmVnPODF2cSW2UzMDw2FJQechgGAnR2r0I7c4+UPF5H5Ema3fAYniW6gJ+HhXBsI7f8GwzT8qs9TP5H0gRBO/WdGDG/C7Zb4WLN65r2iTodz40KFNSAuVmsIUQCubhqIgJOgOe8k3RSnSIY3U4oKLVIS3xKymDirw5c1KsXS6MQJTBkJ3Ay5YvWj9ISDlDhlCMoBja37PgjU17Iws78rJUfYiU2OaMRgFWun6HYnxsKfdVByTq5A9Qqi0o6zt9aPA0RlQ4c77qsOJcp73Oioq+f8lJXWiAGo/I1fJLNs2TWQBSYKcC+1i07FzebzGXvQ/N8JE5RmPgrvIcDSVbBDcLY4hVNpkytz8scYbQMNCnsGNmfvTDK3GAc5zEQ7MSwhScLCuaQ2nI1jbCOVpvU5Oa0nvZP511KeGEWG+CU2FbPU6O2fbzOLQ3InAvwhDIjWWxTMA3fNAv5Xv7fD/fIjjs8nm1rvgYu73oDT8Q+KWx6h0kng5QzJ8F8qN7G1RMrO73pd/ozqPU4MnxJxm0Xty3PH8QNA== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 79fa92e6-dd07-4480-c627-08da0a0ac0ac X-MS-Exchange-CrossTenant-AuthSource: CY4PR10MB1463.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Mar 2022 00:44:12.7657 (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: l2wT271EfAnj1iZ9uc22w2g2RxKWiSWQJ7GtjbhEDFUDdIwEjXo6a/DRPF/DbhpIlDQS6ipBLXU6UDplxx5PF1xaM1AhA4Oz98mXUpc9DYI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR10MB3992 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10291 signatures=694221 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 adultscore=0 bulkscore=0 malwarescore=0 mlxlogscore=999 phishscore=0 spamscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2203200003 X-Proofpoint-GUID: 84GBtk6RvQXQ7Ll2PVudJ_j13s3RqHIz X-Proofpoint-ORIG-GUID: 84GBtk6RvQXQ7Ll2PVudJ_j13s3RqHIz Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Rename iscsi_conn_queue_work to iscsi_conn_queue_xmit to reflect it handles queueing of xmits only. Reviewed-by: Lee Duncan Reviewed-by: Wu Bo Signed-off-by: Mike Christie --- drivers/scsi/cxgbi/libcxgbi.c | 2 +- drivers/scsi/iscsi_tcp.c | 2 +- drivers/scsi/libiscsi.c | 12 ++++++------ include/scsi/libiscsi.h | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/scsi/cxgbi/libcxgbi.c b/drivers/scsi/cxgbi/libcxgbi.c index 4365d52c6430..411b0d386fad 100644 --- a/drivers/scsi/cxgbi/libcxgbi.c +++ b/drivers/scsi/cxgbi/libcxgbi.c @@ -1455,7 +1455,7 @@ void cxgbi_conn_tx_open(struct cxgbi_sock *csk) if (conn) { log_debug(1 << CXGBI_DBG_SOCK, "csk 0x%p, cid %d.\n", csk, conn->id); - iscsi_conn_queue_work(conn); + iscsi_conn_queue_xmit(conn); } } EXPORT_SYMBOL_GPL(cxgbi_conn_tx_open); diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c index 1bc37593c88f..f274a86d2ec0 100644 --- a/drivers/scsi/iscsi_tcp.c +++ b/drivers/scsi/iscsi_tcp.c @@ -205,7 +205,7 @@ static void iscsi_sw_tcp_write_space(struct sock *sk) old_write_space(sk); ISCSI_SW_TCP_DBG(conn, "iscsi_write_space\n"); - iscsi_conn_queue_work(conn); + iscsi_conn_queue_xmit(conn); } static void iscsi_sw_tcp_conn_set_callbacks(struct iscsi_conn *conn) diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index 14f5737429cf..fa44445dc75f 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c @@ -83,7 +83,7 @@ MODULE_PARM_DESC(debug_libiscsi_eh, "%s " dbg_fmt, __func__, ##arg); \ } while (0); -inline void iscsi_conn_queue_work(struct iscsi_conn *conn) +inline void iscsi_conn_queue_xmit(struct iscsi_conn *conn) { struct Scsi_Host *shost = conn->session->host; struct iscsi_host *ihost = shost_priv(shost); @@ -91,7 +91,7 @@ inline void iscsi_conn_queue_work(struct iscsi_conn *conn) if (ihost->workq) queue_work(ihost->workq, &conn->xmitwork); } -EXPORT_SYMBOL_GPL(iscsi_conn_queue_work); +EXPORT_SYMBOL_GPL(iscsi_conn_queue_xmit); static void __iscsi_update_cmdsn(struct iscsi_session *session, uint32_t exp_cmdsn, uint32_t max_cmdsn) @@ -764,7 +764,7 @@ __iscsi_conn_send_pdu(struct iscsi_conn *conn, struct iscsi_hdr *hdr, goto free_task; } else { list_add_tail(&task->running, &conn->mgmtqueue); - iscsi_conn_queue_work(conn); + iscsi_conn_queue_xmit(conn); } return task; @@ -1512,7 +1512,7 @@ void iscsi_requeue_task(struct iscsi_task *task) */ iscsi_put_task(task); } - iscsi_conn_queue_work(conn); + iscsi_conn_queue_xmit(conn); spin_unlock_bh(&conn->session->frwd_lock); } EXPORT_SYMBOL_GPL(iscsi_requeue_task); @@ -1781,7 +1781,7 @@ int iscsi_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *sc) } } else { list_add_tail(&task->running, &conn->cmdqueue); - iscsi_conn_queue_work(conn); + iscsi_conn_queue_xmit(conn); } session->queued_cmdsn++; @@ -1962,7 +1962,7 @@ EXPORT_SYMBOL_GPL(iscsi_suspend_tx); static void iscsi_start_tx(struct iscsi_conn *conn) { clear_bit(ISCSI_CONN_FLAG_SUSPEND_TX, &conn->flags); - iscsi_conn_queue_work(conn); + iscsi_conn_queue_xmit(conn); } /* diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h index 10a9b89b7448..b567ea4700e5 100644 --- a/include/scsi/libiscsi.h +++ b/include/scsi/libiscsi.h @@ -441,7 +441,7 @@ extern int iscsi_conn_get_addr_param(struct sockaddr_storage *addr, enum iscsi_param param, char *buf); extern void iscsi_suspend_tx(struct iscsi_conn *conn); extern void iscsi_suspend_queue(struct iscsi_conn *conn); -extern void iscsi_conn_queue_work(struct iscsi_conn *conn); +extern void iscsi_conn_queue_xmit(struct iscsi_conn *conn); #define iscsi_conn_printk(prefix, _c, fmt, a...) \ iscsi_cls_conn_printk(prefix, ((struct iscsi_conn *)_c)->cls_conn, \ From patchwork Sun Mar 20 00:43:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 553289 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 73DA9C433F5 for ; Sun, 20 Mar 2022 00:44:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236078AbiCTApq (ORCPT ); Sat, 19 Mar 2022 20:45:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42430 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244474AbiCTApn (ORCPT ); Sat, 19 Mar 2022 20:45:43 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E614241A0C for ; Sat, 19 Mar 2022 17:44:21 -0700 (PDT) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 22JDkuxP027768; Sun, 20 Mar 2022 00:44: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-2021-07-09; bh=M0TkzGY5+MJtiXFLyv+LtWAf/ptGUWbNj1xWQLaDhFk=; b=kljowxSniM3nnavovOJWAgGO5J1ZMq9Mw5b2Wfbh5eRoyuWRrbXTWitsmlWja/sarNnb dApKBUlbVIZWGdy8k7zgkEDSFbWoDSrHfXQmvFBw9IVA+0iFmPB99lDxFnMeOQybbnXw GTCzN6+/+RdHR1Xmj9wBmjwGQ+/qnrBH+aZZ10Vgr7m970i0LB5YCzXUQdZaT0d7bEjp EC0/lDfK93EUKKZiKhnNFSw69VzD/dwMocpu+oTrYZ3ekl9hgJddDiLLkvYOm/Y/b9ro kVW/BFMEAxGeyLEUGVehu0cepD4SUu8Z0rLkoTilnOSFaC7XQYX4eBTqGwQGyoOZWJl2 6g== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by mx0b-00069f02.pphosted.com with ESMTP id 3ew5y1rw2e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 20 Mar 2022 00:44:16 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.1.2/8.16.1.2) with SMTP id 22K0ffai137063; Sun, 20 Mar 2022 00:44:15 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2169.outbound.protection.outlook.com [104.47.55.169]) by userp3020.oracle.com with ESMTP id 3ew8mg6mq1-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 20 Mar 2022 00:44:15 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PBKqJRhWPeEWfc3RUULNVWC3xmoodYCY70kYOvYA2c3HXfTI3wWlLNqypi70wXIwdjt9Nq0I16ZlO5upwQrHuotnKQpXU8DUimEC2kgmYURPq1eNS5prWsTAK5AJwoFrqcHInsqjvrvM/bgng4dpebn7cx8sXUYaNLyA04LJIO2RBhlW7k3H1lnNTZQTQyk/hEuzwzrdz7zGOou2cVsxRK/RHa9Cc1ijGgREHAy75ZbLg1+lE+bHvEywdxiLOzTp+fGsF28L89Vb3rkTe5Zl9uNLjuVj5qY+zpyP+951ClZZ07UGyMQQU4R5XDcKYmnRUC0RU1+LfJcKnPJ5b7jb5Q== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=M0TkzGY5+MJtiXFLyv+LtWAf/ptGUWbNj1xWQLaDhFk=; b=RTMq1tobKFAbbQTHzEOWC/bJS3yBfcFoh1EBLQTv8P589na/uzk3Wrx+YVOa5NZBKzkescZfdLXUJJax8DcOTX48xC22Mtrg05V3ZgxqZUn2Fn+HBr6cxWcLIjy2pK8Fxl9h6L8DMgXgAB8gWzbLIvV6Nqy1JmIEWhYiFyPKwMETvL2DTc5nHXggMqkIScOx8g44jIQ+wLY8fJ30VBzGcsHO2d7kyU/H0unajARuRH3dMRMTWd2f92lTTUKVfWHPAoMvPWT1SArhb6k8HwrncymSvPaLcjg1xwxreRRrx1JgIwv0i7SYFWTi61pqmJrF9yWm+XggkMHhln2izxwLRQ== 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=M0TkzGY5+MJtiXFLyv+LtWAf/ptGUWbNj1xWQLaDhFk=; b=teroRakhDIMnX0IsNyJSj2gVSb6txdfTCiMJRZXp7lwLCw/idYaE8hpZk2sOAtRlEFCodnot9lKMMlx8IBG9lh+TYG8D5GruXJFPZ8kpcnkG8Sj4xq9FVRYxyefnMqm2Vc6o83gP8KTWyHlNpY7RhRZnnO3s22rcrtVAux1HL3c= Received: from CY4PR10MB1463.namprd10.prod.outlook.com (2603:10b6:903:2b::12) by CH2PR10MB3992.namprd10.prod.outlook.com (2603:10b6:610:9::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5081.17; Sun, 20 Mar 2022 00:44:13 +0000 Received: from CY4PR10MB1463.namprd10.prod.outlook.com ([fe80::78b1:38c1:cfb8:537f]) by CY4PR10MB1463.namprd10.prod.outlook.com ([fe80::78b1:38c1:cfb8:537f%11]) with mapi id 15.20.5081.022; Sun, 20 Mar 2022 00:44:13 +0000 From: Mike Christie To: lduncan@suse.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, jejb@linux.ibm.com Cc: Mike Christie Subject: [PATCH V2 03/12] scsi: iscsi: Add recv workqueue helpers Date: Sat, 19 Mar 2022 19:43:53 -0500 Message-Id: <20220320004402.6707-4-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220320004402.6707-1-michael.christie@oracle.com> References: <20220320004402.6707-1-michael.christie@oracle.com> X-ClientProxiedBy: DM5PR18CA0065.namprd18.prod.outlook.com (2603:10b6:3:22::27) To CY4PR10MB1463.namprd10.prod.outlook.com (2603:10b6:903:2b::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a2950706-2048-4189-8470-08da0a0ac10e X-MS-TrafficTypeDiagnostic: CH2PR10MB3992:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hk2ajOv8nIXqhK/5jihYTnqB/rVKnNuxVOnkpUq3pmT7//h4g+VYSoFaixAH6CzgeZi+8vpEkNy6IHCsC++/AST6TILxlfd+fB4xUy2vQ+WeVo5Rmf4nh1n7iXWEHUfRwbS1cWPmCmpWOUGY/8mI4UcKMNuOUBw7vlxoLwS9AxNoWKlvfJzkV7KGWdTMbKC6A9AhFgMPX3gAo5HvGTqUhdu60Gb5nd8o+bW7/W4s9VYRY7ntE2xbctejno5ZkHG7LfONdC7N1yhVH9jX68D8DDqJy5zNJM0rqHJVayCU7JBmqd0PliuxQQqehrhxGK0NvFVrmxej4D0Ur/K89Csd1oBKotmoBlwpI8P2x6he/ksDxCjZqF2TTw2TF4KQdZkAoILhTdGthd2GhvFZkXZjjU+QThO8EeZ2wcUI2j+iIAOvADIBFgwgtYP88FsEkd0QZTe2f1R1qorX/jaNTpJ10wkiQ/WsB/+HnauHt8xcu2+IAqpG+WUvOFDka0r2KEx/2fTIxFkPdSebqF4nawjFsI0+GNOLW/kt8bfCoUcOcgjUwIpWzi2wS1qMu1jmfqGaSpoPvf/WajtLbo3z2lnBAb4ioZSoVoqzRhpEtnot/gHzb9K8lBQB+wz1c5HgjtVVRMSrvYL/GLJyM3lItcsObNnGkS1IkftnotMnYFWz527i5SY6RKxao936sTHp43w0XS7gapKOkHt0kNTU5zg/xQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY4PR10MB1463.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(508600001)(66946007)(66556008)(66476007)(4326008)(8676002)(86362001)(83380400001)(5660300002)(6486002)(6506007)(6512007)(6666004)(107886003)(36756003)(26005)(186003)(1076003)(2616005)(8936002)(316002)(2906002)(38100700002)(38350700002)(52116002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: WZqoAoskioWn2/u2XvHUqtsH8Xl40+zH73/gMNusBSkAaAFhC4WylGdYtTcl5BZKtNMF+lHh8HP4iCx4nyRJhyrxo3oqEAWKyNTPJjrVehgGFVwrxNecnW73iV1qBsYXh3iPzeYJjbf2ugH3ayr9EXWA5V3tm9sZRrDprBu4M5PTTpdfZltvBWKTGgkJsjyoNzSMHYH6mef1sU/QChICjfjb7upg8o+NxaZGY2j6CrtCSVTzQ9NPo5DgsE6plo4DHc0Y1YbRC8pvX7Xl5HS1SPvDOVCW8x9YZ6uJfMqQ4xI8zWzsUsnxTIKfyY0S+W3tlERXlgFYFwkPY4U/hMbFdHE0Ot7WV7li0wZqUSxG8vr0/B/WDXYFQqvXNkX2hZJyvUTXrXVCSzdbVm8v1PoKfRJT1a9/6nQxLqs/SFjREoegd0vqglrK/dQQuWThvpajUiIVyN69EUjp5xOqIjuPdASruKhIzkfiTNFlxqPXOqObUnz5StKCx4a1Ub72EFJ+mVULAYybPU4q/LHTUVmh6LStEWJBZq+/ZBozZhyD3NpAXBBcXANT0QlcT39+sSA+Z4S5GM7vruFbDrheCQddIw/mOAsZ7+80b2SQIDah8/RxeeglzYohiqJEP4UQgbJtijNGoC9dkmm0pjwYyEJp+pRGJ0C+rI17IWIXEUbSb4cDSbatl6ljGfytoXQT/IDyPwDX9dXFP4B+rT/hIhQoUj3rIYs1SajeWGSHPZNvkhvf6ph3QtR2HeXwU9T8bl8XLRdqqkT48LTXmRsiSkYNUGwcIDiXEiTvGjjPJnVHdOye5DFASOg650+noVqUfZRz2cfR3pz7xzuyPS8zW7hvyL54E2EjOe735tANhVQD4GAAkb1aqZd4CcuRSYqn6d4nZ3m+Eufw5MpOsjrtY87exkRhQfNujgiSztbJ6ivgl02hXw+OUX0324Ba9lir590M1+8J5GhRu9SwQgFz8F5grtlVerSSpfSuaBAxH0DZ4kyjAXgPNSBNOMrzjPzYsE9weQfcSA7nHOavNW3/dfDg9l5+n6/+BYfApM8Aw0norSpnbSTf2Ruq7A+2LS0bBZxp+XMHnPBbFbBXkPSD2XQqbtnELAxMY/hiYjxQ9w/edtkq+wUf00TR7nb9Yotstk3PbaRrBj4j3aqcmQMSvjlOdNpbvJj7oL9SDQ6hKQ7dOIyVfCoJzeYqx5E3bvTjVFC91tgjkgWbOgphF/1PfLxZ+H9pL+8K3qB0KtrhDouiaXg3FD/6ayviVlJS5o6Lhk3gqo83w6TuaePs9QbZZ3OmD0A3+sNwprwBmzmb0+IlYkqG1BYut/bdj/idrikmKYEWH5hj3qJXQnyBJrdSoHd6txDBPm+f8fvqmB4/Ad9RSolTewJdDOzTY+dcVIjQKg2d9pypa7IOGgbyUwvDpt2PlC5ITU5yP4KQiPzqBy0XVLxUwMwLgbmZP0SyloHsk9Cyb6JCCIqlVJJ54rXYA8/AqQ== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: a2950706-2048-4189-8470-08da0a0ac10e X-MS-Exchange-CrossTenant-AuthSource: CY4PR10MB1463.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Mar 2022 00:44:13.2657 (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: UDCphVaYT0Z0ND9LvErwSKyimt2cI9iejvdYQK0WPmEkoMinLWUdjTOewWASxqeiexF1gMgP7hGcdpb8KHNxohB8djVtB/MnwjTZoBgOMXM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR10MB3992 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10291 signatures=694221 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 adultscore=0 bulkscore=0 malwarescore=0 mlxlogscore=999 phishscore=0 spamscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2203200003 X-Proofpoint-GUID: fwr_hJLOpR8l0q-kt-HX6Y3a-SfrK4fd X-Proofpoint-ORIG-GUID: fwr_hJLOpR8l0q-kt-HX6Y3a-SfrK4fd Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Add helpers to allow the drivers to run their recv paths from libiscsi's workqueue. Reviewed-by: Lee Duncan Signed-off-by: Mike Christie --- drivers/scsi/libiscsi.c | 29 +++++++++++++++++++++++++++-- include/scsi/libiscsi.h | 4 ++++ 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index fa44445dc75f..fec64cbfa4b6 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c @@ -93,6 +93,16 @@ inline void iscsi_conn_queue_xmit(struct iscsi_conn *conn) } EXPORT_SYMBOL_GPL(iscsi_conn_queue_xmit); +inline void iscsi_conn_queue_recv(struct iscsi_conn *conn) +{ + struct Scsi_Host *shost = conn->session->host; + struct iscsi_host *ihost = shost_priv(shost); + + if (ihost->workq && !test_bit(ISCSI_CONN_FLAG_SUSPEND_RX, &conn->flags)) + queue_work(ihost->workq, &conn->recvwork); +} +EXPORT_SYMBOL_GPL(iscsi_conn_queue_recv); + static void __iscsi_update_cmdsn(struct iscsi_session *session, uint32_t exp_cmdsn, uint32_t max_cmdsn) { @@ -1942,7 +1952,7 @@ EXPORT_SYMBOL_GPL(iscsi_suspend_queue); /** * iscsi_suspend_tx - suspend iscsi_data_xmit - * @conn: iscsi conn tp stop processing IO on. + * @conn: iscsi conn to stop processing IO on. * * This function sets the suspend bit to prevent iscsi_data_xmit * from sending new IO, and if work is queued on the xmit thread @@ -1955,7 +1965,7 @@ void iscsi_suspend_tx(struct iscsi_conn *conn) set_bit(ISCSI_CONN_FLAG_SUSPEND_TX, &conn->flags); if (ihost->workq) - flush_workqueue(ihost->workq); + flush_work(&conn->xmitwork); } EXPORT_SYMBOL_GPL(iscsi_suspend_tx); @@ -1965,6 +1975,21 @@ static void iscsi_start_tx(struct iscsi_conn *conn) iscsi_conn_queue_xmit(conn); } +/** + * iscsi_suspend_rx - Prevent recvwork from running again. + * @conn: iscsi conn to stop. + */ +void iscsi_suspend_rx(struct iscsi_conn *conn) +{ + struct Scsi_Host *shost = conn->session->host; + struct iscsi_host *ihost = shost_priv(shost); + + set_bit(ISCSI_CONN_FLAG_SUSPEND_RX, &conn->flags); + if (ihost->workq) + flush_work(&conn->recvwork); +} +EXPORT_SYMBOL_GPL(iscsi_suspend_rx); + /* * We want to make sure a ping is in flight. It has timed out. * And we are not busy processing a pdu that is making diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h index b567ea4700e5..522fd16f1dbb 100644 --- a/include/scsi/libiscsi.h +++ b/include/scsi/libiscsi.h @@ -201,6 +201,8 @@ struct iscsi_conn { struct list_head cmdqueue; /* data-path cmd queue */ struct list_head requeue; /* tasks needing another run */ struct work_struct xmitwork; /* per-conn. xmit workqueue */ + /* recv */ + struct work_struct recvwork; unsigned long flags; /* ISCSI_CONN_FLAGs */ /* negotiated params */ @@ -440,8 +442,10 @@ extern int iscsi_conn_get_param(struct iscsi_cls_conn *cls_conn, extern int iscsi_conn_get_addr_param(struct sockaddr_storage *addr, enum iscsi_param param, char *buf); extern void iscsi_suspend_tx(struct iscsi_conn *conn); +extern void iscsi_suspend_rx(struct iscsi_conn *conn); extern void iscsi_suspend_queue(struct iscsi_conn *conn); extern void iscsi_conn_queue_xmit(struct iscsi_conn *conn); +extern void iscsi_conn_queue_recv(struct iscsi_conn *conn); #define iscsi_conn_printk(prefix, _c, fmt, a...) \ iscsi_cls_conn_printk(prefix, ((struct iscsi_conn *)_c)->cls_conn, \ From patchwork Sun Mar 20 00:43:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 553863 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 646A2C433F5 for ; Sun, 20 Mar 2022 00:44:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244493AbiCTApq (ORCPT ); Sat, 19 Mar 2022 20:45:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42408 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244484AbiCTApm (ORCPT ); Sat, 19 Mar 2022 20:45:42 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50CB1241A0B for ; Sat, 19 Mar 2022 17:44:21 -0700 (PDT) Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 22JDHFEs017476; Sun, 20 Mar 2022 00:44: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-2021-07-09; bh=V6E1xyfdG0sMcYFI86rKLjGCzrRBMs822iIkct0fXHQ=; b=q/Mbfu1+KsSdBRqJqW8hR4eUfU7bCOor3CkMoPNaUQPH3u5WKBFk7vZprJc3V/yWXITM HUHVV8fKEWIxNf+PuPCglRo3RWtjm1ij9dwOtGI7XlKXGevy/EOn2JQr0GZQGa/NKG60 YFaeb/gM3R18sw4EciVe49EpF2eYl1Dr8dJH0gcL+h8A14FzjI2vYhRCoEHlotyms/pe szObCpBd8ncfe76rEwnfinT02PH55aprSJ+eQ4eWfvdlRFY4aFWRo5OMQvWvcYDZ/H0U 5DHFD+4enC5V+K/0U5L1MIyUurm08TQbi3/QwBzIKFwoxir2pSResct0IyUoVnmkFzTP 4w== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by mx0b-00069f02.pphosted.com with ESMTP id 3ew5kcgw8f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 20 Mar 2022 00:44:16 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.1.2/8.16.1.2) with SMTP id 22K0ffaj137063; Sun, 20 Mar 2022 00:44:15 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2169.outbound.protection.outlook.com [104.47.55.169]) by userp3020.oracle.com with ESMTP id 3ew8mg6mq1-5 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 20 Mar 2022 00:44:15 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=M8cr5IEl/OhdXKCV+7BDOEBRYKjarpVdlsHi19ALJBsUYL2d5LiwobchyEn0/g+BnhCP721YhNJWYSm2wFKMObpEshCO+nB38fzPsiLQpb7YUYowlxyhpy3U2I1BXIz9zCXTPtpH/2l5jA0EpIaZJOHTCoqs0xx04oi+MtOhQ0wseKPLe2irNmnWZgJHLE8MAav3gpDeUe72tJtUhVQ87viiU/HMJ1gJF30v+LkmYM0jQw4HrTipegf3+x5bq+otGoWxHK2ztVlvpK1pfJp9nR33RXVM9/sOYNbE2D6fPlCvDlITBEuRZLFMYZxGfkySkkbe37zDlO7IzMfXiXlLmQ== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=V6E1xyfdG0sMcYFI86rKLjGCzrRBMs822iIkct0fXHQ=; b=hnwyAWuAm1yRdHTUANRZGuo2YsAfl3Jc0C2zx9/1ZOU/X5l4HLMU44P0LRQGKxNnhKCzh7FRL5LBFvCFs6G9yaHioluS9TPLNrYV1I81oKzg7YbeWMvHNht7NjiIul3eNyCvhXJG9kpfflLJNTgq0zd7g4YpCgRa6YfodxB1A3ktcSmHCdHOPInxf19zYcuCA7BTWKR+SBR61PVVZsZxdllpuCJs3aNYJmC0F2T0yGI6H9lF9KAp2kq8GutdDoECoMkwHfAHCTLyUcYbFCVnpSDX5R2o3p+5vx/Af6MV2DD5BVekSaC58N7M3DQyNTAAudXd7x/FbigHB3Z/JCKwxA== 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=V6E1xyfdG0sMcYFI86rKLjGCzrRBMs822iIkct0fXHQ=; b=IZl1kNWidl8yUX0YmBIeQiq74f8gehbPv+/C2AUMww4Y2tk1VRblud5++KrSiBaRIbU+pHO/LfNaCK0mZUOB75J68m+kD8mrg5F3pj6cb4kB1+1tlQbxhwrHQV0SZJ5yyqyQ0GVdFPdQRLa9r1oxOVdh91cTUVyCvXBBdLrHXcY= Received: from CY4PR10MB1463.namprd10.prod.outlook.com (2603:10b6:903:2b::12) by CH2PR10MB3992.namprd10.prod.outlook.com (2603:10b6:610:9::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5081.17; Sun, 20 Mar 2022 00:44:14 +0000 Received: from CY4PR10MB1463.namprd10.prod.outlook.com ([fe80::78b1:38c1:cfb8:537f]) by CY4PR10MB1463.namprd10.prod.outlook.com ([fe80::78b1:38c1:cfb8:537f%11]) with mapi id 15.20.5081.022; Sun, 20 Mar 2022 00:44:14 +0000 From: Mike Christie To: lduncan@suse.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, jejb@linux.ibm.com Cc: Mike Christie Subject: [PATCH V2 04/12] scsi: iscsi: Allow a recv and xmit work to run Date: Sat, 19 Mar 2022 19:43:54 -0500 Message-Id: <20220320004402.6707-5-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220320004402.6707-1-michael.christie@oracle.com> References: <20220320004402.6707-1-michael.christie@oracle.com> X-ClientProxiedBy: DM5PR18CA0065.namprd18.prod.outlook.com (2603:10b6:3:22::27) To CY4PR10MB1463.namprd10.prod.outlook.com (2603:10b6:903:2b::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 88446c75-2d59-4020-304a-08da0a0ac15d X-MS-TrafficTypeDiagnostic: CH2PR10MB3992:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: VeqnzvlodR/UFz9rb9x6KiEIIBu33xcoARQYuB17celYTJUKJdOHBgq9zFAJYUqGWYmRIUn49ohvcu0SW+BwcPzTdJySUk4PNhrFK6eJalEXl1ZcUsTYm/k4nYTMkOrVsE3mD4XA1p0PB1BYjh/RZeipdFO7j45V7lt/C5P8umv+mVtJ1AgZrz/pkuoBZvwGS6//dK5lDBtJoseN3e9AGVG0h5OFqgMdOwPFzWmegps0iu2Lo0ALfpVbG4WGP/qnMjYCf7+/Vh9p/fztllXZPNT7DjqiqIKgv+rck3NxUpRJF/r4ZHldAlO9w3I0x3bt4WyZ3VnYbUt4Nqpe/rFSgrW6eZ5+cYFA6hmDYlteG1bHbPxcSAgpKtlM+M/pkeOjHVRVM7j+YYKVxEymm58mKvJ8URt1m612lmvjxWYSmJrpgoEx/P+al1c+s7so6Rzah1zGhUObdfqctTQLhcjOPV9ek0o549co0WP5IYWk+3Q7pMkV9ulnQaRdrCfsgiY9PxPvfKT0Z8Ck9YUSW72sSKS6a6xDrmmklpUF2jp8ZpsI9/3dJgC/mVPE2309kiADhIel50pMqZQLQTrELLrGiXlQg1KIpgC9fBKRAO/Y+ret3jEJjleoiVMBlgcVBl0I5g2+32gDQaS9s1t2hCJ5N6MB8MGm4tBF8vA6QsNlVWcY2Fmr9+MPHlOVJJRMxFude4oiZw1ruKhbAmk45G4npQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY4PR10MB1463.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(508600001)(66946007)(66556008)(66476007)(4326008)(8676002)(86362001)(83380400001)(5660300002)(6486002)(6506007)(6512007)(6666004)(107886003)(36756003)(4744005)(26005)(186003)(1076003)(2616005)(8936002)(316002)(2906002)(38100700002)(38350700002)(52116002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: r0qibsb5E6BmsHGQxPL3jZWL/Mhbz9CVPHvU0jsxqJwl0rPj5tmEsPIVD7YUV9JS3f+LJwyGM+Obt/DOVpvHepIG2aD9VbDg/RkyiqsC+CTHmwB28Zm4YhpTJkhME+5zHIOaipPgwMAjyoCAbPsEyJp27C4r6VOMM9htjv8Ex4G8ed+ybA/DunhvknJai9MHDZPcHuQ3MNAEBCEraQ+ZjDbqTkNpMK9AbI65ZSmQN75+tcvjCIUu2H/5rQFrfNMxsb0HV5/G920ydJZzafMfj9TIDXr0AZo9t5jXrUGhCG+2L0h4+8MSydo0UUa1R1ZStdGrJ9s5GVE/qh6g4b+XMK8XtlQyUszJYccHAFzicyO+I65c6Z/Nr3bih/pYdyyGc6xYlsU9iIjCWNoFnTnWr44ZRHVtZ9t907TzfqVPi1i+T9UxNpSZeiUzwDSFHoqQBl7f1Cgak2V7AYeWgGTrpe9AVP3+5Mzb5xrFCgVa9ceW/KxWomYhHsx6vTkrs+WNdgC2y/hHYw6QfCgpqDrX4Md0TLthvuATlxxNdMFYyUmZEJ9ERfrOUbaZm+e9bRJrN9MiputnOv5kj3eGy91eBgOmK64CAvqBnkLWx/xWtnWTz0+bK70oGK4XtlD57o7/E/kj5SJAne9HkhS3yO16G/xJB7txAq1igSGvq0PusQlorI3a946ZsqzM265m6lnjRnbvxzGW/J3uprMCCKGsUSL8cV08Q4+9FYBCQS46RnnbLyRzsyOlEj7YiAmhmww7JqbyGKm9TJpIWAnnu59dKWjFqWeCgCX5714E9bHshn4RHZzp5csqrPqiO9JzrGRPWTSwe1M8Fz00Rqm40cdi+rrINwIlZSbmTc9ksVUrIJqN/Pf8efuGeSFdycPZWTO9xIwxBvLfEsDqUcARbQvwAEJyoJg06/3R4vn0wYo48YsnXVNgzJLnAdlGiwb/VsAI6cRGk31o2x0zinjNUzREmakkjGWpCm0C/jnqU+IpykhD7eTSnedc5R6ahlb1s56XRDluT0+pX8FebK7Ket53/VWamIiX8cCyO0pvWH2MjDS0nJKiw7J1k0e8hr5ze9FiCS0BdzV0YfMKRLJkrTmpl+fd/daYx5q2fjcY73OOKqbG1RNIENOQ3xv1HvuFqhn7vdN4z0s6ZhysQ/a539W1ES9MBxuvriVBIgsJZdfkc78oLf/VWLMfPSVMQntdaCZihL54yokgUEuhm9D75lUhGBoLrRFRd3UxylMU2xStfsNQtlxKCrxfwwYHe8S4qsymXRPDtiTXVKE8SjuAMXboc7MaYPBqJKDSSp5w4ST15Ujw2eqxWKrKkevRqiVG6xosFXhj1PhTPkBNpnrlK0hsangVxTWek+9NKDm0tBOUXV59Zn83BbdmVa3IQ91/XsDp2RvZAK+yRMY3rlUDsYiZDVxdsJ/wMSyqNPc8vy7HF1i4Cg9nHBLG9MMXYmJsfy+bHRSYZGXuknHf9xNdfcStcw== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 88446c75-2d59-4020-304a-08da0a0ac15d X-MS-Exchange-CrossTenant-AuthSource: CY4PR10MB1463.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Mar 2022 00:44:13.8438 (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: 1pWEyfe7Od6FvyMVFAJclXxXtvYfMszJEJiVqyCFTSG59zv12Xrb4yhwoiQgCVvVNQ10zPpDLfQbUmrHD34w2z6ORHvHDYLi9E0ReGxVmnM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR10MB3992 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10291 signatures=694221 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 adultscore=0 bulkscore=0 malwarescore=0 mlxlogscore=999 phishscore=0 spamscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2203200003 X-Proofpoint-GUID: 61kkDJsgeNNOWemWHXssNDzjr1wJ2yqh X-Proofpoint-ORIG-GUID: 61kkDJsgeNNOWemWHXssNDzjr1wJ2yqh Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Allow the recv and xmit works to run from different threads if the user has set it up. This also removes the __WQ_LEGACY since it was never needed. Reviewed-by: Lee Duncan Signed-off-by: Mike Christie --- drivers/scsi/libiscsi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index fec64cbfa4b6..0a0076144874 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c @@ -2824,8 +2824,8 @@ struct Scsi_Host *iscsi_host_alloc(struct scsi_host_template *sht, if (xmit_can_sleep) { ihost->workq = alloc_workqueue("iscsi_q_%d", - WQ_SYSFS | __WQ_LEGACY | WQ_MEM_RECLAIM | WQ_UNBOUND, - 1, shost->host_no); + WQ_SYSFS | WQ_MEM_RECLAIM | WQ_UNBOUND, + 2, shost->host_no); if (!ihost->workq) goto free_host; } From patchwork Sun Mar 20 00:43:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 553288 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7D099C433EF for ; Sun, 20 Mar 2022 00:44:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244510AbiCTAqA (ORCPT ); Sat, 19 Mar 2022 20:46:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244487AbiCTApn (ORCPT ); Sat, 19 Mar 2022 20:45:43 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4B62A241A0D for ; Sat, 19 Mar 2022 17:44:22 -0700 (PDT) Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 22JEMfp9000642; Sun, 20 Mar 2022 00:44: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-2021-07-09; bh=qoz0WTZo0L6VOmeBwUesT20UpbkpbtYLtoMnuf/71PM=; b=ElEBDE4ljhlcy3kIYR3vYcryEhTFiGVrjFr9j2H54u7/gHcigGSMyAZzZLvKFIeCe7pC Z6iOKq/1LIU5zC/0qWcEm0izOfi+5T6eLVxv45KwHjVnJngY2j5WphkSa3NFsD315ot+ JdbsUVIcI+FjZn55LN4HBw0O/AiyB8uAdliZBFoFPk5JS8ApkaQ04BvJnclFtAmrnE47 +XiXiN6NZjj5+EfpSixlxMJYmB4oERaGj+nQRBuNzFVjxTqmRslRdIKPLRmLn4vF9PQT aRSA0Cmt6X5zatqhuWUO1ZYD/ZRm7rRTMJJzGJRRXUNjVoF+N+WDefg2aJp2qDKS8xpM jA== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by mx0b-00069f02.pphosted.com with ESMTP id 3ew72a8vrk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 20 Mar 2022 00:44:17 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.1.2/8.16.1.2) with SMTP id 22K0ffak137063; Sun, 20 Mar 2022 00:44:16 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2169.outbound.protection.outlook.com [104.47.55.169]) by userp3020.oracle.com with ESMTP id 3ew8mg6mq1-6 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 20 Mar 2022 00:44:16 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iRmi9Jz8to4ch8VgDfoJmyjpICqjxr54769k+GgGGGDnpcCBxD8UTEnIqat2HDimz1jQjK918rS7JeTOyFqK2+n9Pa2ncaLOICNj4sot1cBxlnK1zX7xse8u6nM1AtHdI4nIbPtYMQrbMsWcC48xsjVqTvnPCAblyO5uuTT0WoFHPJNM9hxnc/tFQc60cd3ae6RIywm2TY4cmtu4pO84Jsd+S12uvhjlAZ+eW39WblAOOKLsmG/gmiRVuA68r3NozKBmR6TXGLFkO8CaNXcMgo7OZm1hjV8spFqGKGfMNpQC+LQSCUGQmy/wpPNHlufm1GZQ1Fm9I3sykNafi8e2GA== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=qoz0WTZo0L6VOmeBwUesT20UpbkpbtYLtoMnuf/71PM=; b=TQXSWFchIOAdzqL0gQ1UXqW8Nwym45z0baF2+OtyHp7apqiGtFGl6NHqpTjJ7ciwkLVasOQk9t0rjWgk4jKRzc6eW7Mucp4142iogZOQYKKbu1R2D2CL+8RMZuzXLUvV0jIxzTEVxFAG+eDOnK8TpEsBCYV+jRduG8/cY71xWU2eCgcZ5lv69agN2RiPjeI6RZKr8kZRh3U4N114MChs9fezUlGrLGoAkZeyXS/V529pbmDTwvedm3BGw7VJ7qh1SfJcz8sKucb8F9srHrZfvlKWFpAHgrtxhon2BZgBtp8k32ado5rZI7kwr0xOTjgVKyry2sCvV0XnUSo4Ao9ImA== 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=qoz0WTZo0L6VOmeBwUesT20UpbkpbtYLtoMnuf/71PM=; b=xUxCpo6D7ekiTc50bWzcf7RpDTOFZ01U2m51ud9AHjKIuNhLrskK5KwR1uHvqOIpd5bmtFwkL2HQ4EEwhvS8yETXpJkJaoe0kEQ0sEx789Es6fYjMNhGcGNodQ1IEcAv3z1uaHIyrqC+jE0BY0SX8sbtiUAA0wTSZbs//fHOkPs= Received: from CY4PR10MB1463.namprd10.prod.outlook.com (2603:10b6:903:2b::12) by CH2PR10MB3992.namprd10.prod.outlook.com (2603:10b6:610:9::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5081.17; Sun, 20 Mar 2022 00:44:14 +0000 Received: from CY4PR10MB1463.namprd10.prod.outlook.com ([fe80::78b1:38c1:cfb8:537f]) by CY4PR10MB1463.namprd10.prod.outlook.com ([fe80::78b1:38c1:cfb8:537f%11]) with mapi id 15.20.5081.022; Sun, 20 Mar 2022 00:44:14 +0000 From: Mike Christie To: lduncan@suse.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, jejb@linux.ibm.com Cc: Mike Christie Subject: [PATCH V2 05/12] scsi: iscsi: Run recv path from workqueue Date: Sat, 19 Mar 2022 19:43:55 -0500 Message-Id: <20220320004402.6707-6-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220320004402.6707-1-michael.christie@oracle.com> References: <20220320004402.6707-1-michael.christie@oracle.com> X-ClientProxiedBy: DM5PR18CA0065.namprd18.prod.outlook.com (2603:10b6:3:22::27) To CY4PR10MB1463.namprd10.prod.outlook.com (2603:10b6:903:2b::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8f1a6e8a-63d7-43b6-c7a6-08da0a0ac1b7 X-MS-TrafficTypeDiagnostic: CH2PR10MB3992:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: KX4sS/n/iJKqtAEvR7QU4bLyU6RQ10L+DDq3f/oh8nbMIWp3v7GqwI2IbDY+NgZMVO53O1PsE/fRLI6ji9D1bY94tcJyY53bevFRf33sqP5tFLeMBAQbmsHJUMw1K0kINo6rYJeGe4wb2UuS867pP1f1ir+nOjZSmV2aPA5fUIL4pMSFWVTanPqtn22yXx29WYidQD9x7PPpGXhIcw2pv7VVaP96MlSVE5MgAQ1aLyjFx4jBdXutmPAkIefO9UahJ7mae5vhZSRmAIu8SYtKti6RtLx4FwO6wzJgAcVVt3BOUODCLwqSO1YFC3EWrd+iNz9uFCBH6ya7/Tp248QrSMbhH/KI8x/niZAgoeJEx8ZgZizM2is4bqeJjGDvLYhlf8nwHWvVoixlCoRUgp339b8SSrpx0F0G5MiXuzrRvDlRWlcLcF56kIRLSXq5NVzhHZGLi5UR+vHTuEIY8pauERxl6UEnj5wfW4k4sKbKNTyY87/D2PpKx+/9jCcCaFnyniQoXj6jc2a4m80N08jSn8DXEmwTiJm2H7//e6tlHG/+QZMEeQ7cexv9QUVy9FI+SLqIh2IWXszrA6aYFIfmUbteqmh2VduwktA5drvDPQiJXOh6qDHZ2ZwWdU/iSAlKx9cumhGlSvz35XTSXJHVdgkRyVioGgrr+yiw0jfdJRXwFXhO5XfiRf1WAO8tev5aPjMBCgrBcIOxkkyrFdiPNQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY4PR10MB1463.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(508600001)(66946007)(66556008)(66476007)(4326008)(8676002)(86362001)(83380400001)(5660300002)(6486002)(6506007)(6512007)(6666004)(107886003)(36756003)(26005)(186003)(1076003)(2616005)(8936002)(316002)(2906002)(38100700002)(38350700002)(52116002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: RoPtP05H5cg9vyCUvxbPhRjd9B3Rmk1lfZvy9eKgk+brAMBNNb187duBshCvtlltD+Uz08f9vdfRZzOpRczDfQLeZdMzhiW7v4oRG9wwQ+m1h19k7Mewba5z2R7SVwghy/QkciqeJmZ+6gauYFth4ptBjbUfOQLJ4aKdsOXoFpzyxkkKp3TYzxdqvDMaEZw7Okt240l49NZ2UhyJQsmY+OtJqOiHVeg3Aabuyt6urJ3pDszV0oh15FYD3Wxr9u0SXGIMAsNs97Hwf/w3yXFDduHpA36pgy5zaWY6jjRWRGX8O2XoMKdjgs6BDxodFN+SbBFWd7rnCsz8zy7ZTMNkXcyhV1UKKDzPdx6jti3DMSMvM6rTD9TkHf8vW1lXSxfTbWs6t0z48Ncr93PidKQlb9cm+0QNZFUSMBM50hxBmG7pVKOWIfDANLRqhGljYZwPYvyY1U44VSy8ctgOzgVs4ztdIa6LJI06dvpHg4tmRTpszSri30VR86tGTQJQkyMARStx9S0uUJiYqFqDw0bZcdxnK5dpwKYgYTBRGYZuYxR4UIvlNsD7Gq7XmxJ0uzvKkA3GaSwjdNl/mopptnPU1fp+oNwekXhhRG9DEJlf2nYnDnyNIFpk/+URUscC6XuVY16D5BhIAU93O2QYZKjLFx3qRjXZ7azeZLoTSReY8E5pnNa30hC+JRtd60ZfZhnuIvtZf1ac1qXYX8mepgqPJcLyZvVyVkC8Oq5lgqWtD+jELzG3QE5l7p0cfqLQ6QZ74zoAcRv7eJz4tUSp4yKUqrOc6AZTycgZfh+RIpl5qm6nMHo7Do+A8FF3HB6udXmOFiYumVZSuaK+tFBj5bWbFn4zuG4Bl9Z7hLhbilb7v2PI+6CeMf8Ubrd5s/RAJXasytFSu9akG9PN1ffh8gx1zhtsDzqaKPiFP7WUKX3/U2dKCYB1qu2hlP2eRz2ghiLuwvBdiBtlIMD8sas7xzwlzREjLM2y3CWUTqE+R3e96Vx8EgqsxRifeW3EyfivOjFWB9NMDfDqM94LnGrSc1H1AA5LUMQk7kxp1jMlP5aHhFQcDxYCGQYg6xc/Ck/oL7rbWl1TiEXDvtNsqchz8zRjD9veXVWeVp2zykjetmagJH0H3xJtT5AhKd9DCv5RPwMHtQnRCGhg9YWUojnaW1K7qmNjho2OMotInjrCD1bjkauAJYkR3DhRA1ULy9r6RNcpSecGoLaZJq+7sT+W+pfMYsKkG/UFuw+zUwMB//pSzObZDGtuKNpW8S/eg9GF0meftQwrlml19i9og587oTtVPiClIuwugUYymqjClpzncvocF6WfA9BCQm1ESUxqWN4WboTvUUH3vKv29Ak98PWFOQNj9aKhCGz0SUGnUSdOsC7w9atFr0DbBbaGD/jaeOoArU6G//vN5IJ6PiH6sbk5hAKoOyC0LhyORI0j4fGsa3bHX50gwiUP4Y0MZJYHsXvVRHqXNlsM5jF1m4f3e00FzA== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8f1a6e8a-63d7-43b6-c7a6-08da0a0ac1b7 X-MS-Exchange-CrossTenant-AuthSource: CY4PR10MB1463.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Mar 2022 00:44:14.4375 (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: B9z9vG4Y0AZsDr3ONtlzwN1PQ6Ly9raNnr8bZlinQyeObQvOovL5Wwz0IE+JuY/iW3eok384gvvJMbIz20h+B4I47TBQnSf7kn9miHtrPZA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR10MB3992 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10291 signatures=694221 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 adultscore=0 bulkscore=0 malwarescore=0 mlxlogscore=999 phishscore=0 spamscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2203200003 X-Proofpoint-GUID: xkR6m9Rh8Pumdkcwt0OmoqNSkIhO-fQV X-Proofpoint-ORIG-GUID: xkR6m9Rh8Pumdkcwt0OmoqNSkIhO-fQV Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org We don't always want to run the recv path from the network softirq because when we have to have multiple sessions sharing the same CPUs some sessions can eat up the napi softirq budget and affect other sessions or users. This patch allows us to queue the recv handling to the iscsi workqueue so we can have the scheduler/wq code try to balance the work and CPU use across all sessions's worker threads. Reviewed-by: Lee Duncan Signed-off-by: Mike Christie --- drivers/scsi/iscsi_tcp.c | 62 +++++++++++++++++++++++++++++++--------- drivers/scsi/iscsi_tcp.h | 2 ++ 2 files changed, 51 insertions(+), 13 deletions(-) diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c index f274a86d2ec0..4e467918f4e2 100644 --- a/drivers/scsi/iscsi_tcp.c +++ b/drivers/scsi/iscsi_tcp.c @@ -52,6 +52,10 @@ static struct iscsi_transport iscsi_sw_tcp_transport; static unsigned int iscsi_max_lun = ~0; module_param_named(max_lun, iscsi_max_lun, uint, S_IRUGO); +static bool iscsi_recv_from_iscsi_q; +module_param_named(recv_from_iscsi_q, iscsi_recv_from_iscsi_q, bool, 0644); +MODULE_PARM_DESC(recv_from_iscsi_q, "Set to true to read iSCSI data/headers from the iscsi_q workqueue. The default is false which will perform reads from the network softirq context."); + static int iscsi_sw_tcp_dbg; module_param_named(debug_iscsi_tcp, iscsi_sw_tcp_dbg, int, S_IRUGO | S_IWUSR); @@ -122,20 +126,13 @@ static inline int iscsi_sw_sk_state_check(struct sock *sk) return 0; } -static void iscsi_sw_tcp_data_ready(struct sock *sk) +static void iscsi_sw_tcp_recv_data(struct iscsi_conn *conn) { - struct iscsi_conn *conn; - struct iscsi_tcp_conn *tcp_conn; + struct iscsi_tcp_conn *tcp_conn = conn->dd_data; + struct iscsi_sw_tcp_conn *tcp_sw_conn = tcp_conn->dd_data; + struct sock *sk = tcp_sw_conn->sock->sk; read_descriptor_t rd_desc; - read_lock_bh(&sk->sk_callback_lock); - conn = sk->sk_user_data; - if (!conn) { - read_unlock_bh(&sk->sk_callback_lock); - return; - } - tcp_conn = conn->dd_data; - /* * Use rd_desc to pass 'conn' to iscsi_tcp_recv. * We set count to 1 because we want the network layer to @@ -144,13 +141,48 @@ static void iscsi_sw_tcp_data_ready(struct sock *sk) */ rd_desc.arg.data = conn; rd_desc.count = 1; - tcp_read_sock(sk, &rd_desc, iscsi_sw_tcp_recv); - iscsi_sw_sk_state_check(sk); + tcp_read_sock(sk, &rd_desc, iscsi_sw_tcp_recv); /* If we had to (atomically) map a highmem page, * unmap it now. */ iscsi_tcp_segment_unmap(&tcp_conn->in.segment); + + iscsi_sw_sk_state_check(sk); +} + +static void iscsi_sw_tcp_recv_data_work(struct work_struct *work) +{ + struct iscsi_conn *conn = container_of(work, struct iscsi_conn, + recvwork); + struct iscsi_tcp_conn *tcp_conn = conn->dd_data; + struct iscsi_sw_tcp_conn *tcp_sw_conn = tcp_conn->dd_data; + struct sock *sk = tcp_sw_conn->sock->sk; + + lock_sock(sk); + iscsi_sw_tcp_recv_data(conn); + release_sock(sk); +} + +static void iscsi_sw_tcp_data_ready(struct sock *sk) +{ + struct iscsi_sw_tcp_conn *tcp_sw_conn; + struct iscsi_tcp_conn *tcp_conn; + struct iscsi_conn *conn; + + read_lock_bh(&sk->sk_callback_lock); + conn = sk->sk_user_data; + if (!conn) { + read_unlock_bh(&sk->sk_callback_lock); + return; + } + tcp_conn = conn->dd_data; + tcp_sw_conn = tcp_conn->dd_data; + + if (tcp_sw_conn->queue_recv) + iscsi_conn_queue_recv(conn); + else + iscsi_sw_tcp_recv_data(conn); read_unlock_bh(&sk->sk_callback_lock); } @@ -557,6 +589,8 @@ iscsi_sw_tcp_conn_create(struct iscsi_cls_session *cls_session, conn = cls_conn->dd_data; tcp_conn = conn->dd_data; tcp_sw_conn = tcp_conn->dd_data; + INIT_WORK(&conn->recvwork, iscsi_sw_tcp_recv_data_work); + tcp_sw_conn->queue_recv = iscsi_recv_from_iscsi_q; tfm = crypto_alloc_ahash("crc32c", 0, CRYPTO_ALG_ASYNC); if (IS_ERR(tfm)) @@ -606,6 +640,8 @@ static void iscsi_sw_tcp_release_conn(struct iscsi_conn *conn) */ kernel_sock_shutdown(sock, SHUT_RDWR); + iscsi_suspend_rx(conn); + sock_hold(sock->sk); iscsi_sw_tcp_conn_restore_callbacks(conn); sock_put(sock->sk); diff --git a/drivers/scsi/iscsi_tcp.h b/drivers/scsi/iscsi_tcp.h index 791453195099..850a018aefb9 100644 --- a/drivers/scsi/iscsi_tcp.h +++ b/drivers/scsi/iscsi_tcp.h @@ -28,6 +28,8 @@ struct iscsi_sw_tcp_send { struct iscsi_sw_tcp_conn { struct socket *sock; + struct work_struct recvwork; + bool queue_recv; struct iscsi_sw_tcp_send out; /* old values for socket callbacks */ From patchwork Sun Mar 20 00:43:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 553862 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D1134C433F5 for ; Sun, 20 Mar 2022 00:44:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244504AbiCTAqB (ORCPT ); Sat, 19 Mar 2022 20:46:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244490AbiCTApo (ORCPT ); Sat, 19 Mar 2022 20:45:44 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 30CAD241A0A for ; Sat, 19 Mar 2022 17:44:23 -0700 (PDT) Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 22JFC5UT018301; Sun, 20 Mar 2022 00:44: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-2021-07-09; bh=HzykA2JxtqDjqwULMFqIBXDcg3ZCrU7V5QSj7RW1+EU=; b=WKfaK+JqMkuFl+Ocs6Cf+uwo2jp9Epihyc4UjfFTnj3DDoRjt91pV2CLgYEq7V9xPneE pZFVy2jtdaDG0jV4fBj1/MacZvFGZBRUkks114PIFcemt7exefmMo4twdXeZ2vHIKSZI WK/R3+nZUVTW8y4vriKWUOJm5uvjgj2CB0udpvT7ixME7L0UTuXBEwVaLSq4Q8sJlxBl 100MkJgR2odfcNi1HRiGTPWnnMzM0FHb/obBQ6Vi4PKpB9Gks7CoPAkluz+/uCik+H3b 7MJFVI2aYSGOzXLKAOxOUGWCyl4uiGivGyXj296GqU22i+KHhKGi1BBP+xOjSn4mLGMf wQ== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by mx0b-00069f02.pphosted.com with ESMTP id 3ew5s0gx7u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 20 Mar 2022 00:44:18 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.1.2/8.16.1.2) with SMTP id 22K0ffal137063; Sun, 20 Mar 2022 00:44:16 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2169.outbound.protection.outlook.com [104.47.55.169]) by userp3020.oracle.com with ESMTP id 3ew8mg6mq1-7 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 20 Mar 2022 00:44:16 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TGwYK/wTn013cKJ/DZeu8RHN2yjj1g1at9VU8bfBNPuwmTtUPWLcFxKkpaOQGniszoRxMRKfUdSjjomdPfn6quffMKnaqvnu+XQQQLUHrAJaUfPutftdAw/i3FRmPUi7TtutkhD3OVwGpgw8+GNvj9nilMWfSxjEUYAQStTf9UFUiHybx85AI52aaF7aXQzlbvUTEm3YkMYglVVlLQhxyxk4v+uXJN1RxgQTt/ACIjM27r8DGaSkBqIzXfea29M6aagsMbnhFNULVa1Z4VgLtYhN30uAiKflknxlzBBqLItpSi3zXxMapjHEOi5Bg0VS4FDCO92pHTYl0sE6uw/lXQ== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=HzykA2JxtqDjqwULMFqIBXDcg3ZCrU7V5QSj7RW1+EU=; b=SGA0THXkM+jplBtq3I28ifP8nIiYJPSQn8351HX8HbWq6KNBH/Lm1DYGGYXioS35MJYnT2gvgD9AGNJqRi5QE4FJr28pmWprJP5wR0k8u/BGIFKFNwckeimsVOpF0nhsqD28ngWY3onLdMhIX/oMTteTz5/D7QocrYh7wGBPY74gii5xwJYTvUvQSxXKEopslCeTL4jx3rLcKKBJ8UOBVKs+R8fhDfN4heT0HKnJBydnCXecwVY1tA73YqboyCM/ATIkyzJUsl94+NcGabOmYLIxkI10MyFUMwLOfqz3QFkG9TiAJE7Bdtyln3FgxtVz0HODWa8vaORdIU3ekBPEJw== 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=HzykA2JxtqDjqwULMFqIBXDcg3ZCrU7V5QSj7RW1+EU=; b=Ocj2FI3gpgxmd8Q/pavWiHWiwZbsEEkFJblxHABG6X4pllua0ErQRWuYvgU2lp0uYtDy7QTAO2DdJjPtN+zxGkzz/M78OfP4CuFId8fChuLu9Z6gwETqBrfs9MWyk1++sbW+LLBb6F1y3bn3+ji587tos23PTlY7+ALrpnltcSg= Received: from CY4PR10MB1463.namprd10.prod.outlook.com (2603:10b6:903:2b::12) by CH2PR10MB3992.namprd10.prod.outlook.com (2603:10b6:610:9::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5081.17; Sun, 20 Mar 2022 00:44:15 +0000 Received: from CY4PR10MB1463.namprd10.prod.outlook.com ([fe80::78b1:38c1:cfb8:537f]) by CY4PR10MB1463.namprd10.prod.outlook.com ([fe80::78b1:38c1:cfb8:537f%11]) with mapi id 15.20.5081.022; Sun, 20 Mar 2022 00:44:15 +0000 From: Mike Christie To: lduncan@suse.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, jejb@linux.ibm.com Cc: Mike Christie Subject: [PATCH V2 06/12] scsi: iscsi_tcp: Tell net when there's more data Date: Sat, 19 Mar 2022 19:43:56 -0500 Message-Id: <20220320004402.6707-7-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220320004402.6707-1-michael.christie@oracle.com> References: <20220320004402.6707-1-michael.christie@oracle.com> X-ClientProxiedBy: DM5PR18CA0065.namprd18.prod.outlook.com (2603:10b6:3:22::27) To CY4PR10MB1463.namprd10.prod.outlook.com (2603:10b6:903:2b::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 88a19c46-6e96-4931-fcba-08da0a0ac20f X-MS-TrafficTypeDiagnostic: CH2PR10MB3992:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BczHYO72D95FsFHYlza2giJYIEd6pWcDX4am1JPb4/qcS0AOnWQqXAg2gtf8hyamcACvhVStFFwCtLklp+Wz46jsiub37TQkKv4YlVS9Zk33NQEafBUhBJq/GmQVjvWEuy2ptHNtIOz6N7FeAQFi+zfdU+dCLB+v8EyWPE934Pa5bZZvvEZy8Zt2Gt8e5UFUhMJxqhoPM6xjRPKN14qpE0Q6mnDzaYd8NMnmqoiB9rXGdHs/SIpe6VV+GtUb2p8mF/vu0D/SLFZ5MgH/KADL23mUA4JfzW85FwfqhEk4hF+z3qUSQ+AnpDDUL+VizQS4ZVC+++wKuDb/sFFfL2wFpTnlHLguXY/qpVQ0W7Wz3F1MdJX/I19A25xb4WwWazuhvJLNoGkjoMSFVe55QL08LM7LlJwrEy9ouxZNklTN4AdIfZIgVzclRvLJHZNVB36kQ9Ttzi+wegJN+xUObhaoAWl2jCzLdZDM7Di/KbYS8CHz8GCLoakE5g3aQb1Zq9q6OFethXkC24pcbIT/Mzg7TMRf3UqkUgaHwUTkdCHzhOtCHhxIymYAZ9UDs7MB22SrP4W2JenRlx7MkPMexr1lV49dxYl4h5eb8NeGS51I8BnqOn9tSyZ2OCoOr/1TDv7mG6hV9PRlqgCt+cwmG1A/1YCB+WNdYydsTpbrYz4ridZ9RGG6l92X+IZcWaYdhpx1AzxSsIXWjh2kkIYr8xpROg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY4PR10MB1463.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(508600001)(66946007)(66556008)(66476007)(4326008)(8676002)(86362001)(83380400001)(5660300002)(6486002)(6506007)(6512007)(6666004)(107886003)(36756003)(4744005)(26005)(186003)(1076003)(2616005)(8936002)(316002)(2906002)(38100700002)(38350700002)(52116002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: JNiDF/n4UM/eHduzIFZL6GQyCE5jvC8/8Zag5m8H4Uhpr4WwAw1qrQaBF7Hz31dgVlEWf8XFQNr1oaCrBf2J19uXVxpWDVlyudIKtyY5kuQPYtoqRJaYKnd/rXobZpsjVyU8j4LabdkwAJo0YBFy9NjeqR7TAnfJ36ajyxu8FgZijxwQjy7BKH+uuqWRFrmOPRyVmO8Nwm4SRaCCwDjbVCgaJgxS03ZNtkWbjuGTf8KfqEVLXXQ9KuSYmxf+bLyUcWMKR4le15d2QV0OFJuLoSnb6lvXFEo1ZHBzLDZog0Ee9o48U8asrXqxTCt2xpVLdsZBgcVo3PmrGUJRfu3W76XkEd6yopPuF30fWO5T3twKhsRecX08NP1jMIESsZHXPh+RgtU6uhMSJ3GKv6Fe1Z0IjCrZ0WZW0TbMJVFS1KwVoogpxvrPlJB7UUJdKx0kZppIuwbL2aMYIVZ6/1n+/SE/uaMlcnyE19mVb++iRFiJYF6RJ4H8op6Fv34iYfp0ZcuPNBQZ4buCORQqaRbDIOMNs5odPv9AWKx2hiSV1L7ojUeIDTgLubMZVIFfI2ymV5MkuJOJjYQubDbrr3tk/2g/dJj6nce2DhCm8xGEZ4EbxdtOcjBB3ujkeJ/X3gXWXTew6ciRcvx1ym/E8LEZPMR9XUDWHcRemYN1YrTB+IX8tEopXrQ2x7snyHaYP8V2RC3Bfq/rgBKQsHacWsdltD3K9UBUaApH06iHnRStVkWO31K971CEZsdFEXH8RZSqCC7AEjnwNLbuaZELXEgne6x4Nk/azWc31kbgYHXG+sfHnMbqAjZ8axQf+QE9O0aKg7FFxYqbBbptVIAtauMZ8eJC1lnjQW7sBwPL9WG/jOg/S/oPOV0k2yTQuZkvjgS5CNXnvrHtzhow5rdvYFaxFjfwKMjPbgZ6lnjWOn5EI6vMEDLaZEatpS0LrHImGHSPcHUpWBmBY36U/FxS6bQnvXXZtVaY9Uu0FZgOKtg/kaH2lLcAAI/YL+qRur4LXo3hdpgXm+Zxgj1DhL5TqxRDvlgAlj1p8mLyqnM/bNWRNrDMHM3ANzWEsyozA0LhoOVImXMHwqtd7vQ/nVaGREN6nFh42g5x14HNKUz+MdBlnu2ZZwYpCv2C8aij6DMy9O6V6AY6hBmkCna8lasX+AknDglbmn5u0uE5BMOG5VyEfrza/KEib31FHkN/FQ/UTB8Zt1Db9zDbulQBcyLv7NpqhaI6uZPi64CHcIMyyFgxroZHTjFSDRUAfb1iUOBWhzBGVItHUyf9XlsLafccmw5GyLQx6j+4JrZ7KOhoD7GqsUu4QuwTg2lAOeH/j0lcEI0HldyXlDiDvkC1shGdiseiNv6AIqAW/FVFpb4AAJegG+ujBGBYwTy1kSlvHUQfzJJd5zyfa4LhYOwkRKkfkfiVdaZYDI69jPwhx4Lk5SmBMAePagIdqm7Y+1ewqMchX9mBgxFRjuSzo9QMeNAgjZyXWw== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 88a19c46-6e96-4931-fcba-08da0a0ac20f X-MS-Exchange-CrossTenant-AuthSource: CY4PR10MB1463.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Mar 2022 00:44:14.9687 (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: n8jx6F8n5pVVt4OkFBB42Lgr3E8l2n/AMdrqeYqT2mm8nSyKFVc5/47ZE+zu/N6LHIlxuhKHQIT5xGAmjQLTTGeAt7AE/FC/veZcUuaAMAs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR10MB3992 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10291 signatures=694221 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 adultscore=0 bulkscore=0 malwarescore=0 mlxlogscore=999 phishscore=0 spamscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2203200003 X-Proofpoint-GUID: qW0f2gF_aOTnxbRLlEmIGO3rb_0gqjyp X-Proofpoint-ORIG-GUID: qW0f2gF_aOTnxbRLlEmIGO3rb_0gqjyp Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org If we have more data set the MSG_SENDPAGE_NOTLAST in case we go down the sendpage path. Signed-off-by: Mike Christie --- drivers/scsi/iscsi_tcp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c index 4e467918f4e2..067f71a418c3 100644 --- a/drivers/scsi/iscsi_tcp.c +++ b/drivers/scsi/iscsi_tcp.c @@ -306,7 +306,7 @@ static int iscsi_sw_tcp_xmit_segment(struct iscsi_tcp_conn *tcp_conn, copy = segment->size - offset; if (segment->total_copied + segment->size < segment->total_size) - flags |= MSG_MORE; + flags |= MSG_MORE | MSG_SENDPAGE_NOTLAST; /* Use sendpage if we can; else fall back to sendmsg */ if (!segment->data) { From patchwork Sun Mar 20 00:43:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 553861 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CC0F3C433EF for ; Sun, 20 Mar 2022 00:44:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244481AbiCTAqF (ORCPT ); Sat, 19 Mar 2022 20:46:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244497AbiCTAqA (ORCPT ); Sat, 19 Mar 2022 20:46:00 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 24C73241A1A for ; Sat, 19 Mar 2022 17:44:29 -0700 (PDT) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 22JDXB4l027608; Sun, 20 Mar 2022 00:44: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-2021-07-09; bh=xaNqMKHMxMEPSNPdOQmipmWUgkkqiGxiIHveNJx2zoE=; b=xUq5YsuymigdX35Ed24xfz8kPKdiznsM46d5OtmiPH3LKrWNnbaOTYEoBfFYj6gO89Lv AIhs85brgvBMKJNDb/VW9yoT5YEOQTdVHKv7eIf0PWDnka3qdgIUXtOtyYQ88I0yrAT9 E7xpL/5sscWIIXVTxp6BueQXPZh8fQp3nGdES4EUetFpxUX+FuIyMvEMqdidjAYucRMe GD757+AzLn/5Jr7xfp+NND6dS+OIe0iDi5EDcYzG0t0rHVPgVvPlk3eF/vnyqH3oenQw mFlJzhVAOmCJ8ZYeVDXGWHWW6lasHjqQJhXkaRGAuI9uKtJwVpW/DcBh9Yt54i/ZM6wM rA== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by mx0b-00069f02.pphosted.com with ESMTP id 3ew5y1rw2f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 20 Mar 2022 00:44:18 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.1.2/8.16.1.2) with SMTP id 22K0ffam137063; Sun, 20 Mar 2022 00:44:17 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2169.outbound.protection.outlook.com [104.47.55.169]) by userp3020.oracle.com with ESMTP id 3ew8mg6mq1-8 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 20 Mar 2022 00:44:17 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Dp3M0HriiuGMhSIgZJjU4RV+Ihbr0gMOISmHHXTVp9cnvMBsFpvaGpEbj3/zq1L5KH8weWgITObGbXefpGKAmPzZs5IvjeRJbntPYfHda+HcEEF7Pnsr6B2t9z6AtbPCSe0iIAnV6kC5je9xQrexs+aA5/yFtUc5Bz3h2Ry2yEPNvpsdWeM3bFc7ZYERCTBFc/o8qwak0NUpdvHhmRQ56Seo2Gw8qUnF7KejOeH8ojpcbeqzZKNMn/MQrLAxj7fGbCW9qY3NiR8jsDRL0uNvtUM2/nCO/V/nJzP/iUFFMLTHOx718Xw5uM1j4zQSgfmRf7LPWfdtkORTodR6g+hlFA== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=xaNqMKHMxMEPSNPdOQmipmWUgkkqiGxiIHveNJx2zoE=; b=BQNjxre7hNG9aa3/iQ8CrW+x7mxpNKg56bzXAdf44FEstRw+DzgGPtrPYnLvhX4ejICgU9uEuGfaB6WnDCqG87HnTliWqyRH2eXvLIn1VvYtS6QcpA3G1UEvuXWigZMpbSTpJ2sz4WMczSG7pURy1sNZs5clTxE72dmBvkOADlDIKhzS2kNZJIRFWHi82/h1dggwbveQZrYCW7X2R34V6vGWiNKHT8Ke0Kz0PVZGz4Tc4CsIFjesmReHhew4wl+oQ12/rXFOZIrxY0GzDXzanOV7QfaUUkuh/tJxn6fb8QObW89ePPc4t1VwFxF9pJ/Mb/ahJKM5zCP/Z3P+Q5QduQ== 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=xaNqMKHMxMEPSNPdOQmipmWUgkkqiGxiIHveNJx2zoE=; b=MECbXDN3Cq2q4S76kaHZ6pt4QRgwoYAlRjenxvSDU7qGNbrvveuMAFjqP8RjtGKs/dQ4DqBkDT0yS5XqHdwJ/T9CCqyBSXKDdPe8sBEFuVfsfly4DVSZGRcIlthDTarCGxmE3Pb3TOWr10+ac39up71OwcCdR4FKnRlXeJdM7Lo= Received: from CY4PR10MB1463.namprd10.prod.outlook.com (2603:10b6:903:2b::12) by CH2PR10MB3992.namprd10.prod.outlook.com (2603:10b6:610:9::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5081.17; Sun, 20 Mar 2022 00:44:15 +0000 Received: from CY4PR10MB1463.namprd10.prod.outlook.com ([fe80::78b1:38c1:cfb8:537f]) by CY4PR10MB1463.namprd10.prod.outlook.com ([fe80::78b1:38c1:cfb8:537f%11]) with mapi id 15.20.5081.022; Sun, 20 Mar 2022 00:44:15 +0000 From: Mike Christie To: lduncan@suse.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, jejb@linux.ibm.com Cc: Mike Christie , Wu Bo Subject: [PATCH V2 07/12] scsi: iscsi_tcp: Drop target_alloc use Date: Sat, 19 Mar 2022 19:43:57 -0500 Message-Id: <20220320004402.6707-8-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220320004402.6707-1-michael.christie@oracle.com> References: <20220320004402.6707-1-michael.christie@oracle.com> X-ClientProxiedBy: DM5PR18CA0065.namprd18.prod.outlook.com (2603:10b6:3:22::27) To CY4PR10MB1463.namprd10.prod.outlook.com (2603:10b6:903:2b::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 93639b0c-9e16-4047-f66d-08da0a0ac26c X-MS-TrafficTypeDiagnostic: CH2PR10MB3992:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TfHGArkylfFHvVgJVIQxkIDJfF2sssLSrXpu24Y4Ilpt9FsW25lp94vAnTIdE4RoWbD+22wjKjP26XJwX3frJvFibbbgKCr1mDNCW5miKOyqfw8bcqHw33KLdljuiRndo4lNqPNzLrcubv0IYY/usFWD6AB1QlSgokq1Tl041mXf9cnRINNrxQZosZmvNbrsrsG549ciMKx6W7sffcHlj+qELCnNYX6qH4aMBOMyRR4IMehYaQ0K0JOdr1jjmvkkwsu/aXeFRTmZk4sFDhYP6IcGtqIk/hRVbII+GYmBNKyRvXlIvrwboa2lRgheqCABalftUE5nbWchhur4E6vN+eT3KgIk4N2E5bc2MuOFKmRGgVncMEeaTn9j3GqFWpzbOmHpuGxB5D5+HYFiRU4WTwlL4ctCBhJOKhXfbWO1siaZGS5W6Z/Bggi81Gkh1/YPfsY8mT6Ey4+hqdRuVbg6hpK7MnJ7MWi/MMevogeRWdxVjjLLRKrohkOEk4WV7wIxz9rSy2hufjw/hQetJmNq+Z0RT9KO7mW9UP2YB1l/Zzrx3YqQbJx86AJJTwbt0Quv3hgK4vKAaVWA1K2dQKc2pwzI/ZXHxi1Csl47Jinmi+AQ+Yy4H5JTlSm31IpZjlXg5h6StJmU06T9sY5OZ1EjTPmJs2q5ck31I4nFK+BQQVvA6YC3pVQlaLuSPaX9yGXoEYHBYSPMRl31c7E5ZJ2shg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY4PR10MB1463.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(508600001)(66946007)(66556008)(66476007)(4326008)(8676002)(86362001)(83380400001)(5660300002)(6486002)(6506007)(6512007)(6666004)(36756003)(4744005)(26005)(186003)(1076003)(2616005)(8936002)(54906003)(316002)(2906002)(38100700002)(38350700002)(52116002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: FIm28FvltXUJMeC584ANl0VcFsUzp4WhdtzRUn4QpGDeeXi7iD0VxuqqVVUwJ4xLN4jIFtO8IlgQ5/OlQSfov5ZDXXxhC4m144VUh4qCQ2itQD7yHUsz2lPq0gtI2fylSLCX6OvhRoU//C9+3EP1Ay6NK12dYmR3aVhOz7e/q6L64cJOKSxoiYb9fiHREhDLacozj7K3uRRg3hg8gZYCtYvEsSA2Z1E2mt4SBCupcAxKIPZ4tMFsuWG+qlKBLSar0JKIs4hohTgdokUCtIiDrl2Y7pVFiITK05rVvZFYDaTtvPRdABOKQ9oqItiHwo8sKZ99BAzQvb53wkFawqFLBT88e/KsyxWZ9JukJ6ujx2UO3pPoxmYtHScbu5+Qa/WdHWUWhV302eXCAZ0ULjXlP/vzjzU+g3fIVgFseCy50QK35lQkqlpaYF1L6VZqQnnDDvX7FpR697tJj+NP7mGDtn3bXrCethOaF5rNIkp1gdzxnofuzGydAgVylv0QN3knPp1+BqMTGmtNtsKyWO2AwlNcHyi69j//aQDlxHJQSe8UMKIpoqYwKE9F0VN1e0ZX0Kn6gHTd8k5/onuy5PkYuuF42ktWmysX0p1BgaQNuWyo0V4bWEIpUS84+gSUGsREBoYnnGHs6eD9WmJnnL71ZR7xvbkMyFNaz9a0b++UFZzZYAzKesb0ElvD/vQnoqugiMZ2HCOWoJiiLXt3Zdc2vnK9FT6bYfvfegvC//8cTyA9azUYpvzMLrc0i0ZNwh7wVDOv+vPCphOyQT8Vvzt2T8jI6L5Xkh786jieDO1FJe9adTSc0bHJhA36gWJWMtgoSqokNpVl+nKLKT+NrnSUCg/X3q+BTJ0cE6V9YzugdIrApsDCnU/BrhVHpgqk27UNJnSsJAV1oe942QSoKuTwacutvaW0uVy8x9hiDP5YgczXzdhPHjVbeBEiDVJqKK2BJigKQIaQkcGMhOzDHHKoEAh5nCpFzZ7t0VS8Ro+QQXnAqA6F9oEnFw3rBrAnAWBEQx6Qnm2bq+z8Dz8t6mHoBMls6gH6IqXwQ+r5urbfF6nubAd2MdmBb3Cbee+rJtWziLyRE8H+O6JU7nwm1DVwzF7WoUW3wAsYOQOJOB6GPlR9XbgQuSgG/dVnqYGyPuiOE+vEOHNeaCaTpOzJxlzNzqM+0UV41HjEJQNGq6sB4xSBt8AOaCBXrtPCYw66SSRbDjsT7UvZ8gpTQgYL1nl0hDir5s9PJodZ+j80MytdLM1OPpu7YsuK5Nbk5OL5s7LuN7XiifAzphJAZDJ7Tw9yP9Nh4Ahg2gnJOgpyc/YjuIenWFMhN2JmABspH02sy5vA+alXl51lVyRpH+q+AuNl76CJgGDwoay/QSs3LqvneXu37zf+aLJ0t+0IO/+wooFQo8wBd9q7zKPrD3htCLNE/X+UtgGqxLw2pjXKWjEJXL/0MWWvNykfqToUImI8BPNz2WnodoHwK9gvimLB1wHH1w== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 93639b0c-9e16-4047-f66d-08da0a0ac26c X-MS-Exchange-CrossTenant-AuthSource: CY4PR10MB1463.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Mar 2022 00:44:15.6405 (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: LNXuPhUgeCkk7i9sVVBdGADToBZbPecO6fxKnPdud/STh+HrVrhSi0gHoHbUW9Z5SltLtJ4enU3VGgMD0AsYTN86lLnJ03kxEJ13LAF1YVY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR10MB3992 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10291 signatures=694221 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 adultscore=0 bulkscore=0 malwarescore=0 mlxlogscore=999 phishscore=0 spamscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2203200003 X-Proofpoint-GUID: ZKKz8CadRdkfHJXy2YPbnCgil0bmZW0q X-Proofpoint-ORIG-GUID: ZKKz8CadRdkfHJXy2YPbnCgil0bmZW0q Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org For software iscsi, we do a session per host so there is no need to set the target's can_queue since its the same as the host one. It just results in extra atomic checks in the main IO path. Reviewed-by: Lee Duncan Reviewed-by: Wu Bo Signed-off-by: Mike Christie --- drivers/scsi/iscsi_tcp.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c index 067f71a418c3..e4d633380db0 100644 --- a/drivers/scsi/iscsi_tcp.c +++ b/drivers/scsi/iscsi_tcp.c @@ -1039,7 +1039,6 @@ static struct scsi_host_template iscsi_sw_tcp_sht = { .eh_target_reset_handler = iscsi_eh_recover_target, .dma_boundary = PAGE_SIZE - 1, .slave_configure = iscsi_sw_tcp_slave_configure, - .target_alloc = iscsi_target_alloc, .proc_name = "iscsi_tcp", .this_id = -1, .track_queue_depth = 1, From patchwork Sun Mar 20 00:43:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 553859 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C122DC433EF for ; Sun, 20 Mar 2022 00:44:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244509AbiCTAqJ (ORCPT ); Sat, 19 Mar 2022 20:46:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244498AbiCTAqA (ORCPT ); Sat, 19 Mar 2022 20:46:00 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A148241A11 for ; Sat, 19 Mar 2022 17:44:30 -0700 (PDT) Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 22JERgAV012483; Sun, 20 Mar 2022 00:44:19 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-2021-07-09; bh=E+Cfs3OtyNAKByy8By9BOxk9zf6RL10vh7kZ06stmDw=; b=v3XiDISxRGNohh5jM3ClTEWexJroVYkpDjoScH1ibbb+T0P4XhRCz7nGIExDS0D7nu4y SaR7b7AV4YyfWmwlp1KUtVkzQe6fHGZiufq/rX9n3iwhHAQaj1SXDuT4/pe/3M8iHOtC dhRpyxX3UKbZdj0tpfzyOcrYoHV5E5kGsva7srEw21+9FC7Ag2zBQRzFFyNBF9FY/5F0 fk9NQavMsuam2Gk//R7s8seLVKQ0M1grNJQzXqitKS5vctvEyP88bH9VcN3ZQqs3GV9i tj1WJ7p2+DPdTRqo6WPwn6oQHWF1uMddZWuTn/J/iuKu48igfJ4wiGEMi2Jig8MbjCbb tg== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by mx0b-00069f02.pphosted.com with ESMTP id 3ew6ss0ux0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 20 Mar 2022 00:44:18 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.1.2/8.16.1.2) with SMTP id 22K0ffan137063; Sun, 20 Mar 2022 00:44:17 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2169.outbound.protection.outlook.com [104.47.55.169]) by userp3020.oracle.com with ESMTP id 3ew8mg6mq1-9 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 20 Mar 2022 00:44:17 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iGvd/2OKTcVpuW4ffaF0tXk44eopQoVukUJJIITJ9+NxbLbPajw1P1iqVitFwhlyBaBuvyD0AnSvVUT330iLvRYp0xDGNDGbP+2fA0Kij8LSA6Vy5BcKeSKuticGJTOdILaBZBHxjaWGi5YQ6ZUoNKT8AIVdMteagTN0L9NBsMjul9v0owmeKqtsvBS/aYfwuWSmMlbzgLp6iNS0yR/JEZYMT3TGxrTHdmYXI0JtE56fHgoz0po5QN3bGSV5QOYUGwABxzLeUrkpjh/IPhC6e2otTwhaas6R4RCc3+2jFXnrDUV8G4Mgc9DOcY4xBWJ37RcJvYKbKMNaZC9jNi3x3g== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=E+Cfs3OtyNAKByy8By9BOxk9zf6RL10vh7kZ06stmDw=; b=iv6nQsRosX15IRwrIhQ7a08uYjfexYTawrjL/c/fFO2DhSFTPTzlmXnx9oZdDAee/cLObOqXal/o/ceyR8kCvzN7y71wEFY7Ra50mpLuFq2qrn4kjFGYxYkDCHJUf/OA6ghhxUDT1gZN61dwWd6rr3ejLvppa20TC5JwNoq8+PbZt4qceAHCXVnkAvQ5JuWrPZ7v+RTsjM1+dk+Jgiwo5pY2jPSY6FWdViZESAhVDvf26Z5DNzIYptf3RMRNyOTD+7s7cRcfxyC7a7mTht6vMFTbBlALKdQSJGoQpwcoRBPQmSIAspFbxkhwpdmFpNzdIsc8qODDOhVS2lH8SnPOlA== 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=E+Cfs3OtyNAKByy8By9BOxk9zf6RL10vh7kZ06stmDw=; b=j19adlYMhqhk0gI6OHNxgxz9g2yQs7C8gaVAaQ3NHMbvJS5eiYiELQ9gBoUSwz8qqDO5BODnH8dr3ClpNORi7FbhqIHs5Rn3s8X1zUnMWPYDmbBxctc2m5vuo2bAgTsgohGBwAbMB1M1P1Mf1OPh+d4giaxeSpPv4AxY0eKUKZs= Received: from CY4PR10MB1463.namprd10.prod.outlook.com (2603:10b6:903:2b::12) by CH2PR10MB3992.namprd10.prod.outlook.com (2603:10b6:610:9::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5081.17; Sun, 20 Mar 2022 00:44:16 +0000 Received: from CY4PR10MB1463.namprd10.prod.outlook.com ([fe80::78b1:38c1:cfb8:537f]) by CY4PR10MB1463.namprd10.prod.outlook.com ([fe80::78b1:38c1:cfb8:537f%11]) with mapi id 15.20.5081.022; Sun, 20 Mar 2022 00:44:16 +0000 From: Mike Christie To: lduncan@suse.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, jejb@linux.ibm.com Cc: Mike Christie , Wu Bo Subject: [PATCH V2 08/12] scsi: iscsi: remove unneeded task state check Date: Sat, 19 Mar 2022 19:43:58 -0500 Message-Id: <20220320004402.6707-9-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220320004402.6707-1-michael.christie@oracle.com> References: <20220320004402.6707-1-michael.christie@oracle.com> X-ClientProxiedBy: DM5PR18CA0065.namprd18.prod.outlook.com (2603:10b6:3:22::27) To CY4PR10MB1463.namprd10.prod.outlook.com (2603:10b6:903:2b::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: caf5843c-9fe5-42c9-7944-08da0a0ac2d3 X-MS-TrafficTypeDiagnostic: CH2PR10MB3992:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: egW3eYW0hT/bCNDTYLUKjpIiYrqxNuTi69+gBv2IsMllqnS//HVrPkinnPBbRWoQ00pxMyVMMuu6/ICBpSvH/JUh3RyZGWZcUZxhqR1Ckuw52sPXxj5pNwTNiiQHRbbgcxj1pzhAi+UfgPIdSdzPqiuy3cSh+lJtWECVU/JAfvcbTsbNgphPgdVb6vG0NOKsTPKTb25dpaOa/mSsZjd4Mm3BsBfmrWhL1DTj3S5h05nt8Uc8ZyOhb9IBXHhzuLYIO9fBnNKYGq8m5XhSjiueRr1jagomI3YU73fmb7d82cDIS3XX0zmb68YvXhbl1obUAHdTltJkC+grzbYTGgaOSjxQ5nv1oNGaTtX6g52sgLQ+2f732USQq2hy7IFifiG5d+pYSpfoWCHLkA7M3Qf4Ua05SvpYtsQaTkrl9BMXLzaUUaQsvdv9AmuaFJZ8wbStXLn4zlzMFWd54sj/jSpF++UuyfOzWyoIul/Jzdut85Fm2hA1lzX/61h75yxQxERQbslIDJ91tui8fMQVolZRGYs0mKg0U0VvcAsR/4CXHVLYrpMVsVh2uJYhPYlugP0vck7jxXnqCGS2G8kB1LBl3rfq10vsVpTFLxGN0JL3OgPVf7JV/RsyxFqeiZkcsXVdBB/U4tu4Q32BTjJpnJ9HtW1bgIAgm49qro/aU4moQUCDXj82kY0vER3YyV9OCmmsA35r+ig2bW69Pc89t7XkzA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY4PR10MB1463.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(508600001)(66946007)(66556008)(66476007)(4326008)(8676002)(86362001)(83380400001)(5660300002)(6486002)(6506007)(6512007)(6666004)(36756003)(26005)(186003)(1076003)(2616005)(8936002)(54906003)(316002)(2906002)(38100700002)(38350700002)(52116002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 75BQIjtODnooSYKns0Y/YP6zQxoyscY8Bm1Zw5zHl0mpjNdlPKjHcKYP5IfPmY7FRELJaDUbnz83/pIBKCM2anHeefWIYAdPm/6bl3XBASHnG3tjEyLtpjHvPk2zSoSnPwWfUkOHJALijpNJm6xqNL/rrPkIgAvbvE01/+wpolf8sKTx90ouF3kNXXCLpWgZ8VupOPrBGtgW3gZ3pzo9BRFudEQbu6KWA20F+wEQXw7XbFS+ClPYMNOr/f5jTcozaXxNPw1zZfWV/c6nDwNSY8b5ECdBtJVsjmlDKY1NBwNAn+nozrJyDVhyIdoqHEZtT3+th2iraKWP4uOqYJ35m6vaZSxFNkbrOw4ULGRIbr126RrGQ6Wsw3X2PDx1LwOoKZ1gQw0PBSTzJ0dE5opF2m121XYWz3oy+7zFT0Me8LcGmJ1y7XilVFyVjEBHyKAlVXCaQcSK44BoXzP8sF2amY/Zp67fDEdqV7G+w9FBGrhPAuvLVkabr+/34ZubgrXNWSjTmVD+8UdX3PG42tIT93iQdh9RoF8043tZ8zl9IxBtp4P4wFTLvQsNWp+QDLd3EzKRrMPDEZ6xU9AdID6Lig/O2bWDL9GjTQ3Fn0whbSboWyLVYpYWTG0OdsGRg9y69JullvosMKfDEsmvIUji1QmNZJUkBB/poeqbVaXtcR6Jr9tcBH6dYJLNdLA0gGvJlMHeV/7I5s6XDjSVH+9ZQ6z8YViFPt20lHkfxi+RNDyOC6fibvo4cp3W9YUhDfcurMSQWPH6JkqzPeONWXLf5Es7+HLmETJE/ef4lHSY6zo0kEHXtDNVgr3F9cmDchSKr3NJi4MLa520EpSgmE1A3r3i/uW4AarT7Id4ZpJafO7kdOZ/9NVb5T5UG+DkA2KEfTYS3jB9MSutoXAD58fhtrUSWy1ZO9WmStpjzWITXwMd12s9fsOtbYFOyCHHahhe0G4PdNPBgBvhJdE8fzRxAFTpm4eMk6EG8G9r+EGabB0IJzNmyNq0MC6emtOVBMHcv0Uno+76g8wnEDsTdp6S2WTt6IBscfWFFTrCbO28aSF9iAU1q2VHqMn8PKbSwlCxZaORulRjl9JuVVc9rJaywpGtIKF5kADJ1dsAV3A2/6K9IKQ99Y2ahKa8oyumcc7frN6xu3mOf2UaSd1ClQpZkkLvQxapqf5gCDvqv6cohzqA5PdxvEQQbK6q9ve1sNGh7W0SKskgGQXxCe2jtn/Y70qb849dDFsecXdOmeWwtGHoU9Ds73XZyx3dUxbiGlSxQO28bZdpEj4TIC+EZhb6NksoBbZqWYmGJ4+9Thi8f/ZYh3a5eTKWx55PzrztXQ8geAxG5/0029B0JmQp7UwnGMW3wNwGBxrCr54VJLKSJgjohjgml26N5AtcBl56TY0y2lP08DcLh16YrJbBtNZHuvIOxsHMwYBgi6z631OoR6/+L7qYcjuilQ8PyCRSDpzOEV5x6WtdWYzD4GYwMBuptw== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: caf5843c-9fe5-42c9-7944-08da0a0ac2d3 X-MS-Exchange-CrossTenant-AuthSource: CY4PR10MB1463.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Mar 2022 00:44:16.3123 (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: 4t6apwZkjxprqml5b2CNrfpTiOI8XUppijxrH40r87Em2ONJY1pdg7IdN32vt3wsBWr7vkfTfLSqn0iKHrbgC59cbMmVJZ2rijs3392Bnac= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR10MB3992 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10291 signatures=694221 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 adultscore=0 bulkscore=0 malwarescore=0 mlxlogscore=999 phishscore=0 spamscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2203200003 X-Proofpoint-ORIG-GUID: uX3PXJBK0j1Ly-8qL1QtciFL7opP0mEx X-Proofpoint-GUID: uX3PXJBK0j1Ly-8qL1QtciFL7opP0mEx Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org The patch: commit 5923d64b7ab6 ("scsi: libiscsi: Drop taskqueuelock") added an extra task->state because for commit 6f8830f5bbab ("scsi: libiscsi: add lock around task lists to fix list corruption regression") we didn't know why we ended up with cmds on the list and thought it might have been a bad target sending a response while we were still sending the cmd. We were never able to get a target to send us a response early, because it turns out the bug was just a race in libiscsi/ libiscsi_tcp where 1. iscsi_tcp_r2t_rsp queues a r2t to tcp_task->r2tqueue. 2. iscsi_tcp_task_xmit runs iscsi_tcp_get_curr_r2t and sees we have a r2t. It dequeues it and iscsi_tcp_task_xmit starts to process it. 3. iscsi_tcp_r2t_rsp runs iscsi_requeue_task and puts the task on the requeue list. 4. iscsi_tcp_task_xmit sends the data for r2t. This is the final chunk of data, so the cmd is done. 5. target sends the response. 6. On a different CPU from #3, iscsi_complete_task processes the response. Since there was no common lock for the list, the lists/tasks pointers are not fully in sync, so could end up with list corruption. Since it was just a race on our side, this patch removes the extra check and fixes up the comments. Reviewed-by: Wu Bo Reviewed-by: Lee Duncan Signed-off-by: Mike Christie --- drivers/scsi/libiscsi.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index 0a0076144874..5c74ab92725f 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c @@ -567,16 +567,19 @@ static bool cleanup_queued_task(struct iscsi_task *task) struct iscsi_conn *conn = task->conn; bool early_complete = false; - /* Bad target might have completed task while it was still running */ + /* + * We might have raced where we handled a R2T early and got a response + * but have not yet taken the task off the requeue list, then a TMF or + * recovery happened and so we can still see it here. + */ if (task->state == ISCSI_TASK_COMPLETED) early_complete = true; if (!list_empty(&task->running)) { list_del_init(&task->running); /* - * If it's on a list but still running, this could be from - * a bad target sending a rsp early, cleanup from a TMF, or - * session recovery. + * If it's on a list but still running this could be cleanup + * from a TMF or session recovery. */ if (task->state == ISCSI_TASK_RUNNING || task->state == ISCSI_TASK_COMPLETED) @@ -1484,7 +1487,7 @@ static int iscsi_xmit_task(struct iscsi_conn *conn, struct iscsi_task *task, } /* regular RX path uses back_lock */ spin_lock(&conn->session->back_lock); - if (rc && task->state == ISCSI_TASK_RUNNING) { + if (rc) { /* * get an extra ref that is released next time we access it * as conn->task above. From patchwork Sun Mar 20 00:43:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 553285 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 473D2C433F5 for ; Sun, 20 Mar 2022 00:44:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244490AbiCTAqH (ORCPT ); Sat, 19 Mar 2022 20:46:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244474AbiCTApq (ORCPT ); Sat, 19 Mar 2022 20:45:46 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 539B4241A0C for ; Sat, 19 Mar 2022 17:44:24 -0700 (PDT) Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 22K0Dvoh004455; Sun, 20 Mar 2022 00:44:19 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-2021-07-09; bh=ZjdfNRVMifRXlU0ualN7zVfAC9/cTczit1pKLZrpJ40=; b=NQv0vvPM/CMEpVgmqO3ApW3o42klH+qwndrdyrmK/WLNKKZlwcvw6+8uPOxIdA+4aqFO XTAVw/QpIKnRJ2KacULY6x4rCEO0+geT2IiH5P5naKoVEH4HwvrTHqvxpyuWiY5N4drX /eiz6RozeO5tfxZy3dXRZH4LL6pV8rMsjivz2DipV7cPifiXFx+P8/rfssVVeEHBua7w xwsZa/UD2Q/xHncDzfVkHcBFkHIdTOYsrDIFWXj5yDGVB1CObT0qI3u1ItImga2l9d8c U+KJgT/0UmacFkgMY8yakecnRuYouzC4nRAbz6QTe558tjG8UCDS3uwdO+yb/txu2uYM Iw== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by mx0b-00069f02.pphosted.com with ESMTP id 3ew5s0gx7v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 20 Mar 2022 00:44:19 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.1.2/8.16.1.2) with SMTP id 22K0ffao137063; Sun, 20 Mar 2022 00:44:18 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2169.outbound.protection.outlook.com [104.47.55.169]) by userp3020.oracle.com with ESMTP id 3ew8mg6mq1-10 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 20 Mar 2022 00:44:18 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=j1dzCrWZbRzm4WBrTeSLSVfO5vUdAZl7ODYB2G3tSCREdKTgjNpY2CYTqM22zgW/LbvYtzjYSH+0/0KTGEKmY85vWwuWwkUbaj3gVVQPYRgGHXYJOz72dYMfqOf1iSHtUaz9aGAl8+E2MU5Yb9pBTnf4nmW2Y69XJoPSIBneYKt2xsbKGUsfTGNMzs9gkOBbynvV0+9ZyqpUsQqCjuJT2kjBUO55armIwhK1gu2CpBxG501IGQekOZMFyCSvoLDWZJH6NcoDP/KK26u8E6qusF90d7J8YvNdqiVV1flWN2jJu56fcEweawVfC5KqJ8/YGb/UPq9jDZzcpyebPMBxAw== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ZjdfNRVMifRXlU0ualN7zVfAC9/cTczit1pKLZrpJ40=; b=nMKFs4igipxNIEZAz5Mpf4WdADyAlpE+Dx4CzyGz8ndb10YH49NEtjO+65c/QuKe0OYEjWQ/5rd5WK4DMWaQDccZAbylPQ386t01L1Na6KFV+fXIOuHG7DpfZgqxeURcFtpZvcoPDk1Vc5HBQ5WGVfky4rvH3+tviinKqVkqU6fWbmcDPx+ZALCLLhTVqTjayugMOzhoiKUG0xyY/VLJCB4k/twCILetdYlfKkEM18ZMuSf+LjKZZAi0VAEvfjmQXfMJxHUKs9dokfUl90SHL0+EI2t00Y4QaL3hfcwcMA7ALQPySl7Yv0IpsOoUPixdzQdNgB/I4MYo9PK5BENfuQ== 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=ZjdfNRVMifRXlU0ualN7zVfAC9/cTczit1pKLZrpJ40=; b=ZKCYP9y0UolcfB1Eab5mGlSo4bYhEz5frp68FADbyQvA9CUTAzzR2LLav0Dq8zAVGzypxQrC8iBO0PMr+t9fbaPJP4+F0FLbOeyvTBxlxggEt8++EXXyHAzUozYLYj0gw+1Z7vjAENMdiAZrofgW4K6f/bjKgYjC/hmUHGRB9Sc= Received: from CY4PR10MB1463.namprd10.prod.outlook.com (2603:10b6:903:2b::12) by CH2PR10MB3992.namprd10.prod.outlook.com (2603:10b6:610:9::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5081.17; Sun, 20 Mar 2022 00:44:17 +0000 Received: from CY4PR10MB1463.namprd10.prod.outlook.com ([fe80::78b1:38c1:cfb8:537f]) by CY4PR10MB1463.namprd10.prod.outlook.com ([fe80::78b1:38c1:cfb8:537f%11]) with mapi id 15.20.5081.022; Sun, 20 Mar 2022 00:44:16 +0000 From: Mike Christie To: lduncan@suse.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, jejb@linux.ibm.com Cc: Mike Christie Subject: [PATCH V2 09/12] scsi: iscsi: Remove iscsi_get_task back_lock requirement Date: Sat, 19 Mar 2022 19:43:59 -0500 Message-Id: <20220320004402.6707-10-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220320004402.6707-1-michael.christie@oracle.com> References: <20220320004402.6707-1-michael.christie@oracle.com> X-ClientProxiedBy: DM5PR18CA0065.namprd18.prod.outlook.com (2603:10b6:3:22::27) To CY4PR10MB1463.namprd10.prod.outlook.com (2603:10b6:903:2b::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d3a561c7-a15a-42e4-d541-08da0a0ac332 X-MS-TrafficTypeDiagnostic: CH2PR10MB3992:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: oCQnHetL4m1IEjee0z6D4P87iJckDmNtTotS3qQ3B7LjcRxteYusqmFvygd32dHiEy8MRGhvVyaQkh/qR+VPv3ylvft4HaN19XhFwgnrEh2+1GcCwPdFftMUgitJZRVxCYHEzBNvrPlcDOZjbHKEuZtte/WPKd4rn0sl2BbmH+N9Cz8qjny3Bz0QYbpJGSbn+ue2aPuxB4NWP7YFkMGHrpDog/e39HJvAG4A8+yaSIKbO6Oa/5iFkMO10YblJcWHRvrh1BTbkpRufcelbb4Gc1WrXt7vN2gQc9Vw5eL9zvjL4fuVxUuNGLfYDOrRb+VInS0M6+jgZzcR2ivxSdYIOZmA/y6AHFKybP9rBllSvO9Wt0SLGoTEU5g+8pk6IJlF68tbKXpMMrQffh/y1La9A8Ob0W8yuHZ2kQmpIpFA6lEai7M+eRx0FjIt62JkcRO7t+qY+zBOXwYhIej3a2pZrjsKetNSNzDx8l9uq8Ks/Jh0/wCIsu5iM8KuJ2/VTeRLRCpN//P8Dhm1nCQ57cK08cakH/tXpa8r1XSPjbqOxusY8iAmKfCM97j++lFrZTF221+bAdl4oCys8ZUXQVsvgKeeVXVBFxNw3Eix2VjRLIbOJa92mBhmmLcxAVtJbgzD8gsvPP0HdE8W2KUSV+M0eq+b3x58trVdOaWiFmnwSXPUYbMpyfAT0Nys4egx4PcZZFGoaYlxngfKdxHcyyuCVA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY4PR10MB1463.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(508600001)(66946007)(66556008)(66476007)(4326008)(8676002)(86362001)(83380400001)(5660300002)(6486002)(6506007)(6512007)(6666004)(107886003)(36756003)(26005)(186003)(1076003)(2616005)(8936002)(316002)(2906002)(38100700002)(38350700002)(52116002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: TDf6by2QNi4O6yCRANkMYraplFXMAgVhZGJ9fEmUGNu/6cKZb9TP1bQhLIU0zI2ExooWbo6WxGVGDyMgg3SIZwoimBgKxxOUrc1gypXrNLze5TwtGrPAv5Z52XfDiNH6XYsrt5CnN9uVGLBTPtJNUjeY9+ELn2oW3i0QU9atPbOWyHZyohCoapZiD9stZEm9DU4mlhu+vjI5MlM3YZVNxbcFaYh2ehymXuBNOn1rpcmsJMG4OZ6mtrBiG6SHhhjlxHelbShif+OYZU1/0b5AvjEsdGp0ldOFFWeJzyOOFGDGe1/2Sce3EVaVl39BzBi9JZUcsiRiKlZTOz5VzOP9KD2j6w0t00a8o653dJDH3T2SxsLetM0Vp8xO7dF53Y9Y6ln/NDnpEh0oSBiVmQMXO/5j383M48Mqpn5l+X3J4sv8JTgs0cJ3Mbim5oH52z9NIIMB82zrd3mLgwEP7gO3z/WCFJnPecB0qVy2C2xK3x9pYFH7Z2KTG4XAbiugXWTVUTV3hrZ0NvXZVgDOldGLvg2twdvLiMkAydUSBFol8jVuTtIgu23Zqwp5Do3xdqY/PIRFEdgWiXT66/9shKrKqxRCUXPS3HMzk0MVFv5HvTggBDs61bC5LArtyNMVaY3m4yKu5XRFj3zWzP3cSNFheYPGIbmzWcNRLTiiJzSwPoqfpRIMV6KomNKAcG2fd1b53IziFN3FDZS5sPugMpzeAOJlfxoN3jcq/JZX6y/i7+gu5SqzWS5Gyqh5mmpNMsI0tSow+M4ZkjIswsOqaqXjNGNHjrdqzhms4spwWf0uIQzE/5/1be6irVXyYZ/eydnfxVgcTUNvCQ8WhLl3mv2fWLQsJSxaH/uUgHc4W0pNEh4Mg56zEabGBaQ+rNRr7Sy9SGmUvG/GIhLavB4vybE6dKTSBiVx9u43tfJjxAUoCjl3se+jOAtaE3hvrxP+LmfZmMqvxJ+VLmtsHg7M4qu8MlwsEnrBqRKsBqxLwq/Ah70CEZ3CfNd/+SW0dkEtIn/AZHN4nbES5D6xMZ1Zf5O8X20+saMQDObdoXDZ3DtH1etVMr6LAdJm/CU46OcxpXedDt3ymX9q/G9qdgg8yibdGJmwq/4imu4cN3qU0r9qjQf1xjIjbJQzUeVGkcj3rKVEAk9DByYrOT8MuC0N3pUOCX4crB2vSzE1TINDJsuhxTvFkk6BjbLewXtck9PcJv0jRS5lDKRGYN+r1mW+VN8qJ7OzCezxAQUy7IO9EPkB8EptymRHf8XXWdO99VkLB9OuabfEZdDT7ZRwzQHVThEgMs4k4+WRvyZ5ZY/TXTJoiNBrxQlzBbVp23bKtQKJFWn4RKgmrgFj017XRQ/UtyGBQZSTsEiYvtFLBcZnOSpVnR1dNh/Obv3Gj+aSCSZfChlz4BFEgJMgMXwPOAyH51uZwj/V6kudXcN3ljP9+oHnz7h/xB6aGHZbx4zOwnEspbm5H3cDQi7dEab+ocAhKAlxWQ== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: d3a561c7-a15a-42e4-d541-08da0a0ac332 X-MS-Exchange-CrossTenant-AuthSource: CY4PR10MB1463.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Mar 2022 00:44:16.8904 (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: trnotLAjZvcsBJTBTc/CfvTqygDhnICftDK0TKqwYxHTQ6D/kNsD7vqglIb2PLFza4q/5W9IVQr6YWm4OWZeao+BKY/09hi0ZN4dfnzMVbs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR10MB3992 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10291 signatures=694221 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 adultscore=0 bulkscore=0 malwarescore=0 mlxlogscore=999 phishscore=0 spamscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2203200003 X-Proofpoint-GUID: Aq1SnkqxHI_7qcK5Cm9N-WaPvqsDOXx_ X-Proofpoint-ORIG-GUID: Aq1SnkqxHI_7qcK5Cm9N-WaPvqsDOXx_ Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org We currently require that the back_lock is held when calling the functions that manipulate the iscsi_task refcount. The only reason for this is to handle races where we are handling SCSI-ml eh callbacks and the cmd is completing at the same time the normal completion path is running, and we can't return from the EH callback until the driver has stopped accessing the cmd. Holding the back_lock while also accessing the task->state made it simple to check that a cmd is completing and also get/put a refcount at the same time, and at the time we were not as concerned about performance. The problem is that we don't want to take the back_lock from the xmit path for normal IO since it causes contention with the completion path if the user has chosen to try and split those paths on different CPUs (in this case abusing the CPUs and igoring caching improves perf for some uses). This patch begins to remove the back_lock requirement for iscsi_get/put_task by removing the requirement for the get path. Instead of always holding the back_lock we detect if something has done the last put and is about to call iscsi_free_task. The next patch will then allow iscsi code to do the last put on a task and only grab the back_lock if the refcount is now zero and it's going to call iscsi_free_task. Reviewed-by: Lee Duncan Signed-off-by: Mike Christie --- drivers/scsi/be2iscsi/be_main.c | 19 ++++++- drivers/scsi/libiscsi.c | 95 +++++++++++++++++++++++---------- drivers/scsi/libiscsi_tcp.c | 5 +- include/scsi/libiscsi.h | 2 +- 4 files changed, 88 insertions(+), 33 deletions(-) diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c index ab55681145f8..26e5446ac237 100644 --- a/drivers/scsi/be2iscsi/be_main.c +++ b/drivers/scsi/be2iscsi/be_main.c @@ -231,6 +231,7 @@ static int beiscsi_eh_abort(struct scsi_cmnd *sc) cls_session = starget_to_session(scsi_target(sc->device)); session = cls_session->dd_data; +completion_check: /* check if we raced, task just got cleaned up under us */ spin_lock_bh(&session->back_lock); if (!abrt_task || !abrt_task->sc) { @@ -238,7 +239,13 @@ static int beiscsi_eh_abort(struct scsi_cmnd *sc) return SUCCESS; } /* get a task ref till FW processes the req for the ICD used */ - __iscsi_get_task(abrt_task); + if (!iscsi_get_task(abrt_task)) { + spin_unlock(&session->back_lock); + /* We are just about to call iscsi_free_task so wait for it. */ + msleep(1); + goto completion_check; + } + abrt_io_task = abrt_task->dd_data; conn = abrt_task->conn; beiscsi_conn = conn->dd_data; @@ -323,7 +330,15 @@ static int beiscsi_eh_device_reset(struct scsi_cmnd *sc) } /* get a task ref till FW processes the req for the ICD used */ - __iscsi_get_task(task); + if (!iscsi_get_task(task)) { + /* + * The task has completed in the driver and is + * completing in libiscsi. Just ignore it here. When we + * call iscsi_eh_device_reset, it will wait for us. + */ + continue; + } + io_task = task->dd_data; /* mark WRB invalid which have been not processed by FW yet */ if (is_chip_be2_be3r(phba)) { diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index 5c74ab92725f..a2d0daf5bd60 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c @@ -83,6 +83,8 @@ MODULE_PARM_DESC(debug_libiscsi_eh, "%s " dbg_fmt, __func__, ##arg); \ } while (0); +#define ISCSI_CMD_COMPL_WAIT 1 + inline void iscsi_conn_queue_xmit(struct iscsi_conn *conn) { struct Scsi_Host *shost = conn->session->host; @@ -482,11 +484,11 @@ static void iscsi_free_task(struct iscsi_task *task) } } -void __iscsi_get_task(struct iscsi_task *task) +bool iscsi_get_task(struct iscsi_task *task) { - refcount_inc(&task->refcount); + return refcount_inc_not_zero(&task->refcount); } -EXPORT_SYMBOL_GPL(__iscsi_get_task); +EXPORT_SYMBOL_GPL(iscsi_get_task); void __iscsi_put_task(struct iscsi_task *task) { @@ -600,20 +602,17 @@ static bool cleanup_queued_task(struct iscsi_task *task) } /* - * session frwd lock must be held and if not called for a task that is still - * pending or from the xmit thread, then xmit thread must be suspended + * session back and frwd lock must be held and if not called for a task that + * is still pending or from the xmit thread, then xmit thread must be suspended */ -static void fail_scsi_task(struct iscsi_task *task, int err) +static void __fail_scsi_task(struct iscsi_task *task, int err) { struct iscsi_conn *conn = task->conn; struct scsi_cmnd *sc; int state; - spin_lock_bh(&conn->session->back_lock); - if (cleanup_queued_task(task)) { - spin_unlock_bh(&conn->session->back_lock); + if (cleanup_queued_task(task)) return; - } if (task->state == ISCSI_TASK_PENDING) { /* @@ -632,7 +631,15 @@ static void fail_scsi_task(struct iscsi_task *task, int err) sc->result = err << 16; scsi_set_resid(sc, scsi_bufflen(sc)); iscsi_complete_task(task, state); - spin_unlock_bh(&conn->session->back_lock); +} + +static void fail_scsi_task(struct iscsi_task *task, int err) +{ + struct iscsi_session *session = task->conn->session; + + spin_lock_bh(&session->back_lock); + __fail_scsi_task(task, err); + spin_unlock_bh(&session->back_lock); } static int iscsi_prep_mgmt_task(struct iscsi_conn *conn, @@ -1449,8 +1456,17 @@ static int iscsi_xmit_task(struct iscsi_conn *conn, struct iscsi_task *task, spin_lock_bh(&conn->session->back_lock); if (!conn->task) { - /* Take a ref so we can access it after xmit_task() */ - __iscsi_get_task(task); + /* + * Take a ref so we can access it after xmit_task(). + * + * This should never fail because the failure paths will have + * stopped the xmit thread. WARN on move on. + */ + if (!iscsi_get_task(task)) { + spin_unlock_bh(&conn->session->back_lock); + WARN_ON_ONCE(1); + return 0; + } } else { /* Already have a ref from when we failed to send it last call */ conn->task = NULL; @@ -1492,7 +1508,7 @@ static int iscsi_xmit_task(struct iscsi_conn *conn, struct iscsi_task *task, * get an extra ref that is released next time we access it * as conn->task above. */ - __iscsi_get_task(task); + iscsi_get_task(task); conn->task = task; } @@ -1907,6 +1923,7 @@ static void fail_scsi_tasks(struct iscsi_conn *conn, u64 lun, int error) struct iscsi_task *task; int i; +restart_cmd_loop: spin_lock_bh(&session->back_lock); for (i = 0; i < session->cmds_max; i++) { task = session->cmds[i]; @@ -1915,22 +1932,25 @@ static void fail_scsi_tasks(struct iscsi_conn *conn, u64 lun, int error) if (lun != -1 && lun != task->sc->device->lun) continue; - - __iscsi_get_task(task); - spin_unlock_bh(&session->back_lock); + /* + * The cmd is completing but if this is called from an eh + * callout path then when we return scsi-ml owns the cmd. Wait + * for the completion path to finish freeing the cmd. + */ + if (!iscsi_get_task(task)) { + spin_unlock_bh(&session->back_lock); + spin_unlock_bh(&session->frwd_lock); + msleep(ISCSI_CMD_COMPL_WAIT); + spin_lock_bh(&session->frwd_lock); + goto restart_cmd_loop; + } ISCSI_DBG_SESSION(session, "failing sc %p itt 0x%x state %d\n", task->sc, task->itt, task->state); - fail_scsi_task(task, error); - - spin_unlock_bh(&session->frwd_lock); - iscsi_put_task(task); - spin_lock_bh(&session->frwd_lock); - - spin_lock_bh(&session->back_lock); + __fail_scsi_task(task, error); + __iscsi_put_task(task); } - spin_unlock_bh(&session->back_lock); } @@ -2035,7 +2055,16 @@ enum blk_eh_timer_return iscsi_eh_cmd_timed_out(struct scsi_cmnd *sc) spin_unlock(&session->back_lock); goto done; } - __iscsi_get_task(task); + if (!iscsi_get_task(task)) { + /* + * Racing with the completion path right now, so give it more + * time so that path can complete it like normal. + */ + rc = BLK_EH_RESET_TIMER; + task = NULL; + spin_unlock(&session->back_lock); + goto done; + } spin_unlock(&session->back_lock); if (session->state != ISCSI_STATE_LOGGED_IN) { @@ -2282,6 +2311,7 @@ int iscsi_eh_abort(struct scsi_cmnd *sc) ISCSI_DBG_EH(session, "aborting sc %p\n", sc); +completion_check: mutex_lock(&session->eh_mutex); spin_lock_bh(&session->frwd_lock); /* @@ -2321,13 +2351,20 @@ int iscsi_eh_abort(struct scsi_cmnd *sc) return SUCCESS; } + if (!iscsi_get_task(task)) { + spin_unlock(&session->back_lock); + spin_unlock_bh(&session->frwd_lock); + mutex_unlock(&session->eh_mutex); + /* We are just about to call iscsi_free_task so wait for it. */ + msleep(ISCSI_CMD_COMPL_WAIT); + goto completion_check; + } + + ISCSI_DBG_EH(session, "aborting [sc %p itt 0x%x]\n", sc, task->itt); conn = session->leadconn; iscsi_get_conn(conn->cls_conn); conn->eh_abort_cnt++; age = session->age; - - ISCSI_DBG_EH(session, "aborting [sc %p itt 0x%x]\n", sc, task->itt); - __iscsi_get_task(task); spin_unlock(&session->back_lock); if (task->state == ISCSI_TASK_PENDING) { diff --git a/drivers/scsi/libiscsi_tcp.c b/drivers/scsi/libiscsi_tcp.c index 883005757ddb..defe08142b75 100644 --- a/drivers/scsi/libiscsi_tcp.c +++ b/drivers/scsi/libiscsi_tcp.c @@ -558,7 +558,10 @@ static int iscsi_tcp_r2t_rsp(struct iscsi_conn *conn, struct iscsi_hdr *hdr) return 0; } task->last_xfer = jiffies; - __iscsi_get_task(task); + if (!iscsi_get_task(task)) { + /* Let the path that got the early rsp complete it */ + return 0; + } tcp_conn = conn->dd_data; rhdr = (struct iscsi_r2t_rsp *)tcp_conn->in.hdr; diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h index 522fd16f1dbb..9032a214104c 100644 --- a/include/scsi/libiscsi.h +++ b/include/scsi/libiscsi.h @@ -470,7 +470,7 @@ extern struct iscsi_task *iscsi_itt_to_task(struct iscsi_conn *, itt_t); extern void iscsi_requeue_task(struct iscsi_task *task); extern void iscsi_put_task(struct iscsi_task *task); extern void __iscsi_put_task(struct iscsi_task *task); -extern void __iscsi_get_task(struct iscsi_task *task); +extern bool iscsi_get_task(struct iscsi_task *task); extern void iscsi_complete_scsi_task(struct iscsi_task *task, uint32_t exp_cmdsn, uint32_t max_cmdsn); From patchwork Sun Mar 20 00:44:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 553287 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F21C7C433EF for ; Sun, 20 Mar 2022 00:44:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244513AbiCTAqE (ORCPT ); Sat, 19 Mar 2022 20:46:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42616 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244491AbiCTApq (ORCPT ); Sat, 19 Mar 2022 20:45:46 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1AB5C241A0B for ; Sat, 19 Mar 2022 17:44:24 -0700 (PDT) Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 22JEhZuv012459; Sun, 20 Mar 2022 00:44: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-2021-07-09; bh=G/x9rCYuQmcNZaeQxXNKcCHd2LWbuTuyiAqHrcqM1yI=; b=kBeHw+T4BRjHlTrF1pdzP4uRDq89uveSRibddONg6VQTJ9jHk91W3GSEflqeEiHMvwLT KVZ2Zeuvq9Rc05/5ZB0haLSKPYoj3uAnbxDnncAleFnH+b0NIhWiJghopekBKMmewOad CSSK59s8Ruj0F+efZ3g22KqyOmggeE8NV8KCUC2ZAf7iFVxfzmCkO8btdst83EMgpck4 bLOL9mDB4RsmKQGkhtVDtgfYYduzigXBkJeDYR1wzOFbpbyT5cm5TcMAqOL13anuwAKo LUTzWf2gZqHjvPG2Of1zHJbV2MzFp23GZmiCLDpfV/UofUlnWNY/diBe2JRKuCPByZCg zw== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by mx0b-00069f02.pphosted.com with ESMTP id 3ew6ss0ux1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 20 Mar 2022 00:44:19 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.1.2/8.16.1.2) with SMTP id 22K0ffap137063; Sun, 20 Mar 2022 00:44:18 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2169.outbound.protection.outlook.com [104.47.55.169]) by userp3020.oracle.com with ESMTP id 3ew8mg6mq1-11 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 20 Mar 2022 00:44:18 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WzPgD/hvHkS7yHOHFLC5/vDvU2j5M/VKs5UM5gWkClLCaJMXXWQTGv1q5ampDB7UuvzJ3u3qKBSX0XPc5HzHNBgHGErIMn7q18qpwmq0iTAa46IJROViW3xRw6qhaFBdH4tdfwWlgn94iK0jXELSNSv+PrctNT1RT+k3VISi38lNrnJ4AfFXB0qXjUFetlZEF31nfLvkggIQP7ESdCG19Xhxmi/1n2zkLnx4FEgHntEbZtyNFWutyM1jcV/wjSuWrmfGR3JY1mFsKxEkQOa2XPhW9wIMHiyBWaY23DGLsdOtfiqukzb2a/hCf0vAFq3JPCdpB41M5/WRL/m61TB7ig== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=G/x9rCYuQmcNZaeQxXNKcCHd2LWbuTuyiAqHrcqM1yI=; b=NJWwW2I487xVSiATuRZG2BUxjCNzk2ka0vrRkOpaSAPW/puArvNoMNK/NSl6Bn/biaTjMoXd8qDg2KkPoXxicifgsqqCdAhhFe40ly3MOgDxunUgoXNd/m1GyJiPj8ClNrni03mCuXEThkd5AVYrq6X3m+hTXDYr85M78WHZNp24rLmkOms4BCWmZztfcGId3RTd1ZzPxow93nRb5+aAV9l+8FRgYds1fk/Tz54RBZ0Ivyq/NaeNcJHnTEtmxaoaLo9YQ+IP+2hzr7axi73Jh41Huv4G+Knh0dL/ELHw9pBsLXoWKA3WvXRQoyfFLNyPqFjrahED2eKVb46UDfLEAg== 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=G/x9rCYuQmcNZaeQxXNKcCHd2LWbuTuyiAqHrcqM1yI=; b=F5oAVBMEwm/I1ZWHmQ+lBUKjUsXr3pgQ/PUfvPDYuoALQq+aFRYQmAxVNqsY/zlfBJmiyY1DF2jweXDXm6XhZYqIepRAtII10p61Caf9rDvSOrV6S6YtWG/3vshmMmqkXvcs/zv8XX96jn13nUuJ5K7z5wbuqWvNANu0VhRRGDQ= Received: from CY4PR10MB1463.namprd10.prod.outlook.com (2603:10b6:903:2b::12) by CH2PR10MB3992.namprd10.prod.outlook.com (2603:10b6:610:9::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5081.17; Sun, 20 Mar 2022 00:44:17 +0000 Received: from CY4PR10MB1463.namprd10.prod.outlook.com ([fe80::78b1:38c1:cfb8:537f]) by CY4PR10MB1463.namprd10.prod.outlook.com ([fe80::78b1:38c1:cfb8:537f%11]) with mapi id 15.20.5081.022; Sun, 20 Mar 2022 00:44:17 +0000 From: Mike Christie To: lduncan@suse.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, jejb@linux.ibm.com Cc: Mike Christie Subject: [PATCH V2 10/12] scsi: iscsi: Try to avoid taking back_lock in xmit path Date: Sat, 19 Mar 2022 19:44:00 -0500 Message-Id: <20220320004402.6707-11-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220320004402.6707-1-michael.christie@oracle.com> References: <20220320004402.6707-1-michael.christie@oracle.com> X-ClientProxiedBy: DM5PR18CA0065.namprd18.prod.outlook.com (2603:10b6:3:22::27) To CY4PR10MB1463.namprd10.prod.outlook.com (2603:10b6:903:2b::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0f267ef2-76e9-4146-a805-08da0a0ac388 X-MS-TrafficTypeDiagnostic: CH2PR10MB3992:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vLKnG0tbB3RJBZItNVvJnL4XXWz0p9SGH/VTpFeNhLYSyCDEGe5r7qHaMBz8ho656YWa4CE/BXW+gj6EiTyXSYBoFvBPiDeDScF7OxIpKItDRWY1BTUQ5LXxNtpjqx48DTTdXSv0IKKqWZGmLfS7tMnxt99j0lZZCKRqR25ygRyRiykiD472C2FmVB0fRqCzCOPw5L7ckcP6RrzDLJtGdNfFNTOdHPycW3KicFjY7td8tQ4Ghw2md3Gv25oVCYXHZdYEcar3c6OGpqdrypB7aCZvLocKeUzmaSDgM1zGpTEOLQPnqW8Va/oO5AEqBGC615CetS8g7BthaWfyjM8bWFnA4+wkSLsBercT+LHac97xr9V8H+aoFKu8GnWymn9Ay33O3dLnMvBdgst/tqLyLck3xc99ToDde81FZpil6oRhQzHGjSf9YWp+i0bMqjK2FJMyCgnN6EBiR7C/6LAxmIo3el3DA1IwjMDsdvmrD3iQjeVt5yzH4ajJ6EzfBWFLNPyApIYbSybQqZ7Zocg5QuAMbpWOSaKmv/rD6IWr6zjk78+lG+mwAKNogwTU9UQbvdGnSAYXXQ9+ta5jOD/UEgC9mNZNKRehKK1cAArjvvQb4Hp8ExjxPWu9v4T1HBu3boUIwwAAFcclwTv3dlBJJqoMtLJBWzSHq43p+iQrrlUARdK93qcvVjVZ9LJm7MAN6cmS7JmsFyV0dnF3G+QhLw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY4PR10MB1463.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(508600001)(66946007)(66556008)(66476007)(4326008)(8676002)(86362001)(83380400001)(5660300002)(6486002)(6506007)(6512007)(6666004)(107886003)(36756003)(26005)(186003)(1076003)(2616005)(8936002)(316002)(2906002)(38100700002)(38350700002)(52116002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: TSgR4IRPdUptODVMDqwzJUvjuTc54UxYYIRZbA1n9+XvP7pVirM0vv4bCPNR0VXCQyLsbHxLarD7FP7tjlFO3cXf4nVsBNF9hQyjvZx5Hm6XlVQkIFvMXG9c4OMDI7ffjzD8L6vyidltprsIk9+S5iC0MqO1eDGOXPtjzX0JUCOa5JYhNPKCdRNxQuQ4RcANGC5QiucpPxPzTlFMTjfnnq8LrTYHzvlFvtvvLu9ktbaZyTV1takqG1rIJXJCEmJ2xF0IolYtx33hWDz2pgCaCsrOOxYh2ICwTXgpTW7qm22vbaw+uNMS488ErfWyx6hW89t1xa+jQg7r/VPvWPXKlZExmk4ywsSKvS2bwnndpj0CXnyuU5tsU181WLEQHRq5ot9W/r6WEiY7nXq8LV4zomazkrwO279zOEdgu2u46SlOzb30GK1FfRwJBsJxHpe/odsIxbM2IkCvD5Avsxh4cKeTMP9Q1KS9OWkI77WsPPBzeE2KaskvI2JefAiYWbThOb9OWojFf2/mOSzKh5tmFLNnaZykhMr6NzfPyGVsrVfuOM1g4mm+bGqFh/LGMNOUZ9SoxNxnSJ8fOMrnuOxBmYRd9DRHUuIoWR2JjUToLhpcy/LUtEf9UKzYgCkAEXpSBi0u5U720VcC87cCIjDEFUKCyx+naM5r3o3KQLnJXteCF5DorJ24by6QHWX8Y9fbpxQ3NZb7QvosSTYQE22yjmTnm49+PcGKLXytOFcS4mRt2sE20fsY8GcCtwJYFonhaTXFc9CMP2H/G2jst6S15z8Ap70cOP8bET8Hw5aZZ+VULa1n1L80gRjcEYM32ej37Yy8YE/4yfanBtbyMfkppzOz+mAvmR1Emjj+rgRsg1Fenb9C12nL9qjEzd7saqZhFN25+ATLM9Xi8/YPEhTxpowRiL57p9lcSlYXOp9f9mES6pLkXbu2QrYL3I+DJJ8ni9msb5njRuiAELAii3aUHwxgs2jAvSFJpgq1fVZafh0r2qTNNXDTI15/TTtzssMxIpYVUJn1h9E/t1Kd1jW5rfaz/KUe9k8lnAMlZncONe9Aif3pw+ccQ9lQJ3KCT6NI9c/QoYGcu7a7lwn6+q/2CeQ0S9NVNXA2g1Ig7nl20un594jRHG40vtV32CzYnB4poVDJ0aRK7X9/U2O1vME9xSLQFfgyq3IJDlPdEwpdxRdWg7q4vDq17MLThkDOWrm0kmNMpYruq3ayMJAGQtwZjtD0+BRcw9xxejvp1NPkDICif4PnJdyOK7++7OOe/8JKtJ+La04gTS20XVMEf+O6i7hIp0ZrNojg954pADjAgdtEzVTYjAqdAWLEnZjHmE/hheROpMABvm+/3l6Nazv8U9YZaTAUYWXEGvxCcTpISj4V1xTwpfxcR8zVcP7DqPB9gLm7x5xC23f3uY+Dv0M4HrVa8Y4G4eCjyt3lJSZCcw+s6ZltI17t2TbsdRtL0YfOWb/q6cHA6bkxxQDPytE9sg== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0f267ef2-76e9-4146-a805-08da0a0ac388 X-MS-Exchange-CrossTenant-AuthSource: CY4PR10MB1463.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Mar 2022 00:44:17.4841 (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: qTOLbCNJMlFnh9MLxZxuW00dfyy8pkWmGPllybiPfAP8v5M874gZETZpsoxWjkbfqvtd4Ts9pcz8aebkaF6BMXyg8fDX0TGBvG5t5no6XfM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR10MB3992 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10291 signatures=694221 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 adultscore=0 bulkscore=0 malwarescore=0 mlxlogscore=999 phishscore=0 spamscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2203200003 X-Proofpoint-ORIG-GUID: t8PzUdjIvB2058PpfFEaEBnkxhoQOiPl X-Proofpoint-GUID: t8PzUdjIvB2058PpfFEaEBnkxhoQOiPl Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org We need the back lock when freeing a task, so we hold it when calling __iscsi_put_task from the completion path to make it easier and to avoid having to retake it in that path. For iscsi_put_task we just grabbed it while also doing the decrement on the refcount but it's only really needed if the refcount is zero and we free the task. This modifies iscsi_put_task to just take the lock when needed then has the xmit path use it. Normally we will then not take the back lock from the xmit path. It will only be rare cases where the network is so fast that we get a response right after we send the header/data. Reviewed-by: Lee Duncan Signed-off-by: Mike Christie --- drivers/scsi/libiscsi.c | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index a2d0daf5bd60..cde389225059 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c @@ -490,6 +490,12 @@ bool iscsi_get_task(struct iscsi_task *task) } EXPORT_SYMBOL_GPL(iscsi_get_task); +/** + * __iscsi_put_task - drop the refcount on a task + * @task: iscsi_task to drop the refcount on + * + * The back_lock must be held when calling in case it frees the task. + */ void __iscsi_put_task(struct iscsi_task *task) { if (refcount_dec_and_test(&task->refcount)) @@ -501,10 +507,11 @@ void iscsi_put_task(struct iscsi_task *task) { struct iscsi_session *session = task->conn->session; - /* regular RX path uses back_lock */ - spin_lock_bh(&session->back_lock); - __iscsi_put_task(task); - spin_unlock_bh(&session->back_lock); + if (refcount_dec_and_test(&task->refcount)) { + spin_lock_bh(&session->back_lock); + iscsi_free_task(task); + spin_unlock_bh(&session->back_lock); + } } EXPORT_SYMBOL_GPL(iscsi_put_task); @@ -1453,8 +1460,6 @@ static int iscsi_xmit_task(struct iscsi_conn *conn, struct iscsi_task *task, { int rc; - spin_lock_bh(&conn->session->back_lock); - if (!conn->task) { /* * Take a ref so we can access it after xmit_task(). @@ -1463,7 +1468,6 @@ static int iscsi_xmit_task(struct iscsi_conn *conn, struct iscsi_task *task, * stopped the xmit thread. WARN on move on. */ if (!iscsi_get_task(task)) { - spin_unlock_bh(&conn->session->back_lock); WARN_ON_ONCE(1); return 0; } @@ -1477,7 +1481,7 @@ static int iscsi_xmit_task(struct iscsi_conn *conn, struct iscsi_task *task, * case a bad target sends a cmd rsp before we have handled the task. */ if (was_requeue) - __iscsi_put_task(task); + iscsi_put_task(task); /* * Do this after dropping the extra ref because if this was a requeue @@ -1489,10 +1493,8 @@ static int iscsi_xmit_task(struct iscsi_conn *conn, struct iscsi_task *task, * task and get woken up again. */ conn->task = task; - spin_unlock_bh(&conn->session->back_lock); return -ENODATA; } - spin_unlock_bh(&conn->session->back_lock); spin_unlock_bh(&conn->session->frwd_lock); rc = conn->session->tt->xmit_task(task); @@ -1500,10 +1502,7 @@ static int iscsi_xmit_task(struct iscsi_conn *conn, struct iscsi_task *task, if (!rc) { /* done with this task */ task->last_xfer = jiffies; - } - /* regular RX path uses back_lock */ - spin_lock(&conn->session->back_lock); - if (rc) { + } else { /* * get an extra ref that is released next time we access it * as conn->task above. @@ -1512,8 +1511,7 @@ static int iscsi_xmit_task(struct iscsi_conn *conn, struct iscsi_task *task, conn->task = task; } - __iscsi_put_task(task); - spin_unlock(&conn->session->back_lock); + iscsi_put_task(task); return rc; } From patchwork Sun Mar 20 00:44:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 553284 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 072F8C433EF for ; Sun, 20 Mar 2022 00:44:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244518AbiCTAqL (ORCPT ); Sat, 19 Mar 2022 20:46:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244495AbiCTAps (ORCPT ); Sat, 19 Mar 2022 20:45:48 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 107FD241A18 for ; Sat, 19 Mar 2022 17:44:25 -0700 (PDT) Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 22JDj6ae017423; Sun, 20 Mar 2022 00:44:21 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-2021-07-09; bh=fZN8rMdRfLaEMoDHY7wUXItpggmMdJxykza4sbnXIE4=; b=dBbeWkMPbqa/X2g0m0Kn4GYGZfCQ6YoCJyejHfrIxPjrUmuQSkwF+Q8xkFh0Zk4bBPwM +Qc+5o5wq00GznCiAHi8bQ/Ri6godxFJ7E0Zhn1Z8h0+C8Xc5BpxtUKeKImoOsRU0nla cy44+h5FtMGmU2zw/UGDSsM+kZhKqRmWX4oOLUjEyRiitG1XbMs633OMiHnG2k5zz5c4 tRxDNGunGKr/lcfob9nOtxl31aWpRpNzQgnJ4n/ZdkphdDUeE862+Cp6jgLCi1bgOyn/ DXpRbH77Zj0V2aB0wzFrrp5LT2qMjqp8Qo014Lpug9LyLvPqULrgjcI1SPVfAiqwKSGf uA== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by mx0b-00069f02.pphosted.com with ESMTP id 3ew5kcgw8g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 20 Mar 2022 00:44:21 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.1.2/8.16.1.2) with SMTP id 22K0gu5t077988; Sun, 20 Mar 2022 00:44:20 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2174.outbound.protection.outlook.com [104.47.55.174]) by aserp3020.oracle.com with ESMTP id 3ew6yysr8w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 20 Mar 2022 00:44:20 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=akkUMIfRIfuOLYxw/zKR6PvCHMDYmUpXF+jeMlaOhrukBESvJAqHwExltzp3Usdz1lxgvPo0vvZ0vKHiK97M93iTCfbHm7Xh44IeKvYtanYLF0UoWLTEyZLjn9x1sMn0rpolNehZeOyAOkbDyo+BEEu09mI3Y/84kP1FdzQL/R11TbB2ymowrret+ifw8UJiOZIunFYVm61+R+HhhEMGqRaW8OU9ekCxKzH8yw/OChblEGthM/wSi3lLL4VpiMlVxe5eVk/9vHeTW5Kd/XhFpvrTyMlhLRwlxHNdWWlM8at8uLYPfchQeoyVXVNcxjn9mekyLI0DDBJ2Bb5i1WTGyQ== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=fZN8rMdRfLaEMoDHY7wUXItpggmMdJxykza4sbnXIE4=; b=d1fwUrXjdzP6D3pPlUTan3hbyBJF+FUlGcyGr5xzXfS98l4GkxWGNqfI/ZaCu9AMu3s3mKfTC7W2xIxR/DfbVB/mv29f4h6Ceg1+MHKg5WXVnwq2T1BLrwQwLmnsVMSnDsxmrKRfnjI2sekO+U3r30cKeefAL3EdFYUK3PAj+Tu8BEZV6LLVKVnDuuEfWLGU2ol3yznmsKJsSaWVj3rWEHZZ9khGI9BzM2EKbiqKVKTW+UoaX6VSwTxWP8tBVpeht0aY1zS+xme3iVa41+kGt5FbLbhtVtQHBT2L+CdHs0SKCriWiJi/VFvhMn1W6nP3lrg7gfhUFCjct5Iu95PC2g== 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=fZN8rMdRfLaEMoDHY7wUXItpggmMdJxykza4sbnXIE4=; b=Oi++1YSvSy4xjtGIPMSzO3shp8FGSAdDfCiuQok4o8oia0muMPzhQKmPH8+MQ8vemny8h4OLicZjmzRofK/JsucRzR675A5wW9+lpJswOCsHBq2aomSbhY3e4NpE+UO/XB/FxMnIBWVfLf2yO8fwmuYt4BNKWcfPF7ZcfXInUcs= Received: from CY4PR10MB1463.namprd10.prod.outlook.com (2603:10b6:903:2b::12) by CH2PR10MB3992.namprd10.prod.outlook.com (2603:10b6:610:9::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5081.17; Sun, 20 Mar 2022 00:44:18 +0000 Received: from CY4PR10MB1463.namprd10.prod.outlook.com ([fe80::78b1:38c1:cfb8:537f]) by CY4PR10MB1463.namprd10.prod.outlook.com ([fe80::78b1:38c1:cfb8:537f%11]) with mapi id 15.20.5081.022; Sun, 20 Mar 2022 00:44:18 +0000 From: Mike Christie To: lduncan@suse.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, jejb@linux.ibm.com Cc: Mike Christie Subject: [PATCH V2 11/12] scsi: libiscsi: improve conn_send_pdu API Date: Sat, 19 Mar 2022 19:44:01 -0500 Message-Id: <20220320004402.6707-12-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220320004402.6707-1-michael.christie@oracle.com> References: <20220320004402.6707-1-michael.christie@oracle.com> X-ClientProxiedBy: DM5PR18CA0065.namprd18.prod.outlook.com (2603:10b6:3:22::27) To CY4PR10MB1463.namprd10.prod.outlook.com (2603:10b6:903:2b::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 486fa01f-35b8-4a8e-dd1c-08da0a0ac3e0 X-MS-TrafficTypeDiagnostic: CH2PR10MB3992:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1sRtou9PVqetDbPWOPY7tANY4oiMPagI6jxmB80U2AU6qoRE5g3lCvPl+gyuVWXWdwqc62CfBpGOiu3a5bR+lVzYMeSkB0n5jdtXkL4dJWBnHnbydEysG+6+efVvLj2CwV83e3aImS4wjo60kZqptOi5AVggONzbofqG4EqZZ11+mtLgZV3lPvY/gPw9K5YRmfwEZm06wB5qbdD0JG28NQZNxrbk6LyA43Uj9LPg7aWJnEITnRqO/gRkqNMkh9GBWk5XRgbwSFOXgwwopahnhkv/JoisJXJ7/IL+l9lM6/uBq3q+R1tFZ1sE9o/DDqi5rWUQ3/uR5lOHrgZ85WBwfKHFaInpYxvidclnXqx/Q8w8Dvl2eyFrcysQEQWKwt7rTYL5nenUKQofshhtlHJGNFl7z633FWgm1jDuUj2fwID5XhtigcPbWP2DVgLlB1aJNR/7kWNQ3Dsp33cQLZTX5XvRzLrnEOYM7vbUGSFLjSI5hvGmUSyN3snn7RwGP0L8L6yNAl9nPZgqW4P84C33szHgd4nsUf8zgTweuwK2ubF5TjmT9uOdPdG2CgYLHv80gfJIV/0LjrutayQW0eM6MGPicJOb+HSMdBD0AyvgI1uA8GYQM3x+WFvjNG0GSrQS1PSTntq7Xhh+QV7Ztibnaow8uAMItRKmxccJcL7N3Gfsa/laxP10pz2fu839TTFY0tIye5Z4jzxrqzmQ852QBA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY4PR10MB1463.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(508600001)(66946007)(66556008)(66476007)(4326008)(8676002)(86362001)(83380400001)(5660300002)(6486002)(6506007)(6512007)(6666004)(107886003)(36756003)(26005)(186003)(1076003)(2616005)(8936002)(316002)(2906002)(38100700002)(38350700002)(52116002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 0tgmru4nH82lHbj9izavQ2ysCX2Yc0cVrwvf0ecXg3tDadnW5hNer9BtzWh1sZcXpKOBT1NP+NlTPLSCg1JepG6ctAJiVSgsOWXqK7GRC0XW3LBreDfbXfrvVErCsVHpmcn6UQeJLpQbC63GUM7zL0gRXrQPO2BPX0Va/SEg++5k18+j4gMQWtxTHK+zqhL5x1luK4JBABKjxI4+oPMGXltIaR6dWb7vVIBdB2PbmdlYYyajxXYs6HHMVb6i6W8OReRxI5qAlvPwCynlt9Dq7/jJl/kfS5+BRPcGGgXvq008Ih3B/xKKtB0BEZCpcGLNgGpMWLQ8N14HcWgZhA3JOYCVA7UVyhL7RLMY+DwVrP6WV1uxRM015gFC82JuUv0wamisWTs2YLFYu+yccr+JSiuFxKhMpLNvNA3VZ1xGskE2oiBEnPsF1I/A+Uqdt+YaPFlwq9e3udQETh5c8OVtn7+PiDrxLa6/WiAbQgmn9SVkM8XSTc0qwOqzQenGpv2O6t2lCV7O0ll+BhQclGsaYA1bUvCODIyrffiZhdjwqp1fCrBAxF4X9jAjtsrdGHoAagtr4mKhyHV0I0ht5ENl9rYpGE9wgTTc9/fs7Y4bYTF5tNADmVDdb1TdrXaWhSDZhMrYoo+4Q+oPhsljdS+yTaHzGEOQTiuLbGC2XHwLNntRahMQgDxOZ7Ct4E3UN/lll6PyKCAx2FSWjSJKz01/zAgAlv1cxQrv8UqacgebI0RRmFVClcJL4A72+JB1YmBWsDg3v4c35I00dLPXd45j8zehI+jEOGdmb6sz9b+VR4IVdwbyH1jQoDaJzy9IC0upB+8EjG34hZn8qggZV438RtocQsl7JeIVGGAZVTjWjuLrd5l7e5jqkHuYUDu/Npm2c+ScEg8ftPhKArxmCBMDcgeOKnOLvqVBMDLP4PHGCv93Mcl3u+I+Rek39olK/iLOh++jhcNMbXUSqddnkeRKhMbw6GSdOHv/o7Rlh3HhaJuIdFGmTPo7bF8cEuY2MhHnwd6Y1OkLjkR6tlz1x+2E1Ng57oxQmuHYbDr/DaPJXKXLaK1jTmu2ZkSe5Po5vvbG3cYLQXn0axdEu7I+RPKRTiilq2A/USj8XWSwJDsdMuAusgaXp3USQBjrF4IURb35RJQC4wLw+dQTIaGaJbUNdjvdA9G3jWc4Fn8UCLqtJIa7CIeDm5bZ1tJ2XKUgvkbgtkAluMFrQp+4IOJH1s7hUQbdoU6lTiyBoz4VZEphlbFub39kxxmKlAsL61XoVPkxgJm/IhznhruvhRX3wjFSxo7lnLx9TErnv0pEGurXzelvbHzf4iipCOqDMh29nMb8HsGDm34Nmqbw0JcsbXQZDDtt2xWFBN6Sks+Lq6SEHmpOwO0mQuWSvFdrT1CuH5wDm3qTS0yrwa1GWXC9sIBZYIwCVQ2Yv5tNb82Y5dnHuTglTHZ+YQuMDPNo2I1L/O0KUP7BAaHbpbKTd4DreksTdA== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 486fa01f-35b8-4a8e-dd1c-08da0a0ac3e0 X-MS-Exchange-CrossTenant-AuthSource: CY4PR10MB1463.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Mar 2022 00:44:18.2653 (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: 9CgX47Fw2PNnYz1CrU7J8uO3C5SZCdHeBaGO8OoQ6aSP+LwK06wXLrhV1Fes307N4hDFgan1ajDFD3D4+lVzB6D5RtyZNS+QvI+OKUly5P0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR10MB3992 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10291 signatures=694221 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 spamscore=0 malwarescore=0 suspectscore=0 mlxlogscore=999 bulkscore=0 phishscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2203200003 X-Proofpoint-GUID: e6PhcIYqHenIBCEi8racgsWLQAb00kZ- X-Proofpoint-ORIG-GUID: e6PhcIYqHenIBCEi8racgsWLQAb00kZ- Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org The conn_send_pdu API is evil in that it returns a pointer to a iscsi_task, but that task might have been freed already so you can't touch it. This patch splits the task allocation and transmission, so functions like iscsi_send_nopout can access the task before its sent and do whatever book keeping is needed before it's sent. Reviewed-by: Lee Duncan Signed-off-by: Mike Christie --- drivers/scsi/libiscsi.c | 85 ++++++++++++++++++++++++++++++----------- include/scsi/libiscsi.h | 3 -- 2 files changed, 62 insertions(+), 26 deletions(-) diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index cde389225059..a165d4d10cea 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c @@ -695,12 +695,18 @@ static int iscsi_prep_mgmt_task(struct iscsi_conn *conn, return 0; } +/** + * iscsi_alloc_mgmt_task - allocate and setup a mgmt task. + * @conn: iscsi conn that the task will be sent on. + * @hdr: iscsi pdu that will be sent. + * @data: buffer for data segment if needed. + * @data_size: length of data in bytes. + */ static struct iscsi_task * -__iscsi_conn_send_pdu(struct iscsi_conn *conn, struct iscsi_hdr *hdr, +iscsi_alloc_mgmt_task(struct iscsi_conn *conn, struct iscsi_hdr *hdr, char *data, uint32_t data_size) { struct iscsi_session *session = conn->session; - struct iscsi_host *ihost = shost_priv(session->host); uint8_t opcode = hdr->opcode & ISCSI_OPCODE_MASK; struct iscsi_task *task; itt_t itt; @@ -780,28 +786,57 @@ __iscsi_conn_send_pdu(struct iscsi_conn *conn, struct iscsi_hdr *hdr, task->conn->session->age); } - if (unlikely(READ_ONCE(conn->ping_task) == INVALID_SCSI_TASK)) - WRITE_ONCE(conn->ping_task, task); + return task; + +free_task: + iscsi_put_task(task); + return NULL; +} + +/** + * iscsi_send_mgmt_task - Send task created with iscsi_alloc_mgmt_task. + * @task: iscsi task to send. + * + * On failure this returns a non-zero error code, and the driver must free + * the task with iscsi_put_task; + */ +static int iscsi_send_mgmt_task(struct iscsi_task *task) +{ + struct iscsi_conn *conn = task->conn; + struct iscsi_session *session = conn->session; + struct iscsi_host *ihost = shost_priv(conn->session->host); + int rc = 0; if (!ihost->workq) { - if (iscsi_prep_mgmt_task(conn, task)) - goto free_task; + rc = iscsi_prep_mgmt_task(conn, task); + if (rc) + return rc; - if (session->tt->xmit_task(task)) - goto free_task; + rc = session->tt->xmit_task(task); + if (rc) + return rc; } else { list_add_tail(&task->running, &conn->mgmtqueue); iscsi_conn_queue_xmit(conn); } - return task; + return 0; +} -free_task: - /* regular RX path uses back_lock */ - spin_lock(&session->back_lock); - __iscsi_put_task(task); - spin_unlock(&session->back_lock); - return NULL; +static int __iscsi_conn_send_pdu(struct iscsi_conn *conn, struct iscsi_hdr *hdr, + char *data, uint32_t data_size) +{ + struct iscsi_task *task; + int rc; + + task = iscsi_alloc_mgmt_task(conn, hdr, data, data_size); + if (!task) + return -ENOMEM; + + rc = iscsi_send_mgmt_task(task); + if (rc) + iscsi_put_task(task); + return rc; } int iscsi_conn_send_pdu(struct iscsi_cls_conn *cls_conn, struct iscsi_hdr *hdr, @@ -812,7 +847,7 @@ int iscsi_conn_send_pdu(struct iscsi_cls_conn *cls_conn, struct iscsi_hdr *hdr, int err = 0; spin_lock_bh(&session->frwd_lock); - if (!__iscsi_conn_send_pdu(conn, hdr, data, data_size)) + if (__iscsi_conn_send_pdu(conn, hdr, data, data_size)) err = -EPERM; spin_unlock_bh(&session->frwd_lock); return err; @@ -985,7 +1020,6 @@ static int iscsi_send_nopout(struct iscsi_conn *conn, struct iscsi_nopin *rhdr) if (!rhdr) { if (READ_ONCE(conn->ping_task)) return -EINVAL; - WRITE_ONCE(conn->ping_task, INVALID_SCSI_TASK); } memset(&hdr, 0, sizeof(struct iscsi_nopout)); @@ -999,10 +1033,18 @@ static int iscsi_send_nopout(struct iscsi_conn *conn, struct iscsi_nopin *rhdr) } else hdr.ttt = RESERVED_ITT; - task = __iscsi_conn_send_pdu(conn, (struct iscsi_hdr *)&hdr, NULL, 0); - if (!task) { + task = iscsi_alloc_mgmt_task(conn, (struct iscsi_hdr *)&hdr, NULL, 0); + if (!task) + return -ENOMEM; + + if (!rhdr) + WRITE_ONCE(conn->ping_task, task); + + if (iscsi_send_mgmt_task(task)) { if (!rhdr) WRITE_ONCE(conn->ping_task, NULL); + iscsi_put_task(task); + iscsi_conn_printk(KERN_ERR, conn, "Could not send nopout\n"); return -EIO; } else if (!rhdr) { @@ -1869,11 +1911,8 @@ static int iscsi_exec_task_mgmt_fn(struct iscsi_conn *conn, __must_hold(&session->frwd_lock) { struct iscsi_session *session = conn->session; - struct iscsi_task *task; - task = __iscsi_conn_send_pdu(conn, (struct iscsi_hdr *)hdr, - NULL, 0); - if (!task) { + if (__iscsi_conn_send_pdu(conn, (struct iscsi_hdr *)hdr, NULL, 0)) { spin_unlock_bh(&session->frwd_lock); iscsi_conn_printk(KERN_ERR, conn, "Could not send TMF.\n"); iscsi_conn_failure(conn, ISCSI_ERR_CONN_FAILED); diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h index 9032a214104c..412722f44747 100644 --- a/include/scsi/libiscsi.h +++ b/include/scsi/libiscsi.h @@ -134,9 +134,6 @@ struct iscsi_task { void *dd_data; /* driver/transport data */ }; -/* invalid scsi_task pointer */ -#define INVALID_SCSI_TASK (struct iscsi_task *)-1l - static inline int iscsi_task_has_unsol_data(struct iscsi_task *task) { return task->unsol_r2t.data_length > task->unsol_r2t.sent; From patchwork Sun Mar 20 00:44:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 553860 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A42AFC43217 for ; Sun, 20 Mar 2022 00:44:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244497AbiCTAqG (ORCPT ); Sat, 19 Mar 2022 20:46:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42766 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244494AbiCTAps (ORCPT ); Sat, 19 Mar 2022 20:45:48 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C8124241A16 for ; Sat, 19 Mar 2022 17:44:25 -0700 (PDT) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 22JKeVMu015172; Sun, 20 Mar 2022 00:44:21 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-2021-07-09; bh=BVgLLFskMtHVRg73umRR8/sjE2XSRhYNfpgchOYL/f4=; b=LXov0Nx5zzDnocRUvCYVJFDk99ZxOppmny0odfIBG3WIN0d7ORhh1eZJOZrasnlkAZEY JxX1K5BNkC1T8735pybv0lfoPq9DyOGI3LPFxnMIk9Al9S3UUCjX+uNHHyWZzdi7uPR5 unyDPdgjUhEgZ94/mluP0efaymX2oveoWtCUyifq5QQWczA5TtF0DvQCMfAV+r/DSBh5 KmJxI3HYLqjM3Z+QfPk54j2/m3ieLs7vOV6NJUIaSVOQdWqvzGYBE0X/X3CaO0/7/Nsk 41uFjULRQqoHCLRsQBNAGt0Srb7BSUCzI1bHZwl5hgk/xFGTQ6kUVbGkUssglcFh5k9G 3Q== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by mx0b-00069f02.pphosted.com with ESMTP id 3ew5y1rw2g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 20 Mar 2022 00:44:21 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.1.2/8.16.1.2) with SMTP id 22K0gu5u077988; Sun, 20 Mar 2022 00:44:20 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2174.outbound.protection.outlook.com [104.47.55.174]) by aserp3020.oracle.com with ESMTP id 3ew6yysr8w-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 20 Mar 2022 00:44:20 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BhsR58V9LzWxDpMiCQbtzdiPzOyEIeQAJR3Be3NE8klYIDiNhF6OnpA5vQ82jN3JKjjbenPsfmgQuqNcG6tE4TQKIzNhQOq6dlw9XjuW7gPdUNiiAFUrOgl2H33RINu9oL2HyoIg64qXqJURG4s9kUAgcSwxISPfI2q3pfJDZnWsKIIzSvwT+8Fx+DPVk1bXPUFvtMkfC/Z4EuuMONDNWTvQ8gAR8LEWvn71gO/JnLt2eLnY1y7Oyy5f0glGNC6u8jMap3XAVnbrdpTAXIoC+v5eftg5jWSXOYj7mECCqNqAfM5yXiIYHGHRjTjg7HtUgQrywTSpm0kPAmqQUs8c1Q== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=BVgLLFskMtHVRg73umRR8/sjE2XSRhYNfpgchOYL/f4=; b=h3yLUW36wuSRXcnGUxuRUyOs95PkfkEPDKXRow/F1gf4KP7nSdbLICXpjhibnjFoEjcL2ra5BB6GmFwzjeXdm/76F6f8eowp/j65ploqwhZ1OzTu68TpzoKnr5q+oeYOb2NirYVNXGQVehrG0VinRQRPazxEVrjbo6WWC9Q3Sr4S3Nh+M1umviR3YknFrgeNLYfeLpKooXYkzh58IaxRdXWNCbiJSjyv+Qe31SuCm9FsyuGY2seFg27gY08Nd6Uf2UmSM4ohx30cJkNt6Mf4Tqk3xvCcIlF1GCybzdr+Wc2uaR9mXGlaHfB3FM639KZmrK0U6pvHbXv2Hi6ivYcJYA== 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=BVgLLFskMtHVRg73umRR8/sjE2XSRhYNfpgchOYL/f4=; b=iSFlIjbvMZIL7KkLA3MV7baCW1+hCUV5tLC/7UFdiQ7qyR2LmK5Nb82AdNBDJJUUcuTbjcX0SCsvC92EAI7FLjoqpDwjTSp4FrkeNhyHLZm2JEg5eS999GCAi8F+QsSqqnRHuPxXqgw+P6787YjcrpQNtmMgNAY/OXrGGoLgX8w= Received: from CY4PR10MB1463.namprd10.prod.outlook.com (2603:10b6:903:2b::12) by CH2PR10MB3992.namprd10.prod.outlook.com (2603:10b6:610:9::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5081.17; Sun, 20 Mar 2022 00:44:19 +0000 Received: from CY4PR10MB1463.namprd10.prod.outlook.com ([fe80::78b1:38c1:cfb8:537f]) by CY4PR10MB1463.namprd10.prod.outlook.com ([fe80::78b1:38c1:cfb8:537f%11]) with mapi id 15.20.5081.022; Sun, 20 Mar 2022 00:44:19 +0000 From: Mike Christie To: lduncan@suse.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, jejb@linux.ibm.com Cc: Mike Christie Subject: [PATCH V2 12/12] scsi: iscsi: Fix race between recovery and task xmit. Date: Sat, 19 Mar 2022 19:44:02 -0500 Message-Id: <20220320004402.6707-13-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220320004402.6707-1-michael.christie@oracle.com> References: <20220320004402.6707-1-michael.christie@oracle.com> X-ClientProxiedBy: DM5PR18CA0065.namprd18.prod.outlook.com (2603:10b6:3:22::27) To CY4PR10MB1463.namprd10.prod.outlook.com (2603:10b6:903:2b::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 78daae3c-0c00-4707-5de0-08da0a0ac466 X-MS-TrafficTypeDiagnostic: CH2PR10MB3992:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: y3q0hcaxQoYTxlitbEFgfBMWZFAU75EDB+qOlTEFv3iTwNjpEhBEtRGDJjCgp2dHxcCbm72t6JnVAkkr4EeP4zGJ6Si7sAbcey4/hwV4jKKl8ZUZhCET4Qw8xaFiDmfm+TfSune5kpT2Jx/DZiQuJgKzxZyGSd7q3xk9HSh61XWi7RLxWxZQXUSzvDBUEqO1tUUCV9Xrlt2oA2jIGgUScN77hBjWWrevMVsL/6oKgLAs/eBCIZnoE3x90PzNxlTgU8rbFpI/HwN9uqfr55NSXenq5MFEAmFIQCNTFriwTdKdCWtuP/A4VjZZW+MeMeq3GIA1S03h1rigf/i1AOvqll+OXUyHcmnuB9dTSYOlKVNT7ghhadsdjSbms2HTa9ezBKd6+5SGz1zWiFHIVd1pP6E4O3/spp0GoFOMnvartDgM0lJmhH1L+JAvXJi3fm8xJV7KynOI6KF6/zuCzyLRat0xt1mOpVymwiKs1Elc90wKMKgDHl5sn0FGub76SDbiN/3wP8nUaW6BTZvf55DNA4Qhk3EgKaM/w3frxIV8weyNeBlK+aASl28Qdi1zMAMO9qJZ776ZyNuNj7EUK25KEj4JscF71jKWwonfMV+Cqq5TNiR45NYw+FTzbURqZEIcP6FlkQB6g856Y8fupe0ApK3wIW9vzlsxDF4KOLoG/4UrK9KlWC3kTBwnYv4HaH1Dvy9+kGYc/azfDLJO96ZYOA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY4PR10MB1463.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(508600001)(66946007)(66556008)(66476007)(4326008)(8676002)(86362001)(83380400001)(5660300002)(6486002)(6506007)(6512007)(6666004)(107886003)(36756003)(26005)(186003)(1076003)(2616005)(8936002)(316002)(2906002)(38100700002)(38350700002)(52116002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: wxizloiNKj6JpdmNo0p3lG6aIGWz33m3ZkYqbOFaNfJ/t2h23wugpNKwKAP5skwPo2HiUUFWuP976N7Sf01UffNGvYWbI8remndZ8NQcFcuo8eJVZOROWe8cGNX1IfdkBU1PdaNMm3uz3bnFdl3wtCIaB9+LSpW9/kLv8ME5hkpsJZbhanN58d71tGOunXPlp/N1bJGcw0o5k408xQqqtqEUkC0Hr7+5e4ulQNvKzpaBiRYAaGwYbqi/CgGOFXq0Gt3JVO1FV/ckgreETAZ7DyFuDxv3ZJutg5deEILn3tvztks7rNzAjFTPEPErccs4xyYeLcwr+Nn6sFG7tIblprWZhLpe+Ut9keSwA4DBa78o3ZqLoT46UIZoPPM7qYliDNMcAtZtHTjWeUzXm5HB1eDxPkxsnD01DHzWs33ZupcCqOwH6N3rYKIeCK5EfXDIbyf3FZwJMAh69l/IRGiKTDRNM/pYly/UAM4ddBydUzyCy21gK2BUalezq8BvVKxGKu95mktXwp2TpAIZpgA0TGCgIkU8Miwvxv6M0Fm1hiEvFEZ8ZMU+y2Mp62Y7vHjJmGFUTb9e5VnZ76Plv4j7og0kJNDZAB5Rk1u5MKVuEHeotHWIkRD/NpjEVRtihV7B7rfIEZFYt68fBs7caQ5z4ulgrzlO+Rpv52pkSNYY4tdjHAjn+m6SjgQkhNvQjGpe33hDIXyw9Fa4L7+PTtgqo6mnMOGQXAH0jQ7BOvr2q8V2juXrNhohpOdytMYpQ8KG7fwZWp1x/HFlZwLjOpj62KN1gzctc9EX6q0ZzU/RNNMAYQd1y0AjU+GoZ6ByNiOzqbWE5Gy7MYyXo5SXiu7X5ALPd9dsyolBVyemD7ialH31OpkFfGMIQ+q2qIz+Xe3wpQAPnsT+aasclrWkHDTDRmAgtie/zMXBBEpZj9i5x7h4IfQBEpuOEf3okfuJSNKst0ZCb+AQPH+ddaH8iBQZVU6ZtntEjDvMmpsHgIeB6mSNtd4Jmvucu/lGXOX7Sdhd6UaK49AusfnvWza1d5WG6O20vJ/JkOjStHAh8xMBEwuJy3U8Fw7TZX47MvFf/b6jHxX+63oN8FroOUZuuTkvbxWjR7NWZiUvcyVS2dJgoC8Z1tXG59vGJO1lKODt79NAzEw9LGwcaXng75Ql6+M45lYAyP3pQI4uyFXoFuhBf9tikdQuZ4tscXAHscg8QEl15J29dKBhUfKFibZH/8nnrPbg0vrL8tqkd8KMFO0RKeQrSpWsc8T0Uo5GAB1zrNCAX4mHPj5bPemei4hPEudyBI3GcOh6+27y2yNItzQhweveiot5M6jKZHP4tiMzHsSrrtLW3z1bqnFH4+x8/dWPFroafxihgP8a7drW9p26NVNh0BdAObuZhLLkoHUsQD4I22Rc2txhaI7KyDWsaGS0ha0Tn5gb2HKGeFtN+LZQUh225rIHsKs7s8saTBrVlzpnUw7diNwAxcAziLiAe9HDlg== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 78daae3c-0c00-4707-5de0-08da0a0ac466 X-MS-Exchange-CrossTenant-AuthSource: CY4PR10MB1463.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Mar 2022 00:44:18.9215 (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: hq3oJyEgTnWCkX2Fz9Goo85sICPTIKmPF0j3ZAbyCfq2hbdBytQO5eSkUZEcyWuFZEIYO6XgZT6/cdfCadCfYXRfh/AkXPXm+6T7ahcWnvs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR10MB3992 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10291 signatures=694221 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 spamscore=0 malwarescore=0 suspectscore=0 mlxlogscore=999 bulkscore=0 phishscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2203200003 X-Proofpoint-GUID: RGuosMKDL_n6K0dyp1q2Bzzd9p4Jr8-F X-Proofpoint-ORIG-GUID: RGuosMKDL_n6K0dyp1q2Bzzd9p4Jr8-F Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org set_bit doesn't provide a barrier, so we can hit race where we've called iscsi_suspend_tx and didn't see a work queued, and then a work is queued and run and doesn't see the suspend bit is set. We will then call into the driver when they might have already cleaned up their xmit related code. Reviewed-by: Lee Duncan Signed-off-by: Mike Christie --- drivers/scsi/libiscsi.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index a165d4d10cea..b79739b41b10 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c @@ -2020,10 +2020,14 @@ EXPORT_SYMBOL_GPL(iscsi_suspend_queue); */ void iscsi_suspend_tx(struct iscsi_conn *conn) { - struct Scsi_Host *shost = conn->session->host; + struct iscsi_session *session = conn->session; + struct Scsi_Host *shost = session->host; struct iscsi_host *ihost = shost_priv(shost); + spin_lock_bh(&session->frwd_lock); set_bit(ISCSI_CONN_FLAG_SUSPEND_TX, &conn->flags); + spin_unlock_bh(&session->frwd_lock); + if (ihost->workq) flush_work(&conn->xmitwork); }