<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Aug 11, 2015 at 7:57 AM, Jan-Simon Moeller <span dir="ltr">&lt;<a href="mailto:dl9pf@gmx.de" target="_blank">dl9pf@gmx.de</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Some progress:<br>
<br>
I bisected from 4.1 to 4.2-rc1 and found this.<br>
Sounds scary with clang in mind. This really assumes gcc ;).<br>
<br>
@David: what do you think? Can clang deal with it ?<br>
<br>
<br>
be6cb02779ca74d83481f017db21578cfe92891c is the first bad commit<br>
commit be6cb02779ca74d83481f017db21578cfe92891c<br>
Author: Ingo Molnar &lt;<a href="mailto:mingo@kernel.org">mingo@kernel.org</a>&gt;<br>
Date:   Fri Apr 10 14:08:46 2015 +0200<br>
<br></blockquote><div><br></div><div>Thank you Jan, Woodhouse and everyone, tested with the latest reversal patch and it worked:<br><br>commit 8cb2f092ee1fbfe17cb9c58cd3636ff60a74d88b<br>Author: Jan-Simon Möller &lt;<a href="mailto:dl9pf@gmx.de">dl9pf@gmx.de</a>&gt;<br>Date:   Tue Aug 11 02:20:33 2015 +0200<br><br>    Temporarily revert this patch until we discussed a solution.<br>    <br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
    x86: Align jump targets to 1-byte boundaries<br>
<br>
    The following NOP in a hot function caught my attention:<br>
<br>
      &gt;   5a:   66 0f 1f 44 00 00       nopw   0x0(%rax,%rax,1)<br>
<br>
    That&#39;s a dead NOP that bloats the function a bit, added for the<br>
    default 16-byte alignment that GCC applies for jump targets.<br>
