On Thu, Jul 21, 2016 at 11:06:06AM +0800, Liang, Kan wrote:
Hi Fengguang,

I located the unreachable instruction which is ud2.

This instruction will raise invalid opcode exception. So I think
normally it should not be reached.  Also ud2 should be generated by
compiler, not our codes.

It's great to know that!

I have no idea how to fix it.
Have you met similar issue before?
Do you have any suggestions?

The warning shows up when we enabled gcc-4.4 for kernel build tests.
It emits this "function has unreachable instruction" warning for
~10000 kernel functions all over the places.

So it must be a toolchain specific problem.
Let's CC LKML and gcc lists for possible solutions.

0000000000000e0f <snbep_uncore_msr_enable_event>:
    e0f:       55                      push   %rbp
    e10:       48 89 e5                mov    %rsp,%rbp
    e13:       53                      push   %rbx
    e14:       83 be 80 01 00 00 ff    cmpl   $0xffffffff,0x180(%rsi)
    e1b:       48 89 f3                mov    %rsi,%rbx
    e1e:       74 2b                   je     e4b 
<snbep_uncore_msr_enable_event+0x3c>
    e20:       31 f6                   xor    %esi,%esi
    e22:       e8 00 00 00 00          callq  e27 
<snbep_uncore_msr_enable_event+0x18>
    e27:       48 89 c2                mov    %rax,%rdx
    e2a:       8b b3 78 01 00 00       mov    0x178(%rbx),%esi
    e30:       48 c1 ea 20             shr    $0x20,%rdx
    e34:       48 83 3d 00 00 00 00    cmpq   $0x0,0x0(%rip)        # e3c 
<snbep_uncore_msr_enable_event+0x2d>
    e3b:       00
    e3c:       75 02                   jne    e40 
<snbep_uncore_msr_enable_event+0x31>
    e3e:       0f 0b                   ud2
    e40:       89 f7                   mov    %esi,%edi
    e42:       89 c6                   mov    %eax,%esi
    e44:       ff 14 25 00 00 00 00    callq  *0x0

Thanks,
Kan


tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
master
head:   47ef4ad2684d380dd6d596140fb79395115c3950
commit: 3b94a891667c30fb4624221497d77fc65d950345
perf/x86/intel/uncore: Remove SBOX support for Broadwell server
date:   7 weeks ago
config: x86_64-randconfig-s0-07191857 (attached as .config)
compiler: gcc-4.4 (Debian 4.4.7-8) 4.4.7
reproduce:
        git checkout 3b94a891667c30fb4624221497d77fc65d950345
        # save the attached .config to linux build tree
        make ARCH=x86_64

All warnings (new ones prefixed by >>):

>> arch/x86/events/intel/uncore_snbep.o: warning: objtool:
snbep_uncore_msr_enable_event()+0x2e: function has unreachable
instruction

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Reply via email to