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

Re: [PATCH 2/3] acpi/processor: sanitize _PDC buffer bits when running as Xen dom0


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Mon, 21 Nov 2022 16:03:40 +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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=G8kEk6AAysY2z/E7re01QoqsHZRMQRyyh0Cgrhc6VtM=; b=YXwt5N0W8JZ3pFcDBSlL/DqLrT84lJrpO9Hq21xWd2rojQYqYsIfE7Np5S6ZXAHBT2csBDj2mmnKCIqcxT+HuElhFJK6VeZ+Xz+aBZhzFt07XP8PwAkavudD4O6lLcR/5QrjgmPetwHi+m078ShmqHzliDaYVGkcLly2bGAyX3cWKIK1Z4Ze3J21+0AfBnNng5VMCJXgPprbFwoyvVpjzSfTBMbU+hnWr6l2zIn6xOgXc6q9xWcFVvOIIcFfsA3lt9uNUW7H0RMPQZ/5xslk3i7/lb+tSyldXXnz3hoY1mHpSkQNMXaZ51cukEkbIakdjsMxw2a8SHMKyV+XlcFqcQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mltunTYnAUfU4WRY+IRVktXiyg8yYenRpZ3mKWu2qBGADQV4ebaAo1g96O0V5aXb1PJc1fJQzTJP49WR5CR9l8DbMQlxnB26UanmTdObHcTlA1Vaho6B6pNNklQNhezGk2LG1xNaHUNop+jaySdj+XEQvCPyRoyZ+O9z91WZ22u9Ko+In65LM/p+0gXNfDC64wwiFf7gpDlhV6TS0giFVCqeJITMVmgogm33l0txZHBYLarFuCXFxqRCFXRpEmXk2WiGMhQO8soXZEmKwEDRwbmzYp4OublReI15pQzjfEEaLqPjFr2r9RA3ZOKBErG3T+fxQp0mIVgrG6kXwHO9Qw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx, jgross@xxxxxxxx, stable@xxxxxxxxxxxxxxx, Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>, Thomas Gleixner <tglx@xxxxxxxxxxxxx>, Ingo Molnar <mingo@xxxxxxxxxx>, Borislav Petkov <bp@xxxxxxxxx>, Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>, x86@xxxxxxxxxx, "H. Peter Anvin" <hpa@xxxxxxxxx>, "Rafael J. Wysocki" <rafael@xxxxxxxxxx>, Len Brown <lenb@xxxxxxxxxx>, linux-acpi@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx
  • Delivery-date: Mon, 21 Nov 2022 15:04:15 +0000
  • Ironport-data: A9a23:vKkMAKp8vC6UcC6DWx1Tr57i+wheBmI0ZRIvgKrLsJaIsI4StFCzt garIBmEM/feYGf3LtB3a4Sx8UMO6MPXmNIxHlNrqnw8QiIa8ZuZCYyVIHmrMnLJJKUvbq7FA +Y2MYCccZ9uHhcwgj/3b9ANeFEljfngqoLUUbKCYWYpAFc+E0/NsDo788YhmIlknNOlNA2Ev NL2sqX3NUSsnjV5KQr40YrawP9UlKm06W1wUmAWP6gR5gaHzSBNVfrzGInqR5fGatgMdgKFb 76rIIGRpgvx4xorA9W5pbf3GmVirmn6ZFXmZtJ+AsBOszAazsAA+v9T2Mk0MC+7vw6hjdFpo OihgLTrIesf0g8gr8xGO/VQO3kW0aSrY9YrK1Dn2SCY5xWun3cBX5yCpaz5VGEV0r8fPI1Ay RAXAAIrNhKbp+Lp/LyYCfI2us8SfZbQN5xK7xmM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t8GKN2QhtMTIjDMjB/tQIh6QbWNsB08venqwlc3l9 vnpQsmIq1ImjvsV1DwhSGo9xjr0T4o5XOn4ViEgUH7qci8YD4hEcJOia9QbxOcsiMbzZhB+Z MO+1jcm4tcDBvGkii4z9/UVytynk7xhXY5i+Ycg1FWTINbQr5Mqo40+l9TDf47bVTHwbFiNN MrINDX5f5Qf1/fR3fFvlN3yNjpZXg3FgfueDlxhuWllxxt2FxpxUoRw8IS2l0a8ogmdpVC7+ PYdox1ibBnVKYtHO1ALdZEZfHyJn3GQBrKPm7XC0/gDrs7N3XErIOyyKkp5dutZIcDwPIJ6d j8uWtjxC8Pkn/VeI2zNMUhyGGPfIz9Z0Wh9ihm3ek2hlWmL4CbcxFqSzgV4ridSrskc4jmss 2ISeNr6s/YXBTT8LlyrnPDsrlpWAwjuZ4uy6IGcmPLhP73AavXkcGeWMrvBdPWYEYZsyXEcz E+YAQ=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Mon, Nov 21, 2022 at 03:10:36PM +0100, Jan Beulich wrote:
> On 21.11.2022 11:21, Roger Pau Monne wrote:
> > --- a/drivers/acpi/processor_pdc.c
> > +++ b/drivers/acpi/processor_pdc.c
> > @@ -137,6 +137,14 @@ acpi_processor_eval_pdc(acpi_handle handle, struct 
> > acpi_object_list *pdc_in)
> >             buffer[2] &= ~(ACPI_PDC_C_C2C3_FFH | ACPI_PDC_C_C1_FFH);
> >  
> >     }
> > +   if (xen_initial_domain())
> > +           /*
> > +            * When Linux is running as Xen dom0 it's the hypervisor the
> > +            * entity in charge of the processor power management, and so
> > +            * Xen needs to check the OS capabilities reported in the _PDC
> > +            * buffer matches what the hypervisor driver supports.
> > +            */
> > +           xen_sanitize_pdc((uint32_t *)pdc_in->pointer->buffer.pointer);
> >     status = acpi_evaluate_object(handle, "_PDC", pdc_in, NULL);
> 
> Again looking at our old XenoLinux forward port we had this inside the
> earlier if(), as an _alternative_ to the &= (I don't think it's valid
> to apply both the kernel's and Xen's adjustments). That would also let
> you use "buffer" rather than re-calculating it via yet another (risky
> from an abstract pov) cast.

Hm, I've wondered this and decided it wasn't worth to short-circuit
the boot_option_idle_override conditional because ACPI_PDC_C_C2C3_FFH
and ACPI_PDC_C_C1_FFH will be set anyway by Xen in
arch_acpi_set_pdc_bits() as part of ACPI_PDC_C_CAPABILITY_SMP.

I could re-use some of the code in there, but didn't want to make it
more difficult to read just for the benefit of reusing buffer.

> It was the very nature of requiring Xen-specific conditionals which I
> understand was the reason why so far no attempt was made to get this
> (incl the corresponding logic for patch 1) into any upstream kernel.

Yes, well, it's all kind of ugly.  Hence my suggestion to simply avoid
doing any ACPI Processor object handling in Linux with the native code
and handle it all in a Xen specific driver.  That requires the Xen
driver being able to fetch more data itself form the ACPI Processor
methods, but also unties it from the dependency on the data being
filled by the generic code, and the 'tricks' is plays into fooling
generic code to think certain processors are online.

Thanks, Roger.



 


Rackspace

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