From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.5 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E7199C433E0 for ; Thu, 11 Feb 2021 17:46:31 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 8290864D9C for ; Thu, 11 Feb 2021 17:46:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8290864D9C Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 0A7846B013D; Thu, 11 Feb 2021 12:46:31 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 059FD6B013E; Thu, 11 Feb 2021 12:46:31 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E89E96B013F; Thu, 11 Feb 2021 12:46:30 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0213.hostedemail.com [216.40.44.213]) by kanga.kvack.org (Postfix) with ESMTP id D17466B013D for ; Thu, 11 Feb 2021 12:46:30 -0500 (EST) Received: from smtpin24.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 9A1D6181AEF1D for ; Thu, 11 Feb 2021 17:46:30 +0000 (UTC) X-FDA: 77806716540.24.04D7D27 Received: from mail-pf1-f174.google.com (mail-pf1-f174.google.com [209.85.210.174]) by imf12.hostedemail.com (Postfix) with ESMTP id B233CDE for ; Thu, 11 Feb 2021 17:46:28 +0000 (UTC) Received: by mail-pf1-f174.google.com with SMTP id q20so4131289pfu.8 for ; Thu, 11 Feb 2021 09:46:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=CuzYU9ZaJovg/PrglRp36sBChF64XZ7Wn9l0uV1AGfg=; b=mIRpBdmTky8PfyhBebid9Ahk0BWoMfxdiGAymnMynwzQFhhvHhMk5gbnvtlfJKCxkS xWZz+SrtOgvkotfyBUwCYTc8EOCujfzTMyRhkEj/dRz3lhjc2AMTcQEhLg2tcIYA0jKe cnugz14ALkWK9hkeA167jVYoPoG64M5vnL0VUmiFHUm6ybt4ZBqK8jfZS7yFIlN9RYj1 0fsruYQVNHv0hX5wSRFUOBdjrj9mU+WeONU2xxi6MaZdska0AzsQe0YRO38zG/rfKaZg es8lf7ZGWkDFOieWAagD2sPXH5OvxFQVJA9MOVY8Nc9bi8euGSVHh8xNe4fDuyEknJL3 w8KA== 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:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=CuzYU9ZaJovg/PrglRp36sBChF64XZ7Wn9l0uV1AGfg=; b=dMmNvDyRCc6dp5h0NrResbeltsYZGQqZJWGY/kUzuRXeAFYoAs2jI3pVFVdQPnpI3L p8+9r/Mx8ukZAypQmSj+bU6C9n71RF5tDI3TEWWNWeSAVcBdE96ZTYGUIoxSCVxvuVH6 eJ7PZXCwZV99ow4jxyXJUgFKNkWzDYuetorRkwAAcNgv2PWV/0R/P6dEzt+v9jkh+ywH PBJ4M1UQuLVe0xvaA4cAshRQJ5Ig7xer06FfGE7xGuHUGokVMo9ZoZv8k6vnpJkqOSrM pbwvWi59nJsCLC5EAM5nNCW5mI3hOc48IsDSZ1vcxutQ9wFJiFGh44oj1Qk4vbip09Ml sdxg== X-Gm-Message-State: AOAM531sTEOjvAzQu8Cc7Tof0fFIslqVK6MD3ZykTyUMBgZeauD2w5ro 5n0F5lqznT6ccgiHOhZup83f3Q== X-Google-Smtp-Source: ABdhPJx7ip9lcOgCYohe82Z88/lve2XHj+RIYAVglNKbh9g+cQZIPPZ2VqMleISzmhK8XFv81bkRZg== X-Received: by 2002:a05:6a00:15cc:b029:1ba:5282:3ab8 with SMTP id o12-20020a056a0015ccb02901ba52823ab8mr8995393pfu.77.1613065588783; Thu, 11 Feb 2021 09:46:28 -0800 (PST) Received: from google.com ([2620:15c:f:10:f588:a708:f347:3ebb]) by smtp.gmail.com with ESMTPSA id u14sm6030200pfc.39.2021.02.11.09.46.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Feb 2021 09:46:28 -0800 (PST) Date: Thu, 11 Feb 2021 09:46:21 -0800 From: Sean Christopherson To: Brijesh Singh Cc: "Kirill A. Shutemov" , David Rientjes , Borislav Petkov , Andy Lutomirski , Andrew Morton , Andi Kleen , Tom Lendacky , Jon Grimm , Thomas Gleixner , Christoph Hellwig , Peter Zijlstra , Paolo Bonzini , Ingo Molnar , Joerg Roedel , x86@kernel.org, linux-mm@kvack.org Subject: Re: AMD SEV-SNP/Intel TDX: validation of memory pages Message-ID: References: <7515a81a-19e-b063-2081-3f5e79f0f7a8@google.com> <20210202160205.3wfchtibq2sd7pe5@black.fi.intel.com> <961a2736-9bc9-43e1-1e75-6d373fe9590b@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <961a2736-9bc9-43e1-1e75-6d373fe9590b@amd.com> X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: B233CDE X-Stat-Signature: p8keuwy76mifpcz1zgzcnohztbz75gki Received-SPF: none (google.com>: No applicable sender policy available) receiver=imf12; identity=mailfrom; envelope-from=""; helo=mail-pf1-f174.google.com; client-ip=209.85.210.174 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1613065588-641675 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue, Feb 02, 2021, Brijesh Singh wrote: >=20 > On 2/2/21 10:02 AM, Kirill A. Shutemov wrote: > > On Mon, Feb 01, 2021 at 05:51:09PM -0800, David Rientjes wrote: > >> One possibility for minimal disruption to the boot entry code is to > >> require the guest BIOS to validate 4GB and below, and then leave 4GB= and > >> above to be done lazily (the true amount of memory will actually be = less > >> due to the MMIO hole). > > [ As I didn't looked into actual code, I may say total garbage below.= .. ] > > > > Pre-validating 4GB would indeed be easiest way to go, but it's going = to be > > too slow. > > > > The more realistic is for BIOS to pre-validate memory where kernel an= d > > initrd are placed, plus few dozen megs for runtime. It means decompre= ssion > > code would need to be aware about the validation. >=20 > I was thinking that BIOS validating the lower 4GB will simplify the > changes to the kernel entry code path as well provide a clean approach > to support kexec.=A0 >=20 > My initial thought is >=20 > - BIOS or VMM validate lower 4GB memory. I think we need to treat this as a "plan for the worst, hope for the best= " scenario. I agree that validating all of memory below 4gb would be simpl= er, but there's no guarantee that that approach will be fast enough. Even if it'= s sufficient for traditional VMs, inevitably someone will come up with a us= e case that wants/needs even shorter boot times.