From patchwork Thu Nov 7 12:41:59 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasilis Liaskovitis X-Patchwork-Id: 289311 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 0E7C12C00C3 for ; Thu, 7 Nov 2013 23:42:38 +1100 (EST) Received: from localhost ([::1]:39940 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VeOuw-0004uV-Rh for incoming@patchwork.ozlabs.org; Thu, 07 Nov 2013 07:42:34 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43895) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VeOub-0004tJ-Ra for qemu-devel@nongnu.org; Thu, 07 Nov 2013 07:42:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VeOuX-0004Bw-3t for qemu-devel@nongnu.org; Thu, 07 Nov 2013 07:42:13 -0500 Received: from mail-bk0-f46.google.com ([209.85.214.46]:35344) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VeOuW-0004Bh-Tf for qemu-devel@nongnu.org; Thu, 07 Nov 2013 07:42:09 -0500 Received: by mail-bk0-f46.google.com with SMTP id e11so211107bkh.33 for ; Thu, 07 Nov 2013 04:42:07 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=hen9gUkR2BcOg1pfbinSWv8GFCPONyzV+CBBRcFUKis=; b=DvYsmyCkBqRCSWvj6FNDBQaQCzbn84n1tyEwx20RThqVhjXsGjoLbvtsTIzfbpiktg UwRQqSaCvOjgjafNgvFOJgTTmcI91XzdmJIWj1eHvFA4c2C2x4OaPHu1Dz/4UOzwRiC3 pwnpmky49LvT6lUjc893AWBQJWuR/y637u1jOBZdIaz+3oI3+0Y5G7maWU5huUCrkD+m Gt72X17DDJbK+eZ+b7ptIJTOPMEyQItwpSZdvpIw2CblWhiPCZAvC24VNqo5ROB+vgg6 0+a46bSmhGPLvm6xzBAIUv9Zw5z1R3q42myQ6WDhxScgD1jNPegMmORfMRs2yIq0AwK9 Uohw== X-Gm-Message-State: ALoCoQlg0XDrtC6NDuwyRe5ejDkq8wyG9Fjp6y99gN5bE6NfIlD8qfo2Yu9GBho+kA5sIezI0F6z X-Received: by 10.204.247.137 with SMTP id mc9mr229095bkb.74.1383828127098; Thu, 07 Nov 2013 04:42:07 -0800 (PST) Received: from dhcp-192-168-178-175.ri.pb.local. ([62.217.45.26]) by mx.google.com with ESMTPSA id qe6sm2215451bkb.5.2013.11.07.04.42.05 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Nov 2013 04:42:06 -0800 (PST) From: Vasilis Liaskovitis To: qemu-devel@nongnu.org Date: Thu, 7 Nov 2013 13:41:59 +0100 Message-Id: <1383828119-2181-1-git-send-email-vasilis.liaskovitis@profitbricks.com> X-Mailer: git-send-email 1.7.10.4 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.214.46 Cc: mst@redhat.com, thilo.fromm@profitbricks.com, seabios@seabios.org, Vasilis Liaskovitis , kevin@koconnor.net, imammedo@redhat.com Subject: [Qemu-devel] [RFC PATCH] i386: Add _PXM method to ACPI CPU objects X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org This patch adds a _PXM method to ACPI CPU objects for the pc machine. The _PXM value is derived from the passed in guest info, same way as CPU SRAT entries. The motivation for this patch is a CPU hot-unplug/hot-plug bug observed when using a 3.11 linux guest kernel on a multi-NUMA node qemu/kvm VM. The linux guest kernel parses the SRAT CPU entries at boot time and stores them in the array __apicid_to_node. When a CPU is hot-removed, the linux guest kernel resets the removed CPU's __apicid_to_node entry to NO_NUMA_NODE (kernel commit c4c60524). When the removed cpu is hot-added again, the linux kernel looks up the hot-added cpu object's _PXM method instead of somehow re-discovering the SRAT entry info. With current qemu/seabios, the _PXM method is not found, and the CPU is thus hot-plugged in the default NUMA node 0. (The problem does not show up on initial hotplug of a cpu; the PXM method is still not found in this case, but the kernel still has the correct proximity value from the CPU's SRAT entry stored in __apicid_to_node) ACPI spec mentions that the _PXM method is the correct way to determine proximity information at hot-add time. So far, qemu/seabios do not provide this method for CPUs. So regardless of kernel behaviour, it is a good idea to add this _PXM method. Since ACPI table generation has recently been moved from seabios to qemu, we do this in qemu. Note that the above hot-remove/hot-add scenario has been tested on an older qemu + non-upstreamed patches for cpu hot-removal support, and not on qemu master (since cpu-del support is still not on master). The only testing done with qemu/seabios master and this patch, are successful boots of multi-node linux and windows8 guests. For the initial discussion on seabios and linux-acpi lists see http://www.spinics.net/lists/linux-acpi/msg47058.html Signed-off-by: Vasilis Liaskovitis Reviewed-by: Thilo Fromm --- hw/i386/acpi-build.c | 2 ++ hw/i386/ssdt-proc.dsl | 2 ++ 2 files changed, 4 insertions(+) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 6cfa044..9373f5e 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -603,6 +603,7 @@ static inline char acpi_get_hex(uint32_t val) #define ACPI_PROC_OFFSET_CPUHEX (*ssdt_proc_name - *ssdt_proc_start + 2) #define ACPI_PROC_OFFSET_CPUID1 (*ssdt_proc_name - *ssdt_proc_start + 4) #define ACPI_PROC_OFFSET_CPUID2 (*ssdt_proc_id - *ssdt_proc_start) +#define ACPI_PROC_OFFSET_CPUPXM (*ssdt_proc_pxm - *ssdt_proc_start) #define ACPI_PROC_SIZEOF (*ssdt_proc_end - *ssdt_proc_start) #define ACPI_PROC_AML (ssdp_proc_aml + *ssdt_proc_start) @@ -724,6 +725,7 @@ build_ssdt(GArray *table_data, GArray *linker, proc[ACPI_PROC_OFFSET_CPUHEX+1] = acpi_get_hex(i); proc[ACPI_PROC_OFFSET_CPUID1] = i; proc[ACPI_PROC_OFFSET_CPUID2] = i; + proc[ACPI_PROC_OFFSET_CPUPXM] = guest_info->node_cpu[i]; } /* build this code: diff --git a/hw/i386/ssdt-proc.dsl b/hw/i386/ssdt-proc.dsl index 8229bfd..7eef8b2 100644 --- a/hw/i386/ssdt-proc.dsl +++ b/hw/i386/ssdt-proc.dsl @@ -47,6 +47,8 @@ DefinitionBlock ("ssdt-proc.aml", "SSDT", 0x01, "BXPC", "BXSSDT", 0x1) * also updating the C code. */ Name(_HID, "ACPI0007") + ACPI_EXTRACT_NAME_BYTE_CONST ssdt_proc_pxm + Name(_PXM, 0xAA) External(CPMA, MethodObj) External(CPST, MethodObj) External(CPEJ, MethodObj)