From: David Gibson <david@gibson.dropbear.id.au>
To: Igor Mammedov <imammedo@redhat.com>
Cc: qemu-devel@nongnu.org, ehabkost@redhat.com,
bharata@linux.vnet.ibm.com, Paolo Bonzini <pbonzini@redhat.com>,
Peter Crosthwaite <crosthwaite.peter@gmail.com>,
Richard Henderson <rth@twiddle.net>
Subject: Re: [Qemu-devel] [PATCH v2 7/6] exec: ensure the only one cpu_index allocation method is used
Date: Thu, 28 Jul 2016 15:49:53 +1000 [thread overview]
Message-ID: <20160728054953.GD2588@voom.fritz.box> (raw)
In-Reply-To: <1469611494-163855-1-git-send-email-imammedo@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 1993 bytes --]
On Wed, Jul 27, 2016 at 11:24:54AM +0200, Igor Mammedov wrote:
> Make sure that cpu_index auto allocation isn't used in
> combination with manual cpu_index assignment. And
> dissallow out of order cpu removal if auto allocation
> is in use.
>
> Target that wishes to support out of order unplug should
> switch to manual cpu_index assignment. Following patch
> could be used as an example:
> (pc: init CPUState->cpu_index with index in possible_cpus[]))
>
> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
> ---
> exec.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/exec.c b/exec.c
> index 8e8416b..e0d8f18 100644
> --- a/exec.c
> +++ b/exec.c
> @@ -598,11 +598,14 @@ AddressSpace *cpu_get_address_space(CPUState *cpu, int asidx)
> }
> #endif
>
> +static bool cpu_index_auto_assigned;
> +
> static int cpu_get_free_index(void)
> {
> CPUState *some_cpu;
> int cpu_index = 0;
>
> + cpu_index_auto_assigned = true;
> CPU_FOREACH(some_cpu) {
> cpu_index++;
> }
> @@ -620,6 +623,8 @@ void cpu_exec_exit(CPUState *cpu)
> return;
> }
>
> + assert(!(cpu_index_auto_assigned && cpu != QTAILQ_LAST(&cpus, CPUTailQ)));
> +
> QTAILQ_REMOVE(&cpus, cpu, node);
> cpu->cpu_index = UNASSIGNED_CPU_INDEX;
> cpu_list_unlock();
> @@ -662,6 +667,8 @@ void cpu_exec_init(CPUState *cpu, Error **errp)
> if (cpu->cpu_index == UNASSIGNED_CPU_INDEX) {
> cpu->cpu_index = cpu_get_free_index();
> assert(cpu->cpu_index != UNASSIGNED_CPU_INDEX);
> + } else {
> + assert(!cpu_index_auto_assigned);
> }
> QTAILQ_INSERT_TAIL(&cpus, cpu, node);
> cpu_list_unlock();
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2016-07-28 6:31 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-25 9:59 [Qemu-devel] [PATCH v2 0/6] Fix migration issues with arbitrary cpu-hot(un)plug Igor Mammedov
2016-07-25 9:59 ` [Qemu-devel] [PATCH v2 1/6] exec: reduce CONFIG_USER_ONLY ifdeffenery Igor Mammedov
2016-07-25 9:59 ` [Qemu-devel] [PATCH v2 2/6] exec: don't use cpu_index to detect if cpu_exec_init()'s been called for cpu Igor Mammedov
2016-07-25 10:18 ` David Gibson
2016-07-25 9:59 ` [Qemu-devel] [PATCH v2 3/6] exec: set cpu_index only if it's not been explictly set Igor Mammedov
2016-07-26 18:28 ` Eduardo Habkost
2016-07-27 8:45 ` Igor Mammedov
2016-07-25 9:59 ` [Qemu-devel] [PATCH v2 4/6] qdev: fix object reference leak in case device.realize() fails Igor Mammedov
2016-07-25 9:59 ` [Qemu-devel] [PATCH v2 5/6] pc: init CPUState->cpu_index with index in possible_cpus[] Igor Mammedov
2016-07-25 9:59 ` [Qemu-devel] [PATCH v2 6/6] Revert "pc: Enforce adding CPUs contiguously and removing them in opposite order" Igor Mammedov
2016-07-25 10:22 ` [Qemu-devel] [PATCH v2 0/6] Fix migration issues with arbitrary cpu-hot(un)plug David Gibson
2016-07-26 3:16 ` David Gibson
2016-07-26 15:26 ` Eduardo Habkost
2016-07-26 15:22 ` Michael S. Tsirkin
2016-07-26 18:35 ` Eduardo Habkost
2016-07-27 9:24 ` [Qemu-devel] [PATCH v2 7/6] exec: ensure the only one cpu_index allocation method is used Igor Mammedov
2016-07-28 5:49 ` David Gibson [this message]
2016-08-02 11:40 ` Eduardo Habkost
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=20160728054953.GD2588@voom.fritz.box \
--to=david@gibson.dropbear.id.au \
--cc=bharata@linux.vnet.ibm.com \
--cc=crosthwaite.peter@gmail.com \
--cc=ehabkost@redhat.com \
--cc=imammedo@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).