[Xen-devel] Re: [PATCH][ioemu] Ignore the first watch fire in xenstore_process_dm_command_event()

Ian Jackson
Tue, 16 Jun 2009 17:23:35 -0000

Cui, Dexuan writes ("[PATCH][ioemu] Ignore the first watch fire in
xenstore_process_dm_command_event()"):
> After changeset 19679: ec2bc4b9fa32 (xend: hot-plug PCI devices at
> boot-time) and the related ioemu commits, I notice there is a race
> condition that could break the device assignment of hvm guest.
...
> A straightforward thought is: we can ignore the first watch
> fire. Please see the below patch.

I don''t think this can possibly be right.  xenstore watches are cues
to read the path at which the watch has fired, but number of watch
firings is not conserved.  So the actual watch processing code should
be idempotent.

When we start processing a command we should either (i) delete it from
xenstore immediately, so that future watch triggerings either don''t
see the command or actually see genuine new invocations, or (ii) make
a note that we''re processing the command and arrange not to reprocess
it until something (us or xend, probably) has deleted it.

I''m not sure exactly how the protocol works here ...