Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1381680 > unrolled thread

Re: rtc ds3232 call trace in kernel

Started byAkinobu Mita <akinobu.mita@gmail.com>
First post2016-04-18 15:10 +0200
Last post2016-04-19 06:20 +0200
Articles 4 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: rtc ds3232 call trace in kernel Akinobu Mita <akinobu.mita@gmail.com> - 2016-04-18 15:10 +0200
    RE: rtc ds3232 call trace in kernel Qianyu Gong <qianyu.gong@nxp.com> - 2016-04-19 05:00 +0200
      Re: rtc ds3232 call trace in kernel Akinobu Mita <akinobu.mita@gmail.com> - 2016-04-19 06:00 +0200
        RE: rtc ds3232 call trace in kernel Qianyu Gong <qianyu.gong@nxp.com> - 2016-04-19 06:20 +0200

#1381680 — Re: rtc ds3232 call trace in kernel

FromAkinobu Mita <akinobu.mita@gmail.com>
Date2016-04-18 15:10 +0200
SubjectRe: rtc ds3232 call trace in kernel
Message-ID<rph6c-69y-55@gated-at.bofh.it>
2016-04-18 15:15 GMT+09:00 Qianyu Gong <qianyu.gong@nxp.com>:
> Hi Akinobu,
>
>
>
> I got an rtc call trace when booting 4.6 kernel on our board and I found it
>
> was caused by this patch:
>
>
>
> commit fc1dcb0b39dbb10d3290f2fcd6e154670f699166
>
> Author: Akinobu Mita <akinobu.mita@gmail.com>
>
> Date:   Mon Mar 7 00:27:53 2016 +0900
>
>
>
>     rtc: ds3232: use rtc->ops_lock to protect alarm operations
>
>
>
>     ds3232->mutex is used to protect for alarm operations which
>
>     need to access status and control registers.
>
>
>
>     But we can use rtc->ops_lock instead.  rtc->ops_lock is held when most
>
>     of rtc_class_ops methods are called, so we only need to explicitly
>
>     acquire it from irq handler in order to protect form concurrent
>
>     accesses.
>
>
>
>     Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
>
> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com
>
>
>
> The problem is that rtc->ops_lock would be accessed in ds3232_irq()
>
> without being initialized as rtc_device_register() is called too late.

You have already identified the root cause of this issue.

> As I’m not familiar with rtc things, could I just revert the patch or you
> already
>
> have a solution to this problem? Thanks in advance.

Could you check if the problem is resolved by moving the call of
devm_rtc_device_register() from the end of ds3232_probe() to just
before registering irq handler?

[toc] | [next] | [standalone]


#1382141

FromQianyu Gong <qianyu.gong@nxp.com>
Date2016-04-19 05:00 +0200
Message-ID<rpu3o-88t-7@gated-at.bofh.it>
In reply to#1381680
> -----Original Message-----
> From: Akinobu Mita [mailto:akinobu.mita@gmail.com]
> Sent: Monday, April 18, 2016 9:02 PM
> To: Qianyu Gong <qianyu.gong@nxp.com>
> Cc: alexandre.belloni@free-electrons.com; Mingkai Hu <mingkai.hu@nxp.com>;
> rtc-linux@googlegroups.com; linux-kernel@vger.kernel.org
> Subject: Re: rtc ds3232 call trace in kernel
> 
> 2016-04-18 15:15 GMT+09:00 Qianyu Gong <qianyu.gong@nxp.com>:
> > Hi Akinobu,
> >
> >
> >
> > I got an rtc call trace when booting 4.6 kernel on our board and I
> > found it
> >
> > was caused by this patch:
> >
> >
> >
> > commit fc1dcb0b39dbb10d3290f2fcd6e154670f699166
> >
> > Author: Akinobu Mita <akinobu.mita@gmail.com>
> >
> > Date:   Mon Mar 7 00:27:53 2016 +0900
> >
> >
> >
> >     rtc: ds3232: use rtc->ops_lock to protect alarm operations
> >
> >
> >
> >     ds3232->mutex is used to protect for alarm operations which
> >
> >     need to access status and control registers.
> >
> >
> >
> >     But we can use rtc->ops_lock instead.  rtc->ops_lock is held when
> > most
> >
> >     of rtc_class_ops methods are called, so we only need to explicitly
> >
> >     acquire it from irq handler in order to protect form concurrent
> >
> >     accesses.
> >
> >
> >
> >     Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
> >
> > Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com
> >
> >
> >
> > The problem is that rtc->ops_lock would be accessed in ds3232_irq()
> >
> > without being initialized as rtc_device_register() is called too late.
> 
> You have already identified the root cause of this issue.
> 
> > As I’m not familiar with rtc things, could I just revert the patch or
> > you already
> >
> > have a solution to this problem? Thanks in advance.
> 
> Could you check if the problem is resolved by moving the call of
> devm_rtc_device_register() from the end of ds3232_probe() to just before
> registering irq handler?

Yes. It works(no call trace now). 

Regards,
Qianyu

[toc] | [prev] | [next] | [standalone]


#1382150

