Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp2753145imw; Wed, 6 Jul 2022 11:07:44 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uZkh4XYpDf8yZ88aYYCccLSmUg2hYiVYzlUcNhfF7S9qb7zQkJ0nQ1fKOx/6KufNqlztEF X-Received: by 2002:a05:6402:84a:b0:423:fe99:8c53 with SMTP id b10-20020a056402084a00b00423fe998c53mr57181799edz.195.1657130863833; Wed, 06 Jul 2022 11:07:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657130863; cv=none; d=google.com; s=arc-20160816; b=KIh+GLWFWNG+wW8itZIHw8D7n7TiH/L0BY9racsUVmzk0NPzfX/XMJGJvI9qGDvBNu PY7Ov8zgO1XwG2HIUzDztlxyBVVGgFxoiFhpxqfvc4oU2x29g8qr/eY3uYo8zJ3RGRom d52l7Fnk2/GEq68QlnqLRmIE0PMedr+C7IV/oJnleASjcmFaSBMBW3xkyWN5d2QsK5Ap 058Fi9ItcRk3mv3yjmdEuCfNO0sw58j3QKsg4vDWDf1AdPf50RZAB7bk0TfYk6Jta7ot X8CXFCdi/ArR4Bf5GjldSW5ZJGd6qG4EquEDYWnnY1vmdWTT2EnRpCUX0cTs5J/JBksx ESAA== 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=3eyJEdBzFu1fGOqq23lTWJQZdhZMM8HyIhz/8acbGII=; b=J7pe8ihQm2Xp5g7WGGniXG6uzrI5RjeBkmaiQtIXebeYbJgMAi7sGkJ9VuT8LYKl/Z YUMa6HD5BF89mzX12iGtq00okZyoRqwoGjv3+8ZiWs1U8oY7spf4XWbHnHQQdy5BLIqi Swy8X6YwMEdWJ3+xkIGglHwMEVBx1JJRhiW98AErTtLz8PLNp4w+CX9QP5REWyT2wM/h HoF1TrHKPEdUp3n+x1Od212r/EM4gf7DTrs7jtlcyZgFTe6eFM7lpVzpxbc4ggH8BS8/ zszqAPHqeV8KYauHpOnMthrgeUyVC9GTz61Izy9eEzFchS5+4W4AmkKn44Znp6F/DhOE Rogw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=osbs35Rm; 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 k15-20020aa7d8cf000000b0043a29c3e01bsi5102711eds.118.2022.07.06.11.07.15; Wed, 06 Jul 2022 11:07:43 -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=osbs35Rm; 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 S233420AbiGFRwu (ORCPT + 99 others); Wed, 6 Jul 2022 13:52:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39958 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230472AbiGFRws (ORCPT ); Wed, 6 Jul 2022 13:52:48 -0400 Received: from mail-pg1-x532.google.com (mail-pg1-x532.google.com [IPv6:2607:f8b0:4864:20::532]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4CD431DA49 for ; Wed, 6 Jul 2022 10:52:47 -0700 (PDT) Received: by mail-pg1-x532.google.com with SMTP id 23so14568059pgc.8 for ; Wed, 06 Jul 2022 10:52:47 -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=3eyJEdBzFu1fGOqq23lTWJQZdhZMM8HyIhz/8acbGII=; b=osbs35RmPZ+9VszHQ+FczPth3vyIqnf3OB0itULW8v6dUm8l6LqPkqNZvPPDz+p//r 6Tg6/1cfqNfDbbVOiE8JOJLvZoaSzlek9mLi2zJj8F/dGhXizIwZwQpSjjgpmS3bAi+R LTQg1yL9Nse4n+zU3qT6pd3JjktDNFHTixi+F6CEac1M7LYV1/Ocfrj1xtQmD6Vq77gO QHmJn96/j3jn5jkX1bUQwN8wEJcfZ1AtpgHWe7UYbXPYw3nWsqi9JvGoCWffk+nZzg8V EvV4+OT7sCc/h4iFzxD0b4ISw3WLtTO5COzZ4tFIa1gSLsz3/abzOpYdRrii4v1jL1Vl 2/vg== 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=3eyJEdBzFu1fGOqq23lTWJQZdhZMM8HyIhz/8acbGII=; b=Gugqv+HtCtJu55b9FLj+g9p9uOhFUvo9jdY+5hW4BRAb7lJqVmTdOs/rbszD75b+Xt En4x2cUxt297Z+0MRPFx6TcxWK/Qe4To6gAMbpCSoLsL3GjW6IxkhuEpLEF6VQ9+Hg1S Ga19uvN+mVlPbR3d4mNlHr+eIlWYG2JJTXXfh/8zQQV/cc8gPPgL4AU9rDfVmcjxSHud x3c49epTieVe2/jrxtuFDzRCOsby0zvgGNOA454/3VUDe9LGD/s5g3obINqmLGqJAjnp qrbPjnz6oG1GKGTXxyFvDup2/FDV3b00OnpZIcg8tOd9/sGvw/c+gpTrEinYo/oHJHr8 5xDA== X-Gm-Message-State: AJIora9m68BSJ8NkO85zCHAbKdor9/j+VLo0lAKMrB00nGV+iEMlgvOd L6RzEkylrXE8MBW2nhFk+Xr1Kg== X-Received: by 2002:aa7:94ad:0:b0:525:265b:991f with SMTP id a13-20020aa794ad000000b00525265b991fmr49042989pfl.30.1657129966693; Wed, 06 Jul 2022 10:52:46 -0700 (PDT) Received: from google.com (123.65.230.35.bc.googleusercontent.com. [35.230.65.123]) by smtp.gmail.com with ESMTPSA id b9-20020a631b49000000b00411bbcdfbf7sm11659410pgm.87.2022.07.06.10.52.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Jul 2022 10:52:46 -0700 (PDT) Date: Wed, 6 Jul 2022 17:52:42 +0000 From: Sean Christopherson To: Jim Mattson Cc: Maxim Levitsky , Paolo Bonzini , Vitaly Kuznetsov , Wanpeng Li , Joerg Roedel , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Oliver Upton , Peter Shier Subject: Re: [PATCH v2 00/21] KVM: x86: Event/exception fixes and cleanups Message-ID: References: <20220614204730.3359543-1-seanjc@google.com> <7e05e0befa13af05f1e5f0fd8658bc4e7bdf764f.camel@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: 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, T_SCC_BODY_TEXT_LINE,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 Wed, Jul 06, 2022, Jim Mattson wrote: > On Wed, Jul 6, 2022 at 4:55 AM Maxim Levitsky wrote: > > > 1. Since #SMI is higher priority than the #MTF, that means that unless dual monitor treatment is used, > > and the dual monitor handler figures out that #MTF was pending and re-injects it when it > > VMRESUME's the 'host', the MTF gets lost, and there is no way for a normal hypervisor to > > do anything about it. > > > > Or maybe pending MTF is saved to SMRAM somewhere. > > > > In case you will say that I am inventing this again, I am saying now that the above is > > just a guess. > > This is covered in the SDM, volume 3, section 31.14.1: "Default > Treatment of SMI Delivery:" > > The pseudocode above makes reference to the saving of VMX-critical > state. This state consists of the following: > (1) SS.DPL (the current privilege level); (2) RFLAGS.VM2; (3) the > state of blocking by STI and by MOV SS (see > Table 24-3 in Section 24.4.2); (4) the state of virtual-NMI blocking > (only if the processor is in VMX non-root oper- > ation and the “virtual NMIs” VM-execution control is 1); and (5) an > indication of whether an MTF VM exit is pending > (see Section 25.5.2). These data may be saved internal to the > processor or in the VMCS region of the current > VMCS. Processors that do not support SMI recognition while there is > blocking by STI or by MOV SS need not save > the state of such blocking. > > Saving VMX-critical state to SMRAM is not documented as an option. Hmm, I'm not entirely convinced that Intel doesn't interpret "internal to the processor" as "undocumented SMRAM fields". But I could also be misremembering the SMI flows. Regardless, I do like the idea of using vmcs12 instead of SMRAM. That would provide some extra motivation for moving away from KVM's broken pseudo VM-Exit implementation.