Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/powerpc/booke/pci Downgrade pq3pci_intrsources_lock...
details: https://anonhg.NetBSD.org/src/rev/fb26352495e2
branches: trunk
changeset: 365971:fb26352495e2
user: rin <rin%NetBSD.org@localhost>
date: Sat May 07 05:08:16 2022 +0000
description:
Downgrade pq3pci_intrsources_lock and pq3pci_msigroups_lock from
spin to adaptive mutexes.
These locks are typically used during autoconf(9), not from
interrupt context.
Found by LOCKDEBUG.
XXX
I'm not sure whether these locks are really necessary...
Similar codes, e.g. in powerpc/pic/intr.c, do not use any locks.
diffstat:
sys/arch/powerpc/booke/pci/pq3pci.c | 27 +++++++++++++++------------
1 files changed, 15 insertions(+), 12 deletions(-)
diffs (95 lines):
diff -r 450b22c1a767 -r fb26352495e2 sys/arch/powerpc/booke/pci/pq3pci.c
--- a/sys/arch/powerpc/booke/pci/pq3pci.c Sat May 07 05:01:29 2022 +0000
+++ b/sys/arch/powerpc/booke/pci/pq3pci.c Sat May 07 05:08:16 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pq3pci.c,v 1.30 2022/01/11 22:45:56 andvar Exp $ */
+/* $NetBSD: pq3pci.c,v 1.31 2022/05/07 05:08:16 rin Exp $ */
/*-
* Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -39,7 +39,7 @@
#define __INTR_PRIVATE
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pq3pci.c,v 1.30 2022/01/11 22:45:56 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pq3pci.c,v 1.31 2022/05/07 05:08:16 rin Exp $");
#include "locators.h"
@@ -727,8 +727,11 @@
pq3pci_once_init(void)
{
- mutex_init(&pq3pci_intrsources_lock, MUTEX_DEFAULT, IPL_VM);
- mutex_init(&pq3pci_msigroups_lock, MUTEX_DEFAULT, IPL_VM);
+ /*
+ * XXX necessary??
+ */
+ mutex_init(&pq3pci_intrsources_lock, MUTEX_DEFAULT, IPL_NONE);
+ mutex_init(&pq3pci_msigroups_lock, MUTEX_DEFAULT, IPL_NONE);
return 0;
}
@@ -1209,7 +1212,7 @@
uint32_t bitmap[maplen];
pci_intr_handle_t handle;
- mutex_spin_enter(&pq3pci_msigroups_lock);
+ mutex_enter(&pq3pci_msigroups_lock);
for (u_int i = 0; i < maplen; i++) {
struct pq3pci_msigroup * const msig = pq3pci_msigroups[i];
if (msig == NULL) {
@@ -1237,20 +1240,20 @@
struct pq3pci_msihand * const msih __diagused =
pq3pci_msi_claim(handle);
KASSERT(msih != NULL);
- mutex_spin_exit(&pq3pci_msigroups_lock);
+ mutex_exit(&pq3pci_msigroups_lock);
return handle;
}
}
if (freegroup-- == 0) {
- mutex_spin_exit(&pq3pci_msigroups_lock);
+ mutex_exit(&pq3pci_msigroups_lock);
return 0;
}
struct pq3pci_msigroup * const msig =
kmem_zalloc(sizeof(*msig), KM_NOSLEEP);
if (msig == NULL) {
- mutex_spin_exit(&pq3pci_msigroups_lock);
+ mutex_exit(&pq3pci_msigroups_lock);
return 0;
}
pq3pci_msi_group_setup(msig, freegroup, ipl);
@@ -1259,7 +1262,7 @@
struct pq3pci_msihand * const msih __diagused =
pq3pci_msi_claim(handle);
KASSERT(msih != NULL);
- mutex_spin_exit(&pq3pci_msigroups_lock);
+ mutex_exit(&pq3pci_msigroups_lock);
return handle;
}
@@ -1327,17 +1330,17 @@
pq3pci_intr_source_lookup(struct pq3pci_softc *sc, pci_intr_handle_t handle)
{
struct pq3pci_intrsource *pis;
- mutex_spin_enter(&pq3pci_intrsources_lock);
+ mutex_enter(&pq3pci_intrsources_lock);
SIMPLEQ_FOREACH(pis, &pq3pci_intrsources, pis_link) {
if (pis->pis_handle == handle) {
- mutex_spin_exit(&pq3pci_intrsources_lock);
+ mutex_exit(&pq3pci_intrsources_lock);
return pis;
}
}
pis = kmem_zalloc(sizeof(*pis), KM_NOSLEEP);
if (pis != NULL)
pq3pci_intr_source_setup(sc, pis, handle);
- mutex_spin_exit(&pq3pci_intrsources_lock);
+ mutex_exit(&pq3pci_intrsources_lock);
return pis;
}
Home |
Main Index |
Thread Index |
Old Index