Re: [PATCH 0/4] x86/insn: perf tools: Add a few new x86 instructions

From: Ingo Molnar
Date: Tue Sep 01 2015 - 08:55:24 EST



* Adrian Hunter <adrian.hunter@xxxxxxxxx> wrote:

> > Agreed, what I concern is that someone finds a bug and fixes one of them and
> > another is not fixed.
> >
> > I'll see the forked version and check if it can be merged into the kernel.
>
> Ever since Linus complained about perf tools including kernel headers, I have
> assumed we should have separate source code. That email thread was not cc'ed to
> a mailing list but here is a quote:
>
> Em Sat, Jul 04, 2015 at 08:53:46AM -0700, Linus Torvalds escreveu:
>
> > So this is more fundamental, and looks like it's just due to perf abusing the
> > kernel headers, and now that rbtree has rcu support ("rbtree: Make lockless
> > searches non-fatal"), it gets tons of headers included that really don't work
> > from user space.
> >
> > There might be other things going on, but the rbtree one seems to be a big
> > one. I think perf needs to get its own rbtree header or something, instead of
> > doing that insane "let's include random core kernel headers" thing.

Note that even plain copying and occasional back-merges isn't a bad solution: it's
better than 'messy sharing' of code.

But we can also share code in a bit more organized fashion, and any of the two
solutions I proposed solve these complications:

- if we do the diff -u check warning during perf build then the forked versions
won't stay forked for long. This is the simplest variant.

- if we librarize this functionality into tools/lib/x86/decode/ (and make sure
it's a library that can be linked into the kernel) then we are back to shared
code.

The problem wasn't to share code per se, the problem was to share code in a messy
way, without making it apparent that it's shared code: which made it easy to break
the tools/perf build via harmless looking kernel side changes.

Thanks,

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