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: <20110617171024.GH20010@aftab>
Date:	Fri, 17 Jun 2011 19:10:24 +0200
From:	Borislav Petkov <bp@...64.org>
To:	Hidetoshi Seto <seto.hidetoshi@...fujitsu.com>
Cc:	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"x86@...nel.org" <x86@...nel.org>, Ingo Molnar <mingo@...e.hu>,
	Thomas Gleixner <tglx@...utronix.de>,
	"H. Peter Anvin" <hpa@...or.com>,
	"Luck, Tony" <tony.luck@...el.com>
Subject: Re: [PATCH 8/8] x86, mce, edac: call edac_mce_parse() once per a
 record

On Fri, Jun 17, 2011 at 04:50:48AM -0400, Hidetoshi Seto wrote:
> There is no reason to keep it in the cmpxchg loop.
> (The loop continues until mcelog acquires buffer to save the record)
> 
> And use do-while for the loop here.
> 
> Signed-off-by: Hidetoshi Seto <seto.hidetoshi@...fujitsu.com>

Good catch.

Reviewed-by: Borislav Petkov <borislav.petkov@....com>

> ---
>  arch/x86/kernel/cpu/mcheck/mce.c |   26 +++++++++++++-------------
>  1 files changed, 13 insertions(+), 13 deletions(-)
> 
> diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
> index bc8a02c..f1d8ce1 100644
> --- a/arch/x86/kernel/cpu/mcheck/mce.c
> +++ b/arch/x86/kernel/cpu/mcheck/mce.c
> @@ -148,21 +148,21 @@ void mce_log(struct mce *mce)
>  	/* Emit the trace record: */
>  	trace_mce_record(mce);
>  
> +	/*
> +	 * If edac_mce is enabled, it will check the error type and will
> +	 * process it, if it is a known error.
> +	 * Otherwise, the error will be sent through mcelog interface.
> +	 */
> +	if (edac_mce_parse(mce))
> +		return;
> +
>  	mce->finished = 0;
>  	wmb();
> -	for (;;) {
> +
> +	do {
>  		entry = rcu_dereference_check_mce(mcelog.next);
>  		for (;;) {
>  			/*
> -			 * If edac_mce is enabled, it will check the error type
> -			 * and will process it, if it is a known error.
> -			 * Otherwise, the error will be sent through mcelog
> -			 * interface
> -			 */
> -			if (edac_mce_parse(mce))
> -				return;
> -
> -			/*
>  			 * When the buffer fills up discard new entries.
>  			 * Assume that the earlier errors are the more
>  			 * interesting ones:
> @@ -181,10 +181,10 @@ void mce_log(struct mce *mce)
>  		}
>  		smp_rmb();
>  		next = entry + 1;
> -		if (cmpxchg(&mcelog.next, entry, next) == entry)
> -			break;
> -	}
> +	} while (cmpxchg(&mcelog.next, entry, next) != entry);
> +
>  	memcpy(mcelog.entry + entry, mce, sizeof(struct mce));
> +
>  	wmb();
>  	mcelog.entry[entry].finished = 1;
>  	wmb();
> -- 
> 1.7.1

Thanks.

-- 
Regards/Gruss,
Boris.

Advanced Micro Devices GmbH
Einsteinring 24, 85609 Dornach
GM: Alberto Bozzo
Reg: Dornach, Landkreis Muenchen
HRB Nr. 43632 WEEE Registernr: 129 19551
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