DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ray Kinsella <mdr@ashroe.eu>
To: dev@dpdk.org
Cc: Ferruh Yigit <ferruh.yigit@intel.com>,
	Ray Kinsella <mdr@ashroe.eu>, Neil Horman <nhorman@tuxdriver.com>,
	Thomas Monjalon <thomas@monjalon.net>,
	Luca Boccassi <bluca@debian.org>,
	David Marchand <david.marchand@redhat.com>,
	Bruce Richardson <bruce.richardson@intel.com>,
	Ian Stokes <ian.stokes@intel.com>,
	Eelco Chaudron <echaudro@redhat.com>,
	Andrzej Ostruszka <amo@semihalf.com>,
	Kevin Traynor <ktraynor@redhat.com>,
	John McNamara <john.mcnamara@intel.com>,
	Marko Kovacevic <marko.kovacevic@intel.com>,
	Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Subject: [dpdk-dev] [PATCH v6] abi: provide experimental alias of API for old apps
Date: Fri, 15 May 2020 16:01:53 +0100	[thread overview]
Message-ID: <1589554922-4549-1-git-send-email-mdr@ashroe.eu> (raw)
In-Reply-To: <20200514161104.1546493-1-ferruh.yigit@intel.com>

From: Ferruh Yigit <ferruh.yigit@intel.com>

On v20.02 some APIs matured and symbols moved from EXPERIMENTAL to
DPDK_20.0.1 block.

This had the affect of breaking the applications that were using these
APIs on v19.11. Although there is no modification of the APIs and the
action is positive and matures the APIs, the affect can be negative to
applications.

When a maintainer is promoting an API to become part of the next major
ABI version by removing the experimental tag. The maintainer may
choose to offer an alias to the experimental tag, to prevent these
breakages in future.

The following changes are made to enabling aliasing:

Updated to the abi policy and abi versioning documents.

Created VERSION_SYMBOL_EXPERIMENTAL helper macro.

Updated the 'check-symbols.sh' buildtool, which was complaining that the
symbol is in EXPERIMENTAL tag in .map file but it is not in the
.experimental section (__rte_experimental tag is missing).
Updated tool in a way it won't complain if the symbol in the
EXPERIMENTAL tag duplicated in some other block in .map file (versioned)

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Signed-off-by: Ray Kinsella <mdr@ashroe.eu>
---

This patch depends on "doc: fix references to bind_default_symbol".
https://patches.dpdk.org/patch/69850/

Cc: Neil Horman <nhorman@tuxdriver.com>
Cc: Thomas Monjalon <thomas@monjalon.net>
Cc: Luca Boccassi <bluca@debian.org>
Cc: David Marchand <david.marchand@redhat.com>
Cc: Bruce Richardson <bruce.richardson@intel.com>
Cc: Ian Stokes <ian.stokes@intel.com>
Cc: Eelco Chaudron <echaudro@redhat.com>
Cc: Andrzej Ostruszka <amo@semihalf.com>
Cc: Ray Kinsella <mdr@ashroe.eu>
CC: Kevin Traynor <ktraynor@redhat.com>

v2:
* Commit log updated

v3:
* added suggested comment to VERSION_SYMBOL_EXPERIMENTAL macro

v4:
* update script name in commit log, remove empty line

v5:
* incorporate policy and version doc changes
* remove changes to librte_meter

v6:
* clarified dependency chain includes "doc: fix references to bind_default_symbol".

 buildtools/check-symbols.sh                      |   3 +-
 doc/guides/contributing/abi_policy.rst           |  10 ++
 doc/guides/contributing/abi_versioning.rst       | 158 ++++++++++++++++++++++-
 lib/librte_eal/include/rte_function_versioning.h |   9 ++
 4 files changed, 178 insertions(+), 2 deletions(-)

diff --git a/buildtools/check-symbols.sh b/buildtools/check-symbols.sh
index 3df57c3..e407553 100755
--- a/buildtools/check-symbols.sh
+++ b/buildtools/check-symbols.sh
@@ -26,7 +26,8 @@ ret=0
 for SYM in `$LIST_SYMBOL -S EXPERIMENTAL $MAPFILE |cut -d ' ' -f 3`
 do
 	if grep -q "\.text.*[[:space:]]$SYM$" $DUMPFILE &&
-		! grep -q "\.text\.experimental.*[[:space:]]$SYM$" $DUMPFILE
+		! grep -q "\.text\.experimental.*[[:space:]]$SYM$" $DUMPFILE &&
+		$LIST_SYMBOL -s $SYM $MAPFILE | grep -q EXPERIMENTAL
 	then
 		cat >&2 <<- END_OF_MESSAGE
 		$SYM is not flagged as experimental
