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

Re: [PATCH v2] xen: fix is_xen_pmu()


  • To: Juergen Gross <jgross@xxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx, x86@xxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx
  • From: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>
  • Date: Sat, 26 Mar 2022 11:09:26 -0400
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Olf3oAAddyZOaTnS0/Bj1ES9HeiSJ+pfiqGcQJt4SeE=; b=Jbs6HSsJXEfXJtK1C3t5UvDAUZFR7V3dSDBh3LGpNRx/NoU5FFEsReCaUkS5/ETs2zMl9fZOVWcWQwGKoDocPuRGW1oD9VL+KI9Vj/Mz48YgYhBzlNli6nu7toZ1V9o5A0k1D90QELNf6sxpxB/DifHRv4sLX8AoHSFwy7hhM3kkPtPEzKC5FZ5XicqqGygBHmgmUrKac+6mA7Yd/2wsrIDdb1DyJ5Mod5adp1kX/Wf1EVDNOTEfiqGSGajN48L1Rfda+mTQmAPInFDe8StYJfbSqOSle2sowFT1PjKBvbItjL8rHGuZOoRb0wPyYA/qvuFK+ODJW+zsehDdX8P0fQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XRFq4+NIxQvNVIb5q8YUZPISyl5Q1V76+aFLZbWIpYWHM0D8LXIg1pxjft2k+Tx59fKRvYNfn5MG+oEaQ697Lqcs+CGX/E2fv9Kn24AVow1rEDnDPxUhqledcpH1c7iNh7ajL7IpIVSE9X1AKdZfuBplptZZT0fA6ehcaHmIWakISpA88b9ffHX/2O79hou/CDUkvOdoCyNmrV5Jpz0FKoLhft+ODqCxunHmRMmrXt2u/P78yIvkphx8LTda+7LYMwMdTfRr5AqEdvWa702mGF69jrmfUxBXCwwWAjr/irLkjG/wFVV0QXVjGP0y98pL3CwxoNrvvdiHjOZQmQ2ptA==
  • Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>, Thomas Gleixner <tglx@xxxxxxxxxxxxx>, Ingo Molnar <mingo@xxxxxxxxxx>, Borislav Petkov <bp@xxxxxxxxx>, Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>, "H. Peter Anvin" <hpa@xxxxxxxxx>, Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Sat, 26 Mar 2022 15:09:55 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>


On 3/25/22 10:20 AM, Juergen Gross wrote:
is_xen_pmu() is taking the cpu number as parameter, but it is not using
it. Instead it just tests whether the Xen PMU initialization on the
current cpu did succeed. As this test is done by checking a percpu
pointer, preemption needs to be disabled in order to avoid switching
the cpu while doing the test. While resuming from suspend() this seems
not to be the case:

[   88.082751] ACPI: PM: Low-level resume complete
[   88.087933] ACPI: EC: EC started
[   88.091464] ACPI: PM: Restoring platform NVS memory
[   88.097166] xen_acpi_processor: Uploading Xen processor PM info
[   88.103850] Enabling non-boot CPUs ...
[   88.108128] installing Xen timer for CPU 1
[   88.112763] BUG: using smp_processor_id() in preemptible [00000000] code: 
systemd-sleep/7138
[   88.122256] caller is is_xen_pmu+0x12/0x30
[   88.126937] CPU: 0 PID: 7138 Comm: systemd-sleep Tainted: G        W         
5.16.13-2.fc32.qubes.x86_64 #1
[   88.137939] Hardware name: Star Labs StarBook/StarBook, BIOS 7.97 03/21/2022
[   88.145930] Call Trace:
[   88.148757]  <TASK>
[   88.151193]  dump_stack_lvl+0x48/0x5e
[   88.155381]  check_preemption_disabled+0xde/0xe0
[   88.160641]  is_xen_pmu+0x12/0x30
[   88.164441]  xen_smp_intr_init_pv+0x75/0x100

Fix that by replacing is_xen_pmu() by a simple boolean variable which
reflects the Xen PMU initialization state on cpu 0.

Modify xen_pmu_init() to return early in case it is being called for a
cpu other than cpu 0 and the boolean variable not being set.

Fixes: bf6dfb154d93 ("xen/PMU: PMU emulation code")
Reported-by: Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>
Signed-off-by: Juergen Gross <jgross@xxxxxxxx>



Applied to for-linus-5.18.




 


Rackspace

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