From nobody@FreeBSD.org  Wed Oct 14 15:15:24 2009
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B64E51065676
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 14 Oct 2009 15:15:24 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id A50778FC1C
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 14 Oct 2009 15:15:24 +0000 (UTC)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.3/8.14.3) with ESMTP id n9EFFNYD049545
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 14 Oct 2009 15:15:23 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.3/8.14.3/Submit) id n9EFFNaf049544;
	Wed, 14 Oct 2009 15:15:23 GMT
	(envelope-from nobody)
Message-Id: <200910141515.n9EFFNaf049544@www.freebsd.org>
Date: Wed, 14 Oct 2009 15:15:23 GMT
From: Dmitrij Tejblum <tejblum@yandex-team.ru>
To: freebsd-gnats-submit@FreeBSD.org
Subject: [patch] ichwd watchdog sometimes does not enable
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         139604
>Category:       kern
>Synopsis:       [patch] [ichwd] watchdog sometimes does not enable
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    delphij
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Oct 14 15:20:01 UTC 2009
>Closed-Date:    Fri Sep 16 05:57:27 UTC 2011
>Last-Modified:  Fri Sep 16 06:00:22 UTC 2011
>Originator:     Dmitrij Tejblum
>Release:        7.2-STABLE
>Organization:
OOO Yandex
>Environment:
>Description:
ichwd process watchdog commands with the following code snippet:

                if (timeout != sc->timeout) {
                        if (!sc->active)
                                ichwd_tmr_enable(sc);
                        ichwd_tmr_set(sc, timeout);
                }
                ichwd_tmr_reload(sc);

I.e., ichwd is not enabled when timeout == sc->timeout
>How-To-Repeat:
Suppose you have ichwd configured and watchdogd running. If you stop watchdogd (/etc/rc.d/watchdogd stop) and then start it back (/etc/rc.d/watchdogd start), ichwd will not be enabled. Do it with sysctl debug.bootverbose=1, then ichwd print debug messages.
>Fix:


Patch attached with submission follows:

