Received: by 10.223.176.46 with SMTP id f43csp752062wra; Sat, 20 Jan 2018 04:11:14 -0800 (PST) X-Google-Smtp-Source: AH8x227lkvf1bWGjGxIi+cgiqBldeSXr4uY9pXNY9wJD39uMneuBgZ2+dLKTCMGksOS4WY//g1xH X-Received: by 10.98.139.8 with SMTP id j8mr2162935pfe.4.1516450274594; Sat, 20 Jan 2018 04:11:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516450274; cv=none; d=google.com; s=arc-20160816; b=YECOUvxQt+ASbP9LRTe3QD/hDSAcI8r+ukNY4eoy0huqEShpDQY/nEEW45Xf+IBixB qpwakb0oSXyjxauQ7TevuFgr+uYov+EL8UOqoHpA4fimH937ifZZspKocYw64jC8SZYv NeqLiJLK1sBVBk5XnLeqUcHy3HM9T5vFCAQdcdj5F2NsXX73I9BDi8RMXRpx1qGdAEid ufDE1OzFnbSmq79d79UoxGCuewjZhNvvMNDXjRgVERjG2J42CVJ/x9pw3ukXv19kSQeE 8UyqaGNTDGjO6q8w0Fej49PygIRed6dPUBAisd6oOBCDQ9+J4fvTKJGXbw0hprX/FGiE MeMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=lHT7AuxxaLDrVl19TggdMX35NgoNA8OJL9uabv7KIa8=; b=U/XAj+IhGdWLuDepnPoDpINj1xqIPflskgMHGep491I49JqMGrgRwchYrOZLGZSYKT Cko3M+Mghm1ZrwPO71fH3SIFL9baV1c5qphe4dzEZO6/fiL0lQgIeflAAy/ejB9ypG8o JyqXxLJLeZZuu/lyo26MJWA3uAJpabQ0NYg//0JVhuPm5jBxKn/qojugZ2lmZHPUj2uf Yh9hGmmTmVniNkAprGiG1Rze5g4NannKYW+SNCD74cLWycG5PzYzR57z3tL9V31IgYn2 QjeXfeY55OSu6LDkdmdnw2m7Bl/zJ76RtZZ8Vl+v+rf1CmwUcTVQSP0b8KzeBpfXc3G5 IpwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=AnGdQGM9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b10si10516512pgr.765.2018.01.20.04.11.00; Sat, 20 Jan 2018 04:11:14 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=AnGdQGM9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753549AbeATMIk (ORCPT + 99 others); Sat, 20 Jan 2018 07:08:40 -0500 Received: from mail-lf0-f49.google.com ([209.85.215.49]:33695 "EHLO mail-lf0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751063AbeATMIe (ORCPT ); Sat, 20 Jan 2018 07:08:34 -0500 Received: by mail-lf0-f49.google.com with SMTP id t139so5200415lff.0 for ; Sat, 20 Jan 2018 04:08:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=lHT7AuxxaLDrVl19TggdMX35NgoNA8OJL9uabv7KIa8=; b=AnGdQGM9dhRMV2IYE4x1dyGsXwC5w/dSxyDPee3xFfWvlOc6CR+KyMXrUVC3nEvA9k 9g3ZDaJ0mz660XXsUgf+U7o4PS2Nf7r0KWUSVhIc46l4TJ1xxl4g6LFdCZOjZO/w2Twh GcdNoe12PmFBFITGe2xvTI4t1QlKRHnUgoqw2v7vr6oszSdtAXGKNWDUOZWxZ9ptJhlX gO4jruZHyJWlbNHD1/gkM8yZw8IT0Rej8Q22NxGtfjJieQ/MVGAX6SKrW0y4bxylZFdi rnIjyqtMZcxNXLEIcwFbiLQry3OslKlGN+CjFF6snmQJshZK9HlJncLNkN/9VNU7VesE C4Jw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=lHT7AuxxaLDrVl19TggdMX35NgoNA8OJL9uabv7KIa8=; b=R/O74lto+tExEOokzig60EZaIQ1M66UF8nXP+6i0mNCa160nR1zIhvUyCShMtb2R/W 6UlfYvMyrL2JkERF3XTRcT2ZJrdzheZSs28sqny3MJBrLmshZEMBJnK7ltiEau09gJ/E AFdFgQB6Wb7qMAda+14qmFUD/quVnpdtnOn4KJ3rCjYDE+rMu0DMor5Zd0qmTLjzHPCA gYCTVNB08Zvs6dmpfy738npU7gMBHOGqJT3bela707wrMm6TYb0bvTgrejMie1sYfX1S hNn2xn4ygcyyZTbvqyPAvNmg4CiTx3O1Q41fMx2W1IUQ9oGyVG5opjTCz/x327cM8zlz whzA== X-Gm-Message-State: AKwxytf3Yb2yT0yrzRydsf3KRdKF7xxUR+srbGo01iZToiNU3Il42xek tkaw2xOrzJ3ykIzlOVbKVmmvfJtdPFLfIarsDg== X-Received: by 10.46.17.135 with SMTP id 7mr745090ljr.87.1516450112941; Sat, 20 Jan 2018 04:08:32 -0800 (PST) MIME-Version: 1.0 Received: by 10.25.113.21 with HTTP; Sat, 20 Jan 2018 04:08:02 -0800 (PST) In-Reply-To: <2cf1f64f-b7df-9f3a-ce61-36cd4fe5688b@redhat.com> References: <9fdddcb1-d122-7d52-9204-7066ada5ccba@redhat.com> <44505ab1-237b-88ea-1fb1-f80de9b3025a@redhat.com> <6277b77a-d4a0-5669-e5aa-7a850436227c@amd.com> <6b616ebc-1a8f-0bd7-68be-3674ff99500b@redhat.com> <2cf1f64f-b7df-9f3a-ce61-36cd4fe5688b@redhat.com> From: Gabriel C Date: Sat, 20 Jan 2018 13:08:02 +0100 Message-ID: Subject: Re: Boot regression with bacf6b499e11 ("x86/mm: Use a struct to reduce parameters for SME PGD mapping") on top of -rc8 To: Laura Abbott Cc: Tom Lendacky , Borislav Petkov , Linus Torvalds , Peter Zijlstra , Thomas Gleixner , Ingo Molnar , Brijesh Singh , X86 ML , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 2018-01-20 8:03 GMT+01:00 Laura Abbott : > On 01/19/2018 10:57 PM, Laura Abbott wrote: >> >> On 01/19/2018 10:15 PM, Tom Lendacky wrote: >>> >>> On 1/19/2018 11:25 PM, Gabriel C wrote: >>>> >>>> 2018-01-20 5:02 GMT+01:00 Laura Abbott : >>>>> >>>>> On 01/19/2018 06:23 PM, Gabriel C wrote: >>>>>> >>>>>> >>>>>> 2018-01-20 2:23 GMT+01:00 Laura Abbott : >>>>>>> >>>>>>> >>>>>>> Hi, >>>>>> >>>>>> >>>>>> >>>>>> Hi , >>>>>> >>>>>>> >>>>>>> Fedora got multiple reports of an early bootup crash post -rc8. >>>>>>> Bisection showed bacf6b499e11 ("x86/mm: Use a struct to reduce >>>>>>> parameters for SME PGD mapping") . It doesn't revert cleanly >>>>>>> but if I revert the few other changes in arch/x86/mm/mem_encrypt.c >>>>>>> as well it boots up fine. >>>>>>> >>>>>>> Annoyingly, I can't seem to get any actual kernel logs even with >>>>>>> earlyprintk. It just reboots immediately (triple fault?). This >>>>>>> happens on both of my Lenovo machines and I can ask other reporters >>>>>>> for details as well. >>>>>>> >>>>>> >>>>>> I tested these patches on 2 Lenovo Ideapad both with Skylake CPUs >>>>>> on a older dual Xeon box , on 2 Toshibas with AMD APUs , on a RYZEN >>>>>> box , >>>>>> on dual EPYC box .. ofc on EPYC with mem_encrypt=on on the Intel CPUs >>>>>> disabled. >>>>>> >>>>>> Also tested on top 4.14.13 , 4.14.14 as well on top 4.15.0-rc7 and on >>>>>> current master/rc8++ without to see something like this. >>>>>> >>>>>> Also we pushed these patches on 4.14.13/14 and didn't got any reports >>>>>> about >>>>>> something like this. >>>>>> >>>>>> What Lenovo boxes are these ? maybe I find one to reproduce. >>>>>> >>>>>> >>>>>>> $ git bisect log >>>>>>> # bad: [ec835f8104a21f4d4eeb9d316ee71d2b4a7f00de] Merge tag >>>>>>> 'trace-v4.15-rc4-3' of >>>>>>> git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace >>>>>>> # good: [a8750ddca918032d6349adbf9a4b6555e7db20da] Linux 4.15-rc8 >>>>>>> git bisect start 'origin/master' 'v4.15-rc8' >>>>>>> # bad: [79683f80e4f07dba13cc08d0ebcf5c7b0aa1bf68] Merge tag >>>>>>> 'mmc-v4.15-rc2-3' of >>>>>>> git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc >>>>>>> git bisect bad 79683f80e4f07dba13cc08d0ebcf5c7b0aa1bf68 >>>>>>> # good: [161f72ed6dbe7fb176585091d3b797125d310399] Merge tag >>>>>>> 'mac80211-for-davem-2018-01-15' of >>>>>>> git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211 >>>>>>> git bisect good 161f72ed6dbe7fb176585091d3b797125d310399 >>>>>>> # good: [88dc7fca18001fd883e5ace775afa316b68c8f2c] Merge branch >>>>>>> 'x86-pti-for-linus' of >>>>>>> git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip >>>>>>> git bisect good 88dc7fca18001fd883e5ace775afa316b68c8f2c >>>>>>> # bad: [d47924417319e3b6a728c0b690f183e75bc2a702] x86/intel_rdt/cqm: >>>>>>> Prevent >>>>>>> use after free >>>>>>> git bisect bad d47924417319e3b6a728c0b690f183e75bc2a702 >>>>>>> # good: [fc90ccfd286eabb05ec54521367df8663cf0bbbf] Revert "x86/apic: >>>>>>> Remove >>>>>>> init_bsp_APIC()" >>>>>>> git bisect good fc90ccfd286eabb05ec54521367df8663cf0bbbf >>>>>>> # bad: [bacf6b499e11760aef73a3bb5ce4e5eea74a3fd4] x86/mm: Use a >>>>>>> struct to >>>>>>> reduce parameters for SME PGD mapping >>>>>>> git bisect bad bacf6b499e11760aef73a3bb5ce4e5eea74a3fd4 >>>>>>> # good: [1303880179e67c59e801429b7e5d0f6b21137d99] x86/mm: Clean up >>>>>>> register >>>>>>> saving in the __enc_copy() assembly code >>>>>>> git bisect good 1303880179e67c59e801429b7e5d0f6b21137d99 >>>>>>> # first bad commit: [bacf6b499e11760aef73a3bb5ce4e5eea74a3fd4] >>>>>>> x86/mm: >>>>>>> Use a >>>>>>> struct to reduce parameters for SME PGD mapping >>>>>>> >>>>>>> >>>>>>> Configuration is at >>>>>>> >>>>>>> >>>>>>> https://git.kernel.org/pub/scm/linux/kernel/git/jwboyer/fedora.git/commit/?h=rawhide >>>>>>> Note that I do think this is something in the Fedora configuration >>>>>>> because a generic "make defconfig" booted just fine. >>>>>> >>>>>> >>>>>> >>>>>> But maybe some of the Fedora patches ? >>>>>> >>>>>> Can you try an kernel with the config but without any patches ? >>>>>> Or a defconfig and just enable CONFIG_AMD_MEM_ENCRYPT ? >>>>>> >>>>> >>>>> The bisect was a vanilla kernel without Fedora patches. >>>> >>>> >>>> Ok . I did an build ( v4.15-rc8-225-g8dd903d2cf7b ) on my AMD >>>> Workstation ( EPYC CPU ) >>> >>> >>> I've tried multiple config combinations on my EPYC system and have not >>> been able to reproduce this issue and have not had any boot issues with >>> mem_encrypt=on or mem_encrypt=off. I don't have access to a non-AMD box >>> at the moment, but I'm really scratching my head on this one. >>> >>>> with your 64bit config and one on the Ideapad ( Intel i7-6498DU ) .. >>>> I disabled Selinux since I don't use it here and module signing. >>>> >>>> Also with your config my serial setup won't work and the kernel hangs >>>> but mem_encrypt=on/off works just fine. >>> >>> >>> If your using the EPYC serial device and you haven't enabled legacy >>> serial device support (if your BIOS supports that), then you're using >>> it as a platform device. The fedora config has not set the >>> CONFIG_X86_AMD_PLATFORM_DEVICE setting so you won't get the module >>> to load and give you serial output. >>> >>> I'm confused when you say the kernel hangs but mem_encrypt=on/off works >>> just fine, can you explain that a bit more? >>> >>>> >>>> Also I notice on the Workstation it takes forever to boot untill >>>> 'DMA-API' reports out-of-memory >>>> ( dunno how much memory it need but the box has 128GB of RAM ).. >>> >>> >> >> The machines I have are a Lenovo X1 Carbon and a Lenovo T470s. >> A Lenovo X220 ThinkPad also reported the problem. >> >> If I comment out sme_encrypt_kernel it boots: >> >> diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c >> index 7ba5d819ebe3..443ef5d3f1fa 100644 >> --- a/arch/x86/kernel/head64.c >> +++ b/arch/x86/kernel/head64.c >> @@ -158,7 +158,7 @@ unsigned long __head __startup_64(unsigned long >> physaddr, >> *p += load_delta - sme_get_me_mask(); >> >> /* Encrypt the kernel and related (if SME is active) */ >> - sme_encrypt_kernel(bp); >> + //sme_encrypt_kernel(bp); >> >> /* >> * Return the SME encryption mask (if SME is active) to be used >> as a >> >> >> Interestingly, I tried to print the values in sme_active >> (sme_me_mask , sev_enabled) followed by a return at the >> very start of sme_encrypt_kernel and that rebooted as well, >> vs booting if I just kept the return. sme_me_mask and >> sev_enabled are explicitly marked as being in .data, >> is it possible they are ending up in a section that isn't >> yet mapped or did I hit print too early? >> >> Thanks, >> Laura >> > > One last note: This was built with gcc 7.2.1 With retpoline patches ( if so what patchset ) ? or the one from gcc7 branch ? I didn't tested with this gcc version , I've tested with gcc6 and gcc8-retpoline-enabled compiler. Regards, Gabriel