Module Name: src Committed By: maxv Date: Tue Jul 10 06:44:49 UTC 2018
Modified Files: src/sys/arch/x86/pci: pci_machdep.c Log Message: Fix bug, SPINOUT() is not supposed to take the value given to BACKOFF(). Here the exponential backoff is wrecked. To generate a diff of this commit: cvs rdiff -u -r1.82 -r1.83 src/sys/arch/x86/pci/pci_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/x86/pci/pci_machdep.c diff -u src/sys/arch/x86/pci/pci_machdep.c:1.82 src/sys/arch/x86/pci/pci_machdep.c:1.83 --- src/sys/arch/x86/pci/pci_machdep.c:1.82 Sat Jun 23 16:09:53 2018 +++ src/sys/arch/x86/pci/pci_machdep.c Tue Jul 10 06:44:49 2018 @@ -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 @@ pci_conf_lock(struct pci_conf_lock *ocl, 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 } }