[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.11.1604221104560.3941@nanos>
Date: Fri, 22 Apr 2016 11:05:05 +0200 (CEST)
From: Thomas Gleixner <tglx@...utronix.de>
To: "Du, Changbin" <changbin.du@...el.com>
cc: Andrew Morton <akpm@...ux-foundation.org>,
Jonathan Corbet <corbet@....net>,
"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>,
josh@...htriplett.org, Steven Rostedt <rostedt@...dmis.org>,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
jiangshanlai@...il.com, John Stultz <john.stultz@...aro.org>,
Tejun Heo <tj@...nel.org>, borntraeger@...ibm.com,
dchinner@...hat.com, linux-doc@...r.kernel.org,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 2/7] debugobjects: correct the usage of fixup call
results
On Fri, 22 Apr 2016, changbin.du@...el.com wrote:
> From: "Du, Changbin" <changbin.du@...el.com>
>
> If debug_object_fixup() return non-zero when problem has been
> fixed. But the code got it backwards, it taks 0 as fixup
> successfully. So fix it.
Wrong.
> @@ -415,7 +415,7 @@ int debug_object_activate(void *addr, struct debug_obj_descr *descr)
> state = obj->state;
> raw_spin_unlock_irqrestore(&db->lock, flags);
> ret = debug_object_fixup(descr->fixup_activate, addr, state);
> - return ret ? -EINVAL : 0;
> + return ret ? 0 : -EINVAL;
So you need to look at the fixup_activate() callbacks.
timer_fixup_activate()
The only state handled there is ODEBUG_STATE_NOTAVAILABLE. This can happen
for two reasons:
1) timer is statically allocated and initialized. That's a legitimate reason
and it does not count as a fixup
2) timer has not been initialized, so we have no idea what to do with it. We
set it up with a dummy callback and return 1 because that is a fixup.
So the return check for ret != 0 is correct. #2 is invalid
hrtimer_fixup_activate()
There is not much we can do about it.
work_fixup_activate()
That's similar to timer_fixup_activate(). We need to handle the statically
allocated work gracefully.
rcuhead_fixup_activate()
Handles the ODEBUG_STATE_NOTAVAILABLE case by tracking it. Not a fixup,
returns 0.
The other states are invalid and there is not much we can do about
that. Returns 1.
I agree that this is not really intuitive, but it's correct as it is. I'm
happy to take patches which make it simpler to understand. Just blindly
changing everything to bool does not fall into that category.
Thanks,
tglx
Powered by blists - more mailing lists