-----Original Message-----
在 2021年04月23日 17:44, HAGIO KAZUHITO(萩尾 一仁) 写道:
> -----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?
>
Good idea. Could you please post a formal patch about this change?
Yes, I will.
BTW: is that possible to remove the 'cfq_slice_async'?
I don't think so, I would like to keep this with Martin's patch [1], because
these HZ calculations depend on kernel configs, removing it can cause a
regression for vmcores that do not have the 'write_expire'.
And that 'write_expire' way is a little tricky one and the crash utility
has not used a similar way (using gdb_set_crash_scope()) to get a required
value before (I see gdb_set_crash_scope() in trace.c though [2]), so I'd
like to set the 'cfq_slice_async' way above it, i.e.:
if ((THIS_KERNEL_VERSION < LINUX(4,8,0)) &&
symbol_exists("cfq_slice_async")) {
...
} else if ((symbol_exists("dd_init_queue") &&
...
[1]
https://listman.redhat.com/archives/crash-utility/2021-April/msg00063.html
[2]
https://github.com/fujitsu/crash-trace/blob/master/trace.c#L223
Thanks,
Kazu
Thanks.
Lianbo
> 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),
>