Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/sys Break cycle by using `struct kmutex *' instead of `k...
details: https://anonhg.NetBSD.org/src/rev/a6361a2f41e5
branches: trunk
changeset: 377467:a6361a2f41e5
user: riastradh <riastradh%NetBSD.org@localhost>
date: Thu Jul 13 12:06:20 2023 +0000
description:
Break cycle by using `struct kmutex *' instead of `kmutex_t *'.
sys/sched.h included sys/mutex.h
which includes sys/intr.h
which includes machine/intr.h
which on cats includes arm/footbridge/footbridge_intr.h
which includes arm/cpu.h
which includes sys/cpu_data.h
which includes sys/sched.h
But there was never any real need for sys/mutex.h in sys/sched.h,
because it only uses pointers to the opaque struct kmutex. Cycle
broken by using `struct kmutex *' instead of pulling in sys/mutex.h
for the definition of kmutex_t.
Side effect: This revealed that sys/cpu_data.h needed sys/intr.h
(which was pulled in accidentally by sys/mutex.h via sys/sched.h) for
SOFTINT_COUNT. Also revealed some other machine/cpu.h header files
were missing includes of sys/mutex.h for kmutex_t.
diffstat:
sys/arch/sparc/include/cpu.h | 4 +++-
sys/arch/sparc64/include/cpu.h | 3 ++-
sys/arch/x86/include/cpu.h | 6 +++++-
sys/sys/cpu_data.h | 3 ++-
sys/sys/sched.h | 9 +++++----
5 files changed, 17 insertions(+), 8 deletions(-)
diffs (105 lines):
diff -r e337ca426e69 -r a6361a2f41e5 sys/arch/sparc/include/cpu.h
--- a/sys/arch/sparc/include/cpu.h Thu Jul 13 09:12:23 2023 +0000
+++ b/sys/arch/sparc/include/cpu.h Thu Jul 13 12:06:20 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.h,v 1.110 2021/08/14 17:51:19 ryo Exp $ */
+/* $NetBSD: cpu.h,v 1.111 2023/07/13 12:06:20 riastradh Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -407,6 +407,8 @@ struct cpu_info {
/* Kernel only things. */
#if defined(_KERNEL)
+#include <sys/mutex.h>
+
/*
* definitions of cpu-dependent requirements
* referenced in generic code
diff -r e337ca426e69 -r a6361a2f41e5 sys/arch/sparc64/include/cpu.h
--- a/sys/arch/sparc64/include/cpu.h Thu Jul 13 09:12:23 2023 +0000
+++ b/sys/arch/sparc64/include/cpu.h Thu Jul 13 12:06:20 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.h,v 1.133 2021/08/14 17:51:19 ryo Exp $ */
+/* $NetBSD: cpu.h,v 1.134 2023/07/13 12:06:20 riastradh Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -89,6 +89,7 @@ struct cacheinfo {
#endif
#include <sys/cpu_data.h>
+#include <sys/mutex.h>
#include <sys/evcnt.h>
/*
diff -r e337ca426e69 -r a6361a2f41e5 sys/arch/x86/include/cpu.h
--- a/sys/arch/x86/include/cpu.h Thu Jul 13 09:12:23 2023 +0000
+++ b/sys/arch/x86/include/cpu.h Thu Jul 13 12:06:20 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.h,v 1.133 2022/09/07 00:40:18 knakahara Exp $ */
+/* $NetBSD: cpu.h,v 1.134 2023/07/13 12:06:20 riastradh Exp $ */
/*
* Copyright (c) 1990 The Regents of the University of California.
@@ -65,6 +65,10 @@
#include <sys/evcnt.h>
#include <sys/device_if.h> /* for device_t */
+#ifdef SVS
+#include <sys/mutex.h>
+#endif
+
#ifdef XEN
#include <xen/include/public/xen.h>
#include <xen/include/public/event_channel.h>
diff -r e337ca426e69 -r a6361a2f41e5 sys/sys/cpu_data.h
--- a/sys/sys/cpu_data.h Thu Jul 13 09:12:23 2023 +0000
+++ b/sys/sys/cpu_data.h Thu Jul 13 12:06:20 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu_data.h,v 1.53 2023/07/07 12:34:50 riastradh Exp $ */
+/* $NetBSD: cpu_data.h,v 1.54 2023/07/13 12:06:20 riastradh Exp $ */
/*-
* Copyright (c) 2004, 2006, 2007, 2008, 2019, 2020 The NetBSD Foundation, Inc.
@@ -44,6 +44,7 @@ struct lwp;
#include <sys/queue.h>
#include <sys/kcpuset.h>
#include <sys/ipi.h>
+#include <sys/intr.h>
/* Per-CPU counters. New elements must be added in blocks of 8. */
enum cpu_count {
diff -r e337ca426e69 -r a6361a2f41e5 sys/sys/sched.h
--- a/sys/sys/sched.h Thu Jul 13 09:12:23 2023 +0000
+++ b/sys/sys/sched.h Thu Jul 13 12:06:20 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sched.h,v 1.91 2022/10/26 23:24:09 riastradh Exp $ */
+/* $NetBSD: sched.h,v 1.92 2023/07/13 12:06:20 riastradh Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2002, 2007, 2008, 2019, 2020
@@ -142,10 +142,11 @@ int _sched_protect(int);
#if defined(_KERNEL) || defined(_KMEMUSER)
-#include <sys/mutex.h>
#include <sys/time.h>
#include <sys/queue.h>
+struct kmutex;
+
/*
* Per-CPU scheduler state. Field markings and the corresponding locks:
*
@@ -155,8 +156,8 @@ int _sched_protect(int);
* c: cpu_lock
*/
struct schedstate_percpu {
- kmutex_t *spc_mutex; /* (: lock on below, runnable LWPs */
- kmutex_t *spc_lwplock; /* (: general purpose lock for LWPs */
+ struct kmutex *spc_mutex; /* (: lock on below, runnable LWPs */
+ struct kmutex *spc_lwplock; /* (: general purpose lock for LWPs */
struct lwp *spc_migrating; /* (: migrating LWP */
struct cpu_info *spc_nextpkg; /* (: next package 1st for RR */
psetid_t spc_psid; /* c: processor-set ID */
Home |
Main Index |
Thread Index |
Old Index