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

Re: Questions about Cx and Px state uploading from dom0


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Wed, 6 Apr 2022 12:38:53 +0200
  • 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=+d+bucWvrqZCnG9AHgIGXShQYWJ04fo3sm0QilA9wIc=; b=DGde4BHp8uojqkciw9vSVW5dhwWwIYmgNJaTVn7yqQRk9XYO4Ac9uZpBefDXkRwtYdO7B9gkub7ENk7yFqin0vYzWU0qVSnNgPjyzCLBjlNzg7nxCACo4qeX4bTXObaWLQo5Zs5o+7cbpwMuQWIX7Poffp5cIlZVGOUCXCQZ0LajCihtiHZ7BZejYukllQRTJUQJPToEdfpXyxugigp96oNnbi1t+TPZd1DFf60ReeWriOFmtAYIm2V7mo2wtd7Egz4FF+y0bd4R39G58ztI/8ShaUwftj2C4p2uIsEA7GQn1ak9KRKp9+6vnKOikGQvWqnn20th1S6N1LDVhxO1Dw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oWdG2bG2MnbjDImoACqCzsnsl+O/67lQhfTEKAdWLoBnq7W2wq5k6k1wRIpN0/YuELDiC/yxZfGPJN71t55hyYVrCLnwb9hePaiJK1/cHj42h2M6m7Q53K35K2evrvNlxlQADt/bTnLQ5rMoEFBWl3dRnMMrm27FqoxoeHpyuwiQoYhw1+IJI0CFff+3EYkzzpINavgrdgDywMPyX6tdJJwv4+xsVkUvhts/C59KFIhiT5buOApWiHNNS6LJlO4ATKu4aZlto5fduxRd204IlkflWPr9U80TRMqP6viFORN6SUEnpzIz8EQh/hNCdqqSZ6mYEjj3EVcFpROOA4y04Q==
  • Authentication-results: esa2.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Wed, 06 Apr 2022 10:39:27 +0000
  • Ironport-data: A9a23:CMDIdqCTtukWpxVW/z7jw5YqxClBgxIJ4kV8jS/XYbTApDgl0zIGm 2sXWGrTa66CNmakLdAiPNzj9RkG68WGmN5jQQY4rX1jcSlH+JHPbTi7wuYcHM8wwunrFh8PA xA2M4GYRCwMZiaA4E/raNANlFEkvU2ybuOU5NXsZ2YgHWeIdA970Ug5w7Jh3NYx6TSEK1jlV e3a8pW31GCNg1aYAkpMg05UgEoy1BhakGpwUm0WPZinjneH/5UmJMt3yZWKB2n5WuFp8tuSH I4v+l0bElTxpH/BAvv9+lryn9ZjrrT6ZWBigVIOM0Sub4QrSoXfHc/XOdJFAXq7hQllkPhxz uUOu4CoezxyfbeWmskCFBRaLHpHaPguFL/veRBTsOSWxkzCNXDt3+9vHAc9OohwFuRfWD8Us 6ZCcXZUM07F17neLLGTE4GAguw5K8bmJsUHs2xIxjDFF/c2B5vERs0m4PcGjG5t2J4eTJ4yY eIwMRB+bgvDUicUYHQ2BLMsuc2h3CnWJmgwRFW9+vNsvjm7IBZK+KjgNp/Zd8KHQe1Rn12Ev STW8mLhGBYYOdeDjz2f/RqEmevnjS79HoUIG9WQ9PRnnVmSzWw7EwANWB2wpvzRt6Klc4sBc QpOoHNo9PVsshzwJjXgY/GmiH6Cjl0SR8JiKLZ58luP57WT7gSmXVFRG1atd+canMMxQDUr0 HqAkNXoGSFjvdWpdJ6NyluHhWjsYHZIdAfucQdBFFJYuIe7/OnfmzqVFr5e/LiJYsoZ8N0a6 xSDt2AAiroalqbnPI3rrAmc01pASnUkJzPZBzk7vEr4tmuVh6b/PuREDGQ3C94acu51qXHb4 RA5dzC2trxmMH10vHXlrB8xNL+o/e2ZFzbXnERiGZIsnxz0pSLyJNAMsGEudBgyWirhRdMPS BWN0e+2zMUNVEZGkIctO97hYyjU5faI+SvZugD8MYMVP8kZmP6v9yByf0+At10BY2B3+ZzTz ayzKJ72ZV5DUPwP5GPvG481jO96rghjlDi7bc2qkHyaPU+2OSf9pUEtawDVMIjULcqs/W3oz jqoH5DTkU8CD7SiPHK/HEx6BQliEEXXzKve8qR/XuWCPhBnCCcmDfrQyqkmYItrg+JekeKgw 513chYwJIbX7ZEfFTi3Vw==
  • Ironport-hdrordr: A9a23:HTulkKBoo4SoatnlHehOsceALOsnbusQ8zAXPh9KJiC9I/b1qy nxppkmPH/P6Qr4WBkb6Le90Y27MAnhHPlOkPQs1NaZLXLbUQ6TQr2KgrGSoQEIdxeOk9K1kJ 0QD5SWa+eAfGSS7/yKmTVQeuxIqLLskNHKuQ6d9QYUcegDUdAf0+4TMHf8LqQZfngjOXJvf6 Dsmfav6gDQMUg/X4CePD0oTuLDr9rEmNbPZgMHPQcu7E2rgSmz4LD3PhCE1lNGOgk/i4sKwC zgqUjU96+ju/a0xlv10HLS1Y1fnJ/ExsFYDMKBp8AJInHHixquZq5mR7qe1QpF692H2RIPqp 3hsh0gN8N85zf4eXy0mwLk303a3DMn+xbZuCilqEqmhfa8aCMxCsJHi44cWADe8VAcsNZ117 8O936FtrJMZCmw0xjV1pztbVVHh0C0qX0tnao4lHpES7YTb7dXsMg24F5VKpEdByj3gbpXXN WGNPuspcq+TGnqL0ww5gJUsZ+RtzUIb1q7q3E5y4KoO2M8pgE686MarPZv6kvouqhNDqWs3N 60QZiApIs+PvP+UpgNdtvpYfHHfFAlEii8eV57HzzcZdQ60jT22trK3Ik=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Wed, Apr 06, 2022 at 10:13:41AM +0200, Jan Beulich wrote:
