Re: [PATCH] pps: add epoll support

From: Rodolfo Giometti
Date: Tue Feb 25 2025 - 09:31:12 EST


On 25/02/25 14:39, Denis OSTERLAND-HEIM wrote:
Hi,

I fixed-up s/pps->fetched_ev/pps->last_fetched_ev/ and tested it.

With one process it works well.

```
# cat /sys/class/pps/pps1/assert; PpsPollTest /dev/pps1; cat /sys/class/pps/pps1/assert
1520599383.268749168#29
assert: 29
time: 1520599383.268749168
assert: 30
time: 1520599384.292728352
assert: 31
time: 1520599385.316788416
1520599385.316788416#31
```

OK.

If I start multiple user space programs data races are visible.

```
# for i in 0 1 2 3 4 5 6; do PpsPollTest /dev/pps1 > log$i & done
# sleep 6
# tail log*
==> log0 <==
timeout
assert: 196
time: 1520599554.276752928
assert: 197
time: 1520599555.300692704

This is the same behavior we have when working with a serial port: if more than one process gets access to it, data is stolen.

From my point of view it would be great to fix this bug without such an limitation.

I disagree, it is not a limitation! It is like a normal char device work.

What we have to test now is if your initial goal has been addressed! That is, in an application that has more to do than just dealing with one PPS device, we can use poll()/select() in order to avoid using threads.

Ciao,

Rodolfo

--
GNU/Linux Solutions e-mail: giometti@xxxxxxxxxxxx
Linux Device Driver giometti@xxxxxxxx
Embedded Systems phone: +39 349 2432127
UNIX programming