linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* RE: ACPI fundamental locking problems
@ 2001-07-03 21:28 Grover, Andrew
  2001-07-03 21:37 ` Alan Cox
  2001-07-03 21:53 ` arjan
  0 siblings, 2 replies; 15+ messages in thread
From: Grover, Andrew @ 2001-07-03 21:28 UTC (permalink / raw)
  To: 'Alan Cox', jgarzik; +Cc: linux-kernel, acpi

Some of this discussion's getting a little X-Files-y.

However, there are some points I'd like to touch on...

> From: Alan Cox [mailto:alan@lxorguk.ukuu.org.uk]
> Well lets take a look at the asm shall we
> 1.	It doesnt have a seperate loop when it fails to take the lock
> 	polling it (See intels own docs on spin locks). You do read your
> 	own publications ?

This goes to the special nature of the Global Lock. If we cannot acquire it,
we set a bit, and the system interrupts when it is released. Please see
acpi_ev_acquire_global_lock().

> 2.	It should be using rep nop  (See your own Intel PIV 
> publications)
> 3.	Should be asm __volatile__ or gcc can move it

You are most likely right about all this stuff. Haven't had the need to fix
it because it's been working fine. Patches accepted.

> I am also somewhat puzzled about contexts here. What happens 
> if you take
> an IRQ during the global lock acquire and want to do ACPI. 
> What happens
> if you make a callback from the ACPI code - eg power 
> management that itself
> needs to call AML code ?

All we do at interrupt level is signal the semaphore that threads needing
the GL have blocked on. They continue execution at non-interrupt level.

> I am assuming the ACPI stuff has no IRQ level execution 
> ability, but are you
> sure ACPI never calls a single code path that can require an 
> ACPI operation
> from a callback - eg the PM layer ? Otherwise how can you be 
> sure there won't
> be any priority inversions between the bios/acpi locking set 
> and the kernel 
> locking set

We're aware of this issue and have coded accordingly. We have run into these
issues (specifically with the Embedded Controller driver) and we fix them
when they crop up.

> Microsoft very early on in debugging Win2K problems ask 
> people to use non
> ACPI settings. 

What is your source for this? They certainly could have said that, but
everything I've heard is that MS was so committed to ACPI, they almost left
APM support out of W2K.

> > Jeff Garzik:
> > The difference with ACPI is that vendors can write code 
> that is executed
> > in the kernel's context (instead of what you can consider the BIOS's
> > context).  That is a whole new can of worms.

(I know I'm replying to Jeff's point in your email, sorry)
1) Vendors can write code that is *interpreted* by the OS.
2) If vendors write a malicious BIOS, it's game over even without ACPI
3) ACPI increases visibility of vendor code. You can disassemble AML. You
can step through it with our debugger.

> For security reasons alone we need to ensure ACPI can be 
> firmly in the off
> position. Executing US written binary code in the Linux 
> kernel will not be
> acceptable to european corporations, non US military bodies and most 
> Governments. They'd hate the US to get prior warning of say protestors
> walking into their top secret menwith hill base playing the 
> mission impossible
> theme tune then chaining themselves to things..

You're kidding.........right?

BTW of course ACPI can be turned off via make menuconfig.

> And we have customers who pointedly don't talk to the BIOS 
> and kill SMI/SMM
> early on...

And from what I understand, Itanium doesn't necessarily have a Global Lock
either. Great, no problem. However, we still need to handle machines that
do.

Regards -- Andy

PS Have I read *all* the Intel pubs? Cover to cover? Um, no. ;-)


^ permalink raw reply	[flat|nested] 15+ messages in thread
* RE: ACPI fundamental locking problems
@ 2001-07-03 22:01 Grover, Andrew
  0 siblings, 0 replies; 15+ messages in thread
From: Grover, Andrew @ 2001-07-03 22:01 UTC (permalink / raw)
  To: 'arjan@fenrus.demon.nl'; +Cc: linux-kernel

> From: arjan@fenrus.demon.nl [mailto:arjan@fenrus.demon.nl]
> > BTW of course ACPI can be turned off via make menuconfig.
> 
> Can you point me to the name of the option? I can't find it on my IA64

ACPI is required for IA64 to boot, so you can't disable it AFAIK. Sorry, I
should have included that caveat in my previous message.

-- Andy


^ permalink raw reply	[flat|nested] 15+ messages in thread
* RE: ACPI fundamental locking problems
@ 2001-07-03 18:54 Grover, Andrew
  2001-07-03 19:08 ` Alan Cox
                   ` (3 more replies)
  0 siblings, 4 replies; 15+ messages in thread
