On Wed, Jun 14, 2017 at 05:32:12PM +0200, Paolo Bonzini wrote: > > > On 14/06/2017 17:28, Roman Kagan wrote: > > On Wed, Jun 14, 2017 at 05:08:02PM +0200, Paolo Bonzini wrote: > >> > >> > >> On 06/06/2017 20:19, Roman Kagan wrote: > >>> + sint_route->msg_status = ret; > >>> + /* notify the msg originator of the progress made; if the slot was > >>> busy we > >>> + * set msg_pending flag in it so it will be the guest who will do > >>> EOM and > >>> + * trigger the notification from KVM via sint_ack_notifier */ > >>> + if (ret != -EAGAIN) { > >>> + qemu_bh_schedule(sint_route->msg_bh); > >>> + } > >> > >> It may be faster to use aio_bh_schedule_oneshot, depending on the number > >> of devices. > > > > Messages aren't used on fast paths, they are only exchanged at device > > setup/teardown. So I cared more about readability than speed here. > > Then you really want to use aio_bh_schedule_oneshot, because bottom > halves incur a (small) cost even when you don't use them: each iteration > of the event loop visits the list of bottom halves.
I didn't realize that (yes that's easy to see in the code but the API didn't suggest I needed to ;). > Persistent bottom halves, thus, are only a good idea if they are > expected to trigger very often on a busy VM. If this bottom half is > only triggered at setup/teardown, it shouldn't use them. Thanks for pointing that out; we'll have to adjust our vmbus code too as we used a persistent bottom half for message interactions there too. Roman.