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 40E2142493; Thu, 26 Jan 2023 16:17:33 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2568A40223; Thu, 26 Jan 2023 16:17:33 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 7AEDC400D7 for ; Thu, 26 Jan 2023 16:17:31 +0100 (CET) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 30Q9taZG007298; Thu, 26 Jan 2023 07:17:28 -0800 Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2177.outbound.protection.outlook.com [104.47.57.177]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3nbn7220tq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 26 Jan 2023 07:17:28 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TFLo4sn3kku5XqkyBxS/DNrAtjUzb/hq4TDV1TGQ2nuvOqFTOpruMDzNEKnE13oDMzeJNv5FKM/KBDPWI4X2+7txZVHdf/PWXJuhoYbQd7fSu8xM30tY+aMDHdvCP7oROjDzFaSQfX42RBBIkpyOhxDxKTxFv732129GjslhY2fYyKJw69AxDMmBMQRGsJ0ktvzEEC3ZnySN1ZHxRimDuBySlc1WEiYqel6gLAY3AiiUKpnCz9egPwVHNzWWkCoFxMdqMgyEV/TixKisMEGhjXW+RTF5P5n3eTdPKuZ8meIqylX9K6rMTkMcqjRvM90vHh62Tdgem0qtyhhquGZ/Pg== 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=V2RglQglrO9O0BGt8V4qBJpdSr6QfWeFP7Ay2ZHPlnw=; b=FwQ+olI1LA8jfxbQcwSdnkOjb9NPdwOXTcQms0m6NbhaEv5jU+HLNKNDvpQ+617HN6rmhK7gaExrJrQK0Wsn44pYYAVuDMHYN3BbWdw5KiLgX2aA45OYj519o59w29HdUb8054AoUq26SF1f6ybwgASkHrYAOyIEvJB2nurfF9tclxBs0xE/x52zmJQTs5ASaSCAhhUoq9+b/aPwKDdsAu/YblcRhAkJqE1uXR/M4u3GAAuKG1Uryk6QavnUnzZ0ll0hot+xxnsGbhZSEDfJPRrILZjkixROye3xdUZ5CzX1AnlCXQFDZv7yxb/0usr8d32ghQtPRsoqPBvSt1YcJg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=marvell.com; dmarc=pass action=none header.from=marvell.com; dkim=pass header.d=marvell.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.onmicrosoft.com; s=selector1-marvell-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=V2RglQglrO9O0BGt8V4qBJpdSr6QfWeFP7Ay2ZHPlnw=; b=MSksxhNu/G1EFm4sajQyEJ5AcFSa5oxWVIMhLrXy1msqysiCtct5Rz1MSlq1E/4J1eB7EdlPkdiIyk+6ZswUrQ6BMh1x1xJegRLYy6nmLGsSTrhsh5RBm88hBdf+I7zO8gj3vJlmBATS9auSyHod4kI56srH9CXx87EIYOdORLI= Received: from DM4PR18MB4368.namprd18.prod.outlook.com (2603:10b6:5:39d::6) by BY3PR18MB4660.namprd18.prod.outlook.com (2603:10b6:a03:3c7::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.24; Thu, 26 Jan 2023 15:17:25 +0000 Received: from DM4PR18MB4368.namprd18.prod.outlook.com ([fe80::3117:f51c:37c2:fa05]) by DM4PR18MB4368.namprd18.prod.outlook.com ([fe80::3117:f51c:37c2:fa05%9]) with mapi id 15.20.6043.021; Thu, 26 Jan 2023 15:17:25 +0000 From: Tomasz Duszynski To: =?iso-8859-1?Q?Morten_Br=F8rup?= , "dev@dpdk.org" , Thomas Monjalon CC: Jerin Jacob Kollanukkaran , "Ruifeng.Wang@arm.com" , "mattias.ronnblom@ericsson.com" , "zhoumin@loongson.cn" , "bruce.richardson@intel.com" , "roretzla@linux.microsoft.com" Subject: RE: [PATCH v6 1/4] lib: add generic support for reading PMU events Thread-Topic: [PATCH v6 1/4] lib: add generic support for reading PMU events Thread-Index: AQHZLF9HxL6yMLPInESeqtNvHMF+j66nD34AgAlimuCAACzbsIAANw1A Date: Thu, 26 Jan 2023 15:17:25 +0000 Message-ID: References: <20230110234642.1188550-1-tduszynski@marvell.com> <20230119233916.4029128-1-tduszynski@marvell.com> <20230119233916.4029128-2-tduszynski@marvell.com> <98CBD80474FA8B44BF855DF32C47DC35D8769A@smartserver.smartshare.dk> A <98CBD80474FA8B44BF855DF32C47DC35D876B6@smartserver.smartshare.dk> In-Reply-To: <98CBD80474FA8B44BF855DF32C47DC35D876B6@smartserver.smartshare.dk> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: DM4PR18MB4368:EE_|BY3PR18MB4660:EE_ x-ms-office365-filtering-correlation-id: 48c8e787-2eae-4e5e-585a-08daffb06e2e x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: xKQT+h75xOihrCOdZ3gzDbmnNw4P00bu7qSY183V+6gE53NW8Tu0L7eCtlg/jMR/VWmrwkC3PaQMZVJ/UN+CYdWWQYXUiwudfs3P4+8CIwMpCVnZtZkW4HOhIBsEFXU4cByngiqlFHaue8yTRUpqNPg3y47eJ5O4cDdjVSws6R2AjR4HnsLqmJIUxXUXJWl6KjmWSu7wVubVWc+SxNimuJn5VC0gXOcMcsRdQ7HbLgkN8F4X7Q2o8MrXKy7oo7HmXOabDM8gL0ziNEgRlYCecji5DW+ArMKS+VN4OoZSbyQyRBgJzXNbozKFzGqTUkn3AT44Yd5AEZZs5HqBAhlC1AVZZgE/OHyNWR3NvomQQYEA032qsKiI7hQcvp9/qtaUtYaWVbjhpwY6EhAFXLkDPkihddOGvtcjzJYtY9CBEZzi9EtPG4eQCzMw9YeABn64SnoCLFB/JdhexMNXejMgNSpTRyf2aObBxMpxrs/OlV6CiHxVVnJT45laD8gXZq+rwnHP5J7mgEtPLB2PNrWowG/ZTf5EvmOIK0nqtz8bwV1i8rpfHoWZF3u5z4Xpb0erk+UbUq7543t13nfOGtAzV3Wa9QCzbCG6uspTuPg/ZCeaDInTC7g+LS9LMcXCHAQtoMVm6JKXBre2kCh7PSvjUqMAj4ShGKmLM6fGnIEVi3zcpBrrx/QNcjDlfmG+CpEdVypEJ4UMSYV7QmxkfoWICaVKzWiCU2sbuzZSRDKul9qVB3S860sXDlGEmhXKJ4YJYPQi8TcAYzBasw8XVB7u6BG+4Ilc+CzjcVLP1AgUIE8= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR18MB4368.namprd18.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230025)(4636009)(346002)(376002)(366004)(39860400002)(396003)(136003)(451199018)(45080400002)(55016003)(64756008)(66446008)(66556008)(76116006)(86362001)(83380400001)(8936002)(66476007)(66946007)(8676002)(5660300002)(2906002)(33656002)(66574015)(7696005)(966005)(122000001)(4326008)(316002)(38100700002)(71200400001)(478600001)(41300700001)(110136005)(52536014)(54906003)(38070700005)(26005)(9686003)(186003)(6506007)(41533002); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?Q?K0IMgsylUYr+vYnn/fbeApQWNb8oFJR1BNh5ADqoqvFGWK2uv6+xeT5wmL?= =?iso-8859-1?Q?2evDSsnXZKKfxCKODeAeIea/Dhelpw6IkyTt+bXlaL/LRK3X7lO4pyGU4Q?= =?iso-8859-1?Q?OihYwdIrfq5qavFmWEJ9yo3Vb46qKNx9A3Hq2DoKTL/OvPvYDyzxbCYmBo?= =?iso-8859-1?Q?iT0X+KJlMU+Bdwt962jK71KH7nm00WzkBWnQfcHvzIFkL0R32IIr7HSJiR?= =?iso-8859-1?Q?B7pV23b0ULuYH3glNaQ6vPJOgw6o78+jdIIlB+6iHwxeyrW81Wed+Rw/vT?= =?iso-8859-1?Q?81R47Yd7BvJC6V+wgFp+OPOdzOCOcIzm8R3ROOfFBxfg2kreSYOb1Ew7zo?= =?iso-8859-1?Q?8bGK+Dz5U2e1Ifo6zKQ583EzHsW2nNNThur1IHDpOGR0D7iutEg4oygtud?= =?iso-8859-1?Q?w/urUBDd3OLGfp3rO63gkVzWfb+McCQdqt8j9ty468/7+cqDSlWwTUuD5p?= =?iso-8859-1?Q?+6vlEZsKOpTxE8zTbT90tOrpcQP8qVKQ2n6bLik0asT1xxOsUICTOnvn8i?= =?iso-8859-1?Q?ccJdgkHCrEyaGmW9mT/0pAc/hEoQ3VGIl+PaL8acPq4WleAcpy/fHSpVBG?= =?iso-8859-1?Q?wnm6H0cTKyciDr5N/frsuVnQPYaQXQn6j/z4RYEi/fI9gu7dKCEI8BWCss?= =?iso-8859-1?Q?/B/uHuA9NuwKuzntjGIdsxKE+QbT/RwAYvTWFvbgDV5wMuMRV1r5Q61NqB?= =?iso-8859-1?Q?tJEGTMCbx54IyUh5yXwFzLQqb24CfpOFy2B1PKL1xHY/IUzHa3Esel1Yv7?= =?iso-8859-1?Q?KcjOhPXK7caiIM5rpZSjp/KqAx7ylSPlCRNoEdmO/d/fKLqskbHn+zsweJ?= =?iso-8859-1?Q?QFQ8Iy7YULtZptB+vdmGyN2iMqE9Tbdva7gLm+vdWDwMU9Kwy5mkNRXoM0?= =?iso-8859-1?Q?ltuLz/JNuOkVdNFiMwjdJcA63SRLMZJBapU/1W5jYvQFdatiVY3M86mzRK?= =?iso-8859-1?Q?lDE2mEPErwMviJjYqWKaJnotO1YEa+wF7oP8OOwHtlMgSduWIolLSUG/Qb?= =?iso-8859-1?Q?1ZO/NhdlpkL4Jqrbd7RR0G4S+feURpSy0HC4vjc2xUlgR3LV7ZX3Y2XcEA?= =?iso-8859-1?Q?DISiM8u+3xszfWdeHMR+2LDtBycFsbx7fThLnbUQWkeT2Jf6eULkmDpCHl?= =?iso-8859-1?Q?8RoQOhByjGX7hOSycq3YgTws6uOwA4mG0RXfZ4rW/JLr29fnmwQaIhPw1Q?= =?iso-8859-1?Q?4wMS1zUvz7Gme7Tisq134jorYsgbgrvJsOyEjT+40H2nfo4gCdfjnR0wcm?= =?iso-8859-1?Q?l8Zb+/WkWcIMUKdoRAJxRrHYSLiPAiG8kt2yGENnIav167AitWbh29sDM/?= =?iso-8859-1?Q?3oXuPg00SCqrsYlv33qpF3urxx88TtPbBocOv88LAbXJlKLNOYzCFO9s4o?= =?iso-8859-1?Q?riqSFivM/6/EpoMBw0TumiLjkEQ3ZIl6I5WnWu8JNCtwNVbxacpZgGzC4J?= =?iso-8859-1?Q?wngssjA/zba8FMhzqAzHjSHWrDuwAqLLcfqERaZ74Ov0hF7HSFDcDa7AtH?= =?iso-8859-1?Q?y0qa0Sx19BDpdXGU+pS8LvfCgdyM0oOtTy9ffiFW9w/SNYuXw3i5ptctIl?= =?iso-8859-1?Q?0Ii1B5RQyG4OzvVL/5MJPTEUTnlYmbxhCIfM9ezHtGrCGDtw13e/+KxITa?= =?iso-8859-1?Q?M7KLSNFCV4rWp9geVxa/9qOx1W3g696VVK?= Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: marvell.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM4PR18MB4368.namprd18.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 48c8e787-2eae-4e5e-585a-08daffb06e2e X-MS-Exchange-CrossTenant-originalarrivaltime: 26 Jan 2023 15:17:25.3892 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 70e1fb47-1155-421d-87fc-2e58f638b6e0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: QqZsrmkMLqydv1Nq7NGSOWhyMz+kg6fguGcZOiCRrHJM1REQSuyRlULNCGhXzhZ9VMjLIFLEcaUQz2SRwFzHJg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY3PR18MB4660 X-Proofpoint-GUID: 7MG7WXhTg3ebXyXuxTX0HZhkdX9kfef5 X-Proofpoint-ORIG-GUID: 7MG7WXhTg3ebXyXuxTX0HZhkdX9kfef5 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-01-26_07,2023-01-25_01,2022-06-22_01 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 >-----Original Message----- >From: Morten Br=F8rup >Sent: Thursday, January 26, 2023 1:30 PM >To: Tomasz Duszynski ; dev@dpdk.org; Thomas Monjal= on >Cc: Jerin Jacob Kollanukkaran ; Ruifeng.Wang@arm.com; >mattias.ronnblom@ericsson.com; zhoumin@loongson.cn; bruce.richardson@intel= .com; >roretzla@linux.microsoft.com >Subject: [EXT] RE: [PATCH v6 1/4] lib: add generic support for reading PMU= events > >External Email > >---------------------------------------------------------------------- >> From: Tomasz Duszynski [mailto:tduszynski@marvell.com] >> Sent: Thursday, 26 January 2023 10.40 >> >> >From: Morten Br=F8rup >> >Sent: Friday, January 20, 2023 10:47 AM >> > >> >> From: Tomasz Duszynski [mailto:tduszynski@marvell.com] >> >> Sent: Friday, 20 January 2023 00.39 >> >> >> >> Add support for programming PMU counters and reading their values >> >> in runtime bypassing kernel completely. >> >> >> >> This is especially useful in cases where CPU cores are isolated >> >> (nohz_full) i.e run dedicated tasks. In such cases one cannot use >> >> standard perf utility without sacrificing latency and performance. >> >> >> >> Signed-off-by: Tomasz Duszynski >> >> --- >> > >> >If you insist on passing lcore_id around as a function parameter, the >> function description must >> >mention that the lcore_id parameter must be set to rte_lcore_id() for >> the functions where this is a >> >requirement, including all functions that use those functions. > >Perhaps I'm stating this wrong, so let me try to rephrase: > >As I understand it, some of the setup functions must be called from the EA= L thread that executes >that function - due to some syscall (SYS_perf_event_open) needing to be ca= lled from the thread >itself. > >Those functions should not take an lcore_id parameter. Otherwise, I would = expect to be able to call >those functions from e.g. the main thread and pass the lcore_id of any EAL= thread as a parameter, >which you at the bottom of this email [1] explained is not possible. > >[1]: https://urldefense.proofpoint.com/v2/url?u=3Dhttp- >3A__inbox.dpdk.org_dev_DM4PR18MB4368461EC42603F77A7DC1BCD2E09- >40DM4PR18MB4368.namprd18.prod.outlook.com_&d=3DDwIFAw&c=3DnKjWec2b6R0mOyPa= z7xtfQ&r=3DPZNXgrbjdlXxVEEGYkxI >xRndyEUwWU_ad5ce22YI6Is&m=3DQkMcmM2epUOCdRd6xI5o3d2nQaqruy0GvOQUgbn75cLlzo= bEVMwLBUiGXADiuvVz&s=3D5K9oM8 >e7u52C_0_5xtWIKl31aXRHhJDKoQTDQp5EHWY&e=3D > >> > >> >> Not sure why are you insisting so much on removing that rte_lcore_id(). >> Yes that macro evaluates >> to integer but if you don't think about internals this resembles a >> function call. > >I agree with this argument. And for that reason, passing lcore_id around c= ould be relevant. > >I only wanted to bring your attention to the low cost of fetching it insid= e the functions, as an >alternative to passing it as an argument. > >> >> Then natural pattern is to call it once and reuse results if possible. > >Yes, and I would usually agree to using this pattern. > >> Passing lcore_id around >> implies that calls are per l-core, why would that confuse anyone >> reading that code? > >This is where I disagree: Passing lcore_id as a parameter to a function do= es NOT imply that the >function is running on that lcore! > >E.g rte_mempool_default_cache(struct rte_mempool *mp, unsigned lcore_id) [= 2] takes lcore_id as a >parameter, and does not assume that lcore_id=3D=3Drte_lcore_id(). > Oh, now I got your point! Okay then, if this is going to cause confusion because of misleading self-documenting code I'll change that. =20 >[2]: https://urldefense.proofpoint.com/v2/url?u=3Dhttps- >3A__elixir.bootlin.com_dpdk_latest_source_lib_mempool_rte-5Fmempool.h- >23L1315&d=3DDwIFAw&c=3DnKjWec2b6R0mOyPaz7xtfQ&r=3DPZNXgrbjdlXxVEEGYkxIxRnd= yEUwWU_ad5ce22YI6Is&m=3DQkMcmM2ep >UOCdRd6xI5o3d2nQaqruy0GvOQUgbn75cLlzobEVMwLBUiGXADiuvVz&s=3D4pnL_TZcVhj476= u19ybcn2Rbad6OTb3k2U- >nhFvhZ0k&e=3D > >> >> Besides, all functions taking it are internal stuff hence you cannot >> call it elsewhere. > >OK. I agree that this reduces the risk of incorrect use. > >Generally, I think that internal functions should be documented too. Not t= o the full extent, like >public functions, but some documentation is nice. > >And if there are special requirements to a function parameter, it should b= e documented with that >function. Requiring that the lcore_id parameter must be =3D=3D rte_lcore_i= d() is certainly a special >requirement. > >It might just be me worrying too much, so... If nobody else complains abou= t this, I can live with >it as is. Assuming that none of the public functions have this special req= uirement (either directly >or indirectly, by calling functions with the special requirement). > >> >> >Alternatively, follow my previous suggestion: Omit the lcore_id >> function parameter, and use >> >rte_lcore_id() instead. >> > >>