[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: HVM guest only bring up a single vCPU


  • To: Julien Grall <julien@xxxxxxx>
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Fri, 27 Aug 2021 00:42:00 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=qQRtLIxDo3dBTKtWevj4AOWpU9OBbTyN9NpI/1nvHZU=; b=C2/JrSWDFv3qb8lLTYC8w/jNidzu/wpL6VprkfDBgZB75ewkPiHhmH3Y2rDgHAzXFoyxtmYwWLtyuadd6ylrhZYAknsIRdgV6QONnEmHg6XQ5vIMQ3hKBJMWHeKqRxvJL4sDkYm1OfYkIkZcOy1D3dBXAjkKFJObWjL3mEDc5D3LrSnIJy9PdCo26AoZBtV762dMed1nhE3c+FRAp70zW1TJHcTJNfBSxYpQeH4BBK/LpBqxg0E67/CQa5YW3+tb7fsDwL+kG3o9VLFQoj2dvX6fdHbX9tQc4OnkNkhrnayHyDsbHvUQZo/4UmwFlLc65pCSPSqMiw6vQBB9At2/Cw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cmZDpQmMao+xzqH1G57ETCYP38TZH4ooyFs4oAU0r7h6SgW9vgsyBUb1WKYVtwUl8MGHXd6dxfcDtKIlHXRmT8ERa77PfbKafQhZgfjvs7GJnNOJFA6/pg262eV2rMwL/Uybn3bwwilo8vHpWBXrZifPAKwsI3KMELqvtU6A/nSzhDeby6YL3Wfy+FNwA+mEP2ImU7sKdubEJ+tefTH4RZqa4XNvnICjjKn+yrrQVtH40vHUYJQ3+Q0MRroM6lsRrG3zIt5jzxLv1FGNBwaBOuDyQvJm5uXQ2HSGOkPj2kgxCJMk0w9gXKI6IteEJCYGjGbru+p1HZoOdyRVWo2nPg==
  • Authentication-results: esa2.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>
  • Delivery-date: Thu, 26 Aug 2021 23:42:39 +0000
  • Ironport-hdrordr: A9a23:v4sMeK/mb147Az+ohJ1uk+FPdb1zdoMgy1knxilNoENuHfBwxv rDoB1E73LJYVYqOU3Jmbi7Scy9qADnhOFICO4qTMuftWjdyRaVxeRZg7cKrAeQYxEWmtQtsp uINpIOcuEYbmIK/foSgjPIaurIqePvmMvD5Za8vgVQpENRGsVdBm9Ce3em+yZNNW977PQCZf ihD4Z81kGdkSN9VLXEOpBJZZmOm/T70LbdJTIWDR8u7weDyRuu9b7BChCdmjMTSSlGz7sO+X XM11WR3NTsj9iLjjvnk0PD5ZVfn9XsjvNFGcy3k8AQbhHhkByhaohNU6CL+Bo1vOaswlA3l8 SkmWZuA+1Dr1fqOk2lqxrk3AftlB4o9n/Z0FedxUDupMToLQhKQPZptMZ8SF/0+kAgtNZz3O ZgxGSCradaChvGgWDU+8XIfwsCrDv2nVMS1cooy1BPW4oXb7Fc6aYF+llOLZsGFCXmrKg6De hVCt3G7vo+SyLbU5nghBgr/DWQZAV2Iv/fKXJy/fB9kgIm3UyR9nFohvD2xRw7hdQAo/Au3Z W2Dkxq/Is+BvP+I5gNXdvpevHHflAldyi8eV56EW6XYZ3vBEi93KIfwI9Frt1CK6Z4gafbpv z6ISVlXCgJChrTNfE=
  • Ironport-sdr: cIv441xJEEeTq4AsL3MRboM4sY5i6yNPqEHqLMe3SrYQ68+9UbWmbI5GtUYdQG16HeWjOQZiyN 4jXOpWHooT6Ah2iesgqoLFiZavMS8mVNugTj2P7PnheRpCIlr1eAUoRqzOPSsz3Ccq8/BeTDbg 3z1Sv1pLjeBbHyQCboEk0HaWLOzuIKAplLVGtfzW+B8XX5GdG6PZIspWIjWleIDgPQQWvKwYC8 m3kQeXoXGazlB4gVRwYYlg4XumjodJcQDZNFmmzME/NVfu3T62j4v6WWMse16YAuNOSyp6JjgN j8C8fro3vHlCAT3KbYsBn75L
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 26/08/2021 22:00, Julien Grall wrote:
> Hi Andrew,
>
> While doing more testing today, I noticed that only one vCPU would be
> brought up with HVM guest with Xen 4.16 on my setup (QEMU):
>
> [    1.122180]
> ================================================================================
> [    1.122180] UBSAN: shift-out-of-bounds in
> oss/linux/arch/x86/kernel/apic/apic.c:2362:13
> [    1.122180] shift exponent -1 is negative
> [    1.122180] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.14.0-rc7+ #304
> [    1.122180] Hardware name: Xen HVM domU, BIOS 4.16-unstable 06/07/2021
> [    1.122180] Call Trace:
> [    1.122180]  dump_stack_lvl+0x56/0x6c
> [    1.122180]  ubsan_epilogue+0x5/0x50
> [    1.122180]  __ubsan_handle_shift_out_of_bounds+0xfa/0x140
> [    1.122180]  ? cgroup_kill_write+0x4d/0x150
> [    1.122180]  ? cpu_up+0x6e/0x100
> [    1.122180]  ? _raw_spin_unlock_irqrestore+0x30/0x50
> [    1.122180]  ? rcu_read_lock_held_common+0xe/0x40
> [    1.122180]  ? irq_shutdown_and_deactivate+0x11/0x30
> [    1.122180]  ? lock_release+0xc7/0x2a0
> [    1.122180]  ? apic_id_is_primary_thread+0x56/0x60
> [    1.122180]  apic_id_is_primary_thread+0x56/0x60
> [    1.122180]  cpu_up+0xbd/0x100
> [    1.122180]  bringup_nonboot_cpus+0x4f/0x60
> [    1.122180]  smp_init+0x26/0x74
> [    1.122180]  kernel_init_freeable+0x183/0x32d
> [    1.122180]  ? _raw_spin_unlock_irq+0x24/0x40
> [    1.122180]  ? rest_init+0x330/0x330
> [    1.122180]  kernel_init+0x17/0x140
> [    1.122180]  ? rest_init+0x330/0x330
> [    1.122180]  ret_from_fork+0x22/0x30
> [    1.122244]
> ================================================================================
> [    1.123176] installing Xen timer for CPU 1
> [    1.123369] x86: Booting SMP configuration:
> [    1.123409] .... node  #0, CPUs:      #1
> [    1.154400] Callback from call_rcu_tasks_trace() invoked.
> [    1.154491] smp: Brought up 1 node, 1 CPU
> [    1.154526] smpboot: Max logical packages: 2
> [    1.154570] smpboot: Total of 1 processors activated (5999.99
> BogoMIPS)
>
> I have tried a PV guest (same setup) and the kernel could bring up all
> the vCPUs.
>
> Digging down, Linux will set smp_num_siblings to 0 (via
> detect_ht_early()) and as a result will skip all the CPUs. The value
> is retrieve from a CPUID leaf. So it sounds like we don't set the
> leaft correctly.
>
> FWIW, I have also tried on Xen 4.11 and could spot the same issue.
> Does this ring any bell to you?

The CPUID data we give to guests is generally nonsense when it comes to
topology.  By any chance does the hardware you're booting this on not
have hyperthreading enabled/active to begin with?

Fixing this is on the todo list, but it needs libxl to start using
policy objects (series for the next phase of this still pending on
xen-devel).  Exactly how you represent the topology to the guest
correctly depends on the vendor and rough generation - I believe there
are 5 different algorithms to use, and for AMD in particular, it even
depends on how many IO-APICs are visible in the guest.

~Andrew




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.