Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp679367ybv; Thu, 13 Feb 2020 07:38:43 -0800 (PST) X-Google-Smtp-Source: APXvYqzpJka1qGqzAekF9AfApyEsq2NI9OEjueDeqUt4YmVq/0qa4NyoWjpwfZhpGfLfPKUeOFUJ X-Received: by 2002:a05:6830:1289:: with SMTP id z9mr14224713otp.317.1581608323609; Thu, 13 Feb 2020 07:38:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581608323; cv=none; d=google.com; s=arc-20160816; b=FoW55D/Bw2jx2T1qt7iYeJGPQPhmUO8fQyheMTPga+HFzqDuzUKbQeczFsQyUQs0RW QTAhJpQ8zfUdB7QhBEPNUVWsjxVrNMG3SCN8nCeEQGpEOP6XqbWsJqL6CDo9e5LRkLsb kK00Dn6SKv6dC++fFE3Q7wwBeFjyhj6QuIJlJnslsg1vZuj2G9Q5OxHDudKCKfnfOwB+ IdzwY/cDU/HrZoe1TUXdQGxhzgx6QZWF2pObAL3xRurPLil7r0kHOXZCkDP5wGd+2QKU FVWpECXAJorcqOYdUTSNJkC4viKjUFzmS3tN04+ZNKujq42EWq2OBAkCQvOm+xej4jGY ckfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=BIwp9v3GVZKotnp7S+Y4pLGAJTnYD7WP1/8aPRG9zLg=; b=U4NII8MwbwiZ5pFYtL2C9RyFLFqq1Y/RRxTGTruqlnmgHFBLcM7eyKoGihxHz87P5M iTYDudCxo78DajQyrh57mPnxyXJAGWoCVdeDlFTwTw6ag3qmwVJgd6XaVBUADE3IAuCg l2NPxq5Yv7QWcQ5lI0ErMLe/Rj6HFfbnZ4eJRWCXWltNh9muO44wscEK2eT2WMw4hZGL m2a8GaW8PxgyAVSkpqOjUZRYVfbnR2EgYojEg+P8Gi1YWJQQt4yiz7yrajUpc3TTJFno GWgCcmTQiKkMjOMX9q/UDkBRpG6HD85O/Asgt9359GAWXgxWiMPTLP3FGcVM2LxukUIq Av4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=1KSrhSXA; 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 q25si1400936otg.128.2020.02.13.07.38.31; Thu, 13 Feb 2020 07:38:43 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=default header.b=1KSrhSXA; 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 S1729576AbgBMP3d (ORCPT + 99 others); Thu, 13 Feb 2020 10:29:33 -0500 Received: from mail.kernel.org ([198.145.29.99]:46746 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729217AbgBMP0m (ORCPT ); Thu, 13 Feb 2020 10:26:42 -0500 Received: from localhost (unknown [104.132.1.104]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7D63E20661; Thu, 13 Feb 2020 15:26:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581607601; bh=ZpcbW6ebGxl7BPjUEXVKVR61gFMocjAh4dAkTRP96CE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1KSrhSXAx3hQSZbCIVk6q4VC2aQcOssWN3ARSS6PlT2/LVqKvMt2eRIk2e0GZ6Kx8 cdh1ANtcN9qfOVWJCZCUWIPLU5Oktr8ZlYkYV2ANdGzxwKMVi2Z0bA0GCFA/+UBx7F RhrKOROqOxqBJG72etEzD+j+VjPEU7TmKP3DiRfI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Guilherme G. Piccoli" , Hans de Goede , Andy Shevchenko , Alexandre Belloni Subject: [PATCH 4.19 21/52] rtc: cmos: Stop using shared IRQ Date: Thu, 13 Feb 2020 07:21:02 -0800 Message-Id: <20200213151819.319695169@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200213151810.331796857@linuxfoundation.org> References: <20200213151810.331796857@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andy Shevchenko commit b6da197a2e9670df6f07e6698629e9ce95ab614e upstream. As reported by Guilherme G. Piccoli: ---8<---8<---8<--- The rtc-cmos interrupt setting was changed in the commit 079062b28fb4 ("rtc: cmos: prevent kernel warning on IRQ flags mismatch") in order to allow shared interrupts; according to that commit's description, some machine got kernel warnings due to the interrupt line being shared between rtc-cmos and other hardware, and rtc-cmos didn't allow IRQ sharing that time. After the aforementioned commit though it was observed a huge increase in lost HPET interrupts in some systems, observed through the following kernel message: [...] hpet1: lost 35 rtc interrupts After investigation, it was narrowed down to the shared interrupts usage when having the kernel option "irqpoll" enabled. In this case, all IRQ handlers are called for non-timer interrupts, if such handlers are setup in shared IRQ lines. The rtc-cmos IRQ handler could be set to hpet_rtc_interrupt(), which will produce the kernel "lost interrupts" message after doing work - lots of readl/writel to HPET registers, which are known to be slow. Although "irqpoll" is not a default kernel option, it's used in some contexts, one being the kdump kernel (which is an already "impaired" kernel usually running with 1 CPU available), so the performance burden could be considerable. Also, the same issue would happen (in a shorter extent though) when using "irqfixup" kernel option. In a quick experiment, a virtual machine with uptime of 2 minutes produced >300 calls to hpet_rtc_interrupt() when "irqpoll" was set, whereas without sharing interrupts this number reduced to 1 interrupt. Machines with more hardware than a VM should generate even more unnecessary HPET interrupts in this scenario. ---8<---8<---8<--- After looking into the rtc-cmos driver history and DSDT table from the Microsoft Surface 3, we may notice that Hans de Goede submitted a correct fix (see dependency below). Thus, we simply revert the culprit commit. Fixes: 079062b28fb4 ("rtc: cmos: prevent kernel warning on IRQ flags mismatch") Depends-on: a1e23a42f1bd ("rtc: cmos: Do not assume irq 8 for rtc when there are no legacy irqs") Reported-by: Guilherme G. Piccoli Cc: Hans de Goede Signed-off-by: Andy Shevchenko Tested-by: Guilherme G. Piccoli Reviewed-by: Hans de Goede Link: https://lore.kernel.org/r/20200123131437.28157-1-andriy.shevchenko@linux.intel.com Signed-off-by: Alexandre Belloni Signed-off-by: Greg Kroah-Hartman --- drivers/rtc/rtc-cmos.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/rtc/rtc-cmos.c +++ b/drivers/rtc/rtc-cmos.c @@ -854,7 +854,7 @@ cmos_do_probe(struct device *dev, struct rtc_cmos_int_handler = cmos_interrupt; retval = request_irq(rtc_irq, rtc_cmos_int_handler, - IRQF_SHARED, dev_name(&cmos_rtc.rtc->dev), + 0, dev_name(&cmos_rtc.rtc->dev), cmos_rtc.rtc); if (retval < 0) { dev_dbg(dev, "IRQ %d is already in use\n", rtc_irq);