Re: [Qemu-devel] Re: [PATCH] Fix freezing bug in curses console

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

 



Anthony Liguori wrote:
> >When using the pipe as a simple semaphore all you care about is the 
> >presence or absence of data. It doesn't matter if subsequent writes loose 
> >data (e.g. by not retrying a nonblocking write) as long as a write to an 
> >empty pipe succeeds.
> 
> Yup.  You need to use a global flag to distinguish the type of signal.

If you have a set of BHs which can be scheduled from a signal handler,
set a flag in the BH when it's scheduled, prior to the non-blocking
pipe write.  The select-pipe reader can then look at all eligible BHs
looking for ones with the flag set.

If you can enqueue them in the signal handler that's even better, but
obviously beware of race conditions.

Don't forget to completely drain the pipe when reading.

Maybe use an eventfd instead of a pipe if you have eventfd. :-)

If the signal handler might be run in different threads, you'll need
to take care of memory ordering.  The flag must be set before writing
to the pipe, as observed by the pipe-reading thread.

-- Jamie
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux