cpuidle, ACPI: Make noinstr clean
authorPeter Zijlstra <peterz@infradead.org>
Thu, 12 Jan 2023 19:43:46 +0000 (20:43 +0100)
committerIngo Molnar <mingo@kernel.org>
Fri, 13 Jan 2023 10:48:16 +0000 (11:48 +0100)
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
arch/x86/include/asm/shared/io.h
drivers/acpi/processor_idle.c
include/linux/cpumask.h

index c0ef921c0586c21ea7ca6024250bf5b1d0063263..8009d781c2f97ea7f48178338387712d53a91957 100644 (file)
@@ -5,13 +5,13 @@
 #include <linux/types.h>
 
 #define BUILDIO(bwl, bw, type)                                         \
-static inline void __out##bwl(type value, u16 port)                    \
+static __always_inline void __out##bwl(type value, u16 port)           \
 {                                                                      \
        asm volatile("out" #bwl " %" #bw "0, %w1"                       \
                     : : "a"(value), "Nd"(port));                       \
 }                                                                      \
                                                                        \
-static inline type __in##bwl(u16 port)                                 \
+static __always_inline type __in##bwl(u16 port)                                \
 {                                                                      \
        type value;                                                     \
        asm volatile("in" #bwl " %w1, %" #bw "0"                        \
index 48fcd28eb90703574d9ef0164894cbf9d491e437..7f77710c86fcfc63c032b797e2923f285711360e 100644 (file)
@@ -607,7 +607,7 @@ static int acpi_idle_play_dead(struct cpuidle_device *dev, int index)
        return 0;
 }
 
-static bool acpi_idle_fallback_to_c1(struct acpi_processor *pr)
+static __always_inline bool acpi_idle_fallback_to_c1(struct acpi_processor *pr)
 {
        return IS_ENABLED(CONFIG_HOTPLUG_CPU) && !pr->flags.has_cst &&
                !(acpi_gbl_FADT.flags & ACPI_FADT_C2_MP_SUPPORTED);
index c2aa0aa26b457fd04ad56c3da030a9b788c77b50..d45e5de13721075ea709b4cd9c792b670714eb6b 100644 (file)
@@ -1017,9 +1017,9 @@ static inline const struct cpumask *get_cpu_mask(unsigned int cpu)
  * concurrent CPU hotplug operations unless invoked from a cpuhp_lock held
  * region.
  */
-static inline unsigned int num_online_cpus(void)
+static __always_inline unsigned int num_online_cpus(void)
 {
-       return atomic_read(&__num_online_cpus);
+       return arch_atomic_read(&__num_online_cpus);
 }
 #define num_possible_cpus()    cpumask_weight(cpu_possible_mask)
 #define num_present_cpus()     cpumask_weight(cpu_present_mask)