On Tue, Jul 11, 2017 at 11:48:02AM +0200, Paolo Bonzini wrote: > On 11/07/2017 11:43, Stefan Hajnoczi wrote: > >>> > >>> 1. Must be called under BQL? > >>> 2. Can I/O requests be in flight? > >>> 3. Is it thread-safe? > >>> > >>> Otherwise it will be a nightmare to modify the code since these > >>> constraints are not enforced by the compiler and undocumented. > >> Good point. Are (1) and (3) different ways to say the same thing or do > >> you have other differences in mind? > > There is a difference between (1) and (3). If a function is thread-safe > > then callers can invoke it without any constraints. If a function > > requires a specific lock to be held then that it puts a constraint on > > the caller. > > > > We do have thread-safe functions in the block layer: simple functions > > that fetch a BDS field atomically. There is no need to hold the BQL for > > them. > > Ok, so we are in (somewhat violent) agreement. "It's not thread-safe" > pretty much means "must be called under BQL". > > I look forward to extending Marc-André's -Wthread-safety experiments to > cover bdrv_drained_begin/end!
Sounds good :). Stefan
signature.asc
Description: PGP signature