Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752398AbcDSD6I (ORCPT ); Mon, 18 Apr 2016 23:58:08 -0400 Received: from mail-vk0-f67.google.com ([209.85.213.67]:36671 "EHLO mail-vk0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751905AbcDSD6F convert rfc822-to-8bit (ORCPT ); Mon, 18 Apr 2016 23:58:05 -0400 MIME-Version: 1.0 In-Reply-To: References: Date: Tue, 19 Apr 2016 12:58:03 +0900 Message-ID: Subject: Re: rtc ds3232 call trace in kernel From: Akinobu Mita To: Qianyu Gong Cc: "alexandre.belloni@free-electrons.com" , Mingkai Hu , "rtc-linux@googlegroups.com" , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2169 Lines: 76 2016-04-19 11:36 GMT+09:00 Qianyu Gong : > >> -----Original Message----- >> From: Akinobu Mita [mailto:akinobu.mita@gmail.com] >> Sent: Monday, April 18, 2016 9:02 PM >> To: Qianyu Gong >> Cc: alexandre.belloni@free-electrons.com; Mingkai Hu ; >> 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 : >> > 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. >> >> 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 ?