Re: [PATCH v5 00/10] x86/asm: Compile-time asm code validation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Josh Poimboeuf <jpoimboe@xxxxxxxxxx> writes:

> On Wed, Jun 10, 2015 at 05:04:12PM +0200, Andi Kleen wrote:
>> > > > - duplicate the destination code inside the function
>> > > > - convert the jump to a call
>> > > 
>> > > That all won't work for a lot of cases.
>> > 
>> > Hm, could you give an example?
>> 
>> Just a standard *_user exception handler.
>
> I'm afraid I don't follow.  Exception handlers don't work via jump
> instructions, but rather via CPU exceptions.
>
> Or are you talking about something else?

Let's take an example:

102:
        .section .fixup,"ax"
        103:    addl %ecx,%edx                  /* ecx is zerorest also */
        jmp copy_user_handle_tail
       .previous

        _ASM_EXTABLE(100b,103b)
        _ASM_EXTABLE(101b,103b)
                
The exception handling code is part of the function, but it's out of line.

> Are you suggesting that we implement this gcc optimization in kernel asm
> code?

It was how Linux traditionally implemented locking code for example.
Have the hot path handle the uncontended fast path, and the slow path
call.

I don't know if there is much left of it (a lot of it was removed because
it was hard to describe in dwarf3, needs dwarf4). But it seems bad
to completely disallow it.

But yes eventually gcc generated code should use it again, because it's
great for icache usage if you measure it correctly at run time
(not the broken "size" approach that is unfortunately far too common)

-Andi

-- 
ak@xxxxxxxxxxxxxxx -- Speaking for myself only
--
To unsubscribe from this list: send the line "unsubscribe live-patching" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux Kernel]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux