From patchwork Tue Jan 15 09:27:21 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andreas_F=C3=A4rber?= X-Patchwork-Id: 212055 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 21E192C0086 for ; Tue, 15 Jan 2013 20:28:20 +1100 (EST) Received: from localhost ([::1]:42993 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tv2oc-0002EU-4I for incoming@patchwork.ozlabs.org; Tue, 15 Jan 2013 04:28:18 -0500 Received: from eggs.gnu.org ([208.118.235.92]:57827) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tv2oE-0001ws-OW for qemu-devel@nongnu.org; Tue, 15 Jan 2013 04:27:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Tv2oC-0000aN-S4 for qemu-devel@nongnu.org; Tue, 15 Jan 2013 04:27:54 -0500 Received: from cantor2.suse.de ([195.135.220.15]:41000 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tv2oC-0000aE-Id; Tue, 15 Jan 2013 04:27:52 -0500 Received: from relay1.suse.de (unknown [195.135.220.254]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id 1D743A51FE; Tue, 15 Jan 2013 10:27:50 +0100 (CET) From: =?UTF-8?q?Andreas=20F=C3=A4rber?= To: qemu-devel@nongnu.org Date: Tue, 15 Jan 2013 10:27:21 +0100 Message-Id: <1358242058-1404-4-git-send-email-afaerber@suse.de> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1358242058-1404-1-git-send-email-afaerber@suse.de> References: <1358242058-1404-1-git-send-email-afaerber@suse.de> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x X-Received-From: 195.135.220.15 Cc: Markus Armbruster , Alexander Graf , Luiz Capitulino , "open list:sPAPR" , =?UTF-8?q?Andreas=20F=C3=A4rber?= , David Gibson Subject: [Qemu-devel] [PATCH 03/20] cpu: Move numa_node field to CPUState 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 Signed-off-by: Andreas Färber --- cpus.c | 4 +++- exec.c | 4 +--- hw/spapr.c | 4 +++- include/exec/cpu-defs.h | 1 - include/qom/cpu.h | 2 ++ monitor.c | 4 +++- 6 Dateien geändert, 12 Zeilen hinzugefügt(+), 7 Zeilen entfernt(-) diff --git a/cpus.c b/cpus.c index 6aee15e..d68231a 100644 --- a/cpus.c +++ b/cpus.c @@ -1160,12 +1160,14 @@ static void tcg_exec_all(void) void set_numa_modes(void) { CPUArchState *env; + CPUState *cpu; int i; for (env = first_cpu; env != NULL; env = env->next_cpu) { + cpu = ENV_GET_CPU(env); for (i = 0; i < nb_numa_nodes; i++) { if (test_bit(env->cpu_index, node_cpumask[i])) { - env->numa_node = i; + cpu->numa_node = i; } } } diff --git a/exec.c b/exec.c index 34353f7..de5b27d 100644 --- a/exec.c +++ b/exec.c @@ -262,9 +262,7 @@ CPUArchState *qemu_get_cpu(int cpu) void cpu_exec_init(CPUArchState *env) { -#ifndef CONFIG_USER_ONLY CPUState *cpu = ENV_GET_CPU(env); -#endif CPUArchState **penv; int cpu_index; @@ -279,7 +277,7 @@ void cpu_exec_init(CPUArchState *env) cpu_index++; } env->cpu_index = cpu_index; - env->numa_node = 0; + cpu->numa_node = 0; QTAILQ_INIT(&env->breakpoints); QTAILQ_INIT(&env->watchpoints); #ifndef CONFIG_USER_ONLY diff --git a/hw/spapr.c b/hw/spapr.c index b5e15b8..a61c71e 100644 --- a/hw/spapr.c +++ b/hw/spapr.c @@ -140,6 +140,7 @@ static int spapr_fixup_cpu_dt(void *fdt, sPAPREnvironment *spapr) { int ret = 0, offset; CPUPPCState *env; + CPUState *cpu; char cpu_model[32]; int smt = kvmppc_smt_threads(); uint32_t pft_size_prop[] = {0, cpu_to_be32(spapr->htab_shift)}; @@ -147,11 +148,12 @@ static int spapr_fixup_cpu_dt(void *fdt, sPAPREnvironment *spapr) assert(spapr->cpu_model); for (env = first_cpu; env != NULL; env = env->next_cpu) { + cpu = ENV_GET_CPU(env); uint32_t associativity[] = {cpu_to_be32(0x5), cpu_to_be32(0x0), cpu_to_be32(0x0), cpu_to_be32(0x0), - cpu_to_be32(env->numa_node), + cpu_to_be32(cpu->numa_node), cpu_to_be32(env->cpu_index)}; if ((env->cpu_index % smt) != 0) { diff --git a/include/exec/cpu-defs.h b/include/exec/cpu-defs.h index c02687b..ce178ea 100644 --- a/include/exec/cpu-defs.h +++ b/include/exec/cpu-defs.h @@ -195,7 +195,6 @@ typedef struct CPUWatchpoint { CPUArchState *next_cpu; /* next CPU sharing TB cache */ \ int cpu_index; /* CPU index (informative) */ \ uint32_t host_tid; /* host thread ID */ \ - int numa_node; /* NUMA node this cpu is belonging to */ \ int running; /* Nonzero if cpu is currently running(usermode). */ \ /* user data */ \ void *opaque; \ diff --git a/include/qom/cpu.h b/include/qom/cpu.h index 806b01a..30d1e0c 100644 --- a/include/qom/cpu.h +++ b/include/qom/cpu.h @@ -59,6 +59,7 @@ struct kvm_run; * CPUState: * @nr_cores: Number of cores within this CPU package. * @nr_threads: Number of threads within this CPU. + * @numa_node: NUMA node this CPU is belonging to. * @created: Indicates whether the CPU thread has been successfully created. * @stop: Indicates a pending stop request. * @stopped: Indicates the CPU has been artificially stopped. @@ -73,6 +74,7 @@ struct CPUState { int nr_cores; int nr_threads; + int numa_node; struct QemuThread *thread; #ifdef _WIN32 diff --git a/monitor.c b/monitor.c index b7ac3a3..016910d 100644 --- a/monitor.c +++ b/monitor.c @@ -1783,12 +1783,14 @@ static void do_info_numa(Monitor *mon) { int i; CPUArchState *env; + CPUState *cpu; monitor_printf(mon, "%d nodes\n", nb_numa_nodes); for (i = 0; i < nb_numa_nodes; i++) { monitor_printf(mon, "node %d cpus:", i); for (env = first_cpu; env != NULL; env = env->next_cpu) { - if (env->numa_node == i) { + cpu = ENV_GET_CPU(env); + if (cpu->numa_node == i) { monitor_printf(mon, " %d", env->cpu_index); } }