* [PATCH] ptp: Set lookup cookie when creating a PTP PPS source.
@ 2021-06-28 18:25 Jonathan Lemon
2021-06-28 23:38 ` Richard Cochran
2021-06-29 18:40 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 8+ messages in thread
From: Jonathan Lemon @ 2021-06-28 18:25 UTC (permalink / raw)
To: netdev, richardcochran; +Cc: kernel-team
When creating a PTP device, the configuration block allows
creation of an associated PPS device. However, there isn't
any way to associate the two devices after creation.
Set the PPS cookie, so pps_lookup_dev(ptp) performs correctly.
Signed-off-by: Jonathan Lemon <jonathan.lemon@gmail.com>
---
drivers/ptp/ptp_clock.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/ptp/ptp_clock.c b/drivers/ptp/ptp_clock.c
index c176fa82df85..45429853d60f 100644
--- a/drivers/ptp/ptp_clock.c
+++ b/drivers/ptp/ptp_clock.c
@@ -240,6 +240,7 @@ struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info,
pr_err("failed to create ptp aux_worker %d\n", err);
goto kworker_err;
}
+ ptp->pps_source->lookup_cookie = ptp;
}
err = ptp_populate_pin_groups(ptp);
--
2.30.2
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] ptp: Set lookup cookie when creating a PTP PPS source.
2021-06-28 18:25 [PATCH] ptp: Set lookup cookie when creating a PTP PPS source Jonathan Lemon
@ 2021-06-28 23:38 ` Richard Cochran
2021-06-29 0:08 ` Jonathan Lemon
2021-07-02 0:39 ` Vladimir Oltean
2021-06-29 18:40 ` patchwork-bot+netdevbpf
1 sibling, 2 replies; 8+ messages in thread
From: Richard Cochran @ 2021-06-28 23:38 UTC (permalink / raw)
To: Jonathan Lemon; +Cc: netdev, kernel-team
On Mon, Jun 28, 2021 at 11:25:33AM -0700, Jonathan Lemon wrote:
> When creating a PTP device, the configuration block allows
> creation of an associated PPS device. However, there isn't
> any way to associate the two devices after creation.
>
> Set the PPS cookie, so pps_lookup_dev(ptp) performs correctly.
Setting lookup_cookie is harmless, AFAICT, but I wonder about the use
case. The doc for pps_lookup_dev() says,
* This is a bit of a kludge that is currently used only by the PPS
* serial line discipline.
and indeed that is the case.
The PHC devices are never serial ports, so how does this help?
Thanks,
Richard
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] ptp: Set lookup cookie when creating a PTP PPS source.
2021-06-28 23:38 ` Richard Cochran
@ 2021-06-29 0:08 ` Jonathan Lemon
2021-07-02 0:39 ` Vladimir Oltean
1 sibling, 0 replies; 8+ messages in thread
From: Jonathan Lemon @ 2021-06-29 0:08 UTC (permalink / raw)
To: Richard Cochran; +Cc: netdev, kernel-team
On Mon, Jun 28, 2021 at 04:38:35PM -0700, Richard Cochran wrote:
> On Mon, Jun 28, 2021 at 11:25:33AM -0700, Jonathan Lemon wrote:
> > When creating a PTP device, the configuration block allows
> > creation of an associated PPS device. However, there isn't
> > any way to associate the two devices after creation.
> >
> > Set the PPS cookie, so pps_lookup_dev(ptp) performs correctly.
>
> Setting lookup_cookie is harmless, AFAICT, but I wonder about the use
> case. The doc for pps_lookup_dev() says,
>
> * This is a bit of a kludge that is currently used only by the PPS
> * serial line discipline.
>
> and indeed that is the case.
>
> The PHC devices are never serial ports, so how does this help?
This is for the ptp_ocp driver, I have an update coming.
The systems I'm using have the OpenCompute time card and
several nics, all of which publish PTP/PPS devices.
When there are several PPS devices, this patch allows
selecting the correct one.
--
Joanthan
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] ptp: Set lookup cookie when creating a PTP PPS source.
2021-06-28 18:25 [PATCH] ptp: Set lookup cookie when creating a PTP PPS source Jonathan Lemon
2021-06-28 23:38 ` Richard Cochran
@ 2021-06-29 18:40 ` patchwork-bot+netdevbpf
2021-06-30 0:11 ` Richard Cochran
1 sibling, 1 reply; 8+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-06-29 18:40 UTC (permalink / raw)
To: Jonathan Lemon; +Cc: netdev, richardcochran, kernel-team
Hello:
This patch was applied to netdev/net-next.git (refs/heads/master):
On Mon, 28 Jun 2021 11:25:33 -0700 you wrote:
> When creating a PTP device, the configuration block allows
> creation of an associated PPS device. However, there isn't
> any way to associate the two devices after creation.
>
> Set the PPS cookie, so pps_lookup_dev(ptp) performs correctly.
>
> Signed-off-by: Jonathan Lemon <jonathan.lemon@gmail.com>
>
> [...]
Here is the summary with links:
- ptp: Set lookup cookie when creating a PTP PPS source.
https://git.kernel.org/netdev/net-next/c/8602e40fc813
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] ptp: Set lookup cookie when creating a PTP PPS source.
2021-06-29 18:40 ` patchwork-bot+netdevbpf
@ 2021-06-30 0:11 ` Richard Cochran
0 siblings, 0 replies; 8+ messages in thread
From: Richard Cochran @ 2021-06-30 0:11 UTC (permalink / raw)
To: patchwork-bot+netdevbpf; +Cc: Jonathan Lemon, netdev, kernel-team
On Tue, Jun 29, 2021 at 06:40:04PM +0000, patchwork-bot+netdevbpf@kernel.org wrote:
> Hello:
>
> This patch was applied to netdev/net-next.git (refs/heads/master):
Why is this bot applying patches to net-next with issues that are
under review?
Thanks,
Richard
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] ptp: Set lookup cookie when creating a PTP PPS source.
2021-06-28 23:38 ` Richard Cochran
2021-06-29 0:08 ` Jonathan Lemon
@ 2021-07-02 0:39 ` Vladimir Oltean
2021-07-02 1:28 ` Richard Cochran
2021-07-07 0:26 ` Jonathan Lemon
1 sibling, 2 replies; 8+ messages in thread
From: Vladimir Oltean @ 2021-07-02 0:39 UTC (permalink / raw)
To: Richard Cochran, Jonathan Lemon; +Cc: netdev, kernel-team
On Mon, Jun 28, 2021 at 04:38:35PM -0700, Richard Cochran wrote:
> On Mon, Jun 28, 2021 at 11:25:33AM -0700, Jonathan Lemon wrote:
> > When creating a PTP device, the configuration block allows
> > creation of an associated PPS device. However, there isn't
> > any way to associate the two devices after creation.
> >
> > Set the PPS cookie, so pps_lookup_dev(ptp) performs correctly.
>
> Setting lookup_cookie is harmless, AFAICT, but I wonder about the use
> case. The doc for pps_lookup_dev() says,
Harmless you say?
Let's look at the code in a larger context:
struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info,
struct device *parent)
{
struct ptp_clock *ptp;
...
ptp = kzalloc(...);
...
ptp->info = info;
...
if (ptp->info->do_aux_work) {
...
+ ptp->pps_source->lookup_cookie = ptp;
}
/* Register a new PPS source. */
if (info->pps) {
struct pps_source_info pps;
...
ptp->pps_source = pps_register_source(&pps, PTP_PPS_DEFAULTS);
...
}
Notice anything out of the ordinary?
Like perhaps the fact that ptp->pps_source is an arbitrary NULL pointer
at the time the assignment to ->lookup_cookie is being made, because it
is being created later?
How on earth is this patch supposed to work?
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] ptp: Set lookup cookie when creating a PTP PPS source.
2021-07-02 0:39 ` Vladimir Oltean
@ 2021-07-02 1:28 ` Richard Cochran
2021-07-07 0:26 ` Jonathan Lemon
1 sibling, 0 replies; 8+ messages in thread
From: Richard Cochran @ 2021-07-02 1:28 UTC (permalink / raw)
To: Vladimir Oltean; +Cc: Jonathan Lemon, netdev, kernel-team
On Fri, Jul 02, 2021 at 03:39:36AM +0300, Vladimir Oltean wrote:
> Like perhaps the fact that ptp->pps_source is an arbitrary NULL pointer
> at the time the assignment to ->lookup_cookie is being made, because it
> is being created later?
Oops. @Jonathan please submit a fix as soon as you can. This patch
is already in net-next.
Thanks,
Richard
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] ptp: Set lookup cookie when creating a PTP PPS source.
2021-07-02 0:39 ` Vladimir Oltean
2021-07-02 1:28 ` Richard Cochran
@ 2021-07-07 0:26 ` Jonathan Lemon
1 sibling, 0 replies; 8+ messages in thread
From: Jonathan Lemon @ 2021-07-07 0:26 UTC (permalink / raw)
To: Vladimir Oltean; +Cc: Richard Cochran, netdev, kernel-team
On Fri, Jul 02, 2021 at 03:39:36AM +0300, Vladimir Oltean wrote:
> On Mon, Jun 28, 2021 at 04:38:35PM -0700, Richard Cochran wrote:
> > On Mon, Jun 28, 2021 at 11:25:33AM -0700, Jonathan Lemon wrote:
> > > When creating a PTP device, the configuration block allows
> > > creation of an associated PPS device. However, there isn't
> > > any way to associate the two devices after creation.
> > >
> > > Set the PPS cookie, so pps_lookup_dev(ptp) performs correctly.
> >
> > Setting lookup_cookie is harmless, AFAICT, but I wonder about the use
> > case. The doc for pps_lookup_dev() says,
>
> Harmless you say?
>
> Let's look at the code in a larger context:
>
> struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info,
> struct device *parent)
> {
> struct ptp_clock *ptp;
>
> ...
> ptp = kzalloc(...);
> ...
> ptp->info = info;
> ...
>
> if (ptp->info->do_aux_work) {
> ...
> + ptp->pps_source->lookup_cookie = ptp;
> }
>
> /* Register a new PPS source. */
> if (info->pps) {
> struct pps_source_info pps;
> ...
> ptp->pps_source = pps_register_source(&pps, PTP_PPS_DEFAULTS);
> ...
> }
>
> Notice anything out of the ordinary?
> Like perhaps the fact that ptp->pps_source is an arbitrary NULL pointer
> at the time the assignment to ->lookup_cookie is being made, because it
> is being created later?
>
> How on earth is this patch supposed to work?
It was added to the wrong code block. Checking my tree, I seem to have
it located twice - probably a bad patch that I didn't notice, and since
I don't have an do_aux_work, the first one didn't trigger.
Correction follows.
--
Jonathan
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2021-07-07 0:26 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-28 18:25 [PATCH] ptp: Set lookup cookie when creating a PTP PPS source Jonathan Lemon
2021-06-28 23:38 ` Richard Cochran
2021-06-29 0:08 ` Jonathan Lemon
2021-07-02 0:39 ` Vladimir Oltean
2021-07-02 1:28 ` Richard Cochran
2021-07-07 0:26 ` Jonathan Lemon
2021-06-29 18:40 ` patchwork-bot+netdevbpf
2021-06-30 0:11 ` Richard Cochran
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.