From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 795D2A0588;
	Fri, 17 Apr 2020 04:04:40 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id CF07F1D994;
	Fri, 17 Apr 2020 04:04:39 +0200 (CEST)
Received: from mga09.intel.com (mga09.intel.com [134.134.136.24])
 by dpdk.org (Postfix) with ESMTP id 0B9AF1C296
 for <dev@dpdk.org>; Fri, 17 Apr 2020 04:04:36 +0200 (CEST)
IronPort-SDR: GbjTuPDaM+Rjz/N3bkZTcu077BstGtjbjm5SQCXGdavtDDMaY/VeJZc8Xf8k7UFmY0KwrbN+lB
 yIhFlqqJ3gnA==
X-Amp-Result: SKIPPED(no attachment in message)
X-Amp-File-Uploaded: False
Received: from fmsmga007.fm.intel.com ([10.253.24.52])
 by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;
 16 Apr 2020 19:04:36 -0700
IronPort-SDR: 4XPgPWNZE1/PNgJ3DBP8RkIP5+LdylqacRTgKMG5gL8rogjokDJ4XAGKsuA4MuVXfA8kbmZk87
 WE+eGPqOQmEA==
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.72,393,1580803200"; d="scan'208";a="244578310"
Received: from irsmsx109.ger.corp.intel.com ([163.33.3.23])
 by fmsmga007.fm.intel.com with ESMTP; 16 Apr 2020 19:04:34 -0700
Received: from irsmsx605.ger.corp.intel.com (163.33.146.138) by
 IRSMSX109.ger.corp.intel.com (163.33.3.23) with Microsoft SMTP Server (TLS)
 id 14.3.439.0; Fri, 17 Apr 2020 03:04:33 +0100
Received: from shsmsx603.ccr.corp.intel.com (10.109.6.143) by
 IRSMSX605.ger.corp.intel.com (163.33.146.138) 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 03:04:32 +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 10:04:30 +0800
From: "Wang, Haiyue" <haiyue.wang@intel.com>
To: Neil Horman <nhorman@tuxdriver.com>, "dev@dpdk.org" <dev@dpdk.org>
CC: Jerin Jacob Kollanukkaran <jerinj@marvell.com>, "Richardson, Bruce"
 <bruce.richardson@intel.com>, Thomas Monjalon <thomas@monjalon.net>, "David
 Marchand" <david.marchand@redhat.com>, "Yigit, Ferruh"
 <ferruh.yigit@intel.com>
Thread-Topic: [dpdk-dev] [PATCH v2 01/10] Add __rte_internal tag for functions
 and version target
Thread-Index: AQHVIfPEwfztPXxx6Eef0nBC3Sep6Kh+a0DQ
Date: Fri, 17 Apr 2020 02:04:30 +0000
Message-ID: <018d2553c44b437387a39d040553cbb6@intel.com>
References: <20190525184346.27932-1-nhorman@tuxdriver.com>
 <20190613142344.9188-1-nhorman@tuxdriver.com>
 <20190613142344.9188-2-nhorman@tuxdriver.com>
In-Reply-To: <20190613142344.9188-2-nhorman@tuxdriver.com>
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 <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

Hi Neil,

> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Neil Horman
> Sent: Thursday, June 13, 2019 22:24
> To: dev@dpdk.org
> Cc: Neil Horman <nhorman@tuxdriver.com>; Jerin Jacob Kollanukkaran <jerin=
j@marvell.com>; Richardson,
> Bruce <bruce.richardson@intel.com>; Thomas Monjalon <thomas@monjalon.net>
> Subject: [dpdk-dev] [PATCH v2 01/10] Add __rte_internal tag for functions=
 and version target
>=20
> 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, causing
> build breakage for any compilation unit attempting to build it
>=20
> Validate the use of this tag in much the same way we validate
> __rte_experimental.  By adding an INTERNAL version to library map files,
> we can exempt internal-only functions from ABI checking, and handle them
> to ensure that symbols we wish to only be for internal use between dpdk
> libraries are properly tagged with __rte_experimental
>=20
> Note this patch updates the check-experimental-syms.sh script, which
> normally only check the EXPERIMENTAL section to also check the INTERNAL
> section now.  As such its been renamed to the now more appropriate
> check-special-syms.sh
>=20
> Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
> CC: Jerin Jacob Kollanukkaran <jerinj@marvell.com>
> CC: Bruce Richardson <bruce.richardson@intel.com>
> CC: Thomas Monjalon <thomas@monjalon.net>
> ---
>  ...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-syms.sh=
} (53%)
>=20
....

> 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")))
>=20
>  #endif
>=20
> +/*
> + * __rte_internal tags mark functions as internal only, If specified in =
public
> + * header files, this tag will resolve to an error directive, preventing
> + * 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 use=
d 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:

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 definiti=
on.
	error: 'section' attribute does not apply to types [-Werror=3Dattributes]
	error: 'error' attribute does not apply to types

> 2.20.1