Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp2273554ybd; Mon, 24 Jun 2019 03:43:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqyaHutObA1uryWp86030eqpjggc4RLDyzzxd8bZiDYSD39O51P1tlrAayXnTRp/E/NVqP/R X-Received: by 2002:a17:90a:bb94:: with SMTP id v20mr24370501pjr.88.1561373003806; Mon, 24 Jun 2019 03:43:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561373003; cv=none; d=google.com; s=arc-20160816; b=kP+GsPfL81FrORTWJQDPEQFX8ISx6kQw9KCX+zUOXSVf+z3I28WLpZpWVE8Rc/12KB dbB3FCJ2y0IAFmld9+0/ySUMSuW0cyN/kzvXBY3ZQz73PtfY9ql2b+60WP3MIsAB58A7 bg4ligvmFXde32ltFaNtRH98lm/3UiO0SIi5HnZ/zduCsYSqZthM06CRXS04lpPdpaBE KYtmAO+nUAtWqF3CZFdTkTI37b2qfnJ6/t9u1+imgqLS714Y0dYpFolixS+9f5nmgd8h R185zTY8bSj4MLSsjIycThuXB2sqX52a+i8TBsupUZKUoVrC+8W00LQBOyDeCgQYE5Ky nGFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=ueXeCHRXgTPYs/LzO/VlUX3daHyWEkSIqBzPfisDqTw=; b=u/Gh84u6LAuXq+i4wn8vUGDU9yGpnauP17/WltjjEPo3osdOUfTlVb60MT2RE8vdcV jm9R0LnSXzsWmqwpbP58TcP9yjD4XjT1wKsQjmlWzpitNI+735x5MqOCCWm/tABRq4Zz tupy/CnqiEF8UV2Vl3ZyRHRpTpE05IfwqxF9ynPE/wyjsBvAO2XD6kUlcJpVOq7tGC2/ 9Z46b0MnDBWgc6a8Qd67csKHrvotT8HRXmKZ08SmYssQkIAO+/AOZamGkOEFqCZI/rkD C3opVxXfSanrZomQvtN+CyeFSIGOPMu7etKDSgVbSwAMKP5fsVuygqLJ/wMqxCD21vQ7 fthA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q19si9295184pgv.31.2019.06.24.03.43.08; Mon, 24 Jun 2019 03:43:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729380AbfFXKmp (ORCPT + 99 others); Mon, 24 Jun 2019 06:42:45 -0400 Received: from relay11.mail.gandi.net ([217.70.178.231]:57125 "EHLO relay11.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728676AbfFXKmp (ORCPT ); Mon, 24 Jun 2019 06:42:45 -0400 Received: from localhost (alyon-656-1-672-152.w92-137.abo.wanadoo.fr [92.137.69.152]) (Authenticated sender: alexandre.belloni@bootlin.com) by relay11.mail.gandi.net (Postfix) with ESMTPSA id BE47B100005; Mon, 24 Jun 2019 10:42:38 +0000 (UTC) Date: Mon, 24 Jun 2019 12:42:34 +0200 From: Alexandre Belloni To: Chen-Yu Tsai Cc: Maxime Ripard , Alessandro Zummo , Vincent Donnefort , linux-rtc@vger.kernel.org, devicetree , linux-arm-kernel , linux-kernel Subject: Re: [PATCH 0/3] rtc: pcf8563: Fix unhandled interrupt storm Message-ID: <20190624104234.GG3133@piout.net> References: <20190604042337.26129-1-wens@kernel.org> <20190620162220.GA23549@piout.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.0 (2019-05-25) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 24/06/2019 18:34:29+0800, Chen-Yu Tsai wrote: > On Fri, Jun 21, 2019 at 12:22 AM Alexandre Belloni > wrote: > > > > On 04/06/2019 12:23:34+0800, Chen-Yu Tsai wrote: > > > From: Chen-Yu Tsai > > > > > > Hi everyone, > > > > > > While bringing up my Pine H64, I encountered an interrupt storm from the > > > pcf8563 RTC. The RTC chip's interrupt line is shared with the PMIC, and > > > was not properly added to the device tree. Also, the driver was using an > > > trigger method incompatible with the PMIC, preventing the interrupt line > > > from being shared. Last, the driver only clears and masks the alarm > > > interrupt, while leaving the timer interrupt untouched. This is a > > > problem if previous systems left the timer interrupt enabled, and there > > > was an interrupt pending. > > > > > > This patch set fixes all three issues, one per patch. > > > > > > Please have a look. > > > > > > > I don't have that particular RTC so I can't test but the interrupt > > handling in pcf8563_irq seems problematic too. I guess the RTC will only > > trigger once per second because the call to pcf8563_set_alarm_mode will > > explicitely leave the alarm enabled. The core doesn't really care but it > > doesn't really expect the alarm to stay enabled. i.e. It will ensure the > > alarm is enabled again after setting it when necessary. I think it would > > be safer to simply clear both AIE and AF here. Could you test? > > Yeah, that bit looked weird to me as well. And actually the alarm doesn't > go down to the second, only the minute. > > Is there a test program I can use to test the alarms? > Sure, tools/testing/selftests/rtc/rtctest.c if you use a recent enough version, it will test minute boundaries. -- Alexandre Belloni, Bootlin Embedded Linux and Kernel engineering https://bootlin.com