* Linus Torvalds <torva...@linux-foundation.org> wrote:
> On Mon, Feb 12, 2018 at 1:37 AM, Ingo Molnar <mi...@kernel.org> wrote:
> > Ok, so this does not look _that_ complicated, and the .text savings are
> > significant:
> Honestly, I think we should do it. 3kB of assembly code is noticeable.
> Also, that patch actually allows more cleanups and simplifications.
> Look at the "interrupt" macro, which is used by 'apicinterrupt3', and
> has a number of uses that way.
> That code could be unified a lot, right now it does:
> testb $3, CS-ORIG_RAX(%rsp)
> jz 1f
> call switch_to_thread_stack
> testb $3, CS(%rsp)
> jz 1f
> * IRQ from user mode.
> * We need to tell lockdep that IRQs are off. We can't do this until
> * we fix gsbase, and we should do it before enter_from_user_mode
> * (which can take locks). Since TRACE_IRQS_OFF idempotent,
> * the simplest way to handle it is to just call it twice if
> * we enter from user mode. There's no reason to optimize this since
> * TRACE_IRQS_OFF is a no-op if lockdep is off.
> ENTER_IRQ_STACK old_rsp=%rdi
> /* We entered an interrupt context - irqs are off: */
> and *all* of that could be in a helper function rather than be
> duplicated. and the apicinterrupt3 macro should end up just expanding
> callq helper
> pushq $~(\num)
> callq \fn
> jmp ret_from_intr
> instead of expanding to all that code.
> But that would require that same "save_ret" logic.
> So it's not just the idtentry cases that can use this trick.
> I admit that the trick isn't pretty, but it's not *horribly* ugly either.
Dominik, could you please do this on top latest tip:master? I have applied all
other patches. Note that patch #8 now conflicts with recent annotation fixes.