[PATCH 0/5] platform/x86/amd/pmf: Clean up undesirable function outlining

Rong Zhang posted 5 patches 3 weeks, 3 days ago
drivers/platform/x86/amd/pmf/acpi.c |  76 +-----------------
drivers/platform/x86/amd/pmf/core.c |  22 ------
drivers/platform/x86/amd/pmf/pmf.h  | 150 +++++++++++++++++++++++++++++++-----
drivers/platform/x86/amd/pmf/spc.c  |  15 ----
drivers/platform/x86/amd/pmf/sps.c  |   5 --
5 files changed, 131 insertions(+), 137 deletions(-)
[PATCH 0/5] platform/x86/amd/pmf: Clean up undesirable function outlining
Posted by Rong Zhang 3 weeks, 3 days ago
The amd-pmf driver is notably bloated due to undesirable function
outlining and linkage. Simple and dump helper functions as well as
wrappers should really be static inline functions instead of global ones
from the very beginning, or else they are prone to the overhead of
function outlining and linkage, which bloats themselves and their
callers.

The series converts all these helper functions and wrappers into static
inline functions, and shrink the module (!CONFIG_AMD_PMF_DEBUG &&
CONFIG_AMD_PMF_UTIL_SUPPORT) size by 1472 Bytes (GCC 16 -O2):

      text       data        bss      total filename	(before)
     26810      31672       2768      61250 amd-pmf.ko

      text       data        bss      total filename	(after)
     26046      30964       2768      59778 amd-pmf.ko

As for CONFIG_AMD_PMF_DEBUG && CONFIG_AMD_PMF_UTIL_SUPPORT builds, the
module size is shrunk by 1187 Bytes:

      text       data        bss      total filename	(before)
     34593      45500       2784      82877 amd-pmf.ko

      text       data        bss      total filename	(after)
     33988      44918       2784      81690 amd-pmf.ko

This should also optimize the performance a little bit theoretically,
though it's probably not very important on modern hardware anyway.

Signed-off-by: Rong Zhang <i@rong.moe>
---
Rong Zhang (5):
      platform/x86/amd/pmf: Inline !AMD_PMF_DEBUG stub
      platform/x86/amd/pmf: Inline simple helper functions of Core Layer
      platform/x86/amd/pmf: Inline simple helper function of SPS Layer
      platform/x86/amd/pmf: Inline simple helper function of Smart PC TA interfaces
      platform/x86/amd/pmf: Inline wrappers of ap{mf,ts}_if_call_store_buffer()

 drivers/platform/x86/amd/pmf/acpi.c |  76 +-----------------
 drivers/platform/x86/amd/pmf/core.c |  22 ------
 drivers/platform/x86/amd/pmf/pmf.h  | 150 +++++++++++++++++++++++++++++++-----
 drivers/platform/x86/amd/pmf/spc.c  |  15 ----
 drivers/platform/x86/amd/pmf/sps.c  |   5 --
 5 files changed, 131 insertions(+), 137 deletions(-)
---
base-commit: 9ffed84a24d60ec506d8961fe138f0baa92fdbd0
change-id: 6f1861db-amd-pmf-fix-outlining-204546e884cf

Thanks,
Rong
Re: [PATCH 0/5] platform/x86/amd/pmf: Clean up undesirable function outlining
Posted by Rong Zhang 6 days, 20 hours ago
Hi all,

On Tue, 2026-09-01 at 23:02 +0800, Rong Zhang wrote:
> The amd-pmf driver is notably bloated due to undesirable function
> outlining and linkage. Simple and dump helper functions as well as
> wrappers should really be static inline functions instead of global ones
> from the very beginning, or else they are prone to the overhead of
> function outlining and linkage, which bloats themselves and their
> callers.
> 
> The series converts all these helper functions and wrappers into static
> inline functions, and shrink the module (!CONFIG_AMD_PMF_DEBUG &&
> CONFIG_AMD_PMF_UTIL_SUPPORT) size by 1472 Bytes (GCC 16 -O2):
> 
>       text       data        bss      total filename	(before)
>      26810      31672       2768      61250 amd-pmf.ko
> 
>       text       data        bss      total filename	(after)
>      26046      30964       2768      59778 amd-pmf.ko
> 
> As for CONFIG_AMD_PMF_DEBUG && CONFIG_AMD_PMF_UTIL_SUPPORT builds, the
> module size is shrunk by 1187 Bytes:
> 
>       text       data        bss      total filename	(before)
>      34593      45500       2784      82877 amd-pmf.ko
> 
>       text       data        bss      total filename	(after)
>      33988      44918       2784      81690 amd-pmf.ko
> 
> This should also optimize the performance a little bit theoretically,
> though it's probably not very important on modern hardware anyway.
> 
> Signed-off-by: Rong Zhang <i@rong.moe>

Gentle ping.

Thanks,
Rong

> ---
> Rong Zhang (5):
>       platform/x86/amd/pmf: Inline !AMD_PMF_DEBUG stub
>       platform/x86/amd/pmf: Inline simple helper functions of Core Layer
>       platform/x86/amd/pmf: Inline simple helper function of SPS Layer
>       platform/x86/amd/pmf: Inline simple helper function of Smart PC TA interfaces
>       platform/x86/amd/pmf: Inline wrappers of ap{mf,ts}_if_call_store_buffer()
> 
>  drivers/platform/x86/amd/pmf/acpi.c |  76 +-----------------
>  drivers/platform/x86/amd/pmf/core.c |  22 ------
>  drivers/platform/x86/amd/pmf/pmf.h  | 150 +++++++++++++++++++++++++++++++-----
>  drivers/platform/x86/amd/pmf/spc.c  |  15 ----
>  drivers/platform/x86/amd/pmf/sps.c  |   5 --
>  5 files changed, 131 insertions(+), 137 deletions(-)
> ---
> base-commit: 9ffed84a24d60ec506d8961fe138f0baa92fdbd0
> change-id: 6f1861db-amd-pmf-fix-outlining-204546e884cf
> 
> Thanks,
> Rong
Re: [PATCH 0/5] platform/x86/amd/pmf: Clean up undesirable function outlining
Posted by Mario Limonciello 3 weeks, 3 days ago
On 9/1/26 10:02, Rong Zhang wrote:
> The amd-pmf driver is notably bloated due to undesirable function
> outlining and linkage. Simple and dump helper functions as well as
> wrappers should really be static inline functions instead of global ones
> from the very beginning, or else they are prone to the overhead of
> function outlining and linkage, which bloats themselves and their
> callers.
> 
> The series converts all these helper functions and wrappers into static
> inline functions, and shrink the module (!CONFIG_AMD_PMF_DEBUG &&
> CONFIG_AMD_PMF_UTIL_SUPPORT) size by 1472 Bytes (GCC 16 -O2):
> 
>        text       data        bss      total filename	(before)
>       26810      31672       2768      61250 amd-pmf.ko
> 
>        text       data        bss      total filename	(after)
>       26046      30964       2768      59778 amd-pmf.ko
> 
> As for CONFIG_AMD_PMF_DEBUG && CONFIG_AMD_PMF_UTIL_SUPPORT builds, the
> module size is shrunk by 1187 Bytes:
> 
>        text       data        bss      total filename	(before)
>       34593      45500       2784      82877 amd-pmf.ko
> 
>        text       data        bss      total filename	(after)
>       33988      44918       2784      81690 amd-pmf.ko
> 
> This should also optimize the performance a little bit theoretically,
> though it's probably not very important on modern hardware anyway.
> 
> Signed-off-by: Rong Zhang <i@rong.moe>
> ---
> Rong Zhang (5):
>        platform/x86/amd/pmf: Inline !AMD_PMF_DEBUG stub
>        platform/x86/amd/pmf: Inline simple helper functions of Core Layer
>        platform/x86/amd/pmf: Inline simple helper function of SPS Layer
>        platform/x86/amd/pmf: Inline simple helper function of Smart PC TA interfaces
>        platform/x86/amd/pmf: Inline wrappers of ap{mf,ts}_if_call_store_buffer()
> 
>   drivers/platform/x86/amd/pmf/acpi.c |  76 +-----------------
>   drivers/platform/x86/amd/pmf/core.c |  22 ------
>   drivers/platform/x86/amd/pmf/pmf.h  | 150 +++++++++++++++++++++++++++++++-----
>   drivers/platform/x86/amd/pmf/spc.c  |  15 ----
>   drivers/platform/x86/amd/pmf/sps.c  |   5 --
>   5 files changed, 131 insertions(+), 137 deletions(-)
> ---
> base-commit: 9ffed84a24d60ec506d8961fe138f0baa92fdbd0
> change-id: 6f1861db-amd-pmf-fix-outlining-204546e884cf
> 
> Thanks,
> Rong

Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org>