Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp1238880ybg; Thu, 11 Jun 2020 04:50:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzxO+SJz9yEq9GddDrOQ+vh0H+NkjpNBezfbbPJ5nTDyxJ/SQwe1Thb/HrOYcrcUJ4NesbF X-Received: by 2002:a50:8425:: with SMTP id 34mr6702810edp.314.1591876242994; Thu, 11 Jun 2020 04:50:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591876242; cv=none; d=google.com; s=arc-20160816; b=JeqpqPFZnedr2JG2+99taGTzMS0E9Ebx3wV7nyH+udos8eARRRKAk52vQ3DVfx6U3z U4jywldD4eSceWfg3+b9fw/bY2I/hLZmmoOxA8X610dOgN/tROLsJZiA7cQ8gg1Kts0A oU0SSI70cmLWowIR4H5mC0f/bs3tAZu33YKLzsNqQmkzPAc9KS1bVS45d/8P0czgQN05 bABwEKMOvJojQmgRsNE3MVcp7DKaKgcmcmRc0n5QgGZkqjGM/TuIcvvJdWfG8deRKmgl WOcey42pq+NXSIuV26YPqYzvIvhVyCOJdkDygbn+29VyinQjrNptC44qj3XU6aB0b1PG r9iw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=OjCe/KZ2e3yzQJeuYmnkn9D3OUqq3f8FudOZN9vYS6k=; b=opjqM1k3nEbDp0OYn5UNX1Ry/VKYioA8TDvfDtkcqSOgQ8t6qlRwjGusMuFg2UvkE1 9kprmU2lxGibBKQU/CH8xeRvjGABeUNEiDVsRknnfdld66hMwDWuJ37htzPPy2X//iKy 11xFqpWERj1g9OP6pblK8f5HthDWQgoRXvfklh/WHCO+hnLU4YHMsdABTn7jFkZG3Fr2 nlmbCvLD5Iczxhmu+WbfR3fgL6GbG2jS//LaCuua+LxgmeuJ6kuSZRTlcPhkhDgtBWu7 rSze+cGsAK3OrkPUB1rCPrUGfOGVKPE3N28E5YFBj6qcG1Kx+Eosbqyr3jQoPTnl2f+2 nvEw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dm15si2054261ejc.728.2020.06.11.04.50.20; Thu, 11 Jun 2020 04:50:42 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727775AbgFKLsg (ORCPT + 99 others); Thu, 11 Jun 2020 07:48:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726790AbgFKLsg (ORCPT ); Thu, 11 Jun 2020 07:48:36 -0400 Received: from theia.8bytes.org (8bytes.org [IPv6:2a01:238:4383:600:38bc:a715:4b6d:a889]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1134DC08C5C1; Thu, 11 Jun 2020 04:48:36 -0700 (PDT) Received: by theia.8bytes.org (Postfix, from userid 1000) id DAE2B869; Thu, 11 Jun 2020 13:48:33 +0200 (CEST) Date: Thu, 11 Jun 2020 13:48:31 +0200 From: Joerg Roedel To: Borislav Petkov 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: <20200611114831.GA11924@8bytes.org> References: <20200428151725.31091-1-joro@8bytes.org> <20200428151725.31091-48-joro@8bytes.org> <20200523075924.GB27431@zn.tnic> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200523075924.GB27431@zn.tnic> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, May 23, 2020 at 09:59:24AM +0200, Borislav Petkov wrote: > On Tue, Apr 28, 2020 at 05:16:57PM +0200, Joerg Roedel wrote: > > + /* > > + * 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? The most important use-case is #VC->NMI->#VC. When an NMI hits while the #VC handler uses the GHCB and the NMI handler causes another #VC, then the contents of the GHCB needs to be backed up, so that it doesn't destroy the GHCB contents of the first #VC handling path. Regards, Joerg