Current-Users archive

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

Re: HEADS UP: Merging drm update



> Date: Fri, 24 Dec 2021 01:53:03 +0900
> From: Ryo ONODERA <ryo%tetera.org@localhost>
> 
> And with this patch, I have gotten the following dmesg:
> This has no bus_space_map and extent_alloc_subregion1...

OK, can you try the attached patch and see if it gives us any clues in
dmesg?  This prints a stack trace any time subr_extent.c writes to a
struct extent_region and the region now covers the relevant space.
diff --git a/sys/kern/subr_extent.c b/sys/kern/subr_extent.c
index 05962829e9a9..e7a461c6f265 100644
--- a/sys/kern/subr_extent.c
+++ b/sys/kern/subr_extent.c
@@ -98,6 +98,22 @@ panic(a ...)			printf(a)
 #define	KASSERT(exp)
 #endif
 
+#include <ddb/ddb.h>
+#define	BADSTART		((unsigned long)0x63ec5018)
+#define	OPREGION_SIZE           (8 * 1024)
+#define	BADEND			(BADSTART + OPREGION_SIZE)
+static void
+dumpex(const struct extent_region *rp, const char *file, int line)
+{
+
+	if (BADEND < rp->er_start || rp->er_end <= BADSTART)
+		return;
+	printf("%s:%d extent_region @ %p [0x%lx, 0x%lx)\n", file, line, rp,
+	    rp->er_start, rp->er_end);
+	db_stacktrace();
+}
+#define	DUMPEX(rp)	dumpex(rp, __FILE__, __LINE__)
+
 static struct pool expool;
 
 /*
@@ -373,6 +389,7 @@ extent_insert_and_optimize(struct extent *ex, u_long start, u_long size,
 			 * We can coalesce.  Prepend us to the first region.
 			 */
 			LIST_FIRST(&ex->ex_regions)->er_start = start;
+			DUMPEX(LIST_FIRST(&ex->ex_regions));
 			extent_free_region_descriptor(ex, rp);
 			return;
 		}
@@ -383,6 +400,7 @@ extent_insert_and_optimize(struct extent *ex, u_long start, u_long size,
 		 */
 		rp->er_start = start;
 		rp->er_end = start + (size - 1);
+		DUMPEX(rp);
 		LIST_INSERT_HEAD(&ex->ex_regions, rp, er_link);
 		return;
 	}
@@ -402,6 +420,7 @@ extent_insert_and_optimize(struct extent *ex, u_long start, u_long size,
 		 * note of it.
 		 */
 		after->er_end = start + (size - 1);
+		DUMPEX(after);
 		appended = 1;
 	}
 
@@ -420,6 +439,7 @@ extent_insert_and_optimize(struct extent *ex, u_long start, u_long size,
 			 * Yup, we can free it up.
 			 */
 			after->er_end = LIST_NEXT(after, er_link)->er_end;
+			DUMPEX(after);
 			nextr = LIST_NEXT(after, er_link);
 			LIST_REMOVE(nextr, er_link);
 			extent_free_region_descriptor(ex, nextr);
@@ -428,6 +448,7 @@ extent_insert_and_optimize(struct extent *ex, u_long start, u_long size,
 			 * Nope, just prepend us to the next region.
 			 */
 			LIST_NEXT(after, er_link)->er_start = start;
+			DUMPEX(LIST_NEXT(after, er_link));
 		}
 
 		extent_free_region_descriptor(ex, rp);
@@ -452,6 +473,7 @@ extent_insert_and_optimize(struct extent *ex, u_long start, u_long size,
 	 */
 	rp->er_start = start;
 	rp->er_end = start + (size - 1);
+	DUMPEX(rp);
 	LIST_INSERT_AFTER(after, rp, er_link);
 }
 
@@ -1118,12 +1140,14 @@ extent_free(struct extent *ex, u_long start, u_long size, int flags)
 		/* Case 2. */
 		if ((start == rp->er_start) && (end < rp->er_end)) {
 			rp->er_start = (end + 1);
+			DUMPEX(rp);
 			goto done;
 		}
 
 		/* Case 3. */
 		if ((start > rp->er_start) && (end == rp->er_end)) {
 			rp->er_end = (start - 1);
+			DUMPEX(rp);
 			goto done;
 		}
 
@@ -1132,9 +1156,11 @@ extent_free(struct extent *ex, u_long start, u_long size, int flags)
 			/* Fill in new descriptor. */
 			nrp->er_start = end + 1;
 			nrp->er_end = rp->er_end;
+			DUMPEX(nrp);
 
 			/* Adjust current descriptor. */
 			rp->er_end = start - 1;
+			DUMPEX(rp);
 
 			/* Insert new descriptor after current. */
 			LIST_INSERT_AFTER(rp, nrp, er_link);


Home | Main Index | Thread Index | Old Index