linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Question: goal of twice disabling of preemption in exception handlers
@ 2016-11-20 17:52 Alexnader Kuleshov
  2016-11-27 18:57 ` Andy Lutomirski
  0 siblings, 1 reply; 3+ messages in thread
From: Alexnader Kuleshov @ 2016-11-20 17:52 UTC (permalink / raw)
  To: open list
  Cc: Thomas Gleixner, Ingo Molnar, Borislav Petkov, Andy Lutomirski,
	Paul Gortmaker, Jan Beulich, Tony Luck, Jianyu Zhan

Hello everyone,

Exception handlers which may run on IST stack disable and enable preemption
twice. For example do_int3() [1]. This one calls ist_enter() which
disables preemption with preempt_disable() every time without any conditions.
And later do_int3() calls preempt_disable() again [2] before do_trap().

Of course we decrement preemption counter in the end of such exception
handlers twice too. But what's actual purpose of doing this two times?

[1] https://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git/tree/arch/x86/kernel/traps.c?id=refs/tags/next-20161117#n530
[2] https://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git/tree/arch/x86/kernel/traps.c?id=refs/tags/next-20161117#n566

Thank you.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Question: goal of twice disabling of preemption in exception handlers
  2016-11-20 17:52 Question: goal of twice disabling of preemption in exception handlers Alexnader Kuleshov
@ 2016-11-27 18:57 ` Andy Lutomirski
  2016-11-27 19:45   ` Alexnader Kuleshov
  0 siblings, 1 reply; 3+ messages in thread
From: Andy Lutomirski @ 2016-11-27 18:57 UTC (permalink / raw)
  To: Alexnader Kuleshov
  Cc: open list, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Andy Lutomirski, Paul Gortmaker, Jan Beulich, Tony Luck,
	Jianyu Zhan

On Sun, Nov 20, 2016 at 9:52 AM, Alexnader Kuleshov
<kuleshovmail@gmail.com> wrote:
> Hello everyone,
>
> Exception handlers which may run on IST stack disable and enable preemption
> twice. For example do_int3() [1]. This one calls ist_enter() which
> disables preemption with preempt_disable() every time without any conditions.
> And later do_int3() calls preempt_disable() again [2] before do_trap().
>
> Of course we decrement preemption counter in the end of such exception
> handlers twice too. But what's actual purpose of doing this two times?
>
> [1] https://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git/tree/arch/x86/kernel/traps.c?id=refs/tags/next-20161117#n530
> [2] https://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git/tree/arch/x86/kernel/traps.c?id=refs/tags/next-20161117#n566
>
> Thank you.

You could submit a patch to get rid of the extra one if you like.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Question: goal of twice disabling of preemption in exception handlers
  2016-11-27 18:57 ` Andy Lutomirski
@ 2016-11-27 19:45   ` Alexnader Kuleshov
  0 siblings, 0 replies; 3+ messages in thread
From: Alexnader Kuleshov @ 2016-11-27 19:45 UTC (permalink / raw)
  To: Andy Lutomirski
  Cc: Alexnader Kuleshov, open list, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, Andy Lutomirski, Paul Gortmaker, Jan Beulich,
	Tony Luck, Jianyu Zhan

On 11-27-16, Andy Lutomirski wrote:
> On Sun, Nov 20, 2016 at 9:52 AM, Alexnader Kuleshov
> <kuleshovmail@gmail.com> wrote:
> > Hello everyone,
> >
> > Exception handlers which may run on IST stack disable and enable preemption
> > twice. For example do_int3() [1]. This one calls ist_enter() which
> > disables preemption with preempt_disable() every time without any conditions.
> > And later do_int3() calls preempt_disable() again [2] before do_trap().
> >
> > Of course we decrement preemption counter in the end of such exception
> > handlers twice too. But what's actual purpose of doing this two times?
> >
> > [1] https://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git/tree/arch/x86/kernel/traps.c?id=refs/tags/next-20161117#n530
> > [2] https://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git/tree/arch/x86/kernel/traps.c?id=refs/tags/next-20161117#n566
> >
> > Thank you.
> 
> You could submit a patch to get rid of the extra one if you like.

Thanks for reply. Will send a patch.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-11-27 19:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-20 17:52 Question: goal of twice disabling of preemption in exception handlers Alexnader Kuleshov
2016-11-27 18:57 ` Andy Lutomirski
2016-11-27 19:45   ` Alexnader Kuleshov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).