cpu: Move numa_node field to CPUState
Signed-off-by: Andreas Färber <afaerber@suse.de>
This commit is contained in:
parent
66afd1ad5a
commit
1b1ed8dc40
4
cpus.c
4
cpus.c
|
@ -1160,12 +1160,14 @@ static void tcg_exec_all(void)
|
||||||
void set_numa_modes(void)
|
void set_numa_modes(void)
|
||||||
{
|
{
|
||||||
CPUArchState *env;
|
CPUArchState *env;
|
||||||
|
CPUState *cpu;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (env = first_cpu; env != NULL; env = env->next_cpu) {
|
for (env = first_cpu; env != NULL; env = env->next_cpu) {
|
||||||
|
cpu = ENV_GET_CPU(env);
|
||||||
for (i = 0; i < nb_numa_nodes; i++) {
|
for (i = 0; i < nb_numa_nodes; i++) {
|
||||||
if (test_bit(env->cpu_index, node_cpumask[i])) {
|
if (test_bit(env->cpu_index, node_cpumask[i])) {
|
||||||
env->numa_node = i;
|
cpu->numa_node = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
4
exec.c
4
exec.c
|
@ -262,9 +262,7 @@ CPUArchState *qemu_get_cpu(int cpu)
|
||||||
|
|
||||||
void cpu_exec_init(CPUArchState *env)
|
void cpu_exec_init(CPUArchState *env)
|
||||||
{
|
{
|
||||||
#ifndef CONFIG_USER_ONLY
|
|
||||||
CPUState *cpu = ENV_GET_CPU(env);
|
CPUState *cpu = ENV_GET_CPU(env);
|
||||||
#endif
|
|
||||||
CPUArchState **penv;
|
CPUArchState **penv;
|
||||||
int cpu_index;
|
int cpu_index;
|
||||||
|
|
||||||
|
@ -279,7 +277,7 @@ void cpu_exec_init(CPUArchState *env)
|
||||||
cpu_index++;
|
cpu_index++;
|
||||||
}
|
}
|
||||||
env->cpu_index = cpu_index;
|
env->cpu_index = cpu_index;
|
||||||
env->numa_node = 0;
|
cpu->numa_node = 0;
|
||||||
QTAILQ_INIT(&env->breakpoints);
|
QTAILQ_INIT(&env->breakpoints);
|
||||||
QTAILQ_INIT(&env->watchpoints);
|
QTAILQ_INIT(&env->watchpoints);
|
||||||
#ifndef CONFIG_USER_ONLY
|
#ifndef CONFIG_USER_ONLY
|
||||||
|
|
|
@ -140,6 +140,7 @@ static int spapr_fixup_cpu_dt(void *fdt, sPAPREnvironment *spapr)
|
||||||
{
|
{
|
||||||
int ret = 0, offset;
|
int ret = 0, offset;
|
||||||
CPUPPCState *env;
|
CPUPPCState *env;
|
||||||
|
CPUState *cpu;
|
||||||
char cpu_model[32];
|
char cpu_model[32];
|
||||||
int smt = kvmppc_smt_threads();
|
int smt = kvmppc_smt_threads();
|
||||||
uint32_t pft_size_prop[] = {0, cpu_to_be32(spapr->htab_shift)};
|
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);
|
assert(spapr->cpu_model);
|
||||||
|
|
||||||
for (env = first_cpu; env != NULL; env = env->next_cpu) {
|
for (env = first_cpu; env != NULL; env = env->next_cpu) {
|
||||||
|
cpu = ENV_GET_CPU(env);
|
||||||
uint32_t associativity[] = {cpu_to_be32(0x5),
|
uint32_t associativity[] = {cpu_to_be32(0x5),
|
||||||
cpu_to_be32(0x0),
|
cpu_to_be32(0x0),
|
||||||
cpu_to_be32(0x0),
|
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)};
|
cpu_to_be32(env->cpu_index)};
|
||||||
|
|
||||||
if ((env->cpu_index % smt) != 0) {
|
if ((env->cpu_index % smt) != 0) {
|
||||||
|
|
|
@ -195,7 +195,6 @@ typedef struct CPUWatchpoint {
|
||||||
CPUArchState *next_cpu; /* next CPU sharing TB cache */ \
|
CPUArchState *next_cpu; /* next CPU sharing TB cache */ \
|
||||||
int cpu_index; /* CPU index (informative) */ \
|
int cpu_index; /* CPU index (informative) */ \
|
||||||
uint32_t host_tid; /* host thread ID */ \
|
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). */ \
|
int running; /* Nonzero if cpu is currently running(usermode). */ \
|
||||||
/* user data */ \
|
/* user data */ \
|
||||||
void *opaque; \
|
void *opaque; \
|
||||||
|
|
|
@ -59,6 +59,7 @@ struct kvm_run;
|
||||||
* CPUState:
|
* CPUState:
|
||||||
* @nr_cores: Number of cores within this CPU package.
|
* @nr_cores: Number of cores within this CPU package.
|
||||||
* @nr_threads: Number of threads within this CPU.
|
* @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.
|
* @created: Indicates whether the CPU thread has been successfully created.
|
||||||
* @stop: Indicates a pending stop request.
|
* @stop: Indicates a pending stop request.
|
||||||
* @stopped: Indicates the CPU has been artificially stopped.
|
* @stopped: Indicates the CPU has been artificially stopped.
|
||||||
|
@ -73,6 +74,7 @@ struct CPUState {
|
||||||
|
|
||||||
int nr_cores;
|
int nr_cores;
|
||||||
int nr_threads;
|
int nr_threads;
|
||||||
|
int numa_node;
|
||||||
|
|
||||||
struct QemuThread *thread;
|
struct QemuThread *thread;
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
|
|
@ -1783,12 +1783,14 @@ static void do_info_numa(Monitor *mon)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
CPUArchState *env;
|
CPUArchState *env;
|
||||||
|
CPUState *cpu;
|
||||||
|
|
||||||
monitor_printf(mon, "%d nodes\n", nb_numa_nodes);
|
monitor_printf(mon, "%d nodes\n", nb_numa_nodes);
|
||||||
for (i = 0; i < nb_numa_nodes; i++) {
|
for (i = 0; i < nb_numa_nodes; i++) {
|
||||||
monitor_printf(mon, "node %d cpus:", i);
|
monitor_printf(mon, "node %d cpus:", i);
|
||||||
for (env = first_cpu; env != NULL; env = env->next_cpu) {
|
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);
|
monitor_printf(mon, " %d", env->cpu_index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue