Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp999476ybz; Wed, 29 Apr 2020 13:10:34 -0700 (PDT) X-Google-Smtp-Source: APiQypKcX6QU4ANVNgvoAEoH7yM85k52Wizcg5TQsihGd6YUMdRALgPFM0JxgJYSz7cZ48pHYQY/ X-Received: by 2002:a17:906:e90:: with SMTP id p16mr4401249ejf.14.1588191034262; Wed, 29 Apr 2020 13:10:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588191034; cv=none; d=google.com; s=arc-20160816; b=yQ/u11Ftih9dCkhHbpHBc5F9CmRZKbrtyXLhPfguxDSg3Kw0MDCTJVM2egPXRV0uNI lDKPUEGj8YauPAqNY0crC5a3x4APVV2CcWFOsvHY2cLeZYomG4oSMbn8lasOk9ymQmOp DyG272geOqT+vP4AOUkVEngZk4unoKZcFh3d7qUMaaFwX4Fx0MvdIGm3NkrSXlXm31v2 bd4xnSOG/GGXvwu2vZbHSV7tvx6wMvptQScCxXLJDnpBjOMeKVOGhb3IRv+ciXDmG/UA PzxRJVXgrvHOFrOPjZatSKZ5MPqOxMHZ+E5RLUJIH63ILDS08y5UHGILAOjQ4B4n/9au h/YQ== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:ironport-sdr :ironport-sdr; bh=SwqvZWI/BGjdmg66Tk7QbL3hq0TQ4n/uiZXfFuFaTmo=; b=p8L6AaflQkcaY2tvAS786QHIcteS1Bf48w/848Ok9LdAC/gNYgaoAohc5s9QAqsz8e BSppbHxTdIDnf/6deuKZDjj8o3Utma5UNlF9857vJAbHa9rPjAQqxnH7oW1BPxBZLFju TDbJR3M6ur0O4P3OZ5ci+GdRygahKiLyJIY+ckSNrw2KMSsy8gBhfBWTL1MaqxHxw1ec vqL3eIjqxxz6V4lV588/Uty4RANPXc0tPsIeGSgA6vOua/zTz+nHiRKyCAMEjWY5OZmk iHZkkhE0ib+lHL5NINj6CAE223RNKNPC4kn8iqQwSPqR9yEWbNpnw69J2VZ5Cd26GNXU PsLQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cw6si3931331edb.552.2020.04.29.13.10.10; Wed, 29 Apr 2020 13:10:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726858AbgD2UGb (ORCPT + 99 others); Wed, 29 Apr 2020 16:06:31 -0400 Received: from mga18.intel.com ([134.134.136.126]:37019 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726456AbgD2UGa (ORCPT ); Wed, 29 Apr 2020 16:06:30 -0400 IronPort-SDR: OqmVG6wuJxhpQbu6OPYgekd/oHCyHWVmDMqvwFDKln8Zn+sye7UbKRFnWS1qSI98GSJTiPgXoM aHI/PfKTRHlg== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Apr 2020 13:06:30 -0700 IronPort-SDR: m0hwcU/Pm2d+wtnIowylzWCVRuCjU8EwMkKdW30+nKlBoOHV3ncQiMMWzW2at5i/VsEZUZBqrr cmL1GXMTa68g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,333,1583222400"; d="scan'208";a="459315579" Received: from sjchrist-coffee.jf.intel.com (HELO linux.intel.com) ([10.54.74.202]) by fmsmga005.fm.intel.com with ESMTP; 29 Apr 2020 13:06:29 -0700 Date: Wed, 29 Apr 2020 13:06:29 -0700 From: Sean Christopherson To: Jim Mattson Cc: Paolo Bonzini , Vitaly Kuznetsov , Wanpeng Li , Joerg Roedel , kvm list , LKML , Oliver Upton , Peter Shier Subject: Re: [PATCH 09/13] KVM: nVMX: Prioritize SMI over nested IRQ/NMI Message-ID: <20200429200629.GH15992@linux.intel.com> References: <20200423022550.15113-1-sean.j.christopherson@intel.com> <20200423022550.15113-10-sean.j.christopherson@intel.com> <20200428225949.GP12735@linux.intel.com> <20200429145040.GA15992@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20200429145040.GA15992@linux.intel.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 29, 2020 at 07:50:40AM -0700, Sean Christopherson wrote: > On Tue, Apr 28, 2020 at 04:16:16PM -0700, Jim Mattson wrote: > > On Tue, Apr 28, 2020 at 3:59 PM Sean Christopherson > > wrote: > > > > > > On Tue, Apr 28, 2020 at 03:04:02PM -0700, Jim Mattson wrote: > > > > From the SDM, volume 3: > > > > > > > > • System-management interrupts (SMIs), INIT signals, and higher > > > > priority events take priority over MTF VM exits. > > > > > > > > I think this block needs to be moved up. > > > > > > Hrm. It definitely needs to be moved above the preemption timer, though I > > > can't find any public documentation about the preemption timer's priority. > > > Preemption timer is lower priority than MTF, ergo it's not in the same > > > class as SMI. > > > > > > Regarding SMI vs. MTF and #DB trap, to actually prioritize SMIs above MTF > > > and #DBs, we'd need to save/restore MTF and pending #DBs via SMRAM. I > > > think it makes sense to take the easy road and keep SMI after the traps, > > > with a comment to say it's technically wrong but not worth fixing. > > > > Pending debug exceptions should just go in the pending debug > > exceptions field. End of story and end of complications. I don't > > understand why kvm is so averse to using this field the way it was > > intended. > > Ah, it took my brain a bit to catch on. I assume you're suggesting calling > nested_vmx_updated_pending_dbg() so that the pending #DB naturally gets > propagated to/from vmcs12 on SMI/RSM? I think that should work. This works for L2, but not L1 :-( And L2 can't be fixed without first fixing L1 because inject_pending_event() also incorrectly prioritizes #DB over SMI. For L1, utilizing SMRAM to save/restore the pending #DB is likely the easiest solution as it avoids having to add new state for migration. I have everything coded up but it'll probably take a few weeks to test and get it sent out, need to focus on other stuff for a while.