Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/x86/pci Fix bug, SPINOUT() is not supposed to take ...



details:   https://anonhg.NetBSD.org/src/rev/d7f752da3e23
branches:  trunk
changeset: 324544:d7f752da3e23
user:      maxv <maxv%NetBSD.org@localhost>
date:      Tue Jul 10 06:44:49 2018 +0000

description:
Fix bug, SPINOUT() is not supposed to take the value given to BACKOFF().
Here the exponential backoff is wrecked.

diffstat:

 sys/arch/x86/pci/pci_machdep.c |  15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

diffs (46 lines):

diff -r 45f1ed006a87 -r d7f752da3e23 sys/arch/x86/pci/pci_machdep.c
--- a/sys/arch/x86/pci/pci_machdep.c    Tue Jul 10 01:44:30 2018 +0000
+++ b/sys/arch/x86/pci/pci_machdep.c    Tue Jul 10 06:44:49 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pci_machdep.c,v 1.82 2018/06/23 16:09:53 jakllsch Exp $        */
+/*     $NetBSD: pci_machdep.c,v 1.83 2018/07/10 06:44:49 maxv Exp $    */
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -73,7 +73,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.82 2018/06/23 16:09:53 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.83 2018/07/10 06:44:49 maxv Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -340,20 +340,23 @@
        if (cpuno == cl->cl_cpuno) {
                ocl->cl_cpuno = cpuno;
        } else {
-               u_int spins;
+#ifdef LOCKDEBUG
+               u_int spins = 0;
+#endif
+               u_int count;
+               count = SPINLOCK_BACKOFF_MIN;
 
                ocl->cl_cpuno = 0;
 
-               spins = SPINLOCK_BACKOFF_MIN;
                while (atomic_cas_32(&cl->cl_cpuno, 0, cpuno) != 0) {
-                       SPINLOCK_BACKOFF(spins);
+                       SPINLOCK_BACKOFF(count);
 #ifdef LOCKDEBUG
                        if (SPINLOCK_SPINOUT(spins)) {
                                panic("%s: cpu %" PRId32
                                    " spun out waiting for cpu %" PRId32,
                                    __func__, cpuno, cl->cl_cpuno);
                        }
-#endif /* LOCKDEBUG */
+#endif
                }
        }
 



Home | Main Index | Thread Index | Old Index