lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 4 Jul 2019 08:13:51 +0100
From:   Julien Thierry <julien.thierry@....com>
To:     Shijith Thotton <sthotton@...vell.com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "linux-arm-kernel@...ts.infradead.org" 
        <linux-arm-kernel@...ts.infradead.org>
Cc:     Thomas Gleixner <tglx@...utronix.de>,
        Catalin Marinas <catalin.marinas@....com>,
        Will Deacon <will.deacon@....com>,
        Jayachandran Chandrasekharan Nair <jnair@...vell.com>,
        Ganapatrao Kulkarni <gkulkarni@...vell.com>,
        Jan Glauber <jglauber@...vell.com>,
        Robert Richter <rrichter@...vell.com>
Subject: Re: [PATCH] genirq: update irq stats from NMI handlers

Hi Shijith,

On 04/07/2019 05:22, Shijith Thotton wrote:
> The NMI handlers handle_percpu_devid_fasteoi_nmi() and
> handle_fasteoi_nmi() added by commit 2dcf1fbcad35 ("genirq: Provide NMI
> handlers") do not update the interrupt counts. Due to that the NMI
> interrupt count does not show up correctly in /proc/interrupts.
> 
> Update the functions to fix this. With this change, we can see stats of
> the perf NMI interrupts on arm64.
> 
> Fixes: 2dcf1fbcad35 ("genirq: Provide NMI handlers")
> 
> Signed-off-by: Shijith Thotton <sthotton@...vell.com>
> ---
>  kernel/irq/chip.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
> index 29d6c7d070b4..88d1e054c6ea 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);
> +

This needs to be called with the desc lock taken, otherwise we're likely
to corrupt desc->tot_count.
But taking the desc lock is something we can't do in NMI context (
*spin_lock_irq*() won't prevent an NMI from happening).

>  	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);
> +

Looking at handle_percpu_irq(), I think this might be acceptable. But
does it make sense to only have kstats for percpu NMIs?

Cheers,

-- 
Julien Thierry

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