Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp1534952ybg; Thu, 11 Jun 2020 12:19:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwJy1Z4wvMcCKwbLaGXq9EnY0WwOM/NwM8y2ip52Lb1EbszGSTLasYLj+TIiA56f2JAYSaL X-Received: by 2002:a17:906:4d14:: with SMTP id r20mr9494785eju.346.1591903181987; Thu, 11 Jun 2020 12:19:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591903181; cv=none; d=google.com; s=arc-20160816; b=BRheErKt+imtvmtOvYv3fUzx9r/w1jS06zVkKvG5lqa6VdE4vJrvPyWYwwUYRRABEk MM0sH1wEbGXEr814g9uAQ2aLchVTmOsWVU9HhssGiAtbbsognZM/qpQ02sGXzrt9TvAm NOuhmgChnWHpcF73SA6ml2XX50UVer4XYCgkSLqu3U08Ck7VGhMX9SIKu45ZPTuKotR2 QwEzO/mebac4kkALYBsjUgqMxTkNHOxL7wbBvsD4JyQBz+NLBBp1q4YTgjwRIw0Mtm7J 9OyItGptcKgk43SPkYUbdB2rG6JJtB+vxa5bPOejvNb9Qnv0J0mGWYAxiX10gg+VNWQw 8dZQ== 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:ironport-sdr:ironport-sdr; bh=roJ1Z3dWfUCgi+yEaRbwSGuqc2dMwIgIpPDXlgOiAsQ=; b=KgzbCi7RM6nj6rvrocRAhkBo2JITqYAuzq22W4o5gXLqhJqMROK1fYAlF+4pBBjTXW g0y7D5i0nBZOX0ofTgTxLawTz1hj8RL9bpHMIYs+lWSjdKMUocbPFXPBIDKgKuhawegE Tham9bNiznH1IOFv3U/dzz+ACcuMumFTr92WuM90dHJde6clKquMingFsTRWAWum/PCJ oIucrzL9U3UfKVFjSFTTJ9VQCqfkmGRFPWjNxqk+3NdDqLb0i6vAajdAd++5gT4j/YuA ooSD8mdBt+yUy/E6Q4NR7Z2+pJ/XQlvcLO6M4k03GalzByNzKJ7mZ3CGrJ1Q0B1RQc+6 mVZw== 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c26si2294608edj.238.2020.06.11.12.19.19; Thu, 11 Jun 2020 12:19:41 -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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726993AbgFKRiv (ORCPT + 99 others); Thu, 11 Jun 2020 13:38:51 -0400 Received: from mga18.intel.com ([134.134.136.126]:26022 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726109AbgFKRiu (ORCPT ); Thu, 11 Jun 2020 13:38:50 -0400 IronPort-SDR: 3ZMK9pZhqO18Qaheu3/vQuDhayNGWrmmzn9A2/NNrvi5etOv/KzhPguJsE+XxwrdKezzomYRIs SLZYOBKhphhg== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jun 2020 10:38:49 -0700 IronPort-SDR: zIXZk1x7swvBXnIsc/AiNUfO/vkCBXoLCKBqY2ZiI1nI4gO/aKwjk7q+8TG3rKNcSjvUQvNDdy MFzRBY+uHppg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,500,1583222400"; d="scan'208";a="296669214" Received: from sjchrist-coffee.jf.intel.com (HELO linux.intel.com) ([10.54.74.152]) by fmsmga004.fm.intel.com with ESMTP; 11 Jun 2020 10:38:48 -0700 Date: Thu, 11 Jun 2020 10:38:48 -0700 From: Sean Christopherson To: Joerg Roedel Cc: Borislav Petkov , 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: <20200611173848.GK29918@linux.intel.com> References: <20200428151725.31091-1-joro@8bytes.org> <20200428151725.31091-48-joro@8bytes.org> <20200523075924.GB27431@zn.tnic> <20200611114831.GA11924@8bytes.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200611114831.GA11924@8bytes.org> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 11, 2020 at 01:48:31PM +0200, Joerg Roedel wrote: > 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. Isn't it possible for the #VC handler to hit a #PF, e.g. on copy_from_user() in insn_fetch_from_user()? If that happens, what prevents the #PF handler from hitting a #VC? AIUI, do_vmm_communication() panics if the backup GHCB is already in use, e.g. #VC->#PF->#VC->NMI->#VC would be fatal.