Revert "arm64: alternative: Allow immediate branch as alternative instruction"
authorWill Deacon <will.deacon@arm.com>
Fri, 1 May 2015 12:48:17 +0000 (13:48 +0100)
committerWill Deacon <will.deacon@arm.com>
Tue, 5 May 2015 11:21:52 +0000 (12:21 +0100)
commitb9a95e85bbc56f168f078885f414f305b4589c4b
treecc6acb0ea753833355d3db50ab2b114997fb542f
parent5ebe6afaf0057ac3eaeb98defd5456894b446d22
Revert "arm64: alternative: Allow immediate branch as alternative instruction"

This reverts most of commit fef7f2b2010381c795ae43743ad31931cc58f5ad.

It turns out that there are a couple of problems with the way we're
fixing up branch instructions used as part of alternative instruction
sequences:

  (1) If the branch target is also in the alternative sequence, we'll
      generate a branch into the .altinstructions section which actually
      gets freed.

  (2) The calls to aarch64_insn_{read,write} bring an awful lot more
      code into the patching path (e.g. taking locks, poking the fixmap,
      invalidating the TLB) which isn't actually needed for the early
      patching run under stop_machine, but makes the use of alternative
      sequences extremely fragile (as we can't patch code that could be
      used by the patching code).

Given that no code actually requires alternative patching of immediate
branches, let's remove this support for now and revisit it when we've
got a user. We leave the updated size check, since we really do require
the sequences to be the same length.

Acked-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
arch/arm64/kernel/alternative.c