Re: [PATCH v4] debugobjects: print more data

From: Thomas Gleixner
Date: Tue Feb 22 2011 - 12:21:11 EST


On Tue, 22 Feb 2011, Stanislaw Gruszka wrote:
> On main print function I changed WARN to printk to avoid "cut off" lines
> and keep all informations together.

Sorry for not noticing the problem with this earlier. It makes bug
reporting for Joe user harder than it is now. The WARN based output is
automatically captured by kerneloops and other tools. Your change
prevents it.

And we can be more clever about it.

> struct debug_obj_descr {
> const char *name;
> -
> + void (*print) (void *addr);

So we could change that function to be

void *(debug_hint) (void *addr);

And let it do:

static void *debug_hint(void *addr)
{
return ((struct hrtimer *) addr)->function;
}

The object pointer itself is already known and pretty pointless. There
is really no debug value in the pointer itself.

That would change debug_print_object() to:

void *hint = descr->debug_hint ? descr->debug_hint(obj->object) : NULL;

and make

WARN(1, KERN_ERR "ODEBUG: %s %s (active state %u) object type: %s hint: %pS\n",
msg, obj_states[obj->state], obj->astate,
obj->descr->name, hint);

So we get the valuable additional information w/o losing the ability
of automated bug reports. And I think all we ever want is something
like a callback function, which helps us to identify the object.

Thanks,

tglx
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/