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

Re: Questions about Cx and Px state uploading from dom0


  • To: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Wed, 6 Apr 2022 10:13:41 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.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=kHFRo10nxxd34oAFCmJsIBFTSpieO2iP9Czga7oiTmo=; b=StI6Q9ZxxgzvR4N/6seGAO2RdBgz1Ap8gAxsvbMlT2hGfhu5OUZUGP4ytTKju185K4Zc4CUBgRu9JWuc6vidh1ryLtIIWowkcWwtMtQTVzQofBT357NAP1PIWMntxM7gd4fJ1hOR1YdDnxE76WxjwRG5hOtsOVLa5rTpR5t6U5kMjgTk11DiifYdu5bnR7ckIWr1pXO20F92XgcNyFeaEZyCJ8BKQOtBVKWGGiIjCuMXRFXDDtDd0vEfrYmkkB3cfnQ3gL3JXMkdzVFDCS5SGwcJKm1thIbvc/xRWz17dse+9lTWpmjbpx9QxmnvF4Vix4JbiMO4LyCu/5fozKAqrw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZpIUyCqQvl3pM+4XfgPRrtnLGP5gl7NxoDVqEc8qWM2FKEPzH8YxdhIt2m+4hVBSZqiU80N1Atfi9WMiqN6LLEVSoJm7OJxII/q8QzJOq0YKjlZR5cuxv/06alSOCYpncX3bc2Ums1wEOIYm29ndCI6GCwePQXMJAnBDxURjIkvgMUlX1ZZyjj6XGBf+1G/LRy3gbYT1lRXjD4/Db9XZimJtuarWWIYnfjni/Mt55OVfCAmmZY/GbMu6hlGCRkgR8hXSsD6pKFYlK/Qs2jrZ41l4OtZlKNaCACtuXY/IRdmpQuyJO+xGO1xsKHcaHY2EpeJLfrzgpOmmS6tDZOWZtQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Wed, 06 Apr 2022 08:13:59 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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.

> 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_*.

> 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()).

Jan




 


Rackspace

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