[PATCH] x86/apic: Inline __x2apic_send_IPI_dest()

Eric Dumazet posted 1 patch 1 month, 2 weeks ago
There is a newer version of this series
arch/x86/kernel/apic/local.h       | 8 +++++++-
arch/x86/kernel/apic/x2apic_phys.c | 6 ------
2 files changed, 7 insertions(+), 7 deletions(-)
[PATCH] x86/apic: Inline __x2apic_send_IPI_dest()
Posted by Eric Dumazet 1 month, 2 weeks ago
Avoid one call/ret in networking RPS/RFS fast path, at a little space cost.

scripts/bloat-o-meter -t vmlinux.before vmlinux.after
add/remove: 0/2 grow/shrink: 2/0 up/down: 102/-86 (16)
Function                                     old     new   delta
x2apic_send_IPI                              165     217     +52
__x2apic_send_IPI_mask                       617     667     +50
__pfx___x2apic_send_IPI_dest                  16       -     -16
__x2apic_send_IPI_dest                        70       -     -70

Signed-off-by: Eric Dumazet <edumazet@google.com>
---
 arch/x86/kernel/apic/local.h       | 8 +++++++-
 arch/x86/kernel/apic/x2apic_phys.c | 6 ------
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/arch/x86/kernel/apic/local.h b/arch/x86/kernel/apic/local.h
index bdcf609eb28352530ffcbb3c66ffb32c82df4d7f..14ac32c014eebff968658c5fb4db136edfe7f447 100644
--- a/arch/x86/kernel/apic/local.h
+++ b/arch/x86/kernel/apic/local.h
@@ -14,7 +14,6 @@
 #include <asm/apic.h>
 
 /* X2APIC */
-void __x2apic_send_IPI_dest(unsigned int apicid, int vector, unsigned int dest);
 u32 x2apic_get_apic_id(u32 id);
 
 void x2apic_send_IPI_all(int vector);
@@ -42,6 +41,13 @@ static inline unsigned int __prepare_ICR(unsigned int shortcut, int vector,
 	return icr;
 }
 
+static inline void __x2apic_send_IPI_dest(unsigned int apicid, int vector,
+					  unsigned int dest)
+{
+	unsigned long cfg = __prepare_ICR(0, vector, dest);
+	native_x2apic_icr_write(cfg, apicid);
+}
+
 void default_init_apic_ldr(void);
 
 void apic_mem_wait_icr_idle(void);
diff --git a/arch/x86/kernel/apic/x2apic_phys.c b/arch/x86/kernel/apic/x2apic_phys.c
index 12d4c35547a6f928d14df005dbcbffb71eab4641..10f79026e8e3130ca05764faed6847b16e0f5273 100644
--- a/arch/x86/kernel/apic/x2apic_phys.c
+++ b/arch/x86/kernel/apic/x2apic_phys.c
@@ -107,12 +107,6 @@ void x2apic_send_IPI_self(int vector)
 	apic_write(APIC_SELF_IPI, vector);
 }
 
-void __x2apic_send_IPI_dest(unsigned int apicid, int vector, unsigned int dest)
-{
-	unsigned long cfg = __prepare_ICR(0, vector, dest);
-	native_x2apic_icr_write(cfg, apicid);
-}
-
 static int x2apic_phys_probe(void)
 {
 	if (!x2apic_mode)
-- 
2.52.0.322.g1dd061c0dc-goog
Re: [PATCH] x86/apic: Inline __x2apic_send_IPI_dest()
Posted by kernel test robot 1 month, 2 weeks ago
Hi Eric,

kernel test robot noticed the following build errors:

[auto build test ERROR on tip/master]
[also build test ERROR on tip/x86/core linus/master v6.19-rc2 next-20251219]
[cannot apply to tip/auto-latest]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Eric-Dumazet/x86-apic-Inline-__x2apic_send_IPI_dest/20251222-172515
base:   tip/master
patch link:    https://lore.kernel.org/r/20251222092208.770136-1-edumazet%40google.com
patch subject: [PATCH] x86/apic: Inline __x2apic_send_IPI_dest()
config: i386-allnoconfig-bpf (https://download.01.org/0day-ci/archive/20251223/202512231144.eXwZX0OP-lkp@intel.com/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251223/202512231144.eXwZX0OP-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202512231144.eXwZX0OP-lkp@intel.com/

All errors (new ones prefixed by >>):

   In file included from arch/x86/kernel/apic/apic.c:71:
>> arch/x86/kernel/apic/local.h:48:2: error: call to undeclared function 'native_x2apic_icr_write'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
      48 |         native_x2apic_icr_write(cfg, apicid);
         |         ^
   arch/x86/kernel/apic/local.h:48:2: note: did you mean 'native_apic_icr_write'?
   ./arch/x86/include/asm/apic.h:116:13: note: 'native_apic_icr_write' declared here
     116 | extern void native_apic_icr_write(u32 low, u32 id);
         |             ^
   1 error generated.


vim +/native_x2apic_icr_write +48 arch/x86/kernel/apic/local.h

    43	
    44	static inline void __x2apic_send_IPI_dest(unsigned int apicid, int vector,
    45						  unsigned int dest)
    46	{
    47		unsigned long cfg = __prepare_ICR(0, vector, dest);
  > 48		native_x2apic_icr_write(cfg, apicid);
    49	}
    50	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Re: [PATCH] x86/apic: Inline __x2apic_send_IPI_dest()
Posted by kernel test robot 1 month, 2 weeks ago
Hi Eric,

kernel test robot noticed the following build errors:

[auto build test ERROR on tip/master]
[also build test ERROR on tip/x86/core linus/master v6.19-rc2 next-20251219]
[cannot apply to tip/auto-latest]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Eric-Dumazet/x86-apic-Inline-__x2apic_send_IPI_dest/20251222-172515
base:   tip/master
patch link:    https://lore.kernel.org/r/20251222092208.770136-1-edumazet%40google.com
patch subject: [PATCH] x86/apic: Inline __x2apic_send_IPI_dest()
config: i386-allnoconfig (https://download.01.org/0day-ci/archive/20251223/202512230547.YPNxhzQP-lkp@intel.com/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251223/202512230547.YPNxhzQP-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202512230547.YPNxhzQP-lkp@intel.com/

All errors (new ones prefixed by >>):

   In file included from arch/x86/kernel/apic/hw_nmi.c:24:
   arch/x86/kernel/apic/local.h: In function '__x2apic_send_IPI_dest':
>> arch/x86/kernel/apic/local.h:48:9: error: implicit declaration of function 'native_x2apic_icr_write'; did you mean 'native_apic_msr_read'? [-Wimplicit-function-declaration]
      48 |         native_x2apic_icr_write(cfg, apicid);
         |         ^~~~~~~~~~~~~~~~~~~~~~~
         |         native_apic_msr_read


vim +48 arch/x86/kernel/apic/local.h

    43	
    44	static inline void __x2apic_send_IPI_dest(unsigned int apicid, int vector,
    45						  unsigned int dest)
    46	{
    47		unsigned long cfg = __prepare_ICR(0, vector, dest);
  > 48		native_x2apic_icr_write(cfg, apicid);
    49	}
    50	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Re: [PATCH] x86/apic: Inline __x2apic_send_IPI_dest()
Posted by kernel test robot 1 month, 2 weeks ago
Hi Eric,

kernel test robot noticed the following build errors:

[auto build test ERROR on tip/master]
[also build test ERROR on tip/x86/core linus/master v6.19-rc2 next-20251219]
[cannot apply to tip/auto-latest bp/for-next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Eric-Dumazet/x86-apic-Inline-__x2apic_send_IPI_dest/20251222-172515
base:   tip/master
patch link:    https://lore.kernel.org/r/20251222092208.770136-1-edumazet%40google.com
patch subject: [PATCH] x86/apic: Inline __x2apic_send_IPI_dest()
config: i386-randconfig-141-20251223 (https://download.01.org/0day-ci/archive/20251223/202512230859.jl2eLtLj-lkp@intel.com/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251223/202512230859.jl2eLtLj-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202512230859.jl2eLtLj-lkp@intel.com/

All errors (new ones prefixed by >>):

   In file included from arch/x86/kernel/apic/apic.c:71:
>> arch/x86/kernel/apic/local.h:48:2: error: call to undeclared function 'native_x2apic_icr_write'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
      48 |         native_x2apic_icr_write(cfg, apicid);
         |         ^
   arch/x86/kernel/apic/local.h:48:2: note: did you mean 'native_apic_icr_write'?
   arch/x86/include/asm/apic.h:116:13: note: 'native_apic_icr_write' declared here
     116 | extern void native_apic_icr_write(u32 low, u32 id);
         |             ^
   1 error generated.


vim +/native_x2apic_icr_write +48 arch/x86/kernel/apic/local.h

    43	
    44	static inline void __x2apic_send_IPI_dest(unsigned int apicid, int vector,
    45						  unsigned int dest)
    46	{
    47		unsigned long cfg = __prepare_ICR(0, vector, dest);
  > 48		native_x2apic_icr_write(cfg, apicid);
    49	}
    50	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Re: [PATCH] x86/apic: Inline __x2apic_send_IPI_dest()
Posted by Eric Dumazet 1 month, 2 weeks ago
On Tue, Dec 23, 2025 at 2:06 AM kernel test robot <lkp@intel.com> wrote:
>
> Hi Eric,
>
> kernel test robot noticed the following build errors:
>
> [auto build test ERROR on tip/master]
> [also build test ERROR on tip/x86/core linus/master v6.19-rc2 next-20251219]
> [cannot apply to tip/auto-latest bp/for-next]
> [If your patch is applied to the wrong git tree, kindly drop us a note.
> And when submitting patch, we suggest to use '--base' as documented in
> https://git-scm.com/docs/git-format-patch#_base_tree_information]
>
> url:    https://github.com/intel-lab-lkp/linux/commits/Eric-Dumazet/x86-apic-Inline-__x2apic_send_IPI_dest/20251222-172515
> base:   tip/master
> patch link:    https://lore.kernel.org/r/20251222092208.770136-1-edumazet%40google.com
> patch subject: [PATCH] x86/apic: Inline __x2apic_send_IPI_dest()
> config: i386-randconfig-141-20251223 (https://download.01.org/0day-ci/archive/20251223/202512230859.jl2eLtLj-lkp@intel.com/config)
> compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251223/202512230859.jl2eLtLj-lkp@intel.com/reproduce)
>
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202512230859.jl2eLtLj-lkp@intel.com/
>
> All errors (new ones prefixed by >>):
>
>    In file included from arch/x86/kernel/apic/apic.c:71:
> >> arch/x86/kernel/apic/local.h:48:2: error: call to undeclared function 'native_x2apic_icr_write'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
>       48 |         native_x2apic_icr_write(cfg, apicid);
>          |         ^
>    arch/x86/kernel/apic/local.h:48:2: note: did you mean 'native_apic_icr_write'?
>    arch/x86/include/asm/apic.h:116:13: note: 'native_apic_icr_write' declared here
>      116 | extern void native_apic_icr_write(u32 low, u32 id);
>          |             ^
>    1 error generated.
>
>
> vim +/native_x2apic_icr_write +48 arch/x86/kernel/apic/local.h
>
>     43
>     44  static inline void __x2apic_send_IPI_dest(unsigned int apicid, int vector,
>     45                                            unsigned int dest)
>     46  {
>     47          unsigned long cfg = __prepare_ICR(0, vector, dest);
>   > 48          native_x2apic_icr_write(cfg, apicid);
>     49  }
>     50
>
> --
> 0-DAY CI Kernel Test Service
> https://github.com/intel/lkp-tests/wiki

I missed the CONFIG_X86_X2APIC dependency, thanks !