Skip to contentSkip to conversation

x86/apic: Inline __x2apic_send_IPI_dest()

PATCH Superseded Eric Dumazet 2 participants 5 messages Dec 22, 2025 – Dec 23, 2025 x86

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/apic: Inline __x2apic_send_IPI_dest()

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
---
 arch/x86/kernel/apic/local.h       | 8 +++++++-
 arch/x86/kernel/apic/x2apic_phys.c | 6 ------
 2 files changed, 7 insertions(+), 7 deletions(-)
arch/x86/kernel/apic/local.h +7 -1
index bdcf609eb28352530ffcbb3c66ffb32c82df4d7f..14ac32c014eebff968658c5fb4db136edfe7f447 100644
@@ -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);
arch/x86/kernel/apic/x2apic_phys.c +0 -6
index 12d4c35547a6f928d14df005dbcbffb71eab4641..10f79026e8e3130ca05764faed6847b16e0f5273 100644
@@ -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)
Signature · 1 line
2.52.0.322.g1dd061c0dc-goog
#1 lore raw
kernel test robot noticed the following build errors:

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/[email protected]/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/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

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	
Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#2 lore raw
In reply to Eric Dumazet
kernel test robot noticed the following build errors:

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/[email protected]/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/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

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	
Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#3 lore raw
Quoted 45 lines · kernel test robot

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/[email protected]/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/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

In file included from arch/x86/kernel/apic/apic.c:71:

Quoted 1 line
Quoted 1 line

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);
Quoted 7 lines
Quoted 1 line

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 !

#4 lore raw
In reply to Eric Dumazet
kernel test robot noticed the following build errors:

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/[email protected]/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/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

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	
Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki