Re: Ubiquitous ucas(9)

2019-03-31 Thread Jason Thorpe
> On Mar 31, 2019, at 3:12 PM, Mindaugas Rasiukevicius wrote: > > A few comments: > > - Kernel preemption is implicitly disabled at IPL_HIGH, so you do not need > to do it explicitly. Ah, of course. Makes sense. > - Consider re-using the cpu_lock instead of adding ucas_critical_mutex. Don

Re: Ubiquitous ucas(9)

2019-03-31 Thread Mindaugas Rasiukevicius
Jason Thorpe wrote: > <...> > > a) acquire the ucas_critical_mutex. > b) disable preemption. > c) go to splhigh(). > d) set ucas_critical_owning_cpu to curcpu(). > e) membar_enter() > f) Trigger an IPI on all-but-owning-cpu to enter the ucas_critical_gate. > g) wait for all-but-owning cpu to ente

Re: Ubiquitous ucas(9)

2019-03-31 Thread Jason Thorpe
> On Mar 29, 2019, at 6:16 PM, Jason Thorpe wrote: > > Thanks for the pointer -- I'll take a look. The splhigh() should not be a > problem because the page will be wired. > > So, something like: > > -- Broadcast IPI > -- Wait for semaphore variable to reach (ncpuonline - 1) >

Re: Ubiquitous ucas(9)

2019-03-29 Thread Jason Thorpe
(Apologies for the small-screen reply... picking up someone at the airport, and this is the device I have handy whilst I wait...) Yes, sparc and vax have “test-and-set” atomic primitives. Those are perfectly fine for implementing an interlock in a mutex, but the algorithm I’m implementing at a

Re: Ubiquitous ucas(9)

2019-03-29 Thread Mouse
> I'm trying to wrap up my ufetch / ustore changes (http://mail-index.netbsd.o$ > [...] > Then there are platforms where [ucas is] just missing (sparc, vax). > These platfo$ Why insist that LL/SC and CAS are the only acceptable primitives, and that platforms that don't have them in hardware have t

Re: Ubiquitous ucas(9)

2019-03-29 Thread Jason Thorpe
> On Mar 29, 2019, at 3:01 PM, Mindaugas Rasiukevicius wrote: > I think I might have introduced the ucas_*() API with x86 support back > in 2009 (and portmasters added it to others architectures, but not all).. > The ustore/ufetch API was supposed to be a follow-up clean up. Thanks > for fina

Re: Ubiquitous ucas(9)

2019-03-29 Thread Mindaugas Rasiukevicius
Jason Thorpe wrote: > Folks... > > I'm trying to wrap up my ufetch / ustore changes > (http://mail-index.netbsd.org/tech-kern/2019/02/23/msg024690.html), and I > realized there's another requirement that the project I'm working on > has... specifically, ucas_int() ... for those unfamiliar, this i

Ubiquitous ucas(9)

2019-03-29 Thread Jason Thorpe
Folks... I'm trying to wrap up my ufetch / ustore changes (http://mail-index.netbsd.org/tech-kern/2019/02/23/msg024690.html), and I realized there's another requirement that the project I'm working on has... specifically, ucas_int() ... for those unfamiliar, this is like atomic_cas_int(), but