Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp521478pxj; Fri, 28 May 2021 09:07:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw0unhmNbGf4eHdcl4OlTejW2jzgOqODRpvNcLjMLqMQE/vEhFQ3qXF763TdD6q06EcGa8N X-Received: by 2002:a17:906:8049:: with SMTP id x9mr9802102ejw.13.1622218042357; Fri, 28 May 2021 09:07:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622218042; cv=none; d=google.com; s=arc-20160816; b=J18OVy1tze8J20RgHlOvwj6p6GNdHE7qEsNrtRTeBqzNOZPA3zkI87WPTxUQNrGsFt ijqW1zNrSgp/vWHlAzIPxpVcB+v8CaBbRARwWdJAY49fUiRvs1PmMPA4G6j60YaJhnxm B2Kg10YdTje0oGlGeRKSt9Nh3Nh6IUvIHbIjCy70mycE8akG7JI92vzlNFaxjvZt0wBY pXX2Pyrl3+gcDFFFMrqBYegMCFH/K0jgy4NLLanAbAUJtsfWej+zamq4lFe70BwSta6X zhmu3tIBlSN6cxygHgZsTY5338+Q/2JY76s0g33QK5e6JBooVahqRtPeRoI7FI5WD6En VPUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=uAb+kHRjxNwR2MPKE4B203s8wVuUkqC3DTmz/XimwzU=; b=0eNjHjMZ7MctSewLU4ZRuJWZ3kOhIJY8nCH2WIPeDc1swsxXeDj0K+XPi4UJAXmLZN 3KfMU50+BH8b7T/ce7rG7FV4kfSn5gWD/kS9PvobqViQZN42giu+BnaMZ7AGkdDOfnRj HNCZlJ2EZ2kfObRjoAGO6qLIlG7zZYhSy2936P7HMleIGP0g2pgqkRqnt5kd93IDZUOf ZDmTbhV68UKSZSEGsoY2TqQwGKXI+4OYimE6Uw0AjS956FwmjxuaoA2e7fCz9Sv4dtMc ML2rVEREO/Ad+psgm/vev27EBW9pYeQf/NW9LzSJSwd8v/lm9mspwUccHDgTElxxxDHp ohig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b="F+/yKSQQ"; 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=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id jx12si5240386ejb.103.2021.05.28.09.06.58; Fri, 28 May 2021 09:07:22 -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=@alien8.de header.s=dkim header.b="F+/yKSQQ"; 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=NONE sp=NONE dis=NONE) header.from=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234568AbhE1OnY (ORCPT + 99 others); Fri, 28 May 2021 10:43:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231993AbhE1OnX (ORCPT ); Fri, 28 May 2021 10:43:23 -0400 Received: from mail.skyhub.de (mail.skyhub.de [IPv6:2a01:4f8:190:11c2::b:1457]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A70DEC061574 for ; Fri, 28 May 2021 07:41:48 -0700 (PDT) Received: from zn.tnic (p200300ec2f0e8e00d6a866fcf7197725.dip0.t-ipconnect.de [IPv6:2003:ec:2f0e:8e00:d6a8:66fc:f719:7725]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id CAB5E1EC056D; Fri, 28 May 2021 16:41:46 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1622212906; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=uAb+kHRjxNwR2MPKE4B203s8wVuUkqC3DTmz/XimwzU=; b=F+/yKSQQJiNdc21euAgys4F02wyOKPVdB1h8CAT9RqVK34A0ES2/C/aLgURHnR27HFEuaS ekfK0nhCIUYqswVrFJWM/iVuxCJHsBV2ltlo8oMcZXYdLKzLorpO9uoPgsYXWeC2GCPPLg VDuaOY/GF7rCg4oLhQtO/ZEfL+VxDdA= Date: Fri, 28 May 2021 16:41:40 +0200 From: Borislav Petkov To: Mike Rapoport Cc: Ingo Molnar , "H. Peter Anvin" , Thomas Gleixner , Mike Rapoport , untaintableangel@hotmail.co.uk, x86@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] x86/Kconfig: decrease maximum of X86_RESERVE_LOW to 512K Message-ID: References: <20210526081100.12239-1-rppt@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 27, 2021 at 04:38:07PM +0300, Mike Rapoport wrote: > Well 640K is well known memory limit :) Yah, that I remember - was just wondering why but I guess it was out of caution to cover all that a BIOS *could* touch, see hpa's reply. > Another aspect IMHO is that making things explicit would reduce the amount > of hidden dependencies and in the end make x86::setup_arch() less fragile. Hohumm. > I'm looking now also at: > > 5bc653b73182 ("x86/efi: Allocate a trampoline if needed in efi_free_boot_services()") > > that retries the allocation of trampoline when we free EFI services, so > there is also could be a conflict between reserve_real_mode() and > reserve_bios_regions() in case EBDA is too low. > > So what we have is > - BIOSes that corrupt low memory > - EBDA of unknown size that can be as low as 128k, so we reserve everything > from EBDA start to 640k because we don't trust BIOSes to report EBDA size > properly > - Real mode blob of about 20-30k that must live in the first 640k > - Build time setting to reserve Xk (4K <= X <= 640k) with the default set > to 64k > - Command line option to reserve Yk (4K <= Y <= 640k), this takes precedence > over the build time option. > - A late fallback that uses memory freed from EFI data to place real mode > trampoline there > > It seems to me that we can drop both build time and run time options > entirely, reserve 64k early to avoid having trampoline there and then > always reserve everything below 640k after reserve_real_mode(). > > The late fallback for systems that have most of low memory busy with > BIOS/EFI will remain intact as it does not do memblock allocation anyway. Yah, I certainly like the simplification. The first 640K seem to be a minefield anyway and to quote from that bugzilla again: https://bugzilla.kernel.org/show_bug.cgi?id=16661#c2 "As far as I know, Windows 7 actually reserves all memory below 1 MiB to avoid BIOS bugs." so yeah, I think we should do that. But pls put that justification above in the commit message so that we know why we did it. Thx. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette