qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Andreas Färber" <afaerber@suse.de>
To: Peter Maydell <peter.maydell@linaro.org>,
	"Edgar E. Iglesias" <edgar.iglesias@gmail.com>
Cc: QEMU Developers <qemu-devel@nongnu.org>, pcrost@xilinx.com
Subject: Re: [Qemu-devel] [PATCH] qom/cpu: Remove cpu->exit_request from reset state
Date: Thu, 20 Feb 2014 17:15:19 +0100	[thread overview]
Message-ID: <53062A17.8060909@suse.de> (raw)
In-Reply-To: <CAFEAcA9XSdVmU+4F15HBZ_Es+VDX9E2UCQ=AVY=fWi1F86TO6A@mail.gmail.com>

Am 20.02.2014 16:58, schrieb Peter Maydell:
> On 16 February 2014 02:07, Edgar E. Iglesias <edgar.iglesias@gmail.com> wrote:
>> On Sat, Feb 15, 2014 at 03:42:56PM +0000, Peter Maydell wrote:
>>> On 13 February 2014 05:07,  <edgar.iglesias@gmail.com> wrote:
>>>> From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
>>>>
>>>> cpu->exit_request is part of the execution environment and should
>>>> not be cleared when a CPU resets.
>>>>
>>>> Otherwise, we might deadlock QEMU if a CPU resets while there is
>>>> I/O going on.
>>>>
>>>> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
>>>> ---
>>>>  qom/cpu.c | 1 -
>>>>  1 file changed, 1 deletion(-)
>>>>
>>>> diff --git a/qom/cpu.c b/qom/cpu.c
>>>> index 9d62479..40d82dd 100644
>>>> --- a/qom/cpu.c
>>>> +++ b/qom/cpu.c
>>>> @@ -195,7 +195,6 @@ static void cpu_common_reset(CPUState *cpu)
>>>>          log_cpu_state(cpu, cc->reset_dump_flags);
>>>>      }
>>>>
>>>> -    cpu->exit_request = 0;
>>>>      cpu->interrupt_request = 0;
>>>>      cpu->current_tb = NULL;
>>>>      cpu->halted = 0;
>>>
>>> This looks kind of odd to me. What's the situation you see where
>>> this matters -- is the CPU resetting itself, or is some other device
>>> in another thread triggering the CPU reset? TCG or KVM?
>>
>> Seeing this in TCG. The CPU gets signaled by the IO thread while the
>> CPU is resetting itself. If the CPU looses the race, it clears its
>> exit_request leaving the IO thread waiting for the global lock
>> potentially forever.
>>
>> The CPU actually exits generated code but goes right back in because
>> there is no exit_request pending.
> 
> Yes, having looked at the code I agree with you, so:
> 
> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
> 
> However, doesn't this also apply to interrupt_request ?

I was wondering the same thing but didn't find time to investigate yet.

Is it possible that we rather need to register some reset hook or bottom
half to process the exit_request *before* this reset code runs?

Regards,
Andreas

> If we have a pending asserted interrupt on the CPU
> (ie the IRQ line into the chip is being held high)
> this should result in an interrupt as soon as the
> CPU reenables interrupts after reset, I would have
> thought. Clearing cpu->interrupt_request here will
> make us drop it on the floor.
> 
> thanks
> -- PMM
> 


-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

  reply	other threads:[~2014-02-20 16:15 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-13  5:07 [Qemu-devel] [PATCH] qom/cpu: Remove cpu->exit_request from reset state edgar.iglesias
2014-02-15 15:42 ` Peter Maydell
2014-02-16  2:07   ` Edgar E. Iglesias
2014-02-20 15:58     ` Peter Maydell
2014-02-20 16:15       ` Andreas Färber [this message]
2014-02-20 16:34         ` Peter Maydell
2014-02-20 23:26       ` Edgar E. Iglesias
2014-02-20 23:50         ` Peter Maydell
2014-03-11 23:58       ` Andreas Färber
2014-03-12  0:03         ` Peter Maydell
2014-03-12  1:51           ` Edgar E. Iglesias

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=53062A17.8060909@suse.de \
    --to=afaerber@suse.de \
    --cc=edgar.iglesias@gmail.com \
    --cc=pcrost@xilinx.com \
    --cc=peter.maydell@linaro.org \
    --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 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).