Re: [RFC PATCH 1/5] x86: introduce preemption disable prefix

2018-11-29 Thread Peter Zijlstra
On Fri, Oct 19, 2018 at 07:29:45AM -0700, Andy Lutomirski wrote: > > On Oct 19, 2018, at 1:33 AM, Peter Zijlstra wrote: > > > >> On Fri, Oct 19, 2018 at 01:08:23AM +, Nadav Amit wrote: > >> Consider for example do_int3(), and see my inlined comments: > >> > >> dotraplinkage void notrace do_i

Re: [RFC PATCH 1/5] x86: introduce preemption disable prefix

2018-10-19 Thread Masami Hiramatsu
On Fri, 19 Oct 2018 04:44:33 + Nadav Amit wrote: > at 9:29 PM, Andy Lutomirski wrote: > > >> On Oct 18, 2018, at 6:08 PM, Nadav Amit wrote: > >> > >> at 10:00 AM, Andy Lutomirski wrote: > >> > On Oct 18, 2018, at 9:47 AM, Nadav Amit wrote: > > at 8:51 PM, Andy Lutomirsk

Re: [RFC PATCH 1/5] x86: introduce preemption disable prefix

2018-10-19 Thread Alexei Starovoitov
On Fri, Oct 19, 2018 at 1:22 AM Peter Zijlstra wrote: > > On Thu, Oct 18, 2018 at 10:00:53PM -0700, Alexei Starovoitov wrote: > > > > > > > > > > > Another example is __BPF_PROG_RUN_ARRAY(), which also uses > > > > preempt_enable_no_resched(). > > > > > > Alexei, I think this code is just wrong. >

Re: [RFC PATCH 1/5] x86: introduce preemption disable prefix

