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 X-Spam-Level: X-Spam-Status: No, score=-2.1 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A9023C352A3 for ; Tue, 11 Feb 2020 14:50:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7C2BB206DB for ; Tue, 11 Feb 2020 14:50:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="cY+vxpu+" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730287AbgBKOua (ORCPT ); Tue, 11 Feb 2020 09:50:30 -0500 Received: from merlin.infradead.org ([205.233.59.134]:42424 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728047AbgBKOua (ORCPT ); Tue, 11 Feb 2020 09:50:30 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=qWnHe7FrDz9eGFNLgL+pqzJ1ZkJDW34fv36AbfxXMr8=; b=cY+vxpu+iRqOion51hgN8KX8MM 1ztoOSVH+loxUd+9cbzHUqhSuxSF3LOfJv8duUXhxKH2Z1IHwKMBH/at+c/Cr80ky3sxlR8qCQGvU aVr63GLxbE7ign3Eo81P5zChu8DcE0DuXWqtrdUZzLUQ6fsI5sw8gFrovEGfgeXMmH96vtXSW4wfO u3TY0WQCVUDMYijkbo0rt/loz5YVkvXyit/W4w49yjooJCHdaGaBY+7tkvMXitWtLnxCLfJi5reXz /knDm8dNgLTOgNnS5d+atTm7sAaC7tWVOA+UV4/lKoCh28QH0WVTf2P1CeSseDiFdoJg0jFZcRFC0 XIvV5OOg==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1j1Wra-00065I-Nz; Tue, 11 Feb 2020 14:50:10 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id EE03C300446; Tue, 11 Feb 2020 15:48:19 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id B1B3D2B8BECD3; Tue, 11 Feb 2020 15:50:08 +0100 (CET) Date: Tue, 11 Feb 2020 15:50:08 +0100 From: Peter Zijlstra To: Joerg Roedel Cc: x86@kernel.org, hpa@zytor.com, Andy Lutomirski , Dave Hansen , Thomas Hellstrom , Jiri Slaby , Dan Williams , Tom Lendacky , Juergen Gross , Kees Cook , linux-kernel@vger.kernel.org, kvm@vger.kernel.org, virtualization@lists.linux-foundation.org, Joerg Roedel Subject: Re: [RFC PATCH 00/62] Linux as SEV-ES Guest Support Message-ID: <20200211145008.GT14914@hirez.programming.kicks-ass.net> References: <20200211135256.24617-1-joro@8bytes.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200211135256.24617-1-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, Feb 11, 2020 at 02:51:54PM +0100, Joerg Roedel wrote: > NMI Special Handling > -------------------- > > The last thing that needs special handling with SEV-ES are NMIs. > Hypervisors usually start to intercept IRET instructions when an NMI got > injected to find out when the NMI window is re-opened. But handling IRET > intercepts requires the hypervisor to access guest register state and is > not possible with SEV-ES. The specification under [1] solves this > problem with an NMI_COMPLETE message sent my the guest to the > hypervisor, upon which the hypervisor re-opens the NMI window for the > guest. > > This patch-set sends the NMI_COMPLETE message before the actual IRET, > while the kernel is still on a valid stack and kernel cr3. This opens > the NMI-window a few instructions early, but this is fine as under > x86-64 Linux NMI-nesting is safe. The alternative would be to > single-step over the IRET, but that requires more intrusive changes to > the entry code because it does not handle entries from kernel-mode while > on the entry stack. > > Besides the special handling above the patch-set contains the handlers > for the #VC exception and all the exit-codes specified in [1]. Oh gawd; so instead of improving the whole NMI situation, AMD went and made it worse still ?!?