Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp3217606pxb; Tue, 13 Apr 2021 23:18:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw65kyft6MdqiBjUf/NO3SfBoVU1m9iHa5WR4AMePM+6y4slUv1U8qH5Ya1h1xUhZ0TBgtA X-Received: by 2002:aa7:cc03:: with SMTP id q3mr39663172edt.366.1618381122799; Tue, 13 Apr 2021 23:18:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618381122; cv=none; d=google.com; s=arc-20160816; b=SPDhueYxpA4ekZ1MCE5ww8ReIsO3ZJza1Z3fC2fAwNoWuz688YdnOyilGPiNQtHxv7 U1rHrWZ5btWN1rRGTOGpINOMVMdZadszTuaGa7k8mTGAG1l+iUUOi0a2qe7qCCfNxPpY Ypte9YwSg3eBH7I8Hx/22CAAWidHb6pKj+gng+Nbvj9f3I0gmwq/5yCez2K2pcSgarob dUKlXjCgKkpP2Juj+csLaDWRU+ZAzyR4vmAcOnptxfUvXUkvoaefxw0fpOe0+q2WZDC/ JJCRZw4c7TOabX2WC1OtIdCI+Cz2YqgNeK/Mb/voYc77yiZ0HLSlmzpFHIh4GI5G3Rou /Vdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:message-id :in-reply-to:subject:cc:to:from:date:dkim-signature; bh=7hlbKO+nfOBQ9jb/4q5zl38fZNJwCd9YNYudz1e6oJo=; b=QCdGkWW1UDCJyAJKfZZWO1fN9l4khgSFWdfJDST6klhWqUIql+U8GritbabYFEJ5gf 2GvIzLhEwmaYV5BcvSSmcVSqqAJz1qDAranJXfpaPoyuyY2sYxS7B2jhqfoLnhbV42wv mMzmBMXXzedUj9ySH1vgOwwyGTB5N5pIZrsfV3YN9i73q5a/AcPxvSq7hIaHX0uZpdnf dhneX8vFgAxW3lZ1rs66BATifVf5afbn4Zf3GNIuFLAIErKMlB5IBttMZzFjDiuQLUX7 fNM944s3rP6NWFF1rCCFbL6j6eLzfwql8OIbqzXvHSUVZ3LifldqNC+l1sla9rzLBdyq 44pw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="emUo/ODK"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c18si3794790ede.125.2021.04.13.23.18.18; Tue, 13 Apr 2021 23:18:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="emUo/ODK"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231718AbhDMTJm (ORCPT + 99 others); Tue, 13 Apr 2021 15:09:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231340AbhDMTJl (ORCPT ); Tue, 13 Apr 2021 15:09:41 -0400 Received: from mail-qk1-x72f.google.com (mail-qk1-x72f.google.com [IPv6:2607:f8b0:4864:20::72f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 718FEC061574 for ; Tue, 13 Apr 2021 12:09:21 -0700 (PDT) Received: by mail-qk1-x72f.google.com with SMTP id e13so9148802qkl.6 for ; Tue, 13 Apr 2021 12:09:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=7hlbKO+nfOBQ9jb/4q5zl38fZNJwCd9YNYudz1e6oJo=; b=emUo/ODKrTSEKAjOumtSF4lr31MN8w+c7mJq9O7Q7bHXDLIN1y/Mo948Umq7rGdAzn RAsuiyqIQg1+d9PTPO650M50ud8ZcaC2g7sergtqjR7zOzsTd8ejTAc64nV9boZuYb0R wMtjB/t+VQm6Bxp8EDMh8xJ3Si2KMnLMSdIJ5bjoLjS7etD90jnj6bEwc/er0yPCUE+S zfL4o7U/kdXBRouiQfAPxkXHQw7DZHH5F53lYhTpp0dHrF8/fL6G82OLqaERdYSNbl9c 4NqwqpOyw8JYcCMmEtDbojq2r1Y7c7i562IV4g+trYrjVi+1mPVa01z+EkkxnFJWtshj wn5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=7hlbKO+nfOBQ9jb/4q5zl38fZNJwCd9YNYudz1e6oJo=; b=OVaFMK6oXllXRUY1FC7yBcfMM+nXqAozjBq/0mqw+wYh2eUa41B9s6qdSoDZ8LefCo 9qM2yqhxsX10XFhJMajYt82Mk8/vtI8IOe81V07cYC8ibKvB9DOUtGgOoniJuZAkOrC/ JsuL5LxJ8nFAFsQUN8g16OgOsyheUT82rs9J6kyBy36jcmLo3ZIsclgWsPgctlpIOCXI adxERRITyg/AA+doTrYbbIGcbJLK+s6wp+aUwVDwr90Vs49d7K9ZrgNOXk4P6TU/UC1d XE/2aBqm3XOF/wlZjFtFiRZYxj3/pXPKScVUIxzUkYtm+MLKM2EKel9awavEmddEuMc9 NWhQ== X-Gm-Message-State: AOAM531PfnPlpKWcZx4KQI0/r4E0o10sLjV25kx8ZhSxSIIvUP247mJH FW9HrvyQasp3h8vRq2nZ33fRcQ== X-Received: by 2002:a37:2cc1:: with SMTP id s184mr14892831qkh.489.1618340960420; Tue, 13 Apr 2021 12:09:20 -0700 (PDT) Received: from eggly.attlocal.net (172-10-233-147.lightspeed.sntcca.sbcglobal.net. [172.10.233.147]) by smtp.gmail.com with ESMTPSA id w1sm8833346qto.85.2021.04.13.12.09.18 (version=TLS1 cipher=ECDHE-ECDSA-AES128-SHA bits=128/128); Tue, 13 Apr 2021 12:09:20 -0700 (PDT) Date: Tue, 13 Apr 2021 12:09:08 -0700 (PDT) From: Hugh Dickins X-X-Sender: hugh@eggly.anvils To: Mike Rapoport cc: Randy Dunlap , Stephen Rothwell , Linux Next Mailing List , Linux Kernel Mailing List , X86 ML Subject: Re: linux-next: Tree for Apr 9 (x86 boot problem) In-Reply-To: Message-ID: References: <20210409215103.03999588@canb.auug.org.au> <7cec048d-26f0-104a-6bca-d9afc6a7d1e8@infradead.org> <7bc072c0-bf10-bd0f-95db-0f0a7db47b93@infradead.org> User-Agent: Alpine 2.11 (LSU 23 2013-08-11) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 13 Apr 2021, Mike Rapoport wrote: > > I think I've found the reason. trim_snb_memory() reserved the entire first > megabyte very early leaving no room for real mode trampoline allocation. > Since this reservation is needed only to make sure integrated gfx does not > access some memory, it can be safely done after memblock allocations are > possible. > > I don't know if it can be fixed on the graphics device driver side, but > from the setup_arch() perspective I think this would be the proper fix: > > From c05f6046137abbcbb700571ce1ac54e7abb56a7d Mon Sep 17 00:00:00 2001 > From: Mike Rapoport > Date: Tue, 13 Apr 2021 21:08:39 +0300 > Subject: [PATCH] x86/setup: move trim_snb_memory() later in setup_arch to fix > boot hangs > > Commit a799c2bd29d1 ("x86/setup: Consolidate early memory reservations") > moved reservation of the memory inaccessible by Sandy Bride integrated > graphics very early and as the result on systems with such devices the > first 1M was reserved by trim_snb_memory() which prevented the allocation > of the real mode trampoline and made the boot hang very early. > > Since the purpose of trim_snb_memory() is to prevent problematic pages ever > reaching the graphics device, it is safe to reserve these pages after > memblock allocations are possible. > > Move trim_snb_memory later in boot so that it will be called after > reserve_real_mode() and make comments describing trim_snb_memory() > operation more elaborate. > > Fixes: a799c2bd29d1 ("x86/setup: Consolidate early memory reservations") > Reported-by: Randy Dunlap > Signed-off-by: Mike Rapoport Tested-by: Hugh Dickins Thanks Mike and Randy. ThinkPad T420s here. I didn't notice this thread until this morning, but had been investigating bootup panic on mmotm yesterday. I was more fortunate than Randy, in getting some console output which soon led to a799c2bd29d1 without bisection. Expected to go through it line by line today, but you've saved me - thanks. > --- > arch/x86/kernel/setup.c | 20 +++++++++++++++----- > 1 file changed, 15 insertions(+), 5 deletions(-) > > diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c > index 59e5e0903b0c..ccdcfb19df1e 100644 > --- a/arch/x86/kernel/setup.c > +++ b/arch/x86/kernel/setup.c > @@ -633,11 +633,16 @@ static void __init trim_snb_memory(void) > printk(KERN_DEBUG "reserving inaccessible SNB gfx pages\n"); > > /* > - * Reserve all memory below the 1 MB mark that has not > - * already been reserved. > + * SandyBridge integrated graphic devices have a bug that prevents > + * them from accessing certain memory ranges, namely anything below > + * 1M and in the pages listed in the bad_pages. > + * > + * To avoid these pages being ever accessed by SNB gfx device > + * reserve all memory below the 1 MB mark and bad_pages that have > + * not already been reserved at boot time. > */ > memblock_reserve(0, 1<<20); > - > + > for (i = 0; i < ARRAY_SIZE(bad_pages); i++) { > if (memblock_reserve(bad_pages[i], PAGE_SIZE)) > printk(KERN_WARNING "failed to reserve 0x%08lx\n", > @@ -746,8 +751,6 @@ static void __init early_reserve_memory(void) > > reserve_ibft_region(); > reserve_bios_regions(); > - > - trim_snb_memory(); > } > > /* > @@ -1083,6 +1086,13 @@ void __init setup_arch(char **cmdline_p) > > reserve_real_mode(); > > + /* > + * Reserving memory causing GPU hangs on Sandy Bridge integrated > + * graphic devices should be done after we allocated memory under > + * 1M for the real mode trampoline > + */ > + trim_snb_memory(); > + > init_mem_mapping(); > > idt_setup_early_pf(); > -- > 2.28.0