lkml.org 
[lkml]   [2015]   [Jul]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Kernel broken on processors without performance counters
On Tue, Jul 21, 2015 at 06:12:15PM +0200, Peter Zijlstra wrote:
> Yes, if you start out false, you must be unlikely. If you start out
> true, you must be likely.
>
> We could maybe try and untangle that if there really is a good use case,
> but this is the current state.
>
> The whole reason this happened is because 'false' is like:
>
>
> ...
> <nop>
> 1:
> ...
>
>
>
> label:
> <unlikely code>
> jmp 1b
>
>
> Where the code if out-of-line by default. The enable will rewrite the
> <nop> with a jmp label.

Btw, native_sched_clock() is kinda botched because of that, see below.

I'd want that RDTSC to come first with a NOP preceding it which can
become a JMP in case some idiotic CPU can't do RDTSC and needs to use
jiffies. Instead, we *unconditionally* jump to RDTSC which is WTF?! We
can just as well do a normal unlikely() without the static_key:

.globl native_sched_clock
.type native_sched_clock, @function
native_sched_clock:
pushq %rbp #
movq %rsp, %rbp #,
#APP
# 21 "./arch/x86/include/asm/jump_label.h" 1
1:.byte 0x0f,0x1f,0x44,0x00,0
.pushsection __jump_table, "aw"
.balign 8
.quad 1b, .L122, __use_tsc #,
.popsection

# 0 "" 2
#NO_APP
movabsq $-4294667296000000, %rax #, tmp118
popq %rbp #
imulq $1000000, jiffies_64(%rip), %rdx #, jiffies_64, D.28443
addq %rdx, %rax # D.28443, D.28443
ret
.L122:
#APP
# 118 "./arch/x86/include/asm/msr.h" 1
rdtsc
# 0 "" 2

--
Regards/Gruss,
Boris.

ECO tip #101: Trim your mails when you reply.
--


\
 
 \ /
  Last update: 2015-07-21 20:41    [W:0.141 / U:1.072 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site