[vbox-dev] vgdrvIoCtl_CancelAllWaitEvents inconsistent behavior ?

Michael Thayer michael.thayer at oracle.com
Mon Jul 3 18:49:51 GMT 2017


Hello Hans,

03.07.2017 17:21, Hans de Goede wrote:
> Hi,
> 
> So while working on cleaning up the vboxguest driver for mainline
> linux kernel submission (*) I noticed some inconsistent behavior
> wrt vgdrvIoCtl_CancelAllWaitEvents vs vgdrvIoCtl_WaitEvent.
> 
> If there are no waiters then vgdrvIoCtl_CancelAllWaitEvents
> sets pSession->fPendingCancelWaitEvents and then when
> vgdrvIoCtl_WaitEvent calls vbdgCheckWaitEventCondition it
> will return VINF_SUCCESS + VBOXGUEST_WAITEVENT_OK even
> if u32EventFlagsOut is 0.
> 
> While as vgdrvIoCtl_WaitEvent actually waits and then
> vgdrvIoCtl_CancelAllWaitEvents gets called u32Result
> gets set to VBOXGUEST_WAITEVENT_INTERRUPTED.
> 
> I'm planning on rewriting all this code to directly
> use Linux waitqueues and I was wondering if I should
> preserve this behavior ?
[...]
> *) Very much WIP, see: https://github.com/jwrdegoede/vboxguest

I did not get any response when I asked around about this.  Reading the
code (quite a bit of work, as you presumably discovered too; fortunately
the user-space part is a bit easier) suggests that this is not intended,
as I could not find a caller in trunk or versions 5.1, 5.0 or 4.3 which
depended on this behaviour, and one of the few callers that I did find
(src/VBox/Additions/common/VBoxService/VBoxServiceCpuHotPlug.cpp) looks
like it would handle it incorrectly.  I will correct this in our code
too unless someone here speaks up.

Thanks for spotting that!

Regards
Michael
-- 
Michael Thayer | VirtualBox engineer
ORACLE Deutschland B.V. & Co. KG | Werkstr. 24 | D-71384 Weinstadt

ORACLE Deutschland B.V. & Co. KG
Hauptverwaltung: Riesstraße 25, D-80992 München
Registergericht: Amtsgericht München, HRA 95603

Komplementärin: ORACLE Deutschland Verwaltung B.V.
Hertogswetering 163/167, 3543 AS Utrecht, Niederlande Handelsregister
der Handelskammer Midden-Nederland, Nr. 30143697
Geschäftsführer: Alexander van der Ven, Jan Schultheiss, Val Maher



More information about the vbox-dev mailing list