<br>
    I realize that x86 CPU manufacturers recommend 16-byte jump<br>
    target alignments (it&#39;s in the Intel optimization manual),<br>
    to help their relatively narrow decoder prefetch alignment<br>
    and uop cache constraints, but the cost of that is very<br>
    significant:<br>
<br>
            text           data       bss         dec      filename<br>
        12566391        1617840   1089536    15273767      vmlinux.align.16-<br>
byte<br>
        12224951        1617840   1089536    14932327      vmlinux.align.1-<br>
byte<br>
<br>
    By using 1-byte jump target alignment (i.e. no alignment at all)<br>
    we get an almost 3% reduction in kernel size (!) - and a<br>
    probably similar reduction in I$ footprint.<br>
[...]<br>
<br>
<br>
Best,<br>
Jan-Simon<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
<br>
Am Montag, 10. August 2015, 18:57:29 schrieb Jan-Simon Moeller:<br>
&gt; So what I can see in your a2llog is that it fails somewhere between<br>
&gt; init/main smp_setup_processor_id<br>
&gt; and the<br>
&gt; pr_notice after page_address_init .<br>
&gt; It points to memory init imho - there were a lot of small changes in the<br>
&gt; latest cycle (and ASM changes, too).<br>
&gt;<br>
&gt;<br>
&gt; What I see on my log is is similar ...<br>
&gt; page_address_init ~ setup_arch ~ then arch/x86/kernel/setup.c:898<br>
&gt; setup.c:898 is a printk actually ...<br>
&gt; early_idt_handler_array[i]  ~&gt; early_idt_handler_common<br>
&gt;<br>
&gt; then<br>
&gt; early_idt_handler_common at arch/x86/kernel/head_64.S:397<br>
&gt; dump_stack at lib/dump_stack.c:27<br>
&gt;<br>
&gt; dump stack is already the stacktrace.<br>
&gt;<br>
&gt; So somewhere in arch/x86/kernel/setup.c or arch/x86/kernel/head_64.S<br>
&gt;<br>
&gt; commit cdeb6048940fa4bfb429e2f1cba0d28a11e20cd5<br>
&gt; Author: Andy Lutomirski &lt;<a href="mailto:luto@kernel.org">luto@kernel.org</a>&gt;<br>
&gt; Date:   Fri May 22 16:15:47 2015 -0700<br>
&gt;     x86/asm/irq: Stop relying on magic JMP behavior for early_idt_handlers<br>
&gt;<br>
&gt; maybe ?<br>
&gt;<br>
&gt;<br>
&gt; Best,<br>
&gt; JS<br>
&gt;<br>
&gt; Am Montag, 10. August 2015, 23:26:59 schrieb Peter Teoh:<br>
&gt; &gt; Thank you Jan and David,<br>
&gt; &gt;<br>
&gt; &gt; here are the a2l.log.gz file as attachment.   Not sure if it make sense to<br>
&gt; &gt; you?<br>
&gt; &gt;<br>
&gt; &gt; On Mon, Aug 10, 2015 at 10:53 PM, Jan-Simon Moeller &lt;<a href="mailto:dl9pf@gmx.de">dl9pf@gmx.de</a>&gt; wrote:<br>
&gt; &gt; &gt; Yes, its easier to look at -d in_asm.<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; For that reason (and to not forget the commands ;) ) I added to<br>
&gt; &gt; &gt; targets/x86_64 the make goal<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; &quot;make test-qemu-debug&quot; ... Then take a look at a2l.log .<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; It will generate a few files:<br>
&gt; &gt; &gt; - qemulog.log  is the full dose of -din_asm,op,int,exec,cpu,cpu_reset,<br>
&gt; &gt; &gt; - debugaddr.log  has just the mem addr grep&#39;ed out<br>
&gt; &gt; &gt; - addresses.log is the last 2000 of these w/o the rest of the line<br>
&gt; &gt; &gt; - a2l.log  is the output of address2line for each of the lines in<br>
&gt; &gt; &gt; addresses.log<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; In theory it should point to the last functions executed and print out<br>
&gt; &gt; &gt; the function name/line right in the llvmlinux kernel.<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; Still some grep&#39;ing remains in case there&#39;re a lot of prints (e.g.<br>
&gt; &gt; &gt; stacktrace).<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; Possibly limit the amount of data (just limit to -din_asm) in the<br>
&gt; &gt; &gt; makefile.<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; Just compiling now ...<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; Best,<br>
&gt; &gt; &gt; Jan-Simon<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; Am Montag, 10. August 2015, 09:12:18 schrieb David Woodhouse:<br>
&gt; &gt; &gt; &gt; On Sat, 2015-08-08 at 09:33 +0800, Peter Teoh wrote:<br>
&gt; &gt; &gt; &gt; &gt; On Sat, Aug 8, 2015 at 8:24 AM, Jan-Simon Moeller &lt;<a href="mailto:dl9pf@gmx.de">dl9pf@gmx.de</a>&gt;<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; wrote:<br>
&gt; &gt; &gt; &gt; &gt; &gt; This is probably due to a lockup in early boot stages (16bit boot<br>
&gt; &gt; &gt; &gt; &gt; &gt; code).<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; I believe I did fix all of that once, except for the clang bug where<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; it<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; doesn&#39;t honour -mregparm=3 for calls to intrinsics like memcpy:<br>
&gt; &gt; &gt; &gt; <a href="https://llvm.org/bugs/show_bug.cgi?id=3997" rel="noreferrer" target="_blank">https://llvm.org/bugs/show_bug.cgi?id=3997</a><br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; But I&#39;d assume llvmlinux is still carrying the patch which avoids the<br>
&gt; &gt; &gt; &gt; issue with an explicit call to its memcpy function instead of just<br>
&gt; &gt; &gt; &gt; doing a struct assignment and letting LLVM turn it into a memcpy?<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; Perhaps another such issue has arisen, though?<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; &gt; so is there any way to do debugging through &quot;-s -S&quot; option?<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; Debugging 16-bit code with gdb was relatively painful. A lot of the<br>
&gt; &gt; &gt; &gt; time it&#39;s easier just to run it with -d in_asm and read what happened.<br>
<br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature">Regards,<br>Peter Teoh</div>
</div></div>