Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp10402740ybi; Wed, 24 Jul 2019 22:34:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqyUtFHRB5eTBLDyXueBHUmFsfFFmDTJeH/LqOTG0IjeJzKdy2LOzQP/SwXhMiI0S2S6g1cd X-Received: by 2002:aa7:989a:: with SMTP id r26mr3351619pfl.232.1564032861351; Wed, 24 Jul 2019 22:34:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564032861; cv=none; d=google.com; s=arc-20160816; b=eU68zKCFCVzF+OgrfJkxRwpsyCuQIYlQy+2674kdV9P6PJ/HHgDQ3gpn0hTdlcFJtZ IxbczK5b1re7IUsPAWXJ35zPe13zsUtwhCGX51c8T9G+RKn5FOPgRuzgFt4MIn1unY+G NX8juL+KzEFY/BEO0WQU/lwrqOeY5xdzPBPdNE4NnWls51GvNCytCMVtQXA3ZQ869U+a jNiWNUsTlxsKc6J+ySVkYfR6g6L1gaB6Rra8+IGdAIxH8OSJoS6PTLb9wHW9IxgUcmbC wyzG31yZYvYxjqw1vTF8tTGFhdLp7JKBmY56r3uAgfvboCDjxxp8UqChUh1cNebQWoDf mUYg== 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=IKcA1awLzyt+Yn5WeGIsUQJXppMC/nIPQ3yiBHWwVXA=; b=pw96/7aYjMNa9o035R1StvOEq8YjbMF6UM7W9JChxzVbj+v8s3vS9ENeMCZCMZgnMt 4sLSKkp3k6ySFx/csn8uPZ2RO9wq3rFidr7V17Rq3eidKRm+4DSsSkUctNhEdS2rby5/ k+dTuaXb2QpBcG8Mij6hhiiJcDLBrKm9no+e2/GaulkbPb4RyZyea5G8/wwmv1Q4YYzb Kg5jc3vh8E7LNo+iopB0WUd2EF1/NKaxsW0YWSxlmDlrFRw9l9fB99GZXDgdoDKkiTid a6y5HtKf8UpM6U2mmMcH/kt6KD7LfYVCAFm17xVNhgeuJioMHzPIDFqaBl9GnOGL1+ry sMsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=rl6hlPgz; 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 u1si14325517plb.234.2019.07.24.22.33.30; Wed, 24 Jul 2019 22:34:21 -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=@kernel.org header.s=default header.b=rl6hlPgz; 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 S2404002AbfGXTyF (ORCPT + 99 others); Wed, 24 Jul 2019 15:54:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:36734 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404266AbfGXTyA (ORCPT ); Wed, 24 Jul 2019 15:54:00 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 AACFB22ADC; Wed, 24 Jul 2019 19:53:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1563998040; bh=dWZOKqVtBakxRyBVHEfpZ4h5+T0PPtBUpO8yzT8U9ec=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rl6hlPgz8vH3pQo0Yu/iK0vdZ0fsL7bw9HtQYb2u00BkITqiRgm7bHn4UMBd6/v55 lSumTjZFnqBquOGBDW7X+Ydfn8ea7vR2ogAumH2vWZjwgwjONAxin+hlIEYySwzfMb dcISbNFHJz6Pt1ujEeCkxfCGw7jfWtZROv01pw0Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shijith Thotton , Thomas Gleixner , Sasha Levin Subject: [PATCH 5.1 208/371] genirq: Update irq stats from NMI handlers Date: Wed, 24 Jul 2019 21:19:20 +0200 Message-Id: <20190724191740.214761202@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190724191724.382593077@linuxfoundation.org> References: <20190724191724.382593077@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 [ Upstream commit c09cb1293523dd786ae54a12fd88001542cba2f6 ] 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 Signed-off-by: Sasha Levin --- 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 04fe4f989bd8..bfac4d6761b3 100644 --- a/kernel/irq/chip.c +++ b/kernel/irq/chip.c @@ -754,6 +754,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. @@ -968,6 +970,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 9f8a709337cf..8a93df71673d 100644 --- a/kernel/irq/irqdesc.c +++ b/kernel/irq/irqdesc.c @@ -945,6 +945,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 @@ -962,7 +967,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) -- 2.20.1