From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0BF4BA0588; Fri, 17 Apr 2020 06:40:47 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D39511DDDB; Fri, 17 Apr 2020 06:40:46 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id BA80B1DD8D for ; Fri, 17 Apr 2020 06:40:45 +0200 (CEST) IronPort-SDR: YqLDZvRUE2TuM6ohIMvUaW056SwDEMjk9etaPE+WIdCflNgb2+ABknlrlNSSPz7r4gt3Rtm+YJ KwDvOHmu8JQQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Apr 2020 21:40:44 -0700 IronPort-SDR: sBKuQkrZMUctaQHonX04y8lyDqyUDLP1VnuCp+wvWFLclC5H/xolW44WB9bHDkBILoy4cwWcZ0 r5i+44MRCjHA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,393,1580803200"; d="scan'208";a="257462564" Received: from irsmsx101.ger.corp.intel.com ([163.33.3.153]) by orsmga006.jf.intel.com with ESMTP; 16 Apr 2020 21:40:43 -0700 Received: from irsmsx602.ger.corp.intel.com (163.33.146.8) by IRSMSX101.ger.corp.intel.com (163.33.3.153) with Microsoft SMTP Server (TLS) id 14.3.439.0; Fri, 17 Apr 2020 05:40:42 +0100 Received: from shsmsx603.ccr.corp.intel.com (10.109.6.143) by irsmsx602.ger.corp.intel.com (163.33.146.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Fri, 17 Apr 2020 05:40:41 +0100 Received: from shsmsx603.ccr.corp.intel.com ([10.109.6.143]) by SHSMSX603.ccr.corp.intel.com ([10.109.6.143]) with mapi id 15.01.1713.004; Fri, 17 Apr 2020 12:40:39 +0800 From: "Wang, Haiyue" To: Neil Horman CC: "dev@dpdk.org" , Jerin Jacob Kollanukkaran , "Richardson, Bruce" , Thomas Monjalon , David Marchand , "Yigit, Ferruh" Thread-Topic: [dpdk-dev] [PATCH v2 01/10] Add __rte_internal tag for functions and version target Thread-Index: AQHWFGFUpQ2UnOq6eUKbc1+qWqB+v6h8n5dg Date: Fri, 17 Apr 2020 04:40:39 +0000 Message-ID: <6128d6a6e4eb4b48856e23e505760dd6@intel.com> References: <20190525184346.27932-1-nhorman@tuxdriver.com> <20190613142344.9188-1-nhorman@tuxdriver.com> <20190613142344.9188-2-nhorman@tuxdriver.com> <018d2553c44b437387a39d040553cbb6@intel.com> <20200417023812.rrwe5t7rwfsk6j3p@penguin.lxd> In-Reply-To: <20200417023812.rrwe5t7rwfsk6j3p@penguin.lxd> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.2.0.6 x-originating-ip: [10.239.127.36] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v2 01/10] Add __rte_internal tag for functions and version target X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" > -----Original Message----- > From: Neil Horman > Sent: Friday, April 17, 2020 10:38 > To: Wang, Haiyue > Cc: dev@dpdk.org; Jerin Jacob Kollanukkaran ; Richard= son, Bruce > ; Thomas Monjalon ; Davi= d Marchand > ; Yigit, Ferruh > Subject: Re: [dpdk-dev] [PATCH v2 01/10] Add __rte_internal tag for funct= ions and version target >=20 > On Fri, Apr 17, 2020 at 02:04:30AM +0000, Wang, Haiyue wrote: > > Hi Neil, > > > > > -----Original Message----- > > > From: dev On Behalf Of Neil Horman > > > Sent: Thursday, June 13, 2019 22:24 > > > To: dev@dpdk.org > > > Cc: Neil Horman ; Jerin Jacob Kollanukkaran ; > Richardson, > > > Bruce ; Thomas Monjalon > > > Subject: [dpdk-dev] [PATCH v2 01/10] Add __rte_internal tag for funct= ions and version target > > > > > > This tag is meant to be used on function prototypes to identify > > > functions that are only meant to be used by internal DPDK libraries > > > (i.e. libraries that are built while building the SDK itself, as > > > identified by the defining of the BUILDING_RTE_SDK macro). When that > > > flag is not set, it will resolve to an error function attribute, caus= ing > > > build breakage for any compilation unit attempting to build it > > > > > > Validate the use of this tag in much the same way we validate > > > __rte_experimental. By adding an INTERNAL version to library map fil= es, > > > we can exempt internal-only functions from ABI checking, and handle t= hem > > > to ensure that symbols we wish to only be for internal use between dp= dk > > > libraries are properly tagged with __rte_experimental > > > > > > Note this patch updates the check-experimental-syms.sh script, which > > > normally only check the EXPERIMENTAL section to also check the INTERN= AL > > > section now. As such its been renamed to the now more appropriate > > > check-special-syms.sh > > > > > > Signed-off-by: Neil Horman > > > CC: Jerin Jacob Kollanukkaran > > > CC: Bruce Richardson > > > CC: Thomas Monjalon > > > --- > > > ...rimental-syms.sh =3D> check-special-syms.sh} | 24 +++++++++++++++= +++- > > > lib/librte_eal/common/include/rte_compat.h | 12 ++++++++++ > > > mk/internal/rte.compile-pre.mk | 6 ++--- > > > mk/target/generic/rte.vars.mk | 2 +- > > > 4 files changed, 39 insertions(+), 5 deletions(-) > > > rename buildtools/{check-experimental-syms.sh =3D> check-special-sym= s.sh} (53%) > > > > > .... > > > > > diff --git a/lib/librte_eal/common/include/rte_compat.h > b/lib/librte_eal/common/include/rte_compat.h > > > index 92ff28faf..739e8485c 100644 > > > --- a/lib/librte_eal/common/include/rte_compat.h > > > +++ b/lib/librte_eal/common/include/rte_compat.h > > > @@ -89,4 +89,16 @@ __attribute__((section(".text.experimental"))) > > > > > > #endif > > > > > > +/* > > > + * __rte_internal tags mark functions as internal only, If specified= in public > > > + * header files, this tag will resolve to an error directive, preven= ting > > > + * external applications from attempting to make calls to functions = not meant > > > + * for consumption outside the dpdk library > > > + */ > > > +#ifdef BUILDING_RTE_SDK > > > +#define __rte_internal __attribute__((section(".text.internal"))) > > > +#else > > > +#define __rte_internal __attribute__((error("This function cannot be= used outside of the core > DPDK > > > library"), \ > > > + section(".text.internal"))) > > > +#endif > > > #endif /* _RTE_COMPAT_H_ */ > > > > Since struct definition is also a kind of ABI (am I right ? ;-) ), like= : > > > Yes, thats correct, which is why I've advocated for making structs > opaque as part of the abi, but I suppose thats not where we are. :) >=20 Make sense, normally structs can't live alone without function API. A littl= e paranoid for type only ABI checking. ;-) And this definition is good for AB= I checking as we did it for EXPERIMENTAL. Thanks! Haiyue > > drivers/bus/pci/rte_bus_pci.h > > struct rte_pci_device { > > ... > > struct rte_intr_handle vfio_req_intr_handle; > > /**< Handler of VFIO request interrupt */ > > } __rte_internal; > > > > Then will capture the errors anyway by using one of __rte_internal defi= nition. > > error: 'section' attribute does not apply to types [-Werror=3Dattribut= es] > > error: 'error' attribute does not apply to types > > > As it is currently written, the __rte_internal macro is only written to > work on functions. If you don't want a struct to be part of the ABI, we > would need to either: >=20 > a) make a simmilar macro (say __rte_internal_data) which uses a simmilar > gcc attibute to catch external usage. >=20 > or >=20 > b) just move the strucute definition to a location that isn't exposed as > part of the external ABI >=20 > Neil >=20 > > > 2.20.1 > > > >