* [GIT PULL] small instrumentation updates
@ 2010-10-14 19:42 Frederic Weisbecker
2010-10-14 19:42 ` [PATCH 1/2] tracing: Fix function-graph build warning on 32-bit Frederic Weisbecker
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Frederic Weisbecker @ 2010-10-14 19:42 UTC (permalink / raw)
To: Ingo Molnar
Cc: LKML, Frederic Weisbecker, Thomas Gleixner, H . Peter Anvin,
Peter Zijlstra, Steven Rostedt
Ingo,
Please pull the perf/core branch that can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/frederic/random-tracing.git
perf/core
Thanks,
Frederic
---
Borislav Petkov (1):
tracing: Fix function-graph build warning on 32-bit
Frederic Weisbecker (1):
x86: Barf when vmalloc and kmemcheck faults happen in NMI
arch/x86/mm/fault.c | 4 ++++
arch/x86/mm/kmemcheck/kmemcheck.c | 2 ++
kernel/trace/trace_functions_graph.c | 5 +++--
3 files changed, 9 insertions(+), 2 deletions(-)
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/2] tracing: Fix function-graph build warning on 32-bit
2010-10-14 19:42 [GIT PULL] small instrumentation updates Frederic Weisbecker
@ 2010-10-14 19:42 ` Frederic Weisbecker
2010-10-14 19:42 ` [PATCH 2/2] x86: Barf when vmalloc and kmemcheck faults happen in NMI Frederic Weisbecker
2010-10-15 3:13 ` [GIT PULL] small instrumentation updates Ingo Molnar
2 siblings, 0 replies; 4+ messages in thread
From: Frederic Weisbecker @ 2010-10-14 19:42 UTC (permalink / raw)
To: Ingo Molnar
Cc: LKML, Borislav Petkov, Chase Douglas, Steven Rostedt, Ingo Molnar,
Frederic Weisbecker
From: Borislav Petkov <bp@alien8.de>
Fix
kernel/trace/trace_functions_graph.c: In function ‘trace_print_graph_duration’:
kernel/trace/trace_functions_graph.c:652: warning: comparison of distinct pointer types lacks a cast
when building 36-rc6 on a 32-bit due to the strict type check failing
in the min() macro.
Signed-off-by: Borislav Petkov <bp@alien8.de>
Cc: Chase Douglas <chase.douglas@canonical.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Ingo Molnar <mingo@elte.hu>
LKML-Reference: <20100929080823.GA13595@liondog.tnic>
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
---
kernel/trace/trace_functions_graph.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/kernel/trace/trace_functions_graph.c b/kernel/trace/trace_functions_graph.c
index 02c708a..ef49e93 100644
--- a/kernel/trace/trace_functions_graph.c
+++ b/kernel/trace/trace_functions_graph.c
@@ -665,8 +665,9 @@ trace_print_graph_duration(unsigned long long duration, struct trace_seq *s)
/* Print nsecs (we don't want to exceed 7 numbers) */
if (len < 7) {
- snprintf(nsecs_str, min(sizeof(nsecs_str), 8UL - len), "%03lu",
- nsecs_rem);
+ size_t slen = min_t(size_t, sizeof(nsecs_str), 8UL - len);
+
+ snprintf(nsecs_str, slen, "%03lu", nsecs_rem);
ret = trace_seq_printf(s, ".%s", nsecs_str);
if (!ret)
return TRACE_TYPE_PARTIAL_LINE;
--
1.6.2.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] x86: Barf when vmalloc and kmemcheck faults happen in NMI
2010-10-14 19:42 [GIT PULL] small instrumentation updates Frederic Weisbecker
2010-10-14 19:42 ` [PATCH 1/2] tracing: Fix function-graph build warning on 32-bit Frederic Weisbecker
@ 2010-10-14 19:42 ` Frederic Weisbecker
2010-10-15 3:13 ` [GIT PULL] small instrumentation updates Ingo Molnar
2 siblings, 0 replies; 4+ messages in thread
From: Frederic Weisbecker @ 2010-10-14 19:42 UTC (permalink / raw)
To: Ingo Molnar
Cc: LKML, Frederic Weisbecker, Ingo Molnar, Thomas Gleixner,
H. Peter Anvin, Mathieu Desnoyers, Peter Zijlstra
In x86, faults exit by executing the iret instruction, which then
reenables NMIs if we faulted in NMI context. Then if a fault
happens in NMI, another NMI can nest after the fault exits.
But we don't yet support nested NMIs because we have only one NMI
stack. To prevent from that, check that vmalloc and kmemcheck
faults don't happen in this context. Most of the other kernel faults
in NMIs can be more easily spotted by finding explicit
copy_from,to_user() calls on review.
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
---
arch/x86/mm/fault.c | 4 ++++
arch/x86/mm/kmemcheck/kmemcheck.c | 2 ++
2 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
index 4c4508e..a24c6cf 100644
--- a/arch/x86/mm/fault.c
+++ b/arch/x86/mm/fault.c
@@ -251,6 +251,8 @@ static noinline __kprobes int vmalloc_fault(unsigned long address)
if (!(address >= VMALLOC_START && address < VMALLOC_END))
return -1;
+ WARN_ON_ONCE(in_nmi());
+
/*
* Synchronize this task's top level page-table
* with the 'reference' page table.
@@ -369,6 +371,8 @@ static noinline __kprobes int vmalloc_fault(unsigned long address)
if (!(address >= VMALLOC_START && address < VMALLOC_END))
return -1;
+ WARN_ON_ONCE(in_nmi());
+
/*
* Copy kernel mappings over when needed. This can also
* happen within a race in page table update. In the later
diff --git a/arch/x86/mm/kmemcheck/kmemcheck.c b/arch/x86/mm/kmemcheck/kmemcheck.c
index b3b531a..d87dd6d 100644
--- a/arch/x86/mm/kmemcheck/kmemcheck.c
+++ b/arch/x86/mm/kmemcheck/kmemcheck.c
@@ -631,6 +631,8 @@ bool kmemcheck_fault(struct pt_regs *regs, unsigned long address,
if (!pte)
return false;
+ WARN_ON_ONCE(in_nmi());
+
if (error_code & 2)
kmemcheck_access(regs, address, KMEMCHECK_WRITE);
else
--
1.6.2.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [GIT PULL] small instrumentation updates
2010-10-14 19:42 [GIT PULL] small instrumentation updates Frederic Weisbecker
2010-10-14 19:42 ` [PATCH 1/2] tracing: Fix function-graph build warning on 32-bit Frederic Weisbecker
2010-10-14 19:42 ` [PATCH 2/2] x86: Barf when vmalloc and kmemcheck faults happen in NMI Frederic Weisbecker
@ 2010-10-15 3:13 ` Ingo Molnar
2 siblings, 0 replies; 4+ messages in thread
From: Ingo Molnar @ 2010-10-15 3:13 UTC (permalink / raw)
To: Frederic Weisbecker
Cc: LKML, Thomas Gleixner, H . Peter Anvin, Peter Zijlstra,
Steven Rostedt
* Frederic Weisbecker <fweisbec@gmail.com> wrote:
> Ingo,
>
> Please pull the perf/core branch that can be found at:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/frederic/random-tracing.git
> perf/core
>
> Thanks,
> Frederic
> ---
>
> Borislav Petkov (1):
> tracing: Fix function-graph build warning on 32-bit
>
> Frederic Weisbecker (1):
> x86: Barf when vmalloc and kmemcheck faults happen in NMI
>
>
> arch/x86/mm/fault.c | 4 ++++
> arch/x86/mm/kmemcheck/kmemcheck.c | 2 ++
> kernel/trace/trace_functions_graph.c | 5 +++--
> 3 files changed, 9 insertions(+), 2 deletions(-)
Pulled, thanks a lot Frederic!
Ingo
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-10-15 3:13 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-14 19:42 [GIT PULL] small instrumentation updates Frederic Weisbecker
2010-10-14 19:42 ` [PATCH 1/2] tracing: Fix function-graph build warning on 32-bit Frederic Weisbecker
2010-10-14 19:42 ` [PATCH 2/2] x86: Barf when vmalloc and kmemcheck faults happen in NMI Frederic Weisbecker
2010-10-15 3:13 ` [GIT PULL] small instrumentation updates Ingo Molnar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox