Re: [patch] s390: do not use _local_bh_enable()

From: Martin Schwidefsky
Date: Fri Feb 23 2007 - 08:42:07 EST


On Fri, 2007-02-23 at 10:36 +0100, Heiko Carstens wrote:
> Same here: this is not really an irq handler but a function that gets called
> from different contexts and pretends to be an irq handler. The
> local_bh_disable()/_local_bh_enable() pair is just a trick to prevent bottom
> halve execution. I think you can blame Martin for this ;)

This code is really tricky. There are now three functions (cio_tpi,
sclp_sync_wait and __udelay) where we use a local_bh_disable()
_local_bh_enable() pair while we are disabled for interrupts. cio_tpi
and sclp_sync_wait are used to wait for the interrupt of the console
device to make room in the buffer for a printk out of disabled context.
__udelay() is used in the ETR clock-synchronization code where we are
disabled as well and the only alternative would be looping on a STCK for
about a second.

So basically we want to synchronously receive a specific interrupt. All
other interrupt sources are disabled. We know that the interrupt we wait
for will not cause a softirq to get scheduled. In case of sclp_sync_wait
and __udelay the interrupt is delivered the usual way by using the
asynchronous interrupt handler (I told you it is tricky ;-). That works
as long as only the hardirq part of the interrupt is executed, the
softirq part may not happen -> local_bh_disable. Back in the function
after the interrupt we cannot allow the softirq to happen when we
reenable the bottom-halves since the functions are called disabled and
need to stay disabled -> _local_bh_enable. Since the interrupt we waited
for did not add a softirq no harms is done, no?

--
blue skies, IBM Deutschland Entwicklung GmbH
Martin Vorsitzender des Aufsichtsrats: Johann Weihen
Geschäftsführung: Herbert Kircher
Martin Schwidefsky Sitz der Gesellschaft: Böblingen
Linux on zSeries Registergericht: Amtsgericht Stuttgart,
Development HRB 243294

"Reality continues to ruin my life." - Calvin.


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/