Re: [patch 0/2] Immediate Values - jump patching update

From: H. Peter Anvin
Date: Mon Apr 28 2008 - 21:09:20 EST


Frank Ch. Eigler wrote:
This would require either that DWARF processing be done far after
kernel build, and thus the kernel cannot be self-sufficient /
introspective without user-space assistance (like firmware); or that
the DWARF data extraction (and systemtap-like $context-variable code
generation) be part of the kernel build itself. It *might* be
workable.

DWARF processing done after the kernel build isn't really a problem, although it requires a large vmlinux(.gz) file to be kept around.

As part of the kernel build is probably better, at least in the case of static markers.

At least one complication though is that in the case of markers,
tracing parameter evaluation is itself conditional (and placed out of
the hot path due to -freorder-blocks). With your suggested kind of
assembly ("g" constraints for all the expressions), those expressions
would be evaluated unconditionally, just to make them live somewhere.
That unconditional evaluation can easily entail memory reads and
dependent arithmetic, which could swamp the savings of eliminating the
marker-style conditional branch.

Well, it depends a bit on what kind of expressions you put in there.
You don't really want to put *expressions* in there as much as you want to put *data* references in there, although, of course, if your have something like "foo->bar[baz]->quux" then it's easy to trip upon.

One advantage of using the debugging information in this manner is that you can write the actual markers long after the kernel has compiled, as long as the data happens to be available at the call site.

Once again, the *proper* way to do this is with compiler support. That way we can do patched branches and out-of-line everything with impunity.

-hpa

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