Subject: Re: [Cbe-oss-dev] [patch 02/02] powerpc/cell: add supportfor power button of future IBM cell blades

From: Arnd Bergmann <[email-masked]>
Date: Wed, 9 Jul 2008 15:15:03 +0200

On Wednesday 09 July 2008, Benjamin Herrenschmidt wrote:
> Sorry Christian, i'm still not too happy with this one.
>=20
> There are two issues at hand here:
>=20
> =A0- The use of SELECT, that will be frowned on unfortunately.

Ok, this should be easy to fix, by making it depend on INPUT
instead, like the ACPI power button does. It's modeled after
that anyway.

> =A0- I'm not too sure it's very safe the way you do it. If I understand
> correctly, you can get called for that sysreset at -any- time, including
> when interrupts are off right ?

Yes, that sounds like a problem.

> That means potentially, code that has interrupts off will be interrupted
> by input_report/input_sync, which is really bad (may corrupt the input
> layer internal list management for example).

I can't think of a case where this can realistically hit us (the blades
don't have any other input devices normally), but of course you are
right that it's broken anyway.

> You could solve both things with a little trick: Have the platform code
> just basically set a global flag when the button was pressed and have a
> module that depends on INPUT & INPUT_DEV poll for it (slowly pls) and do
> the input report.

Ugly, but doable, yes. I wonder if there is a way that we can trigger some
interrupt from system_reset_exception context in order to get around the
polling though. tasklets and workqueues unfortunately won't do us any good
here because they also depend on disabling interrupts.

	Arnd <><