Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752216AbZI1GyK (ORCPT ); Mon, 28 Sep 2009 02:54:10 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751817AbZI1GyJ (ORCPT ); Mon, 28 Sep 2009 02:54:09 -0400 Received: from fgwmail7.fujitsu.co.jp ([192.51.44.37]:42804 "EHLO fgwmail7.fujitsu.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751707AbZI1GyI (ORCPT ); Mon, 28 Sep 2009 02:54:08 -0400 X-SecurityPolicyCheck-FJ: OK by FujitsuOutboundMailChecker v1.3.1 Message-ID: <4AC05D6C.3070400@jp.fujitsu.com> Date: Mon, 28 Sep 2009 15:53:32 +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 4/5] mce-inject: no wait on write with MCE_INJ_CTX_RANDOM References: <1254100882.15717.1312.camel@yhuang-dev.sh.intel.com> <4AC05BBF.3010102@jp.fujitsu.com> In-Reply-To: <4AC05BBF.3010102@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: 1683 Lines: 58 Skip schedule_timeout() on write with MCE_INJ_CTX_RANDOM. And call raise_mce() only when it is required. Signed-off-by: Hidetoshi Seto --- arch/x86/kernel/cpu/mcheck/mce-inject.c | 23 +++++++++++------------ 1 files changed, 11 insertions(+), 12 deletions(-) diff --git a/arch/x86/kernel/cpu/mcheck/mce-inject.c b/arch/x86/kernel/cpu/mcheck/mce-inject.c index 702f712..7691c52 100644 --- a/arch/x86/kernel/cpu/mcheck/mce-inject.c +++ b/arch/x86/kernel/cpu/mcheck/mce-inject.c @@ -149,12 +149,11 @@ static int raise_local(void) static void raise_mce(struct mce *m) { - int context = MCE_INJ_CTX(m->inject_flags); - - inject_mce(m); - - if (context == MCE_INJ_CTX_RANDOM) - return; + /* + * Need to give user space some time to set everything up, + * so do it a jiffie or two later everywhere. + */ + schedule_timeout(2); #ifdef CONFIG_X86_LOCAL_APIC if (m->inject_flags & MCE_INJ_NMI_BROADCAST) { @@ -212,12 +211,12 @@ static ssize_t mce_write(struct file *filp, const char __user *ubuf, if (m.extcpu >= num_possible_cpus() || !cpu_online(m.extcpu)) return -EINVAL; - /* - * Need to give user space some time to set everything up, - * so do it a jiffie or two later everywhere. - */ - schedule_timeout(2); - raise_mce(&m); + /* Copy to percpu */ + inject_mce(&m); + + if (MCE_INJ_CTX(m.inject_flags) != MCE_INJ_CTX_RANDOM) + raise_mce(&m); + return usize; } -- 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/