* [patch V3 15/32] s390/kernel: Use stop_machine_cpuslocked()
[not found] <20170524081511.203800767@linutronix.de>
@ 2017-05-24 8:15 ` Thomas Gleixner
2017-05-24 10:57 ` Heiko Carstens
2017-05-24 8:15 ` [patch V3 28/32] s390: Prevent hotplug rwsem recursion Thomas Gleixner
1 sibling, 1 reply; 4+ messages in thread
From: Thomas Gleixner @ 2017-05-24 8:15 UTC (permalink / raw)
To: LKML
Cc: Peter Zijlstra, Ingo Molnar, Steven Rostedt, Sebastian Siewior,
Paul McKenney, linux-s390, Heiko Carstens, David Hildenbrand,
Martin Schwidefsky
[-- Attachment #1: s390kernel_Use_stop_machine_cpuslocked.patch --]
[-- Type: text/plain, Size: 1339 bytes --]
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
stp_work_fn() holds get_online_cpus() while invoking stop_machine().
stop_machine() invokes get_online_cpus() as well. This is correct, but
prevents the conversion of the hotplug locking to a percpu rwsem.
Use stop_machine_cpuslocked() to avoid the nested call. Convert
*_online_cpus() to the new interfaces while at it.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-s390@vger.kernel.org
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: David Hildenbrand <dahi@linux.vnet.ibm.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
---
arch/s390/kernel/time.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
--- a/arch/s390/kernel/time.c
+++ b/arch/s390/kernel/time.c
@@ -636,10 +636,10 @@ static void stp_work_fn(struct work_stru
goto out_unlock;
memset(&stp_sync, 0, sizeof(stp_sync));
- get_online_cpus();
+ cpus_read_lock();
atomic_set(&stp_sync.cpus, num_online_cpus() - 1);
- stop_machine(stp_sync_clock, &stp_sync, cpu_online_mask);
- put_online_cpus();
+ stop_machine_cpuslocked(stp_sync_clock, &stp_sync, cpu_online_mask);
+ cpus_read_unlock();
if (!check_sync_clock())
/*
^ permalink raw reply [flat|nested] 4+ messages in thread
* [patch V3 28/32] s390: Prevent hotplug rwsem recursion
[not found] <20170524081511.203800767@linutronix.de>
2017-05-24 8:15 ` [patch V3 15/32] s390/kernel: Use stop_machine_cpuslocked() Thomas Gleixner
@ 2017-05-24 8:15 ` Thomas Gleixner
2017-05-24 10:57 ` Heiko Carstens
1 sibling, 1 reply; 4+ messages in thread
From: Thomas Gleixner @ 2017-05-24 8:15 UTC (permalink / raw)
To: LKML
Cc: Peter Zijlstra, Ingo Molnar, Steven Rostedt, Sebastian Siewior,
Paul McKenney, Martin Schwidefsky, Heiko Carstens, linux-s390
[-- Attachment #1: s390--Prevent-hotplug-rwsem-recursion.patch --]
[-- Type: text/plain, Size: 1598 bytes --]
The text patching functions which are invoked from jump_label and kprobes
code are protected against cpu hotplug at the call sites.
Use stop_machine_cpuslocked() to avoid recursion on the cpu hotplug
rwsem. stop_machine_cpuslocked() contains a lockdep assertion to catch any
unprotected callers.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: linux-s390@vger.kernel.org
---
arch/s390/kernel/jump_label.c | 2 +-
arch/s390/kernel/kprobes.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
--- a/arch/s390/kernel/jump_label.c
+++ b/arch/s390/kernel/jump_label.c
@@ -93,7 +93,7 @@ void arch_jump_label_transform(struct ju
args.entry = entry;
args.type = type;
- stop_machine(__sm_arch_jump_label_transform, &args, NULL);
+ stop_machine_cpuslocked(__sm_arch_jump_label_transform, &args, NULL);
}
void arch_jump_label_transform_static(struct jump_entry *entry,
--- a/arch/s390/kernel/kprobes.c
+++ b/arch/s390/kernel/kprobes.c
@@ -196,7 +196,7 @@ void arch_arm_kprobe(struct kprobe *p)
{
struct swap_insn_args args = {.p = p, .arm_kprobe = 1};
- stop_machine(swap_instruction, &args, NULL);
+ stop_machine_cpuslocked(swap_instruction, &args, NULL);
}
NOKPROBE_SYMBOL(arch_arm_kprobe);
@@ -204,7 +204,7 @@ void arch_disarm_kprobe(struct kprobe *p
{
struct swap_insn_args args = {.p = p, .arm_kprobe = 0};
- stop_machine(swap_instruction, &args, NULL);
+ stop_machine_cpuslocked(swap_instruction, &args, NULL);
}
NOKPROBE_SYMBOL(arch_disarm_kprobe);
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [patch V3 15/32] s390/kernel: Use stop_machine_cpuslocked()
2017-05-24 8:15 ` [patch V3 15/32] s390/kernel: Use stop_machine_cpuslocked() Thomas Gleixner
@ 2017-05-24 10:57 ` Heiko Carstens
0 siblings, 0 replies; 4+ messages in thread
From: Heiko Carstens @ 2017-05-24 10:57 UTC (permalink / raw)
To: Thomas Gleixner
Cc: LKML, Peter Zijlstra, Ingo Molnar, Steven Rostedt,
Sebastian Siewior, Paul McKenney, linux-s390, David Hildenbrand,
Martin Schwidefsky
On Wed, May 24, 2017 at 10:15:26AM +0200, Thomas Gleixner wrote:
> From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
>
> stp_work_fn() holds get_online_cpus() while invoking stop_machine().
>
> stop_machine() invokes get_online_cpus() as well. This is correct, but
> prevents the conversion of the hotplug locking to a percpu rwsem.
>
> Use stop_machine_cpuslocked() to avoid the nested call. Convert
> *_online_cpus() to the new interfaces while at it.
>
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> Cc: linux-s390@vger.kernel.org
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
> Cc: Steven Rostedt <rostedt@goodmis.org>
> Cc: David Hildenbrand <dahi@linux.vnet.ibm.com>
> Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
>
> ---
> arch/s390/kernel/time.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
Acked-by: Heiko Carstens <heiko.carstens@de.ibm.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [patch V3 28/32] s390: Prevent hotplug rwsem recursion
2017-05-24 8:15 ` [patch V3 28/32] s390: Prevent hotplug rwsem recursion Thomas Gleixner
@ 2017-05-24 10:57 ` Heiko Carstens
0 siblings, 0 replies; 4+ messages in thread
From: Heiko Carstens @ 2017-05-24 10:57 UTC (permalink / raw)
To: Thomas Gleixner
Cc: LKML, Peter Zijlstra, Ingo Molnar, Steven Rostedt,
Sebastian Siewior, Paul McKenney, Martin Schwidefsky, linux-s390
On Wed, May 24, 2017 at 10:15:39AM +0200, Thomas Gleixner wrote:
> The text patching functions which are invoked from jump_label and kprobes
> code are protected against cpu hotplug at the call sites.
>
> Use stop_machine_cpuslocked() to avoid recursion on the cpu hotplug
> rwsem. stop_machine_cpuslocked() contains a lockdep assertion to catch any
> unprotected callers.
>
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
> Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
> Cc: linux-s390@vger.kernel.org
> ---
> arch/s390/kernel/jump_label.c | 2 +-
> arch/s390/kernel/kprobes.c | 4 ++--
> 2 files changed, 3 insertions(+), 3 deletions(-)
Acked-by: Heiko Carstens <heiko.carstens@de.ibm.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-05-24 10:57 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20170524081511.203800767@linutronix.de>
2017-05-24 8:15 ` [patch V3 15/32] s390/kernel: Use stop_machine_cpuslocked() Thomas Gleixner
2017-05-24 10:57 ` Heiko Carstens
2017-05-24 8:15 ` [patch V3 28/32] s390: Prevent hotplug rwsem recursion Thomas Gleixner
2017-05-24 10:57 ` Heiko Carstens
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).