Received: by 2002:ac0:da4c:0:0:0:0:0 with SMTP id a12csp717575imi; Thu, 21 Jul 2022 09:32:48 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tYdusMogiQSKVxmVvYz44LVRka731RFlI7145SNVZMnvDNzYd04o6vQf5/MVPTQvgdwA1u X-Received: by 2002:a17:906:49d4:b0:6d6:e5ec:9a23 with SMTP id w20-20020a17090649d400b006d6e5ec9a23mr42213160ejv.79.1658421168377; Thu, 21 Jul 2022 09:32:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658421168; cv=none; d=google.com; s=arc-20160816; b=fU8TU3RYHe/XdQ5JXCNiOloucEbKzTYsDSvMtKkznBZAD2Vy2dHCS6dhP/yVx5QBeQ VPX54UlGeHaVZv+owfvqKiBJmERNiVhCeONtrEEmL9olSTJ//x4k5bV9gIkVKW3IAAAh 66y9/FlG7JgSAgETs8KzJ2Ndr7q4aFuu7pBbADql49N/CiJJ++1fiZUs/X7QUObg45GR J4nlcP9biMjwvJSjFCOSct3ewtgAFHR8/2Vu0UlHz4IHyPmTpiIMahrBENy8vwuI+MLa i4si1WQjMew9JKWf6hlLovX7QBcPll9qjtNmoS/vxikeJxhfjwkjvAiEThtehOeI9zK9 zRkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=5OeVO50J7VroLT736lBfkoQjjuYlp1AvuRN18nKvUnM=; b=dsYLn45B9xwCFD8oCXpsVj066/YKTqqyQdxpw8EIEGCjrLlOfUWHpm/U7UbjbvZcC/ Qx+ToTHsGyyYSeGx/lSq7M5XH/8Wed7ohbHutFMYoBs3ucqhOfpUJs/XygGsaid28L8S 76b4hECyU97at1U9X78VT/ap0Xpp2zFY7wimDXXvy05WM/eNfpUezagw7U53p/5Z+D8O qZPGp5hgwpEyh++xPFBP+NuDMj0VXXkK4wPPZvzbQ6/FNHlynkK0Zz2FdEWbqwubF4pq binC2RgE7d7OPdryxn7lb4EruxG76jsPEwmmrm9XEb1vmtavRn79v+yyPi1jRN3fED3/ DK/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=YMkM6vDL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id di3-20020a170906730300b0072ee0507879si3357827ejc.518.2022.07.21.09.32.20; Thu, 21 Jul 2022 09:32:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=YMkM6vDL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231955AbiGUQZw (ORCPT + 99 others); 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-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> X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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...