From owner-freebsd-current@FreeBSD.ORG Thu Jun 17 20:14:13 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id AD77F16A4CE for ; Thu, 17 Jun 2004 20:14:13 +0000 (GMT) Received: from apollo.backplane.com (apollo.backplane.com [216.240.41.2]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7FB3C43D4C for ; Thu, 17 Jun 2004 20:14:13 +0000 (GMT) (envelope-from dillon@apollo.backplane.com) Received: from apollo.backplane.com (localhost [127.0.0.1]) i5HKD1x7009399; Thu, 17 Jun 2004 13:13:01 -0700 (PDT) (envelope-from dillon@apollo.backplane.com) Received: (from dillon@localhost) by apollo.backplane.com (8.12.9p2/8.12.9/Submit) id i5HKD1fE009398; Thu, 17 Jun 2004 13:13:01 -0700 (PDT) (envelope-from dillon) Date: Thu, 17 Jun 2004 13:13:01 -0700 (PDT) From: Matthew Dillon Message-Id: <200406172013.i5HKD1fE009398@apollo.backplane.com> To: Julian Elischer References: cc: "'current@freebsd.org'" Subject: Re: STI, HLT in acpi_cpu_idle_c1 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Jun 2004 20:14:13 -0000 :> In acpi_cpu_idle_c1, it does: :> :> sti :> hlt :> :> shouldn't there be a NOP in there so that interrupts :> are guaranteed on? : :I think your reading of it is right.. :but I also think that if it was ALWAYS right we'd see processors :go idle and never wake up again.... :Since this doesn't seem to happen, maybe ther eis a bug in the emulator? : :We can always add a nop I guess and see what happens.. No no no no! The whole point is for interrupts to be disabled when the HLT instruction *begins* execution (they're only disabled for one cycle). If you do: sti; nop; hlt then an interrupt may occur before the HLT instruction is executed. The HLT instruction is then executed even though the interrupt might have scheduled something. In otherwords, you will wind up in a halted state with schedulable threads pending. When you 'STI; HLT' the halt is entered atomicaly while interrupts are still disabled, so no interrupt can squeeze. Then interrupts will be enabled and HLT will resume when the next interrupt occurs. CLI; YES-> RETURN NO (STI;HLT). -Matt