Bug 785623

Summary: i6300esb expires immediately from second time
Product: Red Hat Enterprise Linux 6 Reporter: Shaolong Hu <shu>
Component: qemu-kvmAssignee: Richard W.M. Jones <rjones>
Status: CLOSED WONTFIX QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.3CC: juzhang, michen, mkenneth, mzhan, rbalakri, rpacheco, virt-maint, xfu
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1046559 (view as bug list) Environment:
Last Closed: 2016-06-27 15:41:28 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On:    
Bug Blocks: 1046559    

Description Shaolong Hu 2012-01-30 03:50:17 UTC
Description of problem:
------------------------
Set i6300esb action as "pause", trigger it, after first time expire, system pause, in qemu monitor, run "cont", trigger i6300esb again, there is error prompt in qemu monitor immediately, and system pause without heartbeat time.

Version-Release number of selected component (if applicable):
--------------------------------------------------------------
qemu-kvm-0.12.1.2-2.216.el6.x86_64

How reproducible:
------------------
100%

Steps to Reproduce:
---------------------
1.boot guest with "-device i6300esb,id=watchdog -watchdog-action pause"
2.in guest "echo 0 > /dev/watchdog"
3.after heartbeat, system pause
4.in qemu monitor:
(qemu) info status
VM status: paused (watchdog)
5.in qemu monitor:
(qemu) cont
6.in guest "echo 0 > /dev/watchdog" again
7.after step 6, system pause immediately without heartbeat time, and in qemu monitor:
(qemu) i6300esb_timer_expired: I would send APIC 1 INT 10 here if I knew how (XXX)
(qemu) info status
VM status: paused (watchdog)

Expected results:
------------------
second time pause should take heartbeat time, and no error in qemu monitor.

Comment 2 Richard W.M. Jones 2012-01-30 08:59:19 UTC
I'll just note here that 'echo 0 > /dev/watchdog' is not
a valid way to use the watchdog API.  See this document
for a description of the API:

http://www.mjmwired.net/kernel/Documentation/watchdog/watchdog-api.txt

Comment 3 Shaolong Hu 2012-01-31 08:24:49 UTC
Using following code to test again, still hit the problem.

"-d" - open watchdog then disable it
"-e" - open watchdog, enable it again (equals to open, optional), wait for reset
""   - without any parameter, open watchdog then keep it from expiration


/*
 * Watchdog Driver Test Program
 */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <linux/types.h>
#include <linux/watchdog.h>

int fd;

/*
 * This function simply sends an IOCTL to the driver, which in turn ticks
 * the PC Watchdog card to reset its internal timer so it doesn't trigger
 * a computer reset.
 */
static void keep_alive(void)
{
    int dummy;
    ioctl(fd, WDIOC_KEEPALIVE, &dummy);
    printf("Keep it alive\n");
}

static void timeleft(void)
{
    int timeleft=0;
    ioctl(fd, WDIOC_GETTIMELEFT, &timeleft);
    printf("The time left is %d seconds\n", timeleft);
}

/*
 * The main program.  Run the program with "-d" to disable the card,
 * or "-e" to enable the card then wait for reset, without any parameter, it enable the card then keep it alive.
 */
int main(int argc, char *argv[])
{
    int flags;
    int timeout;
    struct watchdog_info ident;

    fd = open("/dev/watchdog", O_WRONLY);

    if (fd == -1) {
        fprintf(stderr, "Watchdog device not enabled.\n");
        fflush(stderr);
        exit(-1);
    }

    ioctl(fd, WDIOC_GETTIMEOUT, &timeout);
    printf("The timeout is %d seconds\n", timeout);

    timeout=10;

    ioctl(fd, WDIOC_SETTIMEOUT, &timeout);
    printf("The timeout is set to %d seconds\n", timeout);

    ioctl(fd, WDIOC_GETSUPPORT, &ident);
    printf("The driver is %s \n", ident.identity);

    if (argc > 1) {
        if (!strncasecmp(argv[1], "-d", 2)) {
            flags = WDIOS_DISABLECARD;
            ioctl(fd, WDIOC_SETOPTIONS, &flags);
            fprintf(stderr, "Watchdog card disabled.\n");
            fflush(stderr);
            exit(0);
        } else if (!strncasecmp(argv[1], "-e", 2)) {
            flags = WDIOS_ENABLECARD;
            ioctl(fd, WDIOC_SETOPTIONS, &flags);
            fprintf(stderr, "Watchdog card enabled.\n");
            fflush(stderr);
            while(1) {
            timeleft();
            sleep(1);
            }
        } else {
            fprintf(stderr, "-d to disable, -e to enable.\n");
            fprintf(stderr, "run by itself to tick the card.\n");
            fflush(stderr);
            exit(0);
        }
    } else {
        fprintf(stderr, "Watchdog Ticking Away!\n");
        fflush(stderr);
    }

    while(1) {
        keep_alive();
        sleep(1);
    }
}

Comment 4 Shaolong Hu 2012-01-31 08:28:57 UTC
Have to be note here, this time it may expire immediately from third or forth time, no regular pattern.

Comment 5 Shaolong Hu 2012-04-18 08:30:27 UTC
if watchdog action is reset, after guest reboot, everything works fine, seems action pause and debug is virtual machine unique action, so fix this or not would be a judgemental call, i am fine with moving this to 6.4 or closing as won't fix.

Comment 6 RHEL Program Management 2012-05-03 04:45:28 UTC
Since RHEL 6.3 External Beta has begun, and this bug remains
unresolved, it has been rejected as it is not proposed as
exception or blocker.

Red Hat invites you to ask your support representative to
propose this request, if appropriate and relevant, in the
next release of Red Hat Enterprise Linux.

Comment 8 RHEL Program Management 2013-10-14 05:08:05 UTC
This request was not resolved in time for the current release.
Red Hat invites you to ask your support representative to
propose this request, if still desired, for consideration in
the next release of Red Hat Enterprise Linux.

Comment 10 Richard W.M. Jones 2016-06-27 15:41:28 UTC
Closing this as WONTFIX, although I believe that this is
probably working upstream and just needs to be retested.