All of lore.kernel.org
 help / color / mirror / Atom feed
From: Keir Fraser <keir@xen.org>
To: Rafal Wojtczuk <rafal@invisiblethingslab.com>,
	xen-devel@lists.xensource.com
Subject: Re: INIT ipi under Xen
Date: Fri, 14 Jan 2011 15:53:19 +0000	[thread overview]
Message-ID: <C95621EF.2A2AE%keir@xen.org> (raw)
In-Reply-To: <C9561FD3.2A295%keir@xen.org>

On 14/01/2011 15:44, "Keir Fraser" <keir@xen.org> wrote:

> On 14/01/2011 14:54, "Rafal Wojtczuk" <rafal@invisiblethingslab.com> wrote:
> 
>> Hello,
>>     Does anyone know whether Xen-4.0.1, after it has booted and created dom0,
>> does 
>> anything special to prevent interprocessor interrupt with delivery mode INIT
>> from 
>> affecting processors ? Judging by Intel Software Developer Manual there is no
>> documented way to do this; but maybe something less official ?
> 
> Intel SDM Vol.3B, 19.8 ("Restrictions on VMX Operation"), final bullet
> point: "The INIT signal is blocked whenever a logical processor is in VMX
> root operation."

However, it might be remembered and acted on when the CPU executes VMXOFF. I
tried a variant on your code, and as expected it had no immediate effect,
but my system hung when trying to offline CPUs for ACPI S5 (power off). I
didn't dig to confirm, but one reason could be that the secondary CPU
processes the INIT as soon as it executes VMXOFF and hence stops executing
before it has ack'ed to the rest of Xen that it is going offline. Hence Xen
would hang waiting for an ack that never comes. Just a theory.

 -- Keir

> Also, your code won't work if the APIC happens to be in x2APIC mode. You
> should write to the ICR with apic_icr_write(), which handles both xAPIC and
> x2APIC modes correctly.
> 
>  -- Keir
> 
>>     I use the following piece of code (in hypervisor context) to trigger IPI:
>> unsigned long send_init_ipi()
>> {
>>         unsigned long ret;
>>         int i;
>>         rdmsrl(IA32_APIC_BASE, ret);
>>         xen_printk("IA32_APIC_BASE=0x%x\n", ret);
>>         if (ret & (1 << 8)) {   // I am BSP
>>                 *(unsigned int *) (APIC_BASE + 0x300) = 0xc4500; // load ICR1
>>                 asm("wbinvd"); // just in case APIC_BASE is cached WB
>>         }
>>         return ret;
>> }
>> 
>> This code does not seem to cause any effect (even when
>> IA32_APIC_BASE=0xfee00900 is logged) - namely, I can still observe both CPUs
>> running: subsequent triggering of this code sometimes results in
>> IA32_APIC_BASE=0xfee00900 logged, sometimes 0xfee00800.
>> 
>> If I try sending "ordinary" interrupts (by
>> eg writing 0x4169 do ICR1) I can see the interrupt count in /proc/cpuinfo
>> increase. Moreover, if I run the above code when a HVM is running, then it
>> is killed with note in the Xen log that unexpected exit_reason=3 (meaning,
>> EXIT_REASON_INIT) has beed observed. So, everything indicates that indeed
>> the above code generates INIT, but somehow it is ignored by the destination.
>> Even writing 0x84500 (send INIT to every CPU) causes no effect.
>> 
>> The similar code run on bare metal Linux behaves more sanely.
>> Can anyone offer a clue ? This is on Intel Q45 board, E8400 CPU, 64bit
>> Xen-4.0.1.
>> 
>> RW
>> 
>> PS
>> Similarly, sending SIPI causes nothing; but I would expect that SIPI is
>> reacted upon only in wait-for-SIPI state. However, this is not documented
>> anywhere - can someone confirm this assumption more authoritatively ?
>> 
>> 
>> _______________________________________________
>> Xen-devel mailing list
>> Xen-devel@lists.xensource.com
>> http://lists.xensource.com/xen-devel
> 
> 

      reply	other threads:[~2011-01-14 15:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-14 14:54 INIT ipi under Xen Rafal Wojtczuk
2011-01-14 15:44 ` Keir Fraser
2011-01-14 15:53   ` Keir Fraser [this message]

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=C95621EF.2A2AE%keir@xen.org \
    --to=keir@xen.org \
    --cc=rafal@invisiblethingslab.com \
    --cc=xen-devel@lists.xensource.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.