From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.skyhub.de (mail.skyhub.de [5.9.137.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6384B6FB4 for ; Mon, 19 Dec 2022 20:15:01 +0000 (UTC) Received: from zn.tnic (p5de8e9fe.dip0.t-ipconnect.de [93.232.233.254]) (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 803F81EC06BB; Mon, 19 Dec 2022 21:08:36 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1671480516; 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=lrxhiTTF/whrwIYbK5JLyaQ/VG3LtXMAICiu0E+hLIM=; b=CPfVndn+VkW6ZTjP2XUvlPrNlTglu5FlJdPvPusIvXkI+AKI73wrD/UnBGU+ZFq9G9BDBX 1YNpBXsM6I/noQiW3niuawwNR7ZLs0XqfnUxMgMGzXliFX1+Jr8KiQJ2FfC20aOgOhl9gd vH/ng88yULsTbeLMMEWrlt3tMWlBIzc= Date: Mon, 19 Dec 2022 21:08:31 +0100 From: Borislav Petkov To: Michael Roth Cc: Ashish Kalra , x86@kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, linux-coco@lists.linux.dev, linux-mm@kvack.org, linux-crypto@vger.kernel.org, tglx@linutronix.de, mingo@redhat.com, jroedel@suse.de, thomas.lendacky@amd.com, hpa@zytor.com, ardb@kernel.org, pbonzini@redhat.com, seanjc@google.com, vkuznets@redhat.com, jmattson@google.com, luto@kernel.org, dave.hansen@linux.intel.com, slp@redhat.com, pgonda@google.com, peterz@infradead.org, srinivas.pandruvada@linux.intel.com, rientjes@google.com, dovmurik@linux.ibm.com, tobin@ibm.com, vbabka@suse.cz, kirill@shutemov.name, ak@linux.intel.com, tony.luck@intel.com, marcorr@google.com, sathyanarayanan.kuppuswamy@linux.intel.com, alpergun@google.com, dgilbert@redhat.com, jarkko@kernel.org Subject: Re: [PATCH Part2 v6 07/49] x86/sev: Invalid pages from direct map when adding it to RMP table Message-ID: References: <243778c282cd55a554af9c11d2ecd3ff9ea6820f.1655761627.git.ashish.kalra@amd.com> <20221219150026.bltiyk72pmdc2ic3@amd.com> Precedence: bulk X-Mailing-List: linux-coco@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20221219150026.bltiyk72pmdc2ic3@amd.com> On Mon, Dec 19, 2022 at 09:00:26AM -0600, Michael Roth wrote: > We implemented this approach for v7, but it causes a fairly significant > performance regression, particularly for the case for npages > 1 which > this change was meant to optimize. > > I still need to dig in a big but I'm guessing it's related to flushing > behavior. Well, AFAICT, change_page_attr_set_clr() flushes once at the end. Don't you need to flush when you modify the direct map? > It would however be nice to have a set_direct_map_default_noflush() > variant that accepted a 'npages' argument, since it would be more > performant here and also would potentially allow for restoring the 2M > direct mapping in some cases. Will look into this more for v8. set_pages_direct_map_default_noflush() I guess. Although the name is a mouthful so I wouldn't mind having those shortened. In any case, as long as that helper is properly defined and documented, I don't mind. Thx. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette