Skip to content

x86, ptrace, bts, hw-branch-tracer: fixes and cleanups

[email protected] lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest20 patches 29 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/20x86, bts: fix race when bts tracer is removedarch/x86/kernel/ds.c+37 -211 reply
2/20sched: add wait_task_context_switch() fucntion to sched.hinclude/linux/sched.h kernel/sched.c+45 -01 reply
3/20x86, ptrace, bts: defer branch trace stoppingarch/x86/include/asm/processor.h arch/x86/kernel/ptrace.c include/linux/mm.h +2 more+179 -1047 replies
4/20x86, bts: wait until traced task has been scheduled outarch/x86/kernel/ds.c+19 -41 reply
5/20x86, bts: fix race between per-task and per-cpu branch tracingarch/x86/kernel/ds.c+41 -311 reply
6/20x86, bts: use trace_clock_global() for timestampsarch/x86/include/asm/ds.h arch/x86/kernel/ds.c+11 -101 reply
7/20x86, debugctlmsr: add _on_cpu variants to debugctlmsr functionsarch/x86/include/asm/processor.h+27 -01 reply
8/20x86, bts, hw-branch-tracer: add _noirq variants to the debug store interfacearch/x86/include/asm/ds.h arch/x86/kernel/ds.c arch/x86/kernel/ds_selftest.c +2 more+492 -2461 reply
9/20x86, hw-branch-tracer: allocate selftest iterator on heapkernel/trace/trace_selftest.c+12 -81 reply
10/20x86, ds: fix compiler warningarch/x86/kernel/ds_selftest.c+1 -11 reply
11/20x86, ds: fix bounds check in ds selftestarch/x86/kernel/ds_selftest.c+6 -11 reply
12/20x86, ds: selftest each cpuarch/x86/kernel/ds_selftest.c+137 -491 reply
13/20x86, ds: add task tracing selftestarch/x86/kernel/ds_selftest.c+71 -01 reply
14/20x86, ds: add leakage warningarch/x86/include/asm/ds.h arch/x86/include/asm/processor.h arch/x86/kernel/ds.c +3 more+8 -261 reply
15/20x86, ds: use single debug store cpu configurationarch/x86/kernel/ds.c+5 -21 reply
16/20x86, ptrace: add bts context unconditionallyarch/x86/include/asm/ptrace.h arch/x86/kernel/ptrace.c include/linux/ptrace.h +3 more+7 -481 reply
17/20x86, ds: dont use TIF_DEBUGCTLMSRarch/x86/kernel/ds.c+0 -51 reply
18/20x86, ds: fix bad ds_reset_pebs()arch/x86/kernel/ds.c+1 -11 reply
19/20x86, ds: allow small debug store buffersarch/x86/kernel/ds.c arch/x86/kernel/ds_selftest.c+10 -51 reply
20/20x86, ds: support Core i7arch/x86/include/asm/ds.h arch/x86/kernel/ds.c+71 -101 reply

Reviews trailers per patch

3 of 20 patches have a Reviewed-by or Acked-by.

PatchOleg Nesterov
1/20R-b R-b
2/20
3/20R-b R-b
4/20R-b R-b
5/20
6/20
7/20
8/20
9/20
10/20
11/20
12/20
13/20
14/20
15/20
16/20
17/20
18/20
19/20
20/20

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [patch 00/20] x86, ptrace, bts, hw-branch-tracer: fixes and cleanups
Signature · 58 lines
Patches 1-5 fix races with context switching code when the branch traced task
is currently running.

In the worst case, this might cause context switch code to access freed
memory or the tracing hardware to continue tracing into a freed buffer.
Both might crash the kernel.

The first 4 patches apply to .29 using the below preparation patch.


The remaining patches fix bugs in the context of per-cpu tracing (i.e.
hw-branch-tracer) and pebs, add more selftest code, and do some cleanups.


Signed-off-by: Markus Metzger <[email protected]>
---

Index: linux-2.6.29/arch/x86/kernel/ds.c
===================================================================
--- linux-2.6.29.orig/arch/x86/kernel/ds.c	2009-04-01 17:39:55.000000000 +0200
+++ linux-2.6.29/arch/x86/kernel/ds.c	2009-04-01 17:40:42.000000000 +0200
@@ -78,8 +78,8 @@ struct bts_tracer {
 	struct ds_tracer ds;
 	/* the trace including the DS configuration */
 	struct bts_trace trace;
-	/* buffer overflow notification function */
-	bts_ovfl_callback_t ovfl;
+	/* Buffer overflow notification function: */
+	bts_ovfl_callback_t	ovfl;
 };
 
 struct pebs_tracer {
Index: linux-2.6.29/arch/x86/kernel/ptrace.c
===================================================================
--- linux-2.6.29.orig/arch/x86/kernel/ptrace.c	2009-04-01 17:39:55.000000000 +0200
+++ linux-2.6.29/arch/x86/kernel/ptrace.c	2009-04-01 17:40:42.000000000 +0200
@@ -21,6 +21,7 @@
 #include <linux/audit.h>
 #include <linux/seccomp.h>
 #include <linux/signal.h>
+#include <linux/ftrace.h>
 
 #include <asm/uaccess.h>
 #include <asm/pgtable.h>
---------------------------------------------------------------------
Intel GmbH
Dornacher Strasse 1
85622 Feldkirchen/Muenchen Germany
Sitz der Gesellschaft: Feldkirchen bei Muenchen
Geschaeftsfuehrer: Douglas Lusk, Peter Gleissner, Hannes Schwaderer
Registergericht: Muenchen HRB 47456 Ust.-IdNr.
VAT Registration No.: DE129385895
Citibank Frankfurt (BLZ 502 109 00) 600119052

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.