From: Vivek Goyal <vgoyal@in.ibm.com>
To: "Fernando Luis Vázquez Cao" <fernando@oss.ntt.co.jp>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>,
Keith Owens <kaos@ocs.com.au>,
akpm@linux-foundation.org, kexec@lists.infradead.org,
linux-kernel@vger.kernel.org, ak@suse.de, horms@verge.net.au,
mbligh@google.com
Subject: Re: [RFC PATCH 0/10] apic_wait_icr_idle issues and possible solutions
Date: Thu, 26 Apr 2007 12:18:06 +0530 [thread overview]
Message-ID: <20070426064806.GA2626@in.ibm.com> (raw)
In-Reply-To: <1177498984.16078.37.camel@sebastian.intellilink.co.jp>
On Wed, Apr 25, 2007 at 08:03:04PM +0900, Fernando Luis Vázquez Cao wrote:
>
> static __inline__ void apic_wait_icr_idle(void)
> {
> while (apic_read(APIC_ICR) & APIC_ICR_BUSY)
> cpu_relax();
> }
>
> The busy loop in this function would not be problematic if the
> corresponding status bit in the ICR were always updated, but that does
> not seem to be the case under certain crash scenarios. As an example,
> when the other CPUs are locked-up inside the NMI handler the CPU that
> sends the IPI will end up looping forever in the ICR check, effectively
> hard-locking the whole system.
>
> Quoting from Intel's "MultiProcessor Specification" (Version 1.4), B-3:
>
> "A local APIC unit indicates successful dispatch of an IPI by
> resetting the Delivery Status bit in the Interrupt Command
> Register (ICR). The operating system polls the delivery status
> bit after sending an INIT or STARTUP IPI until the command has
> been dispatched.
>
> A period of 20 microseconds should be sufficient for IPI dispatch
> to complete under normal operating conditions. If the IPI is not
> successfully dispatched, the operating system can abort the
> command. Alternatively, the operating system can retry the IPI by
> writing the lower 32-bit double word of the ICR. This “time-out”
> mechanism can be implemented through an external interrupt, if
> interrupts are enabled on the processor, or through execution of
> an instruction or time-stamp counter spin loop."
>
> Intel's documentation suggests the implementation of a time-out
> mechanism, which, by the way, is already being open-coded in some parts
> of the kernel that tinker with ICR.
>
> --- Possible solutions
>
> * Solution A: Implement the time-out mechanism in apic_wait_icr_idle.
>
> The problem with this approach is that introduces a performance penalty
> that may not be acceptable for some callers of apic_wait_icr_idle.
> Besides, during normal operation delivery errors should not occur. This
> brings us to solution B.
>
Hi Fernando,
How much is the performance penalty? Is it really significant. My point
is that, to me changing apic_wait_icr_dle() itself seems to be the simple
approach instead of introducing another function.
Original implementation is:
static __inline__ void apic_wait_icr_idle(void)
{
while (apic_read(APIC_ICR) & APIC_ICR_BUSY)
cpu_relax();
}
And new one will look something like.
do {
send_status = apic_read(APIC_ICR) & APIC_ICR_BUSY;
if (!send_status)
break;
udelay(100);
} while (timeout++ < 1000);
There will be at max 100 microsecond delay before you realize that IPI has
been dispatched. To optimize it further we can change it to 10 microsecond
delay
do {
send_status = apic_read(APIC_ICR) & APIC_ICR_BUSY;
if (!send_status)
break;
udelay(10);
} while (timeout++ < 10000);
or may be
do {
send_status = apic_read(APIC_ICR) & APIC_ICR_BUSY;
if (!send_status)
break;
udelay(1);
} while (timeout++ < 100000);
I don't know if 1 micro second delay is supported. I do see it being
used in kernel/hpet.c
Is it too much of performance overhead? Somebody who knows more about it
needs to tell. To me changing apic_wait_icr_idle() seems simple instead
of introducing a new function and then making a special case for NMI.
Thanks
Vivek
next prev parent reply other threads:[~2007-04-26 6:50 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-25 11:03 [RFC PATCH 0/10] apic_wait_icr_idle issues and possible solutions Fernando Luis Vázquez Cao
2007-04-25 11:13 ` [PATCH 1/10] safe_apic_wait_icr_idle - i386 Fernando Luis Vázquez Cao
2007-04-25 12:55 ` Keith Owens
2007-04-25 12:59 ` Fernando Luis Vázquez Cao
2007-04-25 13:16 ` Andi Kleen
2007-04-25 11:15 ` [PATCH 2/10] safe_apic_wait_icr_idle - x86_64 Fernando Luis Vázquez Cao
2007-04-25 12:26 ` Andi Kleen
2007-04-25 12:55 ` Fernando Luis Vázquez Cao
2007-04-25 13:11 ` Andi Kleen
2007-04-25 13:32 ` Fernando Luis Vázquez Cao
2007-04-25 11:19 ` [PATCH 3/10] smpboot: use safe_apic_wait_icr_idle - i386 Fernando Luis Vázquez Cao
2007-04-25 11:21 ` [PATCH 4/10] smpboot: use safe_apic_wait_icr_idle - x86_64 Fernando Luis Vázquez Cao
2007-04-25 11:26 ` [PATCH 5/10] __inquire_remote_apic: use safe_apic_wait_icr_idle - i386 Fernando Luis Vázquez Cao
2007-04-25 11:27 ` [PATCH 6/10] inquire_remote_apic: use safe_apic_wait_icr_idle - x86_64 Fernando Luis Vázquez Cao
2007-04-25 11:37 ` [PATCH 7/10] __send_IPI_dest_field - i386 Fernando Luis Vázquez Cao
2007-04-25 11:39 ` [PATCH 8/10] __send_IPI_dest_field - x86_64 Fernando Luis Vázquez Cao
2007-04-25 11:49 ` [PATCH 9/10] Use safe_apic_wait_icr_idle in safe_apic_wait_icr_idle - i386 Fernando Luis Vázquez Cao
2007-04-25 11:51 ` [PATCH 10/10] Use safe_apic_wait_icr_idle in __send_IPI_dest_field - x86_64 Fernando Luis Vázquez Cao
2007-04-25 12:33 ` Andi Kleen
2007-04-25 12:52 ` Fernando Luis Vázquez Cao
2007-04-26 6:48 ` Vivek Goyal [this message]
2007-04-26 7:20 ` [RFC PATCH 0/10] apic_wait_icr_idle issues and possible solutions Fernando Luis Vázquez Cao
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070426064806.GA2626@in.ibm.com \
--to=vgoyal@in.ibm.com \
--cc=ak@suse.de \
--cc=akpm@linux-foundation.org \
--cc=ebiederm@xmission.com \
--cc=fernando@oss.ntt.co.jp \
--cc=horms@verge.net.au \
--cc=kaos@ocs.com.au \
--cc=kexec@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mbligh@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox