From: "Jan Beulich" Subject: Re: [PATCH v10 1/6] x86: detect and initialize Cache QoS Monitoring feature Date: Thu, 03 Apr 2014 09:18:35 +0100 Message-ID: <533D357B0200007800005041@nat28.tlf.novell.com> References: <1395815722-143165-1-git-send-email-dongxiao.xu@intel.com> <1395815722-143165-2-git-send-email-dongxiao.xu@intel.com> <533996230200007800003C4D@nat28.tlf.novell.com> <40776A41FC278F40B59438AD47D147A91197E852@SHSMSX104.ccr.corp.intel.com> <5339A8ED0200007800003D2F@nat28.tlf.novell.com> <40776A41FC278F40B59438AD47D147A91197F9C4@SHSMSX104.ccr.corp.intel.com> <533BE831020000780000490D@nat28.tlf.novell.com> <40776A41FC278F40B59438AD47D147A91198001F@SHSMSX104.ccr.corp.intel.com> <533C3F430200007800004C38@nat28.tlf.novell.com> <40776A41FC278F40B59438AD47D147A911980772@SHSMSX104.ccr.corp.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <40776A41FC278F40B59438AD47D147A911980772@SHSMSX104.ccr.corp.intel.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Dongxiao Xu Cc: "keir@xen.org" , "Ian.Campbell@citrix.com" , "andrew.cooper3@citrix.com" , "stefano.stabellini@eu.citrix.com" , "Ian.Jackson@eu.citrix.com" , "xen-devel@lists.xen.org" , "dgdegra@tycho.nsa.gov" List-Id: xen-devel@lists.xenproject.org >>> On 03.04.14 at 05:54, wrote: >> -----Original Message----- >> From: Jan Beulich [mailto:JBeulich@suse.com] >> Sent: Wednesday, April 02, 2014 10:48 PM >> To: Xu, Dongxiao >> Cc: andrew.cooper3@citrix.com; Ian.Campbell@citrix.com; >> Ian.Jackson@eu.citrix.com; stefano.stabellini@eu.citrix.com; >> xen-devel@lists.xen.org; konrad.wilk@oracle.com; dgdegra@tycho.nsa.gov; >> keir@xen.org >> Subject: RE: [PATCH v10 1/6] x86: detect and initialize Cache QoS Monitoring >> feature >> >> >>> On 02.04.14 at 14:40, wrote: >> >> -----Original Message----- >> >> From: Jan Beulich [mailto:JBeulich@suse.com] >> >> Sent: Wednesday, April 02, 2014 4:37 PM >> >> To: Xu, Dongxiao >> >> Cc: andrew.cooper3@citrix.com; Ian.Campbell@citrix.com; >> >> Ian.Jackson@eu.citrix.com; stefano.stabellini@eu.citrix.com; >> >> xen-devel@lists.xen.org; konrad.wilk@oracle.com; dgdegra@tycho.nsa.gov; >> >> keir@xen.org >> >> Subject: RE: [PATCH v10 1/6] x86: detect and initialize Cache QoS > Monitoring >> >> feature >> >> >> >> >>> On 02.04.14 at 04:17, wrote: >> >> >> Iirc disabled CPUs (i.e. hot-pluggable ones) are still listed in MADT, >> >> >> including their LAPIC ID (which the socket number is being calculated >> >> >> from). >> >> > >> >> > I dumped one MADT table from the system, and following is one piece from >> > it: >> >> > If the CPU is there, then APIC ID is shown as a valid value, while CPU is >> >> > not there, then APIC ID is shown as 0xFF. >> >> > I know we can get socket info if CPU is there (by certain calculation), > but >> >> > if CPU is not there, could you help to explain how can we get the socket >> >> > information from it? >> >> >> >> Now a fundamental question is whether this was on a system where >> >> CPUs are actually hotpluggable - it's quite common for APIC IDs to be >> >> set to invalid values when the firmware just allocates a large table >> >> and only fills (and marks enabled) the slots for existing CPUs. >> >> >> >> In any event with sparse APIC ID allocations like this >> >> >> >> ACPI: LAPIC (acpi_id[0x00] lapic_id[0x00] enabled) >> >> ACPI: LAPIC (acpi_id[0x02] lapic_id[0x02] enabled) >> >> ACPI: LAPIC (acpi_id[0x04] lapic_id[0x04] enabled) >> >> ACPI: LAPIC (acpi_id[0x06] lapic_id[0x06] enabled) >> >> ACPI: LAPIC (acpi_id[0x10] lapic_id[0x20] enabled) >> >> ACPI: LAPIC (acpi_id[0x12] lapic_id[0x22] enabled) >> >> ACPI: LAPIC (acpi_id[0x14] lapic_id[0x24] enabled) >> >> ACPI: LAPIC (acpi_id[0x16] lapic_id[0x26] enabled) >> >> >> >> making assumptions about the socket ID range being a subset of >> >> the NR_CPUS one is wrong - you'll either need some data structure >> >> other than a flat array to deal with this, or at least dimension the >> >> thing using MAX_APICS (but you'll then realize that you end up >> >> with an even larger array, i.e. it'll become less acceptable). And >> >> yes, other users making invalid assumptions on the socket ID >> >> ranges should be fixed as well (i.e. likely you would want a cleanup >> >> patch first, and then put the your QoS stuff on top). >> > >> > From your above explanation, it seems that we still cannot get exact socket >> > number from the MADT table, >> >> Why not? The socket IDs are derived from the LAPIC IDs, and as long >> as you have the full set of the latter, you can also determine the full >> set of the former. > > I dumped the MADT table from the machine that supports CPU hotplug. > However if I remove some CPUs from the sockets, those disabled CPU's APIC ID > is shown as 0xFF. > Therefore to me it is difficult to get the full set of the LAPIC IDs, so as > the socket IDs. Okay, that convinces me then that we need to deal with socket IDs being known only at hotplug time. > If use radix tree, it is implemented as a list, where all nodes are > allocated by xmalloc(). It is difficult to share these radix nodes between > Xen and Dom0 tool stack. Besides, current libxl/libxc doesn't have such radix > APIs. But you could get away with a split approach: Provide the socket ID list via ordinary hypercall means (if this isn't already derivable from the topology sysctl anyway), and only share the per-socket data page(s). Jan