Re: [PATCH] xen/acpi-processor: C and P-state driver thatuploads said data to hypervisor.

From: Jan Beulich
Date: Tue Mar 13 2012 - 04:21:42 EST


>>> On 13.03.12 at 04:35, Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx> wrote:
> +static unsigned int __init get_max_acpi_id(void)
> +{
> + struct xenpf_pcpuinfo *info;
> + struct xen_platform_op op = {
> + .cmd = XENPF_get_cpuinfo,
> + .interface_version = XENPF_INTERFACE_VERSION,
> + };
> + int ret = 0;
> + unsigned int i, max_apic_id, max_acpi_id = 0;
> +
> + info = &op.u.pcpu_info;
> + info->xen_cpuid = 0;
> +
> + ret = HYPERVISOR_dom0_op(&op);
> + if (ret)
> + return max_acpi_id;
> +
> + /* The max_present is the same irregardless of the xen_cpuid */
> + max_apic_id = op.u.pcpu_info.max_present;

The 'apic' in the name here is confusing, as this isn't an APIC ID, but
(Xen) ID of the last present CPU (i.e. one less than the maximum
count).

> + for (i = 0; i <= max_apic_id; i++) {
> + info->xen_cpuid = i;
> + ret = HYPERVISOR_dom0_op(&op);
> + if (ret)
> + continue;
> + max_acpi_id = max(info->acpi_id, max_acpi_id);
> + }
> + pr_debug(DRV_NAME "Max ACPI ID: %u\n", max_acpi_id);
> + return max_acpi_id;

Iirc hotplug CPUs may not be represented in MADT, and hence I'd
suggest adding some slack here (e.g. doubling the value).

> +}

Now, if the whole thing could become a true extension to processor.ko,
the fishy (and too weak in the 'm' case, as you noted yourself) Kconfig
dependency on the cpufreq drivers could go away, since both
acpi-cpufreq and powernow-k8 depend on ACPI_PROCESSOR. Which
would at once put it on par with the XenoLinux placement (in terms of
the point in time when it gets executed) of the code.

Jan

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/