From: Grover, Andrew @ 2001-07-03 18:54 UTC (permalink / raw)
  To: 'Jeff Garzik', Linux Kernel Mailing List
  Cc: Linus Torvalds, Acpi-linux (E-mail)

> From: Jeff Garzik [mailto:jgarzik@mandrakesoft.com]
> events/evxface.c:610:acpi_acquire_global_lock ->
> events/evmisc.c:337:acpi_ev_acquire_global_lock ->
> include/platform/acgcc.h:52:ACPI_ACQUIRE_GLOBAL_LOCK
> 
> My immediate objections are,
> (a) acgcc.h is re-implementing spinlocks in a non-standard,
> non-portable, and expensive way, and (b) this entire code path is
> incredibly expensive.

Well, when I look at other Linux code, I assume that if it does something
weird, it does it for a reason.

That is the case here. The Global Lock is for synchronizing accesses between
the OS (that's us) and the firmware (SMI). Normal spinlocks are for intra-OS
locking. Here, we're synchronizing access with the BIOS. It's different.

All this code has been working for as long as I can remember.

You mention twice that it is "expensive". Keeping in mind the 80-20 rule, in
what way do you find this code costly?

> But my fundamental objection is,
> we are depending on vendors to get locking right in their 
> ACPI tables. 
> And assume by some magic or design that said locking works 
> with whatever
> unrelated kernel locking is going on.

By design, it works. We get to slipstream Windows a little here in that
vendors need to have a working Global Lock interface to pass WHQL.

> It is my initial belief that a smaller info query interface that can
> parse useful ACPI would be more effective.  For times like
> suspend/resume where we would want to execute control methods, well,
> there's always the disasm -> write-small-driver cycle.  Who knows if
> this is a realistics proposed solution.  But it really scares me to
> depend on vendors to get locking right.

We're depending on vendors (aka the BIOS) for all the ACPI tables, as well
as every other piece of a priori data we need to boot the OS.

Could I please ask that you at least show me a system where this is a
problem before throwing out all the work we've done on ACPI because of this
technical nit?

Thanks -- Regards -- Andy


^ permalink raw reply	[flat|nested] 15+ messages in thread
* ACPI fundamental locking problems
@ 2001-07-03 17:55 Jeff Garzik
  2001-07-03 19:10 ` Johannes Erdfelt
  0 siblings, 1 reply; 15+ messages in thread
From: Jeff Garzik @ 2001-07-03 17:55 UTC (permalink / raw)
  To: Linux Kernel Mailing List; +Cc: Linus Torvalds, Grover, Andrew

I used to be pretty excited about ACPI, until today.

I was reading through the ACPI spec, to see what was required to obtain
the IRQ routing table from AML.  Continued reading... until I hit a
section talking about the ACPI global lock.

events/evxface.c:610:acpi_acquire_global_lock ->
events/evmisc.c:337:acpi_ev_acquire_global_lock ->
include/platform/acgcc.h:52:ACPI_ACQUIRE_GLOBAL_LOCK

My immediate objections are,
(a) acgcc.h is re-implementing spinlocks in a non-standard,
non-portable, and expensive way, and (b) this entire code path is
incredibly expensive.

But my fundamental objection is,
we are depending on vendors to get locking right in their ACPI tables. 
And assume by some magic or design that said locking works with whatever
unrelated kernel locking is going on.

It is my initial belief that a smaller info query interface that can
parse useful ACPI would be more effective.  For times like
suspend/resume where we would want to execute control methods, well,
there's always the disasm -> write-small-driver cycle.  Who knows if
this is a realistics proposed solution.  But it really scares me to
depend on vendors to get locking right.

We'll see what 2.5 will bring...

</soapbox>

-- 
Jeff Garzik      | "I respect faith, but doubt is
Building 1024    |  what gives you an education."
MandrakeSoft     |           -- Wilson Mizner

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2001-07-12 21:27 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-07-03 21:28 ACPI fundamental locking problems Grover, Andrew
2001-07-03 21:37 ` Alan Cox
2001-07-03 21:53 ` arjan
  -- strict thread matches above, loose matches on Subject: below --
2001-07-03 22:01 Grover, Andrew
2001-07-03 18:54 Grover, Andrew
2001-07-03 19:08 ` Alan Cox
2001-07-03 19:20 ` Jeff Garzik
2001-07-03 19:39   ` Alan Cox
2001-07-09 22:44     ` Pavel Machek
2001-07-12 21:27       ` Alan Cox
2001-07-09 22:44     ` Pavel Machek
2001-07-03 19:37 ` Dave Jones
2001-07-03 19:37 ` Jeff Garzik
2001-07-03 17:55 Jeff Garzik
2001-07-03 19:10 ` Johannes Erdfelt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).