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]
Message-ID: <87lgi6ai40.fsf@concordia.ellerman.id.au>
Date:   Thu, 14 Dec 2017 00:10:39 +1100
From:   Michael Ellerman <mpe@...erman.id.au>
To:     alexander.levin@...izon.com,
        "linux-kernel\@vger.kernel.org" <linux-kernel@...r.kernel.org>,
        "stable\@vger.kernel.org" <stable@...r.kernel.org>
Cc:     Nicholas Piggin <npiggin@...il.com>, alexander.levin@...izon.com
Subject: Re: [PATCH AUTOSEL for 3.18 36/40] powerpc/xmon: Avoid tripping SMP hardlockup watchdog

alexander.levin@...izon.com writes:

> From: Nicholas Piggin <npiggin@...il.com>
>
> [ Upstream commit 064996d62a33ffe10264b5af5dca92d54f60f806 ]
>
> The SMP hardlockup watchdog cross-checks other CPUs for lockups, which
> causes xmon headaches because it's assuming interrupts hard disabled
> means no watchdog troubles. Try to improve that by calling
> touch_nmi_watchdog() in obvious places where secondaries are spinning.
>
> Also annotate these spin loops with spin_begin/end calls.

These macros didn't exist until 4.13, and haven't been backported AFAIK.

cheers

> diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
> index e23f559faa47..6cec1081cb67 100644
> --- a/arch/powerpc/xmon/xmon.c
> +++ b/arch/powerpc/xmon/xmon.c
> @@ -436,14 +436,19 @@ static int xmon_core(struct pt_regs *regs, int fromipi)
>  
>   waiting:
>  	secondary = 1;
> +	spin_begin();
>  	while (secondary && !xmon_gate) {
>  		if (in_xmon == 0) {
> -			if (fromipi)
> +			if (fromipi) {
> +				spin_end();
>  				goto leave;
> +			}
>  			secondary = test_and_set_bit(0, &in_xmon);
>  		}
> -		barrier();
> +		spin_cpu_relax();
> +		touch_nmi_watchdog();
>  	}
> +	spin_end();
>  
>  	if (!secondary && !xmon_gate) {
>  		/* we are the first cpu to come in */
> @@ -470,21 +475,25 @@ static int xmon_core(struct pt_regs *regs, int fromipi)
>  		mb();
>  		xmon_gate = 1;
>  		barrier();
> +		touch_nmi_watchdog();
>  	}
>  
>   cmdloop:
>  	while (in_xmon) {
>  		if (secondary) {
> +			spin_begin();
>  			if (cpu == xmon_owner) {
>  				if (!test_and_set_bit(0, &xmon_taken)) {
>  					secondary = 0;
> +					spin_end();
>  					continue;
>  				}
>  				/* missed it */
>  				while (cpu == xmon_owner)
> -					barrier();
> +					spin_cpu_relax();
>  			}
> -			barrier();
> +			spin_cpu_relax();
> +			touch_nmi_watchdog();
>  		} else {
>  			cmd = cmds(regs);
>  			if (cmd != 0) {
> -- 
> 2.11.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