Re: Checking to see if a bit is _not_ set in a ftrace event filter

From: Steven Rostedt
Date: Mon Dec 01 2014 - 21:41:21 EST


On Mon, 1 Dec 2014 21:19:12 -0500
Theodore Ts'o <tytso@xxxxxxx> wrote:

> I was trying to do something like this:
>
> filter="events/writeback/writeback_mark_inode_dirty/filter"
> echo "(flags & 2048) && ((state & 2048) == 0)" > $filter
>
> ... but that doesn't work.
>
> This works:
>
> echo "flags & 2048" > $filter
>
> But the problem is this:
>
> echo "(state & 2048) == 0" > $filter
>
> The simplest patch to add this would be add a new filter_ops so we
> could do this:
>
> echo "(state !& 2048)" > $filter
>
> ... but that's pretty ugly. But adding more general expression
> parsing in the ftrace event filter code would be non-trivial, and if
> we start trying to make things like "!(state & 2048)" or "(state &
> 2048) == 0", then at some point some crazy person might request
> supporting something like this: "(state ^ flags) == 2048". :-)
>
> So I guess the main question I want to ask is your opinion about
> whether a patch that adds support for the operator "!&" is too ugly to
> live?
>

Yeah, I don't want to add some bastardization compare that we'll be
stuck with till the end of time. Either we modify the tree walk to
handle values (it shouldn't be too difficult, but it wont be trivial),
or we wait till eBPF is up and running as the trace filter replacement
and that should be able to handle this much better.

-- Steve
--
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/