[dm-devel] [PATCH 1/3] dm: a basic support for using the select or poll function

Martin Wilck mwilck at suse.com
Fri May 12 06:48:53 UTC 2017


On Thu, 2017-05-11 at 14:46 -0700, Andy Grover wrote:
> 
> a) Application notes initial event_nrs for all relevant devices
> while (1)
>      b) Application calls ARM_POLL
>      c) Application gets updated event_nrs from LIST_DEVICES and
> handles
>      d) Application calls poll()
> 
> If events arrive between b and c, app sees them.
> If events arrive between c and d, dm_global_event_nr is greater than 
> priv->global_event_nr and poll() will indicate fd is ready
> immediately 
> w/o sleeping.
> If events arrive after d, app sleeps in poll() until fd is ready.
> 
> The difference is that you have to ARM_POLL and *then* process
> events 
> before calling poll(). The only small negative consequence is that if
> an 
> event arrives between b and c, it will be handled by c but poll()
> will 
> still see readiness and pop out of the poll() and loop again when it 
> strictly didn't have to. But events won't be lost.

I see, that would work. The call sequence is reversed compared to
"classical" poll() usage. Not a big problem, just something to be aware
of. Will there be some wrapper in libdm to make sure applications
adhere to these semantics?

And how does user space find out whether the kernel supports this
functionality?

Regards,
Martin

-- 
Dr. Martin Wilck <mwilck at suse.com>, Tel. +49 (0)911 74053 2107
SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)




More information about the dm-devel mailing list