mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Qianyu Gong <qianyu.gong@nxp.com>
To: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Cc: "akinobu.mita@gmail.com" <akinobu.mita@gmail.com>,
	Mingkai Hu <mingkai.hu@nxp.com>,
	"rtc-linux@googlegroups.com" <rtc-linux@googlegroups.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: rtc ds3232 call trace in kernel
Date: Tue, 19 Apr 2016 02:54:01 +0000	[thread overview]
Message-ID: <AM2PR04MB0964DB6638272AE6BC28FD56E76C0@AM2PR04MB0964.eurprd04.prod.outlook.com> (raw)
In-Reply-To: <20160418162151.GR25196@piout.net>


> -----Original Message-----
> From: Alexandre Belloni [mailto:alexandre.belloni@free-electrons.com]
> Sent: Tuesday, April 19, 2016 12:22 AM
> To: Qianyu Gong <qianyu.gong@nxp.com>
> Cc: akinobu.mita@gmail.com; Mingkai Hu <mingkai.hu@nxp.com>; rtc-
> linux@googlegroups.com; linux-kernel@vger.kernel.org
> Subject: Re: rtc ds3232 call trace in kernel
> 
> On 18/04/2016 at 06:15:40 +0000, Qianyu Gong wrote :
> > 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.
> >
> > 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.
> >
> >
> 
> Well, many RTC drivers actually suffer from that. I'm planning to change the
> infrastructure to handle this case better.
> Meanwhile, this is worth fixing.
> 
> 
> --
> Alexandre Belloni, Free Electrons
> Embedded Linux, Kernel and Android engineering http://free-electrons.com

Thanks. I followed Akinobu's suggest and put devm_rtc_device_register() just
before registering the irq handler. The call trace disappeared. Looks like it's 
working well.


Regards,
Qianyu

      reply	other threads:[~2016-04-19  2:54 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <AM2PR04MB09643A16272FB78B0D9FA103E76B0@AM2PR04MB0964.eurprd04.prod.outlook.com>
2016-04-18 13:02 ` Akinobu Mita
2016-04-19  2:36   ` Qianyu Gong
2016-04-19  3:58     ` Akinobu Mita
2016-04-19  4:11       ` Qianyu Gong
2016-04-18 16:21 ` Alexandre Belloni
2016-04-19  2:54   ` Qianyu Gong [this message]

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=AM2PR04MB0964DB6638272AE6BC28FD56E76C0@AM2PR04MB0964.eurprd04.prod.outlook.com \
    --to=qianyu.gong@nxp.com \
    --cc=akinobu.mita@gmail.com \
    --cc=alexandre.belloni@free-electrons.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingkai.hu@nxp.com \
    --cc=rtc-linux@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
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

all inboxes | Powered by JetHome®