Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp2932221pxy; Mon, 3 May 2021 11:09:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyYyDBSRsRlwv5rKnlkNEHrJ0+MoI7/eRh5L2rERyJewU8yU9E/Vvm0roG7u26BjcvB9GpK X-Received: by 2002:a17:902:ee11:b029:ed:7108:623e with SMTP id z17-20020a170902ee11b02900ed7108623emr22219056plb.38.1620065387943; Mon, 03 May 2021 11:09:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620065387; cv=none; d=google.com; s=arc-20160816; b=YBSWrxPwGuTnucy+VS0A1dm3GxIgnla6fUwI/n1xAbQXDp/cag1WeKlBoJXcsBG/+L yZqlPb4ch62XMzsOZSzy2K/AsKqS57/LDjMiHrpqXt4BKnXLS6WJ0rR4SP5LCnh1SuHM RF6X/yw1JnNfPt7AvSvMJu84AfcMpVFy4dEapovVV5m6GelDtC9USltAZ8PNMLxduS+V Bf9sQt8kfiwaHj6qrX8WJNwfWYWyQ4YhqO6i8CG3GibUn0j6S+9tj4P3bwU+TADeeBom h5DcDGN+GEyH8YqDQ/5Q5rzDwHvIFz23nEODpWSQXHKawpuR/0qQn2mvhc8l8wDNwiMI JPmA== 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=kMx7dObqmiMRLKvCPPx5dZSO2/TSonq0GivO88n9Dnw=; b=i3+uR05zeScTv8Y3Fq5wFFvEBaZmYvoxircH60h3eDfMbqE3BF2pC9XNabe7G14HTf NAfCwnubMQMmBkgFSHmhcCc3USHicn2AQilv86cv8LRRa2Cmu7ddKBFJrhZL0YWZ1iVU vqdY7TeTcaWOweL7qoQd1hYlcZNnC0i6Zp4FkdlwHVwYG0ApLtiXpCDWQ0THopszbnnV e9UcgWXu+c/HZy6Zk6hMGRbwsZyG/hm0LtPbCosS8d7aif/i41gTrG1IZShg80ZpUlSM CdqifYP+0pHBZ2mwcDw2ls2RWjt4+T6NN79E3tW9jmw8RIGlN8+7jfDQW93XgTRuIbAp VwzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=RTzFX22T; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 84si13787005pfu.307.2021.05.03.11.09.35; Mon, 03 May 2021 11:09:47 -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=@infradead.org header.s=desiato.20200630 header.b=RTzFX22T; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230232AbhECPIa (ORCPT + 99 others); Mon, 3 May 2021 11:08:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230123AbhECPI3 (ORCPT ); Mon, 3 May 2021 11:08:29 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F39E1C06174A; Mon, 3 May 2021 08:07:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=kMx7dObqmiMRLKvCPPx5dZSO2/TSonq0GivO88n9Dnw=; b=RTzFX22TzavsuLNPyHWsd2y00w cF7Q/aaqJCVid9CI0gOoHuVkJsFTBbZj+lTPkVmRBQuzkNZYpJG9sXa/4C5amfoRCfYEaoMelXezF C0YeOyS2NPjqv9FtF+HlWKZgFNAC6y4cUT4Dth+3fQbFuNHOkJu3qze9TWiODLDmQVdOmH+q7Fnwe 4VInMB/ACCoVu9GXHTNkiuuMBbcoDG8s/XN1fO8sY15E1lODTIA3YXke6rzgpeM5r3GSOHg4dLvuK Me1nm5M0fRzPZ9A2SFF0T9D0zvnBPeANCBMBIQX4m+RiZFxcbxM7QZpJnXNrmLIlNuqCtNrLMG0LX k3rHcIew==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.94 #2 (Red Hat Linux)) id 1ldaAH-00EBCq-9l; Mon, 03 May 2021 15:07:21 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id DFF893001D0; Mon, 3 May 2021 17:07:15 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 61FAF2C1AAE0C; Mon, 3 May 2021 17:07:15 +0200 (CEST) Date: Mon, 3 May 2021 17:07:15 +0200 From: Peter Zijlstra To: Brijesh Singh Cc: x86@kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, tglx@linutronix.de, bp@alien8.de, jroedel@suse.de, thomas.lendacky@amd.com, pbonzini@redhat.com, mingo@redhat.com, dave.hansen@intel.com, rientjes@google.com, seanjc@google.com, hpa@zytor.com, tony.luck@intel.com Subject: Re: [PATCH Part2 RFC v2 08/37] x86/sev: Split the physmap when adding the page in RMP table Message-ID: References: <20210430123822.13825-1-brijesh.singh@amd.com> <20210430123822.13825-9-brijesh.singh@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210430123822.13825-9-brijesh.singh@amd.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 30, 2021 at 07:37:53AM -0500, Brijesh Singh wrote: > This poses a challenge in the Linux memory model. The Linux kernel > creates a direct mapping of all the physical memory -- referred to as > the physmap. The physmap may contain a valid mapping of guest owned pages. > During the page table walk, the host access may get into the situation where > one of the pages within the large page is owned by the guest (i.e assigned > bit is set in RMP). A write to a non-guest within the large page will > raise an RMP violation. To workaround it, call set_memory_4k() to split > the physmap before adding the page in the RMP table. This ensures that the > pages added in the RMP table are used as 4K in the physmap. What's an RMP violation and why are they a problem? > The spliting of the physmap is a temporary solution until the kernel page > fault handler is improved to split the kernel address on demand. How is that an improvement? Fracturing the physmap sucks whichever way around. > One of the > disadvtange of splitting is that eventually, it will end up breaking down > the entire physmap unless its coalesce back to a large page. I am open to > the suggestation on various approaches we could take to address this problem. Have the hardware fracture the TLB entry internally?