qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2] AioContext: fix broken placement of event_no


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [PATCH v2] AioContext: fix broken placement of event_notifier_test_and_clear
Date: Mon, 20 Jul 2015 17:36:20 +0100
User-agent: Mutt/1.5.23 (2014-03-12)

On Mon, Jul 20, 2015 at 07:27:11AM +0200, Paolo Bonzini wrote:
> event_notifier_test_and_clear must be called before processing events.
> Otherwise, an aio_poll could "eat" the notification before the main
> I/O thread invokes ppoll().  The main I/O thread then never wakes up.
> This is an example of what could happen:
> 
>    i/o thread         vcpu thread                   worker thread
>    ---------------------------------------------------------------------
>    lock_iothread
>    notify_me = 1
>    ...
>    unlock_iothread
>                       lock_iothread
>                       notify_me = 3
>                       ppoll
>                       notify_me = 1
>                                                      bh->scheduled = 1
>                                                      event_notifier_set
>                       event_notifier_test_and_clear
>    ppoll
>    *** hang ***

I don't understand this diagram.  Why is event_notifier_test_and_clear()
called by the vcpu thread?  event_notifier_set() was called *after* vcpu
thread's ppoll() returned so I wouldn't expect the vcpu thread to see
the notify.

Was there a previous notify pending?

Attachment: pgpxzwJ0ehGc8.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]