FromAkinobu Mita <akinobu.mita@gmail.com>
Date2016-04-19 06:00 +0200
Message-ID<rpuZs-oc-9@gated-at.bofh.it>
In reply to#1382141
2016-04-19 11:36 GMT+09:00 Qianyu Gong <qianyu.gong@nxp.com>:
>
>> -----Original Message-----
>> From: Akinobu Mita [mailto:akinobu.mita@gmail.com]
>> Sent: Monday, April 18, 2016 9:02 PM
>> To: Qianyu Gong <qianyu.gong@nxp.com>
>> Cc: alexandre.belloni@free-electrons.com; Mingkai Hu <mingkai.hu@nxp.com>;
>> rtc-linux@googlegroups.com; linux-kernel@vger.kernel.org
>> Subject: Re: rtc ds3232 call trace in kernel
>>
>> 2016-04-18 15:15 GMT+09:00 Qianyu Gong <qianyu.gong@nxp.com>:
>> > Hi Akinobu,
>> >
>> >
>> >
>> > I got an rtc call trace when booting 4.6 kernel on our board and I
>> > found it
>> >
>> > was caused by this patch:
>> >
>> >
>> >
>> > commit fc1dcb0b39dbb10d3290f2fcd6e154670f699166
>> >
>> > Author: Akinobu Mita <akinobu.mita@gmail.com>
>> >
>> > Date:   Mon Mar 7 00:27:53 2016 +0900
>> >
>> >
>> >
>> >     rtc: ds3232: use rtc->ops_lock to protect alarm operations
>> >
>> >
>> >
>> >     ds3232->mutex is used to protect for alarm operations which
>> >
>> >     need to access status and control registers.
>> >
>> >
>> >
>> >     But we can use rtc->ops_lock instead.  rtc->ops_lock is held when
>> > most
>> >
>> >     of rtc_class_ops methods are called, so we only need to explicitly
>> >
>> >     acquire it from irq handler in order to protect form concurrent
>> >
>> >     accesses.
>> >
>> >
>> >
>> >     Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
>> >
>> > Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com
>> >
>> >
>> >
>> > The problem is that rtc->ops_lock would be accessed in ds3232_irq()
>> >
>> > without being initialized as rtc_device_register() is called too late.
>>
>> You have already identified the root cause of this issue.
>>
>> > As I’m not familiar with rtc things, could I just revert the patch or
>> > you already
>> >
>> > have a solution to this problem? Thanks in advance.
>>
>> Could you check if the problem is resolved by moving the call of
>> devm_rtc_device_register() from the end of ds3232_probe() to just before
>> registering irq handler?
>
> Yes. It works(no call trace now).

Thanks for testing.  Do you mind submitting your patch to
rtc-linux@googlegroups.com ?

[toc] | [prev] | [next] | [standalone]


#1382154

FromQianyu Gong <qianyu.gong@nxp.com>
Date2016-04-19 06:20 +0200
Message-ID<rpviN-NL-3@gated-at.bofh.it>
In reply to#1382150
> -----Original Message-----
> From: Akinobu Mita [mailto:akinobu.mita@gmail.com]
> Sent: Tuesday, April 19, 2016 11:58 AM
> To: Qianyu Gong <qianyu.gong@nxp.com>
> Cc: alexandre.belloni@free-electrons.com; Mingkai Hu <mingkai.hu@nxp.com>;
> rtc-linux@googlegroups.com; linux-kernel@vger.kernel.org
> Subject: Re: rtc ds3232 call trace in kernel
> 
> 2016-04-19 11:36 GMT+09:00 Qianyu Gong <qianyu.gong@nxp.com>:
> >
> >> -----Original Message-----
> >> From: Akinobu Mita [mailto:akinobu.mita@gmail.com]
> >> Sent: Monday, April 18, 2016 9:02 PM
> >> To: Qianyu Gong <qianyu.gong@nxp.com>
> >> Cc: alexandre.belloni@free-electrons.com; Mingkai Hu
> >> <mingkai.hu@nxp.com>; rtc-linux@googlegroups.com;
> >> linux-kernel@vger.kernel.org
> >> Subject: Re: rtc ds3232 call trace in kernel
> >>
> >> 2016-04-18 15:15 GMT+09:00 Qianyu Gong <qianyu.gong@nxp.com>:
> >> > Hi Akinobu,
> >> >
> >> >
> >> >
> >> > I got an rtc call trace when booting 4.6 kernel on our board and I
> >> > found it
> >> >
> >> > was caused by this patch:
> >> >
> >> >
> >> >
> >> > commit fc1dcb0b39dbb10d3290f2fcd6e154670f699166
> >> >
> >> > Author: Akinobu Mita <akinobu.mita@gmail.com>
> >> >
> >> > Date:   Mon Mar 7 00:27:53 2016 +0900
> >> >
> >> >
> >> >
> >> >     rtc: ds3232: use rtc->ops_lock to protect alarm operations
> >> >
> >> >
> >> >
> >> >     ds3232->mutex is used to protect for alarm operations which
> >> >
> >> >     need to access status and control registers.
> >> >
> >> >
> >> >
> >> >     But we can use rtc->ops_lock instead.  rtc->ops_lock is held
> >> > when most
> >> >
> >> >     of rtc_class_ops methods are called, so we only need to
> >> > explicitly
> >> >
> >> >     acquire it from irq handler in order to protect form concurrent
> >> >
> >> >     accesses.
> >> >
> >> >
> >> >
> >> >     Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
> >> >
> >> > Signed-off-by: Alexandre Belloni
> >> > <alexandre.belloni@free-electrons.com
> >> >
> >> >
> >> >
> >> > The problem is that rtc->ops_lock would be accessed in ds3232_irq()
> >> >
> >> > without being initialized as rtc_device_register() is called too late.
> >>
> >> You have already identified the root cause of this issue.
> >>
> >> > As I’m not familiar with rtc things, could I just revert the patch
> >> > or you already
> >> >
> >> > have a solution to this problem? Thanks in advance.
> >>
> >> Could you check if the problem is resolved by moving the call of
> >> devm_rtc_device_register() from the end of ds3232_probe() to just
> >> before registering irq handler?
> >
> > Yes. It works(no call trace now).
> 
> Thanks for testing.  Do you mind submitting your patch to rtc-
> linux@googlegroups.com ?

No problem.:)

Regards,
Qianyu

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web