Re: [PATCH 1/1] x86: fix text_poke

From: Andi Kleen
Date: Fri Apr 25 2008 - 12:13:36 EST


On Fri, Apr 25, 2008 at 09:06:37AM -0700, Linus Torvalds wrote:
>
>
> On Fri, 25 Apr 2008, Andi Kleen wrote:
> >
> > So all these checks can be just removed.
>
> Quite frankly, I'd rather tighten them up. All the callers actually seem
> to do just a single-byte one.

I think Mathieu did them to prepare for his immediate values which
need to write more bytes (although actually it would be quite
possible to have immediate values only for byte immediates too)

But that code needs much more infrastructure anyways.

>
> So I'd suggest really tightening it up to require total natural alignment

For the common (everything but kprobes) "other code not running"
it doesn't matter and I don't think natural alignment works for the
other cases anyways.

FWIW the original text_poke I started long ago only did bytes

> (rather than the weaker version that required that it fit in an aligned
> unsigned long or whatever). And I'd suggest using FIXMAP's instead of
> vmap. Maybe something like the appended (TOTALLY UNTESTED!)

Not sure how the fixmap is better. It's pretty much equivalent, isn't it?
Perhaps a little cheaper, but the code shouldn't be performance critical.

-Andi

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