2018-10-19 Thread Andy Lutomirski
> On Oct 19, 2018, at 1:33 AM, Peter Zijlstra wrote: > >> On Fri, Oct 19, 2018 at 01:08:23AM +, Nadav Amit wrote: >> Consider for example do_int3(), and see my inlined comments: >> >> dotraplinkage void notrace do_int3(struct pt_regs *regs, long error_code) >> { >>... >>ist_enter(

Re: [RFC PATCH 1/5] x86: introduce preemption disable prefix

2018-10-19 Thread Oleg Nesterov
On 10/18, Andy Lutomirski wrote: > > Oleg, the code in kernel/signal.c: > > preempt_disable(); > read_unlock(&tasklist_lock); > preempt_enable_no_resched(); > freezable_schedule(); > > looks bogus. I don't get what it's trying to achi

Re: [RFC PATCH 1/5] x86: introduce preemption disable prefix

2018-10-19 Thread Peter Zijlstra
On Fri, Oct 19, 2018 at 01:08:23AM +, Nadav Amit wrote: > Consider for example do_int3(), and see my inlined comments: > > dotraplinkage void notrace do_int3(struct pt_regs *regs, long error_code) > { > ... > ist_enter(regs);// => preempt_disable() > cond_loca

Re: [RFC PATCH 1/5] x86: introduce preemption disable prefix

2018-10-19 Thread Peter Zijlstra
On Thu, Oct 18, 2018 at 10:00:53PM -0700, Alexei Starovoitov wrote: > > > > > > > > Another example is __BPF_PROG_RUN_ARRAY(), which also uses > > > preempt_enable_no_resched(). > > > > Alexei, I think this code is just wrong. > > why 'just wrong' ? Because you lost a preemption point, this is

Re: [RFC PATCH 1/5] x86: introduce preemption disable prefix

2018-10-19 Thread Peter Zijlstra
On Thu, Oct 18, 2018 at 09:29:39PM -0700, Andy Lutomirski wrote: > > Another example is __BPF_PROG_RUN_ARRAY(), which also uses > > preempt_enable_no_resched(). > > Alexei, I think this code is just wrong. Do you know why it uses > preempt_enable_no_resched()? Yes, that's a straight up bug. It

Re: [RFC PATCH 1/5] x86: introduce preemption disable prefix

2018-10-18 Thread Alexei Starovoitov
> > > > > Another example is __BPF_PROG_RUN_ARRAY(), which also uses > > preempt_enable_no_resched(). > > Alexei, I think this code is just wrong. why 'just wrong' ? > Do you know why it uses > preempt_enable_no_resched()? dont recall precisely. we could be preemptable at the point where macro

Re: [RFC PATCH 1/5] x86: introduce preemption disable prefix

2018-10-18 Thread Nadav Amit
at 9:29 PM, Andy Lutomirski wrote: >> On Oct 18, 2018, at 6:08 PM, Nadav Amit wrote: >> >> at 10:00 AM, Andy Lutomirski wrote: >> On Oct 18, 2018, at 9:47 AM, Nadav Amit wrote: at 8:51 PM, Andy Lutomirski wrote: >> On Wed, Oct 17, 2018 at 8:12 PM Nadav Amit wrote:

Re: [RFC PATCH 1/5] x86: introduce preemption disable prefix

2018-10-18 Thread Andy Lutomirski
> On Oct 18, 2018, at 6:08 PM, Nadav Amit wrote: > > at 10:00 AM, Andy Lutomirski wrote: > >> >> >>> On Oct 18, 2018, at 9:47 AM, Nadav Amit wrote: >>> >>> at 8:51 PM, Andy Lutomirski wrote: >>> > On Wed, Oct 17, 2018 at 8:12 PM Nadav Amit wrote: > at 6:22 PM, Andy Lutomirski wrote: >

Re: [RFC PATCH 1/5] x86: introduce preemption disable prefix

2018-10-18 Thread Nadav Amit
at 10:00 AM, Andy Lutomirski wrote: > > >> On Oct 18, 2018, at 9:47 AM, Nadav Amit wrote: >> >> at 8:51 PM, Andy Lutomirski wrote: >> On Wed, Oct 17, 2018 at 8:12 PM Nadav Amit wrote: at 6:22 PM, Andy Lutomirski wrote: >> On Oct 17, 2018, at 5:54 PM, Nadav Amit wrote:

Re: [RFC PATCH 1/5] x86: introduce preemption disable prefix

2018-10-18 Thread Nadav Amit
at 12:54 AM, Peter Zijlstra wrote: > On Wed, Oct 17, 2018 at 06:22:48PM -0700, Andy Lutomirski wrote: >>> On Oct 17, 2018, at 5:54 PM, Nadav Amit wrote: >>> >>> It is sometimes beneficial to prevent preemption for very few >>> instructions, or prevent preemption for some instructions that prece

Re: [RFC PATCH 1/5] x86: introduce preemption disable prefix

2018-10-18 Thread Nadav Amit
at 10:29 AM, Andy Lutomirski wrote: > On Thu, Oct 18, 2018 at 10:25 AM Nadav Amit wrote: >> at 10:00 AM, Andy Lutomirski wrote: >> On Oct 18, 2018, at 9:47 AM, Nadav Amit wrote: at 8:51 PM, Andy Lutomirski wrote: >> On Wed, Oct 17, 2018 at 8:12 PM Nadav Amit wrote:

Re: [RFC PATCH 1/5] x86: introduce preemption disable prefix

2018-10-18 Thread Andy Lutomirski
On Thu, Oct 18, 2018 at 10:25 AM Nadav Amit wrote: > > at 10:00 AM, Andy Lutomirski wrote: > > > > > > >> On Oct 18, 2018, at 9:47 AM, Nadav Amit wrote: > >> > >> at 8:51 PM, Andy Lutomirski wrote: > >> > On Wed, Oct 17, 2018 at 8:12 PM Nadav Amit wrote: > at 6:22 PM, Andy Lutomirski

Re: [RFC PATCH 1/5] x86: introduce preemption disable prefix

2018-10-18 Thread Nadav Amit
at 10:00 AM, Andy Lutomirski wrote: > > >> On Oct 18, 2018, at 9:47 AM, Nadav Amit wrote: >> >> at 8:51 PM, Andy Lutomirski wrote: >> On Wed, Oct 17, 2018 at 8:12 PM Nadav Amit wrote: at 6:22 PM, Andy Lutomirski wrote: >> On Oct 17, 2018, at 5:54 PM, Nadav Amit wrote:

Re: [RFC PATCH 1/5] x86: introduce preemption disable prefix

2018-10-18 Thread Andy Lutomirski
> On Oct 18, 2018, at 9:47 AM, Nadav Amit wrote: > > at 8:51 PM, Andy Lutomirski wrote: > >>> On Wed, Oct 17, 2018 at 8:12 PM Nadav Amit wrote: >>> at 6:22 PM, Andy Lutomirski wrote: >>> > On Oct 17, 2018, at 5:54 PM, Nadav Amit wrote: > > It is sometimes beneficial to preve

Re: [RFC PATCH 1/5] x86: introduce preemption disable prefix

2018-10-18 Thread Nadav Amit
at 8:51 PM, Andy Lutomirski wrote: > On Wed, Oct 17, 2018 at 8:12 PM Nadav Amit wrote: >> at 6:22 PM, Andy Lutomirski wrote: >> On Oct 17, 2018, at 5:54 PM, Nadav Amit wrote: It is sometimes beneficial to prevent preemption for very few instructions, or prevent preemption

Re: [RFC PATCH 1/5] x86: introduce preemption disable prefix

2018-10-18 Thread Peter Zijlstra
On Wed, Oct 17, 2018 at 06:22:48PM -0700, Andy Lutomirski wrote: > > > On Oct 17, 2018, at 5:54 PM, Nadav Amit wrote: > > > > It is sometimes beneficial to prevent preemption for very few > > instructions, or prevent preemption for some instructions that precede > > a branch (this latter case wi

Re: [RFC PATCH 1/5] x86: introduce preemption disable prefix

2018-10-17 Thread Andy Lutomirski
On Wed, Oct 17, 2018 at 8:12 PM Nadav Amit wrote: > > at 6:22 PM, Andy Lutomirski wrote: > > > > >> On Oct 17, 2018, at 5:54 PM, Nadav Amit wrote: > >> > >> It is sometimes beneficial to prevent preemption for very few > >> instructions, or prevent preemption for some instructions that precede >

Re: [RFC PATCH 1/5] x86: introduce preemption disable prefix

2018-10-17 Thread Nadav Amit
at 8:11 PM, Nadav Amit wrote: > at 6:22 PM, Andy Lutomirski wrote: > >>> On Oct 17, 2018, at 5:54 PM, Nadav Amit wrote: >>> >>> It is sometimes beneficial to prevent preemption for very few >>> instructions, or prevent preemption for some instructions that precede >>> a branch (this latter ca

Re: [RFC PATCH 1/5] x86: introduce preemption disable prefix

2018-10-17 Thread Nadav Amit
at 6:22 PM, Andy Lutomirski wrote: > >> On Oct 17, 2018, at 5:54 PM, Nadav Amit wrote: >> >> It is sometimes beneficial to prevent preemption for very few >> instructions, or prevent preemption for some instructions that precede >> a branch (this latter case will be introduced in the next patc

Re: [RFC PATCH 1/5] x86: introduce preemption disable prefix

2018-10-17 Thread Andy Lutomirski
> On Oct 17, 2018, at 5:54 PM, Nadav Amit wrote: > > It is sometimes beneficial to prevent preemption for very few > instructions, or prevent preemption for some instructions that precede > a branch (this latter case will be introduced in the next patches). > > To provide such functionality on