[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8734yn8e2x.fsf@intel.com>
Date: Fri, 06 Oct 2023 17:35:02 -0700
From: Vinicius Costa Gomes <vinicius.gomes@...el.com>
To: Xabier Marquiegui <reibax@...il.com>, reibax@...il.com
Cc: chrony-dev@...ony.tuxfamily.org, davem@...emloft.net, horms@...nel.org,
jstultz@...gle.com, mlichvar@...hat.com, netdev@...r.kernel.org,
ntp-lists@...tcorallo.com, richardcochran@...il.com,
rrameshbabu@...dia.com, shuah@...nel.org, tglx@...utronix.de
Subject: Re: [PATCH net-next v4 4/6] ptp: support event queue reader channel
masks
Xabier Marquiegui <reibax@...il.com> writes:
> Simon Horman said:
>> Hi Xabier,
>>
>> queue appears to be leaked here.
>>
>> As flagged by Smatch.
>
> Nice catch Simon. Thank you very much. I think I know how to fix it. I
> will keep it in mind for the next revision.
>
> Vinicius Costa Gomes said:
>> 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().
>
> You are totally correct about that observation. I had never thought of
> this angle until you mentioned it. Thank you for bringing it up.
>
>> 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?).
>
> Old events are indeed lost for a new reader, but I don't see how that
> could be causing a leak. The way it works is, we always have at least
> one queue: the one corresponding to sysfs.
>
Ah, yeah! I forgot that sysfs is a separate events consumer. Disregard
my comment about leaking events, then.
> Whenever a new reader accesses the device, a new queue is created and
> starts to get fed with new coming timestamps alongside the rest of
> existing queues.
>
>> Is this a desired/wanted change? Is it possible that we have
>> applications that depend on the "old" behavior?
>
> I would really like to hear the voice of more experience people on this.
> On my limited experience this is a non-issue because I can control the
> sequencing and I am sure to have the reader ready before I trigger events,
> but you might be right that there might be some use-cases I didn't imagine
> that could be affected by this change in behavior.
>
I am not a heavy user of these APIs, but I don't think this will break
anything. Just thought it important to voice this so when we make this
change in behavior we make it knowingly. (and my imagination could not
produce any practical case that this would be a problem)
But let's see what others say.
> We could tweak the system a little bit by having an additional reference
> fifo with no readers. Whenever a new ptp_open happens, I could just copy
> the entire reference fifo to the new one. I guess this would bring back
> the need to have the fifo mutex.
>
> If this idea works we could be maintaining the same functionality, at the
> cost of making the system be more complex and slower. Is it worth it?
Probably not. I would say that this change in behavior is fine/harmless.
Just a matter of being aware of it.
>
> I look forward to hearing opinions on this. Thank you everyone for your
> feedback.
>
Cheers,
--
Vinicius
Powered by blists - more mailing lists