Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp3195562pxb; Tue, 20 Apr 2021 02:47:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwH+8MxsefR2VocS8TKH7VzoFupM9qA7Od/zwCSdNl/sP6AftfSbJRueoYZ+LMwVSwnJXKY X-Received: by 2002:a62:38c4:0:b029:25f:b5ed:8090 with SMTP id f187-20020a6238c40000b029025fb5ed8090mr9368399pfa.6.1618912064244; Tue, 20 Apr 2021 02:47:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618912064; cv=none; d=google.com; s=arc-20160816; b=vkfYfm+wFmGUIqrlOoLXtvS3bNeu5PsBpqFMNz4eXNvV9ulTVjo42dIYa7BazgiQ1a jgZypACTvf6b2ajwDGN8EuPTKBnI8RJLahDep6F1ehXhvLRLWYLFd37MPybzs1MnqOK3 lG2P4uxFpXM69n9FbfG5uwTkWzVyTtHEjno3Phxo8fcqm2oVzWwAKlhMnUfE+QdbZUsF AC0knolvPYfdzu9oNJ/0ofS34YGbWd8OZZSN9pYXsJO7MIithL0wdu4OZQNM27b32BQz KyastGtVY5kJjQHerWKF5N52PaVBQ0VpOCIHZUIQy4N9FpmicafimSEckNTWnSOu5PKm Nt/A== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=RA9OKky7ZNF04E7Df2ew/ZUVIaSCqLlCAKVZUi2ytbI=; b=Lnpom6JRGvWGhzX8yiRb8WDNrtXY6G6/QQpLdlBqBJwgzzyMZ/nR/5xTi/iNfIrceu pyRgT5awt28sVT+rJptE7NSlZd/WJoX9ZjsLGvZM75zqTFFnog6ogok5PAJQdcSeKJp4 eBOBPaRd6Zn+5Z2qzpZrsJfjSoGTQiIHhtBKvGQ1aLYMnYpUjgKO2tiuuZGC1oFLwKN+ yOvXzLfeDRXESrawgnwmbUc/3dBlT9skPHe+9EGsQxVIXrIp6pk/5aWDS4pBTUwoV/Sp uAfNHG9wrgKg49UOwRa/pOcCAdfRxzhzpCumDEBkc7SYJy9zYDrkB/Vs9WhBTATVYsDo wxCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=Z5IPqA3D; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-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 q15si21908870plx.202.2021.04.20.02.47.29; Tue, 20 Apr 2021 02:47:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-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=Z5IPqA3D; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-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 S231382AbhDTJru (ORCPT + 99 others); Tue, 20 Apr 2021 05:47:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45330 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229937AbhDTJrt (ORCPT ); Tue, 20 Apr 2021 05:47:49 -0400 Received: from mail.skyhub.de (mail.skyhub.de [IPv6:2a01:4f8:190:11c2::b:1457]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2FC23C06174A; Tue, 20 Apr 2021 02:47:17 -0700 (PDT) Received: from zn.tnic (p200300ec2f0e52003145dfcc247b909a.dip0.t-ipconnect.de [IPv6:2003:ec:2f0e:5200:3145:dfcc:247b:909a]) (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 211971EC0103; Tue, 20 Apr 2021 11:47:16 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1618912036; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RA9OKky7ZNF04E7Df2ew/ZUVIaSCqLlCAKVZUi2ytbI=; b=Z5IPqA3Dj6rCvU1FW2fGNMookHdlY3WCXL8wnlBGmBbAxD8xvtvmKnj12I48HYvUriAZsC G89fIO73z1hh67u8EpWSsatS5UBQw5Jtz0yO0eAqVnk16vi6/F5PanO7+uMQtQZFkfrWjH Xl7nUdtgHXMWRtFUk6la5ReMnUTPZJY= Date: Tue, 20 Apr 2021 11:47:13 +0200 From: Borislav Petkov To: Brijesh Singh Cc: linux-kernel@vger.kernel.org, x86@kernel.org, kvm@vger.kernel.org, linux-crypto@vger.kernel.org, ak@linux.intel.com, herbert@gondor.apana.org.au, Thomas Gleixner , Ingo Molnar , Joerg Roedel , "H. Peter Anvin" , Tony Luck , Dave Hansen , "Peter Zijlstra (Intel)" , Paolo Bonzini , Tom Lendacky , David Rientjes , Sean Christopherson , Vlastimil Babka Subject: Re: [RFC Part2 PATCH 04/30] x86/mm: split the physmap when adding the page in RMP table Message-ID: <20210420094713.GD5029@zn.tnic> References: <20210324170436.31843-1-brijesh.singh@amd.com> <20210324170436.31843-5-brijesh.singh@amd.com> <20210419123226.GC9093@zn.tnic> <20210419165214.GF9093@zn.tnic> <30bff969-e8cf-a991-7660-054ea136855a@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <30bff969-e8cf-a991-7660-054ea136855a@amd.com> Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Mon, Apr 19, 2021 at 12:46:53PM -0500, Brijesh Singh wrote: > - KVM callsĀ  alloc_page() to allocate a VMSA page. The allocator returns > 0xffffc80000200000 (PFN 0x200, page-level=2M). The VMSA page is private > page so KVM will call RMPUPDATE to add the page as a private page in the > RMP table. While adding the RMP entry the KVM will use the page level=4K. Right, and *here* we split the 2M page on the *host* so that there's no discrepancy between the host pagetable and the RMP. I guess your patch does exactly that. :) And AFAIR, set_memory.c doesn't have the functionality to coalesce 4K pages back into the corresponding 2M page. Which means, the RMP table is in sync, more or less. Thx and thanks for elaborating. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette