Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp111127ybb; Thu, 19 Mar 2020 12:34:26 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvQXA0PwyShmu6GvQH+1BvwgR8+Wd1KkVh71IFs708RQSv70ytGQtM0YTGK2rSz2qdYO/OQ X-Received: by 2002:aca:fd09:: with SMTP id b9mr3693759oii.88.1584646466198; Thu, 19 Mar 2020 12:34:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584646466; cv=none; d=google.com; s=arc-20160816; b=gAEqdGbo2IkNx0W72XPoq3+Sy/wcdxoNiirs5A4Igmh0o5Nd6foehDu+9dKjlCBeOP 2+SZJoKWGFcDEE57zkuAtrGPufD/xKlgkNOIS3OD5e3HnyI8CDmTVpI0jqfMb7Y2YeYD n/W8oEAH3i9CTUlPsSPwvKDUnW103wFbB51A99fCSNBiHCBP2qxVvlGzgrBkN9/wMIUa yQKCPm0jupPETCCbfiHQXiED/Tg3dqsvPgTgVzs5N+7aMIsPQr0niVyrj0k+5ZPqmFec OJQc2fPW1fpFqa/C7R4DUw7LpG+lgFS19f5FXIJndlnRDTkW52s7XTofkBTW9DN3rcXN dOxA== 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; bh=zs5FaJmgdYKZVLM82JF+GzaOQCIDc9kkxTmWtuClKfg=; b=xgYbn/b8Z5QwFRAoGYBXVJ4CrhxZOJb+Y8V/hquBbXZXd873AzxDE0A0XL+zgxm45/ hgGHu0+gSx/gZAKGSfcSARr/p7b2v/kleIKD4NRExR4P18UpPUujytytoyj5w50a00Mx V1xvZHCy3vZJteIUmLB1t8Oxqw/ChfQWzHHSAOavY7xaXfoF0AK11jm2kEpsiti7FRRc ZjxXN7a+vE2mJD998jrnqEt+mRPWDTXYt6UYkdzT1LwYnKGvMeOOjHoZ9CMaZRUhZMWk VlxpIPCzekA/I/0Sv+V6r0OrNeAr95ZpyDmLvDVN8OT22NmEt4sqfSnMQ1/Y9eBvsVSI GydA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x73si1585223oif.16.2020.03.19.12.34.14; Thu, 19 Mar 2020 12:34:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727360AbgCST07 (ORCPT + 99 others); Thu, 19 Mar 2020 15:26:59 -0400 Received: from mx2.suse.de ([195.135.220.15]:47832 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726785AbgCST07 (ORCPT ); Thu, 19 Mar 2020 15:26:59 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id B4686AD03; Thu, 19 Mar 2020 19:26:56 +0000 (UTC) Date: Thu, 19 Mar 2020 20:26:54 +0100 From: Joerg Roedel To: Andy Lutomirski Cc: Joerg Roedel , X86 ML , "H. Peter Anvin" , Dave Hansen , Peter Zijlstra , Thomas Hellstrom , Jiri Slaby , Dan Williams , Tom Lendacky , Juergen Gross , Kees Cook , LKML , kvm list , Linux Virtualization Subject: Re: [PATCH 70/70] x86/sev-es: Add NMI state tracking Message-ID: <20200319192654.GD611@suse.de> References: <20200319091407.1481-1-joro@8bytes.org> <20200319091407.1481-71-joro@8bytes.org> <20200319160749.GC5122@8bytes.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 Thu, Mar 19, 2020 at 11:40:39AM -0700, Andy Lutomirski wrote: > Nope. A nested NMI will reset the interrupted NMI's return frame to > cause it to run again when it's done. I don't think this will have > any real interaction with #VC. There's no longjmp() here. Ahh, so I misunderstood that part, in this case your proposal of sending the NMI-complete message right at the beginning of do_nmi() should work just fine. I will test this and see how it works out. > I certainly *like* preventing nesting, but I don't think we really > want a whole alternate NMI path just for a couple of messed-up AMD > generations. And the TF trick is not so pretty either. Indeed, if it could be avoided, it should. > > > > This causes us to pop the NMI frame off the stack. Assuming the NMI > > > restart logic is invoked (which is maybe impossible?), we get #DB, > > > which presumably is actually delivered. And we end up on the #DB > > > stack, which might already have been in use, so we have a potential > > > increase in nesting. Also, #DB may be called from an unexpected > > > context. > > > > An SEV-ES hypervisor is required to intercept #DB, which means that the > > #DB exception actually ends up being a #VC exception. So it will not end > > up on the #DB stack. > > With your patch set, #DB doesn't seem to end up on the #DB stack either. Right, it does not use the #DB stack or shift-ist stuff. Maybe it should, is this needed for anything else than making entry code debugable by kgdb? Regards, Joerg