From: Vladimir Oltean <olteanv@gmail•com>
To: Miroslav Lichvar <mlichvar@redhat•com>
Cc: Vinicius Costa Gomes <vinicius.gomes@intel•com>,
netdev@vger•kernel.org, Yangbo Lu <yangbo.lu@nxp•com>,
Yang Yingliang <yangyingliang@huawei•com>,
Richard Cochran <richardcochran@gmail•com>
Subject: Re: [PATCH net-next 1/5] ptp: unregister virtual clocks when unregistering physical clock.
Date: Mon, 31 Jan 2022 14:41:35 +0200 [thread overview]
Message-ID: <20220131124135.62khcaehujxrlhbf@skbuf> (raw)
In-Reply-To: <Yfe0+N2cMJaWNbo7@localhost>
Hi,
On Mon, Jan 31, 2022 at 11:07:52AM +0100, Miroslav Lichvar wrote:
> On Thu, Jan 27, 2022 at 03:58:02PM -0800, Vinicius Costa Gomes wrote:
> > Miroslav Lichvar <mlichvar@redhat•com> writes:
> >
> > > When unregistering a physical clock which has some virtual clocks,
> > > unregister the virtual clocks with it.
>
> > I am not against this change, but I think this problem was discussed
> > before and the suggestions were to fix it differently:
> >
> > https://lore.kernel.org/all/20210807144332.szyazdfl42abwzmd@skbuf/
>
> Is a linked device supposed to be unregistered automatically before
> the parent? The referenced document mentions only suspending
> and resuming, nothing about unregistering.
>
> I tried
>
> device_link_add(parent, &ptp->dev, DL_FLAG_AUTOREMOVE_CONSUMER);
>
> and also with no flags specified, but it didn't seem to do anything
> for the vclock. It was still oopsing.
>
> Any hints?
>
> --
> Miroslav Lichvar
>
First of all, I was wrong about the device hierarchy created by the PTP
subsystem, and as such, device links won't work.
When you unbind a physical PTP clock, what you actually unbind is the
driver from its parent device (the parent->parent, i.e. what is passed
as "parent" to the parent's ptp_clock_register call).
But since the PTP subsystem doesn't register its devices with the device
hierarchy (of device_register(), it only calls the first half:
device_initialize(), it doesn't call device_add), so the dev->kobj
doesn't get added to the devices_kset. The documentation says:
| The earliest point in time when device links can be added is after
| device_add() has been called for the supplier and device_initialize()
| has been called for the consumer.
Furthermore, PTP devices don't have a driver bound to them, with probe()
and remove() callbacks. The only driver is that of the parent of the
physical PHC. So no driver for the vclock => no hook to call
ptp_vclock_unregister() from, even if a device link from ptp->dev to
parent->parent can be added.
So your solution appears to be the correct one given the structure - call
unregister_vclock() manually.
Secondly, you got the arguments in reverse: the consumer is the first
argument, and that is &ptp->dev, and the supplier is "parent".
next prev parent reply other threads:[~2022-01-31 12:41 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-27 11:45 [PATCH net-next 0/5] Virtual PTP clock improvements and fix Miroslav Lichvar
2022-01-27 11:45 ` [PATCH net-next 1/5] ptp: unregister virtual clocks when unregistering physical clock Miroslav Lichvar
2022-01-27 23:58 ` Vinicius Costa Gomes
2022-01-31 10:07 ` Miroslav Lichvar
2022-01-31 12:41 ` Vladimir Oltean [this message]
2022-01-27 11:45 ` [PATCH net-next 2/5] ptp: increase maximum adjustment of virtual clocks Miroslav Lichvar
2022-01-27 11:45 ` [PATCH net-next 3/5] ptp: add gettimex64() to " Miroslav Lichvar
2022-01-27 11:45 ` [PATCH net-next 4/5] ptp: add getcrosststamp() " Miroslav Lichvar
2022-01-27 11:45 ` [PATCH net-next 5/5] ptp: start virtual clocks at current system time Miroslav Lichvar
2022-01-27 22:01 ` Richard Cochran
2022-01-31 10:21 ` Miroslav Lichvar
2022-01-31 16:32 ` Richard Cochran
2022-02-01 8:42 ` Miroslav Lichvar
2022-02-01 19:10 ` Richard Cochran
2022-02-01 19:03 ` Richard Cochran
2022-02-02 9:07 ` Miroslav Lichvar
2022-01-27 22:02 ` [PATCH net-next 0/5] Virtual PTP clock improvements and fix Richard Cochran
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220131124135.62khcaehujxrlhbf@skbuf \
--to=olteanv@gmail$(echo .)com \
--cc=mlichvar@redhat$(echo .)com \
--cc=netdev@vger$(echo .)kernel.org \
--cc=richardcochran@gmail$(echo .)com \
--cc=vinicius.gomes@intel$(echo .)com \
--cc=yangbo.lu@nxp$(echo .)com \
--cc=yangyingliang@huawei$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox