Re: [patch 2.6.24-rc2 1/3] generic gpio -- gpio_chip support

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: David Brownell
Date: Wednesday, November 14, 2007 - 1:20 am

On Tuesday 13 November 2007, Nick Piggin wrote:

That's one subject of discussion here.  I got the expected
knee-jerk responses (saying just that) -- right, ignore those
and aim for ones that look at the actual issues.



Which is why bitops like <asm-generic/bitops/atomic.h> use
normal spinlocks.  Oh, wait, no they don't ...


Today, platform GPIO logic has no preemption points.

There are a few dozen implementations in the tree, not all
using the generic calls (yet!), none radically different.

Certainly when gpio_set_value() is inlined, it works very
much like set_bit()/clear_bit() on hardware with atomic ops.
Not a preemption point

But it often turns into a function call that needs to map
from GPIO number to GPIO bank, and then to a bitslice through
that bank's registers.  I know of only one platform which
even has any locking on those code paths(*) ... so again
those calls aren't preemption points.



Nope.  Just saying that the relevant instructions (three, in the
hot path I looked at, and not a case where priority inversion
scenarios should be a concern) shouldn't be forcibly morphed into
preemption points.  Any more than other bitops were (not).

If a higher priority task needs that CPU, nothing prevents it
from being immediately descheduled.  Ditto handling a hardirq.

All this does is prevent constant and needless checking for
"do you want to preempt me now?" "now?" "now?" in "now?" the
middle "now?" of "now?" i/o "now?" loops.



This isn't driver code...

I think you've just presented an argument why that stuff
shouldn't really exist in -rt either... :)

- Dave

(*)  Exception, arch/arm/plat-omap/gpio.c uses spinlocks.
     Maybe I should say "misuses"; ISTR getting various
     lockdep complaints about the same spinlock being used
     both from IRQ and non-IRQ contexts.  In some common
     cases that lock could probably be eliminated, but
     if you look at the code you'll know why nobody's much
     wanted to clean it up.


-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[patch 2.6.24-rc2 1/3] generic gpio -- gpio_chip support, David Brownell, (Fri Nov 9, 12:36 pm)
Re: [patch 2.6.24-rc2 1/3] generic gpio -- gpio_chip support, David Brownell, (Tue Nov 13, 12:22 pm)
Re: [patch 2.6.24-rc2 1/3] generic gpio -- gpio_chip support, David Brownell, (Tue Nov 13, 11:52 pm)
Re: [patch 2.6.24-rc2 1/3] generic gpio -- gpio_chip support, David Brownell, (Wed Nov 14, 1:20 am)
Re: [patch 2.6.24-rc2 1/3] generic gpio -- gpio_chip support, Haavard Skinnemoen, (Wed Nov 14, 2:54 am)
Re: [patch 2.6.24-rc2 1/3] generic gpio -- gpio_chip support, Thomas Gleixner, (Wed Nov 14, 5:14 am)
Re: [patch 2.6.24-rc2 1/3] generic gpio -- gpio_chip support, David Brownell, (Wed Nov 14, 11:23 pm)
Re: [patch 2.6.24-rc2 1/3] generic gpio -- gpio_chip support, David Brownell, (Wed Nov 14, 11:28 pm)
Re: [patch 2.6.24-rc2 1/3] generic gpio -- gpio_chip support, David Brownell, (Wed Nov 14, 11:50 pm)
Re: [patch 2.6.24-rc2 1/3] generic gpio -- gpio_chip support, David Brownell, (Thu Nov 15, 12:02 am)
Re: [patch 2.6.24-rc2 1/3] generic gpio -- gpio_chip support, David Brownell, (Thu Nov 15, 12:17 am)
Re: [patch 2.6.24-rc2 1/3] generic gpio -- gpio_chip support, Thomas Gleixner, (Thu Nov 15, 12:32 am)
Re: [patch 2.6.24-rc2 1/3] generic gpio -- gpio_chip support, Thomas Gleixner, (Thu Nov 15, 12:35 am)
Re: [patch 2.6.24-rc2 1/3] generic gpio -- gpio_chip support, Haavard Skinnemoen, (Thu Nov 15, 1:43 am)
Re: [patch 2.6.24-rc2 1/3] generic gpio -- gpio_chip support, Haavard Skinnemoen, (Thu Nov 15, 1:51 am)
Re: [patch 2.6.24-rc2 1/3] generic gpio -- gpio_chip support, David Brownell, (Thu Nov 15, 11:55 am)