linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: ke.yu@intel.com, kevin.tian@intel.com,
	linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org,
	lenb@kernel.org, rjw@sisk.pl
Cc: xen-devel@lists.xensource.com, jeremy@goop.org,
	konrad@kernel.org, stefan.bader@canonical.com,
	Ian.Campbell@citrix.com, mike.mcclurg@citrix.com,
	liang.tang@oracle.com
Subject: Re: [PATCH 5/8] ACPI: add processor driver for Xen virtual CPUs.
Date: Fri, 10 Feb 2012 12:18:38 -0500	[thread overview]
Message-ID: <20120210171838.GB25046@phenom.dumpdata.com> (raw)
In-Reply-To: <1322673664-14642-6-git-send-email-konrad.wilk@oracle.com>

> +	if (pr->id == -1) {
> +		int device_declaration;
> +		int apic_id = -1;
> +
> +		if (!strcmp(acpi_device_hid(device), ACPI_PROCESSOR_OBJECT_HID))
> +			device_declaration = 0;
> +		else
> +			device_declaration = 1;
> +
> +		apic_id = acpi_get_cpuid(pr->handle,
> +			device_declaration, pr->acpi_id);
> +		if (apic_id == -1) {
> +			/* Processor is not present in MADT table */

So I was struggling to find an easy way to make the cases below (where
VCPU != physical CPU) work with using the driver that iterates over the
'processor' and was mystified to why it would not work, even with this
patchset. Found out that the acpi_get_cpuid does this:


201 #ifdef CONFIG_SMP
202         for_each_possible_cpu(i) {
203                 if (cpu_physical_id(i) == apic_id)
204                         return i;
205         }

and since not-online vCPUs (so dom0_max_vcpus) are not in the "possible"
bitmask, we never get to check line 203 and end up returning -1 for
offline/not-present/not-possible vCPUs.

Which means that we end up here:
> +			return 0;
> +		}
> +

instead of going through the pr->id = 0.

By the end of this, the information that the hypervisor gets is
actually limited to the amount of CPUs that we specified in dom0_max_vcpus=

> +		/*
> +		 * It's possible to have pr->id as '-1' even when it's actually
> +		 * present in MADT table, e.g. due to limiting dom0 max vcpus
> +		 * less than physical present number. In such case we still want
> +		 * to parse ACPI processor object information, so mimic the
> +		 * pr->id to CPU-0. This should be safe because we only care
> +		 * about raw ACPI information, which only relies on pr->acpi_id.
> +		 * For other information relying on pr->id and gathered through
> +		 * SMP function call, it's safe to let them run on CPU-0 since
> +		 * underlying Xen will collect them. Only a valid pr->id can
> +		 * make later invocations forward progress.
> +		 */
> +		pr->id = 0;
> +	}

  parent reply	other threads:[~2012-02-10 17:21 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-30 17:20 [RFC PATCH] Exporting ACPI Pxx/Cxx states to other kernel subsystems (v1) Konrad Rzeszutek Wilk
2011-11-30 17:20 ` [PATCH 1/8] ACPI: processor: export necessary interfaces Konrad Rzeszutek Wilk
2011-12-16 21:33   ` Konrad Rzeszutek Wilk
2011-12-19  5:43     ` Tian, Kevin
2011-12-19 14:17       ` [Xen-devel] " Konrad Rzeszutek Wilk
2011-11-30 17:20 ` [PATCH 2/8] ACPI: processor: cache acpi_power_register in cx structure Konrad Rzeszutek Wilk
2011-11-30 17:20 ` [PATCH 3/8] ACPI: processor: add __acpi_processor_[un]register_driver helpers Konrad Rzeszutek Wilk
2011-12-16 22:03   ` Konrad Rzeszutek Wilk
2011-12-19  5:48     ` Tian, Kevin
2011-12-19 14:26       ` [Xen-devel] " Konrad Rzeszutek Wilk
2011-12-20  2:29         ` Tian, Kevin
2011-12-20 15:31           ` Konrad Rzeszutek Wilk
2011-12-21  0:35             ` Tian, Kevin
2011-12-23  3:01               ` Konrad Rzeszutek Wilk
2011-12-26  1:31                 ` Tian, Kevin
2012-01-03 20:59                   ` Konrad Rzeszutek Wilk
2012-01-06  1:07                     ` Tian, Kevin
2012-01-13 22:24                       ` Konrad Rzeszutek Wilk
2012-01-17  3:03                         ` Tian, Kevin
2012-01-17 17:13                           ` Konrad Rzeszutek Wilk
2012-01-17 18:19                             ` Konrad Rzeszutek Wilk
2012-01-23 16:53                               ` Konrad Rzeszutek Wilk
2011-11-30 17:21 ` [PATCH 4/8] ACPI: processor: Don't setup cpu idle driver and handler when we do not want them Konrad Rzeszutek Wilk
2011-12-16 21:36   ` Konrad Rzeszutek Wilk
2011-12-19 10:33     ` liang tang
2011-12-19 14:26       ` [Xen-devel] " Konrad Rzeszutek Wilk
2011-12-20  6:25         ` liang tang
2011-11-30 17:21 ` [PATCH 5/8] ACPI: add processor driver for Xen virtual CPUs Konrad Rzeszutek Wilk
2011-12-01  9:24   ` [Xen-devel] " Jan Beulich
2011-12-12 17:29     ` Konrad Rzeszutek Wilk
2011-12-13  7:45       ` Jan Beulich
2011-12-13  9:26         ` liang tang
2011-12-16 22:21           ` Konrad Rzeszutek Wilk
2012-02-10 17:18   ` Konrad Rzeszutek Wilk [this message]
2011-11-30 17:21 ` [PATCH 6/8] ACPI: processor: override the interface of register acpi processor handler for Xen vcpu Konrad Rzeszutek Wilk
2011-11-30 17:21 ` [PATCH 7/8] ACPI: xen processor: add PM notification interfaces Konrad Rzeszutek Wilk
2011-11-30 17:21 ` [PATCH 8/8] ACPI: xen processor: set ignore_ppc to handle PPC event for Xen vcpu Konrad Rzeszutek Wilk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120210171838.GB25046@phenom.dumpdata.com \
    --to=konrad.wilk@oracle.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=jeremy@goop.org \
    --cc=ke.yu@intel.com \
    --cc=kevin.tian@intel.com \
    --cc=konrad@kernel.org \
    --cc=lenb@kernel.org \
    --cc=liang.tang@oracle.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mike.mcclurg@citrix.com \
    --cc=rjw@sisk.pl \
    --cc=stefan.bader@canonical.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).