From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7845541E33; Fri, 10 Mar 2023 05:01:20 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5507A40685; Fri, 10 Mar 2023 05:01:20 +0100 (CET) Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2080.outbound.protection.outlook.com [40.107.22.80]) by mails.dpdk.org (Postfix) with ESMTP id D26DF40150 for ; Fri, 10 Mar 2023 05:01:18 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=dhj0QMlqT+fzYq8Jlr28YHq00diqbxq6BYj/8eKvYjA=; b=Qzo4J9D58Rbj126/lBTKoAaznoryBBp41Zogws5YLbQc+IUcrOVs31rHF3OV7zdGX2mMzvGk20MdR4fQhJl6gGedbRn5lz642x3A34uGdZQ9GrEmOix66uGKPS4h1B1nK51IHrAxTBasDP7tDBFCo+tfwPtUrhuBo330/gWyBdA= Received: from DB6P193CA0019.EURP193.PROD.OUTLOOK.COM (2603:10a6:6:29::29) by PAVPR08MB9137.eurprd08.prod.outlook.com (2603:10a6:102:30e::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6156.33; Fri, 10 Mar 2023 04:01:17 +0000 Received: from DBAEUR03FT029.eop-EUR03.prod.protection.outlook.com (2603:10a6:6:29:cafe::30) by DB6P193CA0019.outlook.office365.com (2603:10a6:6:29::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.17 via Frontend Transport; Fri, 10 Mar 2023 04:01:16 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; pr=C Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DBAEUR03FT029.mail.protection.outlook.com (100.127.142.181) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.19 via Frontend Transport; Fri, 10 Mar 2023 04:01:16 +0000 Received: ("Tessian outbound 2ba0ed2ebb9f:v135"); Fri, 10 Mar 2023 04:01:16 +0000 X-CR-MTA-TID: 64aa7808 Received: from 9c5ecde1cc7f.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 5A4B63C8-AD4B-43F6-A634-2DB2A3F60854.1; Fri, 10 Mar 2023 04:01:10 +0000 Received: from EUR05-DB8-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 9c5ecde1cc7f.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 10 Mar 2023 04:01:10 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gmURL5Ltwc/veyMRH6zlBmRE0KjUVsOhiuhluWv26J0QgZ3vDa48/eP5W0TwtSmsRcuxACltttrkDd7josJHFKGmqpZqhvRxAH6tKNNFjSJjqPl/xIlr10QkkYNHLPVDndOlYmG9r5pb9u7Lcnh5ufk1Ck+fGZWojWSOXfEkY6rAD884POgpotL6kEo6dMMwTOY4AKUg0VfIeTI6OkfdJuf44UYSYnWOe6hlB4VdaTEBc0k/ZMvGhuJuY2NQ48NuAWvdLc9b3LhMpf1Ph71ARqNmP8k/cNhKdqe5QPGJ9v/g+yuDqdPkpF8EhlZ5ng+SdFCah8MRql5NNWW3L60XaA== 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=dhj0QMlqT+fzYq8Jlr28YHq00diqbxq6BYj/8eKvYjA=; b=X8GvdZa7z3Dlvaw0JU+MeDY2GgjNlOaAl+Yt6gVIMhyKU6gkbxisqaG7cS6knLMBAGMKomvQTincLlafrCE+kQwV4rIvrL4M+UZwAfUAhN50GUgYozyVHjUSX6S1GpJ1rdrUxm/4F69EBh17P6ssQz57auwoZ/3w2i2aYSm0cXrCQCOdgmOTCPzcjycQhI+PHyV8sozBlYC47iESi2qmM1V5Um4Cn6gbqWXubA0u5rHSTNKHcG/fSiGNaUUiayH8DT8Ysu0RkbqAn56tSsWXL72RYJYyMVWE1zZFVEOWD3hh/zDYu+KPUNeDyrIz6HRT3zxbhTYQqDPqoMWc8uBFkw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=dhj0QMlqT+fzYq8Jlr28YHq00diqbxq6BYj/8eKvYjA=; b=Qzo4J9D58Rbj126/lBTKoAaznoryBBp41Zogws5YLbQc+IUcrOVs31rHF3OV7zdGX2mMzvGk20MdR4fQhJl6gGedbRn5lz642x3A34uGdZQ9GrEmOix66uGKPS4h1B1nK51IHrAxTBasDP7tDBFCo+tfwPtUrhuBo330/gWyBdA= Received: from DBAPR08MB5814.eurprd08.prod.outlook.com (2603:10a6:10:1b1::6) by DB4PR08MB9383.eurprd08.prod.outlook.com (2603:10a6:10:3f1::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.18; Fri, 10 Mar 2023 04:01:08 +0000 Received: from DBAPR08MB5814.eurprd08.prod.outlook.com ([fe80::910e:e35f:b1eb:ae9]) by DBAPR08MB5814.eurprd08.prod.outlook.com ([fe80::910e:e35f:b1eb:ae9%4]) with mapi id 15.20.6178.019; Fri, 10 Mar 2023 04:01:07 +0000 From: Honnappa Nagarahalli To: Konstantin Ananyev , "mb@smartsharesystems.com" , "olivier.matz@6wind.com" , "konstantin.v.ananyev@yandex.ru" CC: "dev@dpdk.org" , Ruifeng Wang , Kamalakshitha Aligeri , Wathsala Wathawana Vithanage , nd , nd Subject: RE: [PATCH 4/4] mempool: use lcore API to check if lcore ID is valid Thread-Topic: [PATCH 4/4] mempool: use lcore API to check if lcore ID is valid Thread-Index: AQHZUkPdMQ5VovBe6ku0RkzWFw9njK7yL+WggAEx5KA= Date: Fri, 10 Mar 2023 04:01:07 +0000 Message-ID: References: <20230309045738.1261000-1-honnappa.nagarahalli@arm.com> <20230309045738.1261000-5-honnappa.nagarahalli@arm.com> <871c50be83964a08b7c2122d1694c80d@huawei.com> In-Reply-To: <871c50be83964a08b7c2122d1694c80d@huawei.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ts-tracking-id: 390E96BAD827B247A0C10E9FFE4440A5.0 x-checkrecipientchecked: true Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; x-ms-traffictypediagnostic: DBAPR08MB5814:EE_|DB4PR08MB9383:EE_|DBAEUR03FT029:EE_|PAVPR08MB9137:EE_ X-MS-Office365-Filtering-Correlation-Id: 4bd0054c-7e1e-4d8e-70fe-08db211c192b x-checkrecipientrouted: true nodisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: Df8F9eWtH1NAmj5D3F1oiW6UjFiOUohxEEFUBmvKWJkoc4qHOJACwD+KXS1/GqwJ42gwziktzLr67kaURtJnybfFRt4sUC4mKar2PUxTfp0Wqt9akzz0JdZxNXecke3wqyT+sTtOzuoQTdouv+YDOw4kMxUNhg3EesKxbCLD5gJQ0pcqRBvlrSijbsfcHN0O2iW6sNqBY9VdZjjXtZdHJVwe+Y+YIVi8Q5v7vPwtZOhXBp2dJqCQyGqoKvdkxjcDN7UuTcxLuXbPGoDybeHDAI5BTTFYkZW2Q1oEVb/K7HqAwfSwRRGd8p8Yf4F0uX+dl65eTC94DHLxp4dnu4BRHbvdL+lu3Ot963TBO4lwPrxez28DMdpzOCBEccjMo2kLAXO0kdRIwinLMZVTOPZOT88/KjJhSmyEZiBxflCzAl9DPxOYDw54Gi641sTDAFnLQIn3SYCSFAMmC27PDJMMCbcKo6tt7nEFi427z1+Rt15MUtQvB0l5uShwUwM/6ShZHlGqIVgbgNQ3dpyeHqLswatqFRUCiaISk1vVYGle36bOFRRKGmpIAymAPTbx4DL2E7u3i9uHYBFiE4QPPilXhCpMTVtTSy0/RBRGUIoY+fvYO22Wq/qxujtZJFFeB8PdrEI76GQ7QQWYELUbxLy9JFxknDEFtM/X28D5/+yPL/b6/+tT5dQvvxa9yq15j8bPTdr3xa0TK3fenUsL14CTdw== X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DBAPR08MB5814.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230025)(4636009)(346002)(39860400002)(136003)(396003)(376002)(366004)(451199018)(38070700005)(2906002)(5660300002)(8936002)(52536014)(66556008)(4326008)(55016003)(64756008)(33656002)(41300700001)(76116006)(66946007)(110136005)(66476007)(8676002)(66446008)(316002)(86362001)(54906003)(71200400001)(478600001)(7696005)(38100700002)(122000001)(6506007)(9686003)(186003)(83380400001); DIR:OUT; SFP:1101; Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB4PR08MB9383 Original-Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DBAEUR03FT029.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 473f37cb-3f07-48ad-67fb-08db211c13a3 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8vGUGMwjPPailLab3Qe9jp1i49Z6IBh9vIfhqnRqXv41R8JVodOcdrHuM4w8TnbI/uiu/OmR48Ra+grHvj1BNL3mws/64hOhmO4y67eVxZApxHdFXWE6oo/FEwsHba6rnVb8sgt2wqfCwS6ixdAzRxrbAf1MYUrqt4l5PGEdvR8boXDPzp7N/cx8ixTfAmpt+oRdsmjB0gFR8mrMOLZJSEuAUvgif//aX78/Hu75XBUsHreMuUIEvi6UTls2jplaurEqrmOY4NSVOxCJsy8rh0cc1dfA58iwDzQe0ChgPoCRWbh/er3akWv1zr8HMjIKlPWyv3J9VIo62w/r4SFdvqM119z6/zWEX5PqylPkAKl08kpMUl6OSH/OljAQZa9mkDVRm/UZiX2UKKfvfMYJ9k4EOXO6g7iDppwUbNbEfEWrMwzBIy2SEPw1VQUlFqOd33Z0/6SXVcYtqQf1uVRk1B3B993+8nSHhfbplJBq4y5C85iRpW6tP7u5MwbrsqpxftzIHWILY5Huf3lsm2qkpqSGhoVxCCrXY0i1iAv2hO/YgEYMTqEuXfCmENRZzi3ct+Zfw2hPVQ5Nl9Ou9v5sSJQOWrtXxvVvTqeEg2pcDYKQtJcrhWFyaMIJaIjFSJ7BrFjUsjQfw3Qs1Jpek90CbIaV0niEvmJP7iivcd7iJgZDn831EOeZMZdFhe/QkRoZjiuSy7cai0EGDimCP5GGLg== X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFS:(13230025)(4636009)(346002)(136003)(376002)(396003)(39860400002)(451199018)(36840700001)(46966006)(40470700004)(70586007)(70206006)(8676002)(4326008)(54906003)(316002)(7696005)(110136005)(5660300002)(2906002)(6506007)(41300700001)(9686003)(26005)(186003)(336012)(47076005)(8936002)(52536014)(478600001)(82310400005)(356005)(33656002)(86362001)(40480700001)(55016003)(36860700001)(83380400001)(40460700003)(82740400003)(81166007); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Mar 2023 04:01:16.8135 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4bd0054c-7e1e-4d8e-70fe-08db211c192b X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: DBAEUR03FT029.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAVPR08MB9137 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org >=20 >=20 >=20 > > > > Use lcore API to check if the lcore ID is valid. The runtime check > > does not add much value. >=20 > From my perspective it adds a perfect value: > Only threads with valid lcore id have their own default mempool cache. The threads would call 'rte_lcore_id()' to return their lcore_id. This ensu= res the lcore_id is valid already. Why do we need to check it again in rte_= mempool_default_cache? Why would a thread use an incorrect lcore_id? >=20 > > Hence use assert to validate > > the lcore ID. >=20 > Wonder why? > What's wrong for the thread to try to get default mempool cache? What are the cases where a thread does not know that it is not an EAL threa= d and call rte_mempool_default_cache with a random lcore_id? Since, this API is called in the data plane, it makes sense to remove any a= dditional validations. > That would change existing behavior and in general seems wrong to me. Agree on the change in existing behavior. We can discuss this once we agree= /disagree on the above. > So I am strongly opposed. >=20 > > Signed-off-by: Honnappa Nagarahalli > > Reviewed-by: Wathsala Vithanage > > Reviewed-by: Ruifeng Wang > > --- > > lib/mempool/rte_mempool.h | 5 ++--- > > 1 file changed, 2 insertions(+), 3 deletions(-) > > > > diff --git a/lib/mempool/rte_mempool.h b/lib/mempool/rte_mempool.h > > index 009bd10215..00c5aa961b 100644 > > --- a/lib/mempool/rte_mempool.h > > +++ b/lib/mempool/rte_mempool.h > > @@ -1314,10 +1314,9 @@ rte_mempool_cache_free(struct > rte_mempool_cache > > *cache); static __rte_always_inline struct rte_mempool_cache * > > rte_mempool_default_cache(struct rte_mempool *mp, unsigned lcore_id) > > { > > - if (mp->cache_size =3D=3D 0) > > - return NULL; > > + RTE_ASSERT(rte_lcore_id_is_valid(lcore_id)); > > > > - if (lcore_id >=3D RTE_MAX_LCORE) > > + if (mp->cache_size =3D=3D 0) > > return NULL; > > > > rte_mempool_trace_default_cache(mp, lcore_id, > > -- > > 2.25.1 > >