linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH powerpc 0/2] powerpc CONFIG_PREEMPT fixes
@ 2011-02-10 21:57 Paul E. McKenney
  2011-02-10 21:57 ` [PATCH powerpc 1/2] powerpc: protect per-CPU access with preempt_disable Paul E. McKenney
  2011-02-10 21:57 ` [PATCH powerpc 2/2] powerpc: mask smp_processor_id() false positive Paul E. McKenney
  0 siblings, 2 replies; 3+ messages in thread
From: Paul E. McKenney @ 2011-02-10 21:57 UTC (permalink / raw)
  To: benh, paulus; +Cc: linuxppc-dev, linux-kernel

Hello!

This series provides fixes for a couple of CONFIG_PREEMPT problems on
Power:

1.	The hpte_need_flush() function accesses per-CPU variables without
	protection.
2.	The rtas_event_scan() function needs to use raw_smp_processor_id()
	to get a starting point to avoid debugging splats.

There are probably a few more where these came from.  ;-)

								Thanx, Paul

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH powerpc 1/2] powerpc: protect per-CPU access with preempt_disable
  2011-02-10 21:57 [PATCH powerpc 0/2] powerpc CONFIG_PREEMPT fixes Paul E. McKenney
@ 2011-02-10 21:57 ` Paul E. McKenney
  2011-02-10 21:57 ` [PATCH powerpc 2/2] powerpc: mask smp_processor_id() false positive Paul E. McKenney
  1 sibling, 0 replies; 3+ messages in thread
From: Paul E. McKenney @ 2011-02-10 21:57 UTC (permalink / raw)
  To: benh, paulus; +Cc: Paul E. McKenney, linuxppc-dev, linux-kernel

The hpte_need_flush() function accesses the ppc64_tlb_batch per-CPU
variable with preemption enabled, a bug that this patch fixes.  Perhaps
crudely.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
 arch/powerpc/include/asm/pgtable-ppc64.h |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/include/asm/pgtable-ppc64.h b/arch/powerpc/include/asm/pgtable-ppc64.h
index 2b09cd5..6ed08ab 100644
--- a/arch/powerpc/include/asm/pgtable-ppc64.h
+++ b/arch/powerpc/include/asm/pgtable-ppc64.h
@@ -228,8 +228,11 @@ static inline unsigned long pte_update(struct mm_struct *mm,
 		assert_pte_locked(mm, addr);
 
 #ifdef CONFIG_PPC_STD_MMU_64
-	if (old & _PAGE_HASHPTE)
+	if (old & _PAGE_HASHPTE) {
+		preempt_disable();
 		hpte_need_flush(mm, addr, ptep, old, huge);
+		preempt_enable();
+	}
 #endif
 
 	return old;
-- 
1.7.3.2

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH powerpc 2/2] powerpc: mask smp_processor_id() false positive
  2011-02-10 21:57 [PATCH powerpc 0/2] powerpc CONFIG_PREEMPT fixes Paul E. McKenney
  2011-02-10 21:57 ` [PATCH powerpc 1/2] powerpc: protect per-CPU access with preempt_disable Paul E. McKenney
@ 2011-02-10 21:57 ` Paul E. McKenney
  1 sibling, 0 replies; 3+ messages in thread
From: Paul E. McKenney @ 2011-02-10 21:57 UTC (permalink / raw)
  To: benh, paulus; +Cc: Paul E. McKenney, linuxppc-dev, linux-kernel

The rtas_event_scan() function uses smp_processor_id() to select a
starting point in cpu_online_mask, and does so under the protection
of get_online_cpus().  This might not select the current processor
in any case, so switch to raw_smp_processor_id().

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
 arch/powerpc/kernel/rtasd.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/kernel/rtasd.c b/arch/powerpc/kernel/rtasd.c
index 049dbec..7980ec0 100644
--- a/arch/powerpc/kernel/rtasd.c
+++ b/arch/powerpc/kernel/rtasd.c
@@ -412,7 +412,8 @@ static void rtas_event_scan(struct work_struct *w)
 
 	get_online_cpus();
 
-	cpu = cpumask_next(smp_processor_id(), cpu_online_mask);
+	/* raw_ OK because just using CPU as starting point. */
+	cpu = cpumask_next(raw_smp_processor_id(), cpu_online_mask);
         if (cpu >= nr_cpu_ids) {
 		cpu = cpumask_first(cpu_online_mask);
 
-- 
1.7.3.2

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-02-10 21:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-10 21:57 [PATCH powerpc 0/2] powerpc CONFIG_PREEMPT fixes Paul E. McKenney
2011-02-10 21:57 ` [PATCH powerpc 1/2] powerpc: protect per-CPU access with preempt_disable Paul E. McKenney
2011-02-10 21:57 ` [PATCH powerpc 2/2] powerpc: mask smp_processor_id() false positive Paul E. McKenney

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).