Skip to content
Snippets Groups Projects
  • Todd Kjos's avatar
    ANDROID: KABI macros to release excess KABI fields for use with backports · 554eb9d6
    Todd Kjos authored
    
    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)
    554eb9d6