This message generated a parse failure. Raw output follows here. Please use 'back' to navigate. From devnull@lkml.org Tue Apr 16 15:40:28 2024 Delivery-date: Mon, 19 Sep 2011 10:40:34 +0200 Received: from mga01.intel.com ([192.55.52.88]:39681 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753550Ab1ISIk3 (ORCPT ); Mon, 19 Sep 2011 04:40:29 -0400 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP; 19 Sep 2011 01:40:28 -0700 X-ExtLoop1: 1 X-Ironport-AV: E=Sophos;i="4.68,404,1312182000"; d="scan'208";a="55194025" Received: from gchen16-mobl2.ccr.corp.intel.com (HELO [10.238.128.146]) ([10.238.128.146]) by fmsmga002.fm.intel.com with ESMTP; 19 Sep 2011 01:40:26 -0700 Message-Id: <4E76FFF9.9050308@linux.intel.com> Date: Mon, 19 Sep 2011 16:40:25 +0800 From: Chen Gong User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:6.0.1) Gecko/20110830 Thunderbird/6.0.1 Mime-Version: 1.0 To: "Chen, Gong" Cc: "Kleen, Andi" , "Huang, Ying" , "Luck, Tony" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] add IRQ context simulation in mce-inject References: <749B9D3DBF0F054390025D9EAFF47F2212D25B0AF7@shsmsx501.ccr.corp.intel.com> In-Reply-To: <749B9D3DBF0F054390025D9EAFF47F2212D25B0AF7@shsmsx501.ccr.corp.intel.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-Id: X-Mailing-List: linux-kernel@vger.kernel.org =E4=BA=8E 2011/9/19 16:34, Chen, Gong =E5=86=99=E9=81=93: > Current mce-inject can simulate some kinds of scenarios, such as > one CPU working in process context, and other CPUs working in NMI > context. To extend the coverage of test range, a new IRQ context > for other CPUs is added. > > Signed-off-by: Chen Gong > --- > arch/x86/include/asm/mce.h | 1 + > arch/x86/kernel/cpu/mcheck/mce-inject.c | 34 ++++++++++++++++++++= +++++++--- > 2 files changed, 31 insertions(+), 4 deletions(-) > > diff --git a/arch/x86/include/asm/mce.h b/arch/x86/include/asm/mce.h > index c9321f3..2490e8c 100644 > --- a/arch/x86/include/asm/mce.h > +++ b/arch/x86/include/asm/mce.h > @@ -54,6 +54,7 @@ > #define MCJ_CTX_IRQ 2 /* inject context: IRQ */ > #define MCJ_NMI_BROADCAST 4 /* do NMI broadcasting */ > #define MCJ_EXCEPTION 8 /* raise as exception */ > +#define MCJ_IRQ_BRAODCAST 0x10 /* do IRQ broadcasting */ > > /* Fields are zero when not available */ > struct mce { > diff --git a/arch/x86/kernel/cpu/mcheck/mce-inject.c b/arch/x86/kerne= l/cpu/mcheck/mce-inject.c > index 0ed633c..8f7a119 100644 > --- a/arch/x86/kernel/cpu/mcheck/mce-inject.c > +++ b/arch/x86/kernel/cpu/mcheck/mce-inject.c > @@ -17,6 +17,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -94,6 +95,18 @@ static int mce_raise_notify(struct notifier_block = *self, > return NOTIFY_STOP; > } > > +static void mce_irq_ipi(void *info) > +{ > + int cpu =3D smp_processor_id(); > + struct mce *m =3D&__get_cpu_var(injectm); > + > + if (cpumask_test_cpu(cpu, mce_inject_cpumask)&& > + m->inject_flags& MCJ_EXCEPTION) { > + cpumask_clear_cpu(cpu, mce_inject_cpumask); > + raise_exception(m, NULL); > + } > +} > + > static struct notifier_block mce_raise_nb =3D { > .notifier_call =3D mce_raise_notify, > .priority =3D NMI_LOCAL_NORMAL_PRIOR, > @@ -146,9 +159,10 @@ static void raise_mce(struct mce *m) > return; > > #ifdef CONFIG_X86_LOCAL_APIC > - if (m->inject_flags& MCJ_NMI_BROADCAST) { > + if (m->inject_flags& (MCJ_IRQ_BRAODCAST | MCJ_NMI_BROADCAST)) { > unsigned long start; > int cpu; > + > get_online_cpus(); > cpumask_copy(mce_inject_cpumask, cpu_online_mask); > cpumask_clear_cpu(get_cpu(), mce_inject_cpumask); > @@ -158,13 +172,25 @@ static void raise_mce(struct mce *m) > MCJ_CTX(mcpu->inject_flags) !=3D MCJ_CTX_RANDOM) > cpumask_clear_cpu(cpu, mce_inject_cpumask); > } > - if (!cpumask_empty(mce_inject_cpumask)) > - apic->send_IPI_mask(mce_inject_cpumask, NMI_VECTOR); > + if (!cpumask_empty(mce_inject_cpumask)) { > + if (m->inject_flags& MCJ_IRQ_BRAODCAST) { > + /* > + * don't wait because mce_irq_ipi is necessary > + * to be sync with following raise_local > + */ > + preempt_disable(); > + smp_call_function_many(mce_inject_cpumask, > + mce_irq_ipi, NULL, 0); > + preempt_enable(); > + } else if (m->inject_flags& MCJ_NMI_BROADCAST) > + apic->send_IPI_mask(mce_inject_cpumask, > + NMI_VECTOR); > + } > start =3D jiffies; > while (!cpumask_empty(mce_inject_cpumask)) { > if (!time_before(jiffies, start + 2*HZ)) { > printk(KERN_ERR > - "Timeout waiting for mce inject NMI %lx\n", > + "Timeout waiting for mce inject %lx\n", > *cpumask_bits(mce_inject_cpumask)); > break; > } > -- 1.7.1 > > N=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BDr=EF=BF=BD=EF=BF=BDy=EF= =BF=BD=EF=BF=BD=EF=BF=BDb=EF=BF=BDX=EF=BF=BD=EF=BF=BD=C7=A7v=EF=BF=BD^=EF= =BF=BD)=DE=BA{.n=EF=BF=BD+=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD{=EF=BF=BD= =EF=BF=BD=EF=BF=BD=EF=BF=BDzX=EF=BF=BD=EF=BF=BD=17=EF=BF=BD=EF=BF=BD=DC= =A8}=EF=BF=BD=EF=BF=BD=EF=BF=BD=C6=A0z=EF=BF=BD&j:+v=EF=BF=BD=EF=BF=BD=EF= =BF=BD=07=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BDzZ+=EF=BF=BD=EF=BF=BD+zf=EF= =BF=BD=EF=BF=BD=EF=BF=BDh=EF=BF=BD=EF=BF=BD=EF=BF=BD~=EF=BF=BD=EF=BF=BD= =EF=BF=BD=EF=BF=BDi=EF=BF=BD=EF=BF=BD=EF=BF=BDz=EF=BF=BD=1E=EF=BF=BDw=EF= =BF=BD=EF=BF=BD=EF=BF=BD?=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD&=EF=BF=BD= )=DF=A2=1Bf=EF=BF=BD=EF=BF=BD^j=C7=ABy=EF=BF=BDm=EF=BF=BD=EF=BF=BD@A=EF= =BF=BDa=EF=BF=BD=EF=BF=BD=7F=EF=BF=BD=0C0=EF=BF=BD=EF=BF=BDh=EF=BF=BD=0F= =EF=BF=BDi=7F My mailstop meets some trouble, please forgive me for sending this patc= h=20 via outlook :-( send -- 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/