Received: by 2002:a25:1104:0:0:0:0:0 with SMTP id 4csp909294ybr; Sat, 23 May 2020 01:02:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxaIddnH8RGaMJ1CClzzQhXhcnTzazlP04txaTOFvhb+od/3ijr7i9oubQD71O+FurXcWPT X-Received: by 2002:a50:dac4:: with SMTP id s4mr6317330edj.84.1590220924399; Sat, 23 May 2020 01:02:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590220924; cv=none; d=google.com; s=arc-20160816; b=Eps1eLpJWYmXG/TSRWouM9EcSiUohzYLfhwSFXdQzuUpl4/TsH8ph8I+iovp/JIN+n YkSSWpujLzJEVTeuKSfENAKJ8a+cLsL6dV9aNJRKWIus9FIO7I7uPck7ANYHK6jCEgN+ AM/0ZU43lHNpazUq/nh5mTqWPuBrW/PHTE562uAmd6OjS9MM6YMnL1j5hzmYrMrHGJcp Xq2uJ6vTPSxSGRFHOaZkKelmA3ovMgjFcuOZPOeNo8di+TiDGUDn//TUvvOnmraYQFcY i6QmE8zToe3C8AkGV52F9tqW4nb0k4OrZPfqp06GA2W6V0mg15TmGue4anqo7q2/wypj 4Evg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=PIo+t2JcI6yVRedmlgz10X421O+M066c0hltaVL112k=; b=SnoUEVDYH2vKrvmrpk9vlu7rzXrWO3IqHq+hW1jh/YE7wniR7ndC6S9vUsnA6/yUrI QMYjfM9M6cRu7KvFg6wXAX4OjYrSHwP866rFWfDtgGLqqKlkKpvrx5m2Wgti4Wo/AVzq i2P9Bf5hrvzPbs3xcSm+h6d32/hCZtW2tb6uZItx0Gqpg9kb7lJaYxJnrMQaBeAZkfPr AoA/0LxEremyv0F9iJlE075NbPbcnNgxjxSZUGCx1dHybGweTL4JGGTau/ve/+UStOua to5lW/OlpBF9MojEdand0w5SUxyCNcF8N+DpgZ9d15ZJAI/HX2Pb227TCTzRm9LKDZMe FMWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=ZLEXWPqM; 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; 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 n23si5936757eju.98.2020.05.23.01.01.41; Sat, 23 May 2020 01:02:04 -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=@alien8.de header.s=dkim header.b=ZLEXWPqM; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387752AbgEWH7c (ORCPT + 99 others); Sat, 23 May 2020 03:59:32 -0400 Received: from mail.skyhub.de ([5.9.137.197]:57804 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387627AbgEWH7b (ORCPT ); Sat, 23 May 2020 03:59:31 -0400 Received: from zn.tnic (p200300ec2f1b96004c59f332ede330a0.dip0.t-ipconnect.de [IPv6:2003:ec:2f1b:9600:4c59:f332:ede3:30a0]) (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 215841EC0338; Sat, 23 May 2020 09:59:30 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1590220770; 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=PIo+t2JcI6yVRedmlgz10X421O+M066c0hltaVL112k=; b=ZLEXWPqMrm4G0DwJpbs8Xgi9xF4kgV5KjgjmvT9VK9gOBCLZtVjao6/GkCbl6+4X+V5fwU RC9EWJFZV06I1nR899eptspZxrdViE5apbzfahsF0PgTl3LX1V8HCCJUtgslfPsCUj9YUS /PGarM2WPPCDvyJoyVnqQyWd5w4+ROU= Date: Sat, 23 May 2020 09:59:24 +0200 From: Borislav Petkov To: Joerg Roedel Cc: x86@kernel.org, hpa@zytor.com, Andy Lutomirski , Dave Hansen , Peter Zijlstra , Thomas Hellstrom , Jiri Slaby , Dan Williams , Tom Lendacky , Juergen Gross , Kees Cook , David Rientjes , Cfir Cohen , Erdem Aktas , Masami Hiramatsu , Mike Stunes , Joerg Roedel , linux-kernel@vger.kernel.org, kvm@vger.kernel.org, virtualization@lists.linux-foundation.org Subject: Re: [PATCH v3 47/75] x86/sev-es: Add Runtime #VC Exception Handler Message-ID: <20200523075924.GB27431@zn.tnic> References: <20200428151725.31091-1-joro@8bytes.org> <20200428151725.31091-48-joro@8bytes.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200428151725.31091-48-joro@8bytes.org> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 28, 2020 at 05:16:57PM +0200, Joerg Roedel wrote: > diff --git a/arch/x86/kernel/sev-es.c b/arch/x86/kernel/sev-es.c > index a4fa7f351bf2..bc3a58427028 100644 > --- a/arch/x86/kernel/sev-es.c > +++ b/arch/x86/kernel/sev-es.c > @@ -10,6 +10,7 @@ > #include /* For show_regs() */ > #include > #include > +#include > #include > #include > #include > @@ -25,7 +26,7 @@ > #include > #include > #include > -#include > +#include > #include > > /* For early boot hypervisor communication in SEV-ES enabled guests */ > @@ -46,10 +47,26 @@ struct sev_es_runtime_data { > > /* Physical storage for the per-cpu IST stacks of the #VC handler */ > struct vmm_exception_stacks vc_stacks __aligned(PAGE_SIZE); > + > + /* Reserve on page per CPU as backup storage for the unencrypted GHCB */ one > + struct ghcb backup_ghcb; I could use some text explaining what those backups are for? > + /* > + * Mark the per-cpu GHCBs as in-use to detect nested #VC exceptions. > + * There is no need for it to be atomic, because nothing is written to > + * the GHCB between the read and the write of ghcb_active. So it is safe > + * to use it when a nested #VC exception happens before the write. > + */ Looks liks that is that text... support for nested #VC exceptions. I'm sure this has come up already but why do we even want to support nested #VCs? IOW, can we do without them first or are they absolutely necessary? I'm guessing VC exceptions inside the VC handler but what are the sensible use cases? Thx. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette