User: Password:
|
|
Subscribe / Log in / New account

Link-time optimization for the kernel

Link-time optimization for the kernel

Posted Aug 21, 2012 23:22 UTC (Tue) by andikleen (guest, #39006)
Parent article: Link-time optimization for the kernel

Thanks for the article

I should clarify that the sysycall argument problem in
http://lwn.net/Articles/512685/
is not LTO specific. It's a general problem that the 32bit kernel violates the ABI. It uses some stack arguments for syscalls inside the kernel. The actual syscall interface is defined with registers, but the interface between the syscall entry code and the actual syscall has stack arguments.

The kernel entry code saves all registers on the stack. The same area also doubles as the stack arguments for syscalls.

According to the ABI it's legal for the compiler to change arguments on the stack. But the 32bit kernel cannot tolerate this because it corrupts the saved user space registers.

My 32bit LTO kernel just happened to hit this and the "noinline" is just a workaround to change the register allocation. But there's nothing wrong with inlining in LTO.

The problem could happen without LTO too.

64bit kernel don't have this problem because they pass all 6 syscall arguments in registers even inside the kernel.

It was also not fun to debug.

-Andi Kleen


(Log in to post comments)

Link-time optimization for the kernel

Posted Aug 22, 2012 1:56 UTC (Wed) by jhoblitt (subscriber, #77733) [Link]

Sounds like it's not worth trying to support LTO for x86 kernels until it's a proven win on amd64.

Link-time optimization for the kernel

Posted Aug 22, 2012 3:19 UTC (Wed) by andikleen (guest, #39006) [Link]

I don't think the problem is that common. We can work around it too.

Link-time optimization for the kernel

Posted Aug 23, 2012 8:07 UTC (Thu) by gb (subscriber, #58328) [Link]

Interesting experiment, but what's the point of building 32-bit kernels at this moment then 64-bit installations are more common than 32-bit?

Link-time optimization for the kernel

Posted Aug 23, 2012 19:31 UTC (Thu) by stevenb (guest, #11536) [Link]

Is that really true in the mobile space? ;-)

Link-time optimization for the kernel

Posted Aug 24, 2012 12:14 UTC (Fri) by misiu_mp (guest, #41936) [Link]

In the mobile space we have arm and it has plenty of registers doesn't it?

Link-time optimization for the kernel

Posted Aug 26, 2012 4:05 UTC (Sun) by theICEBear (guest, #23193) [Link]

It does and AArch64 is not far away, given rate of change within the mobile/pad fad-driven world the new chips will start hitting market sooner rather than later.

Link-time optimization for the kernel

Posted Aug 27, 2012 20:01 UTC (Mon) by stevenb (guest, #11536) [Link]

I was thinking more of 32-bits Atom.

ARM Thumb wouldn't have many registers either, but I don't know whether you could (or could want to) build an ARM Thumb linux kernel.

Link-time optimization for the kernel

Posted Aug 30, 2012 19:20 UTC (Thu) by cibervicho (subscriber, #52552) [Link]

ARM Thumb wouldn't have many registers either, but I don't know whether you could (or could want to) build an ARM Thumb linux kernel.
Thumb and Thumb-2 have as many registers as ARM (32-bit). You can build a Thumb-2 kernel with CONFIG_THUMB2_KERNEL=y


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