Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2424147pxb; Mon, 19 Apr 2021 05:33:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxkHaRWwgq3oygGyqp7AwtwXsa2fxY2lxG7e/g3VXLpcb9Onzytpk+Y77WkYE2YMLoRDTxl X-Received: by 2002:a17:902:b20e:b029:eb:47e3:5977 with SMTP id t14-20020a170902b20eb02900eb47e35977mr22403232plr.67.1618835618832; Mon, 19 Apr 2021 05:33:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618835618; cv=none; d=google.com; s=arc-20160816; b=heVXEoBnH3k62bWj07aSMsg5w8rLfgzz9CBfG/rQpb1upjQfbP12BvQ90+eyIKOSef u2Bm4hUImFqBW5P9/4HJzLTRSnucPoFkiJdytSMCx4jSDK2JymQnYcC3bzlzv3lTuMKS UQItwsgjpNLT7WNq+5y/4yDq1ZBr0dBnwdA7feTGxYv5vrqUn6FcwaGuKZmcFwkC6gkc I2AP6biFLd/2aM79oKQPedgShhtJTj4uktd/TvYcUpdR2XA5+6HUG0Re5GxQxVOsojDD gjdcshaI4mOOXh13gYTR63zxYDB6Pkx7xkOg2YqTh68QCrFtQig2273idUolqRU2CY+r oO2Q== 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=vCGEvRMDH0rrbCfjQ2X9p8m5Gtw0cPGam+h/egSoMNc=; b=F8IKeeQYdKyf+eLkkL+3hIyK6O/raY2KveOmXdmnW6GfsyySeBvWSyTui0yr1BMSsr Z3arN3VZ5Y/+GwjMSzkUXxeQZcBU0Q8yJD9Zu7lQmP8RbJHWkqQvUFLYQNf51SRIp/XP GH7ZjRoPpkDFcDUtgPhGSff8sQg/M978lHaeJ3ndcPJVJe/b4btwWtDx5rPtrXeFfa5w PL4lwn+wa0nzkGlq4wGZDWtEEi14AQWwjZTvmxOGK3ruWsLrNFXqsrCn2dF/dNjIKqkk nMXksHIlQZ/VEALZ3PIka1EvJN0MHIwrrX/twnIEQqfcCO29eEAflaoDcHMEi/oI7dDE 8BMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=V9ZPCIFl; 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 lb6si17451342pjb.153.2021.04.19.05.33.20; Mon, 19 Apr 2021 05:33:38 -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=V9ZPCIFl; 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 S233826AbhDSMdH (ORCPT + 99 others); Mon, 19 Apr 2021 08:33:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233780AbhDSMdH (ORCPT ); Mon, 19 Apr 2021 08:33:07 -0400 Received: from mail.skyhub.de (mail.skyhub.de [IPv6:2a01:4f8:190:11c2::b:1457]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81F43C06174A; Mon, 19 Apr 2021 05:32:37 -0700 (PDT) Received: from zn.tnic (p200300ec2f078100b366c1e70d1e8d9d.dip0.t-ipconnect.de [IPv6:2003:ec:2f07:8100:b366:c1e7:d1e:8d9d]) (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 8511C1EC0283; Mon, 19 Apr 2021 14:32:32 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1618835552; 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=vCGEvRMDH0rrbCfjQ2X9p8m5Gtw0cPGam+h/egSoMNc=; b=V9ZPCIFlhpbQYkPk+sI9Ccev1lyvF0iMPPx+SDbLMYnc/NuDaeFjwuEOyLqkJygh7yI/89 UsE6ZYHOwz7TKQM8F6Ns47UmU3QrEWMTFGsEuhE4vShqSNPf80gu7eIhPfwNb7MPIY3C3y wvsVoBdF0qrw9nA/FqH1ZNqRBN7uv0E= Date: Mon, 19 Apr 2021 14:32:26 +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: <20210419123226.GC9093@zn.tnic> References: <20210324170436.31843-1-brijesh.singh@amd.com> <20210324170436.31843-5-brijesh.singh@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20210324170436.31843-5-brijesh.singh@amd.com> Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Wed, Mar 24, 2021 at 12:04:10PM -0500, Brijesh Singh wrote: > A write from the hypervisor goes through the RMP checks. When the > hypervisor writes to pages, hardware checks to ensures that the assigned > bit in the RMP is zero (i.e page is shared). If the page table entry that > gives the sPA indicates that the target page size is a large page, then > all RMP entries for the 4KB constituting pages of the target must have the > assigned bit 0. Hmm, so this is important: I read this such that we can have a 2M page table entry but the RMP table can contain 4K entries for the corresponding 512 4K pages. Is that correct? If so, then there's a certain discrepancy here and I'd expect that if the page gets split/collapsed, depending on the result, the RMP table should be updated too, so that it remains in sync. For example: * mm decides to group all 512 4K entries into a 2M entry, RMP table gets updated in the end to reflect that * mm decides to split a page, RMP table gets updated too, for the same reason. In this way, RMP table will be always in sync with the pagetables. I know, I probably am missing something but that makes most sense to me instead of noticing the discrepancy and getting to work then, when handling the RMP violation. Or? Thx. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette