Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

cpuidle, ACPI: Make noinstr clean

objtool found cases where ACPI methods called out into instrumentation code:

vmlinux.o: warning: objtool: io_idle+0xc: call to __inb.isra.0() leaves .noinstr.text section
vmlinux.o: warning: objtool: acpi_idle_enter+0xfe: call to num_online_cpus() leaves .noinstr.text section
vmlinux.o: warning: objtool: acpi_idle_enter+0x115: call to acpi_idle_fallback_to_c1.isra.0() leaves .noinstr.text section

Fix this by: marking the IO in/out, acpi_idle_fallback_to_c1() and
num_online_cpus() methods as __always_inline.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Tested-by: Tony Lindgren <tony@atomide.com>
Tested-by: Ulf Hansson <ulf.hansson@linaro.org>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Frederic Weisbecker <frederic@kernel.org>
Link: https://lore.kernel.org/r/20230112195541.294846301@infradead.org

authored by

Peter Zijlstra and committed by
Ingo Molnar
6a123d6a 10fdb38c

+5 -5
+2 -2
arch/x86/include/asm/shared/io.h
··· 5 5 #include <linux/types.h> 6 6 7 7 #define BUILDIO(bwl, bw, type) \ 8 - static inline void __out##bwl(type value, u16 port) \ 8 + static __always_inline void __out##bwl(type value, u16 port) \ 9 9 { \ 10 10 asm volatile("out" #bwl " %" #bw "0, %w1" \ 11 11 : : "a"(value), "Nd"(port)); \ 12 12 } \ 13 13 \ 14 - static inline type __in##bwl(u16 port) \ 14 + static __always_inline type __in##bwl(u16 port) \ 15 15 { \ 16 16 type value; \ 17 17 asm volatile("in" #bwl " %w1, %" #bw "0" \
+1 -1
drivers/acpi/processor_idle.c
··· 607 607 return 0; 608 608 } 609 609 610 - static bool acpi_idle_fallback_to_c1(struct acpi_processor *pr) 610 + static __always_inline bool acpi_idle_fallback_to_c1(struct acpi_processor *pr) 611 611 { 612 612 return IS_ENABLED(CONFIG_HOTPLUG_CPU) && !pr->flags.has_cst && 613 613 !(acpi_gbl_FADT.flags & ACPI_FADT_C2_MP_SUPPORTED);
+2 -2
include/linux/cpumask.h
··· 1017 1017 * concurrent CPU hotplug operations unless invoked from a cpuhp_lock held 1018 1018 * region. 1019 1019 */ 1020 - static inline unsigned int num_online_cpus(void) 1020 + static __always_inline unsigned int num_online_cpus(void) 1021 1021 { 1022 - return atomic_read(&__num_online_cpus); 1022 + return arch_atomic_read(&__num_online_cpus); 1023 1023 } 1024 1024 #define num_possible_cpus() cpumask_weight(cpu_possible_mask) 1025 1025 #define num_present_cpus() cpumask_weight(cpu_present_mask)