> On 23.03.2022 09:54, Roger Pau Monné wrote:
> > Hello,
> > 
> > I was looking at implementing ACPI Cx and Px state uploading from
> > FreeBSD dom0, as my main test box is considerably slower without Xen
> > knowing about the Px states.  That has raised a couple of questions.
> > 
> > 1. How to figure out what features to report available by OSPM when
> > calling the _PDC (or _OSC) ACPI method.  I'm confused by the usage of
> > this from Linux: it seems to be used to detect mwait support in
> > xen_check_mwait but not when calling _PDC (ie: in
> > acpi_processor_set_pdc).  I'm also not sure what the hypercall expects
> > the caller to provide.  Should buf[2] be set to all the possible
> > features supported by the OS and Xen will trim those as required?
> 
> I'm afraid upstream Linux doesn't quite use this as originally
> intended. Consulting my most recent (but meanwhile quite old) forward
> port tree of XenoLinux that I still have readily available, I find in
> drivers/acpi/processor_pdc.c:
> 
> static acpi_status
> acpi_processor_eval_pdc(acpi_handle handle, struct acpi_object_list *pdc_in)
> {
>       acpi_status status = AE_OK;
> 
> #ifndef CONFIG_XEN
>       if (boot_option_idle_override == IDLE_NOMWAIT) {
>               /*
>                * If mwait is disabled for CPU C-states, the C2C3_FFH access
>                * mode will be disabled in the parameter of _PDC object.
>                * Of course C1_FFH access mode will also be disabled.
>                */
> #else
>       {
>               struct xen_platform_op op;
> #endif
>               union acpi_object *obj;
>               u32 *buffer = NULL;
> 
>               obj = pdc_in->pointer;
>               buffer = (u32 *)(obj->buffer.pointer);
> #ifndef CONFIG_XEN
>               buffer[2] &= ~(ACPI_PDC_C_C2C3_FFH | ACPI_PDC_C_C1_FFH);
> #else
>               op.cmd = XENPF_set_processor_pminfo;
>               op.u.set_pminfo.id = -1;
>               op.u.set_pminfo.type = XEN_PM_PDC;
>               set_xen_guest_handle(op.u.set_pminfo.u.pdc, buffer);
>               VOID(HYPERVISOR_platform_op(&op));
> #endif
>       }
>       status = acpi_evaluate_object(handle, "_PDC", pdc_in, NULL);
> 
>       if (ACPI_FAILURE(status))
>               ACPI_DEBUG_PRINT((ACPI_DB_INFO,
>                   "Could not evaluate _PDC, using legacy perf. control.\n"));
> 
>       return status;
> }
> 
> (This is a 4.4-based tree, for reference.)
> 
> IOW the buffer is passed to Xen for massaging before invoking _PDC.

Indeed.  I'm however confused by what should be pre-filled into the
buffer by the OS.  _PDC is about the processor driver power management
support, and none of this power management is done by the OS (I don't
plan to let FreeBSD do CPU power management when running as hardware
domain), so IMO passing an empty buffer and letting Xen fill it is the
correct thing to do, at least for the use-case in FreeBSD.

> > 2. When uploading Px states, what's the meaning of the shared_type
> > field in xen_processor_performance?  I've looked at the usage of the
> > field by Xen, and first of all it seems to be a layering violation
> > because the values set in the field (CPUFREQ_SHARED_TYPE_*) are not
> > exposed as part of the public interface.  This all works for Linux
> > because the same values are used by Xen and the Linux kernel.
> 
> Well, yes - that's the way code was written back at the time when
> cpufreq support was introduced. It should rather have been
> DOMAIN_COORD_TYPE_* to be used in the interface, which Linux
> translates to CPUFREQ_SHARED_TYPE_*.

I will send a patch to add those to the public headers.

> > Secondly, this is not part of the data fetched from ACPI AFAICT, so
> > I'm unsure how the value should be calculated.  I also wonder whether
> > this couldn't be done by Xen itself from the uploaded Px data (but
> > without knowing exactly how the value should be calculated it's hard
> > to tell).
> 
> As per above - while it's not fetched from ACPI directly, there
> looks to be a direct translation from what ACPI provides (see
> acpi_processor_preregister_performance()).

Yes, the translation from DOMAIN_COORD_TYPE_ to CPUFREQ_SHARED_TYPE_
is not a problem.

My concern is that there's some logic in Linux to assert the
correctness of the provided data in ACPI, checking the match of the
domain and the coordination type between all the processor objects as
part of setting the field.

I see that Xen also does some checks on the uploaded data in
cpufreq_add_cpu, so I wonder if I can get away with just setting the
shared_type field based on the coord_type of the current processor
object, without having to cross check it's coherent with the values on
other processors.

Thanks, Roger.



 


Rackspace

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