Re: [PATCH 1/2] iio: hrtimer-trigger: Mark hrtimer to expire in hard interrupt context

Jonathan Cameron
2020-10-10T22:57:10Z

On Fri, 2 Oct 2020 16:10:09 +0200
Christian Eggers <ceggers@arri.de> wrote:

> Hi Jonathan,

Lars-Peter's patch! But I'm sure he'll do an updated version to deal
with the point you make below.

@Lars no great hurry as this isn't going to make the merge window
anyway so we have a couple of weeks. Will have to hit after rc1 and
get backported as relevant.

Thanks,

Jonathan

>
> On Monday, 21 September 2020, 11:57:03 CEST, Jonathan Cameron wrote:
> > On Mon, 21 Sep 2020 09:17:26 +0200
> >
> > Christian Eggers <ceggers@arri.de> wrote:
> > > Tested together with
> > >
> > > - iio: Fix: Do not poll the driver again if try_reenable() callback
> > > returns non 0. and
> > > - iio:trigger: rename try_reenable() to reenable() plus return void
> > >
> > > on latest mainline (without PREEMPT_RT). The original WARN_ONCE() in
> > > kernel/irq/handle.c:159 was not raised anymore. But even without the
> > > current patches, this warning is not shown (as this problem only applies
> > > to -RT).
> > >
> > > Currently I haven't ported a RT kernel > 5.4 for my board, so I cannot
> > > check with current RT. On 5.4. there the patches seem not to work fully
> > > as kernel/timer/hrtimer.c is not up to date enough.
> > >
> > > Sorry for being not very helpful...
> >
> > Thanks for at least trying!
>
> I've just ported my BSP to v5.9-rc7-rt10. It looks like your patch misses one
> additional change in iio_trig_hrtimer_set_state():
>
> - hrtimer_start(&trig_info->timer, trig_info->period,
> - HRTIMER_MODE_REL);
> + hrtimer_start(&trig_info->timer, trig_info->period,
> + HRTIMER_MODE_REL_HARD);
>
> Without this, WARN_ON_ONCE() in kernel/time/hrtimer.c:1133 will be hit:
>
> WARN_ON_ONCE(!(mode & HRTIMER_MODE_HARD) ^ !timer->is_hard);
>
> So the mode HRTIMER_MODE_REL_HARD is required for hrtimer_init() (will be
> stored in timer->is_hard) and for hrtimer_start().
>
> Best regards
> Christian
>
>
>
> ________________________________
> [http://assets.arri.com/media/sign/2020-04-03-E-mail-signature-Stellar2_V1.jpg] <https://microsites.arri.com/stellar/>
>
> Get all the latest information from www.arri.com<https://www.arri.com/>, Facebook<https://www.facebook.com/TeamARRI>, Twitter<https://twitter.com/ARRIChannel>, Instagram<https://instagram.com/arri> and YouTube<https://www.youtube.com/user/ARRIChannel>.
>
> Arnold & Richter Cine Technik GmbH & Co. Betriebs KG
> Sitz: München - Registergericht: Amtsgericht München - Handelsregisternummer: HRA 57918
> Persönlich haftender Gesellschafter: Arnold & Richter Cine Technik GmbH
> Sitz: München - Registergericht: Amtsgericht München - Handelsregisternummer: HRB 54477
> Geschäftsführer: Dr. Michael Neuhäuser; Stephan Schenk; Walter Trauninger; Markus Zeiler