Commit 4ecf0a43 authored by Heiko Carstens's avatar Heiko Carstens

processor: get rid of cpu_relax_yield

stop_machine is the only user left of cpu_relax_yield. Given that it
now has special semantics which are tied to stop_machine introduce a
weak stop_machine_yield function which architectures can override, and
get rid of the generic cpu_relax_yield implementation.
Acked-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: default avatarThomas Gleixner <tglx@linutronix.de>
Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
parent 38f2c691
...@@ -222,12 +222,6 @@ static __no_kasan_or_inline unsigned short stap(void) ...@@ -222,12 +222,6 @@ static __no_kasan_or_inline unsigned short stap(void)
return cpu_address; return cpu_address;
} }
/*
* Give up the time slice of the virtual PU.
*/
#define cpu_relax_yield cpu_relax_yield
void cpu_relax_yield(const struct cpumask *cpumask);
#define cpu_relax() barrier() #define cpu_relax() barrier()
#define ECAG_CACHE_ATTRIBUTE 0 #define ECAG_CACHE_ATTRIBUTE 0
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#define KMSG_COMPONENT "cpu" #define KMSG_COMPONENT "cpu"
#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
#include <linux/stop_machine.h>
#include <linux/cpufeature.h> #include <linux/cpufeature.h>
#include <linux/bitops.h> #include <linux/bitops.h>
#include <linux/kernel.h> #include <linux/kernel.h>
...@@ -59,7 +60,7 @@ void s390_update_cpu_mhz(void) ...@@ -59,7 +60,7 @@ void s390_update_cpu_mhz(void)
on_each_cpu(update_cpu_mhz, NULL, 0); on_each_cpu(update_cpu_mhz, NULL, 0);
} }
void notrace cpu_relax_yield(const struct cpumask *cpumask) void notrace stop_machine_yield(const struct cpumask *cpumask)
{ {
int cpu, this_cpu; int cpu, this_cpu;
...@@ -73,7 +74,6 @@ void notrace cpu_relax_yield(const struct cpumask *cpumask) ...@@ -73,7 +74,6 @@ void notrace cpu_relax_yield(const struct cpumask *cpumask)
smp_yield_cpu(cpu); smp_yield_cpu(cpu);
} }
} }
EXPORT_SYMBOL(cpu_relax_yield);
/* /*
* cpu_init - initializes state that is per-CPU. * cpu_init - initializes state that is per-CPU.
......
...@@ -1518,10 +1518,6 @@ static inline int set_cpus_allowed_ptr(struct task_struct *p, const struct cpuma ...@@ -1518,10 +1518,6 @@ static inline int set_cpus_allowed_ptr(struct task_struct *p, const struct cpuma
} }
#endif #endif
#ifndef cpu_relax_yield
#define cpu_relax_yield(cpumask) cpu_relax()
#endif
extern int yield_to(struct task_struct *p, bool preempt); extern int yield_to(struct task_struct *p, bool preempt);
extern void set_user_nice(struct task_struct *p, long nice); extern void set_user_nice(struct task_struct *p, long nice);
extern int task_prio(const struct task_struct *p); extern int task_prio(const struct task_struct *p);
......
...@@ -36,6 +36,7 @@ int stop_cpus(const struct cpumask *cpumask, cpu_stop_fn_t fn, void *arg); ...@@ -36,6 +36,7 @@ int stop_cpus(const struct cpumask *cpumask, cpu_stop_fn_t fn, void *arg);
int try_stop_cpus(const struct cpumask *cpumask, cpu_stop_fn_t fn, void *arg); int try_stop_cpus(const struct cpumask *cpumask, cpu_stop_fn_t fn, void *arg);
void stop_machine_park(int cpu); void stop_machine_park(int cpu);
void stop_machine_unpark(int cpu); void stop_machine_unpark(int cpu);
void stop_machine_yield(const struct cpumask *cpumask);
#else /* CONFIG_SMP */ #else /* CONFIG_SMP */
......
...@@ -177,6 +177,11 @@ static void ack_state(struct multi_stop_data *msdata) ...@@ -177,6 +177,11 @@ static void ack_state(struct multi_stop_data *msdata)
set_state(msdata, msdata->state + 1); set_state(msdata, msdata->state + 1);
} }
void __weak stop_machine_yield(const struct cpumask *cpumask)
{
cpu_relax();
}
/* This is the cpu_stop function which stops the CPU. */ /* This is the cpu_stop function which stops the CPU. */
static int multi_cpu_stop(void *data) static int multi_cpu_stop(void *data)
{ {
...@@ -204,7 +209,7 @@ static int multi_cpu_stop(void *data) ...@@ -204,7 +209,7 @@ static int multi_cpu_stop(void *data)
/* Simple state machine */ /* Simple state machine */
do { do {
/* Chill out and ensure we re-read multi_stop_state. */ /* Chill out and ensure we re-read multi_stop_state. */
cpu_relax_yield(cpumask); stop_machine_yield(cpumask);
if (msdata->state != curstate) { if (msdata->state != curstate) {
curstate = msdata->state; curstate = msdata->state;
switch (curstate) { switch (curstate) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment