Port-i386 archive

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

Re: [PATCH] Add intr_mask() / intr_unmask() interface to mask / unmask individual interrupt sources



On Sat, Nov 30, 2019 at 11:00:36AM -0800, Jason Thorpe wrote:
> 
> > On Nov 30, 2019, at 10:02 AM, Manuel Bouyer <bouyer%antioche.eu.org@localhost> wrote:
> > 
> > This depends on the backend controller. iichid on x86 is working fine
> > as is on my laptop ...
> 
> It might "work" in some cases, but is in general not a safe model.  Saying it "depends on the backend controller" is really a giant red flag, complete with <blink> tag and klaxons sounding off.  As I was cleaning up the way the i2c mid-layer handles bus acquire / release, I found wildly inconsistent behavior... some back-end controllers didn't even bother with the bus lock if I2C_F_POLL was specified and would have happily clobbered on whatever else might have been going on at the time.  Others would have deadlocked.  Still others would have done things that would have resulted in a panic.  In at least one case, I found a bug in a backend driver that required it to force I2C_F_POLL because **without it** a deadlock was guaranteed.

Yes, I've noticed this too. I've fixed some case where I could test the code.

Note that usually, the bus acquire / release issue is not a problem
if there's a single slave on the bus, which remains the common case.

> [...]
> > I still believe we'll need some #define to know if the MD interrupt code
> > provides working mask/unmask until all ports provide them.
> > This will be usefull for more hardware than i2c ...
> 
> I guess I'm fine with adding a #define __HAVE_INTR_MASK that can be tested (and I'll make ihidev.c require it).
> 
> But eventually a proper overhaul of the various interrupt APIs we have needs to be undertaken.  Alas, that's just beyond the scope of what I'm trying to get done right now, and I don't really have the bandwidth to go down that rabbit hole.

Sure, I agree with this long-term goal. Beside ihidev I have another case
that would use it (on arm).

But this is lots of work, and we can't break existing code until all
ports have implemented it.

-- 
Manuel Bouyer <bouyer%antioche.eu.org@localhost>
     NetBSD: 26 ans d'experience feront toujours la difference
--


Home | Main Index | Thread Index | Old Index