Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp3955674imm; Tue, 11 Sep 2018 04:53:59 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbQ1SuJNl3cfRsx+Nl982Wz8VAExuiuGU9/oPGHeut95KVCCo7uVUNWE4ClQfwE0lQk6Brz X-Received: by 2002:a17:902:a413:: with SMTP id p19-v6mr26885647plq.220.1536666839082; Tue, 11 Sep 2018 04:53:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536666839; cv=none; d=google.com; s=arc-20160816; b=HISQBZPZxMRJFYRZDLcbUtjqLuTIwf1h+Y5qcE2aOEA2RcXNkmKGu8JfIMEU2HD0iu eN4jtqlay1vAzr4uZ29a8hT7MTQoP/CTcLNb/zJkz+5g9qI+qPDP9AY5PTyKC53/uQ8p Rcn3pfDq0zrshlXtllutbxztSTYLdp7Pya6NLaPEWPPmIPJHraQz3/s2Gz8PaWaEwNV4 RIuRGLxwGssiC9a7t0uABmxXa2VdPV/dz98yOPnTcrvZAhWGuIt+5LewacbZOff7AeYR qLn40qev5QyAu0+idFtiAs0pz5yxQjLb0bjbq2VdwQI4IpZHWyzB1g0Vs2OjADOw9Ikg +Xng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version:dkim-signature; bh=k/wQ1DXgB2jr/G8LKBVLaVt0iL5Ml/Net+R0AvrLGmg=; b=B1kxiuLRFnjsKDAq72TiADhwYDReQIsPiIGh3I3q1sbzyN0xwP3a8YYKrll0x7C+ta kN/uHE5oezFYCMFH6MJcxR0pmPUp1sscp3a1EQBsAwO2pubNHI0bouxhCs5AnkhT1+YW PV85vzCoXWhwFP1cUwwe74gEdpPNaycTiFAMQm8JNEPU5Hr5GS3nGCN9peEiHvcluSYA FMv3LOlZ3mqHGkKMpdq71+jcnH2K945C+kLrRJ05AXjwlsfVcL69uACLZn9dvVj3S2j/ aYxnW0EKZm/nFHA+xFGdZhBfpTkZXPo8Zkz+KsaVE8YkeWazykeRSOwH9oByG6prR951 ipkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b=AMaOdGZ8; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k18-v6si20430337pgl.364.2018.09.11.04.53.43; Tue, 11 Sep 2018 04:53:59 -0700 (PDT) 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=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b=AMaOdGZ8; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727659AbeIKQvF (ORCPT + 99 others); Tue, 11 Sep 2018 12:51:05 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:36988 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726563AbeIKQvF (ORCPT ); Tue, 11 Sep 2018 12:51:05 -0400 Received: by mail-pg1-f196.google.com with SMTP id 2-v6so12144504pgo.4 for ; Tue, 11 Sep 2018 04:52:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amacapital-net.20150623.gappssmtp.com; s=20150623; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=k/wQ1DXgB2jr/G8LKBVLaVt0iL5Ml/Net+R0AvrLGmg=; b=AMaOdGZ8iegnQs8pHJwemQ4T692pImMFEeh8Z+Tn/YhKIhmddP/KqEb/ELd8i5hcD+ t/EnKCEYTjs5A6eqeGeJj8SYIZ/rspB/GSlIi0PmWSuLAC8gCPdU6G5MRZt/27u9xfNO B2kAkS1tYsNsPCVx1EaV3khJbw+Cy3yt3vOd+NeyWjNDS3qitB68L0GABaecfHJTBThP /C+CD9xvfZ/SoMw4hLU8Tj+G9lu0x+BWaThacDRA0x7KqR/GZ2m10loNWtTkI+lCN5+n ilnRqw6A9aNFNeEMriTD35knz8Yg05+roOoVBF4eDzoyNmLvOC+rXadi7ShbQp2/KgZk 6EWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=k/wQ1DXgB2jr/G8LKBVLaVt0iL5Ml/Net+R0AvrLGmg=; b=G5srhuxPk4uk7f16S8eHqrmvsoxBy7ePe2iuICwRtAxkW4U/E/g0W++OlJQobE2qMD HfMMp7R3L7cwgQIBjBoNYGDeInjYjf9VoUJuRpQgysrIKNgoM6zCfqZi+iM5tgSgYY1p ITWs+t86G4I3oR2Nq6MVjf6OM5nlaLTG3BTedSrlQIf0FTSB3QsR571CuRb88uqwxYWr 5eDXWcZzVHOu9Qymel0FPyDiSvuh3mKj5z3ZO3BH00gNhs5xZD+18FXEcKWgfniquFFe Z9+Q/erV6Q6E0Dc7jtAUJHmwL9Mgdi0M0Qks0s5103JnufApUlspiVoQyw1Lse17pC5/ 1Row== X-Gm-Message-State: APzg51ArupCVl/giSaS0d+GtVmrAFtrZn56n2hdf8G9H2AArMaWZYlw0 ZaQ/s/j7uLygAFpDa+ShiTaOXw== X-Received: by 2002:a62:68c3:: with SMTP id d186-v6mr29001747pfc.70.1536666725552; Tue, 11 Sep 2018 04:52:05 -0700 (PDT) Received: from ?IPv6:2601:646:c200:7429:6c19:77f6:df55:1bb5? ([2601:646:c200:7429:6c19:77f6:df55:1bb5]) by smtp.gmail.com with ESMTPSA id t14-v6sm20766140pgu.0.2018.09.11.04.52.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Sep 2018 04:52:03 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (1.0) Subject: Re: Random crashes with i386 and efi boots From: Andy Lutomirski X-Mailer: iPhone Mail (15G77) In-Reply-To: <20180910215659.GA17966@roeck-us.net> Date: Tue, 11 Sep 2018 04:52:02 -0700 Cc: linux-kernel@vger.kernel.org, Ard Biesheuvel , Joerg Roedel , Thomas Gleixner , Michal Hocko , Andi Kleen , Linus Torvalds , Dave Hansen , Pavel Machek , linux-efi@vger.kernel.org, x86@kernel.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <20180910215659.GA17966@roeck-us.net> To: Guenter Roeck Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On Sep 10, 2018, at 2:56 PM, Guenter Roeck wrote: >=20 > Hi folks, >=20 > even after commit eeb89e2bb1ac ("x86/efi: Load fixmap GDT in > efi_call_phys_epilog()"), my i386/efi qemu boot tests still crash randomly= > (roughly 5-10% of the time). As before, I don't see much useful output in > the qemu log (this time it doesn't even complain about a triple fault).=20= >=20 > Debugging shows that the crash happens in efi_call_phys_epilog(). > A sample log from a crashed test run is attached below. It appears that > the crash happens if there is an interrupt at a critical section of the > code. >=20 > While playing with the code, I found a possible fix. >=20 > diff --git a/arch/x86/platform/efi/efi_32.c b/arch/x86/platform/efi/efi_32= .c > index 05ca14222463..9959657127f4 100644 > --- a/arch/x86/platform/efi/efi_32.c > +++ b/arch/x86/platform/efi/efi_32.c > @@ -85,10 +85,9 @@ pgd_t * __init efi_call_phys_prolog(void) >=20 > void __init efi_call_phys_epilog(pgd_t *save_pgd) > { > + load_fixmap_gdt(0); > load_cr3(save_pgd); > __flush_tlb_all(); > - > - load_fixmap_gdt(0); > } We have IRQs on here? It seems plausible that we=E2=80=99re in a window whe= re the EFI pgd doesn=E2=80=99t have cpu_entry_area mapped. Also, the hard co= ded CPU 0 is suspicious. Maybe try instrumenting the code to check whether the clone_pgd_range calls i= n setup_percpu.c have happened yet? Your patch may well be correct, but, if we have IRQs on, we should really ha= ve cpu_entry_area mapped in both pgds. Or we could turn off IRQs. Why on Earth are IRQs on in a context where the f= ixmap gdt is unusable?