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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5D770C433EF for ; Thu, 21 Jul 2022 16:25:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231965AbiGUQZw (ORCPT ); Thu, 21 Jul 2022 12:25:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59782 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229481AbiGUQZu (ORCPT ); Thu, 21 Jul 2022 12:25:50 -0400 Received: from mail-pg1-x536.google.com (mail-pg1-x536.google.com [IPv6:2607:f8b0:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F1EE783F19 for ; Thu, 21 Jul 2022 09:25:45 -0700 (PDT) Received: by mail-pg1-x536.google.com with SMTP id 12so1878148pga.1 for ; Thu, 21 Jul 2022 09:25:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=5OeVO50J7VroLT736lBfkoQjjuYlp1AvuRN18nKvUnM=; b=YMkM6vDLPLjmGcZQHgSmri+i2/nAPH+/qCTfgudw2H+zVQTjyTbi07IY4iX3Jp5NLk OsvNgm0HxSQ0nRBBzaMovnt/g/rt+hqEaEoYl4unXO5xMrENsjB7ovNTLyuwr/EQhO5Q Bng5DtDV1UUvxGtSghiWDgwWQdE0iq6DPKdQxiss1L6qI58lbXmEZc1/cN9/fkCn+WAE uX8edVy7nXpmcxOpMQ0Gt0pbMvlclinuPpLfVZRrf83tDmq45etKijsNaRhegnVWwt5R VJeWouHPEUlRz/f9rHFLue7LrGb7t67Ah1qTrZZp3MMPdCDo4l9oi0ogfYfsNiIGDfxk 6Oag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=5OeVO50J7VroLT736lBfkoQjjuYlp1AvuRN18nKvUnM=; b=QAKX63In2KNM+3TBmZv4z6uYfCFtb/YZWt4xFuT2khr0J+lnp2gpPey+aGIKagFsAg 1+WnRZBQYFwYC09nUVZGpxvVlritPih9gFkZANTMlbvUHZ2C3lHV62aUq0S2LleWVzEO w0SpE90gu6VJXMquAk6vTYmLgJoIEbXP3XG+nl5++FnfD2qVZuE9Ui7TtkMk2PjZ3+PH hTT1U9QVvATlotL47056wXtyMw9QkZcCB0/4dBh+BWeQAKK6VdwH6wgrRcV6D5PU2Lp9 jH7HQMGkKDflSeQvXZRlRBMRFYF22mlIncF79Drq65dvrMdOFEILXbcIIxs/6XIE8Uqo NB9Q== X-Gm-Message-State: AJIora/ucxS3Oe4wb7Tyfb0UdHfehUHbgcWc06kw6aIQVfgW+ALJZsP3 VcZlVLxN0bkQ/psj1U4TJbCaCA== X-Google-Smtp-Source: AGRyM1ssGZStH5RKI0f7tLkGUTHVJhb80FN2mRQMENDsdJFujfu+pZ3MuEs/4tNXiZ1Rt1cUk09uYg== X-Received: by 2002:a63:4a12:0:b0:419:9ede:b7a0 with SMTP id x18-20020a634a12000000b004199edeb7a0mr36227511pga.167.1658420745211; Thu, 21 Jul 2022 09:25:45 -0700 (PDT) Received: from google.com (123.65.230.35.bc.googleusercontent.com. [35.230.65.123]) by smtp.gmail.com with ESMTPSA id i8-20020a170902c94800b0016d2dc52eb1sm1987771pla.18.2022.07.21.09.25.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Jul 2022 09:25:44 -0700 (PDT) Date: Thu, 21 Jul 2022 16:25:40 +0000 From: Sean Christopherson To: Maxim Levitsky Cc: Santosh Shukla , Paolo Bonzini , Vitaly Kuznetsov , Jim Mattson , Joerg Roedel , Tom Lendacky , kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCHv2 4/7] KVM: SVM: Report NMI not allowed when Guest busy handling VNMI Message-ID: References: <20220709134230.2397-1-santosh.shukla@amd.com> <20220709134230.2397-5-santosh.shukla@amd.com> <413f59cd3c0a80c5b71a0cd033fdaad082c5a0e7.camel@redhat.com> <23f156d46033a6434591186b0a7bcce3d8a138d1.camel@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <23f156d46033a6434591186b0a7bcce3d8a138d1.camel@redhat.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 21, 2022, Maxim Levitsky wrote: > On Thu, 2022-07-21 at 16:08 +0000, Sean Christopherson wrote: > > So we have a poor man's NMI-window exiting. > > Yep, we also intercept IRET for the same purpose, and RSM interception > is also a place the NMI are evaluated. > > We only single step over the IRET, because NMIs are unmasked _after_ the IRET > retires. Heh, check out this blurb from Intel's SDM: An execution of the IRET instruction unblocks NMIs even if the instruction causes a fault. For example, if the IRET instruction executes with EFLAGS.VM = 1 and IOPL of less than 3, a general-protection exception is generated (see Section 20.2.7, “Sensitive Instructions”). In such a case, NMIs are unmasked before the exception handler is invoked. Not that I want to try and handle that in KVM if AMD follows suit, I simply find it amusing how messy this all is. A true NMI-window exit would have been nice...