[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ZSDWHZb7AgAm6GT+@hoboy.vegasvil.org>
Date: Fri, 6 Oct 2023 20:53:01 -0700
From: Richard Cochran <richardcochran@...il.com>
To: Vinicius Costa Gomes <vinicius.gomes@...el.com>
Cc: Xabier Marquiegui <reibax@...il.com>, netdev@...r.kernel.org,
tglx@...utronix.de, jstultz@...gle.com, horms@...nel.org,
chrony-dev@...ony.tuxfamily.org, mlichvar@...hat.com,
ntp-lists@...tcorallo.com, alex.maftei@....com, davem@...emloft.net,
rrameshbabu@...dia.com, shuah@...nel.org
Subject: Re: [PATCH net-next v4 4/6] ptp: support event queue reader channel
masks
On Fri, Oct 06, 2023 at 03:05:12PM -0700, Vinicius Costa Gomes wrote:
> Sorry that I only noticed a (possible) change in behavior now.
>
> Before this series, when there was a single queue, events where
> accumulated until the application reads the fd associated with the PTP
> device. i.e. it doesn't matter when the application calls open().
>
> AFter this series events, are only accumulated after the queue
> associated with that fd is created, i.e. after open(). Events that
> happened before open() are lost (is this true? are we leaking them?).
>
> Is this a desired/wanted change? Is it possible that we have
> applications that depend on the "old" behavior?
So the existing behavior is not very nice to user space. The is
forced to clear the fifo after open, like this
ts2phc_pps_sink.c:
117 static int ts2phc_pps_sink_clear_fifo(struct ts2phc_pps_sink *sink)
118 {
119 struct pollfd pfd = {
120 .events = POLLIN | POLLPRI,
121 .fd = sink->clock->fd,
122 };
123 struct ptp_extts_event event;
124 int cnt, size;
125
126 while (1) {
127 cnt = poll(&pfd, 1, 0);
128 if (cnt < 0) {
129 if (EINTR == errno) {
130 continue;
131 } else {
132 pr_emerg("poll failed");
133 return -1;
134 }
135 } else if (!cnt) {
136 break;
137 }
138 size = read(pfd.fd, &event, sizeof(event));
So, no one will miss the old behavior!
Thanks,
Richard
Powered by blists - more mailing lists