All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anthony Liguori <aliguori@us.ibm.com>
To: Glauber Costa <glommer@redhat.com>
Cc: jan.kiszka@siemens.com, qemu-devel@nongnu.org
Subject: [Qemu-devel] Re: [PATCH 5/6] enable cpu hotplug
Date: Fri, 17 Apr 2009 15:18:57 -0500	[thread overview]
Message-ID: <49E8E431.4090909@us.ibm.com> (raw)
In-Reply-To: <1239981649-6366-6-git-send-email-glommer@redhat.com>

Glauber Costa wrote:
> This patch enable cpu hotplug to happen via acpi events.
> Note that all it does is generate acpi messages. It still needs
> guest cooperation, in the very way as real hardware.
>
> It is basically what we have in kvm, but in a qemuish style, with
> a few improvements.
>
> Signed-off-by: Glauber Costa <glommer@redhat.com>
> ---
>  cpu-all.h |    1 +
>  exec.c    |   13 +++++++++++
>  hw/acpi.c |   69 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  monitor.c |   21 ++++++++++++++++++
>  sysemu.h  |    1 +
>  5 files changed, 105 insertions(+), 0 deletions(-)
>
> diff --git a/cpu-all.h b/cpu-all.h
> index aaaa70d..a0c97f7 100644
> --- a/cpu-all.h
> +++ b/cpu-all.h
> @@ -745,6 +745,7 @@ int page_check_range(target_ulong start, target_ulong len, int flags);
>
>  void cpu_exec_init_all(unsigned long tb_size);
>  CPUState *cpu_copy(CPUState *env);
> +CPUState *qemu_get_cpu(int cpu);
>
>  void cpu_dump_state(CPUState *env, FILE *f,
>                      int (*cpu_fprintf)(FILE *f, const char *fmt, ...),
> diff --git a/exec.c b/exec.c
> index 13e43d0..a7ac18f 100644
> --- a/exec.c
> +++ b/exec.c
> @@ -538,6 +538,19 @@ static int cpu_common_load(QEMUFile *f, void *opaque, int version_id)
>  }
>  #endif
>
> +CPUState *qemu_get_cpu(int cpu)
> +{
> +    CPUState *env = first_cpu;
> +
> +    while (env) {
> +        if (env->cpu_index == cpu)
> +            break;
> +        env = env->next_cpu;
> +    }
> +
> +    return env;
> +}
> +
>  void cpu_exec_init(CPUState *env)
>  {
>      CPUState **penv;
> diff --git a/hw/acpi.c b/hw/acpi.c
> index 22fbc4a..10c0e69 100644
> --- a/hw/acpi.c
> +++ b/hw/acpi.c
> @@ -26,6 +26,7 @@
>  #include "kvm.h"
>
>  //#define DEBUG
> +//#define DEBUG_CPU
>   

Consider introducing a cpu_dprintf() or something like that.

> @@ -709,11 +712,44 @@ static void pciej_write(void *opaque, uint32_t addr, uint32_t val)
>  #endif
>  }
>
> +static uint32_t cpuhotplug_read(void *opaque, uint32_t addr)
> +{
> +    if ((addr < PROC_BASE) || (addr > (PROC_BASE + 31))) {
> +        /* should never happen, so return a poison */
> +        return 0xabcdefab;
> +    }
> +    else {
>   

Should be one line.

> +void qemu_system_cpu_hot_add(int cpu, int state)
> +{
> +    CPUState *env;
> +
> +    if ((state) && !qemu_get_cpu(cpu)) {
> +#ifdef DEBUG_CPU
> +        printf("creatng new cpu %d\n", cpu);
> +#endif
> +        env = pc_new_cpu(cpu, first_cpu->cpu_model_str, 1);
> +        enable_processor(&gpe, cpu);
> +    }
> +    else {
>   

Should be one line.

> +
> +    if (!strcmp(status, "online"))
> +       state = 1;
> +    else if (!strcmp(status, "offline"))
> +       state = 0;
>   

Should have {}s.


-- 
Regards,

Anthony Liguori

      parent reply	other threads:[~2009-04-17 20:19 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-17 15:20 [Qemu-devel] [PATCH 0/6] Add support for cpu hotplug Glauber Costa
2009-04-17 15:20 ` [Qemu-devel] [PATCH 1/6] split pc_new_cpu Glauber Costa
2009-04-17 15:20   ` [Qemu-devel] [PATCH 2/6] always have apic Glauber Costa
2009-04-17 15:20     ` [Qemu-devel] [PATCH 3/6] Fix warnings and errors with DEBUG enabled Glauber Costa
2009-04-17 15:20       ` [Qemu-devel] [PATCH 4/6] disallow kqemu if we fail to load it Glauber Costa
2009-04-17 15:20         ` [Qemu-devel] [PATCH 5/6] enable cpu hotplug Glauber Costa
2009-04-17 15:20           ` [Qemu-devel] [PATCH 6/6] add bios support for " Glauber Costa
2009-04-17 20:06             ` [Qemu-devel] " Anthony Liguori
2009-04-17 20:18           ` Anthony Liguori [this message]

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=49E8E431.4090909@us.ibm.com \
    --to=aliguori@us.ibm.com \
    --cc=glommer@redhat.com \
    --cc=jan.kiszka@siemens.com \
    --cc=qemu-devel@nongnu.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.