From patchwork Wed Jun 9 05:55:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Khoje X-Patchwork-Id: 12309009 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9FD8BC48BCF for ; Wed, 9 Jun 2021 05:55:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8074A61364 for ; Wed, 9 Jun 2021 05:55:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230261AbhFIF5v (ORCPT ); Wed, 9 Jun 2021 01:57:51 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:53072 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229942AbhFIF5t (ORCPT ); Wed, 9 Jun 2021 01:57:49 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 1595p4UQ052304; Wed, 9 Jun 2021 05:55:52 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=vOKFHp5LBI7G1d+5RrJEj+q6UJgsg+h4nc8KyOkirA8=; b=trvgULrgX/sXQ8yIWx1orSr4SLEoBE/1/ehaSdOrseEoBHoonSYNsxiCcyAOk9zHoO0W y1Sj0uBzV8RRdpXU8/J9y78mQZ1espaPm2+hXpCGknYHR+vjQ4jnzZFpGR+JYTkDNKtT axboLBXYdKra2w6dayAbPjZnknGDVITgbrkKhvWRU2SuZ8S927s5SAjmjWpIP3iKA1Qk z9E37Ov3kbKr7utR24JyfhlOkEBuiGpFE9bac9sTzlr0mJbGXrV/YVPxZNsrB+ztBmZU JNpONlV2YyqjzbhsbAP9vJ+J3HZdD9mJ5LqeqQJm5k7coPm+VK4zi7EUvngfDpYXjDfN Mw== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2120.oracle.com with ESMTP id 3914qupg57-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 09 Jun 2021 05:55:52 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 1595oNqn106264; Wed, 9 Jun 2021 05:55:51 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2171.outbound.protection.outlook.com [104.47.59.171]) by userp3030.oracle.com with ESMTP id 38yxcvce2r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 09 Jun 2021 05:55:51 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TVvVSGNkM6eql6rKjkP9bAaUXKs2QlWNfQiodwX0GJJCpTJ7zNKqXaPUKLl43o4y9XoELVrNrXYT4B0b1m/XIWeSKPPjvfXkLe+4JdVeG029rVfEF/GzNP83Rwi+7/uBEOxut3UryzaNwKG72ihlobADvCRW0hhE4kbWVl5iRjDoFhipY85XqU5jkLPgj4bjRrjsJPiDHpeTrgtwbeI+O/ggvkVzXJX/qJQHhFV/G1I1He6j9UHuEOurvmSSwxEi5S7+nH9bNvJ9/hfLvpAfDNGOnKVW9bpFO9TLn2K8Ihtj3QBkpSBBw+oQR2Eup5qcFHPdyYbOxZhQPGmIsXmnBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=vOKFHp5LBI7G1d+5RrJEj+q6UJgsg+h4nc8KyOkirA8=; b=AP11tcRa5OPp2IvVrxuM3iZUXGN1keV5KDMsF4jGLsDxgZYqSG9qdnjM8WsM1+tYOLciOTU7o4fkxDZgcIFea+3ZlMevOH0ho5bv3jXwf+ZYyBjse0DGVimZNU12gY/q/q3NIJxpYsvNJx2CIHH2oZRAAG0W26PgIK5X2COPPSbbTEt14MpnFrMsCpcPKh39klAEujRbOtBc7FZe2XeJom9QnusWRjIuun1htOTITRm2712CyHxM+vY42ojsu+1J0x/VJUJxhPB2o08VZYngFe8E5XlGivwdz3HlMifP9tUjbQfHxd2Bb49nLHYEqUjPyIJ+ZU5Ku7gnBtF5i6ac7w== 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=vOKFHp5LBI7G1d+5RrJEj+q6UJgsg+h4nc8KyOkirA8=; b=jPI6lWStf9KOOxx3PLwEmYnrMHAkVtuzxiyej+8J0SkMtjWEtlx0NjIGMFJT0BJpfEV1c74fTihu2AVJnOKgrvA6a4CIE9nB/iIRnbaLSoGSb6k/sco3nwpAp4FAq51vK9QoqMUNZTmcPT6F+rVq8Hkqxsj5jjRa1zt0o47+rYc= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=oracle.com; Received: from DM5PR1001MB2091.namprd10.prod.outlook.com (2603:10b6:4:2c::21) by DM5PR1001MB2217.namprd10.prod.outlook.com (2603:10b6:4:2e::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.20; Wed, 9 Jun 2021 05:55:49 +0000 Received: from DM5PR1001MB2091.namprd10.prod.outlook.com ([fe80::5c05:40f0:dbae:4c71]) by DM5PR1001MB2091.namprd10.prod.outlook.com ([fe80::5c05:40f0:dbae:4c71%5]) with mapi id 15.20.4173.029; Wed, 9 Jun 2021 05:55:49 +0000 From: Anand Khoje To: linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Cc: dledford@redhat.com, jgg@ziepe.ca, haakon.bugge@oracle.com, leon@kernel.org Subject: [PATCH v3 1/3] IB/core: Removed port validity check from ib_get_cached_subnet_prefix Date: Wed, 9 Jun 2021 11:25:32 +0530 Message-Id: <20210609055534.855-2-anand.a.khoje@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210609055534.855-1-anand.a.khoje@oracle.com> References: <20210609055534.855-1-anand.a.khoje@oracle.com> X-Originating-IP: [171.50.202.152] X-ClientProxiedBy: TYAPR01CA0029.jpnprd01.prod.outlook.com (2603:1096:404:28::17) To DM5PR1001MB2091.namprd10.prod.outlook.com (2603:10b6:4:2c::21) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from AAKHOJE-T480.in.oracle.com (171.50.202.152) by TYAPR01CA0029.jpnprd01.prod.outlook.com (2603:1096:404:28::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4219.21 via Frontend Transport; Wed, 9 Jun 2021 05:55:47 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1f7fe617-3687-4b5e-6f1c-08d92b0b3bac X-MS-TrafficTypeDiagnostic: DM5PR1001MB2217: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4303; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1tt52OYNeL4b0DEd/np0pSBFxxLT5h48h6Sxi9yRu7SWBjKI8T9RFxTTe3D7R8GYM6D8tRGXRHJSWl8+lkk+aqvLmn6F9E25h1I6sIu3pCTq7WPVNjVD+Ub8NenmDND3RsX1Lrwn2BrMHWTWr5pZQI5BcBAhXXRjfxidpvQavvqYmBwvbyniXNA5cGTClOJsmNMuhWViE37H6Ls/BkZ42dSUPC0retw03QgwYoADskrz95Douc3shjCfYN2XAPZQdr04sv4s5JcidKFdKiIg2sgzSK9JNvM2MnR+F6CUexMudMoq9NPNaz3RdbOsKckVw4C1UyOp3TIBxfWnw1bTEAPRnIBaLKk6bHxRigaS7k1PYNTYSg0KIj7DrCopbbwSA/Z2tH94NtMeJ1IYgwBV90aksfuT+dY0mNe9L4F7H4aSRoxVyLVMPOXXcUSwh1aplrFIsPo5v+dM9jOu2js4mJHUu1pSmVB3OTkFCAcN0BpzdJgHuRrUYGcKtLtYgRQ3NY4NgL6gBsVHr3JVAQnBMnS8VYO6R8hCCZHCgTTHCA8oj9YsRh5RVGtSMEywfrwxQX12oxemH5vLk3977owPmwDc59hAWAWoaWpwettFtLunipJo8/FjFZZz7K0g51iphQMQsGHDGmhqsoBbm9PbJqMGwRQprw6NbfMgyIJtTCs= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM5PR1001MB2091.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(396003)(376002)(39860400002)(136003)(366004)(346002)(956004)(2616005)(26005)(6486002)(1076003)(2906002)(316002)(5660300002)(8936002)(186003)(38100700002)(6666004)(16526019)(66556008)(38350700002)(86362001)(103116003)(66476007)(52116002)(7696005)(478600001)(83380400001)(4326008)(8676002)(36756003)(66946007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: pvIXxbMdMbWOo8RHhDv3Ht17B8x4P8s7FNvMHgXHx9UCRucjG3uP9FZJuO5DxIuL4DgcaNqh/tU/AHC3h+5y1lzF5lVMHdhp9DNxZvLE4eNP+dG+a/pu1b4LYQotnLJzaLwFFooldT9evxFYDZFQCGaUARq6U6zh2v5OehmUw9cPbQqS5cLRZP1fEPeawz450cJIgf09LkWCJyB2zFQwBYlHDfibx6+nsfeuB/DzLzvD2wT67I1LlxuT5iFU2BJtaHWfQg0PsLrPmqa5+ar1MxQCv2HiocV8uoG8EDjNQJQ7J28fkVcokKRx7DZpQCxuZWj6Md/XCkeu1XEZoFvp/rKNUvEsF3H0NhLEfNSacTA9T87AFxNF4Dnkjq2QufmQn0xogVQBiAZwZ/QBMAHlUgNMl28Ltme1G0hf07rwUafFXBSGIiNgCNNtSS+EREDzNEDUhgN444yUX6piMqLVKQexnZ9i7QFbAT3nwOc7J8PKDr+u/o+/d7yAKtxj89QJ0bxdsv0G/axSLV8JH9wTfo2eXWCbfwpsQT50NGiF2wOcFR6DGHpeuNnuxV4/nSm4s6qII4cSJZ3mnTZfAQg8P8Xik2pn1726HTPHLTRRNO/AcbbaLznXWceZLyDaGkYUU9q+4ci2mSOBy9ywtoRHGwp6PlAo8+Xqw4CdaFyJcbtxX+6IzK0gw/ksjm3SbH1pFMdX70ZKiy0HZVIBTMQQG5FrMH8lL1rfikv7AmReBe05Am4LEcIsmEmkJM0pi5Y7kahyjhHvIW6MjZbn/XMiz5rjsy5oKBJLBN79HBNpoaOOWU7StmZpCW8iMQr3It7/AKXwMAik2EwSaXbJc5m1UmFFfRdanpTkDVXWOnZMtygP5Mry3sz6m4OULszISWj/YONnJ6kUU2JSrkT7eWbI+u+9+C/X2m7KwxC4j9ENnxVz2c0tOftDF5g7vseHEzHDQoQUQdiLMcGBymNUpr6vvJIxVXNoeJIvGzL0U765sY82rZoR6VH+qLWCfpoUAl/6HbJWAhXpkwaSfIWoMOpPP6RIgVohUul8yTqeT2mZHS2KFwrpThEK7f93FBgXKfzbCQXl9Jf5nFHrOTKQqFH9OVoy5hSNbYnenHn/X/MfemzNxvbEACSx58lK6hZ1AEw0uY9yjnoDIgGWZp6Lmzmcib0mU/5IiHP/jOvZgPReXVxnb0ePeBQpUiD3Mg5JWDd8XWFhkZTHe6o3rmFBDNjYFBqRuVm+j0Zk1gCZ4wYQ0lc8lEwAHUNawH9HyLFPP9Wfkg11/e1IWgBk0foUyWSiqLr8jGtgceBFzBS0xnXwgmxWqB6qdMkaBrJ5kuJTgNF4 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1f7fe617-3687-4b5e-6f1c-08d92b0b3bac X-MS-Exchange-CrossTenant-AuthSource: DM5PR1001MB2091.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jun 2021 05:55:49.7865 (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: fQV9Wz6GTKyl6uHNKIP+EU/SzaLlo9rDdwV3quctHkjgij32tca2rKtObRJAt0bCqpdxIwo6VgH0/+XFjbfh63dyUw98OIju+dNxv7/1vqw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR1001MB2217 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=10009 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 bulkscore=0 mlxscore=0 spamscore=0 adultscore=0 mlxlogscore=999 suspectscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2106090018 X-Proofpoint-ORIG-GUID: G-hne0KJIVuObOZm6CyejLU47AnKxLGF X-Proofpoint-GUID: G-hne0KJIVuObOZm6CyejLU47AnKxLGF X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=10009 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 impostorscore=0 phishscore=0 spamscore=0 malwarescore=0 clxscore=1015 lowpriorityscore=0 priorityscore=1501 adultscore=0 mlxscore=0 mlxlogscore=999 bulkscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2106090018 Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org Removed port validity check from ib_get_cached_subnet_prefix() as this check is not needed because "port_num" is valid. Suggested-by: Leon Romanovsky Signed-off-by: Anand Khoje Signed-off-by: Haakon Bugge Reviewed-by: Leon Romanovsky --- v1 -> v2: - Added changes as per Leon's suggestion of removing port validity check from ib_get_cached_subnet_prefix(). - Split the v1 patch in 3 patches as per Leon's suggestion. v2 -> v3: - Added some formatting changes per Leon's suggestions and removed return from ib_get_cached_subnet_prefix. --- drivers/infiniband/core/cache.c | 6 +----- drivers/infiniband/core/core_priv.h | 2 +- drivers/infiniband/core/device.c | 13 ++++--------- drivers/infiniband/core/security.c | 7 ++----- 4 files changed, 8 insertions(+), 20 deletions(-) diff --git a/drivers/infiniband/core/cache.c b/drivers/infiniband/core/cache.c index 3b0991fedd81..e957f0c915a3 100644 --- a/drivers/infiniband/core/cache.c +++ b/drivers/infiniband/core/cache.c @@ -1069,19 +1069,15 @@ int ib_get_cached_pkey(struct ib_device *device, } EXPORT_SYMBOL(ib_get_cached_pkey); -int ib_get_cached_subnet_prefix(struct ib_device *device, u32 port_num, +void ib_get_cached_subnet_prefix(struct ib_device *device, u32 port_num, u64 *sn_pfx) { unsigned long flags; - if (!rdma_is_port_valid(device, port_num)) - return -EINVAL; - read_lock_irqsave(&device->cache_lock, flags); *sn_pfx = device->port_data[port_num].cache.subnet_prefix; read_unlock_irqrestore(&device->cache_lock, flags); - return 0; } EXPORT_SYMBOL(ib_get_cached_subnet_prefix); diff --git a/drivers/infiniband/core/core_priv.h b/drivers/infiniband/core/core_priv.h index 29809dd30041..0b23f50fa958 100644 --- a/drivers/infiniband/core/core_priv.h +++ b/drivers/infiniband/core/core_priv.h @@ -214,7 +214,7 @@ int ib_nl_handle_ip_res_resp(struct sk_buff *skb, struct nlmsghdr *nlh, struct netlink_ext_ack *extack); -int ib_get_cached_subnet_prefix(struct ib_device *device, +void ib_get_cached_subnet_prefix(struct ib_device *device, u32 port_num, u64 *sn_pfx); diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c index c660cef66ac6..595128b26c34 100644 --- a/drivers/infiniband/core/device.c +++ b/drivers/infiniband/core/device.c @@ -886,15 +886,10 @@ static void ib_policy_change_task(struct work_struct *work) rdma_for_each_port (dev, i) { u64 sp; - int ret = ib_get_cached_subnet_prefix(dev, - i, - &sp); - - WARN_ONCE(ret, - "ib_get_cached_subnet_prefix err: %d, this should never happen here\n", - ret); - if (!ret) - ib_security_cache_change(dev, i, sp); + + ib_get_cached_subnet_prefix(dev, i, &sp); + + ib_security_cache_change(dev, i, sp); } } up_read(&devices_rwsem); diff --git a/drivers/infiniband/core/security.c b/drivers/infiniband/core/security.c index e5a78d1a63c9..543391273b82 100644 --- a/drivers/infiniband/core/security.c +++ b/drivers/infiniband/core/security.c @@ -72,7 +72,7 @@ static int get_pkey_and_subnet_prefix(struct ib_port_pkey *pp, if (ret) return ret; - ret = ib_get_cached_subnet_prefix(dev, pp->port_num, subnet_prefix); + ib_get_cached_subnet_prefix(dev, pp->port_num, subnet_prefix); return ret; } @@ -664,10 +664,7 @@ static int ib_security_pkey_access(struct ib_device *dev, if (ret) return ret; - ret = ib_get_cached_subnet_prefix(dev, port_num, &subnet_prefix); - - if (ret) - return ret; + ib_get_cached_subnet_prefix(dev, port_num, &subnet_prefix); return security_ib_pkey_access(sec, subnet_prefix, pkey); } From patchwork Wed Jun 9 05:55:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Khoje X-Patchwork-Id: 12309011 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5AB1AC48BCF for ; Wed, 9 Jun 2021 05:56:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 44E94610A5 for ; Wed, 9 Jun 2021 05:56:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233411AbhFIF5y (ORCPT ); Wed, 9 Jun 2021 01:57:54 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:53100 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233146AbhFIF5x (ORCPT ); Wed, 9 Jun 2021 01:57:53 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 1595ovrj051925; Wed, 9 Jun 2021 05:55:55 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=zVO/ufUnpzdpLeNXWtf7p1UL46MNrXcF4o5Knb9saFw=; b=AUfR8kkOgvffQ0pU+1U/FztXBuRleolh/DTiMQwyPHyJHDO9okOTz/PixMldN/QVIl4c k0IROnXkmnsOMa6aFH6fEcjco64bX6/k2g+k7157v+cFeZhszi1K7RgGYJ5X2Q3Ir2w9 uoH+ebnMdXqG/LLdoNFhs9cGIp+WtwsJ1OtrkZ4M2TdEe8xxNGiESJYt7s17C0YdTfeM xARanfI5wjHJcf3j+fr+qCBvWzpgmIRkx71N375ZOXr0nl7V/JEUL0RC/T+LYE/Z/vbq scZ6OEPQaV3fZtT1SVwmcwSnDEEAUzXVHZzcatbou3kZifhvW228NxXIPwA45wZffGpu Qg== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2120.oracle.com with ESMTP id 3914qupg5a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 09 Jun 2021 05:55:55 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 1595oYX8160732; Wed, 9 Jun 2021 05:55:54 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2173.outbound.protection.outlook.com [104.47.59.173]) by aserp3020.oracle.com with ESMTP id 3922wty147-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 09 Jun 2021 05:55:54 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YuOIBJwZMrrzKoplf/Bbb6+NX4ydhqO0Y4x0R3ZA/RXIR7lNzV4A6pxjcoLb87uyq1I72PpYhvlRxhJTuPVCAdXWvaYMBdbSfKEtQ/lwamkIqQno3odG+35IpUSGUGUV0tSjhXvRcToEYrHpFAWCOO+ZaRiDw20yDe0XN34G0G6hGkmeBxaCFzk5YrW8kweeyd3K6VTrSwBXIRu3g0WwRrR3hxCo+dRteITdUyYcaE+QX0cTkFdGeSUgw/C2VKQvAda43bz9CFknol99kVlSEmeSFKF+ykpLHaur5whuCh3HIhWxxAt0qUz0fySFGFc79SdWGEYJI0WoHyXXH/s8EA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=zVO/ufUnpzdpLeNXWtf7p1UL46MNrXcF4o5Knb9saFw=; b=hi5IT9KzLfMEkrrMKldU75AEIIUMSUVWY4N9jsLtJ5ZjvgFjtE9z459PE2u3hWBYcCU7v3gfkJsdtMFBd4u5A9Wj4Hyyj/bNQQxH1ZUlSwMko/GT8pvVTXMVUNUDlM93OZqkDzaFBepSHtO4K1xeONmneUfWXAaIfH+i/KN2yKTT6C580SToM3H+rLwgzl2N9/42Wjp0W8pgp4Oktz4WKAEDVnY3qCG5QDGvSDz/neZSOXz3fZX10riUqmIebTla2kfDtMssVo9CmREnuxjY6tKfY78HBisp1om4dOsFItzUoIVRJfrNb4x7iijhnWH5UOp3MqY3eASQCLwbOAEMBQ== 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=zVO/ufUnpzdpLeNXWtf7p1UL46MNrXcF4o5Knb9saFw=; b=ZIfX+CnOcNK0IaJGgz2qbrWG24xYfRYl5pWbFM6Xt+JE1qDPJy99dw3iyFgsHXOxn7SrPEqNB+/QuxbXXaKgKVpyuVYqco6SVzEhTgAN93PpJb62r0zHNzvZcvFQbSoz7PHBGpFzbNhZWkqUVEk3877zTXWagIJ5uV05ALHep2s= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=oracle.com; Received: from DM5PR1001MB2091.namprd10.prod.outlook.com (2603:10b6:4:2c::21) by DM5PR1001MB2217.namprd10.prod.outlook.com (2603:10b6:4:2e::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.20; Wed, 9 Jun 2021 05:55:52 +0000 Received: from DM5PR1001MB2091.namprd10.prod.outlook.com ([fe80::5c05:40f0:dbae:4c71]) by DM5PR1001MB2091.namprd10.prod.outlook.com ([fe80::5c05:40f0:dbae:4c71%5]) with mapi id 15.20.4173.029; Wed, 9 Jun 2021 05:55:52 +0000 From: Anand Khoje To: linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Cc: dledford@redhat.com, jgg@ziepe.ca, haakon.bugge@oracle.com, leon@kernel.org Subject: [PATCH v3 2/3] IB/core: Shuffle locks in ib_port_data to save memory Date: Wed, 9 Jun 2021 11:25:33 +0530 Message-Id: <20210609055534.855-3-anand.a.khoje@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210609055534.855-1-anand.a.khoje@oracle.com> References: <20210609055534.855-1-anand.a.khoje@oracle.com> X-Originating-IP: [171.50.202.152] X-ClientProxiedBy: TYAPR01CA0029.jpnprd01.prod.outlook.com (2603:1096:404:28::17) To DM5PR1001MB2091.namprd10.prod.outlook.com (2603:10b6:4:2c::21) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from AAKHOJE-T480.in.oracle.com (171.50.202.152) by TYAPR01CA0029.jpnprd01.prod.outlook.com (2603:1096:404:28::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4219.21 via Frontend Transport; Wed, 9 Jun 2021 05:55:50 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7bcfe982-9aec-4ba9-ed27-08d92b0b3d5c X-MS-TrafficTypeDiagnostic: DM5PR1001MB2217: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4303; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: uga8rHmHjJH/m7FhVtuaUanYO8Fd3ACHEHKEGS+0koIPOGQj8i8BdDrgJNePZb8xKCxb1I7364dApm7osiE2o94kfgNQnjv2vZtoRpwQiToWRQ+cN+L2SzEBpYqtYziTvaY7oQOCv9WUsBuRfCkf0QHk4bLU2HqD8cTg4O5R2inOVtXTcC9xxPu+FsYQPMqm3P1epEALFHznv5rz40pKaj3CUiG4aSX+7/zpnShZvbs73bSrKFHlP7eM3KoGcpMj6KUXDKXBNpliU160wi0Tn1QHW1SchGB0D8n3yP5QD2iQLGOYm+5BChwi681hceVgBFHpf31EKeVWX9ht/9UVVbl2S89N4vKxJBlsE/Vx5DuhTD+yDb/uVHhLg4l0YZa11VDRe7wvQhSUB9kvpjwqknbhn5uneV5T2ue2HCqERpihChczoGBzxP95HGjajlJHarewe6lV/V8FfD2HJQW9aX20NAS0rRyRBDa62iIjtDeU+Q2l5iWsSewOQGHcDjwcIW6ZZKKmnl5DHfo542VtOQEVY0IcFx5E/6sI+moK73G2Yuq/60plM2EMZlbdGUqa5LQt94Nf3MegzAiVHEsMkKuJ++MkmZB++PW+BYfN8UbmpXwum1z1NrcwI9YE5YsNuzosFOFnFzOjm0tEoFm3KE2kP+74t2frUj1rLftgPi4= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM5PR1001MB2091.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(396003)(376002)(39860400002)(136003)(366004)(346002)(956004)(2616005)(26005)(6486002)(1076003)(2906002)(316002)(5660300002)(8936002)(186003)(38100700002)(6666004)(16526019)(66556008)(38350700002)(86362001)(103116003)(66476007)(52116002)(7696005)(478600001)(83380400001)(4326008)(8676002)(36756003)(66946007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 2duImkrJfHJOWGM1PLKhnCgdsyveMDe6UfbI2VcijRFVLaGO3DR3jXFufr6qs1BLcetWzsh1kao5bwkbnpM9fdEBKLv+Olp79LbI/PSO/OiO2s9RFB5NSjEUMlerF8KDwMK81PHxvIER7MNuRwNoopoDY7DBrcwEsUeXvWEYbQXoDf46kOhg5QRKNlwaODHQqul6lx1lb+Q0HoP44kJgt2oehvqlNYct5xS5V9Hbv/8HGA0Zm7g3yE4dsUSBss0MXTk53ce1IY2fO4ZBRX9eZwyA+hTdT7o2c5SmYH6dnYcF+uB8m8PKOJZGZ1Rxwzkl7+O7epKtFDrAKkUnRwO5ebbEx8wvUQmBbNPeuqUm/XXolD2enoqWvf6emwD2/F3yURC/bwiSfg4tPnjVFnMi2Zrd9RckjK+FJDZa/XYnlVltlRmVCsnmUgB80SBjdwNORf4jAE207vCPdu5z0BR8bGU+frtMpRtaIS9XEfvC+I9xOwdJdT+6nojmap+exxJUT9DjVhPmoC1o6vg995mQcmS0Ivf/rq/xV8no8M8xzCqbYBFw7faJu9wSGL/eNnh4ePL12F/Lexzt4fabgH1UBhdwyluqqlwxBg4JaFmi6QRAuupVnFJP8omgvOOIflPoFbiJ4kC/KOxkTIX9w8igjp3FnJ23UIx1f5kAEII5OykENNIWa7CWXSMOwhf6gFprj3ehKUT6GVaSRGcG8WOm4+khX2PJuGyAaFP7Zc4NPaMOP390avoi58ZAktPqbFGCF86bSbBAPKh0MxJAbIMdTPxMi/ytQ+ykgsm+v+Th/C5axiDUL6u0idmP87tJJCYdwVoWxL+eiVKMlc7QmA+wXC0L+1Dz/pz+XKJwwAQQe4AkG1506aoa7MbeMG+f2R5blbviqTWgUw5gysfb6ln8C8v4v7CVFJQBobXmLEsOy3T6ZXRx4UyUFa2RE6Xxc2nstdmqMZi1aF035osC6dP08MDaVkuogDlxvb1VwUwTaHl/T6BP6jl1O+31yBBG7ZmNIorQWm8kwqfyzeQ/zxHvoMVJrWrslXmBNdWhGxMYKlQB9FP5jTD0a2guulTRIAF1TtAyBiT/8BIHxP95JgBJkwZZQGck/H3qFlGL8kqkh1wylBcR974bshrrrJJgLJF5TVSRM4UXMKKqmxFiXMlpDw1KFP4BkucrxqFiWtaMmmhDmfPkwE7niMzqL6tqR657nku+VWuaej6jMAcFSSpW1pnk6FSl3sgbf3b/mfZ+L8D0tGV0d9RDMU0fhBzMtAsT8sbkeVQ57I3IEleL3QbjzxjnuZ5jiBgP9QhVnwuJVx7sYJnBYFf4ZTmvyJlRuiYB X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7bcfe982-9aec-4ba9-ed27-08d92b0b3d5c X-MS-Exchange-CrossTenant-AuthSource: DM5PR1001MB2091.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jun 2021 05:55:52.6279 (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: i5wl/yiQPbPz31saDP7/R//0hG3PADYjUnBi6TLXvUqAYsZxIaVqLlA9m4flzaWsMswMkTzZGflq66hGyYi83FjyNmKocN/z+/us2eny/u4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR1001MB2217 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=10009 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 suspectscore=0 malwarescore=0 mlxscore=0 spamscore=0 phishscore=0 bulkscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2106090018 X-Proofpoint-ORIG-GUID: g1-in51su9CCwx2kIcyY2ZIq7Uumor6j X-Proofpoint-GUID: g1-in51su9CCwx2kIcyY2ZIq7Uumor6j X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=10009 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 impostorscore=0 phishscore=0 spamscore=0 malwarescore=0 clxscore=1015 lowpriorityscore=0 priorityscore=1501 adultscore=0 mlxscore=0 mlxlogscore=999 bulkscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2106090018 Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org pahole shows two 4-byte holes in struct ib_port_data after pkey_list_lock and netdev_lock respectively. Shuffling the netdev_lock to be after pkey_list_lock, this shaves off eight bytes from the struct. Suggested-by: Haakon Bugge Signed-off-by: Anand Khoje Reviewed-by: Leon Romanovsky --- v1 -> v2: - Split the v1 patch in 3 patches as per Leon's suggestion. v2 -> v3: - No changes. --- drivers/infiniband/core/cache.c | 6 +----- include/rdma/ib_verbs.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h index 7e2f3699b898..41cbec516424 100644 --- a/include/rdma/ib_verbs.h +++ b/include/rdma/ib_verbs.h @@ -2175,11 +2175,13 @@ struct ib_port_data { struct ib_port_immutable immutable; spinlock_t pkey_list_lock; + + spinlock_t netdev_lock; + struct list_head pkey_list; struct ib_port_cache cache; - spinlock_t netdev_lock; struct net_device __rcu *netdev; struct hlist_node ndev_hash_link; struct rdma_port_counter port_counter; From patchwork Wed Jun 9 05:55:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Khoje X-Patchwork-Id: 12309013 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8DF6CC47095 for ; Wed, 9 Jun 2021 05:56:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 77F63610A5 for ; Wed, 9 Jun 2021 05:56:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233917AbhFIF5z (ORCPT ); Wed, 9 Jun 2021 01:57:55 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:54188 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229942AbhFIF5y (ORCPT ); Wed, 9 Jun 2021 01:57:54 -0400 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 1595oHsv112256; Wed, 9 Jun 2021 05:55:57 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=bSRuSEzERi/e6QasgFjbWYvgSIYkno2OGtGnZUB6wWw=; b=vJFMlU+ydxkJJxA2Si76Mn3WtoWjoeBpbAKC8qw3UP7uWyeWSNiq2gNN/DoTiVq5U80+ p0ygG9Q+zJae7U7mI+aeNxj9NTvF1x3iDVKAuEuPiur44CjujjmQPZ7WhlfTzypASdvK wrBk5bdSjc7aqIowZXiIISi7TUTNzogGrsZAwkxkrarREPa9ObNVMCr1NIue09wpZSak aDVHTQxRJ+j/ngB3HRrPH/Y+ldsCNwYm2hicCaaKzyziTqWGa8dXpl1NzjuXBLJonKrT 8ffsiH5MwLX1TR/MGoi0EaChjbeNoOnizQ+rVGaXWWddCB6MaBJWtqALR0uSkelrcbhK 7w== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by aserp2120.oracle.com with ESMTP id 39017nfymg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 09 Jun 2021 05:55:57 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 1595osCA061835; Wed, 9 Jun 2021 05:55:57 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2177.outbound.protection.outlook.com [104.47.59.177]) by aserp3030.oracle.com with ESMTP id 38yyabfkk5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 09 Jun 2021 05:55:57 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Bnd1rux/uJOjDQ+a0VbtHealTEyQQvo2edv0zGCykQWy6RGcL43GsRzuK9qxUXmag7SQYq2C3tZ/eL66mw/QQGUQVvjOxRf7+JJGPeO4C8sT8yhrHNpPiisBDoRUMYeSBw3oTPbRp94i/y8uS/UadVDEtSmXGPX4Is+HjA1Yaz/Ky5LtAGTrNQFwuRvoKEr/REVjrcqppLVn2eeVwbeNC0i1volnspFsEXR6YUPB3eUCnHew/y1gkORRAnz2JMz1+2GGMpmXOhen3KUaiiN7yXCGtG7TuS1qYriPKkGBzaTB4N2LBwmVlyN32e3bgYHup7+ZJcEW7qR7gYdY9BECmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=bSRuSEzERi/e6QasgFjbWYvgSIYkno2OGtGnZUB6wWw=; b=LLxsd4VLbqLt6h7xLZcmwNaAjJQNiM/cmD+PxT547+sTfhHQ17ZSCevajCyI7qmlWD9+e7I2xS2sERYX40a07RE61YCtM4fXH20sm4tO/n0KKk1lhV9LLVTIGcHPjUW0Ow7nrDrbFfZiD5LJ73bV3whTuWrhKVeBMAtibrmgRnKVbBcBlfIzZTGDYWcDmZ/RaraMIWTv8AxZyQJ3cwlHo47viGSKtJdw4ZWTvFpl6kalewq73ECEr6pqlIA5Q9qmu1RlrzxOwBaxWEiMXM9Mu8GMRBrPQFwn2N1+1jVOZch0P0a1bAMvPeF4i0XgRoDYU7RtYSl8c2jg4b6sG7SejQ== 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=bSRuSEzERi/e6QasgFjbWYvgSIYkno2OGtGnZUB6wWw=; b=OMj1DLP1RT/F9R29VQRXaFSC810yAE23ySf/lLs9CRu4W4Iepo50ma1tpTEtFEENE21qeX5Rhps0sk7xdz9EW2EisLU+esOSnLEEA9WkA+zsDuGfZ/wNbo+cNqEVnHU/Qfwd2wC6Jzy5/o5Aucfa0qYM0UuFBBmq3HCw4E06txo= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=oracle.com; Received: from DM5PR1001MB2091.namprd10.prod.outlook.com (2603:10b6:4:2c::21) by DM5PR1001MB2217.namprd10.prod.outlook.com (2603:10b6:4:2e::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.20; Wed, 9 Jun 2021 05:55:55 +0000 Received: from DM5PR1001MB2091.namprd10.prod.outlook.com ([fe80::5c05:40f0:dbae:4c71]) by DM5PR1001MB2091.namprd10.prod.outlook.com ([fe80::5c05:40f0:dbae:4c71%5]) with mapi id 15.20.4173.029; Wed, 9 Jun 2021 05:55:55 +0000 From: Anand Khoje To: linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Cc: dledford@redhat.com, jgg@ziepe.ca, haakon.bugge@oracle.com, leon@kernel.org Subject: [PATCH v3 3/3] IB/core: Obtain subnet_prefix from cache in IB devices. Date: Wed, 9 Jun 2021 11:25:34 +0530 Message-Id: <20210609055534.855-4-anand.a.khoje@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210609055534.855-1-anand.a.khoje@oracle.com> References: <20210609055534.855-1-anand.a.khoje@oracle.com> X-Originating-IP: [171.50.202.152] X-ClientProxiedBy: TYAPR01CA0029.jpnprd01.prod.outlook.com (2603:1096:404:28::17) To DM5PR1001MB2091.namprd10.prod.outlook.com (2603:10b6:4:2c::21) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from AAKHOJE-T480.in.oracle.com (171.50.202.152) by TYAPR01CA0029.jpnprd01.prod.outlook.com (2603:1096:404:28::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4219.21 via Frontend Transport; Wed, 9 Jun 2021 05:55:53 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ebb0239b-eb48-432b-7c7a-08d92b0b3f0e X-MS-TrafficTypeDiagnostic: DM5PR1001MB2217: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6108; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: oqIARSbBO9AISPSY0rU+Mvm0xzdJ2Y9LNkGpNrQ11Y6QuNno65ccHamuL2NMacGIJSSgho435Rq7OPQMrby9wOJZyL20gw7PK/Ctq7e8xzhdWfEB2POuM7JuSuE646g3MSwBuWQFzRQT3vEo3nq7aGzvtHR4t/H6p9RaMkkcBz4d1eHlRaiJYC7C1gl6zI22PGqnTdm0JO+hw58jRyP0N47kkDaGHWFcyL7OQ4lNWKo6jAgKghS3c9ygonz3pjp+FtD8mciMu22HyiIKHmk9a+gUebhyJQw3p9oaBZUj83cak4a8c/VppuXTpJxEsbviBXhPD9EeDXUlu8yU2CBaDFZbiMrpPQS5KMgpueybJrWy4iv+/e2zbuLzJKqFQQRWy8AxmPWNHj+3Zsnbb2EhzOpTSzLMr1iUUFbzT504S+S7rfzFtqVBSOU2APctpT5e3LWr/n041NT1leyVAt+frBB8ukV4uNyXeHSbXV5JvnrBKV4gDd7b4tdxgpYzANe4zb0vdjwRa9t3Sq4Kb9OtTcw0mh/9A4/0G2B6SkpEeaLUFfif/ruzbSopqU4r37iCfrK5stO13xSV0qOF9FeGK/fYUay2GhRAR0P67VR3fWMAixWJAPWFOT0SaC1sB01yc2DuNh7P+vVeIbHFjvxksw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM5PR1001MB2091.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(396003)(376002)(39860400002)(136003)(366004)(346002)(956004)(2616005)(26005)(6486002)(1076003)(2906002)(316002)(5660300002)(8936002)(186003)(38100700002)(6666004)(16526019)(66556008)(38350700002)(86362001)(103116003)(66476007)(52116002)(7696005)(478600001)(83380400001)(4326008)(8676002)(36756003)(66946007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 4sW/leAvBPh2fzD8eSHXVYSh30wGocwmGwcAjv0nsli63NW6Ei4PhN+G0zCpk4vbex5DeiAA7L9Ki/5T9sd0xXo9hUePAmQIQGqu9kiuMNaCxBKuvBN/7syMHW6u1l+KT2Pyq8qsocDD7QWy6/m6u2ckbl9GQ6TUZ6dr2htaSiqZrguvcudaRvMzIMOOIy2UyOthHGCJU13wEor7lhuy7CYHP666nVQLoB+jPMtzfdXYZhHuohj0MugT7+AH5zRXZC0gwpTPcMNTcMfK6dDqBZZwCdOgZ2vzEj91cn0/GyfBZmsf650mcGlEK21gZtzMasxj7cfdOIcNw6p3twbD/wDkP/4bmzm0+lK8qDc9ikEWR/o/aRpux79UmKm/HaxMtNhJaRrzq3/0pKwziwl0xir3QbRUN8vAExDx7xxV5OfNmcW8B2q/eUKbFEV76/oKvrVvZK6JE0AJvwTKMqDFcfumwZbg4v+4Hzc89XcvrowYh5I+hhiypIDK9+9qF80Ifi+mcM6blTVphycenrI1tVl7py1JafeFar+dqrkT8oQQXYjNYfnYLDFfz+JSQNBz+7wiHTk1aGYltP/f48py50YbChPnQhzAQAMmhxBtpJy4kyqRvSLcvqi24dvBt6zXL1B8aC1JSuqxEXBp7fQxbMvIVMWMJVFslD6Y8KUsJIswAg2+Bg++e4ajaQBE1W/QYBar62krb2PpOwdq0wp7vw/ICCAVB0oCsZXNUApSypzjMIvDE4q3mUekD/oiWhVd4/w5lDuGAgrP5L4KXzPevhOlU56/C5av94+eGz+8/3SlYaEAdD2p6mRiRF5fFZw4+/u3gxloyfjy2jeMbMgZCMcfqHT3xE1jW6IVKBkGMYB06u387TR+WIPXNpcqafoz+taDs51MvoBFLYCpLykryHErUAuaBQL5gjQ+/WnMnxI3u3ylyydtg/ULQOMbukm9pEcHnpFTy32TzS2lQeabvgHmI1HgH1AHopOqi52alLKRvM+NX68ah4F8mTwZgJHeZxY8RVet6VwFWMVM3K8bxSizkfL7gQJ/7duYLycLaB7M5yWMmDE2a/we++hdCUDmUQeOYvcOoBjzOyRTAPDQzgdAJBDAtzLvswSIM/aktT5kID6LrMEaEtyaUSi4GkxxLmmQznJP2qexx6IxVWoRL05Gy9kyRMhOHispE2jxSHj9dW4SrZ9vslsL989WcBU25UXxN9CbCuWueOJCed0HMDOgd5FEqaEKPbxH4TAt4XVTPwEyjwUO62jbMqXfzHg3gOY9jXN3/DZWOQJbiNuSkVFjrJWmycLckqnPTv0LueNrleGyM0Ug7u+pfgkct7R6 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: ebb0239b-eb48-432b-7c7a-08d92b0b3f0e X-MS-Exchange-CrossTenant-AuthSource: DM5PR1001MB2091.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jun 2021 05:55:55.4603 (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: /AooBm1L8NiEcNkFBDRMx2CuxCq6yDWVRnxcpQ3jydB0JLpHwcQsToAKXH2gACKXghgyNlp7ePq2f/cNSvIEcDb799Icl3thnb22/wJLvcU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR1001MB2217 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=10009 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 malwarescore=0 spamscore=0 adultscore=0 suspectscore=0 mlxscore=0 mlxlogscore=999 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2106090018 X-Proofpoint-GUID: ceqfm4T-3uQUngq8_ucBgW9K7kXkCudh X-Proofpoint-ORIG-GUID: ceqfm4T-3uQUngq8_ucBgW9K7kXkCudh X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=10009 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 bulkscore=0 spamscore=0 mlxlogscore=999 phishscore=0 impostorscore=0 suspectscore=0 clxscore=1015 mlxscore=0 malwarescore=0 priorityscore=1501 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2106090018 Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org ib_query_port() calls device->ops.query_port() to get the port attributes. The method of querying is device driver specific. The same function calls device->ops.query_gid() to get the GID and extract the subnet_prefix (gid_prefix). The GID and subnet_prefix are stored in a cache. But they do not get read from the cache if the device is an Infiniband device. The following change takes advantage of the cached subnet_prefix. Testing with RDBMS has shown a significant improvement in performance with this change. The function ib_cache_is_initialised() is introduced because ib_query_port() gets called early in the stage when the cache is not built while reading port immutable property. In that case, the default GID still gets read from HCA for IB link- layer devices. Fixes: fad61ad ("IB/core: Add subnet prefix to port info") Signed-off-by: Anand Khoje Signed-off-by: Haakon Bugge --- v1 -> v2: - Split the v1 patch in 3 patches as per Leon's suggestion. v2 -> v3: - Added changes as per Mark Zhang's suggestion of clearing flags in git_table_cleanup_one(). --- drivers/infiniband/core/cache.c | 7 ++++++- drivers/infiniband/core/device.c | 9 +++++++++ include/rdma/ib_cache.h | 6 ++++++ include/rdma/ib_verbs.h | 6 ++++++ 4 files changed, 27 insertions(+), 1 deletion(-) diff --git a/drivers/infiniband/core/cache.c b/drivers/infiniband/core/cache.c index e957f0c915a3..94a8653a72c5 100644 --- a/drivers/infiniband/core/cache.c +++ b/drivers/infiniband/core/cache.c @@ -917,9 +917,12 @@ static void gid_table_cleanup_one(struct ib_device *ib_dev) { u32 p; - rdma_for_each_port (ib_dev, p) + rdma_for_each_port (ib_dev, p) { + clear_bit(IB_PORT_CACHE_INITIALIZED, + &ib_dev->port_data[p].flags); cleanup_gid_table_port(ib_dev, p, ib_dev->port_data[p].cache.gid); + } } static int gid_table_setup_one(struct ib_device *ib_dev) @@ -1623,6 +1626,8 @@ int ib_cache_setup_one(struct ib_device *device) err = ib_cache_update(device, p, true); if (err) return err; + set_bit(IB_PORT_CACHE_INITIALIZED, + &device->port_data[p].flags); } return 0; diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c index 595128b26c34..e8e7b0a61411 100644 --- a/drivers/infiniband/core/device.c +++ b/drivers/infiniband/core/device.c @@ -2059,6 +2059,15 @@ static int __ib_query_port(struct ib_device *device, IB_LINK_LAYER_INFINIBAND) return 0; + if (!ib_cache_is_initialised(device, port_num)) + goto query_gid_from_device; + + ib_get_cached_subnet_prefix(device, port_num, + &port_attr->subnet_prefix); + + return 0; + +query_gid_from_device: err = device->ops.query_gid(device, port_num, 0, &gid); if (err) return err; diff --git a/include/rdma/ib_cache.h b/include/rdma/ib_cache.h index 226ae3702d8a..1526fc6637eb 100644 --- a/include/rdma/ib_cache.h +++ b/include/rdma/ib_cache.h @@ -114,4 +114,10 @@ ssize_t rdma_query_gid_table(struct ib_device *device, struct ib_uverbs_gid_entry *entries, size_t max_entries); +static inline bool ib_cache_is_initialised(struct ib_device *device, + u8 port_num) +{ + return test_bit(IB_PORT_CACHE_INITIALIZED, + &device->port_data[port_num].flags); +} #endif /* _IB_CACHE_H */ diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h index 41cbec516424..ad2a55e3a2ee 100644 --- a/include/rdma/ib_verbs.h +++ b/include/rdma/ib_verbs.h @@ -2169,6 +2169,10 @@ struct ib_port_immutable { u32 max_mad_size; }; +enum ib_port_data_flags { + IB_PORT_CACHE_INITIALIZED = 1 << 0, +}; + struct ib_port_data { struct ib_device *ib_dev; @@ -2178,6 +2182,8 @@ struct ib_port_data { spinlock_t netdev_lock; + unsigned long flags; + struct list_head pkey_list; struct ib_port_cache cache;