* [Qemu-devel] pause_all_vcpus() TCG bug?
@ 2013-05-01 13:33 Andreas Färber
2013-05-01 13:47 ` Peter Maydell
0 siblings, 1 reply; 3+ messages in thread
From: Andreas Färber @ 2013-05-01 13:33 UTC (permalink / raw)
To: qemu-devel; +Cc: Peter Maydell, 陳韋任
Hello,
This is today's function, with annotations and question inline:
void pause_all_vcpus(void)
{
CPUArchState *penv = first_cpu;
qemu_clock_enable(vm_clock, false);
while (penv) {
CPUState *pcpu = ENV_GET_CPU(penv);
pcpu->stop = true;
qemu_cpu_kick(pcpu);
penv = penv->next_cpu;
}
/* So, at this point penv == NULL. */
if (qemu_in_vcpu_thread()) {
cpu_stop_current();
if (!kvm_enabled()) {
while (penv) {
/* Looks like this can never be true then? */
/* Is penv = first_cpu; missing? */
CPUState *pcpu = ENV_GET_CPU(penv);
pcpu->stop = 0;
/* 0 instead of false may hint at a mismerge... */
pcpu->stopped = true;
penv = penv->next_cpu;
}
return;
}
}
while (!all_vcpus_paused()) {
qemu_cond_wait(&qemu_pause_cond, &qemu_global_mutex);
penv = first_cpu;
while (penv) {
qemu_cpu_kick(ENV_GET_CPU(penv));
penv = penv->next_cpu;
}
}
}
Thanks,
Andreas
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] pause_all_vcpus() TCG bug?
2013-05-01 13:33 [Qemu-devel] pause_all_vcpus() TCG bug? Andreas Färber
@ 2013-05-01 13:47 ` Peter Maydell
2013-05-02 8:44 ` Jan Kiszka
0 siblings, 1 reply; 3+ messages in thread
From: Peter Maydell @ 2013-05-01 13:47 UTC (permalink / raw)
To: Andreas Färber; +Cc: Jan Kiszka, qemu-devel, 陳韋任
On 1 May 2013 14:33, Andreas Färber <afaerber@suse.de> wrote:
> Hello,
>
> This is today's function, with annotations and question inline:
>
> void pause_all_vcpus(void)
> {
> CPUArchState *penv = first_cpu;
>
> qemu_clock_enable(vm_clock, false);
> while (penv) {
> CPUState *pcpu = ENV_GET_CPU(penv);
> pcpu->stop = true;
> qemu_cpu_kick(pcpu);
> penv = penv->next_cpu;
> }
>
> /* So, at this point penv == NULL. */
>
> if (qemu_in_vcpu_thread()) {
> cpu_stop_current();
> if (!kvm_enabled()) {
> while (penv) {
>
> /* Looks like this can never be true then? */
> /* Is penv = first_cpu; missing? */
>
> CPUState *pcpu = ENV_GET_CPU(penv);
> pcpu->stop = 0;
>
> /* 0 instead of false may hint at a mismerge... */
>
> pcpu->stopped = true;
> penv = penv->next_cpu;
> }
> return;
> }
> }
This certainly looks odd. This bug seems to have
been present since this patch was first committed
(d798e9745, January last year, by Jan.)
-- PMM
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] pause_all_vcpus() TCG bug?
2013-05-01 13:47 ` Peter Maydell
@ 2013-05-02 8:44 ` Jan Kiszka
0 siblings, 0 replies; 3+ messages in thread
From: Jan Kiszka @ 2013-05-02 8:44 UTC (permalink / raw)
To: Peter Maydell; +Cc: Andreas Färber, 陳韋任, qemu-devel
On 2013-05-01 15:47, Peter Maydell wrote:
> On 1 May 2013 14:33, Andreas Färber <afaerber@suse.de> wrote:
>> Hello,
>>
>> This is today's function, with annotations and question inline:
>>
>> void pause_all_vcpus(void)
>> {
>> CPUArchState *penv = first_cpu;
>>
>> qemu_clock_enable(vm_clock, false);
>> while (penv) {
>> CPUState *pcpu = ENV_GET_CPU(penv);
>> pcpu->stop = true;
>> qemu_cpu_kick(pcpu);
>> penv = penv->next_cpu;
>> }
>>
>> /* So, at this point penv == NULL. */
>>
>> if (qemu_in_vcpu_thread()) {
>> cpu_stop_current();
>> if (!kvm_enabled()) {
>> while (penv) {
>>
>> /* Looks like this can never be true then? */
>> /* Is penv = first_cpu; missing? */
Yeah, obviously. It practically didn't matter so far for the use case of
pause/resume_all_vcpus over a vcpu itself (kvmvapic). Feel free to fix.
>>
>> CPUState *pcpu = ENV_GET_CPU(penv);
>> pcpu->stop = 0;
>>
>> /* 0 instead of false may hint at a mismerge... */
Nope, stop was uint32_t at that time.
Jan
>>
>> pcpu->stopped = true;
>> penv = penv->next_cpu;
>> }
>> return;
>> }
>> }
>
> This certainly looks odd. This bug seems to have
> been present since this patch was first committed
> (d798e9745, January last year, by Jan.)
>
> -- PMM
>
--
Siemens AG, Corporate Technology, CT RTC ITP SDP-DE
Corporate Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-05-02 8:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-01 13:33 [Qemu-devel] pause_all_vcpus() TCG bug? Andreas Färber
2013-05-01 13:47 ` Peter Maydell
2013-05-02 8:44 ` Jan Kiszka
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).