Merge branch 'strict-mm-typechecks-support' into features
authorVasily Gorbik <gor@linux.ibm.com>
Tue, 11 Mar 2025 14:29:44 +0000 (15:29 +0100)
committerVasily Gorbik <gor@linux.ibm.com>
Tue, 11 Mar 2025 14:29:44 +0000 (15:29 +0100)
commit5983ab168475e609a92669b6d6ca5e145a9ce5db
tree463868851e731e6f97f7ceaea3675f3001f81a42
parent8751b6e9e4abf3603b567e871768eb8cca8ef91a
parent03544866df1bc78fe740fc9d17816874ba7bde5a
Merge branch 'strict-mm-typechecks-support' into features

Heiko writes:

"The recent large kernel Rust thread where Linus commented about that
structures may be returned in registers [1] made me again aware that this
is not true for s390 where the ABI defines that structures are returned in
a return value buffer allocated by the caller. This was also mentioned by
Alexander Gordeev a couple of weeks ago.

In theory the -freg-struct-return compiler flag would allow to return small
structures in registers, however that has not been implemented for
s390. Juergen Christ did an experimental gcc implementation which shows the
benefit of such a change (bloat-o-meter):

add/remove: 3/2 grow/shrink: 12/441 up/down: 740/-7182 (-6442)

This result is not very impressive, and doesn't seem to justify a new ABI
for the kernel.

However there is still the existing STRICT_MM_TYPECHECKS which can be used
to change some mm types from structures to simple scalar types. Changing
the mm types results in:

add/remove: 2/8 grow/shrink: 25/116 up/down: 3902/-6204 (-2302)

Which is already a third of the possible savings which would be the result
of the described ABI change.

Therefore add support for a configurable STRICT_MM_TYPECHECKS which allows
to generate better code, but also allows to have type checking for debug
builds."

[1] https://lore.kernel.org/all/CAHk-=wgb1g9VVHRaAnJjrfRFWAOVT2ouNOMqt0js8h3D6zvHDw@mail.gmail.com/

* strict-mm-typechecks-support:
  s390/mm: Add configurable STRICT_MM_TYPECHECKS
  s390/mm: Convert pgste_val() into function
  s390/mm: Convert pgprot_val() into function
  s390/mm: Use pgprot_val() instead of open coding

Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
arch/s390/configs/debug_defconfig
arch/s390/include/asm/pgtable.h
arch/s390/mm/init.c
arch/s390/mm/pgtable.c