From: David Gibson <david@gibson.dropbear.id.au>
To: Sam Bobroff <sam.bobroff@au1.ibm.com>
Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org, agraf@suse.de
Subject: Re: [Qemu-devel] [PATCH 4/4] ppc: spapr: Make VCPU ID handling private to SPAPR
Date: Fri, 4 Aug 2017 13:10:19 +1000 [thread overview]
Message-ID: <20170804031019.GG6553@umbus.fritz.box> (raw)
In-Reply-To: <696b158f34bcf950f95709927f7496b5a4426229.1501740002.git.sam.bobroff@au1.ibm.com>
[-- Attachment #1: Type: text/plain, Size: 1688 bytes --]
On Thu, Aug 03, 2017 at 04:28:52PM +1000, Sam Bobroff wrote:
> The concept of a VCPU ID that differs from the CPU's index
> (cpu->cpu_index) exists only within SPAPR machines so, move the
> functions ppc_get_vcpu_id() and ppc_get_cpu_by_vcpu_id() into spapr.c
> and rename them appropriately.
>
> Signed-off-by: Sam Bobroff <sam.bobroff@au1.ibm.com>
Mostly good, but...
[snip]
> +int spapr_vcpu_id(PowerPCCPU *cpu)
> +{
> + return cpu->vcpu_id;
> +}
> +
> +PowerPCCPU *spapr_find_cpu(int vcpu_id)
> +{
> + CPUState *cs;
> +
> + CPU_FOREACH(cs) {
> + PowerPCCPU *cpu = POWERPC_CPU(cs);
> +
> + if (cpu->vcpu_id == vcpu_id) {
> + return cpu;
> + }
> + }
> +
> + return NULL;
> +}
[...]
> diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c
> index 7ccb350c5f..2bf2727860 100644
> --- a/target/ppc/kvm.c
> +++ b/target/ppc/kvm.c
> @@ -512,7 +512,7 @@ bool kvmppc_is_mem_backend_page_size_ok(const char *obj_path)
>
> unsigned long kvm_arch_vcpu_id(CPUState *cpu)
> {
> - return ppc_get_vcpu_id(POWERPC_CPU(cpu));
> + return spapr_vcpu_id(POWERPC_CPU(cpu));
> }
Here you've replaced an implicit dependency on spapr details in the
generic code with an explicit dependency on spapr details. That's the
wrong direction.
Instead _this_ one should directly reference vcpu_id, the spapr one
should be something like:
if (kvm)
return kvm_arch_vcpu_id(...)
else
return cpu_index;
--
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: 833 bytes --]
next prev parent reply other threads:[~2017-08-04 3:38 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-03 6:28 [Qemu-devel] [PATCH 0/4] Cleanup cpu_dt_id Sam Bobroff
2017-08-03 6:28 ` [Qemu-devel] [PATCH 1/4] spapr: Fix bug in h_signal_sys_reset() Sam Bobroff
2017-08-03 12:37 ` [Qemu-devel] [Qemu-ppc] " Greg Kurz
2017-08-04 2:18 ` David Gibson
2017-08-03 6:28 ` [Qemu-devel] [PATCH 2/4] e500: Use cpu_index instead of vcpu_dt_id Sam Bobroff
2017-08-03 13:15 ` [Qemu-devel] [Qemu-ppc] " Greg Kurz
2017-08-04 2:21 ` David Gibson
2017-08-03 6:28 ` [Qemu-devel] [PATCH 3/4] ppc: spapr: Rename cpu_dt_id to vcpu_id Sam Bobroff
2017-08-03 13:19 ` [Qemu-devel] [Qemu-ppc] " Greg Kurz
2017-08-04 2:25 ` David Gibson
2017-08-03 6:28 ` [Qemu-devel] [PATCH 4/4] ppc: spapr: Make VCPU ID handling private to SPAPR Sam Bobroff
2017-08-03 13:23 ` [Qemu-devel] [Qemu-ppc] " Greg Kurz
2017-08-04 3:10 ` David Gibson [this message]
2017-08-07 6:07 ` [Qemu-devel] " Sam Bobroff
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=20170804031019.GG6553@umbus.fritz.box \
--to=david@gibson.dropbear.id.au \
--cc=agraf@suse.de \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=sam.bobroff@au1.ibm.com \
/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).