From: Boris Ostrovsky Subject: Re: 4.2.3 - xen: vector 0x2 is not implemented Date: Tue, 8 Oct 2013 18:53:25 -0700 (PDT) Message-ID: <65451e07-a489-4325-aefa-f6f891a0d2cf@default> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="__1381283605116108150abhmt105.oracle.com" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: netwiz@crc.id.au Cc: xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org --__1381283605116108150abhmt105.oracle.com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline ----- netwiz@crc.id.au wrote: > On 9/10/2013 2:56 AM, Boris Ostrovsky wrote: > > On 10/08/2013 10:41 AM, Steven Haigh wrote: > >> On 10/09/2013 01:31 AM, Boris Ostrovsky wrote: > >>> On 10/08/2013 08:42 AM, Ian Campbell wrote: > >>>> On Tue, 2013-10-08 at 10:50 +1100, Steven Haigh wrote: > >>>>> Hi all, > >>>>> > >>>>> I've had a report of a host starting to give this output: > >>>>> Oct 7 19:36:37 kernel: INFO: rcu_sched self-detected stall on > CPU { 2} > >>>>> (t=3D273561 jiffies g=3D17919 c=3D17918 q=3D9688) > >>>>> Oct 7 19:36:37 kernel: sending NMI to all CPUs: > >>>>> Oct 7 19:36:37 kernel: xen: vector 0x2 is not implemented > >>>> This bit is just a symptom triggered by the initial rcu stall > which is > >>>> your real problem. > >>>> > >>>> That said I thought the NMI thing was fixed recently, which might > have > >>>> gotten you better debugging on the rcu problem. > >>> This went into v3.12-rc1 (commit 6efa20e). > >>> > >>> Steven, can you try your test with newer kernels that have this > fix? > >>> With > >>> it we should be able to see where the stall is happening. > >> Sadly I can't easily rebuild this to 3.12. Is it possible to get a > >> version / patch / commit that will work with 3.11.x? > >=20 > > I am not sure I understand what you are asking for. A backport of > the > > patch to 3.11.x so that you apply it on top of your sources and > build it > > yourself? >=20 > Correct. I have a buildroot set up for building 3.11.x into RPMs that > would take a lot of work to change to 3.12. As this is a problem with > 3.11 as well (as I don't run or provide 3.12 anywhere), I'd like to > test > the fix on 3.11. I am attaching the patch to 3.11.4 (which is exactly the same as the one that went into 3.12 btw). I only compile-tested it to make sure that it bui= lds. >=20 > Eventually, it will need to be fixed in the 3.11 series as well. >=20 It's unlikely to go into 3.11 since it's really a new feature and not a bug= fix. -boris --__1381283605116108150abhmt105.oracle.com Content-Type: text/plain; charset=UTF-8; name="nmi_3.11.4.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="nmi_3.11.4.patch" diff --git a/arch/x86/include/asm/xen/events.h b/arch/x86/include/asm/xen/e= vents.h index ca842f2..608a79d 100644 --- a/arch/x86/include/asm/xen/events.h +++ b/arch/x86/include/asm/xen/events.h @@ -7,6 +7,7 @@ enum ipi_vector { =09XEN_CALL_FUNCTION_SINGLE_VECTOR, =09XEN_SPIN_UNLOCK_VECTOR, =09XEN_IRQ_WORK_VECTOR, +=09XEN_NMI_VECTOR, =20 =09XEN_NR_IPIS, }; diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c index 193097e..b5a22fa 100644 --- a/arch/x86/xen/enlighten.c +++ b/arch/x86/xen/enlighten.c @@ -427,8 +427,7 @@ static void __init xen_init_cpuid_mask(void) =20 =09if (!xen_initial_domain()) =09=09cpuid_leaf1_edx_mask &=3D -=09=09=09~((1 << X86_FEATURE_APIC) | /* disable local APIC */ -=09=09=09 (1 << X86_FEATURE_ACPI)); /* disable ACPI */ +=09=09=09~((1 << X86_FEATURE_ACPI)); /* disable ACPI */ =20 =09cpuid_leaf1_ecx_mask &=3D ~(1 << (X86_FEATURE_X2APIC % 32)); =20 @@ -735,8 +734,7 @@ static int cvt_gate_to_trap(int vector, const gate_desc= *val, =09=09addr =3D (unsigned long)xen_int3; =09else if (addr =3D=3D (unsigned long)stack_segment) =09=09addr =3D (unsigned long)xen_stack_segment; -=09else if (addr =3D=3D (unsigned long)double_fault || -=09=09 addr =3D=3D (unsigned long)nmi) { +=09else if (addr =3D=3D (unsigned long)double_fault) { =09=09/* Don't need to handle these */ =09=09return 0; #ifdef CONFIG_X86_MCE @@ -747,7 +745,12 @@ static int cvt_gate_to_trap(int vector, const gate_des= c *val, =09=09 */ =09=09; #endif -=09} else { +=09} else if (addr =3D=3D (unsigned long)nmi) +=09=09/* +=09=09 * Use the native version as well. +=09=09 */ +=09=09; +=09else { =09=09/* Some other trap using IST? */ =09=09if (WARN_ON(val->ist !=3D 0)) =09=09=09return 0; diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c index 8f3eea6..0caa7af 100644 --- a/arch/x86/xen/setup.c +++ b/arch/x86/xen/setup.c @@ -33,6 +33,9 @@ /* These are code, but not functions. Defined in entry.S */ extern const char xen_hypervisor_callback[]; extern const char xen_failsafe_callback[]; +#ifdef CONFIG_X86_64 +extern const char nmi[]; +#endif extern void xen_sysenter_target(void); extern void xen_syscall_target(void); extern void xen_syscall32_target(void); @@ -547,7 +550,13 @@ void xen_enable_syscall(void) =09} #endif /* CONFIG_X86_64 */ } - +void __cpuinit xen_enable_nmi(void) +{ +#ifdef CONFIG_X86_64 +=09if (register_callback(CALLBACKTYPE_nmi, nmi)) +=09=09BUG(); +#endif +} void __init xen_arch_setup(void) { =09xen_panic_handler_init(); @@ -565,7 +574,7 @@ void __init xen_arch_setup(void) =20 =09xen_enable_sysenter(); =09xen_enable_syscall(); - +=09xen_enable_nmi(); #ifdef CONFIG_ACPI =09if (!(xen_start_info->flags & SIF_INITDOMAIN)) { =09=09printk(KERN_INFO "ACPI in unprivileged domain disabled\n"); diff --git a/arch/x86/xen/smp.c b/arch/x86/xen/smp.c index b81c88e..1e2580a 100644 --- a/arch/x86/xen/smp.c +++ b/arch/x86/xen/smp.c @@ -572,6 +572,12 @@ static inline int xen_map_vector(int vector) =09case IRQ_WORK_VECTOR: =09=09xen_vector =3D XEN_IRQ_WORK_VECTOR; =09=09break; +#ifdef CONFIG_X86_64 +=09case NMI_VECTOR: +=09case APIC_DM_NMI: /* Some use that instead of NMI_VECTOR */ +=09=09xen_vector =3D XEN_NMI_VECTOR; +=09=09break; +#endif =09default: =09=09xen_vector =3D -1; =09=09printk(KERN_ERR "xen: vector 0x%x is not implemented\n", diff --git a/drivers/xen/events.c b/drivers/xen/events.c index 5e8be46..387f3f4 100644 --- a/drivers/xen/events.c +++ b/drivers/xen/events.c @@ -56,6 +56,7 @@ #include #include #include +#include #include =20 /* @@ -1212,7 +1213,15 @@ EXPORT_SYMBOL_GPL(evtchn_put); =20 void xen_send_IPI_one(unsigned int cpu, enum ipi_vector vector) { -=09int irq =3D per_cpu(ipi_to_irq, cpu)[vector]; +=09int irq; + +=09if (unlikely(vector =3D=3D XEN_NMI_VECTOR)) { +=09=09int rc =3D HYPERVISOR_vcpu_op(VCPUOP_send_nmi, cpu, NULL); +=09=09if (rc < 0) +=09=09=09printk(KERN_WARNING "Sending nmi to CPU%d failed (rc:%d)\n", cpu,= rc); +=09=09return; +=09} +=09irq =3D per_cpu(ipi_to_irq, cpu)[vector]; =09BUG_ON(irq < 0); =09notify_remote_via_irq(irq); } diff --git a/include/xen/interface/vcpu.h b/include/xen/interface/vcpu.h index 87e6f8a..b05288c 100644 --- a/include/xen/interface/vcpu.h +++ b/include/xen/interface/vcpu.h @@ -170,4 +170,6 @@ struct vcpu_register_vcpu_info { }; DEFINE_GUEST_HANDLE_STRUCT(vcpu_register_vcpu_info); =20 +/* Send an NMI to the specified VCPU. @extra_arg =3D=3D NULL. */ +#define VCPUOP_send_nmi 11 #endif /* __XEN_PUBLIC_VCPU_H__ */ --__1381283605116108150abhmt105.oracle.com Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --__1381283605116108150abhmt105.oracle.com--