diff --git a/doc/guides/contributing/abi_policy.rst b/doc/guides/contributing/abi_policy.rst
index 86e7dd9..c33bff1 100644
--- a/doc/guides/contributing/abi_policy.rst
+++ b/doc/guides/contributing/abi_policy.rst
@@ -160,6 +160,11 @@ The requirements for changing the ABI are:
      ``experimental``, as described in the section on :ref:`Experimental APIs
      and Libraries <experimental_apis>`.

+   - In situations in which an ``experimental`` symbol has been stable for some
+     time. When promoting the symbol to become part of the next ABI version, the
+     maintainer may choose to provide an alias to the ``experimental`` tag, so
+     as not to break consuming applications.
+
 #. If a newly proposed API functionally replaces an existing one, when the new
    API becomes non-experimental, then the old one is marked with
    ``__rte_deprecated``.
@@ -318,6 +323,11 @@ not required. Though, an API should remain in experimental state for at least
 one release. Thereafter, the normal process of posting patch for review to
 mailing list can be followed.

+After the experimental tag has been formally removed, a tree/sub-tree maintainer
+may choose to offer an alias to the experimental tag so as not to break
+applications using the symbol. The alias is then dropped at the declaration of
+next major ABI version.
+
 Libraries
 ~~~~~~~~~

diff --git a/doc/guides/contributing/abi_versioning.rst b/doc/guides/contributing/abi_versioning.rst
index 7065979..27b5231 100644
--- a/doc/guides/contributing/abi_versioning.rst
+++ b/doc/guides/contributing/abi_versioning.rst
@@ -156,6 +156,11 @@ The macros exported are:
   ``be`` to signal that it is being used as an implementation of a particular
   version of symbol ``b``.

+* ``VERSION_SYMBOL_EXPERIMENTAL(b, e)``: Creates a symbol version table entry
+  binding versioned symbol ``b@EXPERIMENTAL`` to the internal function ``be``.
+  The macro is used when a symbol matures to become part of the stable ABI, to
+  provide an alias to experimental for some time.
+
 .. _example_abi_macro_usage:

 Examples of ABI Macro use
@@ -361,7 +366,7 @@ and a new DPDK_21 version, used by future built applications.
 .. note::

    **Before you leave**, please take care to the review the sections on
-   :ref:`Mapping static symbols <mapping_static_symbols>`, :ref:`Enabling
+   :ref:`mapping static symbols <mapping_static_symbols>`, :ref:`enabling
    versioning macros <enabling_versioning_macros>` and :ref:`ABI deprecation
    <abi_decprecation>`.

@@ -415,6 +420,157 @@ at the start of the head of the file. This will indicate to the tool-chain to
 enable the function version macros when building. There is no corresponding
 directive required for the ``make`` build system.

+.. _aliasing_experimental_symbols:
+
+Aliasing experimental symbols
+_____________________________
+
+In situations in which an ``experimental`` symbol has been stable for some time,
+and it becomes a candidate for promotion to the stable ABI. At this time, when
+promoting the symbol, maintainer may choose to provide an alias to the
+``experimental`` symbol version, so as not to break consuming applications.
+
+The process to provide an alias to ``experimental`` is similar to that, of
+:ref:`symbol visioning <example_abi_macro_usage>` described above. Assume we
+have an experimental function ``rte_acl_create`` as follows
+
+.. code-block:: c
+
+ #include <rte_compat.h>;
+
+ /*
+  * Create an acl context object for apps to
+  * manipulate
+  */
+ __rte_experimental
+ struct rte_acl_ctx *
+ rte_acl_create(const struct rte_acl_param *param)
+ {
+ ...
+ }
+
+In the map file, experimental symbols are listed as part of the ``experimental``
+version node.
+
+.. code-block:: none
+
+   DPDK_20 {
+        global:
+        ...
+
+        local: *;
+   };
+
+   EXPERIMENTAL {
+        global:
+
+        rte_acl_create;
+   };
+
+When we promote the symbol to the stable ABI, we simply strip the
+``rte_experimental`` annotation from the function and move the symbol from the
+``experimental`` node, to the node of the next major ABI version as follow.
+
+.. code-block:: c
+
+ /*
+  * Create an acl context object for apps to
+  * manipulate
+  */
+ struct rte_acl_ctx *
+ rte_acl_create(const struct rte_acl_param *param)
+ {
+        ...
+ }
+
+We then update the map file, adding the symbol ``rte_acl_create`` to the ``v21``
+version node.
+
+.. code-block:: none
+
+   DPDK_20 {
+        global:
+        ...
+
+        local: *;
+   };
+
+   DPDK_21 {
+        global:
+
+        rte_acl_create;
+   } DPDK_20;
+
+
+Although there are strictly no guarantees or commitments associated with
+:ref:`experimental symbols <experimental_apis>`, a maintainer may wish to offer
+an alias to experimental. The process to add an alias to experimental, is
+similar to the symbol versioning process. Assuming we have an experimental
+symbol as before, we now add the symbol to both the ``experimental`` and ``v21``
+version nodes.
+
+.. code-block:: c
+
+ #include <rte_compat.h>;
+ #include <rte_function_versioning.h>;
+
+ /*
+  * Create an acl context object for apps to
+  * manipulate
+  */
+ struct rte_acl_ctx *
+ rte_acl_create(const struct rte_acl_param *param)
+ {
+ ...
+ }
+
+ __rte_experimental
+ struct rte_acl_ctx *
+ rte_acl_create_e(const struct rte_acl_param *param)
+ {
+    return rte_acl_create(param);
+ }
+ VERSION_SYMBOL_EXPERIMENTAL(rte_acl_create, _e);
+
+ struct rte_acl_ctx *
+ rte_acl_create_v21(const struct rte_acl_param *param)
+ {
+    return rte_acl_create(param);
+ }
+ BIND_DEFAULT_SYMBOL(rte_acl_create, _v21, 21);
+
+
+In the map file, we map the symbol to both the experimental and ``v21`` version
+nodes.
+
+.. code-block:: none
+
+   DPDK_20 {
+        global:
+        ...
+
+        local: *;
+   };
+
+   DPDK_21 {
+        global:
+
+        rte_acl_create;
+   } DPDK_20;
+
+   EXPERIMENTAL {
+        global:
+
+        rte_acl_create;
+   };
+
+.. note::
+
+   Please note, similar to :ref:`symbol visioning <example_abi_macro_usage>`
+   when aliasing to experimental you will also need to take care of
+   :ref:`mapping static symbols <mapping_static_symbols>`.
+
+
 .. _abi_decprecation:

 Deprecating part of a public API
diff --git a/lib/librte_eal/include/rte_function_versioning.h b/lib/librte_eal/include/rte_function_versioning.h
index b9f862d..f588f26 100644
--- a/lib/librte_eal/include/rte_function_versioning.h
+++ b/lib/librte_eal/include/rte_function_versioning.h
@@ -47,6 +47,14 @@
 #define VERSION_SYMBOL(b, e, n) __asm__(".symver " RTE_STR(b) RTE_STR(e) ", " RTE_STR(b) "@DPDK_" RTE_STR(n))

 /*
+ * VERSION_SYMBOL_EXPERIMENTAL
+ * Creates a symbol version table entry binding the symbol <b>@EXPERIMENTAL to the internal
+ * function name <b><e>. The macro is used when a symbol matures to become part of the stable ABI,
+ * to provide an alias to experimental for some time.
+ */
+#define VERSION_SYMBOL_EXPERIMENTAL(b, e) __asm__(".symver " RTE_STR(b) RTE_STR(e) ", " RTE_STR(b) "@EXPERIMENTAL")
+
+/*
  * BIND_DEFAULT_SYMBOL
  * Creates a symbol version entry instructing the linker to bind references to
  * symbol <b> to the internal symbol <b><e>
@@ -79,6 +87,7 @@
  * No symbol versioning in use
  */
 #define VERSION_SYMBOL(b, e, n)
+#define VERSION_SYMBOL_EXPERIMENTAL(b, e)
 #define __vsym
 #define BIND_DEFAULT_SYMBOL(b, e, n)
 #define MAP_STATIC_SYMBOL(f, p) f __attribute__((alias(RTE_STR(p))))
--
2.7.4

  parent reply	other threads:[~2020-05-15 15:02 UTC|newest]

Thread overview: 71+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-29 12:29 [dpdk-dev] [RFC] meter: fix ABI break due to experimental tag removal Ferruh Yigit
2020-01-29 14:46 ` Bruce Richardson
2020-01-29 14:57 ` Andrzej Ostruszka
2020-01-29 16:25   ` Ferruh Yigit
2020-01-29 16:30     ` Andrzej Ostruszka
2020-01-29 16:40       ` Ferruh Yigit
2020-01-29 16:43 ` [dpdk-dev] [RFC v2] " Ferruh Yigit
2020-01-29 17:49   ` Andrzej Ostruszka
2020-01-30 12:33   ` Thomas Monjalon
2020-01-30 12:57     ` Luca Boccassi
2020-01-30 14:17       ` Thomas Monjalon
2020-01-30 14:21         ` Luca Boccassi
2020-01-30 15:55           ` Thomas Monjalon
2020-01-30 16:04             ` Luca Boccassi
2020-01-30 16:15               ` Eelco Chaudron
2020-01-30 20:20                 ` Thomas Monjalon
2020-02-03 11:10                   ` Eelco Chaudron
2020-01-31  9:25     ` Ferruh Yigit
2020-05-13 12:11   ` [dpdk-dev] [PATCH] meter: provide experimental alias of API for old apps Ferruh Yigit
2020-05-13 16:30     ` Thomas Monjalon
2020-05-13 17:37       ` Ferruh Yigit
2020-05-13 18:05     ` [dpdk-dev] [PATCH v2] " Ferruh Yigit
2020-05-14  8:44       ` Ray Kinsella
2020-05-14 11:53         ` [dpdk-dev] [dpdk-stable] " Ferruh Yigit
2020-05-14 11:52     ` [dpdk-dev] [PATCH v3] " Ferruh Yigit
2020-05-14 15:10       ` Ray Kinsella
2020-05-14 15:32       ` David Marchand
2020-05-14 15:56         ` Ray Kinsella
2020-05-14 16:07         ` Ferruh Yigit
2020-05-14 16:30           ` David Marchand
2020-05-14 16:11     ` [dpdk-dev] [PATCH v4] " Ferruh Yigit
2020-05-15 13:31       ` Thomas Monjalon
2020-05-15 14:41         ` Ray Kinsella
2020-05-15 15:03         ` Ray Kinsella
2020-05-15 14:36       ` [dpdk-dev] [PATCH v5] abi: " Ray Kinsella
2020-05-15 15:01       ` Ray Kinsella [this message]
2020-05-16 11:53         ` [dpdk-dev] [PATCH v6] " Neil Horman
2020-05-18 17:18           ` Thomas Monjalon
2020-05-18 17:34             ` Ferruh Yigit
2020-05-18 17:51               ` Thomas Monjalon
2020-05-18 18:32                 ` Ferruh Yigit
2020-05-19 14:13                   ` Ray Kinsella
2020-05-19 14:14             ` Ray Kinsella
2020-05-17 19:52       ` [dpdk-dev] [PATCH v4] meter: " Dumitrescu, Cristian
2020-05-18  6:29         ` Ray Kinsella
2020-05-18  9:22           ` Thomas Monjalon
2020-05-18  9:30             ` Ray Kinsella
2020-05-18 10:46               ` Thomas Monjalon
2020-05-18 11:18                 ` Dumitrescu, Cristian
2020-05-18 11:49                   ` Ray Kinsella
2020-05-18 11:48                 ` Ray Kinsella
2020-05-18 12:13                   ` Thomas Monjalon
2020-05-18 13:06                     ` Ray Kinsella
2020-05-18 18:30     ` [dpdk-dev] [PATCH v5] " Ferruh Yigit
2020-05-19 12:16     ` [dpdk-dev] [PATCH v6] " Ferruh Yigit
2020-05-19 13:26       ` Dumitrescu, Cristian
2020-05-19 14:24         ` Thomas Monjalon
2020-05-19 14:22       ` Ray Kinsella
2020-02-02 18:53 ` [dpdk-dev] [RFC] meter: fix ABI break due to experimental tag removal Neil Horman
2020-02-03 12:53   ` Ferruh Yigit
2020-02-04 12:02     ` Neil Horman
2020-02-05 10:04       ` Luca Boccassi
2020-02-05 11:32         ` Neil Horman
2020-02-13 17:40           ` Ray Kinsella
2020-02-14  2:40             ` Neil Horman
2020-02-14 11:36               ` Bruce Richardson
2020-02-14 20:48                 ` Neil Horman
2020-02-14 21:52                   ` Bruce Richardson
2020-02-15 13:43                     ` Neil Horman
2020-02-17 14:23                   ` Ray Kinsella
2020-02-17 15:37                     ` Neil Horman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1589554922-4549-1-git-send-email-mdr@ashroe.eu \
    --to=mdr@ashroe.eu \
    --cc=amo@semihalf.com \
    --cc=bluca@debian.org \
    --cc=bruce.richardson@intel.com \
    --cc=cristian.dumitrescu@intel.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=echaudro@redhat.com \
    --cc=ferruh.yigit@intel.com \
    --cc=ian.stokes@intel.com \
    --cc=john.mcnamara@intel.com \
    --cc=ktraynor@redhat.com \
    --cc=marko.kovacevic@intel.com \
    --cc=nhorman@tuxdriver.com \
    --cc=thomas@monjalon.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).