Skip to content

Commit 3e12758

Browse files
committed
x86/mm/kmmio: Remove redundant preempt_disable()
Now that kmmio uses rcu_read_lock_sched_notrace() there's no reason to call preempt_disable() as the read_lock_sched_notrace() already does that and is redundant. This also removes the preempt_enable_no_resched() as the "no_resched()" portion was bogus as there's no reason to do that. Link: https://lkml.kernel.org/r/[email protected] Cc: Masami Hiramatsu <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: "[email protected]" <[email protected]> Cc: Karol Herbst <[email protected]> Cc: Pekka Paalanen <[email protected]> Cc: Dave Hansen <[email protected]> Cc: Andy Lutomirski <[email protected]> Cc: Ingo Molnar <[email protected]> Signed-off-by: Steven Rostedt (Google) <[email protected]>
1 parent c1ac03a commit 3e12758

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

arch/x86/mm/kmmio.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -246,14 +246,13 @@ int kmmio_handler(struct pt_regs *regs, unsigned long addr)
246246
page_base &= page_level_mask(l);
247247

248248
/*
249-
* Preemption is now disabled to prevent process switch during
250-
* single stepping. We can only handle one active kmmio trace
249+
* Hold the RCU read lock over single stepping to avoid looking
250+
* up the probe and kmmio_fault_page again. The rcu_read_lock_sched()
251+
* also disables preemption and prevents process switch during
252+
* the single stepping. We can only handle one active kmmio trace
251253
* per cpu, so ensure that we finish it before something else
252-
* gets to run. We also hold the RCU read lock over single
253-
* stepping to avoid looking up the probe and kmmio_fault_page
254-
* again.
254+
* gets to run.
255255
*/
256-
preempt_disable();
257256
rcu_read_lock_sched_notrace();
258257

259258
faultpage = get_kmmio_fault_page(page_base);
@@ -324,7 +323,6 @@ int kmmio_handler(struct pt_regs *regs, unsigned long addr)
324323

325324
no_kmmio:
326325
rcu_read_unlock_sched_notrace();
327-
preempt_enable_no_resched();
328326
return ret;
329327
}
330328

@@ -364,7 +362,6 @@ static int post_kmmio_handler(unsigned long condition, struct pt_regs *regs)
364362
ctx->active--;
365363
BUG_ON(ctx->active);
366364
rcu_read_unlock_sched_notrace();
367-
preempt_enable_no_resched();
368365

369366
/*
370367
* if somebody else is singlestepping across a probe point, flags

0 commit comments

Comments
 (0)