--- sys/dev/ichwd/ichwd.c	2009-06-11 22:10:17.000000000 +0400
+++ sys/dev/ichwd/ichwd.c	2009-10-14 16:39:46.000000000 +0400
@@ -316,11 +316,10 @@
 	cmd &= WD_INTERVAL;
 	timeout = ((uint64_t)1 << cmd) / ICHWD_TICK;
 	if (cmd) {
-		if (timeout != sc->timeout) {
-			if (!sc->active)
-				ichwd_tmr_enable(sc);
+		if (!sc->active)
+			ichwd_tmr_enable(sc);
+		if (timeout != sc->timeout)
 			ichwd_tmr_set(sc, timeout);
-		}
 		ichwd_tmr_reload(sc);
 		*error = 0;
 	} else {


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->delphij 
Responsible-Changed-By: delphij 
Responsible-Changed-When: Mon Aug 29 20:51:25 UTC 2011 
Responsible-Changed-Why:  
Take. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=139604 
State-Changed-From-To: open->patched 
State-Changed-By: delphij 
State-Changed-When: Fri Sep 2 17:07:01 UTC 2011 
State-Changed-Why:  
Patched in -HEAD, MFC reminder. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=139604 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/139604: commit references a PR
Date: Fri,  2 Sep 2011 17:06:58 +0000 (UTC)

 Author: delphij
 Date: Fri Sep  2 17:06:50 2011
 New Revision: 225340
 URL: http://svn.freebsd.org/changeset/base/225340
 
 Log:
   Fix a bug in ichwd(4) which prevents it from beig enabled if the new
   timeout is the same timeout.
   
   Submitted by:	Dmitrij Tejblum <tejblum yandex-team.ru>
   PR:		kern/139604
   MFC after:	2 weeks
   Approved by:	re (kib)
 
 Modified:
   head/sys/dev/ichwd/ichwd.c
 
 Modified: head/sys/dev/ichwd/ichwd.c
 ==============================================================================
 --- head/sys/dev/ichwd/ichwd.c	Fri Sep  2 17:06:23 2011	(r225339)
 +++ head/sys/dev/ichwd/ichwd.c	Fri Sep  2 17:06:50 2011	(r225340)
 @@ -402,11 +402,10 @@ ichwd_event(void *arg, unsigned int cmd,
  	cmd &= WD_INTERVAL;
  	timeout = ((uint64_t)1 << cmd) / ICHWD_TICK;
  	if (cmd) {
 -		if (timeout != sc->timeout) {
 -			if (!sc->active)
 -				ichwd_tmr_enable(sc);
 +		if (!sc->active)
 +			ichwd_tmr_enable(sc);
 +		if (timeout != sc->timeout)
  			ichwd_tmr_set(sc, timeout);
 -		}
  		ichwd_tmr_reload(sc);
  		*error = 0;
  	} else {
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: patched->closed 
State-Changed-By: delphij 
State-Changed-When: Fri Sep 16 05:57:03 UTC 2011 
State-Changed-Why:  
Patch MFC'ed to all supported -STABLE branches, thanks for 
your submission! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=139604 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/139604: commit references a PR
Date: Fri, 16 Sep 2011 05:57:21 +0000 (UTC)

 Author: delphij
 Date: Fri Sep 16 05:57:01 2011
 New Revision: 225606
 URL: http://svn.freebsd.org/changeset/base/225606
 
 Log:
   MFC r225340:
   
   Fix a bug in ichwd(4) which prevents it from being enabled if the new
   timeout is the same timeout.
   
   Submitted by:	Dmitrij Tejblum <tejblum yandex-team.ru>
   PR:		kern/139604
 
 Modified:
   stable/8/sys/dev/ichwd/ichwd.c
 Directory Properties:
   stable/8/sys/   (props changed)
   stable/8/sys/amd64/include/xen/   (props changed)
   stable/8/sys/cddl/contrib/opensolaris/   (props changed)
   stable/8/sys/contrib/dev/acpica/   (props changed)
   stable/8/sys/contrib/pf/   (props changed)
 
 Changes in other areas also in this revision:
 Modified:
   stable/7/sys/dev/ichwd/ichwd.c
 Directory Properties:
   stable/7/sys/   (props changed)
   stable/7/sys/cddl/contrib/opensolaris/   (props changed)
   stable/7/sys/contrib/dev/acpica/   (props changed)
   stable/7/sys/contrib/pf/   (props changed)
 
 Modified: stable/8/sys/dev/ichwd/ichwd.c
 ==============================================================================
 --- stable/8/sys/dev/ichwd/ichwd.c	Fri Sep 16 05:45:13 2011	(r225605)
 +++ stable/8/sys/dev/ichwd/ichwd.c	Fri Sep 16 05:57:01 2011	(r225606)
 @@ -402,11 +402,10 @@ ichwd_event(void *arg, unsigned int cmd,
  	cmd &= WD_INTERVAL;
  	timeout = ((uint64_t)1 << cmd) / ICHWD_TICK;
  	if (cmd) {
 -		if (timeout != sc->timeout) {
 -			if (!sc->active)
 -				ichwd_tmr_enable(sc);
 +		if (!sc->active)
 +			ichwd_tmr_enable(sc);
 +		if (timeout != sc->timeout)
  			ichwd_tmr_set(sc, timeout);
 -		}
  		ichwd_tmr_reload(sc);
  		*error = 0;
  	} else {
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/139604: commit references a PR
Date: Fri, 16 Sep 2011 05:57:25 +0000 (UTC)

 Author: delphij
 Date: Fri Sep 16 05:57:01 2011
 New Revision: 225606
 URL: http://svn.freebsd.org/changeset/base/225606
 
 Log:
   MFC r225340:
   
   Fix a bug in ichwd(4) which prevents it from being enabled if the new
   timeout is the same timeout.
   
   Submitted by:	Dmitrij Tejblum <tejblum yandex-team.ru>
   PR:		kern/139604
 
 Modified:
   stable/7/sys/dev/ichwd/ichwd.c
 Directory Properties:
   stable/7/sys/   (props changed)
   stable/7/sys/cddl/contrib/opensolaris/   (props changed)
   stable/7/sys/contrib/dev/acpica/   (props changed)
   stable/7/sys/contrib/pf/   (props changed)
 
 Changes in other areas also in this revision:
 Modified:
   stable/8/sys/dev/ichwd/ichwd.c
 Directory Properties:
   stable/8/sys/   (props changed)
   stable/8/sys/amd64/include/xen/   (props changed)
   stable/8/sys/cddl/contrib/opensolaris/   (props changed)
   stable/8/sys/contrib/dev/acpica/   (props changed)
   stable/8/sys/contrib/pf/   (props changed)
 
 Modified: stable/7/sys/dev/ichwd/ichwd.c
 ==============================================================================
 --- stable/7/sys/dev/ichwd/ichwd.c	Fri Sep 16 05:45:13 2011	(r225605)
 +++ stable/7/sys/dev/ichwd/ichwd.c	Fri Sep 16 05:57:01 2011	(r225606)
 @@ -319,11 +319,10 @@ ichwd_event(void *arg, unsigned int cmd,
  	cmd &= WD_INTERVAL;
  	timeout = ((uint64_t)1 << cmd) / ICHWD_TICK;
  	if (cmd) {
 -		if (timeout != sc->timeout) {
 -			if (!sc->active)
 -				ichwd_tmr_enable(sc);
 +		if (!sc->active)
 +			ichwd_tmr_enable(sc);
 +		if (timeout != sc->timeout)
  			ichwd_tmr_set(sc, timeout);
 -		}
  		ichwd_tmr_reload(sc);
  		*error = 0;
  	} else {
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
>Unformatted:
