Bug 1335720

Summary: watchdog action 'inject-nmi' takes no effect
Product: Red Hat Enterprise Linux 7 Reporter: Xu Han <xuhan>
Component: qemu-kvm-rhevAssignee: Bandan Das <bdas>
Status: CLOSED ERRATA QA Contact: Xu Han <xuhan>
Severity: unspecified Docs Contact:
Priority: medium    
Version: 7.3CC: chayang, huding, juzhang, knoel, mrezanin, virt-maint
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard:
Fixed In Version: qemu-kvm-rhev-2.6.0-5.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-11-07 21:08:03 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Xu Han 2016-05-13 05:41:32 UTC
Description of problem:
Watchdog action 'inject-nmi' takes no effect. I checked the source codes and the build log of qemu-kvm-rhev-2.6.0-1.el7.x86_64 and found that macro 'TARGET_I386' is missing.

    cc -I/builddir/build/BUILD/qemu-2.6.0/tcg -I/builddir/build/BUILD/qemu-2.6.0/tcg/i386 -I/builddir/build/BUILD/qemu-2.6.0/linux-headers -I/builddir/build/BUILD/qemu-2.6.0/linux-headers -I. -I/builddir/build/BUILD/qemu-2.6.0 -I/builddir/build/BUILD/qemu-2.6.0/include -Ihw/core -Ihw/core -I/usr/include/pixman-1    -Werror -DHAS_LIBSSH2_SFTP_FSYNC -fPIE -DPIE -m64 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common  -O2 -g -pipe -Wall  -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -fPIE -DPIE -Wendif-labels -Wmissing-include-dirs -Wempty-body -Wnested-externs -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wold-style-declaration -Wold-style-definition -Wtype-limits -fstack-protector-strong   -I/usr/include/p11-kit-1     -I/usr/include/libpng15   -I/usr/include/spice-server -I/usr/include/cacard -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/nss3 -I/usr/include/nspr4 -I/usr/include/spice-1   -I/usr/include/cacard -I/usr/include/nss3 -I/usr/include/nspr4   -I/usr/include/libusb-1.0     -I/builddir/build/BUILD/qemu-2.6.0/tests -MMD -MP -MT hw/core/nmi.o -MF hw/core/nmi.d -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -pthread -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include   -g   -c -o hw/core/nmi.o hw/core/nmi.c


hw/core/nmi.c:

    void inject_nmi(void)
    {
    #if defined(TARGET_I386)
        CPUState *cs;

        CPU_FOREACH(cs) {
            X86CPU *cpu = X86_CPU(cs);

            if (!cpu->apic_state) {
                cpu_interrupt(cs, CPU_INTERRUPT_NMI);
            } else {
                apic_deliver_nmi(cpu->apic_state);
            }
        }
    #else
        nmi_monitor_handle(0, NULL);
    #endif
    }


Version-Release number of selected component (if applicable):
qemu-kvm-rhev-2.6.0-1.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Launch VM with parameter '-devcie i6300esb,id=wdt0 -watchdog-action inject-nmi'
2. On guest, active the watchdog interface and wait it expires
# python -c "open('/dev/watchdog').close()"

Actual results:
Guest had not received the NMI.

Expected results:
Guest could receive the NMI.
[  854.678150] Uhhuh. NMI received for unknown reason 20 on CPU 0.
[  854.678424] Do you have a strange power saving mode enabled?
[  854.678679] Dazed and confused, but trying to continue

Comment 2 Bandan Das 2016-05-19 22:17:19 UTC
(In reply to Xu Han from comment #0)
> Description of problem:
> Watchdog action 'inject-nmi' takes no effect. I checked the source codes and
> the build log of qemu-kvm-rhev-2.6.0-1.el7.x86_64 and found that macro
> 'TARGET_I386' is missing.
> 
You are right, the code inside of the ifdefs isn't getting compiled and will throw an error even if you try to. I will post patches shortly. Thanks for debugging!

Comment 3 Miroslav Rezanina 2016-06-06 10:50:52 UTC
Fix included in qemu-kvm-rhev-2.6.0-5.el7

Comment 5 Xu Han 2016-09-06 09:20:13 UTC
Verified this issue with qemu-kvm-rhev-2.6.0-22.el7.x86_64.

Steps: same as comment 0.

Results:
Guest could receive the NMI.

[  306.155563] i6300esb: Unexpected close, not stopping watchdog!
[  311.158013] Uhhuh. NMI received for unknown reason 21 on CPU 0.
[  311.158013] Do you have a strange power saving mode enabled?
[  311.158013] Dazed and confused, but trying to continue

So, this bug has been fixed.

Comment 8 errata-xmlrpc 2016-11-07 21:08:03 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2016-2673.html