Re: [PATCH 2/2] vnc: don't mess up with iohandlers in the vnc thread

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

 



On 03/10/2011 02:45 PM, Anthony Liguori wrote:
On 03/10/2011 07:06 AM, Paolo Bonzini wrote:
On 03/10/2011 01:59 PM, Corentin Chary wrote:
Instead, we now store the data in a temporary buffer, and use a socket
pair to notify the main thread that new data is available.

You can use a bottom half for this instead of a special socket.
Signaling a bottom half is async-signal- and thread-safe.

Bottom halves are thread safe?

I don't think so.

They probably should be but they aren't today.

Creating a new bottom half is not thread-safe, but scheduling one is. Assuming that you never use qemu_bh_schedule_idle, qemu_bh_schedule boils down to:

    if (bh->scheduled)
        return;
    bh->scheduled = 1;
    /* stop the currently executing CPU to execute the BH ASAP */
    qemu_notify_event();

You may have a spurious wakeup if two threads race on the same bottom half (including the signaling thread racing with the IO thread), but overall you can safely treat them as thread-safe.

Paolo
--
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