From patchwork Wed Jun 16 06:52:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Khoje X-Patchwork-Id: 12324327 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CD49CC48BE6 for ; Wed, 16 Jun 2021 06:52:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B2424613BF for ; Wed, 16 Jun 2021 06:52:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231774AbhFPGyr (ORCPT ); Wed, 16 Jun 2021 02:54:47 -0400 Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]:33242 "EHLO mx0b-00069f02.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230515AbhFPGyq (ORCPT ); Wed, 16 Jun 2021 02:54:46 -0400 Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 15G6lTSH018815; Wed, 16 Jun 2021 06:52:37 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=yeBI8FSZcSZ2HuoFYJWWHI+BaT2vYAXqtgajDl10RR0=; b=Wu7hf48SUV03jsNIiCm7UXMt7bi5Pkn5uI/9CrAi9+8FbpI1C/pOqWDpq3+D8tZjsAfn G9hY5kJ+COgiOIg5lbZldvkPodYqmfVngRL5724LQ0Xe6Uz/mUGIzNZiacjaPSC8Ju8P oRcpMYD5vLUWLcaSKI7hvHJqe56bI+v3zFH268ecgV1JyMC865Oh+o3PWSxSPSUNR0St ad2DrZt6LYhsdYyEGsL5He06Nwj+t4B9SsVnbBwR3VuQliOKH5eWQRRlQ/tfq9Vh7ATs d6deEi7jvOVNNyUkzHxp36DAFyS2ZpHuQjp1TCa6SY99h2wTCR9YxP1n4lmM60d0uatn /g== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by mx0b-00069f02.pphosted.com with ESMTP id 396tjdshm4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 16 Jun 2021 06:52:37 +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 15G6p2rI089782; Wed, 16 Jun 2021 06:52:37 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2101.outbound.protection.outlook.com [104.47.58.101]) by aserp3020.oracle.com with ESMTP id 396waseytp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 16 Jun 2021 06:52:36 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fD7MjIBeTDm3Du7N3W1nG52T1GiGx/zHjSh/UAE+OJKuMuWX4+UdIA0+22Z+GgmkZwkPX/xaggpGo1Bv0nTe768ShNuPp/SLwqSIXkicSNYSIOGVqXTRHhs+Oj+XNrShjIJT5IBfiIcIsIavpgS4KWizQkT6GwJaS7tJ45lPXH1T7l1Hj1Jw/bnbBq8d5rDnDG1zPD/gFFz8tAwss0GT6IEaDvvaJ6gnPagh2VDc058piouVS+kVPvce+itEMprBOs31e+tCJQoahCHSgYYN8Z1LvcpA8dwPCqQhtL+iBqMPYu4jeG/+HxgN45iQDpbu0HAay4rajjrdCrZyC6mkZg== 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=yeBI8FSZcSZ2HuoFYJWWHI+BaT2vYAXqtgajDl10RR0=; b=gDSgYnB4gEY3CMV15/0X0/Dpc2gCZWuyp1CuUQiHAPzyw7nCB/1QkiJBBQolZz5maxZUnQfu3fs20uEjGyJI6QJU2DY7nYc4OxIQSyjZc0KuhnHM5bXq1rCfREVstXXrSPEwuePCpE0+JVfScDWKHKOQz4wZeqjzy+OtQYNBTqCOfZLMKzwgNn1w26VhZ87qyTgscQHM7+QWXqv7zE43DFbFTztI8AIfKgaAqO2EpJ/c/3TxVILDXehxvuh/VaitKg6dRM1RZa/3si24bv4/TuANaxmszpIKgY7NHj3RNp6OmRxmennyvch841GkK0fobLKLe/W9cDeRUQNxdcWzYg== 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=yeBI8FSZcSZ2HuoFYJWWHI+BaT2vYAXqtgajDl10RR0=; b=qiA5GPThSFtWHB/eq8gopktZb/0Ckd01VLmaPsubkp6opG/isGBs4GaKRNjOzXHUlbKrz5NrVhbS+aUxaWxBcfK6811L/EqNsKyWsKxcFL91JHC4y5NbS96NSUYbJASDe6V6KdIv+yj41XQ2+qVqe8tvZ6qrI1yd+oz2fxPl42c= 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 DM5PR10MB2043.namprd10.prod.outlook.com (2603:10b6:3:114::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4219.22; Wed, 16 Jun 2021 06:52:34 +0000 Received: from DM5PR1001MB2091.namprd10.prod.outlook.com ([fe80::211c:a5c4:2259:e508]) by DM5PR1001MB2091.namprd10.prod.outlook.com ([fe80::211c:a5c4:2259:e508%3]) with mapi id 15.20.4219.026; Wed, 16 Jun 2021 06:52:34 +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 v4 for-next 1/3] IB/core: Removed port validity check from ib_get_cached_subnet_prefix Date: Wed, 16 Jun 2021 12:22:11 +0530 Message-Id: <20210616065213.987-2-anand.a.khoje@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210616065213.987-1-anand.a.khoje@oracle.com> References: <20210616065213.987-1-anand.a.khoje@oracle.com> X-Originating-IP: [182.70.80.33] X-ClientProxiedBy: SG2PR03CA0139.apcprd03.prod.outlook.com (2603:1096:4:c8::12) 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 (182.70.80.33) by SG2PR03CA0139.apcprd03.prod.outlook.com (2603:1096:4:c8::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4242.9 via Frontend Transport; Wed, 16 Jun 2021 06:52:32 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4e84ad91-afe5-4fd3-3437-08d9309351fa X-MS-TrafficTypeDiagnostic: DM5PR10MB2043: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4941; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: m2FCRAEcw9Y1m2y/tzx+Iv6+8/0C46NpzHsy+X0eH9pnhBOBBKs4pMO/wd9zMmGpoA4k4zxTiCzOnCFE+wbWIIXQ3ytHBMB52TEgU32AiAp+i/zuK2LynIb0o2eBENP6L7u43b2204zwWYPhh1FodVMZcatMOR6ldy3gS6gI+fzL1Mnym9E5Fvk48QP1mLUazKXH5Rxc8kxcdZjayDNWlJiiZHth3+X3QccKzplj9YmjiQGUP8w1se47HWVzeHGc+rcfZ1MQYVBxM2PFLzxay1atIJMoTQZnzxx1lvIo5VzjiXuBEElvJ7PGgygEJMlbaFiFJGOz80T7fiLvWLwPsKRNZunmsI5tt3bl4IelnlJOvg9TGiw1jC/J1yYmkLwZe4KKK7D4WwMrH1rI67LYpgatDaF+YdtLRV5ykZUz0JkW4bBHpcSHx7EIbcsdccB8zM7JkNNcxQ9MidlSBqA9aOVi9f904DM2CCZX8WdHwqVBhe5FAEN/z+3NHRRHyDvHB0dRZ6Qof5Usua3O9KldE0CYhDWwMj7CuBzCu/WdUcMTLYxvk+iB2Q3azqudZihy5QGnRWO0NX/jMLzxavDwP5PtSXOMs5/zijoedMTyj/E+ofq48LAXl4MBtNocnI5fkl4lyN+hkyANetJ55+2tQ8RJPIGgmA7rdZtidecbLYSlt4tL17kspUuGCkX0paJ0 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:(366004)(376002)(136003)(396003)(346002)(39860400002)(6486002)(66476007)(316002)(7696005)(36756003)(52116002)(16526019)(186003)(5660300002)(66556008)(66946007)(8936002)(4326008)(1076003)(103116003)(38100700002)(83380400001)(2616005)(86362001)(8676002)(478600001)(26005)(956004)(2906002)(38350700002)(6666004)(120606002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: OkvGvvvBeyXIf18DGAZ2YHLrzYVhY2XoVEneD6mSXFHTZ1Ea4Hs2f+h0t0uvQ2NmNOWajDlE9hGcT83RQTuoYHdv4smIgIC4kBh92fiXY9T5VfPRRsaFFoBa/6VK9s1/jSwVJJXwBhYlKNrDEp8k2q9uaplsI5EvIgxwRsCijrSGdoalEdjlZtxpk31qYiC/uJNWu04V/rw/+TEXQ1qjtmNPe35lsQu3aMraeGDRFCFOssTNFOiH71/bGhzkN2gSxvgfQU2+/wrLO/I0P2zIPk0G7TYkXv0tyACzMhqJI8evC7YF6skwMCaE942t2+KkIdM9jWWvfaTRi3NdKC1EH/OZQ0/yML/2qtTJ8C3hZnXsno+4lFsM8g5XP/k4NNRc8ePG+YlFhJkJgpNIAthHExuvcbCna8x8ROfUkrWxeOtbeQIV6tlqVbdzDZGgrS//JE2S9VePWdFwSDlfSJfqEO6BMKqgn/oD3ajrIRfYSUzQUkOCq9D1zxN3QIEI80q/f52OFewI1Cr4yiqP/HjfRAsjzzvKrIvdNbbOaCY6FrjCZRzrmJUeWNy158VMndcAHvF7KuHvtIEcoglnbvqMMQBtJC0A/0DFMd2drytn/LhoNZRhCNirGh+/Y5MlmBy1d4LXMko4McCjZ0oUt5NROyPtuE5RAPwtCG89q2h4l4J89DyuYXapoJFWpjX8e8rZBMNdH/sMQFMHB3jEvJBHFM9PV+QmMxN0UHOiKeeXsNnl9zymGyahOHAQ//3uCefyQWotzgotzXhgdop+0VYEyQ18Mh/ZC+aAvSHSsPxeagjR0sW6nfD0n5fwoFpQEHLZKD5nZLBheWgZ0qyun/LeNomMaoLlobYMSQUbzIDhp2SJnkjn0PDkpj028OKWBMV5RijOoCA7eSdlEA9VF+mLukA80nKfFrY4NGZVWBcXK22JIFO9bCTFL5CxN+0RMQ9HQI6pos1T24EWwPd3owsEingxz8ubUIZoakmF/qrb09//qZuC/tA7NZIgn1lNKSbwvBgGnvKHRdlWC8nmF98W9hweNphZq0c6G5cyzez6Y2lnFKi8QpIaACMVAhFwTMUAkChQF/iYn/CWZ8DVh63dNo3dIFGl4KQoVGwr7vWFphWB0JuhwpfCPo8/ioI1Coo9b7YbKdOSbzlMaBfWT9uQ+Q/RIleCjZSP3stiMtR+jS4BMcdO6Ubl+n32eIamO0L4ZUv86yBnrI+714Ht4rjVdS0YX3B4fGNHA4YZx44fE94zikfAVk2spdSSb51m+wdHgoPzp0x5sZvHoh+S12vXwoBf9Hz5gicSQf1A1/u9m0bo/R0JK3l+RYNaB1qI3gbY X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4e84ad91-afe5-4fd3-3437-08d9309351fa X-MS-Exchange-CrossTenant-AuthSource: DM5PR1001MB2091.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jun 2021 06:52:34.7101 (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: qNYptMjBeyWYASV0X1eFpjeDfWEjr/862BaOFws1a5ukpZHyEUDmMEBXoW1fKchPw8LwsXzp+0SzbstgslNiNLypU3RdQRDXaFVpJRxQeKY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR10MB2043 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=10016 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 adultscore=0 malwarescore=0 phishscore=0 spamscore=0 bulkscore=0 mlxscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2106160042 X-Proofpoint-ORIG-GUID: ooT5FvgiBaIJuzDqzn3aYw741zCNbmFh X-Proofpoint-GUID: ooT5FvgiBaIJuzDqzn3aYw741zCNbmFh 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. v3 -> v4: - Removed a newline in ib_policy_change_task(). --- drivers/infiniband/core/cache.c | 7 +------ drivers/infiniband/core/core_priv.h | 2 +- drivers/infiniband/core/device.c | 11 ++--------- drivers/infiniband/core/security.c | 7 ++----- 4 files changed, 6 insertions(+), 21 deletions(-) diff --git a/drivers/infiniband/core/cache.c b/drivers/infiniband/core/cache.c index d320459..2325171 100644 --- a/drivers/infiniband/core/cache.c +++ b/drivers/infiniband/core/cache.c @@ -1069,19 +1069,14 @@ 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 29809dd..0b23f50 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 c660cef..7a617e4 100644 --- a/drivers/infiniband/core/device.c +++ b/drivers/infiniband/core/device.c @@ -886,15 +886,8 @@ 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 e5a78d1..5433912 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 16 06:52:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Khoje X-Patchwork-Id: 12324329 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1ABB6C48BE6 for ; Wed, 16 Jun 2021 06:52:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F18E161164 for ; Wed, 16 Jun 2021 06:52:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230515AbhFPGyt (ORCPT ); Wed, 16 Jun 2021 02:54:49 -0400 Received: from mx0a-00069f02.pphosted.com ([205.220.165.32]:17530 "EHLO mx0a-00069f02.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231892AbhFPGys (ORCPT ); Wed, 16 Jun 2021 02:54:48 -0400 Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 15G6ka7Z004162; Wed, 16 Jun 2021 06:52:40 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=gd4iU+T32qZFNfLTCNO0Wo6M5V838GsfMuhGfDxRamo=; b=Zk/R8MQG4syc8kmGeV9xNc7QU3F2/olspug/cO9ZKa5Ul0wIR/6ujwOomcODEN6DSTXj L0C+293EwZxhWlkbNR9+L7nrddPeJwc1k5UqDGY8ukk9+VyEVVt5vqFBUs+fyXmwNMZM NMbsp8n65317x8PXDIAH8t2to5SMbsWj2zMMFR2EI6H0dxVtzIqAZ6pq4Hh0/X3nIJgk 8IqwlUiYI7cLUjSKaSIMyrkunzkY8ZQMTCecGTNV2dPk/mwuRvEFkLiaPpWNmzyZ6/gC iH3s8MXmbGK8nrVkbmde0V6l+78kecMmL+uZ6kfagwwglgc0WerVGpfxbMIBW+OvrQpC ww== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by mx0b-00069f02.pphosted.com with ESMTP id 395y1kt2f8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 16 Jun 2021 06:52:40 +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 15G6p2ZF089813; Wed, 16 Jun 2021 06:52:39 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2040.outbound.protection.outlook.com [104.47.66.40]) by aserp3020.oracle.com with ESMTP id 396waseyw8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 16 Jun 2021 06:52:39 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BfAM3w6DmG8Uv1U+EZig6S6Z5FbA+tz3jA697INeeYzq6EvXkwXz2PGqXM15aG2e04k9MGMqv6SV1Q7czMuvT7NpWGD8TlLJTb+p871CSMGl9He/KedrUNnUoV13kbkBmKNqp18dIM7CBp4yAiq158QqmZ6nY1tx5Dedo6ru3sP8hc2UvR1LOyiLzkev5B4aFr9+5yvpOzxkhtie/3HmMhCOY2/QfSm/kQYsRmUs+ehvZR/0Ap+0lNZdSLOgwcALMM4rZeXksz5XI30nr/zVwrD53PUyj9rkiCcWb26tsK2/So6PGhGTliZIj5zRoDfBPlr0/SpEWfHrijbehs90Vg== 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=gd4iU+T32qZFNfLTCNO0Wo6M5V838GsfMuhGfDxRamo=; b=L5bRhfs2xpaDOyTFfNOPVKLeECGjKft1Dc2bCweX2oOEXoNEREC1rDkDdFGghGd6nLg5DsiEJsR46/vrekkXx+SAe+2/lgBXrDVI6N+Y1dJ1swI+i0hm/T7IXGrp5qx37KtoFPNReIaUtcmuAj6qqQ6SaotZypEm9+rzY4FRSUw0r2/O2M9rzp5EKF0xfTi+eSIuNgjuxRRfgkONaoDWK7JchVZyREtcS28E0v7bofBjWoLK3cbPe+al+fgFxLwBawYYZU1e8/pPvNGOYQmkYOx7urlNXxpL8W6Ebxp6nbyVvVbeLCf9zO+VdApSFM1jiLMNK3Y2D9srATTKblqErw== 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=gd4iU+T32qZFNfLTCNO0Wo6M5V838GsfMuhGfDxRamo=; b=a0RkB8uqcnk+VKqQBybLPG1dCBr6tpx2oV4FmOTbpAmDxZI6qgP21OcpgEcJU/1MLAeepOzY7kS5DQyFl2LxnuBMAEQ95VeIaduMQlet6aAAbLdnjgjtaonWbF54RhB9xuDE2iJxAoH8dtJTMiuINegESgI9qhGv5sE082fm+Fo= 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 DM5PR10MB2043.namprd10.prod.outlook.com (2603:10b6:3:114::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4219.22; Wed, 16 Jun 2021 06:52:37 +0000 Received: from DM5PR1001MB2091.namprd10.prod.outlook.com ([fe80::211c:a5c4:2259:e508]) by DM5PR1001MB2091.namprd10.prod.outlook.com ([fe80::211c:a5c4:2259:e508%3]) with mapi id 15.20.4219.026; Wed, 16 Jun 2021 06:52:37 +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 v4 for-next 2/3] IB/core: Shuffle locks in ib_port_data to save memory Date: Wed, 16 Jun 2021 12:22:12 +0530 Message-Id: <20210616065213.987-3-anand.a.khoje@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210616065213.987-1-anand.a.khoje@oracle.com> References: <20210616065213.987-1-anand.a.khoje@oracle.com> X-Originating-IP: [182.70.80.33] X-ClientProxiedBy: SG2PR03CA0139.apcprd03.prod.outlook.com (2603:1096:4:c8::12) 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 (182.70.80.33) by SG2PR03CA0139.apcprd03.prod.outlook.com (2603:1096:4:c8::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4242.9 via Frontend Transport; Wed, 16 Jun 2021 06:52:35 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e72be15d-f6be-4a56-fb04-08d9309353b5 X-MS-TrafficTypeDiagnostic: DM5PR10MB2043: 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: RQ1tIqMCIttWPOfZTgaiCFS5jjelNy3yVEJnWN4s9FwrJKdv2+2hD2BI6HeS8MIqyoSBTUYPcsn1AJCn7VggF9f8rrvPfMmU9th4yGkF5Af7KoTgzcIXKhvNa2qVeMR5TuyQn/IEv7M87TrkvLo7226T3eEemVJHGURQ1oFTr0aG9mWMPPV5v3eSNhdeyQjrxPtkjp/OQtfH0FidKgEFaUDNnIJf/vzM6oC2JMbuCDU/4LL3+0UkCAjhF6nMQfqN4KYclQ3mN2i4qY7NfJp1eCgsSCiDUCqC7k6K4PNaymSa5tOr7L4VO1MSEL3shnZZHugPjWXxD/qF501GYloNulB7EHF6PSMLKJKc7IvmUE0IvMCtEKAi/fYd/w2GIrr7CxVkNJ5LDP+ibF8fyEzIkdRfQ/mnbD0owfsYhm+WrRCQA1u3kbRkB76iip05fhk4LOz7ebhS0S3DqLdGMSnMx49BGKgzh72ZAaj2DDln+jPgQbp1tW8kojD2LjbtWYxu5J6FJDZn36S9Ii3UnKyBSH3wc8HFK78RSq+cyVjB4Laqb9lFN4JjklsWI+1gDyRzed6Ccp32jdN3Fy3YEN4GthyKC1JBZ0C4KxL64Lu+0VITEJGHLS9Mj4+UNW3tH2/ugUBKyrLAYh2rYEbxYjnPs38LAsurxfV1cnKb/BYJZ1c4QwlTaN6k5dT48al6z10i 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:(366004)(376002)(136003)(396003)(346002)(39860400002)(6486002)(66476007)(316002)(7696005)(36756003)(52116002)(16526019)(186003)(5660300002)(66556008)(66946007)(8936002)(4326008)(1076003)(103116003)(38100700002)(83380400001)(2616005)(86362001)(8676002)(478600001)(26005)(956004)(2906002)(38350700002)(6666004)(120606002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: sernfCPb6CeatDxbt3xSkzsLfYtBKoajWx7MAMmAZTZ3Qrm8nWCw6yVc4rPdg4u0MhXMgsMtt7+vPkI6LKFfn0/BSzeIf2eABj05Hd9Bog334y+q3IxqokhAb5Ot4w6N1lzcagFMBGEZDgnBQ8e+oMhwEC8lB2eLWmmThOUZoPEouMFIwegiFDlbY3CePKCCcor/2A7U56j+qs09R+c8I4oABc2pUp90PvOucsBdgYBtfFO5Rfd33Ixgam+DhqN8xsV+/uQLXXQPv0CBnNjSwuUWUPEwRswAOaumNhEg+odtyK9mi/0RQ3dingBoGf1LkyoMOJpfCVOJ4dqTmTNmKf1H+XEcIU+rTPr8AsvnmTl5nHyNebnSEjEdckpShGuFwzwKVC0Ky8EH91NvevWEvl9wDLm0Woj83hk8z5Yd/L1AMWGZJxg3PIqgX+PmRj9aAxDPRkQ0WFHEfiG3SnnukWlej6DH6lg0idfpDks1NyzC+dixFcSLRoKoh6PYa67fHc7cf1Cg4+C2CuBNJ5G+NqP+pgZUOzIufjlvhOCHeqEqyIm3usfyTOC24BgjS6lyWNwgKnvhVx/S8u6CE1ABPu4rpv+GKVNuN/u2VWAX1Y45b1RshKljIbMEYucU39oXTuNaTyjEx9tFYoZESd2En2Dul41gJtFlXCUtzh8LSWYxPBVg6n27qkCzdkJb4tr54mtnjlpMQIl7/s3jQwgpGjxGCVjbxKCYRIVLmcKm6irXIGe6f2dse7gPirv7Gy3NnzSPk2sCkPHW4ATvkm0FIxexyZ+cFgpCByIqWs0it4N41D5CweA0frocz5oaGKbztzlWkPraUH/piCR4H4D5MuUQ5ywXW/cppoW2/3bh55zt7xBND/JbIx+1YQKcLoxmT8SZtBPZ95nAdNVlAZYFqI+YRpFHgHiGXCR0dTXbRM4UOj4w08ZADydAByTSBcCnqIrW8Fo9BV9SZf1oIjhJADTb7FIKkpf7+2BCW0fCfDW+FJI7fwswcxVqAIiYjoNLQDegKj4J5nw4G4145eneVhGzzMCiCQN30se+vSv7Y1PkokfdA4DZG1Rsluejy/rcEW480AHCDDpXNJH1JBsLgckALFx6j/Jf+pVdqyQNQ8Y5ZjmWwkjMxNIslXNh4zyKGu3a76FGqs3kUkkV8g8aR4yOzQIKiA2+aZ8ahC15tI/c0kVtn6lnyahnsN5RYhn+ZQ8k67nLZe/iPqJ75fF/qJNgRrBVUPUlscu9ZAqnYuUD5qUDfmzjWrIzi8u54FbM2IfJJIkVhR4DV31GtokJ8qxuChxyt9mTGrg5kumi3pRThXyBLTcYVVhkKGVzmEK/ X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: e72be15d-f6be-4a56-fb04-08d9309353b5 X-MS-Exchange-CrossTenant-AuthSource: DM5PR1001MB2091.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jun 2021 06:52:37.6034 (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: 8Xb6ZPFQ/cPuXHLRkRhR5SuRu4vvNmyAj3d2pG7FJPqiWctkFvbnd1U+k0KP3CCGljTM/h9Ye2NEUXHRf7pgZPyxKnJZNFFGodEKXW3lkm8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR10MB2043 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=10016 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 adultscore=0 malwarescore=0 phishscore=0 spamscore=0 bulkscore=0 mlxscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2106160042 X-Proofpoint-ORIG-GUID: VA3c27X1F5OuMdRsmOYjTjDGAD3UI-X7 X-Proofpoint-GUID: VA3c27X1F5OuMdRsmOYjTjDGAD3UI-X7 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. v3 -> v4: - No changes. --- 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 05dbc21..c96d601 100644 --- a/include/rdma/ib_verbs.h +++ b/include/rdma/ib_verbs.h @@ -2174,11 +2174,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 16 06:52:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Khoje X-Patchwork-Id: 12324331 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E7E99C48BE5 for ; Wed, 16 Jun 2021 06:52:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C8760613B9 for ; Wed, 16 Jun 2021 06:52:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231986AbhFPGyy (ORCPT ); Wed, 16 Jun 2021 02:54:54 -0400 Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]:39024 "EHLO mx0b-00069f02.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231867AbhFPGyv (ORCPT ); Wed, 16 Jun 2021 02:54:51 -0400 Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 15G6kUZt022889; Wed, 16 Jun 2021 06:52:43 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=Cx8AgWs1hpzShOUQ243TfZH9vS1K4MB+r5j7SE0QIfc=; b=tAAh46nqImZHs2/nZ0xlWCfJ76wVbeXnLEzqsbkG+E6T7hds4aPtKJo8paGz9xcrU+ZQ 591aiV50avjnnqyPWhA7qpxwT4HWx+VD+VwDlIcidUeRUpnPDa68oyd7rTfjO6uv5zf1 jsE4euOQwptbf7jNZ9scXuCLrOcOvTl7uWP28ebJzOy2M1GuOq+mp8mQVfMkK43r5htY v+SYgj5tHtxbmCbQdNtW/Hr9MfiTXlQCRmRkdgC+KfE+rqhuok2KqdArHn7DfI2R/Pe4 ltE7EKWqzJ1eZr0qCizNxLlW2isE1qyGrr7S4sBUi3sQqYuNgP3z1WJqnTDOV1pLbVf/ RA== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by mx0b-00069f02.pphosted.com with ESMTP id 39770h8c23-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 16 Jun 2021 06:52:43 +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 15G6p3ul089864; Wed, 16 Jun 2021 06:52:42 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2100.outbound.protection.outlook.com [104.47.58.100]) by aserp3020.oracle.com with ESMTP id 396waseyye-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 16 Jun 2021 06:52:42 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AWbbGWUFNjX2JjxLdHt/nAYX4EkMn5fEjZ4+FOQD/maY8tbJUYsaCwMAjOgWGpibB5ZUbuuTow/ET8aKrgkG9nDlBaiYUG1o/v8XdBkILlSw/AEC91ApzK0AmmAdsuPGSb8BiWecMxlwBhHb9Nkh7drwBSOzV8pP7dwuHsDVqck+S9IqaTnVmaqpIH6dAQIUsRegooGH/X68ETarfYuKWvSIsxxI/vIKA5AUwvFL4iZSqIJ+LWv7p8FL0D6pS63rMHnG6hWCwU35quchTukNaIx64JjeppJbH8yqY9KzJcgbtarrKjL3DwFJWCchKdD+LsM9VDB1CAL203TCWHFumQ== 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=Cx8AgWs1hpzShOUQ243TfZH9vS1K4MB+r5j7SE0QIfc=; b=TtXfpUPDf5LFmqczB4iSXYBxaWf78G5CYjujtm+DiKFzG8du47oYjjVUtzxrdaLa/NGfE7AlW1eybjJVdyCrWVF6FsXc2+dKRhCBrXrIl5dyb3AW6onpUYefwPvnOoBMeo6lXHVyqWrmk5GVKzrpybKTlq7iudetyDRmQQJR4gXGArr907jeqKeDiDqoL+yTbkYNTP5v7rStKQBaG2B5CA1kZbIHG52Do8kspdg9FMwpEF9VcKnvCqmli5snepGhxijer+nik/AT0yOdTJyXwMizDTeuoRlFdu5VRVf0E4CQwRqsUq0gvZyU1eisgAyeOr9BO/mjkrBN6jQSeraU3g== 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=Cx8AgWs1hpzShOUQ243TfZH9vS1K4MB+r5j7SE0QIfc=; b=L/qwj+neBsrHEkUXLTrYY1OKpQeFhh2zp0lR92OSBYd2oQxgdckloJmrBERKawEqe5y58W1Tw974I3Q7MaOxNfrSswCwYUaP6EvwvqPesyZoVHbZExVUoRuECN7RX+/U7xNPNq/lFtWc8av/5rGbFbq7d7dPiBX79cxe6Nq62LQ= 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 DM5PR10MB2043.namprd10.prod.outlook.com (2603:10b6:3:114::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4219.22; Wed, 16 Jun 2021 06:52:40 +0000 Received: from DM5PR1001MB2091.namprd10.prod.outlook.com ([fe80::211c:a5c4:2259:e508]) by DM5PR1001MB2091.namprd10.prod.outlook.com ([fe80::211c:a5c4:2259:e508%3]) with mapi id 15.20.4219.026; Wed, 16 Jun 2021 06:52:40 +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 v4 for-next 3/3] IB/core: Obtain subnet_prefix from cache in IB devices Date: Wed, 16 Jun 2021 12:22:13 +0530 Message-Id: <20210616065213.987-4-anand.a.khoje@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210616065213.987-1-anand.a.khoje@oracle.com> References: <20210616065213.987-1-anand.a.khoje@oracle.com> X-Originating-IP: [182.70.80.33] X-ClientProxiedBy: SG2PR03CA0139.apcprd03.prod.outlook.com (2603:1096:4:c8::12) 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 (182.70.80.33) by SG2PR03CA0139.apcprd03.prod.outlook.com (2603:1096:4:c8::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4242.9 via Frontend Transport; Wed, 16 Jun 2021 06:52:38 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 23a6b455-2a16-4ecf-d312-08d930935572 X-MS-TrafficTypeDiagnostic: DM5PR10MB2043: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5797; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WNQ115DHYSoKbJxXfELc1pSseMnKKyR+XinELm9ZxljyK1DqP3u79JJYkD1kMYkUzLXmoJJAZO2LGxWaysRYWHpGbgkImG6SZe4TlTYI6olgDS4r4jP622VnSc7lkL4iZKDoM3+08gGBAPbYKrsB7MfYm75i9qRlvG/zcg0KNwBB7tV0iAbWUFGWFzL1GfQnrNjKis1Fw6aV3pLnONLSo9i3XCrntbWhQE+dwIMrIWq+C0rnAUuPUeWajGnTv94CfGhrIESaA4VkS51D1wJPLeBALETIxHZYcGnHNb/hbzOdm3qFPzYInTjCzh1Zyi5DdyB67JVW4ms9uQ2l4VG9n8d2NnIyTqkLkXK3KZEj+SkLNPE34X2qg9IVtZXIRY4md9ShbR6SlqbpoKtlSVmpW8TgH2tNUadgX5spGBMGZppxTjxBnFwQ6C9W/KgfzgnV4UWpMJrG3BjEEuWFta0xj71gxxSQHOs9G35LWXVvK/cYnMAtucjCjzepFVoai0SfzLg77bhrmfxschCQpYCo+AiK6Aj8QKjhPu3NRVlUgSvmzEHhAzdxtrdyjyf36znuE6n4nuUQLcyeO+o+ZM0qkwr4FEo/eALhkPUeBotx8CCcAdAVbOTDgabuz+5J9YRWeXZk5pdgoADyhiQPE50b4Sa5zBEoWWkT+4F9g2bY5TuUEP/sWYx2LQyefTVFVfrF 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:(366004)(376002)(136003)(396003)(346002)(39860400002)(6486002)(66476007)(316002)(7696005)(36756003)(52116002)(16526019)(186003)(5660300002)(66556008)(66946007)(8936002)(4326008)(1076003)(103116003)(38100700002)(83380400001)(2616005)(86362001)(8676002)(478600001)(26005)(956004)(2906002)(38350700002)(6666004)(120606002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: pzMoBi+nN7tm/eEmPe4GdJM3eONVupiNgOlHTWbVfs07xATqVD2BTiB1NlkiklIcM2XknJm9M9MP6NDyw6b1QJgUeGrwkRN8F1fOp+6dhbgFbKrymYQqquLWt6U0+XzD9t9b+grIjsgpcexHBDm/AeaxsxQ61q6FfsQXD7jo1PbdPBFJJny4EI0oYIbiuY7xqfBsAf+GpabDAHIEOl/9in6E9uT4ocvKBXO+wBvWKBjJBTfdmsnIK4CKElHvx2JSXlSgbukEGANhmmd+cepbzIPZPOw/DqilBiQ16GtI7/tcimPM+4Qco7R4IT7u9Js0b7rDXImCLrj4yNpviOkbhvP8a0jUEp+zR38QQeq1UDRNo77qrQafkJEztSEyhFaa1aYRaq3tiEnZ4Gs6eyjOXmAHJNagqaveTeb7t5ExuRBq0u/9qK50qKYLDCo1dmghJEseQF1vJB/zAVSnRs6d+ITCv0czrafx01UR25PqcHTCKjvU9CofN50VlfSHNTfMkjmsKSsw2SH6CxBNeplYqPXCV+h8o8/zM2hxLJu4XLa0SuQy+SqwF/A2wyuoN1kqf7iJr2QUOpWjTj8rrpLOR8ncy3fkNJZyqW76Kz3U0338uAlzoeobv8HLYt+aZf91fLAptZKbP3XQUzVmFXDmjm1DzfY9S6kBx37BkT3OExrOUAOB7fEstIzuxwffJd9hWNZuNRJfAxEipagR4UQFKhZPvP4Af5NCALJ+1ZqPVkPRu3/PO4hf6E4hN8SY8ayZHCuk55UOBFVWJ/BAO63pmEIpBQQocYqfVU4D6buE1LHLkRHEfq/R0Ko7NtxEXvDFfEFah4e2lZXGkbinPaae6vJROF87rRYpSCxM3KM+Qhm8759Of2fAepr4sf0JN05lHF0iuhMhzrfQiIBj+0LJBvVJb3/+k8tpTQ0v43pcdsRDCrVicDTqb/zA9+XyO3r52ONz0DDdIusUnX9pdGPkfi4MPJXC1Qb/aUV+2WLOFt+iOoofKeKkiZGZEkuTlJxQkUkSa6sB65JV66l/Ni5EfuQDQ9XnPQDOA6vIx4bSi0kDTZxruxTeqwD2X9ciwtJj7YrKaAC1SEaYou4Z793+/RrpFQzQqEw7YJy2qFiCt+M+XIsiB9TRrw8jEGlUsP8Mmz4efi6dyqdWyNZnbG5U2O4OmFdqA+sTOWwb+TI86AIfaMOT0CwFWl+A8dZY+M4G4rdKnIKddE0Z2vK/Z9AyPg3CC8jR0Z29Jz938WYvlCTCZa+FKsYZlwkYYtjAZzgeC6x+u2UZuXDTxhrnOKCgbdNlQKMesMWR6GLvfFhhYSxgLcYn8KyfyNYKRGsROo4J X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 23a6b455-2a16-4ecf-d312-08d930935572 X-MS-Exchange-CrossTenant-AuthSource: DM5PR1001MB2091.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jun 2021 06:52:40.5178 (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: kT92jJeQmu8olYLdTdGfidsVTX2n+8Id5Z7sAigEWBygfltHaRixxPUaQMsA7nn+hsWr2Z/mMEfzPTVqdDIQtfH25jQIWTW4kPhU+DmTdX8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR10MB2043 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=10016 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 adultscore=0 malwarescore=0 phishscore=0 spamscore=0 bulkscore=0 mlxscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2106160042 X-Proofpoint-GUID: kniKsrh2OVDdQLUGZpbcPY6WdYPMZ3iA X-Proofpoint-ORIG-GUID: kniKsrh2OVDdQLUGZpbcPY6WdYPMZ3iA 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. In the situation of an event causing cache update, the subnet_prefix will get retrieved from newly updated GID cache in ib_cache_update(), so that we do not end up reading a stale value from cache via ib_query_port(). Fixes: fad61ad ("IB/core: Add subnet prefix to port info") Suggested-by: Leon Romanovsky Suggested-by: Aru Kolappan Signed-off-by: Anand Khoje Signed-off-by: Haakon Bugge Reported-by: kernel test robot Reported-by: kernel test robot --- 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(). v3 -> v4: - Removed the enum ib_port_data_flags and 8 byte flags from struct ib_port_data, and the set_bit()/clear_bit() API used to update this flag as that was not necessary. Done to keep the code simple. - Added code to read subnet_prefix from updated GID cache in the event of cache update. Prior to this change, ib_cache_update was reading the value for subnet_prefix via ib_query_port(), due to this patch, we ended up reading a stale cached value of subnet_prefix. --- drivers/infiniband/core/cache.c | 18 +++++++++++++++--- drivers/infiniband/core/device.c | 9 +++++++++ include/rdma/ib_cache.h | 5 +++++ include/rdma/ib_verbs.h | 1 + 4 files changed, 30 insertions(+), 3 deletions(-) diff --git a/drivers/infiniband/core/cache.c b/drivers/infiniband/core/cache.c index 2325171..cd99c46 100644 --- a/drivers/infiniband/core/cache.c +++ b/drivers/infiniband/core/cache.c @@ -917,9 +917,11 @@ 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) { + ib_dev->port_data[p].cache_is_initialized = 0; 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) @@ -1466,6 +1468,7 @@ static int config_non_roce_gid_cache(struct ib_device *device, struct ib_port_attr *tprops = NULL; struct ib_pkey_cache *pkey_cache = NULL; struct ib_pkey_cache *old_pkey_cache = NULL; + union ib_gid gid; int i; int ret; @@ -1523,13 +1526,21 @@ static int config_non_roce_gid_cache(struct ib_device *device, device->port_data[port].cache.lmc = tprops->lmc; device->port_data[port].cache.port_state = tprops->state; - device->port_data[port].cache.subnet_prefix = tprops->subnet_prefix; + ret = rdma_query_gid(device, port, 0, &gid); + if (ret) { + write_unlock_irq(&device->cache.lock); + goto err; + } + + device->port_data[port].cache.subnet_prefix = + be64_to_cpu(gid.global.subnet_prefix); + write_unlock_irq(&device->cache_lock); if (enforce_security) ib_security_cache_change(device, port, - tprops->subnet_prefix); + be64_to_cpu(gid.global.subnet_prefix)); kfree(old_pkey_cache); kfree(tprops); @@ -1629,6 +1640,7 @@ int ib_cache_setup_one(struct ib_device *device) err = ib_cache_update(device, p, true, true, true); if (err) return err; + device->port_data[p].cache_is_initialized = 1; } return 0; diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c index 7a617e4..57b9039 100644 --- a/drivers/infiniband/core/device.c +++ b/drivers/infiniband/core/device.c @@ -2057,6 +2057,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 226ae37..46b43a7 100644 --- a/include/rdma/ib_cache.h +++ b/include/rdma/ib_cache.h @@ -114,4 +114,9 @@ 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, + u32 port_num) +{ + return device->port_data[port_num].cache_is_initialized; +} #endif /* _IB_CACHE_H */ diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h index c96d601..405f7da 100644 --- a/include/rdma/ib_verbs.h +++ b/include/rdma/ib_verbs.h @@ -2177,6 +2177,7 @@ struct ib_port_data { spinlock_t netdev_lock; + u8 cache_is_initialized:1; struct list_head pkey_list; struct ib_port_cache cache;