Skip to content

Commit 3e39aa1

Browse files
Stuart BennettIngo Molnar
authored andcommitted
x86 mmiotrace: improve handling of secondary faults
Upgrade some kmmio.c debug messages to warnings. Allow secondary faults on probed pages to fall through, and only log secondary faults that are not due to non-present pages. Patch edited by Pekka Paalanen. Signed-off-by: Stuart Bennett <[email protected]> Signed-off-by: Pekka Paalanen <[email protected]> Cc: Steven Rostedt <[email protected]> Signed-off-by: Ingo Molnar <[email protected]>
1 parent 0b700a6 commit 3e39aa1

File tree

1 file changed

+22
-18
lines changed

1 file changed

+22
-18
lines changed

arch/x86/mm/kmmio.c

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -232,28 +232,32 @@ int kmmio_handler(struct pt_regs *regs, unsigned long addr)
232232

233233
ctx = &get_cpu_var(kmmio_ctx);
234234
if (ctx->active) {
235-
disarm_kmmio_fault_page(faultpage);
236235
if (addr == ctx->addr) {
237236
/*
238-
* On SMP we sometimes get recursive probe hits on the
239-
* same address. Context is already saved, fall out.
237+
* A second fault on the same page means some other
238+
* condition needs handling by do_page_fault(), the
239+
* page really not being present is the most common.
240240
*/
241-
pr_debug("kmmio: duplicate probe hit on CPU %d, for "
242-
"address 0x%08lx.\n",
243-
smp_processor_id(), addr);
244-
ret = 1;
245-
goto no_kmmio_ctx;
246-
}
247-
/*
248-
* Prevent overwriting already in-flight context.
249-
* This should not happen, let's hope disarming at least
250-
* prevents a panic.
251-
*/
252-
pr_emerg("kmmio: recursive probe hit on CPU %d, "
241+
pr_debug("kmmio: secondary hit for 0x%08lx CPU %d.\n",
242+
addr, smp_processor_id());
243+
244+
if (!faultpage->old_presence)
245+
pr_info("kmmio: unexpected secondary hit for "
246+
"address 0x%08lx on CPU %d.\n", addr,
247+
smp_processor_id());
248+
} else {
249+
/*
250+
* Prevent overwriting already in-flight context.
251+
* This should not happen, let's hope disarming at
252+
* least prevents a panic.
253+
*/
254+
pr_emerg("kmmio: recursive probe hit on CPU %d, "
253255
"for address 0x%08lx. Ignoring.\n",
254256
smp_processor_id(), addr);
255-
pr_emerg("kmmio: previous hit was at 0x%08lx.\n",
256-
ctx->addr);
257+
pr_emerg("kmmio: previous hit was at 0x%08lx.\n",
258+
ctx->addr);
259+
disarm_kmmio_fault_page(faultpage);
260+
}
257261
goto no_kmmio_ctx;
258262
}
259263
ctx->active++;
@@ -305,7 +309,7 @@ static int post_kmmio_handler(unsigned long condition, struct pt_regs *regs)
305309
struct kmmio_context *ctx = &get_cpu_var(kmmio_ctx);
306310

307311
if (!ctx->active) {
308-
pr_debug("kmmio: spurious debug trap on CPU %d.\n",
312+
pr_warning("kmmio: spurious debug trap on CPU %d.\n",
309313
smp_processor_id());
310314
goto out;
311315
}

0 commit comments

Comments
 (0)