rpms/kernel/F-8 linux-2.6-powerpc-fix-missed-hardware-breakpoints-across-multiple-threads.patch, NONE, 1.1 kernel.spec, 1.410, 1.411

Dave Jones (davej) fedora-extras-commits at redhat.com
Sat Mar 29 17:54:46 UTC 2008


Author: davej

Update of /cvs/pkgs/rpms/kernel/F-8
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv7721

Modified Files:
	kernel.spec 
Added Files:
	linux-2.6-powerpc-fix-missed-hardware-breakpoints-across-multiple-threads.patch 
Log Message:
powerpc: Fix missed hardware breakpoints across multiple threads. (#439619)

linux-2.6-powerpc-fix-missed-hardware-breakpoints-across-multiple-threads.patch:

--- NEW FILE linux-2.6-powerpc-fix-missed-hardware-breakpoints-across-multiple-threads.patch ---
Return-Path: <michael at ozlabs.org>
Received: from localhost
	by host0.dyn.jankratochvil.net with IMAP (fetchmail-6.3.8)
	for <jkratoch at localhost> (single-drop); Fri, 28 Mar 2008 09:12:12 +0100 (CET)
Received: from pobox.devel.redhat.com ([unix socket])
	 by pobox.devel.redhat.com (Cyrus v2.2.12-Invoca-RPM-2.2.12-8.1.RHEL4) with LMTPA;
	 Fri, 28 Mar 2008 04:12:08 -0400
X-Sieve: CMU Sieve 2.2
Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254])
	by pobox.devel.redhat.com (8.13.1/8.13.1) with ESMTP id m2S8C8Yd032302;
	Fri, 28 Mar 2008 04:12:08 -0400
Received: from mx3.redhat.com (mx3.redhat.com [172.16.48.32])
	by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id m2S8C51O005453;
	Fri, 28 Mar 2008 04:12:05 -0400
Received: from ozlabs.org (ozlabs.org [203.10.76.45])
	by mx3.redhat.com (8.13.8/8.13.8) with ESMTP id m2S8Bsxr020745;
	Fri, 28 Mar 2008 04:11:55 -0400
Received: by ozlabs.org (Postfix, from userid 1034)
	id 7C499DDE9E; Fri, 28 Mar 2008 19:11:48 +1100 (EST)
To: Paul Mackerras <paulus at samba.org>
Cc: <jan.kratochvil at redhat.com>, <roland at redhat.com>,
        Benjamin Herrenschmidt <benh at kernel.crashing.org>,
        Anton Blanchard <anton at samba.org>
Message-Id: <deeb6bcad042aec876919ef77d3b39b4b1c20784.1206691670.git.michael at ellerman.id.au>
From: Michael Ellerman <michael at ellerman.id.au>
Subject: [PATCH] Fix missed hardware breakpoints across multiple threads
Date: Fri, 28 Mar 2008 19:11:48 +1100 (EST)
X-RedHat-Spam-Score: -0.15 
X-Scanned-By: MIMEDefang 2.58 on 172.16.52.254
X-Scanned-By: MIMEDefang 2.63 on 172.16.48.32
Status: RO
Content-Length: 2356
Lines: 70

There is a bug in the powerpc DABR (data access breakpoint) handling,
which can result in us missing breakpoints if several threads are trying
to break on the same address.

The circumstances are that do_page_fault() calls do_dabr(), this clears
the DABR (sets it to 0) and sets up the signal which will report to
userspace that the DABR was hit. The do_signal() code will restore the DABR
value on the way out to userspace.

If we reschedule before calling do_signal(), __switch_to() will check the
cached DABR value and compare it to the new thread's value, if they match
we don't set the DABR in hardware.

So if two threads have the same DABR value, and we schedule from one to
the other after taking the interrupt for the first thread hitting the DABR,
the second thread will run without the DABR set in hardware.

The cleanest fix is to move the cache update into set_dabr(), that way we
can't forget to do it.

Reported-by: Jan Kratochvil <jan.kratochvil at redhat.com>
Signed-off-by: Michael Ellerman <michael at ellerman.id.au>
---
 arch/powerpc/kernel/process.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)


Paul, your call on if this is 25 or 26 material.


diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index 59311ec..4ec6055 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -241,8 +241,12 @@ void discard_lazy_cpu_state(void)
 }
 #endif /* CONFIG_SMP */
 
+static DEFINE_PER_CPU(unsigned long, current_dabr);
+
 int set_dabr(unsigned long dabr)
 {
+	__get_cpu_var(current_dabr) = dabr;
+
 #ifdef CONFIG_PPC_MERGE		/* XXX for now */
 	if (ppc_md.set_dabr)
 		return ppc_md.set_dabr(dabr);
@@ -259,8 +263,6 @@ int set_dabr(unsigned long dabr)
 DEFINE_PER_CPU(struct cpu_usage, cpu_usage_array);
 #endif
 
-static DEFINE_PER_CPU(unsigned long, current_dabr);
-
 struct task_struct *__switch_to(struct task_struct *prev,
 	struct task_struct *new)
 {
@@ -325,10 +327,8 @@ struct task_struct *__switch_to(struct task_struct *prev,
 
 #endif /* CONFIG_SMP */
 
-	if (unlikely(__get_cpu_var(current_dabr) != new->thread.dabr)) {
+	if (unlikely(__get_cpu_var(current_dabr) != new->thread.dabr))
 		set_dabr(new->thread.dabr);
-		__get_cpu_var(current_dabr) = new->thread.dabr;
-	}
 
 	new_thread = &new->thread;
 	old_thread = &current->thread;
-- 
1.5.2.rc1.1884.g59b20



Index: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/F-8/kernel.spec,v
retrieving revision 1.410
retrieving revision 1.411
diff -u -r1.410 -r1.411
--- kernel.spec	28 Mar 2008 21:24:30 -0000	1.410
+++ kernel.spec	29 Mar 2008 17:53:37 -0000	1.411
@@ -605,6 +605,7 @@
 Patch132: linux-2.6-powerpc-generic-suspend-003-remove-adb-sleep-notifier.patch
 Patch133: linux-2.6-powerpc-generic-suspend-004-kill-pmu-sleep-notifier.patch
 Patch134: linux-2.6-powerpc-generic-suspend-005-proper-sleep-management.patch
+Patch135: linux-2.6-powerpc-fix-missed-hardware-breakpoints-across-multiple-threads.patch
 Patch140: linux-2.6-ps3-ehci-iso.patch
 Patch141: linux-2.6-ps3-storage-alias.patch
 Patch142: linux-2.6-ps3-legacy-bootloader-hack.patch
@@ -1122,6 +1123,8 @@
 ApplyPatch linux-2.6-powerpc-generic-suspend-003-remove-adb-sleep-notifier.patch
 ApplyPatch linux-2.6-powerpc-generic-suspend-004-kill-pmu-sleep-notifier.patch
 ApplyPatch linux-2.6-powerpc-generic-suspend-005-proper-sleep-management.patch
+# ppc kernel hardware watchpoint support (bz 439619)
+ApplyPatch linux-2.6-powerpc-fix-missed-hardware-breakpoints-across-multiple-threads.patch
 ###  NOT (YET) UPSTREAM:
 # The EHCI ISO patch isn't yet upstream but is needed to fix reboot
 ApplyPatch linux-2.6-ps3-ehci-iso.patch
@@ -1984,6 +1987,9 @@
 
 
 %changelog
+* Sat Mar 29 2008 Dave Jones <davej at redhat.com>
+- powerpc: Fix missed hardware breakpoints across multiple threads. (#439619)
+
 * Fri Mar 28 2008 John W. Linville <linville at redhat.com> 2.6.24.4-64
 - libertas: fix spinlock recursion bug
 - rt2x00: Ignore set_state(STATE_SLEEP) failure




More information about the fedora-extras-commits mailing list