Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752483AbcDSCyI (ORCPT ); Mon, 18 Apr 2016 22:54:08 -0400 Received: from mail-am1on0070.outbound.protection.outlook.com ([157.56.112.70]:61984 "EHLO emea01-am1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751943AbcDSCyG convert rfc822-to-8bit (ORCPT ); Mon, 18 Apr 2016 22:54:06 -0400 From: Qianyu Gong To: Alexandre Belloni CC: "akinobu.mita@gmail.com" , Mingkai Hu , "rtc-linux@googlegroups.com" , "linux-kernel@vger.kernel.org" Subject: RE: rtc ds3232 call trace in kernel Thread-Topic: rtc ds3232 call trace in kernel Thread-Index: AdGZMiaPR50pSmJwQj23G58uRE4gmQAXEM+AABVzz1A= Date: Tue, 19 Apr 2016 02:54:01 +0000 Message-ID: References: <20160418162151.GR25196@piout.net> In-Reply-To: <20160418162151.GR25196@piout.net> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: free-electrons.com; dkim=none (message not signed) header.d=none;free-electrons.com; dmarc=none action=none header.from=nxp.com; x-originating-ip: [123.151.195.53] x-ms-office365-filtering-correlation-id: 09905e7a-bcca-48b2-b4c8-08d367fddc84 x-microsoft-exchange-diagnostics: 1;AM3PR04MB1441;5:WJP+hMYCtZHmSVlS+2ygOmnYiOz7gyP3JGvq8ccJb7MTiayuH5UyScsYz7LP61q+BnUsWUYBMdF7JjsJs11sLD0OUBMybcCWSXA3zcFzp4PIA4q6paO8s7wWo9hUIn8W86ZlEw8Ix1YB1YdUFacV265r/lue80ebO1hchfDd8Y8VnrNLW0FY+EDeFX0ipyv3;24:1U/Bt7Wwvmx9gpQVYROs8VSIKStD/r3a1KU4adG7VH2X95qOiW7ieGDPXR4SOtHrBY4Ppx10d3m75nHORMpaXBQMjzW4G+eOQTlou7PX6ck=;7:aCiB1FvN0bK0Vz3OLDqczQ42Bg+0FzMOdXSn/FEnAO/ccEeiZAfvhpbPSh/HTKn7dWihP0egnGiR+9KDLawUZgSfjYHJWYpPkVJshSFYw6OSXRauNxb083J4RgTc+E+sWiMiz6MXllukdOPR5hNUymrp58qh4Locv08T+eywafT5TpBf5wkoqG+WtS4e9OBbSDmxu06MhM7u/QE1781xy7JJB3vLWLsPdZzMDmQ3shw= x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:AM3PR04MB1441; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(9101521026)(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001)(6055026);SRVR:AM3PR04MB1441;BCL:0;PCL:0;RULEID:;SRVR:AM3PR04MB1441; x-forefront-prvs: 0917DFAC67 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(979002)(6009001)(51874003)(13464003)(377454003)(16601075003)(3846002)(2906002)(102836003)(6116002)(3660700001)(1220700001)(76576001)(33656002)(3280700002)(1096002)(81166005)(586003)(9686002)(4326007)(10400500002)(5003600100002)(110136002)(19580395003)(74316001)(87936001)(5002640100001)(92566002)(189998001)(77096005)(15975445007)(5008740100001)(66066001)(2900100001)(2950100001)(76176999)(54356999)(5004730100002)(50986999)(122556002)(19580405001)(11100500001)(86362001)(575784001)(969003)(989001)(999001)(1009001)(1019001);DIR:OUT;SFP:1101;SCL:1;SRVR:AM3PR04MB1441;H:AM2PR04MB0964.eurprd04.prod.outlook.com;FPR:;SPF:None;MLV:ovrnspm;PTR:InfoNoRecords;LANG:en; spamdiagnosticoutput: 1:23 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Apr 2016 02:54:01.1880 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM3PR04MB1441 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2053 Lines: 56 > -----Original Message----- > From: Alexandre Belloni [mailto:alexandre.belloni@free-electrons.com] > Sent: Tuesday, April 19, 2016 12:22 AM > To: Qianyu Gong > Cc: akinobu.mita@gmail.com; Mingkai Hu ; 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 > > 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 > > Signed-off-by: Alexandre Belloni > > > 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