Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp4276121ybi; Sat, 6 Jul 2019 01:45:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqydAwDfJG9yCuK7TvzW135QrLPotvPBNJwUOBh5ikkC1pohnnpIIdwA0ftz5W7IKexbQkH1 X-Received: by 2002:a63:60c8:: with SMTP id u191mr9331281pgb.401.1562402712848; Sat, 06 Jul 2019 01:45:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562402712; cv=none; d=google.com; s=arc-20160816; b=irUa8E7wPurlQJPoYJqtvL7Ea2NmBiHt9r+2JuVaCXT7KW2cVhBC74k6yAG45xcBXe +7EWodfcb8YDR88atulTXN+lC6PBhyoSpCut6AysI0WvPfmqU6dby7q0cFEXHb6orUt9 HFGK4zhwWCiupB7WZtpiRZfzDPqTQyEtS7qtmDbvlCS9q/gPxge/HwjjcvCV8M962sGn D9LgUXg/mNtVNH+8YqEYA0wVNgduQs4czrU3ioWR8wtDCEP0jS5ruj9oCN1w1VUSLtxT 073rA8EphVNor7JvfoSYtCKzaz9qq8q9cy8Zh5YY3zO5agfqvpVZWud6cqSnRg7xWDke y4sQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date:dkim-signature:dkim-filter; bh=Uo4rkYrgZmi4bhQTRyfMXE8q9YNR3nRwhlV+/Wf6dYM=; b=oxsa3tpAVZxHIXOoUIcmyins1Dlwqr3AkxXmje/fdrLPTEkAPTaKos3fD273Wq8PZT OfO3MG4ar8O6mxG1NUaWyF1G+6GztOb9MDfXk8BtnG/WFjvsnVuKOtHjwVHaznotJTQy mUkpBZTSOyyVEGXxo5rulhCGNqgpgWdq94CrHpQ5fEn/CiC7u+vV8oPpdNo8BdoL2bAY D47gM5N+lq41ObeUAMG2y0sJAEQuVWnijgAoNjIPzcTFmB70UjuacrFV4kOx//cGeL2G PqM7lk6ma0g41aMSAhL/8Pwvph6y3UjnWcO5b3scvwjAeBK5HTUbwdzlTJOpHPJAWvTX W/Ug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zytor.com header.s=2019061801 header.b=sAkBH4wT; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zytor.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v10si11471875plg.320.2019.07.06.01.44.55; Sat, 06 Jul 2019 01:45:12 -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; dkim=pass header.i=@zytor.com header.s=2019061801 header.b=sAkBH4wT; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zytor.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726065AbfGFInP (ORCPT + 99 others); Sat, 6 Jul 2019 04:43:15 -0400 Received: from terminus.zytor.com ([198.137.202.136]:46223 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725934AbfGFInP (ORCPT ); Sat, 6 Jul 2019 04:43:15 -0400 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTPS id x668h4HP351377 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Sat, 6 Jul 2019 01:43:04 -0700 DKIM-Filter: OpenDKIM Filter v2.11.0 terminus.zytor.com x668h4HP351377 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zytor.com; s=2019061801; t=1562402585; bh=Uo4rkYrgZmi4bhQTRyfMXE8q9YNR3nRwhlV+/Wf6dYM=; h=Date:From:Cc:Reply-To:In-Reply-To:References:To:Subject:From; b=sAkBH4wTQf904dGRI6IP1F/6vvDIAP/MjfERem12V6BWCXLDq1TM0dJ9GGekmnqXO /yEO8MPLPMTcRq/ZaTXln362oPPS8J7LevO6DtbxVvfL5sy7lrs2vy0d1iBMDctQ0e FYwjyGqSfpEn7ONmsWravPcn2VqkMkZN308rRziMi0IYjmcrrVPSPn631OxP/5PiyZ kJGnY2Xzk4pFpOIm9LATtttgdZznmnfMzp3zwShxBM+TwdpTKWX94x0HTAjR+A1YN/ OuhZS2dNbKtrhOPBkT2Y86iaU4Z19h/5+6XTE9KlvBzzEItZsZek6GHQKYeOEPH55v cAhz5AV1Kxs8Q== Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id x668h4Z1351374; Sat, 6 Jul 2019 01:43:04 -0700 Date: Sat, 6 Jul 2019 01:43:04 -0700 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Shijith Thotton Message-ID: Cc: tglx@linutronix.de, linux-kernel@vger.kernel.org, mingo@kernel.org, hpa@zytor.com, sthotton@marvell.com Reply-To: tglx@linutronix.de, linux-kernel@vger.kernel.org, mingo@kernel.org, hpa@zytor.com, sthotton@marvell.com In-Reply-To: <1562313336-11888-1-git-send-email-sthotton@marvell.com> References: <1562313336-11888-1-git-send-email-sthotton@marvell.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:irq/core] genirq: Update irq stats from NMI handlers Git-Commit-ID: c09cb1293523dd786ae54a12fd88001542cba2f6 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=-1.2 required=5.0 tests=ALL_TRUSTED,BAYES_00, DATE_IN_FUTURE_06_12,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU, DKIM_VALID_EF autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: c09cb1293523dd786ae54a12fd88001542cba2f6 Gitweb: https://git.kernel.org/tip/c09cb1293523dd786ae54a12fd88001542cba2f6 Author: Shijith Thotton AuthorDate: Fri, 5 Jul 2019 07:56:20 +0000 Committer: Thomas Gleixner CommitDate: Sat, 6 Jul 2019 10:40:19 +0200 genirq: Update irq stats from NMI handlers The NMI handlers handle_percpu_devid_fasteoi_nmi() and handle_fasteoi_nmi() do not update the interrupt counts. Due to that the NMI interrupt count does not show up correctly in /proc/interrupts. Add the statistics and treat the NMI handlers in the same way as per cpu interrupts and prevent them from updating irq_desc::tot_count as this might be corrupted due to concurrency. [ tglx: Massaged changelog ] Fixes: 2dcf1fbcad35 ("genirq: Provide NMI handlers") Signed-off-by: Shijith Thotton Signed-off-by: Thomas Gleixner Link: https://lkml.kernel.org/r/1562313336-11888-1-git-send-email-sthotton@marvell.com --- kernel/irq/chip.c | 4 ++++ kernel/irq/irqdesc.c | 8 +++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c index 29d6c7d070b4..04c850fb70cb 100644 --- a/kernel/irq/chip.c +++ b/kernel/irq/chip.c @@ -748,6 +748,8 @@ void handle_fasteoi_nmi(struct irq_desc *desc) unsigned int irq = irq_desc_get_irq(desc); irqreturn_t res; + __kstat_incr_irqs_this_cpu(desc); + trace_irq_handler_entry(irq, action); /* * NMIs cannot be shared, there is only one action. @@ -962,6 +964,8 @@ void handle_percpu_devid_fasteoi_nmi(struct irq_desc *desc) unsigned int irq = irq_desc_get_irq(desc); irqreturn_t res; + __kstat_incr_irqs_this_cpu(desc); + trace_irq_handler_entry(irq, action); res = action->handler(irq, raw_cpu_ptr(action->percpu_dev_id)); trace_irq_handler_exit(irq, action, res); diff --git a/kernel/irq/irqdesc.c b/kernel/irq/irqdesc.c index c52b737ab8e3..9149dde5a7b0 100644 --- a/kernel/irq/irqdesc.c +++ b/kernel/irq/irqdesc.c @@ -946,6 +946,11 @@ unsigned int kstat_irqs_cpu(unsigned int irq, int cpu) *per_cpu_ptr(desc->kstat_irqs, cpu) : 0; } +static bool irq_is_nmi(struct irq_desc *desc) +{ + return desc->istate & IRQS_NMI; +} + /** * kstat_irqs - Get the statistics for an interrupt * @irq: The interrupt number @@ -963,7 +968,8 @@ unsigned int kstat_irqs(unsigned int irq) if (!desc || !desc->kstat_irqs) return 0; if (!irq_settings_is_per_cpu_devid(desc) && - !irq_settings_is_per_cpu(desc)) + !irq_settings_is_per_cpu(desc) && + !irq_is_nmi(desc)) return desc->tot_count; for_each_possible_cpu(cpu)