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 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 18469C43217 for ; Tue, 2 Nov 2021 18:44:29 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 9C4AE60720 for ; Tue, 2 Nov 2021 18:44:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 9C4AE60720 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=alien8.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 22D27940008; Tue, 2 Nov 2021 14:44:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1DCE6940007; Tue, 2 Nov 2021 14:44:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0CC01940008; Tue, 2 Nov 2021 14:44:28 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0082.hostedemail.com [216.40.44.82]) by kanga.kvack.org (Postfix) with ESMTP id F4153940007 for ; Tue, 2 Nov 2021 14:44:27 -0400 (EDT) Received: from smtpin10.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id B901D8249980 for ; Tue, 2 Nov 2021 18:44:27 +0000 (UTC) X-FDA: 78764865774.10.70CF791 Received: from mail.skyhub.de (mail.skyhub.de [5.9.137.197]) by imf26.hostedemail.com (Postfix) with ESMTP id ECF4220019EE for ; Tue, 2 Nov 2021 18:44:26 +0000 (UTC) Received: from zn.tnic (p200300ec2f1dc300e1073f755e7fce47.dip0.t-ipconnect.de [IPv6:2003:ec:2f1d:c300:e107:3f75:5e7f:ce47]) (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 4195F1EC0295; Tue, 2 Nov 2021 19:44:24 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1635878664; 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=AxuOw0DQ4Frl9MECG8Kper8H3T3XmCRerq6iet0JTvg=; b=fnDosBtZdhTQHutSgr1/+RABVQIrAbm94J935ajx4Z9Kisycu7UocDnt8PckwIj3n3lTJx BI19SipB4tqJQJUImPbytZWTapJ9GIoEiP27NptNIzkc92S11oTGUZeyuZe08xinQ4Gf7N AyTH+RF5Fl4D+tugIqEWI0IxA6rfSSU= Date: Tue, 2 Nov 2021 19:44:18 +0100 From: Borislav Petkov To: Brijesh Singh Cc: x86@kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, linux-efi@vger.kernel.org, platform-driver-x86@vger.kernel.org, linux-coco@lists.linux.dev, linux-mm@kvack.org, Thomas Gleixner , Ingo Molnar , Joerg Roedel , Tom Lendacky , "H. Peter Anvin" , Ard Biesheuvel , Paolo Bonzini , Sean Christopherson , Vitaly Kuznetsov , Jim Mattson , Andy Lutomirski , Dave Hansen , Sergio Lopez , Peter Gonda , Peter Zijlstra , Srinivas Pandruvada , David Rientjes , Dov Murik , Tobin Feldman-Fitzthum , Michael Roth , Vlastimil Babka , "Kirill A . Shutemov" , Andi Kleen , "Dr . David Alan Gilbert" , tony.luck@intel.com, marcorr@google.com, sathyanarayanan.kuppuswamy@linux.intel.com Subject: Re: [PATCH v6 14/42] x86/sev: Register GHCB memory when SEV-SNP is active Message-ID: References: <20211008180453.462291-1-brijesh.singh@amd.com> <20211008180453.462291-15-brijesh.singh@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: ECF4220019EE X-Stat-Signature: ap1r8z7trunqfcsk1mior3modyyzq358 Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=alien8.de header.s=dkim header.b=fnDosBtZ; spf=pass (imf26.hostedemail.com: domain of bp@alien8.de designates 5.9.137.197 as permitted sender) smtp.mailfrom=bp@alien8.de; dmarc=pass (policy=none) header.from=alien8.de X-Rspamd-Server: rspam02 X-HE-Tag: 1635878666-3041 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, Nov 02, 2021 at 01:24:01PM -0500, Brijesh Singh wrote: > To answer your question, GHCB is registered at the time of first #VC > handling by the second exception handler. And this is what I don't like - register at use. Instead of init everything *before* use. > Mike can correct me, the CPUID page check is going to happen on first > #VC handling inside the early exception handler (i.e case 1). What is the "CPUID page check"? And no, you don't want to do any detection when an exception happens - you want to detect *everything* *first* and then do exceptions. > See if my above explanation make sense. Based on it, I don't think it > makes sense to register the GHCB during the CPUID page detection. The > CPUID page detection will occur in early VC handling. See above. If this needs more discussion, we can talk on IRC. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette