From patchwork Tue Mar 8 00:27:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 550030 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 57C11C433EF for ; Tue, 8 Mar 2022 00:28:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234233AbiCHA3G (ORCPT ); Mon, 7 Mar 2022 19:29:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230303AbiCHA3F (ORCPT ); Mon, 7 Mar 2022 19:29:05 -0500 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C46625C6A for ; Mon, 7 Mar 2022 16:28:10 -0800 (PST) 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 227LLAiQ031932; Tue, 8 Mar 2022 00:28:03 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2021-07-09; bh=/aUaVSFW1sgk3Um1U/BACf35FQIvYysrPU++CR+h9OA=; b=ho8kILWQjwNPNEjjgM/UrTK2rBJItyAjYfzszBat5Twl5hqY8pexJQKGSdngG2D+tJxC O5MZyg8wOQzJh8KfjIqr0BGg+4TM7UDnAQhpU/fHXaHqG17jEUemkhBvAfwQsbRi8NP2 VxE/HWO8zoGtjNzsHGcbjXa04aihuzJZIPtdVdWdLzWyYRgnGn7XMI0gRR1NAyeaZ2FL DrmSldrvEwzg4D8LUxeOie6DbLsMBxY6tpAdFA4YfqMsx3ayBcsQ6qbTknODs6vOQTcl 5L3vP6zWM9hXWiEHQh/Rt1r88MDfzd6Ytr6MEFRxYng5Am44jIYbWjo5BcNJbr1EuGri Ww== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by mx0b-00069f02.pphosted.com with ESMTP id 3ekyranbuh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 08 Mar 2022 00:28:02 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.1.2/8.16.1.2) with SMTP id 2280AJ97134548; Tue, 8 Mar 2022 00:28:01 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2100.outbound.protection.outlook.com [104.47.55.100]) by userp3030.oracle.com with ESMTP id 3ekvyu3hrq-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 08 Mar 2022 00:28:01 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Kj1ucEijP+0FWYAoCEi2Xwm8iPrOu2DfgL8RYrbHDsaETEmsTQr2IRx2d1OXK1mdr3xjJNnn4y8kmK+25WOiDaWaSSpzLLCCbugnImiyVWpz45iabcNwtOPaa25lMah+7w9nbAbTGueN5adBYdiM1YuxQE/j3d0J0MwnTgEjIPzkgNIbmL0/A4fBCYr8wsQvbnoTHjjfHJai7gYl8JE52o/Hteg0OBMegAgP6zkWvFlRjl9Nvw7ykL3CdAR4lF8QroLKX2YahzXNSitmyT+4TuKbzOTQ/YrxeblIdgYcTvuUK7cYpZcegxr7Q1MaU1uFNSxBw4aWhpAL3+CxNilpNw== 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=/aUaVSFW1sgk3Um1U/BACf35FQIvYysrPU++CR+h9OA=; b=M0ljmxMiv6wU8fRwNMR6hiHUHBaleII+Q+Je4+HD6dCULyl3Hdw0n1zjxsPo7KO+jaOpRRs1NYHwlTJ9TW5wzWFWNsfuhvdzdlWr8GHJpCAbAn+5BtnJng2DURo2gjqoLg93lS65GEKorb2K7u7AfppTImLkz4DHGsFjN/5VXepYBMGv3mDLKfFGFlBtO/0xcGODmravVSKUHa+h2+mQdrFwW+rrCK9bFowvWqRy6NoKHkQK0JPBV2IePean9Vpxd8Nse977qXVV7V0CsvARdmOxbkwQyMygElg+p/+iOtqnGeZBNHzUUProkZ3iDVygYM4yxOJPfvXrmqoFLspm5g== 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=/aUaVSFW1sgk3Um1U/BACf35FQIvYysrPU++CR+h9OA=; b=FlcElwT/wo9XbbdboEa+REBokrNMBCAdPmRL7KV3pK+DNuCg4Tn+rLSE7GRsNC1tXs1RZaLbCoQkdEL0toQr9XrbmNFWUe1o44u5GkNyRuvDaobO7o2uZIOigCRQ4iJ8x/M8rJLNOO4LucNiZ/t0MB2qBqZyoRZs/ezH1zaIYCw= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by DM6PR10MB4361.namprd10.prod.outlook.com (2603:10b6:5:211::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.15; Tue, 8 Mar 2022 00:27:58 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::3dd8:6b8:e2e6:c3a2]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::3dd8:6b8:e2e6:c3a2%12]) with mapi id 15.20.5038.027; Tue, 8 Mar 2022 00:27:58 +0000 From: Mike Christie To: lduncan@suse.com, cleech@redhat.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, jejb@linux.ibm.com Cc: Mike Christie Subject: [PATCH 01/12] scsi: iscsi: Merge suspend fields Date: Mon, 7 Mar 2022 18:27:36 -0600 Message-Id: <20220308002747.122682-2-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220308002747.122682-1-michael.christie@oracle.com> References: <20220308002747.122682-1-michael.christie@oracle.com> X-ClientProxiedBy: DS7PR05CA0025.namprd05.prod.outlook.com (2603:10b6:5:3b9::30) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8a865575-a0fb-4206-01f8-08da009a7df5 X-MS-TrafficTypeDiagnostic: DM6PR10MB4361: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: qZiGv4aXjKHxQG6msQZGC3g0SjlTEvSYIPjRSbLEFxWbEAXdoHGi1rjx0Mlo/xknkHe7P2Zz5yYPNWn+qHhiogrE7nem4uPIJyTxKeM3ipaGqXBPgpgebk3pTDNhw0t7m0ZMGU+XknFUOfWrfvA0CjVkx16pxvhNqWkCFkJ/E37RrOEKrEkxMlcmDIZ5pg+52j5DrR+9j/7g4jAPnIWsK7UNfHLatphcD5HnhZYMi1CWqhmsvqKoHoDopiyMKMg49AZoHjpWqVwIPALkkQgIWJqi01EqmV9WOdeMSvZOon8epbktJf/Lr+uWiMcy73/nqQyeyBMIoiY7oN+e+YCGVOW3dQT3I1FeQn+PZLfl/xMkPm7WSsItNVQpy9dbORjn3c902KtLH67P2jxBpR56QVNNUc2lJDZgBG0TGDBi96BBqlgApgWGmP/G2nI3bPio4PfNyxSvqGmzaOrLr86Do0b/NfUfgd6/sKE3fmcuDsdWANZCJfSw32UXbJOYU14mivCP1q3YxNUJsop6VPmxx/ozgRAGR+vm+M1eJ4ArMFQwcY/CDntZzf3SfI6+TrJMwYJ1IUxa+VArezObONya0DXs1WPdpkI4lvH6lfonrkx+y+cK0T1KP1pF8Zp0xMHZTtqEr5AuYuSH4x2d0Ht0hq/lCUW823Gc4Cp6xNehucFJP8zTs54cJo3pcu/R/g/4N6zsLoS0u2iqsT+cL6b3yQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(26005)(508600001)(6666004)(107886003)(1076003)(186003)(52116002)(86362001)(6486002)(6512007)(83380400001)(6506007)(2616005)(8936002)(5660300002)(38100700002)(66946007)(8676002)(4326008)(66556008)(66476007)(36756003)(15650500001)(2906002)(38350700002)(316002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: hZ+9dY0kl0MGSwWH6DpA0NpOd/lM+6xAJkkZs9gitYWClh3AmDhA37ju4huJH1L/agsx4ngwFYaKojPkqTVDpMONWJGzPJU8wQruPzEBeTvAPvBCIzPzHwBO7yGeHIBOHg784JAABtcfrIhaKV/JQEoo0qBW74Vdye/Kh+hlcolOsbE5kaF217uhE5a72thu3yV/RtLwzv7WrL09GQt5ci1wvWik8hmcaD7mw2PPW+fg1e3nWLTIh/Y5vA2XoWvrIFEaFt4+kFReIGbx1ADereESMrYz71pfxoa5lIQtBX6hzpNNhlnYYSF1R09AmRp1m2r6GkghI2PAMs0k6LlJj5lzrvCiVXuypBAqOxPsagM/aB84MmTs2uunkhptF4pO8qeW/B2sTh1sCXSXvaAP2fN9sEjWLDLzKp+TANjX5t27b0fQq/dycqquP/MNZZHqThb8VkPeVk8DPkI0XSl7D19V05t8I2MHu197cRp/d3iaHmvb7Ije6wCsLhOvLc11PeTgg5gWgruvhTUL3ewHZOS7dG5vcapjG77WjrdDgJvYA/AXWElqHBEV2MDjcfV8iaIjTWOxJ2W1xV8b+/X4aXd5NImqDnHR6pTCOb0X/qWo/olLtuWg7T1Ajc+DMJA4DyOIq+B8oHxyK6vAXa2TBDq2UYlhBeYUIm9I4l5dqm18zxdGVSgkuH1vfxp2d+VgKOtMJun8SJnHTjaW1K11We/BpL0JF7JFNoYIT6RL4BbTWjc9NrpLczPYfgA1rBGHokyjxYbdHfaTLNjJXw3bSXJU/usgZOCFWYMd0e4o0wZjG+ffe5kH0zXyAv3ybLVZP4MI1/WEBYzivinb9zfyC0TMODZXnPaqZSiXwU7Hi9ICBG+bpJKsWw2YcdHS5jSUW8W9RHE15ghaOgWDzr7mH7wdPpkHlje4knCDOL9M+IGu6kyFW5Bdgz10sH9MUbnkffAr/96nWrCcsf1tjIFxFMQs0PiXl6lWy9a4k0ADa3nTi6yDU7ly9ZZvH15jUzyzR0pmHhRmHDT6l+pUHjZk6TZYxEDLuWDKYpqUqAa9co0eDGBS8MFsBHViJ8SeRXp2Ra/OjNST9FAIu/xBs7zgNT6mLyXnm5ud4QLiZZ7EgZZD3q9iCfqouW6ic6iWngz65DQNvCUcACRPyu1Kg2nBlZ4j2n6HNdAXf2W2zU3Oap+e82LKy5BDxQZOkJqO+lMp4v1ugBoCCdd5OzPYUaNhwfQ/LDj/qRX0BBjozjJgOP4GSm0RsO1pP6OeUvQWpC8dwpXRM9nXq0i5pYCEwevQH29EIRfDmKMsbTOApqSrPpOYq/2lxVjhIFGf6xoOkcCgPQVZYd4NvDAueBgeSa4uJEmb5/8kXLXUW7iM0qna6vWj/fzoTdR6oIQx101go/zWkxgnykydYhQ4PICgSSxSudBeQecUdAac0RzhVpP+Xk6wr9aoQg4bwq+07Xsq6QrsXoA/BVi+5tXsgRg/pfu6+0zUrKsA2rEFrCjIKRWkoQDdOMhUMgMWdZNbbyC0pUUfrAKFQb+UHRxoVrnmz6UvU2e31N3ACwiqFjBRMLHmGxPqGe9nFMjjKGWw62LZ5HO141TZ98iV/LcOcAt03BlLmBWsxMqIn6L5MR7YMinHK7TJjzb86E3JCPUJo+qPXOahlb/iCcPCRr1sxG4TUfDkUA== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8a865575-a0fb-4206-01f8-08da009a7df5 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Mar 2022 00:27:56.5768 (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: Lzm5zYBI1LGMVT0PYoLGZJJEWFedDjvaugKhg5VcBJLuMyCdbMJpLwYsVUfjavvJmQHFd0g21eZUf0OAHGHF//KZFANhMTUSb2F9YzJRug8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB4361 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10279 signatures=690470 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxscore=0 suspectscore=0 bulkscore=0 mlxlogscore=999 adultscore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2203070121 X-Proofpoint-GUID: XfZCml9KL9_7KQWHOlSJPmw5_Q6fABf- X-Proofpoint-ORIG-GUID: XfZCml9KL9_7KQWHOlSJPmw5_Q6fABf- Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Move the tx and rx suspend fields into one flags field. 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 Tue Mar 8 00:27:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 550029 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 5E004C4332F for ; Tue, 8 Mar 2022 00:28:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238128AbiCHA3J (ORCPT ); Mon, 7 Mar 2022 19:29:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230330AbiCHA3F (ORCPT ); Mon, 7 Mar 2022 19:29:05 -0500 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F54125E9B for ; Mon, 7 Mar 2022 16:28:10 -0800 (PST) Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 227L49J6010008; Tue, 8 Mar 2022 00:28:03 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2021-07-09; bh=i3xIIMn4Yqf3FEI1YcW1laUcT1gaR6iT6BiDU3xdIc8=; b=LPUQIZTdKJPmyuXwTyV9XNV69r7PFg6gRkiGXchpayhoUF0PuCOjLLnUSqxYBH7jOD2v TzlFITPWS88KnldglVsq/H9AHrpWiR1mrJjlU2EP6feED0yixZRhSx7O0h4NQp8uudRY jsuPNeya33yWhRvmO/ttPCDgez6s5VVO2Nq/pgYvicXo01dp5QoZ0gb8bFqMf6As4fN2 b+Q1dQbKIvs61xB8OAnK5S7oy5HrPOimMPWTRldTp224dUK7zclKQYfoVF3na9vNhGCZ V0borp6/NV2l5Ixw/GTeZwc4Q5Sel55W2N13eKQHlP5FSMCiYNNlbWd1R85bpddA9HA5 7A== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by mx0b-00069f02.pphosted.com with ESMTP id 3em0dtwjmk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 08 Mar 2022 00:28:03 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.1.2/8.16.1.2) with SMTP id 2280AJ98134548; Tue, 8 Mar 2022 00:28:02 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2100.outbound.protection.outlook.com [104.47.55.100]) by userp3030.oracle.com with ESMTP id 3ekvyu3hrq-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 08 Mar 2022 00:28:02 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dl2MG2rIQAuNHc7146ik5ur7GNunzUdENjnJ0joOu+VOf7HYUU1m5fUbDu/94qDsTEt0ap31x29fuzM9MqrzRuE76T3/R6Wx1jukzme78FzkLW+sb5n+A9a5XS6Ga2nBXlBa9RVGqpBmfisBlC+BD19cL/Bu1HW/vgizM1DdzteFoYThstTTh+wSpk4xPyfBKstLj5FkwL3thC2Ml5DTVIEeeXkAp1ivvMNuza5jc8hC/ypSjFGPT48naue59gG8O1y5kofD2sMHIir4WALTX0RCPdBGp7YeltkaewEmoCVo+oQey+r6vmE00AjPd98S5tSsmuDgHAuXt9bUFTEEGg== 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=i3xIIMn4Yqf3FEI1YcW1laUcT1gaR6iT6BiDU3xdIc8=; b=OC9e2Vvc/hl0mB1zSYDgd3VC7PRGm6Pd5FnWTSyBDASsPaLIFMR4sm2prrVFivrMVf4UtRzZpiMvffaJ6ik+T9heqetcmWTGld0+j0s5xHxqQshTvwUCp9prC+X/ForIIRCVGYOVFWoAA7aGCgNEBJZhUvjh94GawilpyQp26NDjuTa22QZ7QsThxUhHFf66ZieAL+LzlF9qwpav3RyF0zecVGchd2jIm2W4mqUqEQilfLv8Hr4c+EQ1rgYHg8h31jnvTkqymUxG7wB5MLFivycF/YpSOXpJpwVoWXJEbglP+Od6+xciSG38Hq4a1aUQ9XorofyZDzsjASlDvA2iQg== 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=i3xIIMn4Yqf3FEI1YcW1laUcT1gaR6iT6BiDU3xdIc8=; b=jFNipJmv79YmkbGUeywih9AHv4EGdq8loZmMjxdGyQZclF/RQtpdOTHyJksVjsfHnQWFVF5ZwtgeEivq7FvWxhK9vM4mg4K2vYVYyRyzKGhB+bInWi0jL4QziAVTcTCBhYSSqvo3FeFXZ1EBX4CftKjlBAU92lNYMfWF9bMZQW0= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by DM6PR10MB4361.namprd10.prod.outlook.com (2603:10b6:5:211::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.15; Tue, 8 Mar 2022 00:27:58 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::3dd8:6b8:e2e6:c3a2]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::3dd8:6b8:e2e6:c3a2%12]) with mapi id 15.20.5038.027; Tue, 8 Mar 2022 00:27:58 +0000 From: Mike Christie To: lduncan@suse.com, cleech@redhat.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, jejb@linux.ibm.com Cc: Mike Christie Subject: [PATCH 02/12] scsi: iscsi: Rename iscsi_conn_queue_work Date: Mon, 7 Mar 2022 18:27:37 -0600 Message-Id: <20220308002747.122682-3-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220308002747.122682-1-michael.christie@oracle.com> References: <20220308002747.122682-1-michael.christie@oracle.com> X-ClientProxiedBy: DS7PR05CA0025.namprd05.prod.outlook.com (2603:10b6:5:3b9::30) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c90b5157-9663-47f8-6184-08da009a7e35 X-MS-TrafficTypeDiagnostic: DM6PR10MB4361: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: qDN7COfC3qvtSA5TweaTTiGABdX895hFMhOS2VaYY3DDWG0DeeaCywtKAEqhu6jXkMYWy+Mc+cw03qUe0Sdyv2m+4ad5vpkKy/RnYH4iDa/TBel/GFQOzp3NCzQvAOnn6iemwRxzPrIq2eL/BwC6XPUJNk4vYGnkSkdgcKPi6UyTu3qt+KSW1G/hT+I+KOMHsc4ZnKJtqKQDpGrJhnwvqohuqeJDqhdS5kUjT/WDQ4f7W6OkKjpnunFks6V0O7CLofDHd9cyhZ5Ih8vAtbwxtd8DiHBNCj6bXHKS0isdoRNkNa8ABDbcBJzD/lNO3leLvZrCquPjP6Bf0P8CWPhSHwi9NJWXDrG6wsCx8wBjMe3amwNf4crHgNXspEaBM93qenUbojgYWZnTtRAI86rJWkqPK79GBiTMtJGLMkXKOppAEk7bmJPKLJH1FikEc6qWLr7z7qQ4zDh4m9KMpdsbPFPTiUsRnJ60p87qnu2Elxrjd0JUZoCpvZZvss2KBqvJehlnn0oGDLPxPl5Aa1I5LUbf808Shi5+mKEQad3v2PU7segkciAt++AJLCya9v4wzKC4inJka4mf/ORVR5pYUkc2816wiAhFC8gZZdvbg0GHEqgpP/Cr+w+ELBMq9rlb8oYcVSgIO8g64ZwOzUdEm6p305EWDfijteFkcWpdHSO5XBnJQjtmJwulVxQ57+2a6y9gN0TRiYjbcaOQAd9Vqw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(26005)(508600001)(6666004)(107886003)(1076003)(186003)(52116002)(86362001)(6486002)(6512007)(83380400001)(6506007)(2616005)(8936002)(5660300002)(38100700002)(66946007)(8676002)(4326008)(66556008)(66476007)(36756003)(2906002)(38350700002)(316002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: eEwf3DmqiyUN1bSkBF9hbnC7vP8kkZcqpC+uWZS02FCGqCZMkM9vnd6pTrk9Shqcs7tdyZRss1WzkLc05HCvNY+zo+Qc3sli9OyY8NfRZKt+8F9uTbY7rKGQOWhMx63BestuQxxMvQlB88xIQ/LAVSaGsDxzC/V4Pm8d4bkjvWdaQIC1N+8xIUuicjYrByg8jinYbJTyw3UnAC13AAEKhogO/Y5EyJPPdi8BBojDSZSupjWXPg4gOYnef+iuUCA+PLjzowTfLKLUAGChyD7ADxxYekj9zDx26q23ucL125uTteuhCnuWejurcClo70GtD4okCRihBL7TQgmM6UGJLaMcLuznwlfQaHmg/UTotFmUXqfLMq6/W9IqD5u/07+9vQqXm+uLCWVV8+8NwpEjCs7jD20SHJNusNOgAAsilvC2/DC/KeVODworL9aN1Q+Pna8w3JCK+gw+ZK56XZPXejjy6TRzavztwYBRZS6Z3BuwktJcU8p0OEStRTT4xsY8VwO4efNBXQ+BRiXc/4jGwlEuFfudxQAZMJAL4MZ5SFaV2vOplpriaftZuAp/wIa6l6NSPNXsaPPv8+szjl8IHBQY0WRJ9J2uetWO/TWGfZKIedpGYxryn28fsOlxeC3kaZC2NJ4QExMR7U8+4528SIvK+hq4t4/b9jcx0iu6nEA25njLnYySw6EKkv4PMN+n/Ob+gBOPMazNWDMe+j1/sJS9urMmfyVLFCf4pNIKTpNn+jStbx0/Kv+Qf9jsrTG1rBwBHEvdQ6Cdb4m+JZguoEf1kzLO6yw5oEAGjAiKyjPPtkUGyyFmOJh8vorrt609oyUaKA8XG9fc1yPas1ax7jSUkrUEkFpcbXpmyB+2v0HxM9se8LbWgqzoULCE7jF5KePJ67vNo2UjdxjGsz4XOqmw2qmGUeB50ZTdWpn2QaErtu59VFj011AhfokYmcNtL86QgH3K3pvrmn1y7hfJB5zuLmEGDeqCWf1wDA7RlvgbI1C9YBzLNG2X3cFBk6E6rBjGQSCFbTCQWeB4ryM+vc0B4Z2TTVoO1Qx/O3VwXDC1g6LmqS4Ol3v/0PHGAoOHgzDgsPqAPKvwvLX74AkX74cygrpRAebMjeA/WvVGJ/6t3EP9ntGFALuvA2X4CdKtarWbVvdPojqII8eiMOAcNjdvixQxp6pE2Q7XKbinpgmidbtBEr9rjoRQQFuUSeVk7lTng+s+2iOutIXFlurFDBOAwHWPCACOZ0mNoZNeI2okmdNDfkj56jccCXyErvywabcPm00QpIKCVcHfWyPwRAWQmMSlsF9QzBlaMhMp1UVJID7tsDnRVLRNpO41hRsp/IXxzRDEvWDFVOZ6rVyWwFIgTLr9u2D+IylLBP8XGhAkD39G07X0KbWPuXSeFnbZK2+mN1oMPMoLQ9bETDDBagSMuLNON7crhK4fiIrKRDsaawBFWHMOBJJw5kEM1X+iH6K5+RaifLed/zWPcHuwTXLDrLDNKaPerTDXiB/nYIv4j3pDxEZp2oWI2LwX+7feRcztTto1B1psml4nmME9VCGV0OWrfD58D+JVlLF+di01QQjSgY7HGsKRioOw/YAOczj0t2yhnbWnxDcfHFOfPnCZgiDYnzzhs8mNTYLQhPhTnhYJn/Z1PGB/yW+1dkb3ZwesyUFexapFPTm1BslI+A== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: c90b5157-9663-47f8-6184-08da009a7e35 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Mar 2022 00:27:56.9831 (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: 4EQ4oEpS42W/y88xdT6soDorutitvQpmFagxNEEFiSy78EvWvSQxGcCpgXmf7d2zIvokpzJ3yfVdSsN1mjfoiQy2lA/Oh+UdzWBseOufEGk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB4361 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10279 signatures=690470 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxscore=0 suspectscore=0 bulkscore=0 mlxlogscore=999 adultscore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2203070121 X-Proofpoint-ORIG-GUID: 2G8iIU4K2qLMWsMbWVTkQV7M_66CQOoY X-Proofpoint-GUID: 2G8iIU4K2qLMWsMbWVTkQV7M_66CQOoY 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. Signed-off-by: Mike Christie Reviewed-by: Wu Bo --- 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 Tue Mar 8 00:27:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 549630 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 0040CC433F5 for ; Tue, 8 Mar 2022 00:28:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237481AbiCHA3I (ORCPT ); Mon, 7 Mar 2022 19:29:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59572 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230194AbiCHA3F (ORCPT ); Mon, 7 Mar 2022 19:29:05 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2F02D220F1 for ; Mon, 7 Mar 2022 16:28:09 -0800 (PST) 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 227L6s6d028218; Tue, 8 Mar 2022 00:28:04 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2021-07-09; bh=N4jkZysATB+z7KttZcm/s5CN+lZxxRYfe+fqa9hAyOY=; b=wzXfUn6VYMoC7VsApQo0/3g97DahD79vdhjD+yzsBN9asu5Z+8FsJMHlsZa1qVcrlaP3 i4xL6rVV6GNeu2Of5VtI9Pg53vk6BoFmrWwq7ScX0/nM8ELVHhc4xGWV2nAHb6fj5uqh Eud1gpwtwDF2yRJL268EME5rRL3T0yqQebQIOr/CUhM98TDTAZwvckksHnPrxJvfwPQY aTW27tuOgy4gg7BtUgf8SWsLhalp+cZuh4brgvMvQ8KX35dKcA9p1iKqCxZTxOX1FKtn uDsMPs1FzrTWxK97RlFpBUaR+PQHH7rMSLHmyHCK1hNW3w+KU2KdYtvxc5nPfy0VuI0T dg== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by mx0b-00069f02.pphosted.com with ESMTP id 3ekxn2dk4e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 08 Mar 2022 00:28:04 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.1.2/8.16.1.2) with SMTP id 2280AJ99134548; Tue, 8 Mar 2022 00:28:03 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2100.outbound.protection.outlook.com [104.47.55.100]) by userp3030.oracle.com with ESMTP id 3ekvyu3hrq-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 08 Mar 2022 00:28:02 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CWmSjiuigDas7SadKChQdDVYRhcZp3ewWOmem/6keYrPVHJIlG89E61nR2ULhOL3N2O7GZeweXZUQOQxkAekwznXyokJ2A3uF6tV3gvwe9/IwBdu/ffcJxKNpvQq/mkS+GOJNzzbzTDSOfGQmsHIah+dIKlwASH6dMSXliGZm0XFQ26s27jaZ4cxj8x/Mul2APM5dIUsbmCwSsY5BopgaEbBZ6sz6P0Kmhq6O0JfsAN37VIMrhbBsjJiVRuVFn+QViRU95i0JqJ6sOMJVGE7lYl85AcB5xfnGPivi8DN6rHZkkbQ9LfL5jBsjWZ9TPYa7mNfpGVumHSF9lTaSs0KOg== 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=N4jkZysATB+z7KttZcm/s5CN+lZxxRYfe+fqa9hAyOY=; b=OVrFXRm6zndoFT9ShgqGhDQSJenvHNXyS1/Al09syEItPl1d+PqXTtEyUh5H/UOAnbzGbzl/MZRRbDygJQRnWkkbM9ybIsjpNuYgh94Tzl7pB2/zi1YULuHgo+Gx4APxtldZwixjUHez7+4+xkpcOT3QTDgehfDPjvkru3RWxxZOFO7TEH0PVgDpPhnze6NTWKJrftpOzCTztzUNTYOWhi12aYIesRcxZ4xCPQXskQcOzfkcsyRB2KO2JV+TXWzGNjnIKAHy+7387YxA9QTHzxbhZMKheLdk3WivBYXUqnzKsEN4Q0ctUjAO9nkwN33qbdla05+gWvruaYd3XCvCUA== 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=N4jkZysATB+z7KttZcm/s5CN+lZxxRYfe+fqa9hAyOY=; b=0NX1w8oV5QQoQuaDw5Gyo5WILhcb9M7b7YdtGKKrfnqHk/aJXmuNpFEj7/2LILN0lAX3krdBK++OrfVx+uAdVcK5htQcxLYqzBVzGjUIT5ypqX3T19qB3I2hHCmfRmryTvAlD+f2SEk6N0uIas32EqDQvjNteqeWT0rnBYYa/lc= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by DM6PR10MB4361.namprd10.prod.outlook.com (2603:10b6:5:211::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.15; Tue, 8 Mar 2022 00:27:58 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::3dd8:6b8:e2e6:c3a2]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::3dd8:6b8:e2e6:c3a2%12]) with mapi id 15.20.5038.027; Tue, 8 Mar 2022 00:27:58 +0000 From: Mike Christie To: lduncan@suse.com, cleech@redhat.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, jejb@linux.ibm.com Cc: Mike Christie Subject: [PATCH 03/12] scsi: iscsi: Add recv workqueue helpers Date: Mon, 7 Mar 2022 18:27:38 -0600 Message-Id: <20220308002747.122682-4-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220308002747.122682-1-michael.christie@oracle.com> References: <20220308002747.122682-1-michael.christie@oracle.com> X-ClientProxiedBy: DS7PR05CA0025.namprd05.prod.outlook.com (2603:10b6:5:3b9::30) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a1621242-c547-489d-c105-08da009a7e75 X-MS-TrafficTypeDiagnostic: DM6PR10MB4361: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: kwZ63laozjbjsMQB+KQfnJxPShEyr8X/T3RqxUN6LU3+iBdrgTIZVeupJr9XYURUm0vamTN5Dt7jv2k0UkAcchjGeM9uhnirDkiskLcGc7fKPBdmU3b+/L37LOQrKfvbEoM5NtvvGLIDd/iX7Z8PznQdrEJRQs1bvnbfQK0f/B8dg3jLVCUAkUpaibdJZ//qlH2wcjYo38TQCokGgRzB7EZm7e8zk3/SWLO53FVDlAC24VtVLQZRW6VvKOZ8QzOq1PIwZexXrokI/oxX4AHx2Yzqmb/KBKo6Qi6BRM6cOyfhzsMvxLdijTgpeeN4mNjp1NJoMEb+VQqDeID7UD2KBVt3/j2z4ZFymwvzoyLXfpMFaRT29tT/DlpurrOYRdoZ9HeSJfhJichIgvCrda+e5l6N0zbBnvo/KVkU817Y2KUo+lVZlEAPdPp9/Rppfgehj0kWWToLQ6M+xGA4ItlWjbBC4+R2y0WhqHKH2JiO8o/tuiHx3K1OxYshb8PM1deBujP2tY+joKqvq2gq4TuBCcqh3kFuW3DtRntWUrPTh+IWaoA6CdRHjhMa91Nb86YTcJpN6coxjTkHRr22FtgkG+zj//5wWApUKl67AlkGlp9xieHpSPpvAb1veSXlONqVTUk0DIkJ3/akOI1sAH95K4i4kmzimUcff/PxfcpOUgP1m3rocYen/ddIJltHl3Ahow+IQNZLnOkaXKaX86hgeQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(26005)(508600001)(6666004)(107886003)(1076003)(186003)(52116002)(86362001)(6486002)(6512007)(83380400001)(6506007)(2616005)(8936002)(5660300002)(38100700002)(66946007)(8676002)(4326008)(66556008)(66476007)(36756003)(2906002)(38350700002)(316002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: EZi5U/3LbHVcQCDQWLgAwepHkzHmoQjFCHbeK44nTiYe9xThZSlOPp0Lyw0a6aEfgt5TrXu/BjmAw/dAOOjDqgfPrs+kaeQvNJBQGDA/YO9TDzXWeucN+ae+5TXAX1a3Cd5dbo68BDUPgra+AP1XqlzM0+9+dkN8+EP+gdu1EWFtRsq9+EKx5VpQRnXitnGOjJTSCdF7AA4lWdKHrjdQcrZMjOF8TwtztGf7oo7GXfxce9EwnHPtZpr2Q7rjrbxei7mn9tLSMhjYG49BQrrkwjGtMPS8S0D/snr37tP37xh8QR7+w68/nr079fK1NOym1QpvW117dbkRHDU1NqPBsODJXEYcoZQcgjxLqWiZN5iRFjY3g8btYwYBsrZBDXv7A+N1w/otjSiMI/Pn1yGKDvrQ2ditnUJM5MJSC4zoAirzc8b6RQ8FkNLUsg/B+AFcLzEhvz6u0tabx9TusfMYaVS4DU507D1V5i5j9KQEuQ6liyNGJxPWO10yZfwNIZO/FlPJYHo2vdKKXDliiKN9ZRQPNYKJfZ+aH5Pn2mcLGDsKZRTqsjcE8i9GBDX28oxk0JFVkv53t6AuZCSWMEUY+k/cPdKIWSRo9NimUR4OTzKQC0NUaTiM9QLRFBwlPi+Gxrv1U0la5ICtQKIMiW1dOHYgH4JifOY9AYPKtzlNPWDahFWnI7X3B0yfEUKZHR43R3KWuuOvMHqUwDA8FJfghNY7ZVNh3F5bMAbbOjTkoecTK1U43JKHfpSP6YQ6lt90dcf/8etLD69u6CDHdWkEJD8DMSLepl75PzdnGwskHZmuxV0FsgcE6LjyDw+FcChguhKJ2aZtbBJhnI8qwVzTCUpJkBomap83f12uGeCYjHmV8YUSKrNQnmjZ5+h2XpjTn10HrinHIzb6tOo+w1zL05k8Qo6rRTUn1QpluqByaQNhpPL+wNYStH0odPCBZHwvD6+yXQEHukh3nXrqadSzdyHbpWnC9FY0j4T3rWhM2X1z43bQvmaHt8wSkb8PX3jA/BLdnrxWjAvyt7TcOrou+Kf8mMlvlGBBHcNjotfOWlSGJmkZiAirXl9gwrxKh2eqni7KfJuvpDrgQL7Ftk3G7PY+fzl04c+J1+2i9qD1HnzoAQ6tIRcc0MR2U646CvmISfbS19n/CjLV8zXITbPWPYH83J0rltGngTm6woc4NBqyt6g1i1lnMKfJUAnPS2ckGSaF6+YK3XC3SPWC51b2fyLU+gBo0c/CwcdpN6l1ZWOicMtprEXS6je6S3gbZvJk2IV2eGDbrvLgnQXLGJymBiT1ShsJeOsW++oX3mzP1DCTzQVyKUjN72xQ+LpnXm4vFUCzV6Z45EownsU1Buf5yXlSPUeTB/VN7rnivpMAS/dkoI0vBrkgZE2+pg5QkEjuHZlNvcHvfT8Lz/KmQeUhSPwBW8sSvhUXNdCurc6pl/rbM6yUMy8PZfn4G869SkRGZuyODsimFi3fxSkgoFIs3PJNR6FJsgy2c+KKqy6MMQqRHZqgxunrXNi287Jd610iSfn2EAH0ems4AB3oGi01OTe9h8/88dfaYxOOMorG6VB3/SHggCRwpL1g5bmnyDwqQ7hAY95nU5FssUJKT2myS7b5HErihwDOKfh5GcmOiIbP0SPc3fQJ6dOswBuEvJrmolgX6wjb8POGjBeymI2N8w== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: a1621242-c547-489d-c105-08da009a7e75 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Mar 2022 00:27:57.3893 (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: WnWSC6fubL2tLlHlI8T65YfxGYY+fnvu6dTcXihqUFlTaSyxOlnGY1HxLQ93PIAk8ejTV/lJfm9Nd+hwTfdgKwjMKBUgjAXAxndRNlPT6Sg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB4361 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10279 signatures=690470 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxscore=0 suspectscore=0 bulkscore=0 mlxlogscore=999 adultscore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2203070121 X-Proofpoint-ORIG-GUID: DLvzGtXneHk-heXcui-sj9dQ_f2ZG_E9 X-Proofpoint-GUID: DLvzGtXneHk-heXcui-sj9dQ_f2ZG_E9 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. Signed-off-by: Mike Christie Reviewed-by: Lee Duncan --- 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 Tue Mar 8 00:27:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 550027 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 75C4FC433F5 for ; Tue, 8 Mar 2022 00:28:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243562AbiCHA3Q (ORCPT ); Mon, 7 Mar 2022 19:29:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236712AbiCHA3H (ORCPT ); Mon, 7 Mar 2022 19:29:07 -0500 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE69C2612F for ; Mon, 7 Mar 2022 16:28:12 -0800 (PST) Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 227L3BB9010003; Tue, 8 Mar 2022 00:28:05 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2021-07-09; bh=HZBNKRckkxaCHgdQBskpAVHvKijhUBr0XO7fEsPyfVI=; b=EZWaFKfo9g36YJMfhHl5g8REO9pjP+cNKRwdu93lDn/DcTVurWp+KbEZxKywhfrPnK+3 1Kn20JMLMajFZ2LZZVe64gBUMmbtFCNdVy/dL1pMH+ilQ2IEYpnY2a5NsTE8L1q6mDyT MSPGifNWuEv06o9sYJPETFCe1WlCPKEvRq8/5QnbFwceQQec7l7h5laiEPjQR9feOpLD 5Z1LYmh7R4I30b3161p5P4WojPY/A8aJrbfIO0Oykiq34SAXzdGbgitmwXA3bX3lmP+M vG/oP/IRyY4eR1epNSxIEubIfMcolUZZaWNp6hdR9ag/CwoE2JiKUCE0ATjZKq0gIPQe 0w== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by mx0b-00069f02.pphosted.com with ESMTP id 3em0dtwjmp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 08 Mar 2022 00:28:05 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.1.2/8.16.1.2) with SMTP id 2280AJ9B134548; Tue, 8 Mar 2022 00:28:03 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2100.outbound.protection.outlook.com [104.47.55.100]) by userp3030.oracle.com with ESMTP id 3ekvyu3hrq-5 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 08 Mar 2022 00:28:03 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RaB/3jPQlTOahBHqQ6J3ACzTHKO94ODBBhCAUcNlg9UXkHG0UhSTORotNHxkz62/QKzIUq02devnPytRy6iCwgG2PUNaUwVpff6E+qLsGnCH0glnAzChty/NF35tiOHDs55hwSSuhRkLrS3tRXlrmnGlfqLCjMLd/YAdm+ywnNHGaGBk4GV/FjAUBelgSnIDsaJw3CvN4AiQjz66QoYnUqQHWE0xPyAMJvzBX4Y6HcE19V6MmILE7xosWU2BbdqtjrYvmNpT0raiAUy6gQVHYTmtcOZOUOsPc1Aei0QmIW5vy0/PP19iF5ImkmiF8Qcbntfe2opK4iyFlF9PgmRTzg== 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=HZBNKRckkxaCHgdQBskpAVHvKijhUBr0XO7fEsPyfVI=; b=P8KAVZQVTha6lifk9tcVtgF3YQzxjPdoZQYccMJosasP1DANy6rSCQDe9biMtAUyHF2trf86vnJ+hfZBOYNJeaHCYn7/rCn+VW+uvCvYruF0jdiDndZuDTlTf6vfQNGx3m8aJF99j96783r38iQ2c1N05fsaDRPP4uLjX+WtmRIjtem+NnWTLL91ZNzQIgcuBPcwqAqwq0J8VACfIrW6KyXdymp/vFACRYJbpObAmFfukUDq1dHTaizsa8CFX7r6XeUwnnDDZwa49G4jPS627fzpW87aHWwC/SndhSEO+05K48hlebsCBUhLGtKSw5u5uj070AinIyj3sxrhiY8q7Q== 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=HZBNKRckkxaCHgdQBskpAVHvKijhUBr0XO7fEsPyfVI=; b=u4szMxumjCt+om+EAJBISdqGm1YurpUJ45lPnvtn6gtblONIBMSvYy6a3MlvaBg3Htw9IP2kyRD8h/0fD+cFMASVCGf+a4uVsbmbcCd6Ga35kE+axZNEPm9BNQBo1rvqJmqtYIkHqOatOQufBrFWkgekBVBGdKUpqRK+PxjiPr8= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by DM6PR10MB4361.namprd10.prod.outlook.com (2603:10b6:5:211::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.15; Tue, 8 Mar 2022 00:27:59 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::3dd8:6b8:e2e6:c3a2]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::3dd8:6b8:e2e6:c3a2%12]) with mapi id 15.20.5038.027; Tue, 8 Mar 2022 00:27:58 +0000 From: Mike Christie To: lduncan@suse.com, cleech@redhat.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, jejb@linux.ibm.com Cc: Mike Christie Subject: [PATCH 04/12] scsi: iscsi: Allow a recv and xmit work to run Date: Mon, 7 Mar 2022 18:27:39 -0600 Message-Id: <20220308002747.122682-5-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220308002747.122682-1-michael.christie@oracle.com> References: <20220308002747.122682-1-michael.christie@oracle.com> X-ClientProxiedBy: DS7PR05CA0025.namprd05.prod.outlook.com (2603:10b6:5:3b9::30) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 05ef9daf-c58e-4630-f969-08da009a7eae X-MS-TrafficTypeDiagnostic: DM6PR10MB4361: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: SpALv+uqth3Tf5+4K5m4YEQ30RXTJlSfzXI1BeN54Sd31/y8BmdxfJDs2aqS5bf9hJ00q56iLBrKfGNO0uqi3U5JRBtYHfhsa9uYPs3uXD5Vs34G+FQEzujaqVaE4ExEp71raV8buuL5nnrwPQDZ8yBbrxY3qDo5tFUg+DdroByq4nt73D5XxtSPT6sjAKbOIPOVbdGspF3ZXBnSjfibc2DNtAlowsfqgAyOfKQ2CECMpMnbuysm2M/rrE51OhjaaHawCFKswtQNyYXCtKkQQwbrZNYMwnS4ssF99TtQfEN/Av2PqARh1b2vmXwCvxu7YgVdszrQ7wvoNrxOUnFsAp2LMWoe5xPLDtEdvCYeTzsEaWyRgdCnks6PloG/4iSHjQWl5U4U2NNPCwVMpQH00A1mc74KM4X2lA3Zgu7slNHOyakgmWj/5qCWRx9kIdoEN1aGmXkhpg5f7v5Zk+FKsgfYBjPuN370h/N1ErhaYBu3dSR3UhnMOEi3XSRZunFZ4Y75Y98UMYYBTZqhs//xJBEttIOsaHkZEqu0oGXnBujGKJIH0OAViZQhxfXXjF6rjA4tpAIvrrEAYuHp/7TsSvrbUKhFJjudcUhkCrL+5pQvYgc9WrFg6Z+I935vl0BfCWzNZboZYES9AaB5mzAPeS+ioyYZd/EWf3Mp4Q6DIEliDGsWX4YZCOqzCZAaltWvi41LTnKR0CzI0Z0FoDzt4Q== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(26005)(508600001)(6666004)(107886003)(1076003)(186003)(52116002)(86362001)(6486002)(6512007)(83380400001)(6506007)(2616005)(8936002)(5660300002)(38100700002)(66946007)(8676002)(4326008)(66556008)(66476007)(36756003)(4744005)(2906002)(38350700002)(316002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: A5jZ3flm4vZ+mtNQEikk1F4Uv6e7n9hlkc+yUpsJlF2QCkpAKlwW5zrfK+O/natkxe0N+WJUmF0LpBeOJuhv47dsJP09aBUz7/+viXEFGg9J87kgmx1j/7b7XpjTU1DKVvdShrUjVtn55x5vIWFFeTfWBfUIMN7bdP3M45Q24WFKoaNlHO9l3soBRr2bX3T5SWkL5ROX0s/zLQKiV3DGcUakt9kAKBQ2mgFEVsU3vXbytdZC1XQ/iX+Gi0Ke0NhrovscJ1yePFoKKu25gO+92t88l7N9Zxj054ymdXOfTcSdwnerXq+7iWh9uHOhya/MpSW5KcRpnwt0nFNX03z8sNqwPSBkIhG5vJru9/v9uIF/1XYR4ErnFlif36jWg6AZBK5+vjMGz4SjLf3bUXc64SolQawWDYHYT6pzrcyatV3bZdwSNj4WtsSGa/bvyCaRf8tb4Ru4lISBKjXuVOy7HlhPitIUkAwYbKZOM3t6jLrH+FBl5fWx0/AI38TwaeeSWikkOwiQ8LKXaQr2HweQzwNf1uGcHC2MxkdoRr1uKt6GrpSl8bDmidILljSYAEzDoxISCyDU5h05NnXjhXygQA4IOa7bi8+t2tz3MjUgz84yHm0cu+NRDd6wEn470X3GY52u3IWQBmeWkpXaNKHG9W8CP1NtzRpcFRt72Pb5YxUhEKZyqvuNoBGCiiapMjCVIs5lWmFHD7IXcDZxUIAD6P5xcH+b6X6e+RGg+rU2TTAfQK+bPwyYXmoEDttbnZS+Dp5FdB39kli7S3eXZxUWcREJihD/ZVt2y8ITOikghBdirdrNEXNyz7X171wWFDEndWIDag5wW/EZSobg58IJBYgAdcK2L0ISrwX1ZhYTSggR1cTGW5RLVtWdToPKZP10AsTG9Q3Pabi17o6yGS2E1RpDra6w3WyFAy0zHsZV5ErJ2rATfUqgLIE3A0e/E5kWuqHk0itSHUpZhwXC/uMTRfIF64ieVg/y0E5DR8/fa6C1Rfc+i2uAFPZSjMA+GaKa0MiPKwUDFCKYH9l6QZNIEJHB/spGNqsriEPpjlPwE3tzdxD/A9iFWyiJABgJcJGUkyCbD5Ws+TvkVxF7clagq4RiHEd1BWW3Y2jxetx5V5yGXqsBucUXriiQdOUFVGUA1uFYGlQYXIDje8veqB+IX+pezHa4g0n3o/lUp8NYVksO886qMl9NBkkxbLGNCcUSMsclMMT+h39gFvqL1StfRd8F0DWDFwaeCLt8hgsp4akhwzapFth1m6kHxoZx4kOHbhHmMTQVxBvtqqUfNySveHP9XGVqbh6kQIRdA/P/R60xpuLHYeMGetFkT5WkzL1ejHIrhZ/H3asEbctUfClXq8SMvxVBJadTkOQ3gA1WSUz+ICp2XQd7Xfj2/KwWrQek8cX8URAqb0RsUPvX9R7yGKBEYaTfO9kPSm++raq/LRSnDnvKP/9PXZV3+9ibszeXjxhSy6DlK19LA08bUjkOrQV1bD1J1RPZOYxe2SQMvjKuUuJyfim3QiEtv5PKFwNUI0X5sLV2njcApxFpcTD/+SslU5A+2vjFNswjVbmf51PTIJKmVXOs4EIXgeHH19PLhJXA5gfSYDmUfkiy0xEw8nlRHP12TmtKWukdvX9rlbSLKosM9MspC/XFXougCNFeRcMD+vBxwysZJ5ALPU7iew== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 05ef9daf-c58e-4630-f969-08da009a7eae X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Mar 2022 00:27:57.7956 (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: B1UWG7JCCPDursQZBpl6aQXWqGXAwi6VtCVpzqkRJP7AxKw9uJgG8acRudrtiGD0fH2WqVxKNovfTEDJ8K3+Mx0NThRb9NEAQnhcziyWfRg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB4361 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10279 signatures=690470 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxscore=0 suspectscore=0 bulkscore=0 mlxlogscore=999 adultscore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2203070121 X-Proofpoint-ORIG-GUID: 2o27SE4w0oEC5uRfDXm4rbeL68X0d_EB X-Proofpoint-GUID: 2o27SE4w0oEC5uRfDXm4rbeL68X0d_EB 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. 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 Tue Mar 8 00:27:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 550028 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 84C7EC433FE for ; Tue, 8 Mar 2022 00:28:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240337AbiCHA3M (ORCPT ); Mon, 7 Mar 2022 19:29:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59650 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230156AbiCHA3G (ORCPT ); Mon, 7 Mar 2022 19:29:06 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C43CC2612F for ; Mon, 7 Mar 2022 16:28:10 -0800 (PST) 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 227LG1LV002100; Tue, 8 Mar 2022 00:28:05 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2021-07-09; bh=Log4L3cI5wHMa7yoYDFDa8MG7Kmyb9ISM/Q3uyn51sg=; b=MEMeXjnqkhddsYTb5BVuPr07ungQnvS+Joei1Uo5JBOWPMvy3McfFY7It2JzI+Uogfhu bk46nmXx1vabz6BUmT6MY90Ng+bLPUzEQmdTRIYOGLUPB5dAKn2OIIvKjwyOvE3ODN3+ Yo/sL3Xsf2cqY8XDBJrFoNYX8L5EkBETSD2s6YBLmaeC1eneRVZZq1yCpzVnzMElxNqR K2nssb7s/ljjgaOQC0qkhSnA9dNhmX5W06kD7vHXx5TyfHRX26KS8+48K8mCOYKUdb0V Cn8DBjDUnHwgEBSdvw8YoqRbDZ9YcWWEjz0g8G7c14ReSDCgef5FLhELUpK6ZdhMe3UK NA== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by mx0b-00069f02.pphosted.com with ESMTP id 3ekyfsdgkr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 08 Mar 2022 00:28:05 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.1.2/8.16.1.2) with SMTP id 2280AJ9C134548; Tue, 8 Mar 2022 00:28:04 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2100.outbound.protection.outlook.com [104.47.55.100]) by userp3030.oracle.com with ESMTP id 3ekvyu3hrq-6 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 08 Mar 2022 00:28:04 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ORcHoyk+hJcSWC2nbqYFlRw8XozEDODs/8qZyAd1SUJdYDbhl9TJDTl5b4yHIGsqwylHrVpp6Lk3j/AeLMWmA/Ms7f6b0ToROEDYV9nhhnOwhTQElXg1ipquTfGbl1v5Wg4KON1R5HLfdkCGu78Sr4+dpEd+AXK0cySo5CqV6PSmDYDsjKRfU8R2Ww3sjqHK3kCg5IWNWH1J1icekeIWzK0DBvInFvazq6gBSEKDDwXFXEmob/Zi3+9x23Fe6JkH8tHs9FbHCKIoFH9QNQOdhIQYNj7mWnXB4rRA9y/QDU0bXwWEw9n3NECKhF02IO0+mgy6XYORGI/g7aASN4ajqA== 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=Log4L3cI5wHMa7yoYDFDa8MG7Kmyb9ISM/Q3uyn51sg=; b=bAj8YkRx9OyKt8lYW6aG/vy+IL2UhLcPLFh5H6hwTcfy7A0//j1ERsEgiUCL8p4CE0l5p9qD6NEsuVv6d5RaqGlThCAuzooiTPXxl17zAKprd4JaVr7D5cJR+3sFHEPAEAtvt81ntVtj8tWLFtlXrvYkf189mFfcwGtJpqg/q+Nhz861s9FtoI5jBToRkKwCl2S6r2E3RpqgdcpHo4nByyIqaC0LBy4aFOmXL7H+4xar7OI/tMZM3oK2dGDYvVeW4EYKQ519hbUsYAHki4/yXC/YMZNatHjDtkuillXa0y8XZjBIaSb33Ut49h8BBfPlxJBoXlLaq9sfACLSewALUg== 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=Log4L3cI5wHMa7yoYDFDa8MG7Kmyb9ISM/Q3uyn51sg=; b=ShXrsQB1pOVlE+W/4XGuEoP1TljSuiz+kgYJe8GwZTR/T+Kvn/CN5SG8R8TP34lfBUzWMgYTQh9H6o+REYBrasndqm8jlZXRwujBmZdPeshw5UtD2SWhs71KETuh2dn55BgQMt+3CP/ud1CsNKBn+LyYJO7LC9e/OWfvX7q31XY= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by DM6PR10MB4361.namprd10.prod.outlook.com (2603:10b6:5:211::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.15; Tue, 8 Mar 2022 00:27:59 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::3dd8:6b8:e2e6:c3a2]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::3dd8:6b8:e2e6:c3a2%12]) with mapi id 15.20.5038.027; Tue, 8 Mar 2022 00:27:59 +0000 From: Mike Christie To: lduncan@suse.com, cleech@redhat.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, jejb@linux.ibm.com Cc: Mike Christie Subject: [PATCH 05/12] scsi: iscsi: Run recv path from workqueue Date: Mon, 7 Mar 2022 18:27:40 -0600 Message-Id: <20220308002747.122682-6-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220308002747.122682-1-michael.christie@oracle.com> References: <20220308002747.122682-1-michael.christie@oracle.com> X-ClientProxiedBy: DS7PR05CA0025.namprd05.prod.outlook.com (2603:10b6:5:3b9::30) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e93234d4-d15c-4f5e-f690-08da009a7eec X-MS-TrafficTypeDiagnostic: DM6PR10MB4361: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: S4rDL+pC/dUrYPU9Dp4Bf+oOVO5LSpBZgjfBYtxSfIcyuipwcxliQ8Aga6YXps+eKQXZPHiBBPA3sIn0ummWSu+luk4o55up1jssXePFzG+k2y45tB1iQJxoYsHosmr+r0qbqQXeWXuB2zCoPETAcC+wbkbSKQluqwT0QkAPgY0XIU826/RK2aHMWOxIHPiJZUAQhn3T9xTXEWNi9maWHvSuoKwVVh/NXoSm67OqEldWj70CWRHbjIkUhkooYRT/V8SZg1y0t2InbOl9CDjs9OtWOSzYo337BNRM9OHytKpNEcFuyDJc8porkKa9r1C4U1DNseaauHO5S5i4SEKwnc6TFxN2Mifut17nC8XHGeAIDAIcJqz3hYgp0Kif8Mut1786MdfwocJ8Hr3b6nrnWXTlP8AFXxofXZjGxliBChE2kYDnHNhsu+h+OkiVKxV33u68g2tLZhDwGPLKOCvgstWuhPB0cfoM3iNp//PuceMi76dT2zVVt5O0uhiGAOTzXAkf0Cw937WyR+lbkWG+83UvPSVtxJoBUeCFp9zu3wCi6KkVKDg3GVmDk+cP8wm3bSfH8eB70rCmasN/pcRdQgtk0z8kdgQnzU7SBFCuyQxvFdnTOL4YU/CuONjWIDThMUyWnaiBfiiGI9xWKgoJ8lYsA1TXMIJPpUoKK/zJaShFDBGDyZUBOTfBCoVKNGVbYO7Eyso/LY5ZzWZ3pvQ91g== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(26005)(508600001)(6666004)(107886003)(1076003)(186003)(52116002)(86362001)(6486002)(6512007)(83380400001)(6506007)(2616005)(8936002)(5660300002)(38100700002)(66946007)(8676002)(4326008)(66556008)(66476007)(36756003)(2906002)(38350700002)(316002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 2Ht11u6O7EupATrT3y6of6NBcnkyoyuTJYvsOyETST2ycZlCKAm4kYQizJIB0mOpz2BP3e2aYu7uAA1Q4K5jHBTtgja7jieZcfMWr1sx1qy2izXRzJ9VDMcWLOauM5BKVV53i0uT/rCNoIHgPULrbVk5icRLpplH7EgOEVj+8+TTP3MxC34gUi9QILUdyEqqEotnIf7N8IXniBqwtLR3fHJAElavFA7zYqKXaap0uirFnKfXS0Lr0RCbP+onJCEJ8wniM5crXceg49VFPX3izNEGOauuNyYg3jDwRbTNc9LLu2+9DlQXyIerR5Oknvwm6sWYi/x3oAdADKFzepkp8WO8VwcK+0Cs02ush1jXxB6CZD/6SGhsvTSiIEMa7wQ5sLJWz4PHYBGNSOwoGXUD7iZ8Vnd6G1yw2Qr3b0Jt1A0ZYSTu3CUqyi+pqM/1YERUitYE/WC66BG9+u7o1JFknLV6Gx3OnG1e9V/hRu1hJ45UF/flrXNMhluADYN9YFn09q+XJ5jwQIG25lHpMufvaH0/8hLq6YHPZjeTChkQTlNYveNmtRy2VnY4HEe8wvqLbjUdYHWicqFQ7Bn9FXIgjnsUs3t6bTfiLzfbiiVS2KzqRUl2eFRnS/UUobolQ7yGQjH2PkVOZZ3+Iaq4YJ6kQZWNJcCnd0RIqIy5zbmSwi1j/N0Sd18LmQDefpbUJk8QmDCDjm9jZfEXrGCUlVsd9c3XCtLoxaxGTV8UJXAZdWBNcNZJsdSrf/4jrN34S+fwMoc2KNvCV0KrczKbllF2QLhjGFmPjkfGcz8YN6l5UMO49vBuYRMsy/mJAJG26ASa8VqHtUgSLKG7dDdQ406ESre7ypzBHieuttYWzZj70GbglavyNHMgPCwm12dkPRDUEekr+xUr2Ya6CVoNAcM2a3ycUwcTIRTroyVqhr6qlFjBgNFbPIX1wLAkU0HgEiaZ/OMPyt0HGbhbA5+GmY8m4lEPuh3UwxmRnBLt62m1IM16GGQUhuHkHq2iBIzuMeO0Zxq9q3j0d4+mGlVXA8Ncj5HqNXf5I91Of0wQjJmQ6+w4z29yIGF12+JCS7ITwFxgXl+paEOVqyAdmc02CXVjaA8XV/1cGAmf7BGJ7KsdbF+rSUF35iT/o5MgPQBnO7uXrqTNgD8O2mWa7LEqjj36U3XHvZuFztrk4c42z+dwPP+JIwpLIux81Vz6/LsZsIDK5Bs0HNKPloIUXCRzq4hMuLvTdRRu/jhXOsM6Z3UUavxCNuez/kk0n0ybC+XH13YI6XRMB6gj3oydwpKQt6Tvjp+bIT0YAa3DW5LlamfJC7i76e4N/c89ck8g5x+98+bGUrpYd9mSgvmkVg9sHdmZFlX/fe6/656SvY7AX/Liewf/W0yw7jYBcYgsd/xh7KGPGPz/GvazSfSDbeTUojwD8tOD59vXYSkFDPJVve8nV8s2P3mXJ9XDlzdy0DM5zAnzpkwYHBS+MsGtNsqL6HpWYX4Gyo7CajzIYNs8Th7gc9vjYSorCEwTv9xgK9LWj+2vMrPNrwWLlzt0HPsHySZaO+gYmdNfAJc6miqlBJ+chJ98FkjxgmUgpD2xuS/rqWa+v77AjoqpJ7q+/94cW94NOl/X6tAQaxYPwKXlq+/00YqNp/U/qJSt7Nu46QFI+oyGg5ChdPDKfByEBl0v/LMtHw== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: e93234d4-d15c-4f5e-f690-08da009a7eec X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Mar 2022 00:27:58.1862 (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: jdub1T+xo7zDuzBARQeLEK8XFHxaAjCu/Ak7fXeLtW5qPDOgz9ST9FQ1xugL+zWRdlNgP9HcequtWVWaT+jjy+bQcTN+705txRrSHhAOjyI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB4361 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10279 signatures=690470 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxscore=0 suspectscore=0 bulkscore=0 mlxlogscore=999 adultscore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2203070121 X-Proofpoint-GUID: FNBE27SbEsMoaSBq1kJgkj5ibUVxl4pd X-Proofpoint-ORIG-GUID: FNBE27SbEsMoaSBq1kJgkj5ibUVxl4pd 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. Signed-off-by: Mike Christie Reviewed-by: Lee Duncan --- 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..261599938fc9 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_use_recv_wq; +module_param_named(use_recv_wq, iscsi_use_recv_wq, bool, 0644); +MODULE_PARM_DESC(use_recv_wq, "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_use_recv_wq; 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 Tue Mar 8 00:27:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 550026 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 8F9C7C433EF for ; Tue, 8 Mar 2022 00:28:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244126AbiCHA3T (ORCPT ); Mon, 7 Mar 2022 19:29:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59712 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233945AbiCHA3G (ORCPT ); Mon, 7 Mar 2022 19:29:06 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D99A7B7E3 for ; Mon, 7 Mar 2022 16:28:11 -0800 (PST) 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 227L6kZi002124; Tue, 8 Mar 2022 00:28:06 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2021-07-09; bh=dkxSE8XILheD5w32F7QW8Ip6616IdJvel3Kn3kCo+6c=; b=Q9nocIPmdxkesaSgb6nCmk0RykMDqfiXoWhm/XvlEsAX54dnF6kyjJ2/QZzkD8lJuAmG /7cjilmf6wVRarm7b/MKqkkCpa8JSO25EYqqi96N9S1Ga+b6pocmSfqgaSXVO9rDn0qj 1cs3C33IZf2Uz4RXmDIZ7Afu/NsPd94TYeFeF/+QxaRtZCDfgKJkjZC8SF8xIzKYvgk8 dEogmdj7iXFewahWp//W2/LN9m1R8pcoLrAAc3MSSDkgKwDpDCyPaw9/PMsZC6A+r1Ld P+oR7eOhRPxVYJgSPwKnEuro5+f66NTb101Xz5eeyMRJiMrZb1Mu5y6gU/E0y2MQaG8E Bg== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by mx0b-00069f02.pphosted.com with ESMTP id 3ekyfsdgks-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 08 Mar 2022 00:28:06 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.1.2/8.16.1.2) with SMTP id 2280AJ9D134548; Tue, 8 Mar 2022 00:28:05 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2100.outbound.protection.outlook.com [104.47.55.100]) by userp3030.oracle.com with ESMTP id 3ekvyu3hrq-7 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 08 Mar 2022 00:28:04 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GHVszXsa8bKj/x/hui1r9kPTeLGVRfzj8rwSUsc01H0hKNonTPfA0YWfXi0scDIL7SdZinW5ffNiNYomJBsjqZeTRqToX3zijTr1J6wFY1lkDWl+LjVPGz9xcN1M0X4tebknhmBE93wXZByS5sSn2nQNrtPM5Ew6NMFuCs9uHNNqk9vGScetqImFOKZ/tik9mESQFoQIbqsQwT45EFnX8dSjiKPWsqjzHjTmqhsp/J4zqsQVs5po58CUHoWQ1jB4YVVcAJeg+lLgyYxVnp6/UftFYn1DC7yET8HTTvjwjUmSJjYyFO9ylHFO9n+1VJYr+FoauYBM+zYjvKYNT4lYpQ== 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=dkxSE8XILheD5w32F7QW8Ip6616IdJvel3Kn3kCo+6c=; b=gKQR3GloojSBKzuFd04dNXXGlH4SaejPrlsMJ5ZLVi+O0uPhOfjB/vJSUI9SK8vVtE/m+NNyp2Bs5sdvunOC+NjMPcp4pLrLMv1NHitUYCigkzFz3kMv6CIsGu5bySQ6mazH9IIyJ9isBWurmsWXLV1Ip5orBErjOG4zm1MC/tr6xe9Kzd3KDm777+gTsrBFQ06D+U/i+mZf1HuPGcrT+At66nv2Jpd2Nbm+LQGK/sFiaEob8nAYph8d+wuF0nAeF7YIELNob0jI4nOcquwS17EzFeqJuUzfPPTFg91UWu8E1KCfo30RsNieRwgj8HItFsU6ez+hEffs4CsbqsnZYQ== 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=dkxSE8XILheD5w32F7QW8Ip6616IdJvel3Kn3kCo+6c=; b=EuSxnXDKP2C3d382Z60qdQYPD+LQAcr/Yuoj4xSrGV/4uOnCsl8tPJWdo1L2QsAiwmG7DI0UKY84tw13Q/VW6WmKY7k7Lh2nuG0fkfwfGMmPpC9ZjWL2jk7oaFQD3vXGxuk9ifE+flKFNhgQznHcXnTiOHeAOxQuHz+uIXcZ1jI= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by DM6PR10MB4361.namprd10.prod.outlook.com (2603:10b6:5:211::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.15; Tue, 8 Mar 2022 00:27:59 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::3dd8:6b8:e2e6:c3a2]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::3dd8:6b8:e2e6:c3a2%12]) with mapi id 15.20.5038.027; Tue, 8 Mar 2022 00:27:59 +0000 From: Mike Christie To: lduncan@suse.com, cleech@redhat.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, jejb@linux.ibm.com Cc: Mike Christie Subject: [PATCH 06/12] scsi: iscsi_tcp: Use sendpage for the PDU header Date: Mon, 7 Mar 2022 18:27:41 -0600 Message-Id: <20220308002747.122682-7-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220308002747.122682-1-michael.christie@oracle.com> References: <20220308002747.122682-1-michael.christie@oracle.com> X-ClientProxiedBy: DS7PR05CA0025.namprd05.prod.outlook.com (2603:10b6:5:3b9::30) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f21d4f09-267d-4678-9167-08da009a7f28 X-MS-TrafficTypeDiagnostic: DM6PR10MB4361: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: ZE6KJius+x7Ajk/q6RtoyJRAaWKUBEliJUMDCQ2LDIN9tjFuRP4v88o/9ztgYGmEelCEEqHqjI86sUpw8nLY4OmLoq7HSG9TkIxkL4JaEu/m9VMyCg8JgKmsLbiURGR8F+jliIC2PPtH/Rz4+DvJzTY4gmTnB6Etner8SwBOxpAt4XTPePCcsOKbtV4DpYP1SIN52wFhiSTHp6MHlJeWw9povIrg2cdCt4AxqVLhYj2/aDRPO5yZJSPvBdRgwe3y9E0wp0BscJeuV0tlGP3+k1S1sV5QDppNiqIfR3PwztY76rM3dU9e11Lzvrazek0u0yFPHDANr0ylAYgzKP1/1SBNJqtEy9xI8kZVtTWm37DLFPejwun/akMf634QEzkIzU9yvWog2ETMEbLYWF1iQ98NJ6fXTrvR6rJ/IKcm2zNrRBaJSMjgPDq+MeDjQ15BOCQ71RzhqzYgeE130f+dVolkXlU3mXstzU0F6cFvcOSmMsc6xjFimaNlObtl8SzbZ+DAHYeQd2Cj5eQdHDruPDnmp9O4hDFj7Uk1+WQaUv3p3VpwHhTuKCJTDWx9xZYtWC/rn4WO0jktKU5TbfkItu53v12WBoM4phiiC0kik1BkTfdjeu/IjrsTo34amWXbyfoIKlDJOucgCF1BoQ8+EQViWw/7PMvQBLR2mgJh0f2EPUWhITSu6Y3bzRyy6EKECe6HxeXQfwWcK4xzxpgPTw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(26005)(508600001)(6666004)(107886003)(1076003)(186003)(52116002)(86362001)(6486002)(6512007)(83380400001)(6506007)(2616005)(8936002)(5660300002)(38100700002)(66946007)(8676002)(4326008)(66556008)(66476007)(36756003)(2906002)(38350700002)(316002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: uXHrtQCNaIOn9Ol3mO4dfgkQ4E7tVhf4ORS7iYj1r+hPtQr96iXs9/fmE9xeoz4DFDNOjbVqpSdjrVrnBMULGsAzPHSwKUV2FXj3c4PGcsXYcFEQPJJPte0tgwFJjHzZ+Aj91RFBCBkHB0WqDzE8fKe/uhdv3HKtxuqNCv+oaWVjJKC77apc8isAT1JSMXbrvIEOODoPp5EMH1DHdjH7n4FqJxhSYzNpEUmM1j62ez8BrhA/RTP43DQ8T73ir+Xf83Er8t4kaWEKNt3zEaWzW6WXAHM79ZLxBhc8FRHKXx9LrzivAwW0/BUZhQzg9EmTxT28hYZdmCbVAkvbIG5F8z/054wRljIKJXrr8yb5NFanvIFuPGF4xHjjLFnbMzgg4gUZBTXjYFIi7JFVit97NN8aMIVHqLOrM6NDimGDjSh5lOts2NpKJSUL/vZf5WfNNpdEfD7HnIxp5hmvkUKy692utxkxFD6g3Q3J8jfXU8lL4e/bfwTx8/wXe6oRLIi/HFutiAKKqE8M2j63Kj8EmzeB9xqadjbDTN4l72m/SETKh+ixh0CHhq+FC9XFyjk5yA7350VhVbKXiTMPHpDV9YsgplQpJV6zboh5eDy2F6S98ywItdM25iON5Qw/7HN43Ge9xEpiWIFMrOR1yJpHQ7fQi0xVzOT2QxK+DBY3tkg2hN+lXiqFrLh3GRqdlsUvLI7Vriy39BeXOY0vHCm/WHyByixkZz4Hi6hlEkHFK1IiX30HiGIx+gfs3cmRKWR95cEHvORVdm9Hyu66kNRxLAht70I8dGU1CDRi/JXJlbT2VthVfw2xixKi13RW+PxmiHZYnC/+MpeJgZdiFJm1yrp7lxcAtMuKv8/0s8Tnq6XKXhx4wiWLSZ2YdG196VvwPskDlgGeJAdi/ytZQ7uBMEkysKbYiMZ/HLt1+QWbKy0y/2a0QmXs2G5PbSTxIcPqKmWz7wzZHVZIEQG76uhNf/2vpmM/6QTVnM8ENo18gSIDgvOytQXSHRRYpk7+6QEZut7hS11zvrDDBf4nduEXMTxACvrSX2V2Z6Eyb87P758dKrR6GC0qXO3C1VA6ZXVqR3R4mEb9Ec+lITzOTr0WbTVz/6li3PWWp6959LETnHUQ3eAFEnBC9DY4dLSFEk8gI1Z4IuEJFRF73H6jmr1lcIzC8czNVvgSIPYMvOmu32ly81IdyXaF63Ju74rbuMXP3p4CWmLWpAENw7+P7mFb0YVho2TSjP/sT2swLw6DQtIUhevgkTtrgprZ4WoMCqcVtQOfXo3J86LqYh2Bw3QNq7hXMrKpEGorHg0YauAb9Cxy1QydqLuFB9hJkaAKJkezvOQLPIPwD38sUbhXuccNaJqalwdkLy7772ZE1sgpWkNAeHQlAN5jBK4W81GtFo0bOfQcHN+kgnIEzlvGVLPBe/+3M5qOmx1FB924qn0xnMudSqHyvjpOJxqUjvSD1DSLAcWCXJHUD8kTQJ3e7MFp06GnOj1jcfGd5UhDGM8hl104eXMLWXurdcqNZ3/PmPktKoCaHhyIGUlM3GomRy9+NUAMlQVE/edPkG9+nIUBzx5Eoz61ApudYbPbdH1MKbof5GMIW67eYSbgYPpt1WMT0ZItwpPEDGqxGSV148E9YsXx9oJg0WCcv5sOz8Vem5FuQFOK1lwimafACzXu8VAPrg== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: f21d4f09-267d-4678-9167-08da009a7f28 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Mar 2022 00:27:58.5768 (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: UCeEZ18U3IFPQLOCRaB1dvRLY8HwOYgnio4CQCk5kdm9pselF2lQ6WCykBKTmBW7n6RbPyXQE2qsWVSHqd7l3JYnVdkWSkWFS/uJF/VsqbE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB4361 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10279 signatures=690470 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxscore=0 suspectscore=0 bulkscore=0 mlxlogscore=999 adultscore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2203070121 X-Proofpoint-GUID: w2pwl-pPiQCv4t4217gYz6eN1XflRk_W X-Proofpoint-ORIG-GUID: w2pwl-pPiQCv4t4217gYz6eN1XflRk_W Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This has us use zero copy the PDU header. Signed-off-by: Mike Christie Reviewed-by: Lee Duncan --- drivers/scsi/iscsi_tcp.c | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c index 261599938fc9..3bdefc4b6b17 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) { @@ -315,13 +315,27 @@ static int iscsi_sw_tcp_xmit_segment(struct iscsi_tcp_conn *tcp_conn, r = tcp_sw_conn->sendpage(sk, sg_page(sg), offset, copy, flags); } else { - struct msghdr msg = { .msg_flags = flags }; - struct kvec iov = { - .iov_base = segment->data + offset, - .iov_len = copy - }; - - r = kernel_sendmsg(sk, &msg, &iov, 1, copy); + void *data = segment->data + offset; + + /* + * Make sure it's ok to send the header using zero + * copy. The case where the sg page can't be zero + * copied will also go down the sendmsg path. + */ + if (sendpage_ok(data)) { + r = tcp_sw_conn->sendpage(sk, + virt_to_page(data), + offset_in_page(data), copy, + flags); + } else { + struct msghdr msg = { .msg_flags = flags }; + struct kvec iov = { + .iov_base = data, + .iov_len = copy, + }; + + r = kernel_sendmsg(sk, &msg, &iov, 1, copy); + } } if (r < 0) { From patchwork Tue Mar 8 00:27:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 549628 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 42AFAC433EF for ; Tue, 8 Mar 2022 00:28:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243211AbiCHA3N (ORCPT ); Mon, 7 Mar 2022 19:29:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59674 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233832AbiCHA3G (ORCPT ); Mon, 7 Mar 2022 19:29:06 -0500 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3FFA726AD5 for ; Mon, 7 Mar 2022 16:28:11 -0800 (PST) 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 227LE2sI031927; Tue, 8 Mar 2022 00:28:04 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2021-07-09; bh=utAf89Eqb0N5MnuFRt55pB1mE48U/xU7ZRc0B2oYioc=; b=uCrleZhPDfIAMyrqSVNmkg7x4UTYl4Um0hRW1z5B9WtLhQE7iZWxMvkis92VvsIwHssm D4eZrmIYbxGFilNZh4McGFQ/hN4dtm+oD5ft6apWOMxijtLQNtWgkp0Ih3++e2wugu+Z VnFcBJ+ilb2rms0S3fd+zGjxGRSppVI94RoR/1r6vPLQgrhjIVu53Hmvqf2mbiQuTSr0 75FvUYlw4qZvgv5si1naEyb9wcb5tzsS53pq9fi2aX9bKmzqmD5dAMvoXXtZgU8k6pnE Aqezq7F4QnOwqqISBOR4aELUU2ECSFVqwqf6aYFLXGPEpex+EIlbsPOnRDQG3jUIAHJv Gg== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by mx0b-00069f02.pphosted.com with ESMTP id 3ekyranbuj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 08 Mar 2022 00:28:03 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.1.2/8.16.1.2) with SMTP id 2280AKkw134578; Tue, 8 Mar 2022 00:28:02 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2108.outbound.protection.outlook.com [104.47.70.108]) by userp3030.oracle.com with ESMTP id 3ekvyu3hs1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 08 Mar 2022 00:28:02 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fxRvmqYrG2bMsiKIVJ4xYTGbwIEDYt7isFEmlgRLkX+8mt7TICc/YcfvmVUFWCaeU01qVGKzaSWsZ1EcBE7an9+ITcOdZet0W2ESxEi1pH/LLleTrqlIvAHegIa9iepo1c3viR3h0B8JTAhIt/zwmkgju0Xy+BEIINo4TtYYVU7XY/qzoG/vztDfMUC4Nxo/061xpsELhTM0IJA5h8CsjMt95XihusWz6gek/0Ai2NoBFNgz41jqKiGvNNjxNf9oYjejMM9dGs2T9eJsCkHiRlONCdItfgplOljgkTXqa2eJqiH2ZSjw1s+nzByRnK5ui1UKm28HOo2R1t7DT1yB0Q== 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=utAf89Eqb0N5MnuFRt55pB1mE48U/xU7ZRc0B2oYioc=; b=ZxAh6j5n5iK9PoI/jlJjJTvXW+YELcRoiPGXTpo9Hliykbt/tZQIABXdi9fqeK1sBWbT0jzmkcJ594dlffFFjYmmKk6l+M6s8bRiuC1XAW1fAibRz/tWcb0Iz8jXNLYnYEajywwNjmEAdZ62xsyqY79sF7zP8Y4pryNagZL4KEwXbb8wAvq7Wdu4sjPrKVilnpe6vJscEHHzaZOgIjdzJQp/ksCnge8uMl5e0Bf5m5KHLCdC06l8uo3ev9kDnutZ6FvG1uYbGobEaViKM0WkFDTt2/NBmVpsmYl2FM3OWU0TY8NHGKwWr1w+1JhtEvOoTZOnUxtG3eR9G1sqZVvkvw== 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=utAf89Eqb0N5MnuFRt55pB1mE48U/xU7ZRc0B2oYioc=; b=xqilTD67G7eC0urzWl2uf13Yzyn4pSsHzByN854B0bcs2Yy/19g7MdBWX+6cOp1mbK/qIpnWjBYUiNX+KZUTRg0Vhrf5ws+hJlYppGA58MbgP4VAb/s5I3BG0tROfoxTncsh/6UFMP4DtiCh056mRLNwdfMovDkT5xCRAS9520I= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by DM6PR10MB2809.namprd10.prod.outlook.com (2603:10b6:5:63::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.14; Tue, 8 Mar 2022 00:28:00 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::3dd8:6b8:e2e6:c3a2]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::3dd8:6b8:e2e6:c3a2%12]) with mapi id 15.20.5038.027; Tue, 8 Mar 2022 00:27:59 +0000 From: Mike Christie To: lduncan@suse.com, cleech@redhat.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, jejb@linux.ibm.com Cc: Mike Christie Subject: [PATCH 07/12] scsi: iscsi_tcp: Drop target_alloc use Date: Mon, 7 Mar 2022 18:27:42 -0600 Message-Id: <20220308002747.122682-8-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220308002747.122682-1-michael.christie@oracle.com> References: <20220308002747.122682-1-michael.christie@oracle.com> X-ClientProxiedBy: DS7PR05CA0025.namprd05.prod.outlook.com (2603:10b6:5:3b9::30) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4b92d97e-abbb-4af8-8e8a-08da009a7f66 X-MS-TrafficTypeDiagnostic: DM6PR10MB2809: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: 3EQwwMb+yX9G3Fu1WrJl5qvfk/UMSwGwItNCh9FKWRxRh5a/6/SOedLGMo/DOu+nbpaI/iUDtanvnRMV6MDjgxeKX767HqxQIUSv07UBP+cOjp9WsxEfjM9xzVgqNYnjItxBABF+zxHSHKPnM8PT1Q5kW8mMvNDCeSR2Qw9OAS06VArrGVMLa/4gJkwItzAy6PhoA3WUPUGlEYO3aY+yEwtv17EZVEmqNrGIu8o95hQcm03y0VBAETSTip4w9Bs+F7CaSuWSg0MfZPeqK40HiOT/0bnSWs7RZ1/nOVtQNJy+KdrhxxjFsutfwGBBueg7HWampuXS0Vvo8PzVakcebAqfpL0r81CVOcJEGIhwndDUnfuJpvVFG2B323n37dHm9o7Gw3NFDU+iZr7RlIt2gJczMtgvb/db/UzSiSa6MnfgJeNtsXgmkxtzAFjiSDCdCsjcocb97tQmicGle0Lu0Vqm1YaGvR1PZYX++idEOeMYeTlt+cSwicgpfunDOnsKHkdSdwdez0HPVVXNhefFK2x6/RGz6LN6dLCqJmeI0FrNLEiWMkWnaElkmxqGWYaTt4XO3p3eVPuAadKH6VmVRN3a0f/UT9IvlZ+WX+SkVSmFHKNplY6ylyfX3psWD0cyF2iOKjp7paGXlqDX3KTu3zGXI/+rxTFYoI+BNNTfnniXZAnjTRKY9PQLkyufYMpk8hc7Ret5/+3yUdIh3yivKg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(8676002)(66946007)(38100700002)(66476007)(38350700002)(2906002)(66556008)(4326008)(4744005)(8936002)(5660300002)(6486002)(86362001)(316002)(508600001)(52116002)(6506007)(186003)(26005)(36756003)(83380400001)(6512007)(6666004)(1076003)(2616005)(107886003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: /J64ut18uob8eO6hhY7HHdINkeBAr6yzZ2wcDHC/HJnI25IRaoQREg1VjhY2r40/0zmTPCMaxXdUwQqIa+3GBlPkLb6zEpuCbQKQbbMIUEAugKSqIxOrAbOkd8trWfgrP3NVZC6S0ZosXaxjSgy7NXvEPsiksOEusYRe/vasqWIUEO2A1IVW+WwIJKQ6/yznMEzioGYO02RcoAwVtslPaqbfP5bnksg9q108gdWcAdsrlvD9LVbMnt0a6l6DdapP1fHKxBHE+sqGU6a51GqV0bRE8U0a44bF6+1gXa0Wgc1cX5XOiK5WwTuUZGGJUYqqRGe8yPQ3zQL8Ejf2uL7FSJaT+96mnmjsx4/5sJMj/H2O02oMz8V+7ZJypXOnoCiYN7oQ7jFQ2HlOewrIItkp0vMS8EA0heZFZJWUitY+S1R8gA49LrSLiy0Zn+8FcXYaLsmQ45xRvCbGUfWlYgv3y52S0Rp00gVmkQ83ZkMS8Izd6w0DO9+upeDWYW4XcOdc2jupyz3rO3EY7XAVhPDxmpIyPiThcwgCqcw8UGnK0jtRC358HFlJtgOpR5qgtHZ+1lM4+XiiLULXnpMdCOiUDYmeo8leZeLvFFs1Z0MbA9aX/oGoMXRwhOWkb1kk9n4NZ5ilNE7dO2DGtW2rHdK5t99p38D0Q06Bw/ziKmMT1MQ7yCN4C0+S7pZAmjH2E9R1au6U/RNj5BR+DHtNnyku28vkotFx/o2hbPXqGvftmcwXp007mwqmyO+ZlgMpg8DxDJRHey5fNZUpqFd7gNM9RotcDBXZLeuUMnp56gdVzYbkvqfJ4LRG4KoQg+EbjgBD5gEYWGTmPdWydc8+V5OjePZA3kmQ8zApZVQpN5FU/4c2XFBV17Giiy1oRFC40kyI5dHyCtkOMDDccL4uW1GfI9ggGvZvs+E+h+9Th6KdzpyBoybayqHutO4dDyheMMzQxqQq0X8wojU9R4Bbl80gdVDVjP8IEPWFjSPYBJ2GW3WzbtaZpZB6k1OQIwiLzOafjAYmlc3rjejMrRMX57m1jRl3nFQuAJLjKZ5Ynl7Oe/bMoqi8YoMkRetgbZmOoNNm/JtJa5E8fzwpkxYFqd/5zrPZXCb0pdsC3fkMeQRoHlWbn0Cl66TTeXQclll9VhNUoXD581e9YlN04OfbD9qKtPYkRpm7a4mPR9jVmuFpDaEdaKyegInWmuDwR5Uab4G6kyVo6MSi2gkvUZQOVz0e/GHJFaz8fBQCsbRt8rfRrR3UG+Cas8hmySOXVe/0I5ODzTYXMmX0Ilxmx20hqFbF7c3DMftpf+9O+3F3GSJFWtTOk/9S9T2P885Phe5D5EKuor79WOCIBPzzIq8ZQtKH7oj6YPKRjO+MrT7gM+PVGCvNLbdsItxkGPKBykiIfF5J4aBY5EZQQ49IReckyYaPLtcg6QrXcDoGJQRdhz63D75mWresC6LyFihyF4/DmPUJcHKEgnbjQjX4fCFu9Y6H8Kojez0oEJrCIOIiSOvmYgzSb1BTRFWI6w8fMrx510YZ4U1yY/jBQIJm23/r50quqVLk71Sns9lb5JFes/qXY0e7+YKwViwR2nnACR5P9QZH9Z7hN7A0u/WWfZLN5sdDdTzqQpp5s8oylivRicadlM10l8Qi/MYnqsUol9HgOpj3BhOQU0Vzw43r5aUte+O43g== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4b92d97e-abbb-4af8-8e8a-08da009a7f66 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Mar 2022 00:27:58.9831 (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: aUCluwAPldl3BOLwnN4dIxYXSC/D/Ee4O7z7dSEN0cDsAzBrcOx3h/3g9VjYnVwGesCnxzc95FEBKp0B71PEjguTnADrcbpxJ4/0WR75Z50= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB2809 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10279 signatures=690470 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxscore=0 suspectscore=0 bulkscore=0 mlxlogscore=999 adultscore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2203070121 X-Proofpoint-GUID: AFwVm3kLPQssd8EZ6l9t1uuDQ1hdUZPG X-Proofpoint-ORIG-GUID: AFwVm3kLPQssd8EZ6l9t1uuDQ1hdUZPG 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. Signed-off-by: Mike Christie Reviewed-by: Wu Bo Reviewed-by: Lee Duncan --- 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 3bdefc4b6b17..974245eab605 100644 --- a/drivers/scsi/iscsi_tcp.c +++ b/drivers/scsi/iscsi_tcp.c @@ -1053,7 +1053,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 Tue Mar 8 00:27:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 549626 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 1F9D6C433F5 for ; Tue, 8 Mar 2022 00:28:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244136AbiCHA3U (ORCPT ); Mon, 7 Mar 2022 19:29:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230303AbiCHA3H (ORCPT ); Mon, 7 Mar 2022 19:29:07 -0500 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1104F25C6A for ; Mon, 7 Mar 2022 16:28:12 -0800 (PST) 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 227L8EUf022315; Tue, 8 Mar 2022 00:28:05 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2021-07-09; bh=YrcQoe3lxoxJAaVOC/CZP6kOtAcgVi6LcgYlA6Uryzc=; b=XPC6t15NYJ9Qn83S6p+T2Z3KHicBCrEP0FqCmScoL/gMeC8e4yqystPByOTwJvGVy6yY s89A16r4a8bYo+9IVINxuGQfg8DKvC4PojE4A9EnaCvWMyW6hZpOokDCzSIuSoECXU2T IIs3XLl1EXUgLYekugmSlJnxdfz9EtAnvaJpDV6UAfNHibUNEuXH21DwElenPPufrYOj fO10AMcgwFf7jRT8MHb6AB9b5XxffGPC0HqB0o8qJEHJhZhuIWqe3G30XTgy0C3Qs37U BEui+e87BcW8ZqTBZr1E9S4J5zSua5HHK+cnO/JkY+y9ZR9b8Q5x+D0QLAOR7UeTIVRH Xg== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by mx0b-00069f02.pphosted.com with ESMTP id 3ekxf0njg3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 08 Mar 2022 00:28:05 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.1.2/8.16.1.2) with SMTP id 2280AKkx134578; Tue, 8 Mar 2022 00:28:03 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2108.outbound.protection.outlook.com [104.47.70.108]) by userp3030.oracle.com with ESMTP id 3ekvyu3hs1-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 08 Mar 2022 00:28:03 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ajp96IP8z37K1qZGLa5JGwG8DARHnM/GHGQjNKLV5wBGiEDt3KKmWmv/Wd6Aeav1RcCxIulGZKzZbSwT+DuQs3HzYJdHi8Cx9+W3bN8nmQrTZv09oHT2gJR1EZEFPoLc5rU2MB2pm/k3I8P5BD5kab5kzRYXvhMM+pEY8UzLJ9K+AnZl1qFHSCHcqbhezeoRIweg7INyEaG4rM37n+oO4McH3Mt7ON1pkx/VBfLG5rpZ8RYxvqr93ek03sDfeHNp71Joi693qrJdRYLn5KwwkQqtwXFcFwuwloCiIpjjTIB3XsXEzaOeB5QCDcPyJybz3qSlvvPe5mgxDK3PZ/ydfw== 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=YrcQoe3lxoxJAaVOC/CZP6kOtAcgVi6LcgYlA6Uryzc=; b=RCXzXa02AvSpgHUqBMDVcuI95n70QdHKgtWu0OkcPxlrtmEae2VmbZWfymM+agdj3wHcDXfQlK2Ckzu6h8ZL9BLz43KoVb8IVJEWWVBrWM++PIxw6fGQucMYnqQ3R5wqIy4uZRks5Dj7Y5r9LBuklV8qJ4b2Ta7sITJJKn8776ekXq3oRt/9ysvwUBOjHOFk96vLCMq85N5m7e9njcDaZtKn6VlcxIU1H8fgzFz/A1Q3hjD7rnxLghYoUABTk3ANoYp2354QPeFDJWHmWMsviG/pn1jnu9qDkQLgrs/b+IWTxLUi3xN+GJwSiC+Lfi/J2vTBZCyy9XMbAhNlxOOfkA== 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=YrcQoe3lxoxJAaVOC/CZP6kOtAcgVi6LcgYlA6Uryzc=; b=c/xD4LsvhQKF2QUJzSqcgqI2ZuQo494mceebS75DWxdJ4pNAPlMlRDaRvabuLVMEwfg74XdPC4DzLrgb8XBOZI1Di3yIfvNBVbkdoS80Y/CPkGbe3nharyQOfv8XzWxsl6Ns+rALJUuqvKgcmZFy9NIGomdXIZwHJustN+cfdio= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by DM6PR10MB2809.namprd10.prod.outlook.com (2603:10b6:5:63::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.14; Tue, 8 Mar 2022 00:28:00 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::3dd8:6b8:e2e6:c3a2]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::3dd8:6b8:e2e6:c3a2%12]) with mapi id 15.20.5038.027; Tue, 8 Mar 2022 00:28:00 +0000 From: Mike Christie To: lduncan@suse.com, cleech@redhat.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, jejb@linux.ibm.com Cc: Mike Christie Subject: [PATCH 08/12] scsi: iscsi: remove unneeded task state check Date: Mon, 7 Mar 2022 18:27:43 -0600 Message-Id: <20220308002747.122682-9-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220308002747.122682-1-michael.christie@oracle.com> References: <20220308002747.122682-1-michael.christie@oracle.com> X-ClientProxiedBy: DS7PR05CA0025.namprd05.prod.outlook.com (2603:10b6:5:3b9::30) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 53952de6-b5f9-495d-b2bd-08da009a7fab X-MS-TrafficTypeDiagnostic: DM6PR10MB2809: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: UXdCRE9NE3kYcJ0zfTRsHAfB0ludSRF7kJOJbp7h6EbY9zxqbg0xLfFePlnLobRcoRpjcN1dngJ3XKFZ2U/a1x3A/PBqOiV5F1w3gKlaIWh+/EH+I+wOeqQvnO3TfUk17BkVidJIywPYSUk9dg5we5Y0FCyLbR4wwzXzdCHRTDs9Yf8CQoMrj/UBDYeyC8brbJYMkxoXwbZ728k8rkUnjrUbJ8ng4w/383GU7d4j/BcIPyG0CWeTKVxMenk3EjxD/KHtC5tYYMaO6BjVsTOUGDEceF2KFvPXeYEQaI6SYnwQcgGlerjjSw0i+PanDh35ObB99tVaIRjsf/XARqKeScvFI98B9aQDW5ON3sC8r6SeI+5SjitwOjirykUaB3yJxnr7izwlDmzby6Ail9Qywwmagv4GBKVOl86Y7kU9cgWtv59bxOis+Vjh65HqnaAiXEMWj0Kgxy3UlQT58sf9P2J6fpYClH2vTQUAmc+1L8nTZUqodePMGFtL5n2RHpboLFWSQp2AI8LOaSdXj28Wwagv6X77udz0EyiA3NJpNFMH/bd6XetBzPdJT1FHEYXqnVRO6XdKoh9jN9L/kfAydwESr2stoHG2/ShKnTvW6Y4hrvZZ2AZuDgpOmVw9wcaT+H6RDDkdG5bx/3jNU+2SCJXRF7QTG70rC47+scnsffyCxqQFce//rJL+NrZOWI54++OvVJjiMYpc4n+Q8FPBIg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(8676002)(66946007)(38100700002)(66476007)(38350700002)(2906002)(66556008)(4326008)(8936002)(5660300002)(6486002)(86362001)(316002)(508600001)(52116002)(6506007)(186003)(26005)(36756003)(83380400001)(6512007)(6666004)(1076003)(2616005)(107886003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: eBWOWWInIQED0d59YiclzzGcOtqvc8iD374lx+PzCFTmFht76N7LtHZY8jVAOrAGF7/ymI96kF88CRhMyGPV6Lg0CyM+oHbz5u7RK1X3rk5wgOdv4gYKuNhr0v5JI7KMb2b6fBjYaAll6adMjaxtQOW//JdaT70xCOqyUB6X1sdJYuXNcK2fISiJMxcWnc7RgOL8EcKcIrWq/OlyUavhmOE8o4ex0n5WO/UUzJQgBk5zPD00iB2iCDnmm0hZJA2ObTM3u6gOtI2U1mhCGHeVHVBtLmVO8GzYl3m/FjVj6TPhfPemA8jZcadQi/OL66dF3qzn+A4N73fpCa2IhPrn8pH5U/a+x0aoOFxPrnF+ddvmW5FEo9pU48aMZ1YngUH0dm9mgJsXYXsUVxCs+TlxxNJ6Nrgo/HKdPreVC8gKfCvLhC6YLYUBz7DMEy1IZEgdq7SMWtNBgchYezffxvt0M037W1egDSTepxczwGqT9qkWM3Jy6fsznMxo6AGTK7MbZtO3VrnhUNEsxQi3Wl2P8EboZQD6h1sbaEccOsQhWP5x1NMYLcX0cIKy7HpwnnSMu3EIsadYgEE1BWFcXl+hhel43j5VorXCYEjMDQc7cpH9A+J7g9mcyQ8t/UZNOs03NHZy/OlcmtL5pKPd/roOhWOPwRq/25fNCjmqTDt0aVzNUlT5w9kKKRm6Zh5PQCCRsSiYBs5ye/yuTBGhWGtJYk4rdGWbXDncXuDWKgrDPQWgjoWfzXCw/H6KqPBRy2IViy9ZnMKtuBCkvWE87Z5pcH6b8oFYfGd8KkgIy4+Sg9tgJYUwkHkxc07nfayl6oZJXz+SGfG3E/PGEeohakA3BqruwA4d1vr+wd3vAovFG22NTzkNsvon3pAInC4efM9DRJhL9JveCS2py82tZMC22Z9NIzImvlfim+N/jUZ0i2riGCS3eAhiDkhPUW+lud/jbjAofS+jv6kWZQEj0L+2aZgHNbVYz45FXStNyZVgkAp9q58NPMcMm9h4KT2yy/7PHEmAGbHgnrmteUzs3KEFky5EHn1DahkR3ESKCSjlHB6Er5GeVaRBc3G6r0fB8EmZ7B4FrVFU7vvTEGANsvFdt+s4HjkbDEE8hL4mYT5proljht+y583L5gd+/3pPLtOJuo5OCkeaWN1JI1POohhudPZC7nSA7f55Qdf5X29S15YIOeELoOxxGyMRdPYQ7l2l6vDdKYdDlZMFReBicgJlETvLC8F/Pfpqi1SRr+xhZYlU2FrgCk7H9Zt35yF64UBEhf5HJfoEH2FxWqjXK+J2Y4k6cBXg6cyYyALOfYkVkotfU8tX/XcuAXG9O07ssTc7VEtKHDRkTzomLUNyFJqohUZU2VwPPP4uVwjTCCOO4dj7zEgHSxsbbbLzZvvFIA/RIAujL4JfW/1NkdYnnHroJtSelZzjem9wTXh1USM+aqbLcRGcbPPO5ZFV/dwWysdPi8E5LvkrjtMDUuZsJNh5YLfQwh46w0NBW3qJbXPGkSlmW/7p97Y01xfRUuP5W6MaQSg4KH1pSvaCddbh3c4OzN4J4Z15ggNIWm+aAphif4l3UtQaQBL2w4tA91YVYQ9NVMExvZ3KUstS43222LQwmsSqtqIpUhOlSbNqs9Zof/7ZsRcNUu55nqqS3DTormcLGSO9ooR200SRXFntZwHQ2w== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 53952de6-b5f9-495d-b2bd-08da009a7fab X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Mar 2022 00:27:59.4206 (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: oyzu53WnMxJ4Zubhw4b2VpeNY2CoyBLO5cPzJdzF7YH346gnd6MJaNNZEERmjWroJlvZ1foXrSkKLnaLBWLFSeXWI7eHi/fDrOCHvfjPPOw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB2809 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10279 signatures=690470 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxscore=0 suspectscore=0 bulkscore=0 mlxlogscore=999 adultscore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2203070121 X-Proofpoint-ORIG-GUID: XTQbcyllOQQqR9ebzTB9cWWKvGZCq9Vx X-Proofpoint-GUID: XTQbcyllOQQqR9ebzTB9cWWKvGZCq9Vx 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: Lee Duncan Signed-off-by: Mike Christie Reviewed-by: Wu Bo Reviewed-by: Lee Duncan --- 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 Tue Mar 8 00:27:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 549625 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 1C495C433EF for ; Tue, 8 Mar 2022 00:28:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233442AbiCHA3l (ORCPT ); Mon, 7 Mar 2022 19:29:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60066 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239319AbiCHA3M (ORCPT ); Mon, 7 Mar 2022 19:29:12 -0500 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80C7D25E9B for ; Mon, 7 Mar 2022 16:28:12 -0800 (PST) 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 227LGAes022335; Tue, 8 Mar 2022 00:28:05 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2021-07-09; bh=jQYCBCDDXzNRbCJkPDo0bZFgEvxpyXaqI9phr5yDp8c=; b=cdLiKs6t7IanrTbITbU5adxM5Fs51/Z9aA3sMJnRtuVMV+VrEXTjk3H44tfGfhyaJORd jsYrHevFVJ5BAmkmmL3CcOaWoJD5Xby90l6dvqXIxuNjyJrxB4wqC+7vnYmBiAclisco eB9+rHNAs9jmYAGticvEo2EevEpiNsPGmkuXT8Wx4YuPsrwl+98IC+Oz0huWSWdAICYf 0VBFeOekkSj6VUK/sIeSWyWXGuuRAhYWLi7BpSh+vY2iwxwA+3tQsqGBAOwhexL70AS+ OJ/mORDpBFfgGS5r9TZoqQgjZZ53tCLzkuHJgDmkThInj7FZK+QbkQMmLD1o3CtJsJTu fQ== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by mx0b-00069f02.pphosted.com with ESMTP id 3ekxf0njg4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 08 Mar 2022 00:28:05 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.1.2/8.16.1.2) with SMTP id 2280AKl0134578; Tue, 8 Mar 2022 00:28:03 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2108.outbound.protection.outlook.com [104.47.70.108]) by userp3030.oracle.com with ESMTP id 3ekvyu3hs1-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 08 Mar 2022 00:28:03 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Lv61+1k6Px6kUgnyYacz36xQPdmPw/gOIdDCUBh8iUd464FMDWK3DDPHnR6U65bWccSX05wBWWvBGuOWTLmc47e4/govJl5fAWTGyv8viQ6OIZ5KJzakKHx1M+ugis2C+L5dwoa6J9FEf47GYZJbLwxYYIrl+vOwG/K77LaAf24PZrOXrvjBVPr8dghXN8YNj5rVUKsS06CM1TSx8pWY8ZV7wCDNH3+GjW53Vuv2dCGYqL25J2ZV/+YC8C1dHwx4aauq2PNpGdxfbYqQmix0T9wtVCLBM7eAHkTP+jgjauXXwMmjKKbKKeqiAzdYi3i8fjwT0w9NuzwUIdhoqP/5Pg== 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=jQYCBCDDXzNRbCJkPDo0bZFgEvxpyXaqI9phr5yDp8c=; b=mLRl6z4JHjEMhvR70cyImUzrh96JsnW5jNDmC6kAR5NSoWfr/NNtrv6K75CrmghHK0aWRb5lV9Rv7DSRpOde2ZsOVmeU2yAaWhTUE1BWOaw+VWdMiuOrw0+kY611CaqBaq+WFfCTKxn+d/6m9bbvJoSGM/fQeqyFnsgrhcYWTMT2x0HwIpTWntWvCyg0zugmHOS0EOd4gA86ybtLfpDTc/i6Tss4w9iEbNZqKlwwufwvUrvU661qo6H7nCA5xWuV270PAPGn+gR7FBETEr7I177WerbWNT70ngh4VDC/6RSnH9Saaf4ctB1JPjRDTnjtqyoiN9sH4mRMd3TWbMOw5g== 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=jQYCBCDDXzNRbCJkPDo0bZFgEvxpyXaqI9phr5yDp8c=; b=u3Hoki3maKzTU1F0kf5Zy1i2FPiFzs/XcDveouKdznmvhAhraw/TbbP9Nv9DQvd4ciYWUlRL555MEo+mWiAJkD9dfJ9Lcqtph3oxcRn+ZUjwQUzYKC2YiHR9QLErk4AinJsFvFvGLov9pdcBofyRhWYkdXjSotlJI5OXDbuTrZo= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by DM6PR10MB2809.namprd10.prod.outlook.com (2603:10b6:5:63::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.14; Tue, 8 Mar 2022 00:28:01 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::3dd8:6b8:e2e6:c3a2]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::3dd8:6b8:e2e6:c3a2%12]) with mapi id 15.20.5038.027; Tue, 8 Mar 2022 00:28:01 +0000 From: Mike Christie To: lduncan@suse.com, cleech@redhat.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, jejb@linux.ibm.com Cc: Mike Christie Subject: [PATCH 09/12] scsi: iscsi: Remove iscsi_get_task back_lock requirement Date: Mon, 7 Mar 2022 18:27:44 -0600 Message-Id: <20220308002747.122682-10-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220308002747.122682-1-michael.christie@oracle.com> References: <20220308002747.122682-1-michael.christie@oracle.com> X-ClientProxiedBy: DS7PR05CA0025.namprd05.prod.outlook.com (2603:10b6:5:3b9::30) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e211ff84-b7f3-4f74-4d86-08da009a7fe7 X-MS-TrafficTypeDiagnostic: DM6PR10MB2809: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: XH5XChwnuNJIqoDbqamQKIFEiPhZJH3Oj1hsV3ZgYgMdcbwrspnAjFzMy0QucnRZMGemmu0gBjRPzgY0oNLN4O4FizSmJZ2niHzHRweLW6fGxl7c0HhqVg+oD4UwR7V5FOlZO6vDesZNgrXChxX+JykFvaiRSX1+nn9xeu75B1sXBG2sr+ftrC+0gA2LRI7b+x+5stVqm0LT/UV1iS8usC3qrXJ2kmysZ0UNKHmY3PZojfMIzc39pNaavwEMiU6nUiWCAd3XPHi2DzfP1CAvOyMpoYIO4fRGuyV9fXowRdAhXJ6k674P8pDji2XdSVsSY9bGvBvv0oZF50CXhlCi8hn2PqqfjcmKzIujXy9delSXV2HhZAtNTTyfo2uhVqFztvRMH6y4EQng/5omg3pdpoK343qsKT1dYfuSjRhC7AASnKE2eexvhTjy6qfmfWy7tykH/SaQGITTdGGKVVIKNaQMGnyQ0kVUwJEgc+e2HVWY3LCZjIIFT+vlZ94+fp2gvQsGTT6Bh7lxf2nNcMrcqdUgT/LBtPRIzSujAi65jSWY0kKZUtB44fQFVX35IJ30cXMH8Wkr0yH+Lz/mhELYLQxfKwKBpYJvyPtvHeIATuHVI0oSXg8+4rkmNU0KIbF/99bn3C9OSye7iH27PZv+jHxKGzEcoXTZ9uFlS6d+3eM5hby1m1SI7h/RYwEgKR1ViIuX/fhpXR82In171EAm7A== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(8676002)(66946007)(38100700002)(66476007)(38350700002)(2906002)(66556008)(4326008)(8936002)(5660300002)(6486002)(86362001)(316002)(508600001)(52116002)(6506007)(186003)(26005)(36756003)(83380400001)(6512007)(6666004)(1076003)(2616005)(107886003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: CREgJYEO6Sx+kCTQSQ9HYZLAXImguXpBF2qsd9+rKZDzSQaSQYzuX5cib1NQxVveEcFlRgEKS2Nog6XjZ/Zz9QVL1P+0WqiIccGTBIG0JXyKmjgFQTreFq53McTfeTQ2/chemKH3/9r5sZjphLuyZ4C1kIoPQkKPkcKY2oBQzUSufHVrG63eMj9lK+6QbueRuiM2xb7Vm+n/dOqoJd2hcz+7Ed51LDicIP0pQHzoIo399tjShpKLSwNpdvLRSufucbnp3f+Z5GCug39u/2qxmdqJNule9CQ3R14SmzVBRspgnc+psybs5bigL+VUOllZLZ0S4LXldSJ063mxBIE4t5LW4+v6CLSkFm8M6F99NzDOSKz9kQpMSzI8XFfokex/WdHdVw7YRgA3SzOEg/PIz1WY8pSbo+s4K5/Z8PldbuADrcLb0UvdDwgUWhllfvtaIPXdUn2VJi2VZXPo3gSqX0T3LlgWs3AKLtG8LdFYHrNjOSwKSxftHHrw6484NdOez0sr4g2crag2txdp9kTBEYXZot8ahAlsNj2LCk1lo/OE80vgMZ0yAU2IoUy4n7ZMeV3yVOwYnTHXgjbF7Edzb86blpLvCI9dBHqB3J46OPxTFfP4bVHA+kWW+qv7VKRpT23bmjZ5mj1lGL5qdswXD3weE7C6Ms6Rfzs6bBwxptIB/Sj6BAM9jNMo+XULXUkWiL7iXzp54waeQ+PeWXu4aCQW0Dz2ID08x3tAcvMZQkBDdDqgb+LLtM2iEyAprRpeoMzHyYEol9p5bD+uDgI4/CYh1X35lc5xG0cwAV7JauANou0KZqTzTCVQP5ZvOlq50bca8KFeE1uhc47Y4ItdaNmaDPziwN/1vOlbjAliOt3YT6OyvpxZhqYfbL323chzqmBDmlLU7/lK5nxBqPlGLqlS02EwHTqBimcLdBL3Pnl/d2nnHnLJtvdEoBtKH9BuitBUeLfEuFccjng0cPnVuDahwKeiV/zcnnldhNxqPVcjQ2rCWxOpdg7vSJaX5Rb93YQNIDchIcDOS/kyv1b3Ppl5om2HolOX5m7fo3DP2PD58SKmxjaXDYa0Kyn5kmaE5wO/cjMyP0k4FsECcI/CMKZ+ZgKw+2X82O9WX3Ns6+81juvLCy/dd3JN/yq3HhtToXB/LddyCLWRAuG0bp5GPFwM66MmdaDhKcik4qLbtDi5Zxg9Z0i3ugy2etbjN8JMYrAPII7jInZGpjbSh6gNK+kRpepRcVMkE1tDIJLhrilEA9ddkqkF2Wj6DYvoA6K0MdlTYN9TBfX2KDoMvI3/GXRxvC7yv1Ex8x0WBJEvXkWUwjBJ4Uy+yS4LpgYw2O4IE8CHqhcOpw0BtXWK6LeqVQfflaDsXETJMNJQHCi369oTIDPrnlsGEoJOiaVwX9zHHu7m97tqQiMpq/f1CJrkJyw/Yy3tuVOOuBXd6+Q44QmlStHYhjiuvjA+8f+1mkXfxTbomEjQL6cSGlpbFImMFl91c3dYdtwLP46DfFqZ6AKUlkXQVSDhiNy+WBJiWLeIylGxRRdb8xMdTY3t0WumnzzmmZVDLzVQOcQyFRirF6Qx7uTyw7e3qfJkGE0/D12RakTFCfwSQBY0F1YxenaZciS0j5oVOcvNy69+HwurWiVpFFdj21G0u7gYgUMP8cU2k+jpiFJF9nSO7fIdZRQ5dg== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: e211ff84-b7f3-4f74-4d86-08da009a7fe7 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Mar 2022 00:27:59.8425 (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: +I3w3F7wvo7CJZAikwFe+TyFHOAAGKtq08HUPBu2uYrC5mInsp+cGNU/cljH7w33N51oLrtP8GBzuCmUyt+aOs75Idu65SdJ7C8YgoustDY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB2809 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10279 signatures=690470 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxscore=0 suspectscore=0 bulkscore=0 mlxlogscore=999 adultscore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2203070121 X-Proofpoint-ORIG-GUID: dezRTd83BM6mDajSjP3p2rttNA_ncYa1 X-Proofpoint-GUID: dezRTd83BM6mDajSjP3p2rttNA_ncYa1 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 handing 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. By holding the back_lock while also accessing the task->state makes it simple to check that a cmd is completing and also get/put a refcount at the same time. 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. Signed-off-by: Mike Christie Reviewed-by: Lee Duncan Reviewed-by: Lee Duncan --- 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. */ + udelay(5); + 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 5 + 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); + udelay(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. */ + udelay(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 Tue Mar 8 00:27:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 549629 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 19AB8C433EF for ; Tue, 8 Mar 2022 00:28:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231913AbiCHA3K (ORCPT ); Mon, 7 Mar 2022 19:29:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59614 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230346AbiCHA3F (ORCPT ); Mon, 7 Mar 2022 19:29:05 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C331EB7E3 for ; Mon, 7 Mar 2022 16:28:10 -0800 (PST) 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 227L8Mei009301; Tue, 8 Mar 2022 00:28:05 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2021-07-09; bh=NkCLkD4MmjyDdDLtG67HYxRigQCWPWgbMU7ilXgdNCI=; b=lrmJT2MgkGJQXltuQxEyVAB7569srGnLPzpIdoSD20FEVxGeqjdLL3yT2j5WL9dMgJNb jZOp6zGd/rBVQX0xVlXrs7aUWAt3BnJji6XFC4h5DNxTc9qnEIQSMgZiBo5UfM8tGnax aDdtk//YR7tyYkamhIAmTb3R/OtBeIEGFstruapxDcwfjFJj9rxf2ERb6PPsgphFLAuS sMnJEU09gPp3TsVtMJqUDafraJN5XE9xPlGEEX8Kxk99tQ4CpwV4J4R9LMN9LlGzgjt/ Xytvm2D8dFH82UEh2YviyZtIGnigYeWKI2hYeY59bwnHUkqLShe4EJ3546dyTCoRxXzG IQ== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by mx0b-00069f02.pphosted.com with ESMTP id 3ekx9cdf49-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 08 Mar 2022 00:28:05 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.1.2/8.16.1.2) with SMTP id 2280AKl1134578; Tue, 8 Mar 2022 00:28:04 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2108.outbound.protection.outlook.com [104.47.70.108]) by userp3030.oracle.com with ESMTP id 3ekvyu3hs1-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 08 Mar 2022 00:28:04 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eiMwRZ6aioV+PaZPbUA3zbKmGcpjKteORJ0JA27OI2x9L3DQs5uFekXUak+9FU2ADVJl7KAbRZhvq3goFAmXobJIqLBaCJgyJJVT4kmAAyAjvrF0KWfgVQrnY4ZVRFlPiWqwQnbQevi6w7Lp4BYbHhPtSYSicFBdmoWr2ddShIDivtf7V6ItWLtqSt4Qj6BiLuKeqS4oAf435m/BrEpQx2NGIcPK4Lb9nZSV9KXHcAnDczcChG0btZl1hKURlc7gXrv2LyLCcMwhghKvkMRhFqBmNeysvQT6LW/UpZBvVpLVB4cgfTU4Ng4l3QgNFabTQY/RisKIDMno6ZOrz7nBdg== 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=NkCLkD4MmjyDdDLtG67HYxRigQCWPWgbMU7ilXgdNCI=; b=kUc7OuMpSnpvcCEgj/FXD1SkW4WkJyOJ7JUr834MfQqPd/O3VDBmrqM0RsBqx1HM8hIci2fDVxHbwMI9W+rx1bqVvtts2iIMzUS0ZsXkV6rMeWtWGTa4EpcUg7BcADKArRQT8EjlLUSTh9kIX2fECdII5Q30fa9UDMRwfFnGfkcBmuCBA9bjI4BkPaJVcfx0w7E2Gc/Yz+78M9DyaNdAbvOb9AygIPIpOE+LNUyiXgimw2wxIDJUvHq4kcF7nHAsUFIhbf9J7gdTHTKnGeF25BjJy61KmeFBuJ/8RGYfZW5aos0cCSKQkFOzk2URh1ijYM3Bj7+1BMSjOt8Z18Cvng== 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=NkCLkD4MmjyDdDLtG67HYxRigQCWPWgbMU7ilXgdNCI=; b=BXRj5wjdRol4FIb3nl9xQOF8fJBYHHrD3I7Oq9j4OZ5NUejAK8LghGUWI2mVA+XcMx5jNgMJF+Tq9jRA15mvNE7lDT0OWDcV8D3JdfTRFYUfG+amAklKX0u3soCbUdzLPng2IsxYxt+RGGSo0BUj+quuxrdjvEGJxDDzphhnVlc= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by DM6PR10MB2809.namprd10.prod.outlook.com (2603:10b6:5:63::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.14; Tue, 8 Mar 2022 00:28:01 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::3dd8:6b8:e2e6:c3a2]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::3dd8:6b8:e2e6:c3a2%12]) with mapi id 15.20.5038.027; Tue, 8 Mar 2022 00:28:01 +0000 From: Mike Christie To: lduncan@suse.com, cleech@redhat.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, jejb@linux.ibm.com Cc: Mike Christie Subject: [PATCH 10/12] scsi: iscsi: Try to avoid taking back_lock in xmit path Date: Mon, 7 Mar 2022 18:27:45 -0600 Message-Id: <20220308002747.122682-11-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220308002747.122682-1-michael.christie@oracle.com> References: <20220308002747.122682-1-michael.christie@oracle.com> X-ClientProxiedBy: DS7PR05CA0025.namprd05.prod.outlook.com (2603:10b6:5:3b9::30) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 605cdfef-e320-4978-4abb-08da009a8025 X-MS-TrafficTypeDiagnostic: DM6PR10MB2809: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: h2YYWxB9S2JWhek2pd7y87slL5xkOdJL1mG6H5whVYhSBIVe+BlyrwMkU/9nzcKIW03eSBkFP6FbmSk5RrrhUAx5iZSdjuHyyUFLTd7pztL4HYvFirVBiy59a15Q+y4qniboB5DHbM4yA008Ciz0i/kU9mrB9orBT/AvLM9vCDZs6swK4g3W9L5J9XtkiaFzPbpdov6MSiqmYU7ds9v5Il76SQUrd5jlYaj/QRlU7ckllHZ3q6RsuytvqlHLrNBkRaJC6maKYnSlnq8D3bo0raVqYTLOS/aw32fIs7u2voSNZvFw7JZ8ctMgB7r/jMA+sPWcD6NqLdcMMYN+kowJP5at1LJ9f6IWFC/JrCFF+EkpKsBKPiIIBa2VVsi7bd120riVbMI31n0haX+ERNnXi3Nw3nhYPENlso34PsKGZUSGPVRXsOGAxkc6HXSjtc38guDRsT/iBP1Y0pnmTW0wqvXTLrI7kNe9IlNzW45x8OtMGUsAw6US3PvBhNo2erCR7OBtluKIedvFJD6M3hy2SXwlkFDzQV4YnHdFXGOjD71taDQHxj6N+UisJbBxcpQBFCoYWrqvoLMLk0M/rUElxXZV+CXM4wJZzZNEciBx6cZ+SuGgrGTP9lnXkcKKOuObYIyRo3K9pSTMBMspT6TUiHlgAztSwdjMHMoa1v/zp2ODNLNUtgfzDaE2hVtoCiNPQqaQev+hcZhcs9eKQ/BXzg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(8676002)(66946007)(38100700002)(66476007)(38350700002)(2906002)(66556008)(4326008)(8936002)(5660300002)(6486002)(86362001)(316002)(508600001)(52116002)(6506007)(186003)(26005)(36756003)(83380400001)(6512007)(6666004)(1076003)(2616005)(107886003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: D6gtXj9aBJdl3RoF4otb150Tk/zFP1Wf12DUuNFqPf9YdfbpEi7F6tUtUFJZvZbSO9uqTk8aAHlDv6pdvNwA3oaxqOVjbwrC5KMaTq/I+mI3hob2kAucgd3nmGwrt9Cws+LJ6dDw2MPW5MNbH0xlhCRRiRFhy01aLSlkJN21tbf8DsXOqr5pVN1Tou94Ogf4sqLjXY8tk0WwHw+D0sRYiBNx7wwh5q4lTnHCkwKtw4pgex+L/Zaq7M8xg1Qi4LfRD13zNF1nmpvCb1wUCcXb5M8dv1Cdxvvo234rX5I+3YSajarHVYH0XbmzFsMhewJIA1X2KQw/v5nNRXTBp0Iypzr79IVk0qHfemUDzHiclGJ7KJp1zIvQqnx5Dn8g9J8nMQGIb4LbEcXp2/u1s9Pue5U4JofNH1WupEjWrQic7jEi2qEzoIvsLA3dXLSyJCpWcJ2Q60ORZQMGFQ6+pr3mIz2qAlJ4MT8hC63jdy99OvzaAozQcOVrXKar9Rpn3PHMms7Vsai5PrVXJU09mbmKjYct/FQ0UJDgMw4T2BRPGHnke1IoojUZ9lCEPLfLfp74UKb33v0HPs+Yt0SyCAsLAL+7kmQ8QEWbyEUB694vXQPVs0B95+rX7iG9lTgIcDfVhIQFz9C4oBFRGK2X0mOZYr7BTNbnmVsPUjH9pnsRhSVLjmWwCKVb27Ux679l3eotC77lxK54AMvhGDvBDvU60Kfg7z9Ti9JHXITJu8B5Zgq9V+8YBihoS5PfpDSqiW5CdjVpULpAl5o04ngHv2LZbyp5k/CoBwAcXE8MOl3yINF6bzruRRYNsGRznVPqJtsYMycBfuBO1RF9T+lm+S/Pr86aZ+dsugrf6hSBjtI94U5sZkL2xk9k2LsP3CU84eWHO1QRy5HS5rK3ie8KvP7HO2fw/GgXc01DNI3ZGYk2MHmKzQVqfo+2G9OhhcBB5hLfDmhL6zghr+cT9sBpwvN46YBdaAv6V+hZwx77v9Lz/QV3c/Uw3jnub4ruPImova4bm8wg036CWYZ6PmiYha7kynPMf6j78D2Ulz1KDHJdSK4Y9QkK6q3IgVH37q3uN7c1c51d2NEDaaTfp/DZkBb8emWKef/CQUBiLa+9hJGrCNxFAq89eoARPSbePI45CsnEHVzGr2furfGOyuI5XdAqy19tvsjSeYR0lzLoBVGDI+IbqDStTXe9SyiSmmPtqcjpTPtuWdhSObZjyV44ND1syH26rU1yuGprgrhmb6lM2iatevqQjZi6ImqWRTyMd1IPFO9rHuITB57HQQWCoCJPCzoMW0UTioFbnLxOlFaKrwe7lQY6sDwLZVqh9TK5pe1RSKImw+LOvq+cNDDOOEQ8FqLqklOi0atReDlzQTtVCARt9xrEBjWanTD7SllWpLPlvJ8qmV2pWc8J80y7jFHF4CUG25p1DljOD95Gd1rDKEhQMv1YG/fVpl4jnS7b9AQlrmkGzn3lNpyMe04l4R+oaARGD+7GcQaeJELjVkQfTfD6EpmPvh690U5KG9WMPuS7URAwAlCrA4jIdai+Hvbat/Ac+MMEa1eT0lotuHCWXeMupVCE45W+VmXwkD3AE5ji6x4DbASOFl5uPIFk1owxo6Xhpf4ay6SZ5KkOl26kU2nY2auqRi7lnANDEqJMFIdcb/AhmazvN4VK+/uaehzJgA== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 605cdfef-e320-4978-4abb-08da009a8025 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Mar 2022 00:28:00.2175 (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: VUsCsILEzWL7dBAqxrGnR1zMuurnwL9hpzUl9vBeBD15eZjUKrU2kLtczGacEpm9ccoGwZGPtJZwAmHzZDLwIu/Zm6JwJmujlMyhQOkdm/8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB2809 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10279 signatures=690470 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxscore=0 suspectscore=0 bulkscore=0 mlxlogscore=999 adultscore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2203070121 X-Proofpoint-ORIG-GUID: ETnuCd2TxOYKOhE93FhiYTQFo7DJiDD2 X-Proofpoint-GUID: ETnuCd2TxOYKOhE93FhiYTQFo7DJiDD2 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. Signed-off-by: Mike Christie Reviewed-by: Lee Duncan --- 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 Tue Mar 8 00:27:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 549627 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 BCBB7C433F5 for ; Tue, 8 Mar 2022 00:28:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244099AbiCHA3R (ORCPT ); Mon, 7 Mar 2022 19:29:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59684 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233943AbiCHA3G (ORCPT ); Mon, 7 Mar 2022 19:29:06 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 40CE92715B for ; Mon, 7 Mar 2022 16:28:11 -0800 (PST) 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 227L8Mej009301; Tue, 8 Mar 2022 00:28:06 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2021-07-09; bh=goRruGcVkEQo+F/UncRqU/pNkHQwTtve9jYrMqMS1Pg=; b=jeGRwwfqf3cOc6N88WBZ9KFCPHq4QWfes/QCNosjNWCiBPAVyuABT9ajI7z9LF5ARZ7F MH2GmQr3rBZtBbZK/Kcjl9M3Y4jIP+4zcBaHhDbMoILEIboCHAZRtINskk6AebJzHCuo aaTcjV+GZj7BJaClSmQxuA8bYrUaC81CkJqs8JD2j9Xm2JXrZFyvFJfVhEwGaYssOr2I ki7NLH0QZqv9P5pWEzZaVBM7xoxcYW16Ckf4FO+4Gtkrobg+dAFRC8uYfL/kuRw38d7i dC3FG/lNZakCLoEgg09lNRnJRCJCdyHFRP6QaFA4DRFHK1fVqEi3C4phVF0F8iPIFFbS XA== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by mx0b-00069f02.pphosted.com with ESMTP id 3ekx9cdf4a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 08 Mar 2022 00:28:05 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.1.2/8.16.1.2) with SMTP id 2280AKl2134578; Tue, 8 Mar 2022 00:28:04 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2108.outbound.protection.outlook.com [104.47.70.108]) by userp3030.oracle.com with ESMTP id 3ekvyu3hs1-5 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 08 Mar 2022 00:28:04 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VBorKfGmy8fc6yDlPvoTvrSfOtrQcgDN/9QOO9yXmLNdMrgn/xkOgAfVyTUjqDaqErSOL7QC8fkqb51RXmm67KdZ5eEmlcYRJPThYu+uvBqKhbJNaKAR+n8czfIrw1B/FaVsyC26vn9bbMK3ANhaPy606yr7vRN/lFxgx9yCkFGtu26Ij7ZgHiaADJoCVJduI5KN3LGMmdPovMDbY7N2+gd2O4pxaYw5+sXuFWAsLtK5mxZiaGEsNS8kwTf/AFe0TD2de8jadyMXAZ42bCZa+qYOV4gviHihvF/S8fqiPk+sn0PD1NkKENVQU0dVTwN4jHtzx4nI8h+eD1YNWAHVzw== 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=goRruGcVkEQo+F/UncRqU/pNkHQwTtve9jYrMqMS1Pg=; b=a9Dd+/JKARdEwvaLSQTovERrrcG+sUxWfrCOHgJHjkQr4JM/yRJmBE+AufYeZqh+WoDf7Ktd/mHJ63qcxz50untwK5IX/QCFJOh9TxDy8rQJLfRW4NiXveq+O2mzg16HppQ/j1BQ4RARjpBoP0zDKey4AJu4V/NRzEiW4uPgMe5KouA26FDtV/jLtiKbYt15yP2uVLUVrEW/iRjirJ29Fi3zrSfQhLuk43lXA0FRClT8U7aaD68gNHdgDx82ni4TRPv4hfd+xs7JPuIijiX/1r/kO2Vz2JfOIqI1hpKyEOpqOVcYS7hMpPdDWkMXhPHo5pr82mb68dOsaqVFztAkQQ== 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=goRruGcVkEQo+F/UncRqU/pNkHQwTtve9jYrMqMS1Pg=; b=D9WoXnc+x6iYTcUSrVGojMGTPDZzm2p+x1N1f6YgMtJ7olRDQNJceEoUEc28MDskLDuo2ndzcN2uDmaCDll8cW+wKGonhadhtH/kbZHF8b3S9ZMptn9jhYmzIxhWNd/Lbt8rmhngiShtkqKb0a1idl8DFB1Ws9LXiheqlYLpwuw= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by DM6PR10MB2809.namprd10.prod.outlook.com (2603:10b6:5:63::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.14; Tue, 8 Mar 2022 00:28:01 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::3dd8:6b8:e2e6:c3a2]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::3dd8:6b8:e2e6:c3a2%12]) with mapi id 15.20.5038.027; Tue, 8 Mar 2022 00:28:01 +0000 From: Mike Christie To: lduncan@suse.com, cleech@redhat.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, jejb@linux.ibm.com Cc: Mike Christie Subject: [PATCH 11/12] scsi: libiscsi: improve conn_send_pdu API Date: Mon, 7 Mar 2022 18:27:46 -0600 Message-Id: <20220308002747.122682-12-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220308002747.122682-1-michael.christie@oracle.com> References: <20220308002747.122682-1-michael.christie@oracle.com> X-ClientProxiedBy: DS7PR05CA0025.namprd05.prod.outlook.com (2603:10b6:5:3b9::30) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1e106d56-96d0-4ea5-3398-08da009a806f X-MS-TrafficTypeDiagnostic: DM6PR10MB2809: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: 8fRis3KBh9bEpa2mnFCLLjjnp6/JlpAyTBR2v49H/Dq5lgqwBE9sTe8s6WIoCfT+yAVFIyLn0iC6UFft0nBN3DzXZyubHY8LYewmG1QS430bnbkN4VA33kdlrfb1gVTVXEiODLAXzJ1d4esMlXkDRwDvGTREKOAcYpXT1LTDpaGPClZ60p/4hbaGU3CLiKfiP8R8EV6mshqsDs3LibhXn+viNSAiWtTeMXnmCjuOvIYkgmqw9m8Nj/mwuqSN4Tna7Bhs7hK+uwNWDxtQkhxUinGfyWIGsbtFwPjiKvlC//2m3XCr4ZswNYB+85apQ4km8oDm54HGGnCR3V4MuYN9XZLcYQge79wD2PLM0/+i/5eILRIQMwGuXtRwZC+5YZY0LQb2aQDlwFv1E1mytMm+z7h8hi9F3ban2d57ELMibAyFMSGgiZevtlieb+zvkWoyW+yFet4US0DfZcm0KjADIetpEtYROKfrng1wdMB+UaiXJVb3GAQsY3nP40+EJKpkzwQQTmPRK046yKzNkt+1Y/u6oy5PSOzVbSxXs3HQa3FSVgzIS5z0Ul1l65jZKv9H/ghC8Rb19JzENIfKmqNc6oH3Pc/lI/61oZK5ou5jq7qOgJjS9o40BFvjwsEVzlJt+NiszI7/UB8bw0HZ0c6VbEX0QnVAqJvfjkLfiw4pcXmCrM0vdh21Z3X5U7zfdQlCdlXjLLY8JJJRHovaMNlsUQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(8676002)(66946007)(38100700002)(66476007)(38350700002)(2906002)(66556008)(4326008)(8936002)(5660300002)(6486002)(86362001)(316002)(508600001)(52116002)(6506007)(186003)(26005)(36756003)(83380400001)(6512007)(6666004)(1076003)(2616005)(107886003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: rFGj7PGIYRP/R2Hz2wCyMsBJZe0rty1X+cuWtbiLCtFGcpNOKf2mlg0KTzAvZp1WgWL7iGZjPqOwTbfA46kUH2aevoe1F9j5MSPL8/XPhm6itXPiMoK6qJi2Er7a9nZOnNWLD0MrdDnbAISENPjhlzEMvEIhbDDAn65B2Dr9TaY7//wSGc0jPm9sYTKSbcWYfpL6qfk1tX47xIra+/3CtaAwk0Jb0qiJikiEwgGEfP30qZmMVk/V0hV/MOyeIfYI22ujEb60wm+rt9TPcHcEUlWMUtjhKSqzARtyuHIpcXVLUmDUYchgIfJ9VuM95ASZZvPfyB/eF7NjhGqlQ2BpR3BrEreEw1+sFhh1uKtYosg4dkUtrPp3S+8UBEYdh0vGIkWySp1MsvceMwAPJw+qNjVzIpvLWh20E/QHUupciDcig5L9jl3nsnn6fRxT/BIh0FXwtUxLeu0ejYmWCpP+fg83Lw40uRCQ32rO/QPu4Zrh+IPULLfGlJChkpidORVs6GG+1J96e79N/roJQq4+q0Dc07ZZgWvH6OCeV+WQ0Xm5T1/hPAmtkfOgh3aS0T3YaAXmdiBtcTiQSnuL3r2cPuIMOkxmODr/xO6QDYsZHaG0h2L1f+kEn0LCxP2SZ0LyXL4f5kHQb3DtLKsaLzQBcHN6nrI8LO/vMwZSq3Zl4OR9VX53GQo16b4ucBsadtkYcA4Jw9uXDNEDimt1ZsbbDMzngCa9DnRULobwG7ywIq4vGQWZfE2T/M1XflyCYUa/yaNzD90t24g7a/jhVWL04RaO6QZ2wLdfuIMD5KPHEDtWNsDnz5KnVU4abBAM10YpT2o5m7nrBLN4Ma7NNbTfOPim5c/tVAp8NROPEqBqDMyr6GCDF3/EOfuQeo4n6l8ccfQqPXCFgxp1RfsJ/NDJDYlAhD1XPMSn8QnVzPo0f3sCcabNicMtgMINjWSencVNmx5ctoixY4VBdLn7JV6bDLcrot42KbBU5/o193Tg3syfrQpH1hAQDeQ2g+lDWHYzfM+Cr0t6GcqLt9vFpafI4FWU/i2lTVUv/adhjaBvk+NSOqivx4bY/kAjMKZLb9DSXYHG60MrLJe9LLrdrsBoyIJwZ01rXspsIjfdrnBJg9FvffV7fVrgWJYUH9241UrLuMbmFHgWB3TrIPmAHBxtRQz6eqd15/t4OYScoE4Lhq9Btyje18dQFuFhFaLDsmkBDA4F3Cbn1cJVkE3I1+a6Wo92Jpm0Bcj98lNSbHerTWY9CmhjRzRVx7D1sbPIlYTtqd445RpqJf9yG1yRsBvuvTUeSAeyKBhw7LBXKOkZ7+EkjB0HZYWv7PXd4OEVfaWb/6vPSi/zr23awfUSGK5i+jVSblz/Zib8HCMbsYzVYJ8vP1pCuVwnOVjB8ev/6NBcjXju+bSXZI+fqqBgBy549ZInNv0lZpOYaSCqtxJrpVxKlYgMtQ2UbxNx3BGcd1sDjwv8Q8yHGOEgi6Nl84DABe7r1YnvxPFvv0uymKvr0EuvhhaQqykx7uDke8SyetPuE9ro4q8RpS8rbqjcuXImNsrd0wq3b5j/gGpN92EHXlfu1iJXMCwL5SAgPKuRtxLgND831aIRhOYe16K0TsNxGs2QwwK33xXEVgfwohd0yqRHhTmorcQW+3TnSviRnpXS5g50ta3aDsatAYsvUv54Qg== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1e106d56-96d0-4ea5-3398-08da009a806f X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Mar 2022 00:28:00.7487 (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: Nap4mQ6Z055pPBLMs7aIzwwQrw07m+hzlVBDdbp0tSfXMZRiOTyhfiVgB6w0P4XQWWfmXZoesgML7BqVYAbgciadD1ud6oi1g2SP9c/20zY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB2809 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10279 signatures=690470 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxscore=0 suspectscore=0 bulkscore=0 mlxlogscore=999 adultscore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2203070121 X-Proofpoint-ORIG-GUID: PbYkpdQ8xEzFjcrnNj2j4ADk4dhfGJRx X-Proofpoint-GUID: PbYkpdQ8xEzFjcrnNj2j4ADk4dhfGJRx 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. Signed-off-by: Mike Christie Reviewed-by: Lee Duncan --- 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 Tue Mar 8 00:27:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 550025 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 5ACA9C433F5 for ; Tue, 8 Mar 2022 00:28:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244162AbiCHA3k (ORCPT ); Mon, 7 Mar 2022 19:29:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60068 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238792AbiCHA3M (ORCPT ); Mon, 7 Mar 2022 19:29:12 -0500 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0B33220F1 for ; Mon, 7 Mar 2022 16:28:13 -0800 (PST) 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 227LM0Bv031943; Tue, 8 Mar 2022 00:28:07 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2021-07-09; bh=O4WvJaFnvoepKgzLrfrUUr1dyz8nRGu4XdkevVpVDvs=; b=JFFGY65JPrMkmEXpuOhAWhwtL/SHpc4r3NdchiD1o/Kz2TXvrGqgfbiJ63bxR5YPiZ18 TComcXq1t3Bgu195pOlNmb+rObqAj54zGcDNsq4u/VPTjsnU54OJzVQ0DJnuPEZBODNA DVaQt6WCh+dgXGzQTa9gFU2jujYSy0NK4Iob+hkZMFUKmT21yC5AmyayEX+HqyuV2lO8 C1L/EHs+WnmXjEKUZdtA2acB+tDGHwCRh0FitZEmmpkqz4v1jrcuyYs81yAjmzEpEYz2 pG6+WZMVshlGSiGRC8KQpJ0JlOLcqLxxHmzKHmwomKFncH8DhBPXL3gMeLTEVXvVDAXH 6A== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by mx0b-00069f02.pphosted.com with ESMTP id 3ekyranbun-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 08 Mar 2022 00:28:06 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.1.2/8.16.1.2) with SMTP id 2280AKl3134578; Tue, 8 Mar 2022 00:28:05 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2108.outbound.protection.outlook.com [104.47.70.108]) by userp3030.oracle.com with ESMTP id 3ekvyu3hs1-6 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 08 Mar 2022 00:28:05 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UANwHla2sj1gh8oW9SBC2347lnmDhua/5+5eLfvJzOT3sPjtopfh+i4+UitXrrYg59wyLAt8XivHTxlyh4Fj2Q+J2GJxHzr8lAO/2Z8AEKIVY9B27p0SGkfyLWdB44OjRBEHuEb9VXarNec0IPy4QKcp6ksxH2nigi4nnKF+VoEfle18eA8kSwgw2Hq1d9mMRrtYfQBDVsF5jyHrzg8OPJjRGBtQQgOv5NDzDmbs1Td0WVr71Xmp2RQvl0uFGTjP6y2oC2TEuhbgHFAl2ERPi/yoYj5ZTfUbWE673nYaoO/qZoNfcEwpwKjGiiYHYaqTBQd9s1/BqlWCx7+tZidxHw== 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=O4WvJaFnvoepKgzLrfrUUr1dyz8nRGu4XdkevVpVDvs=; b=KOHoYbT4EeXKLqQawWvnwaOFkT1n0c5Zj8ZE/0+Lxcs26aSlqG5G8WtPagYibWzHfv9jsaMbNKEQ8NMg82NPegz5ir3ZdqPlVOkxgLEi8hBrx4nT3SB/ROP9d1Ne09e5nceBlF0RE21cKJ7TVHk/D5D3FiWFJCXiZnpXI2o7NQ/Oaf4uiRuyoMqfgUK/7hiP/jaHe7arrtrf9kM8A7XTv5eDWSkaCnVdLLkMTPtFmlzqtdG437ZI8AAOlJ9oNaGEExExyIcCsbgipR24TZ2csnt8qfxouOO5JcL3m8ilxOnEJ1KY1cveHyn/He6Akn+o5aNvCReZgHyppDiOPRWaoQ== 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=O4WvJaFnvoepKgzLrfrUUr1dyz8nRGu4XdkevVpVDvs=; b=ieiV/UYDGth74uTsQ+qZioZkdqL0p8/+hCYNyB4Ayk8IbJNE5Jo+GmwiOfjwX49PGbrIUKFtKNsyKQHjYz0PMK1qMwpntVXUEMeFDKTDg6xSYFXux9+3PHMLeZ27VyRfhwb+VbokuGIH7Ojazq+rfGu2bFKrrVH3PZD33j/Z8iQ= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by DM6PR10MB2809.namprd10.prod.outlook.com (2603:10b6:5:63::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.14; Tue, 8 Mar 2022 00:28:02 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::3dd8:6b8:e2e6:c3a2]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::3dd8:6b8:e2e6:c3a2%12]) with mapi id 15.20.5038.027; Tue, 8 Mar 2022 00:28:02 +0000 From: Mike Christie To: lduncan@suse.com, cleech@redhat.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, jejb@linux.ibm.com Cc: Mike Christie Subject: [PATCH 12/12] scsi: iscsi: Fix race between recovery and task xmit. Date: Mon, 7 Mar 2022 18:27:47 -0600 Message-Id: <20220308002747.122682-13-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220308002747.122682-1-michael.christie@oracle.com> References: <20220308002747.122682-1-michael.christie@oracle.com> X-ClientProxiedBy: DS7PR05CA0025.namprd05.prod.outlook.com (2603:10b6:5:3b9::30) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 217bfd14-6b59-4085-9315-08da009a80af X-MS-TrafficTypeDiagnostic: DM6PR10MB2809: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: uprGOJXARyrB8cZd7U3O1ke2gm+KhYz1zblJWD0IvlMMASOfsav0IZPoUohLAJuKJIuE6x1TXmC7I7fXXomNgy0YKJ71ZJxiAWHbPUN0Sl3coENrFMdWyHq8j+aF6NW5/h2l9bbYxy0KMUPDmUvjQ8Ri6mo5I0oV8Wp3+ZM1ACkGYeGatnK72Sl1qL4uS76tN9C8Bq+l8K7XF5HcaPeH/6AoPqwvhsKRRVlzz/rSL0NM0iO3cSuS15/sert1J2ESxSrIhWjCi/Zcs715vL7SJmyW4bFxSrBhTBJe2jvNmiaxgaiHW/qRl6l1swVffGGby07igRIwpRZd8jOrKYdBZIYQgAIP3UZ9hJJ5nYYN7EbR7y1j/aZT3Mj2ISxZm9UMvaUjHZW7BrLo374dwiK37Xto65jkZmnY3IwqAwLup79GLfN9Vhkfob3tQseQxEpX4IKN9SC+AYQt8cP24kgYV7io6zTJbGhuvsv3i6qv8AdcBaiILLXpnDL3MEem7UFlmL5CLIs22eGHtH5ECD+8bdAoQ44z4ip4Eiwn11O/WLFXX+Ole/iCk941zfTfP47Jn++6pARZoOlhJCnewTBPayvFTRZa/JQHONe015Hlxqv3j3Tg0B0qULir/MDVb+2gsZoyeyeBjw5n2/kig9XWl/Rx7x7yWz6n8xmO3KhPahI+mxXIb4h6nSyb6U8kLay25K3pPCnTmHRo2SCBTbxTYQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(8676002)(66946007)(38100700002)(66476007)(38350700002)(2906002)(66556008)(4326008)(8936002)(5660300002)(6486002)(86362001)(316002)(508600001)(52116002)(6506007)(186003)(26005)(36756003)(83380400001)(6512007)(6666004)(1076003)(2616005)(107886003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 2gZ4AVM4uo/TAIZ9RXmYGuR+oNG7j5ekmANA8JB7NDsQNSefMYKfh/m4QGL8MPZQ6VKXTZ1WgXPyaj0QhJ4gvKYNvkMCeHOCZEyMe+gA8nVyEtUVAaZsb0y+OTqZfVSMbbqRti4UPM2cRrGtaOheyA+JdrDv3ftj4q9S2jBiF8X2dBylUwO/ArTv0h9rmKR2XR8he7JjyloEtNClYS+NvCEm+G33Bv5TSIidQjar+seNsTdAbZmiTsV8tcLG2Etma/MsvtXUw+ZVziKC9sG3oiT0HEptI4hKqjoDFignNahjzGNcOgydUIjkj4QX6upyhlFp6xq7dKJ2TyfAqg9XBF0jzeRZm1sWPndiQnK8uzGjFm4DjEU9/oWX3JE/7WSOTAB5kJxqLl4ShAETFNQ/YusxQCHhpHiuIUARthQj3xz8p06k9GNlw/lhInxf7ebfp5cWww6Yx8uNFv2Dh3O1QTxqeu+eYsQQKiqH3wJ2JTNbspm/WPVK/xMZ6POcWeqyR9gmFS1zL8ad7hS975lRrL2ggC8+bajNKoBNkcWQIjlx/5grqir9LPFqEPH02RCYL/EhTCCi42Lb3DsFWVU76nkYZolFhPEuSTDrDsNHjQB87TfVAsBh9tWrycGyMfu3k9wjdlMYKKtJy6bEEaT3ifCspWS58mj8koQnpsBuFwOOa3+BCkyDCIva4bwJoo+qmObNowzK24R/beT8qxB5cNDAm7Ul+ccBmLMXOaFp3LIPhzGScQzUCaMDj8LkncUvCsfjjj3LaATUuHr1qJuRVC5bKbgG2Hvjrkb8ZZjv+SQGIDeP88xQCwl+yxvzOHxuNDRPf9zhWnhCC7CaSTKWtkWYx9zfFEUJDj+aCX84iBOJFPeYwwZ5bPZDZatXTyj8BFsZmir2B+Kl0nHVn81cRXGmzxoS9finquIx31Ve8/3p864/g1wzb5lf/Z6fdQt1MHSLFfFtxOw2ko9/L0YZ0d29Dsw4A44dRBWqbUQBH8bjDFBP+6I8Ej6JVuzG4jv6djAZtawoZtmbVLQ+X9C9daVrT9+GwHDuONNhu0gOSjlo8Pl0txnGiGzAYDLbwdY9Fbf5g9Q7W1nGn16YVQEGdOb/Fit+36SGkE5QObE3dD0eHTfP6O9HBTNq/Lunj6p09XB2SyCXcDVJecCnB80kNHzSuI66LLVFK1sA6LJljy57e8bb7bn7CTedIVmSm7KmopcS5dW9PJY336X4TVAQWlWc+jtLHrH4tlPbP1YsWY8tKgTkahhcWZtYLcSjsAiP9DuSmxnxldH9t39u0OdIojZdlL+om3Sgb5kXTiHHfj0cd7/aZjLDnscNe25zQO5L2bL6gYRRZfXQG1bnYwSGIOTfXLQoErb5ZWWuNpX8ktc5e5C/GSTbOoDxD9vU3gdlRk056FPzedrUFJ4e9oA0upVOmR4ow18huNZZEulYPanr1R3r80a+gT2jSBpu+WzyChLv1YUHQSGaSD0Z2sJPiDV6fj1SW0mJ/Jz0Vi0VxXGEkz6L9ySPgEGlapPPxYs6cMjT2mkpiy6FbXUoIOwYhZZ68Ef9n1/Ol0HQjiSSb53fblz712BhDGFa56x+y7+ovmFELDvqgN3WLMIeR6Qnj2SEhgutaAfQU2sBwsbqVuOLgzVket2MO5SRNxW/F314CC9HksKAs/TRvEZocJya8A== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 217bfd14-6b59-4085-9315-08da009a80af X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Mar 2022 00:28:01.1237 (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: f8BgdKOL7eF5Prr982nEGXide+IYhw9DjDaOi+IDZbsyuN+GMnxxWXktLrAx8xF6wjqBIvFh3FJKSTnf5zHtXvR2DoDXLbr+bzh99Z2xycM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB2809 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10279 signatures=690470 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxscore=0 suspectscore=0 bulkscore=0 mlxlogscore=999 adultscore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2203070121 X-Proofpoint-GUID: aJWtiznAtHv6nKKFIdWk10_v_Ah-hbbm X-Proofpoint-ORIG-GUID: aJWtiznAtHv6nKKFIdWk10_v_Ah-hbbm 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. Signed-off-by: Mike Christie Reviewed-by: Lee Duncan --- 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); }