Re: smp_mb__after_spinlock requirement too strong?

2018-03-12 Thread 焦晓冬
On Mon, Mar 12, 2018 at 9:24 PM, Andrea Parri wrote: > Hi Trol, > > [...] > > >> But this is just one special case that acquire-release chains promise us. >> >> A=B=0 as initial >> >> CPU0CPU1CPU2CPU3 >> write A=1 >>

Re: smp_mb__after_spinlock requirement too strong?

2018-03-12 Thread 焦晓冬
On Mon, Mar 12, 2018 at 9:24 PM, Andrea Parri wrote: > Hi Trol, > > [...] > > >> But this is just one special case that acquire-release chains promise us. >> >> A=B=0 as initial >> >> CPU0CPU1CPU2CPU3 >> write A=1 >>

Re: smp_mb__after_spinlock requirement too strong?

2018-03-12 Thread Peter Zijlstra
On Mon, Mar 12, 2018 at 05:13:03PM +0800, 焦晓冬 wrote: > If the fixed comment could point out where this RCsc is used, it will be > great. The one that comes to mind first is RCU-sched, that relies on a context switch implying a full smp_mb(). But I think there's more..

Re: smp_mb__after_spinlock requirement too strong?

2018-03-12 Thread Peter Zijlstra
On Mon, Mar 12, 2018 at 05:13:03PM +0800, 焦晓冬 wrote: > If the fixed comment could point out where this RCsc is used, it will be > great. The one that comes to mind first is RCU-sched, that relies on a context switch implying a full smp_mb(). But I think there's more..

Re: smp_mb__after_spinlock requirement too strong?

2018-03-12 Thread Andrea Parri
Hi Trol, [...] > But this is just one special case that acquire-release chains promise us. > > A=B=0 as initial > > CPU0CPU1CPU2CPU3 > write A=1 >read A=1 >write B=1 >

Re: smp_mb__after_spinlock requirement too strong?

2018-03-12 Thread Andrea Parri
Hi Trol, [...] > But this is just one special case that acquire-release chains promise us. > > A=B=0 as initial > > CPU0CPU1CPU2CPU3 > write A=1 >read A=1 >write B=1 >

Re: smp_mb__after_spinlock requirement too strong?

2018-03-12 Thread 焦晓冬
On Mon, Mar 12, 2018 at 4:56 PM, Peter Zijlstra wrote: > On Mon, Mar 12, 2018 at 04:56:00PM +0800, Boqun Feng wrote: >> So I think the purpose of smp_mb__after_spinlock() is to provide RCsc >> locks, it's just the comments before that may be misleading. We want >> RCsc locks

Re: smp_mb__after_spinlock requirement too strong?

2018-03-12 Thread 焦晓冬
On Mon, Mar 12, 2018 at 4:56 PM, Peter Zijlstra wrote: > On Mon, Mar 12, 2018 at 04:56:00PM +0800, Boqun Feng wrote: >> So I think the purpose of smp_mb__after_spinlock() is to provide RCsc >> locks, it's just the comments before that may be misleading. We want >> RCsc locks in schedule code

Re: smp_mb__after_spinlock requirement too strong?

2018-03-12 Thread Peter Zijlstra
On Mon, Mar 12, 2018 at 04:56:00PM +0800, Boqun Feng wrote: > So I think the purpose of smp_mb__after_spinlock() is to provide RCsc > locks, it's just the comments before that may be misleading. We want > RCsc locks in schedule code because we want writes in different critical > section are

Re: smp_mb__after_spinlock requirement too strong?

2018-03-12 Thread Peter Zijlstra
On Mon, Mar 12, 2018 at 04:56:00PM +0800, Boqun Feng wrote: > So I think the purpose of smp_mb__after_spinlock() is to provide RCsc > locks, it's just the comments before that may be misleading. We want > RCsc locks in schedule code because we want writes in different critical > section are

Re: smp_mb__after_spinlock requirement too strong?

2018-03-12 Thread Boqun Feng
On Mon, Mar 12, 2018 at 04:18:00PM +0800, 焦晓冬 wrote: > >> Peter pointed out in this patch https://patchwork.kernel.org/patch/9771921/ > >> that the spinning-lock used at __schedule() should be RCsc to ensure > >> visibility of writes prior to __schedule when the task is to be migrated to > >>

Re: smp_mb__after_spinlock requirement too strong?

2018-03-12 Thread Boqun Feng
On Mon, Mar 12, 2018 at 04:18:00PM +0800, 焦晓冬 wrote: > >> Peter pointed out in this patch https://patchwork.kernel.org/patch/9771921/ > >> that the spinning-lock used at __schedule() should be RCsc to ensure > >> visibility of writes prior to __schedule when the task is to be migrated to > >>

Re: smp_mb__after_spinlock requirement too strong?

2018-03-12 Thread 焦晓冬
>> Peter pointed out in this patch https://patchwork.kernel.org/patch/9771921/ >> that the spinning-lock used at __schedule() should be RCsc to ensure >> visibility of writes prior to __schedule when the task is to be migrated to >> another CPU. >> >> And this is emphasized at the comment of the

Re: smp_mb__after_spinlock requirement too strong?

2018-03-12 Thread 焦晓冬
>> Peter pointed out in this patch https://patchwork.kernel.org/patch/9771921/ >> that the spinning-lock used at __schedule() should be RCsc to ensure >> visibility of writes prior to __schedule when the task is to be migrated to >> another CPU. >> >> And this is emphasized at the comment of the

Re: smp_mb__after_spinlock requirement too strong?

2018-03-11 Thread Boqun Feng
On Sun, Mar 11, 2018 at 03:55:41PM +0800, 焦晓冬 wrote: > Peter pointed out in this patch https://patchwork.kernel.org/patch/9771921/ > that the spinning-lock used at __schedule() should be RCsc to ensure > visibility of writes prior to __schedule when the task is to be migrated to > another CPU. >

Re: smp_mb__after_spinlock requirement too strong?

2018-03-11 Thread Boqun Feng
On Sun, Mar 11, 2018 at 03:55:41PM +0800, 焦晓冬 wrote: > Peter pointed out in this patch https://patchwork.kernel.org/patch/9771921/ > that the spinning-lock used at __schedule() should be RCsc to ensure > visibility of writes prior to __schedule when the task is to be migrated to > another CPU. >

smp_mb__after_spinlock requirement too strong?

2018-03-10 Thread 焦晓冬
Peter pointed out in this patch https://patchwork.kernel.org/patch/9771921/ that the spinning-lock used at __schedule() should be RCsc to ensure visibility of writes prior to __schedule when the task is to be migrated to another CPU. And this is emphasized at the comment of the newly introduced

smp_mb__after_spinlock requirement too strong?

2018-03-10 Thread 焦晓冬
Peter pointed out in this patch https://patchwork.kernel.org/patch/9771921/ that the spinning-lock used at __schedule() should be RCsc to ensure visibility of writes prior to __schedule when the task is to be migrated to another CPU. And this is emphasized at the comment of the newly introduced