Re: [PATCH v3 net-next 06/10] net: ptp: create a mock-up PTP Hardware Clock driver
From: Vladimir Oltean
Date: Wed Aug 02 2023 - 08:44:49 EST
Hi Kurt,
On Wed, Aug 02, 2023 at 02:18:10PM +0200, Kurt Kanzenbach wrote:
> > +static u64 mock_phc_cc_read(const struct cyclecounter *cc)
> > +{
> > + return ktime_to_ns(ktime_get_raw());
>
> Maybe return ktime_get_raw_ns()?
Maybe.. Didn't notice that there's a helper which does exactly this.
> > +}
> > +
> > +static int mock_phc_adjfine(struct ptp_clock_info *info, long scaled_ppm)
> > +{
> > + struct mock_phc *phc = info_to_phc(info);
> > + s64 adj;
> > +
> > + adj = (s64)scaled_ppm << MOCK_PHC_FADJ_SHIFT;
> > + adj = div_s64(adj, MOCK_PHC_FADJ_DENOMINATOR);
> > +
> > + spin_lock_bh(&mock_phc_lock);
>
> Why spin_lock_bh()? What's executed in bh context here? The PTP aux
> worker runs in thread context.
Correct, thanks for spotting. This is a left-over from some other
(unsubmitted) functionality I was working on. In the submitted variant,
nothing runs in softirq context, and thus, bottom halves don't need to
be disabled.
If there's nothing functionally broken, I think I'd prefer to address
both comments with follow-up patches rather than respinning this 10-patch
series. The build testing for this series still has not finished yet,
since yesterday.
Thanks for reviewing.