Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755010AbZJEGhF (ORCPT ); Mon, 5 Oct 2009 02:37:05 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754304AbZJEGhE (ORCPT ); Mon, 5 Oct 2009 02:37:04 -0400 Received: from fgwmail6.fujitsu.co.jp ([192.51.44.36]:39997 "EHLO fgwmail6.fujitsu.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754210AbZJEGhD (ORCPT ); Mon, 5 Oct 2009 02:37:03 -0400 X-SecurityPolicyCheck-FJ: OK by FujitsuOutboundMailChecker v1.3.1 Message-ID: <4AC993DB.40206@jp.fujitsu.com> Date: Mon, 05 Oct 2009 15:36:11 +0900 From: Hidetoshi Seto User-Agent: Thunderbird 2.0.0.23 (Windows/20090812) MIME-Version: 1.0 To: Huang Ying CC: Ingo Molnar , "H. Peter Anvin" , Andi Kleen , "linux-kernel@vger.kernel.org" Subject: [PATCH 04/10] x86, mce: use do-while in mce_log References: <1253269241.15717.525.camel@yhuang-dev.sh.intel.com> <4AC990E1.7030708@jp.fujitsu.com> In-Reply-To: <4AC990E1.7030708@jp.fujitsu.com> Content-Type: text/plain; charset=ISO-2022-JP Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1194 Lines: 48 No changes in logic. Signed-off-by: Hidetoshi Seto --- arch/x86/kernel/cpu/mcheck/mce.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c index 9e8eabd..5f88ada 100644 --- a/arch/x86/kernel/cpu/mcheck/mce.c +++ b/arch/x86/kernel/cpu/mcheck/mce.c @@ -134,7 +134,8 @@ void mce_log(struct mce *mce) mce->finished = 0; wmb(); - for (;;) { + + do { entry = rcu_dereference(mcelog.next); for (;;) { /* @@ -156,14 +157,13 @@ 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(); - mce->finished = 1; set_bit(0, &mce_need_notify); } -- 1.6.4.3 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/