All of lore.kernel.org
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Matt Wilson <msw@amazon.com>
Cc: "Roger Pau Monné" <roger.pau@citrix.com>,
	"Keir Fraser" <keir@xen.org>,
	"Ian Campbell" <Ian.Campbell@citrix.com>,
	chuck.anderson@oracle.com, xen-devel <xen-devel@lists.xen.org>
Subject: Re: HVM CPU enumeration, mapping to VCPU ID (Was: Re: [Xen-users] FreeBSD PVHVM call for testing)
Date: Fri, 9 Aug 2013 09:54:38 -0400	[thread overview]
Message-ID: <20130809135438.GA5044@phenom.dumpdata.com> (raw)
In-Reply-To: <20130604142224.GC7110@phenom.dumpdata.com>

On Tue, Jun 04, 2013 at 10:22:24AM -0400, Konrad Rzeszutek Wilk wrote:
> > > > > The new hypercall to figure this out could be used, but that wouldn't
> > > > > explain why we are failing to start on the correct VCPU?
> > > > 
> > > > I didn't follow the jump here. Can you provide an example?
> > > 
> > > http://lists.xen.org/archives/html/xen-devel/2013-05/msg00941.html
> > 
> > OK, got it.
> > 
> > [   84.619508] smpboot: Booting Node 0 Processor 1 APIC 0x8
> > 
> > So it seems like, in this case:
> > 
> > int __cpuinit native_cpu_up(unsigned int cpu)
> > {
> >         int apicid = apic->cpu_present_to_apicid(cpu);
> > 
> > apic->cpu_present_to_apicid(1) returned 8 instead of 2.
> > 
> > All of that should have been set up correctly ahead of time by
> > generic_processor_info() for all possible CPUs. Do you have the full
> > boot log?
> > 
> 
..snip...
> [    0.000000] ACPI: PM-Timer IO Port: 0xb008
> [    0.000000] ACPI: LAPIC (acpi_id[0x00] lapic_id[0x00] enabled)
> [    0.000000] ACPI: LAPIC (acpi_id[0x01] lapic_id[0x02] disabled)
> [    0.000000] ACPI: LAPIC (acpi_id[0x02] lapic_id[0x04] disabled)
> [    0.000000] ACPI: LAPIC (acpi_id[0x03] lapic_id[0x06] disabled)
> [    0.000000] ACPI: LAPIC (acpi_id[0x04] lapic_id[0x08] disabled)
                                                     ^^^^ - take a note of that
.. snip..
> [   84.585905] CPU 1 got hotplugged
> [   84.590192] installing Xen timer for CPU 1
> [   84.596371] SMP alternatives: lockdep: fixing up alternatives
> [   84.603560] SMP alternatives: switching to SMP code
> [   84.619508] smpboot: Booting Node 0 Processor 1 APIC 0x8
                                                          ^^^ and that

> [   84.639766] ------------[ cut here ]------------
> [   84.639766] WARNING: at /home/konrad/ssd/konrad/linux/arch/x86/xen/time.c:336 xen_vcpuop_set_mode+0xc2/0xd0()
> [   84.639766] Hardware name: HVM domU

I discussed this with Matt over IRC, but the analysis was that the APIC
ID is wrong. Instead of using APIC 0x02 for CPU1, it ended up using APIC 0x08
(which is for CPU4). And that triggered the xen_vcpuop_set_mode to fail
(as the hypervisor would say - you are running on CPU4, not CPU1, return
-ENODEV) and we hit the BUG_ON() in the Linux.

Chuck Anderson (CC-ed here) discovered that he was hitting this as well
and realized that if he was using the QEMU with these three patches:

169b8fa piix4acpi, xen, hotplug: Fix race with ACPI AML code and hotplug.
309149c piix4acpi, xen: Clarify that the qemu_set_irq calls just do an IRQ pulse.
82b10d1 piix4acpi, xen, vcpu hotplug: Split the notification from the changes.

the problem would go away. We did not go any deeper to figure out the culprit.

My money is on the AML code modifying the MADT and while it is executing
another ACPI GSI is triggered (the old code would trigger it for every CPU
being hot-plugged) and as the Linux ACPI AML interpreter reads the MADT and writes
out the newly updated MADT another of the CPUs ends up reading the MADT as well -
but ends up with the data being bogus as the AML interpreter did not finish
and got garbage.

Either way, the resolution is if you see this - the fix is to update the
qemu to have those patches.

Thanks Chuck for digging in this and finding the clues.


P.S.
I don't know how SeaBIOS does the CPU hotplug, but it might be worth looking
at that too at some point.

  parent reply	other threads:[~2013-08-09 13:54 UTC|newest]

Thread overview: 102+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <519131D8.9010307@citrix.com>
2013-05-13 18:52 ` FreeBSD PVHVM call for testing Michael Sierchio
     [not found] ` <CAHu1Y73xuFqAQL99rTJL0_LGFNsdafcDd0sTpyg9DYjAgmf_jQ@mail.gmail.com>
2013-05-13 18:59   ` Colin Percival
     [not found]   ` <51913821.4040104@freebsd.org>
2013-05-13 19:08     ` Michael Sierchio
     [not found]     ` <CAHu1Y727R0KW-MfrfNf1_jjuZhCTq+8=dJidNmRZ29i2iKPQ+w@mail.gmail.com>
2013-05-13 19:13       ` Colin Percival
2013-05-14  9:19 ` George Dunlap
     [not found] ` <CAFLBxZZ1eNf2UoHf1NvWd_cfomSChr0LDYyfFcXpYROg8RNC8Q@mail.gmail.com>
2013-05-14 15:56   ` Dario Faggioli
2013-05-16 18:55 ` Colin Percival
     [not found] ` <51952BAE.6010609@freebsd.org>
2013-05-17  0:43   ` Roger Pau Monné
     [not found]   ` <51957D42.9060801@citrix.com>
2013-05-17  3:07     ` Colin Percival
     [not found]     ` <51959ED9.6040405@freebsd.org>
2013-05-18  9:50       ` Roger Pau Monné
     [not found]       ` <51974EC9.9030204@citrix.com>
2013-05-18 15:44         ` Colin Percival
     [not found]         ` <5197A1EA.2040404@freebsd.org>
2013-05-22 11:45           ` Roger Pau Monné
     [not found]           ` <519CAFC7.1070908@citrix.com>
2013-05-22 20:03             ` Colin Percival
     [not found]             ` <519D24A9.3050407@freebsd.org>
2013-05-23  9:06               ` Roger Pau Monné
     [not found]               ` <519DDC0A.9000201@citrix.com>
2013-05-23 19:09                 ` Colin Percival
     [not found]                 ` <519E6958.6020606@freebsd.org>
2013-05-24 10:11                   ` Roger Pau Monné
     [not found]                   ` <519F3CD0.5090405@citrix.com>
2013-05-28 16:15                     ` Roger Pau Monné
     [not found]                     ` <51A4D804.9050208@citrix.com>
2013-05-28 19:18                       ` Matt Wilson
     [not found]                       ` <20130528191855.GA13736@u109add4315675089e695.ant.amazon.com>
2013-05-28 21:33                         ` Colin Percival
     [not found]                         ` <51A5229F.80205@freebsd.org>
2013-05-29 17:03                           ` Roger Pau Monné
     [not found]                           ` <51A634EC.7050805@citrix.com>
2013-05-29 17:22                             ` Matt Wilson
2013-05-29 17:25                             ` [Xen-users] " Ian Campbell
2013-05-29 18:24                               ` Konrad Rzeszutek Wilk
2013-05-30  9:26                                 ` Ian Campbell
2013-05-29 22:10                               ` Matt Wilson
2013-05-30  9:31                                 ` Ian Campbell
2013-05-30 17:16                                   ` Matt Wilson
2013-05-31  8:21                                     ` HVM CPU enumeration, mapping to VCPU ID (Was: Re: [Xen-users] FreeBSD PVHVM call for testing) Ian Campbell
2013-05-31 18:53                                       ` Matt Wilson
2013-06-03 14:44                                         ` Konrad Rzeszutek Wilk
2013-06-03 15:57                                           ` Matt Wilson
2013-06-03 17:33                                             ` Konrad Rzeszutek Wilk
2013-06-03 18:23                                               ` Matt Wilson
2013-06-04 14:22                                                 ` Konrad Rzeszutek Wilk
2013-06-05 16:15                                                   ` Matt Wilson
2013-06-05 19:10                                                     ` Konrad Rzeszutek Wilk
2013-08-09 13:54                                                   ` Konrad Rzeszutek Wilk [this message]
     [not found]                             ` <20130529172201.GA20973@u109add4315675089e695.ant.amazon.com>
2013-05-29 17:45                               ` FreeBSD PVHVM call for testing Roger Pau Monné
     [not found]                               ` <51A63EB3.5090007@citrix.com>
2013-05-29 20:58                                 ` Colin Percival
     [not found]                                 ` <51A66C13.7060203@freebsd.org>
2013-05-29 22:19                                   ` Matt Wilson
     [not found]                                   ` <20130529221920.GC20973@u109add4315675089e695.ant.amazon.com>
2013-05-30  1:10                                     ` Colin Percival
2013-05-21 17:40 ` Konrad Rzeszutek Wilk
2013-05-22 11:41   ` Roger Pau Monné
     [not found]   ` <519CAECE.9040706@citrix.com>
2013-05-22 12:21     ` Konrad Rzeszutek Wilk
2013-05-22 15:27 ` Yuriy Kohut
2013-05-23 12:57 ` Jeroen van der Ham
2013-05-23 13:20 ` Jeroen van der Ham
     [not found] ` <647F6650-AEED-4784-8A45-98324860EE0A@dckd.nl>
2013-05-23 13:30   ` Roger Pau Monné
     [not found]   ` <519E1A0C.3070609@citrix.com>
2013-05-24 22:27     ` Craig Rodrigues
     [not found]     ` <CAG=rPVeWnTdhXucg-KRjgSRLfTCz5bRNdkTGQX7ug2Bu2qJkiQ@mail.gmail.com>
2013-05-28 15:21       ` Outback Dingo
     [not found]       ` <CAKYr3zyu-zppwsy9RDOGXj+cc1Xt76hzwB0S1LnfZnhCLpxL=g@mail.gmail.com>
2013-05-28 22:05         ` Craig Rodrigues
2013-05-28 22:43           ` Outback Dingo
     [not found]           ` <CAKYr3zwbdtw4s+jUMNQJCc1P3S=T_b1k2M_QK8=FQKieDa7Uhg@mail.gmail.com>
2013-05-28 23:09             ` Craig Rodrigues
     [not found]             ` <CAG=rPVeZKSbWRd0egjZpvJghUsK6rXVr+wwL-u7LAoeKMNpozQ@mail.gmail.com>
2013-05-28 23:20               ` Outback Dingo
     [not found]               ` <CAKYr3zzqgii5G8xw2yQtgxEXaa38Ww4hibxMcCCVCtJZ7PGgew@mail.gmail.com>
2013-05-29 17:07                 ` Justin T. Gibbs
     [not found] ` <616EE8A8-78BA-46E6-90AA-4A22160289DF@dckd.nl>
2013-05-23 13:02   ` Outback Dingo
2013-05-23 13:33   ` Roger Pau Monné
     [not found]   ` <519E1AA6.2060808@citrix.com>
2013-05-23 15:02     ` Outback Dingo
2013-05-23 16:30     ` Outback Dingo
     [not found]     ` <CAKYr3zyB-9FOUwAgbq19rMNoxb5XEzHP5Wa0RiiGYJ_XcG7VbA@mail.gmail.com>
2013-05-23 16:48       ` Sergey Kandaurov
2013-05-23 16:48       ` Roger Pau Monné
     [not found]       ` <519E4850.1090305@citrix.com>
2013-05-23 17:02         ` Outback Dingo
     [not found]         ` <CAKYr3zxJMdhMCu-A0epLekLw+sLAWjSUR7UB7jHo0zfG_QfaRQ@mail.gmail.com>
2013-05-23 17:22           ` Jeroen van der Ham
     [not found]           ` <0BBCBA0B-F4A6-4775-A172-D051D9363665@dckd.nl>
2013-05-23 17:29             ` Outback Dingo
2013-05-23 17:41 ` Roger Pau Monné
2013-05-23 23:24 ` Outback Dingo
     [not found] ` <7C420745-BAC0-4BD0-AB60-E3BC7F8BA2A7@onapp.com>
2013-05-24  8:34   ` Yuriy Kohut
     [not found] ` <519E54DE.5090304@citrix.com>
2013-05-24 14:14   ` Konrad Rzeszutek Wilk
     [not found]   ` <20130524141400.GB3900@phenom.dumpdata.com>
2013-05-24 14:16     ` Outback Dingo
2013-05-24 14:21     ` Roger Pau Monné
2013-05-24 22:21     ` Craig Rodrigues
     [not found]     ` <CAG=rPVfoyHOzN5qZPn9YAfR2QPnLxBMVJBLv2abg7CMtdPWHJA@mail.gmail.com>
2013-05-28 13:42       ` Konrad Rzeszutek Wilk
2013-05-30  8:50   ` Jeroen van der Ham
     [not found]   ` <6B8B9354-AF52-4081-B67B-04565D1BCE99@dckd.nl>
2013-05-30  9:04     ` Roger Pau Monné
     [not found]     ` <51A71616.4060508@citrix.com>
2013-05-30  9:15       ` Jeroen van der Ham
     [not found]       ` <ED94B614-A210-4D0B-A60B-8022C30BB0F1@dckd.nl>
2013-05-30 14:56         ` Outback Dingo
     [not found]         ` <CAKYr3zxo0-BOBQuJk_qY2=kbxnMyMR7gffEzoVL+YuTmj-Trdg@mail.gmail.com>
2013-05-30 15:10           ` Jeroen van der Ham
2013-06-10 14:48   ` Roger Pau Monné
     [not found]   ` <51B5E730.6070007@citrix.com>
2013-06-10 15:09     ` Outback Dingo
     [not found]     ` <CAKYr3zxhqvpaL-G0L9220zbRY7D_ZQ+9DZ4MKKGiKtsWvPw3RA@mail.gmail.com>
2013-06-10 15:16       ` Roger Pau Monné
2013-06-13 17:20     ` Roger Pau Monné
     [not found]     ` <51B9FF53.2020901@citrix.com>
2013-06-19 11:13       ` Jeroen van der Ham
     [not found]       ` <2C70BC9B-5964-498F-AAE2-E5024160E3E5@dckd.nl>
2013-06-19 11:34         ` Roger Pau Monné
     [not found]         ` <51C1972B.50703@citrix.com>
2013-06-19 12:16           ` Jeroen van der Ham
     [not found]           ` <C4BE5FBE-DF19-404F-B478-0F33D716454F@dckd.nl>
2013-06-19 12:20             ` Roger Pau Monné
     [not found]             ` <51C1A223.6030305@citrix.com>
2013-06-19 12:33               ` Jeroen van der Ham
     [not found]               ` <6E99C9B2-E28D-4793-81C2-97440AC5AD0E@dckd.nl>
2013-06-19 12:44                 ` Roger Pau Monné
     [not found]                 ` <51C1A7AA.2010307@citrix.com>
2013-06-19 16:07                   ` Jeroen van der Ham
     [not found]                   ` <B6D2239B-86D0-4B1B-A357-63F6E5A18284@dckd.nl>
2013-06-19 16:15                     ` Justin T. Gibbs
     [not found]                     ` <BB38EA9B-54E4-43CD-AF49-7B480DC50BFF@freebsd.org>
2013-06-19 16:50                       ` Jeroen van der Ham
     [not found]                       ` <546D0358-4F92-4E8C-AED0-94FC5D36086F@dckd.nl>
2013-06-19 16:52                         ` Justin T. Gibbs
     [not found]                         ` <E8150505-ECA0-4CB6-B777-A41334B8B903@FreeBSD.org>
2013-06-19 20:03                           ` Jeroen van der Ham
2013-06-20  9:20       ` Jeroen van der Ham
     [not found]       ` <54560214-F170-426E-BDF9-2295D8B8E982@dckd.nl>
2013-06-20  9:33         ` Roger Pau Monné
     [not found]         ` <51C2CC63.9070505@citrix.com>
2013-06-20  9:37           ` Jeroen van der Ham
2013-07-22  7:18       ` Jeroen van der Ham
     [not found]       ` <4A595D02-7B79-4C6C-9356-55FA9E45EDDC@dckd.nl>
2013-07-22  8:29         ` Roger Pau Monné
     [not found]         ` <51ECED83.9020905@citrix.com>
2013-07-22  8:40           ` Jeroen van der Ham
     [not found]           ` <A1FE7DDA-7C0D-4456-A754-65CBCA81232D@dckd.nl>
2013-07-22 10:40             ` Roger Pau Monné
2013-07-22 16:23             ` Jeroen van der Ham
2013-10-11  9:42 ` Eggert, Lars
     [not found] ` <7BE1E0BE-C4E8-4706-8751-23A30D733A94@netapp.com>
2013-10-11 13:56   ` Roger Pau Monné

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=20130809135438.GA5044@phenom.dumpdata.com \
    --to=konrad.wilk@oracle.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=chuck.anderson@oracle.com \
    --cc=keir@xen.org \
    --cc=msw@amazon.com \
    --cc=roger.pau@citrix.com \
    --cc=xen-devel@lists.xen.org \
    /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.