Re: [PATCH] Fix machdep->HZ calculation for kernel versions > 2.6.0

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

 



-----Original Message-----
> > As for the 'write_expire' way, I found that it can be printed after
> > "set scope dd_init_queue" or "set scope deadline_init_queue" on old kernels.
> >
> > crash> p write_expire
> > No symbol "write_expire" in current context.
> > p: gdb request failed: p write_expire
> > crash> set scope dd_init_queue
> > scope: ffffffffa43e3f80 (dd_init_queue)
> > crash> p write_expire
> > $1 = 5000
> >
> > Maybe we can make use of gdb_set_crash_scope() and gdb_pass_through() to
> > get this value?
> >
> 
> The 'write_expire' is a static variable, which needs to get its value from
> gdb. Seems that it is a bit complicated.
> 
> But It's worth having a try.

The following is a draft patch.  It worked for some dumpfiles I have
from 2.6.16 to 5.11 including RHEL8.0 one.  What do you think?

diff --git a/task.c b/task.c
index 423cd454502b..654df6b1220c 100644
--- a/task.c
+++ b/task.c
@@ -417,7 +417,33 @@ task_init(void)
 
 	STRUCT_SIZE_INIT(cputime_t, "cputime_t");
 
-	if (symbol_exists("cfq_slice_async")) {
+	if ((symbol_exists("dd_init_queue") &&
+	    gdb_set_crash_scope(symbol_value("dd_init_queue"), "dd_init_queue")) ||
+	    (symbol_exists("deadline_init_queue") &&
+	    gdb_set_crash_scope(symbol_value("deadline_init_queue"), "deadline_init_queue"))) {
+		char buf[BUFSIZE];
+		uint write_expire = 0;
+
+		open_tmpfile();
+		sprintf(buf, "printf \"%%d\", write_expire");
+		if (gdb_pass_through(buf, pc->tmpfile, GNU_RETURN_ON_ERROR)) {
+			rewind(pc->tmpfile);
+			while (fgets(buf, BUFSIZE, pc->tmpfile)) {
+				sscanf(buf, "%d", &write_expire);
+			}
+		}
+		close_tmpfile();
+
+		if (write_expire) {
+			machdep->hz = write_expire / 5;
+			if (CRASHDEBUG(2))
+				fprintf(fp, "write_expire exists: setting hz to %d\n",
+					machdep->hz);
+		}
+		fprintf(fp, "write_expire = %d, machdep->hz = %d\n", write_expire, machdep->hz);
+		gdb_set_crash_scope(0, NULL);
+
+	} else if (symbol_exists("cfq_slice_async")) {
 		uint cfq_slice_async;
 
 		get_symbol_data("cfq_slice_async", sizeof(int),


--
Crash-utility mailing list
Crash-utility@xxxxxxxxxx
https://listman.redhat.com/mailman/listinfo/crash-utility




[Index of Archives]     [Fedora Development]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]     [Fedora Tools]

 

Powered by Linux