Commit Graph

4 Commits

Author SHA1 Message Date
Jaskaran Singh
3c06a5ce5e ANDROID: Split ANDROID_STRUCT_PADDING into separate configs
Not all non-GKI platforms support disabling ANDROID_STRUCT_PADDING,
as some modules may require Android vendor data. However, it would be
beneficial to have the option to disable some of the struct paddings,
such as ANDROID_KABI_RESERVE, for memory savings given a situation
where the ANDROID_STRUCT_PADDING config cannot be disabled.

Split the ANDROID_STRUCT_PADDING config into two configs, one to control
ANDROID_VENDOR_DATA and ANDROID_OEM_DATA, and another to control
ANDROID_KABI_RESERVE.

Bug: 206561931
Change-Id: Iea4b962dff386a17c9bef20ae048be4e17bf43ab
Signed-off-by: Jaskaran Singh <quic_jasksing@quicinc.com>
2022-04-07 05:44:50 +00:00
Qingqing Zhou
b7a6c15a6f ANDROID: Configure out the macros in android_kabi and android_vendor
Add one CONFIG to control removing the macros or not. On some platform,
configureing out the macros removes the associated members from the
structs, this reduces the object size of the slabs related with the
structs, therefore reduces the total slab memory consumption of system.

Besides, this also reduces vmlinux size a bit, therefore the total
kernel memory size increses a bit.

The macros are ANDROID_KABI_RESERVE, ANDROID_VENDOR_DATA,
ANDROID_VENDOR_DATA_ARRAY, ANDROID_OEM_DATA, ANDROID_OEM_DATA_ARRAY.

Bug: 206561931
Signed-off-by: Qingqing Zhou <quic_qqzhou@quicinc.com>
Change-Id: I0868d299ccce3c4b39f42af17916828500be6cc4
2022-01-12 16:49:39 +08:00
Greg Kroah-Hartman
f8b361d17d ANDROID: GKI: rework the ANDROID_KABI_USE() macro to not use __UNIQUE()
The __UNIQUE_ID() macro causes problems as it turns out to not be
deterministic across different compiler runs as it relies on the
__COUNTER__ macro which could have been used on other .h files previous
to this .h file being included.

This shows up specifically when building with "LTO=thin" vs. "LTO=full"
as different build paths seem to be triggered.

As the structure name isn't really needed at all here, we were just
including it for older compilers that could not handle anonymous
structures in a union, just drop the whole thing which resolves the abi
naming issue.

Bug: 210255585
Reported-by: Giuliano Procida <gprocida@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I6b9449fa9d26ffc5d66b2f0f3b41e2d5f3003f68
2021-10-29 10:57:02 +01:00
Greg Kroah-Hartman
d2eb8b0028 ANDROID: GKI: add android_kabi.h
This header file is to be used for various macros to help make keeping
the kernel ABI "stable" during an "ABI Freeze" period.

They are to be used both before the freeze (to anticipate places where
there will be changes), and after the freeze (to keep the abi stable for
structures where there were changes due to LTS or other changes to the
kernel tree.)

Strongly based on rh_kabi.h from Red Hat's RHEL kernel tree.

This adds support for "real" padding and the ability to replace fields
with other fields.

But, note that ABI changes will still be caught by libabigail at this
point in time, work on that is still ongoing.  When that is completed,
all that will be needed is to modify the _ANDROID_KABI_RESERVE() macro
in this file.  No other file changes should be needed.

Bug: 151154716
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I77038cc251c819c3ed22a9cb8843b185416b6727
2021-03-15 07:47:37 +00:00