tech-net archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: if_txtimer API to replace (*if_watchdog)()



On Thu, Jan 23, 2020 at 09:19:42AM -0800, Jason Thorpe wrote:

> > On Jan 23, 2020, at 8:10 AM, Andrew Doran <ad%netbsd.org@localhost> wrote:
> > 
> > With spin mutexes you can only do a positive check, i.e.  "I know I should
> > own this right now and want to check that" because for the negative case
> > some other CPU could own it, or mutex_owned() could be lying to you because
> > the kernel was compiled without options MULTIPROCESSOR.
> 
> Hm, it'd be nice if we could record this somehow to assert that "it's this CPU that has it".

It's a big compromise, for older computers that don't have CAS, or where
they'll never have more than one CPU.  I'd rather it didn't work that way
but it's the price to pay.  If you have the CPU cycles to burn you can run
LOCKDEBUG and it'll keep you honest with stuff like that, it does a kind of
crude parallel simulation with its own data structures and keeps track of
what locks are held, and remembers where they were taken, and by whom and
readily panics if it doesn't like how things turn out.

Andrew


Home | Main Index | Thread Index | Old Index