Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-7]: src Pull up following revision(s) (requested by ozaki-r in ti...



details:   https://anonhg.NetBSD.org/src/rev/38861f4da5eb
branches:  netbsd-7
changeset: 798644:38861f4da5eb
user:      martin <martin%NetBSD.org@localhost>
date:      Mon Dec 01 11:38:42 2014 +0000

description:
Pull up following revision(s) (requested by ozaki-r in ticket #279):
        sys/kern/kern_ktrace.c: revision 1.166
        sys/dev/isa/aps.c: revision 1.16
        sys/dev/sysmon/sysmonvar.h: revision 1.45
        sys/dev/ir/irframe_tty.c: revision 1.60
        sys/dev/sysmon/sysmon_envsys_events.c: revision 1.111
        sys/dev/sysmon/sysmon_envsys_events.c: revision 1.112
        sys/dev/pci/pccbb.c: revision 1.207
        sys/dev/wscons/wskbd.c: revision 1.135
        sys/dev/usb/ohci.c: revision 1.254
        sys/net/if_ecosubr.c: revision 1.41
        sys/dev/pcmcia/btbc.c: revision 1.17
        sys/arch/x86/x86/via_padlock.c: revision 1.23
        sys/dev/sdmmc/sdmmc.c: revision 1.23
        sys/dev/bluetooth/btkbd.c: revision 1.17
        sys/dev/bluetooth/bcsp.c: revision 1.25
        sys/arch/x86/pci/fwhrng.c: revision 1.8
        sys/dev/ic/nslm7x.c: revision 1.61
        share/man/man9/callout.9: revision 1.28
Replace callout_stop with callout_halt
In order to call callout_destroy for a callout safely, we have to ensure
the function of the callout is not running and pending. To do so, we should
use callout_halt, not callout_stop.
Discussed with martin@ and riastradh@.
Make it clear that we should use not callout_stop but callout_halt
before callout_destroy
Replace callout_stop with callout_halt
In order to call callout_destroy for a callout safely, we have to ensure
the function of the callout is not running and pending. To do so, we should
use callout_halt, not callout_stop.
In this case, we need to pass an interlock to callout_halt to wait for
the callout complete.
Reviewed by riastradh@.
Kill sme_callout_mtx and use sme_mtx instead
We can use sme_mtx for the callout as well. Actually we should do so
because sme_events_list and some other data that are touched in the
callout should be protected by sme_mtx, not sme_callout_mtx.
Discussed with riastradh@ in
http://mail-index.netbsd.org/tech-kern/2014/11/11/msg017956.html
Replace callout_stop with callout_halt
In order to call callout_destroy for a callout safely, we have to ensure
the function of the callout is not running and pending. To do so, we should
use callout_halt, not callout_stop.
In this case, we need to pass an interlock to callout_halt to wait for
the callout complete. And also we make sure that SME_CALLOUT_INITIALIZED
is unset before calling callout_halt to prevent the callout from calling
callout_schedule. This is the same as what we did in sys/netinet6/mld6.c@1.61.
Reviewed by riastradh@.

diffstat:

 share/man/man9/callout.9              |  10 +++++++---
 sys/arch/x86/pci/fwhrng.c             |   6 +++---
 sys/arch/x86/x86/via_padlock.c        |   6 +++---
 sys/dev/bluetooth/bcsp.c              |   8 ++++----
 sys/dev/bluetooth/btkbd.c             |   7 +++----
 sys/dev/ic/nslm7x.c                   |   6 +++---
 sys/dev/ir/irframe_tty.c              |   6 +++---
 sys/dev/isa/aps.c                     |   6 +++---
 sys/dev/pci/pccbb.c                   |   6 +++---
 sys/dev/pcmcia/btbc.c                 |   6 +++---
 sys/dev/sdmmc/sdmmc.c                 |   6 +++---
 sys/dev/sysmon/sysmon_envsys_events.c |  22 +++++++++++++---------
 sys/dev/sysmon/sysmonvar.h            |   3 +--
 sys/dev/usb/ohci.c                    |   6 +++---
 sys/dev/wscons/wskbd.c                |   6 +++---
 sys/kern/kern_ktrace.c                |   9 +++++----
 sys/net/if_ecosubr.c                  |   6 +++---
 17 files changed, 66 insertions(+), 59 deletions(-)

diffs (truncated from 506 to 300 lines):

diff -r 9de4dde862a6 -r 38861f4da5eb share/man/man9/callout.9
--- a/share/man/man9/callout.9  Mon Dec 01 10:37:32 2014 +0000
+++ b/share/man/man9/callout.9  Mon Dec 01 11:38:42 2014 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: callout.9,v 1.27 2014/07/27 21:35:07 riastradh Exp $
+.\"    $NetBSD: callout.9,v 1.27.2.1 2014/12/01 11:38:43 martin Exp $
 .\"
 .\" Copyright (c) 2000, 2003, 2009 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd February 2, 2013
+.Dd November 21, 2014
 .Dt CALLOUT 9
 .Os
 .Sh NAME
@@ -116,7 +116,11 @@
 when a device is being detached).
 The callout should be stopped before
 .Fn callout_destroy
-is called.
+is called by calling
+.Fn callout_halt .
+Note that
+.Fn callout_stop
+shouldn't be used for this purpose.
 .Pp
 The
 .Fn callout_reset
diff -r 9de4dde862a6 -r 38861f4da5eb sys/arch/x86/pci/fwhrng.c
--- a/sys/arch/x86/pci/fwhrng.c Mon Dec 01 10:37:32 2014 +0000
+++ b/sys/arch/x86/pci/fwhrng.c Mon Dec 01 11:38:42 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fwhrng.c,v 1.7 2014/08/10 16:44:34 tls Exp $   */
+/*     $NetBSD: fwhrng.c,v 1.7.2.1 2014/12/01 11:38:43 martin Exp $    */
 
 /*
  * Copyright (c) 2000 Michael Shalayeff
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fwhrng.c,v 1.7 2014/08/10 16:44:34 tls Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fwhrng.c,v 1.7.2.1 2014/12/01 11:38:43 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -211,7 +211,7 @@
 
        rnd_detach_source(&sc->sc_rnd_source);
 
-       callout_stop(&sc->sc_rnd_ch);
+       callout_halt(&sc->sc_rnd_ch, NULL);
        callout_destroy(&sc->sc_rnd_ch);
 
        /* Disable the RNG. */
diff -r 9de4dde862a6 -r 38861f4da5eb sys/arch/x86/x86/via_padlock.c
--- a/sys/arch/x86/x86/via_padlock.c    Mon Dec 01 10:37:32 2014 +0000
+++ b/sys/arch/x86/x86/via_padlock.c    Mon Dec 01 11:38:42 2014 +0000
@@ -1,5 +1,5 @@
 /*     $OpenBSD: via.c,v 1.8 2006/11/17 07:47:56 tom Exp $     */
-/*     $NetBSD: via_padlock.c,v 1.22 2014/08/10 16:44:34 tls Exp $ */
+/*     $NetBSD: via_padlock.c,v 1.22.2.1 2014/12/01 11:38:43 martin Exp $ */
 
 /*-
  * Copyright (c) 2003 Jason Wright
@@ -20,7 +20,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: via_padlock.c,v 1.22 2014/08/10 16:44:34 tls Exp $");
+__KERNEL_RCSID(0, "$NetBSD: via_padlock.c,v 1.22.2.1 2014/12/01 11:38:43 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -626,7 +626,7 @@
        struct via_padlock_softc *sc = device_private(self);
 
        if (sc->sc_rnd_attached) {
-               callout_stop(&sc->sc_rnd_co);
+               callout_halt(&sc->sc_rnd_co, NULL);
                callout_destroy(&sc->sc_rnd_co);
                rnd_detach_source(&sc->sc_rnd_source);
                sc->sc_rnd_attached = false;
diff -r 9de4dde862a6 -r 38861f4da5eb sys/dev/bluetooth/bcsp.c
--- a/sys/dev/bluetooth/bcsp.c  Mon Dec 01 10:37:32 2014 +0000
+++ b/sys/dev/bluetooth/bcsp.c  Mon Dec 01 11:38:42 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bcsp.c,v 1.24 2014/05/20 18:25:54 rmind Exp $  */
+/*     $NetBSD: bcsp.c,v 1.24.2.1 2014/12/01 11:38:43 martin Exp $     */
 /*
  * Copyright (c) 2007 KIYOHARA Takashi
  * All rights reserved.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bcsp.c,v 1.24 2014/05/20 18:25:54 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcsp.c,v 1.24.2.1 2014/12/01 11:38:43 martin Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -349,10 +349,10 @@
                sc->sc_unit = NULL;
        }
 
-       callout_stop(&sc->sc_seq_timer);
+       callout_halt(&sc->sc_seq_timer, NULL);
        callout_destroy(&sc->sc_seq_timer);
 
-       callout_stop(&sc->sc_le_timer);
+       callout_halt(&sc->sc_le_timer, NULL);
        callout_destroy(&sc->sc_le_timer);
 
        return 0;
diff -r 9de4dde862a6 -r 38861f4da5eb sys/dev/bluetooth/btkbd.c
--- a/sys/dev/bluetooth/btkbd.c Mon Dec 01 10:37:32 2014 +0000
+++ b/sys/dev/bluetooth/btkbd.c Mon Dec 01 11:38:42 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: btkbd.c,v 1.16 2013/09/12 12:20:01 martin Exp $        */
+/*     $NetBSD: btkbd.c,v 1.16.4.1 2014/12/01 11:38:43 martin Exp $    */
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: btkbd.c,v 1.16 2013/09/12 12:20:01 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: btkbd.c,v 1.16.4.1 2014/12/01 11:38:43 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/callout.h>
@@ -251,8 +251,7 @@
 
 #ifdef WSDISPLAY_COMPAT_RAWKBD
 #ifdef BTKBD_REPEAT
-       callout_stop(&sc->sc_repeat);
-       KASSERT(!callout_invoking(&sc->sc_repeat));
+       callout_halt(&sc->sc_repeat, NULL);
        callout_destroy(&sc->sc_repeat);
 #endif
 #endif
diff -r 9de4dde862a6 -r 38861f4da5eb sys/dev/ic/nslm7x.c
--- a/sys/dev/ic/nslm7x.c       Mon Dec 01 10:37:32 2014 +0000
+++ b/sys/dev/ic/nslm7x.c       Mon Dec 01 11:38:42 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nslm7x.c,v 1.60 2013/10/20 21:13:15 christos Exp $ */
+/*     $NetBSD: nslm7x.c,v 1.60.4.1 2014/12/01 11:38:43 martin Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nslm7x.c,v 1.60 2013/10/20 21:13:15 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nslm7x.c,v 1.60.4.1 2014/12/01 11:38:43 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -1703,7 +1703,7 @@
 void
 lm_detach(struct lm_softc *lmsc)
 {
-       callout_stop(&lmsc->sc_callout);
+       callout_halt(&lmsc->sc_callout, NULL);
        callout_destroy(&lmsc->sc_callout);
        sysmon_envsys_unregister(lmsc->sc_sme);
 }
diff -r 9de4dde862a6 -r 38861f4da5eb sys/dev/ir/irframe_tty.c
--- a/sys/dev/ir/irframe_tty.c  Mon Dec 01 10:37:32 2014 +0000
+++ b/sys/dev/ir/irframe_tty.c  Mon Dec 01 11:38:42 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: irframe_tty.c,v 1.59 2013/12/16 15:49:40 mrg Exp $     */
+/*     $NetBSD: irframe_tty.c,v 1.59.4.1 2014/12/01 11:38:42 martin Exp $      */
 
 /*
  * TODO
@@ -41,7 +41,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: irframe_tty.c,v 1.59 2013/12/16 15:49:40 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: irframe_tty.c,v 1.59.4.1 2014/12/01 11:38:42 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/proc.h>
@@ -245,7 +245,7 @@
        struct irframet_softc *sc = device_private(dev);
        int rc;
 
-       callout_stop(&sc->sc_timeout);
+       callout_halt(&sc->sc_timeout, NULL);
 
        rc = irframe_detach(dev, flags);
 
diff -r 9de4dde862a6 -r 38861f4da5eb sys/dev/isa/aps.c
--- a/sys/dev/isa/aps.c Mon Dec 01 10:37:32 2014 +0000
+++ b/sys/dev/isa/aps.c Mon Dec 01 11:38:42 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: aps.c,v 1.15 2012/08/14 14:36:43 jruoho Exp $  */
+/*     $NetBSD: aps.c,v 1.15.14.1 2014/12/01 11:38:42 martin Exp $     */
 /*     $OpenBSD: aps.c,v 1.15 2007/05/19 19:14:11 tedu Exp $   */
 /*     $OpenBSD: aps.c,v 1.17 2008/06/27 06:08:43 canacar Exp $        */
 /*
@@ -24,7 +24,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: aps.c,v 1.15 2012/08/14 14:36:43 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aps.c,v 1.15.14.1 2014/12/01 11:38:42 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -429,7 +429,7 @@
 {
        struct aps_softc *sc = device_private(self);
 
-        callout_stop(&sc->sc_callout);
+        callout_halt(&sc->sc_callout, NULL);
         callout_destroy(&sc->sc_callout);
 
        if (sc->sc_sme)
diff -r 9de4dde862a6 -r 38861f4da5eb sys/dev/pci/pccbb.c
--- a/sys/dev/pci/pccbb.c       Mon Dec 01 10:37:32 2014 +0000
+++ b/sys/dev/pci/pccbb.c       Mon Dec 01 11:38:42 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pccbb.c,v 1.206 2014/03/29 19:28:25 christos Exp $     */
+/*     $NetBSD: pccbb.c,v 1.206.4.1 2014/12/01 11:38:42 martin Exp $   */
 
 /*
  * Copyright (c) 1998, 1999 and 2000
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pccbb.c,v 1.206 2014/03/29 19:28:25 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pccbb.c,v 1.206.4.1 2014/12/01 11:38:42 martin Exp $");
 
 /*
 #define CBB_DEBUG
@@ -560,7 +560,7 @@
        if (!TAILQ_EMPTY(&sc->sc_memwindow))
                aprint_error_dev(self, "memory windows not empty");
 
-       callout_stop(&sc->sc_insert_ch);
+       callout_halt(&sc->sc_insert_ch, NULL);
        callout_destroy(&sc->sc_insert_ch);
 
        mutex_destroy(&sc->sc_pwr_mtx);
diff -r 9de4dde862a6 -r 38861f4da5eb sys/dev/pcmcia/btbc.c
--- a/sys/dev/pcmcia/btbc.c     Mon Dec 01 10:37:32 2014 +0000
+++ b/sys/dev/pcmcia/btbc.c     Mon Dec 01 11:38:42 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: btbc.c,v 1.16 2014/05/20 18:25:54 rmind Exp $  */
+/*     $NetBSD: btbc.c,v 1.16.2.1 2014/12/01 11:38:43 martin Exp $     */
 /*
  * Copyright (c) 2007 KIYOHARA Takashi
  * All rights reserved.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: btbc.c,v 1.16 2014/05/20 18:25:54 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: btbc.c,v 1.16.2.1 2014/12/01 11:38:43 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/callout.h>
@@ -210,7 +210,7 @@
        pmf_device_deregister(self);
        btbc_disable(sc->sc_dev);
 
-       callout_stop(&sc->sc_ledch);
+       callout_halt(&sc->sc_ledch, NULL);
        callout_destroy(&sc->sc_ledch);
 
        if (sc->sc_unit) {
diff -r 9de4dde862a6 -r 38861f4da5eb sys/dev/sdmmc/sdmmc.c
--- a/sys/dev/sdmmc/sdmmc.c     Mon Dec 01 10:37:32 2014 +0000
+++ b/sys/dev/sdmmc/sdmmc.c     Mon Dec 01 11:38:42 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sdmmc.c,v 1.22 2014/03/19 15:26:42 nonaka Exp $        */
+/*     $NetBSD: sdmmc.c,v 1.22.4.1 2014/12/01 11:38:43 martin Exp $    */
 /*     $OpenBSD: sdmmc.c,v 1.18 2009/01/09 10:58:38 jsg Exp $  */
 
 /*
@@ -49,7 +49,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sdmmc.c,v 1.22 2014/03/19 15:26:42 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sdmmc.c,v 1.22.4.1 2014/12/01 11:38:43 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_sdmmc.h"
@@ -199,7 +199,7 @@
        }



Home | Main Index | Thread Index | Old Index