Re: [PATCH v2] x86/traps: Don't force in_interrupt() to return true in IST handlers

From: Oleg Nesterov
Date: Fri Jun 10 2016 - 08:51:10 EST


On 05/24, Andy Lutomirski wrote:
>
> void ist_enter(struct pt_regs *regs)
> {
> if (user_mode(regs)) {
> @@ -109,13 +115,7 @@ void ist_enter(struct pt_regs *regs)
> rcu_nmi_enter();
> }
>
> - /*
> - * We are atomic because we're on the IST stack; or we're on
> - * x86_32, in which case we still shouldn't schedule; or we're
> - * on x86_64 and entered from user mode, in which case we're
> - * still atomic unless ist_begin_non_atomic is called.
> - */
> - preempt_count_add(HARDIRQ_OFFSET);
> + preempt_disable();

off-topic question,

perhaps it makes sense to remove another preempt_disable/preempt_enable_no_resched
in do_int3() and do_debug() ?

They were added by d99e1bd175f4291ddb6e62b22bb5bdbe3976389a ("x86/entry/traps: Refactor
preemption and interrupt flag handling") and afaics for no reason.

Oleg.