Bug 199845

Summary: Often times black screen on boot (boot hangs)
Product: Memory Management Reporter: harryharryharry (vaaghoofdharry)
Component: OtherAssignee: Andrew Morton (akpm)
Status: RESOLVED CODE_FIX    
Severity: high CC: dvyukov, kirill
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 4.17-rc1 Subsystem:
Regression: No Bisected commit-id:
Attachments: Initramfs unpacking failed: uncompression error
Initramfs unpacking failed: junk in compressed archive
Initramfs unpacking failed: broken padding

Description harryharryharry 2018-05-26 14:11:30 UTC
Created attachment 276207 [details]
Initramfs unpacking failed: uncompression error

Since 4.17-rc1 my Asus X205TA (baytrail platform) often hangs on boot, when this happens I need to hard reset the laptop. I've looked for similar bugtrackers and there are some:

Black screen every 1/3 times on boot
https://bugzilla.kernel.org/show_bug.cgi?id=199613

screen stays dark for long on bootup since kernel 4.17.0-rc2+
https://bugzilla.kernel.org/show_bug.cgi?id=199619

black screen irrespective of amdgpu.dc=1 or 0 at boot on kernels 4.17-rc2 and onwards caused by low entropy
https://bugzilla.kernel.org/show_bug.cgi?id=199567

The first one being the most similar in describing the symptoms. But neither one of the recommended solutions (generating entropy on boot, enabling kasan memory debugger) helped for me.

I noticed while on ubuntu with the mainline kernel 4.17-rc1 that sometimes instead of a black screen I got an actual screendump of what went wrong (I've attached pictures). The errors are always slightly different but all point to initramfs decompression issues. So I started looking at the diff between 4.16 and 4.17-rc1 and reverted the commits to head_64.S (and for the compilation to succeed also the commits to pgtable_64.c). This 'solves' or rather circumvents the boot hangs for me. This workaround still works on 4.17-rc6.
Comment 1 harryharryharry 2018-05-26 14:14:08 UTC
Created attachment 276209 [details]
Initramfs unpacking failed: junk in compressed archive
Comment 2 harryharryharry 2018-05-26 14:14:48 UTC
Created attachment 276211 [details]
Initramfs unpacking failed: broken padding
Comment 3 Dmitry Vyukov 2018-05-26 14:54:04 UTC
This does not seem to be related to KASAN/sanitizers.
Comment 4 harryharryharry 2018-05-26 16:40:44 UTC
Sorry, I couldn't find a suitable category. I must have missed 'other'. Thanks for amending.
Comment 5 Kirill A. Shutemov 2018-05-28 11:49:00 UTC
Hm. Could you try to bisect which commit is first broken one?
Comment 6 harryharryharry 2018-05-28 12:36:59 UTC
Either the commit for head_64.S in 4.17-rc1:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/diff/arch/x86/boot/compressed/head_64.S?id=v4.17-rc1&id2=v4.16

or the commit for pgtable_64.c in 4.17-rc1:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/diff/arch/x86/boot/compressed/pgtable_64.c?id=v4.17-rc1&id2=v4.16

I can't successfully compile the kernel with only the first commit reverted.
Comment 7 Kirill A. Shutemov 2018-05-28 13:31:19 UTC
That's not commits. That's just diffs between v4.16 and v4.17-rc1 for these files. It doesn't help much with isolating the problem.

Could you find the first broken *commit*.

This would give the list of commits to look at:

git log --no-merges --oneline v4.16..v4.17-rc1 arch/x86/boot/compressed

And have you checked that plain 4.17-rc6 or -rc7 are still broken? There was couple of fixes in v4.17-rc6 in this area.
Comment 8 harryharryharry 2018-05-30 20:46:40 UTC
Thanks for the pointers, sorry I'm not too savvy with git but I'm trying to learn.

When head is at:
d6289f36aa7d (HEAD) x86/build: Don't pass in -D__KERNEL__ multiple times
loading the initramfs never freezes.

When head is at:
07344b15a994 (HEAD) x86/boot: Fix SEV boot failure from change to __PHYSICAL_MASK_SHIFT
loading the initramfs freezes regularly.

I checked 07344b15a994 with git show, but there doesn't seem to be anything regarding head_64.S or pgtable_64.c in there. However the following commit (194a9749c73d) pertains arch/x86/boot/compressed/head_64.S

Is this the commit that causes the random freezes during initramfs load ?
Comment 9 harryharryharry 2018-05-31 10:45:36 UTC
Forgot to add: I've tried 4.17-rc6 en 4.17-rc7 and 4.17.0-rc7-next-20180529 and they all exhibit the same freezing behaviour.
Comment 10 Kirill A. Shutemov 2018-05-31 14:13:40 UTC
Could you also check if 547edaca247a works fine for you?
Comment 11 harryharryharry 2018-05-31 20:11:49 UTC
No the initramfs also fails to load sometimes when booting a kernel compiled with head at:
547edaca247a (HEAD) x86/mm: Update comment in detect_tme() regarding x86_phys_bits
Comment 12 harryharryharry 2018-06-17 14:12:44 UTC
Issue still occurs with 4.18-rc1