* [Qemu-devel] [PATCH] provide cpu_index to env mapping
@ 2009-06-09 16:15 Glauber Costa
2009-06-09 16:25 ` Avi Kivity
0 siblings, 1 reply; 7+ messages in thread
From: Glauber Costa @ 2009-06-09 16:15 UTC (permalink / raw)
To: qemu-devel; +Cc: aliguori
There are some people interested in, given a cpu number,
pick its CPUState. KVM is an example, although not yet in tree.
This patch provides a way of doing that.
Signed-off-by: Glauber Costa <glommer@redhat.com>
---
cpu-all.h | 1 +
exec.c | 13 +++++++++++++
2 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/cpu-all.h b/cpu-all.h
index dc9b034..8990be3 100644
--- a/cpu-all.h
+++ b/cpu-all.h
@@ -741,6 +741,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 52f4e89..6c26cb6 100644
--- a/exec.c
+++ b/exec.c
@@ -541,6 +541,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;
--
1.5.6.6
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH] provide cpu_index to env mapping
2009-06-09 16:15 [Qemu-devel] [PATCH] provide cpu_index to env mapping Glauber Costa
@ 2009-06-09 16:25 ` Avi Kivity
2009-06-09 16:40 ` Glauber Costa
2009-06-09 16:45 ` Gleb Natapov
0 siblings, 2 replies; 7+ messages in thread
From: Avi Kivity @ 2009-06-09 16:25 UTC (permalink / raw)
To: Glauber Costa; +Cc: aliguori, qemu-devel
Glauber Costa wrote:
> There are some people interested in, given a cpu number,
> pick its CPUState. KVM is an example, although not yet in tree.
> This patch provides a way of doing that.
>
>
I think it's better to migrate kvm towards using env as the handle
instead of the cpu index.
kvm will soon address lose its cpu numbering in favor of apic ids; and
apic ids will not start from zero on large guests.
--
error compiling committee.c: too many arguments to function
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH] provide cpu_index to env mapping
2009-06-09 16:25 ` Avi Kivity
@ 2009-06-09 16:40 ` Glauber Costa
2009-06-09 16:42 ` Avi Kivity
2009-06-09 16:46 ` Gleb Natapov
2009-06-09 16:45 ` Gleb Natapov
1 sibling, 2 replies; 7+ messages in thread
From: Glauber Costa @ 2009-06-09 16:40 UTC (permalink / raw)
To: Avi Kivity; +Cc: aliguori, qemu-devel
On Tue, Jun 09, 2009 at 07:25:02PM +0300, Avi Kivity wrote:
> Glauber Costa wrote:
>> There are some people interested in, given a cpu number,
>> pick its CPUState. KVM is an example, although not yet in tree.
>> This patch provides a way of doing that.
>>
>>
>
> I think it's better to migrate kvm towards using env as the handle
> instead of the cpu index.
btw: the particular user of this is cpu hotplug.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH] provide cpu_index to env mapping
2009-06-09 16:40 ` Glauber Costa
@ 2009-06-09 16:42 ` Avi Kivity
2009-06-09 16:52 ` Glauber Costa
2009-06-09 16:46 ` Gleb Natapov
1 sibling, 1 reply; 7+ messages in thread
From: Avi Kivity @ 2009-06-09 16:42 UTC (permalink / raw)
To: Glauber Costa; +Cc: aliguori, qemu-devel
Glauber Costa wrote:
> On Tue, Jun 09, 2009 at 07:25:02PM +0300, Avi Kivity wrote:
>
>> Glauber Costa wrote:
>>
>>> There are some people interested in, given a cpu number,
>>> pick its CPUState. KVM is an example, although not yet in tree.
>>> This patch provides a way of doing that.
>>>
>>>
>>>
>> I think it's better to migrate kvm towards using env as the handle
>> instead of the cpu index.
>>
> btw: the particular user of this is cpu hotplug.
>
Well, cpu hotplug should definitely use the apic id.
--
error compiling committee.c: too many arguments to function
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH] provide cpu_index to env mapping
2009-06-09 16:25 ` Avi Kivity
2009-06-09 16:40 ` Glauber Costa
@ 2009-06-09 16:45 ` Gleb Natapov
1 sibling, 0 replies; 7+ messages in thread
From: Gleb Natapov @ 2009-06-09 16:45 UTC (permalink / raw)
To: Avi Kivity; +Cc: Glauber Costa, aliguori, qemu-devel
On Tue, Jun 09, 2009 at 07:25:02PM +0300, Avi Kivity wrote:
> Glauber Costa wrote:
>> There are some people interested in, given a cpu number,
>> pick its CPUState. KVM is an example, although not yet in tree.
>> This patch provides a way of doing that.
>>
>>
>
> I think it's better to migrate kvm towards using env as the handle
> instead of the cpu index.
>
> kvm will soon address lose its cpu numbering in favor of apic ids; and
> apic ids will not start from zero on large guests.
>
The work is almost done.
--
Gleb.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH] provide cpu_index to env mapping
2009-06-09 16:40 ` Glauber Costa
2009-06-09 16:42 ` Avi Kivity
@ 2009-06-09 16:46 ` Gleb Natapov
1 sibling, 0 replies; 7+ messages in thread
From: Gleb Natapov @ 2009-06-09 16:46 UTC (permalink / raw)
To: Glauber Costa; +Cc: aliguori, Avi Kivity, qemu-devel
On Tue, Jun 09, 2009 at 01:40:09PM -0300, Glauber Costa wrote:
> On Tue, Jun 09, 2009 at 07:25:02PM +0300, Avi Kivity wrote:
> > Glauber Costa wrote:
> >> There are some people interested in, given a cpu number,
> >> pick its CPUState. KVM is an example, although not yet in tree.
> >> This patch provides a way of doing that.
> >>
> >>
> >
> > I think it's better to migrate kvm towards using env as the handle
> > instead of the cpu index.
> btw: the particular user of this is cpu hotplug.
>
cpu hotplug can use apic ids too.
--
Gleb.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH] provide cpu_index to env mapping
2009-06-09 16:42 ` Avi Kivity
@ 2009-06-09 16:52 ` Glauber Costa
0 siblings, 0 replies; 7+ messages in thread
From: Glauber Costa @ 2009-06-09 16:52 UTC (permalink / raw)
To: Avi Kivity; +Cc: aliguori, qemu-devel
On Tue, Jun 09, 2009 at 07:42:42PM +0300, Avi Kivity wrote:
> Glauber Costa wrote:
>> On Tue, Jun 09, 2009 at 07:25:02PM +0300, Avi Kivity wrote:
>>
>>> Glauber Costa wrote:
>>>
>>>> There are some people interested in, given a cpu number,
>>>> pick its CPUState. KVM is an example, although not yet in tree.
>>>> This patch provides a way of doing that.
>>>>
>>>>
>>> I think it's better to migrate kvm towards using env as the handle
>>> instead of the cpu index.
>>>
>> btw: the particular user of this is cpu hotplug.
>>
>
> Well, cpu hotplug should definitely use the apic id.
yes.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2009-06-09 16:46 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-09 16:15 [Qemu-devel] [PATCH] provide cpu_index to env mapping Glauber Costa
2009-06-09 16:25 ` Avi Kivity
2009-06-09 16:40 ` Glauber Costa
2009-06-09 16:42 ` Avi Kivity
2009-06-09 16:52 ` Glauber Costa
2009-06-09 16:46 ` Gleb Natapov
2009-06-09 16:45 ` Gleb Natapov
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).