Skip to content
Snippets Groups Projects
Commit 554eb9d6 authored by Todd Kjos's avatar Todd Kjos
Browse files

ANDROID: KABI macros to release excess KABI fields for use with backports


With KMI freeze, we reserve padding in structs to be exclusively used
for LTS updates that would otherwise break the KMI. These fields are
reserved via the ANDROID_KABI_RESERVE() macro that adds a u64 field to
the struct. The ANDROID_KABI_USE() macro is used when the field is
needed for an LTS patch backport.

Since these fields must be reserved at KMI freeze time, we have make
our best guess at what might be needed - and sometimes reserve too many
fields. An example of this is the 8 ANDROID_KABI_RESERVE() fields in
`struct net_device` for android13-5.15. We are now 3 years into the
6 year lifetime for android13-5.15 and none of those 8 padding fields
have been used. At this point it is reasonable to allow 1 or 2 of those
fields to be used for non-LTS backports.

We won't relax the rule that ANDROID_KABI_RESERVE() is exclusively
for LTS backports, Instead we'll introduce a new macro,
ANDROID_KABI_BACKPORT_OK() to release some KABI fields for general use
as the branches age and the use of padding for LTS becomes unlikely.

We release the field for use by replacing the ANDROID_KABI_RESERVE()
with the new ANDROID_KABI_BACKPORT_OK() macro, which has the exact
same implementation, but allows others to use it for backporting
features from upstream.

When an ANDROID_KABI_BACKPORT_OK() field is going to be used, the
ANDROID_KABI_BACKPORT_USE() macro is used to indicate that the field
was used for a feature backport, not an LTS patch.

This patch adds the two new macros:

ANDROID_KABI_BACKPORT_OK() : exactly the same as ANDROID_KABI_RESERVE()
ANDROID_KABI_BACKPORT_USE() ; exacly the same as ANDROID_KABI_USE()

Patches that change an ANDROID_KABI_RESERVE() to ANDROID_KABI_BACKPORT_OK() must
be reviewed and get a CR+1 from gregkh@, joneslee@ or tkjos@ to make
sure it really is acceptable to reduce the padding for LTS merges.

Bug: 392673958
Signed-off-by: default avatarTodd Kjos <tkjos@google.com>
Change-Id: I19b9dfc16d891fb6fe48ec4379c6fa3dcb6adf24
(cherry picked from commit f1954b6e)
parent 773ad7ab
No related branches found
No related tags found
No related merge requests found
......@@ -90,6 +90,14 @@
#define ANDROID_KABI_RESERVE(number)
#endif
/*
* ANDROID_KABI_BACKPORT_OK
* Used to allow padding originally reserved with ANDROID_KABI_RESERVE
* to be used for backports of non-LTS patches by partners. These
* fields can by used by replacing with ANDROID_KABI_BACKPORT_USE()
* for partner backports.
*/
#define ANDROID_KABI_BACKPORT_OK(number) ANDROID_KABI_RESERVE(number)
/*
* Macros to use _after_ the ABI is frozen
......@@ -104,6 +112,17 @@
#define ANDROID_KABI_USE(number, _new) \
_ANDROID_KABI_REPLACE(_ANDROID_KABI_RESERVE(number), _new)
/*
* ANDROID_KABI_BACKPORT_USE(number, _new)
* Use a previous padding entry that was defined with
* ANDROID_KABI_BACKPORT_OK(). This is functionally identical
* to ANDROID_KABI_USE() except that it differentiates the
* normal use of KABI fields for LTS from KABI fields that
* were released for use with other backports from upstream.
*/
#define ANDROID_KABI_BACKPORT_USE(number, _new) \
ANDROID_KABI_USE(number, _new)
/*
* ANDROID_KABI_USE2(number, _new1, _new2)
* Use a previous padding entry that was defined with ANDROID_KABI_RESERVE for
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment