Re: [RFC PATCH] explicitly mark recursion count
From: Jörn Engel
Date: Wed Jun 02 2004 - 14:02:27 EST
On Wed, 2 June 2004 11:37:50 -0700, Davide Libenzi wrote:
>
> You're requesting to add and maintain data to feed a tool that catches
> only trivially visible recursion. I don't want to waste mine and your time
> explaining why your tool will never work, but if you want an hint, you can
> start thinking about all functions that sets/pass callbacks and/or sets
> operational functions. I don't know if you noticed that, but Linux is
> heavily function-pointer driven. Eg, one function setups a set of function
> pointers, and another 317 indirectly calls them. Having such comments, not
> only makes the maintainance heavier, but gives the false sense of safeness
> that once you drop that data in, you're protected against recursion.
Yeah, I know about the problems to generate a complete call graph.
With function pointers, it is plain impossible to get it right in the
most general case.
Note the "in the most general case" part. You can get things right if
you make some assumptions and those assumptions are actually valid.
In my case the assumptions are:
1. all relevant function pointers are stuffed into some struct and
2. no casts are used to disguise function pointer as something else.
If you stick with those rules, the resulting code is quite sane, which
is much more important than any tools being usable. If the kernel
doesn't stick to those rules for a good reason, I'd like to know about
it, so I can adjust my tool. And if the kernel doesn't stick to those
rules for no good reason, the code if broken and needs to be fixed.
Is this sane?
Jörn
--
A victorious army first wins and then seeks battle.
-- Sun Tzu
-
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/