|
|
Subscribe / Log in / New account

Variable size jump_label support

From:  Peter Zijlstra <peterz-AT-infradead.org>
To:  x86-AT-kernel.org
Subject:  [RFC][PATCH 0/9] Variable size jump_label support
Date:  Mon, 07 Oct 2019 10:44:43 +0200
Message-ID:  <20191007084443.79370128.1@infradead.org>
Cc:  peterz-AT-infradead.org, linux-kernel-AT-vger.kernel.org, rostedt-AT-goodmis.org, mhiramat-AT-kernel.org, bristot-AT-redhat.com, jbaron-AT-akamai.com, torvalds-AT-linux-foundation.org, tglx-AT-linutronix.de, mingo-AT-kernel.org, namit-AT-vmware.com, hpa-AT-zytor.com, luto-AT-kernel.org, ard.biesheuvel-AT-linaro.org, jpoimboe-AT-redhat.com, hjl.tools-AT-gmail.com
Archive-link:  Article

These here patches are something I've been poking at for a while, enabling
jump_label to use 2 byte jumps/nops.

It _almost_ works :-/

That is, you can build some kernels with it (x86_64-defconfig for example works
just fine).

The problem comes when GCC generates a branch into another section, mostly
.text.unlikely. At that point GAS just gives up and throws a fit (more details
in the last patch).

Aside from anyone coming up with a really clever GAS trick, I don't see how we
can do this other than:

 - get binutils/gas 'fixed', for this there's two possible approaches:

  * add some extra operators such that something like:

      .set disp %[l_yes] ~ 1b ? (%[l_yes] - (1b + 2)) : 128

    works, where the new '~' infix operator would indicate left and right hand
    operands are from the same section, and the ?: conditional operator would be
    added to make it all work.

  * add a 'fake' mnemonic for x86 that directly generates the right NOP:

      nojmp{.d8,d32} %target

    which would completely mirror how the existing 'jmp{.d8,d32} %target'
    works, except it would emit single instruction NOP2/NOP5.

 - use 'jmp' and get objtool to rewrite the text. Steven has earlier proposed
   something like that (using recordmcount) and Linus hated that.



Copyright © 2019, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds