Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3188889pxk; Tue, 15 Sep 2020 12:24:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxnNzPeRDN6M8K/IAKYRGHYMkhXbMsggHKa3sHFlR/i32AoBss5Xd86MWDBRp5OvVfdZIi0 X-Received: by 2002:a17:906:4e4a:: with SMTP id g10mr21097111ejw.274.1600197871107; Tue, 15 Sep 2020 12:24:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600197871; cv=none; d=google.com; s=arc-20160816; b=YbCqbR1JSzkEMKY1VP8lUznN+5qgSK6k9D1ju+W3R8L62+w700ZilWRETfk4y1wWk1 GiCS1FGINxJB7DzD/JW3SgNaBzT9L1/wKHFWsu/opOpe0+TqtdPBb410JrV/HfsT/6uG 4OTpRxj7pyWReJxm8Q5lelzxoil6az7sfwdPwEX0/34CYqh15zF94d9K7yS5Ro2pdlHt HpRLY8VzH4cZoxgB9LD+hDZ6flzaaq79KOIyriY0ou4g/uW5FqPJQ2fC6nNHCCBCuqxv O7NJTlPl8uNbb1M5CXdq17yS0QSITmub7LS1sUiJn5iw8gwFqf1ThccM4SwgegTC/LSP y8ug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:ironport-sdr:ironport-sdr; bh=+/5uffl8U8JsTeK5IQ63kPPCXW5CxzJUbVH6Vgv0/O4=; b=bcvkDUnTjnPHduvifWIqznL4xN3N+LC9f5zaim2kTY1Er8pKDCOVnPvNymtefLnlOD 6g7bBLHewm5WYepTD2W0bvsuhqRzLyK3Kzgr6y3ZGc9NHmPepFGWV9ccSDmo6W9YKW96 IWPh2j7L9Kaf0Gu1VBAzhc85ftkgRg5JeuQeQkT49mcowEqidIiUrq1gjWRpMI3DYEDZ f58GR1P4HBSaUdSI5ajlYtEeOkgn9nm9wrmpmfXkrLFmXz4aSJb3KlWKoltpvF9NVzX8 JiKyofdMfj1jukPqnS6k7NVTNC+iJpDQYii0PB4ksbS3Ohi5npYfuFviqviztxY2f/xb Mbzg== 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 p3si8637525edx.219.2020.09.15.12.24.08; Tue, 15 Sep 2020 12:24:31 -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 S1727869AbgIOTUZ (ORCPT + 99 others); Tue, 15 Sep 2020 15:20:25 -0400 Received: from mga18.intel.com ([134.134.136.126]:37628 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728002AbgIOTPU (ORCPT ); Tue, 15 Sep 2020 15:15:20 -0400 IronPort-SDR: jpu6sbgfgarRvochp2TdkCIwnWBE9evbVdFpNcCQMcb/fthZ4t9rILwK9HUCiJXY9sWDe2HbGf qqhb3YSUS00Q== X-IronPort-AV: E=McAfee;i="6000,8403,9745"; a="147082733" X-IronPort-AV: E=Sophos;i="5.76,430,1592895600"; d="scan'208";a="147082733" 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; 15 Sep 2020 12:15:08 -0700 IronPort-SDR: +QXOI6frlxKJqQT9QSK1/luWh9YStL/bPt1O4xifBlSTe5DlR1HQRd9PoXNv+wbD3QBZBeMu28 oI2xAZlhyhdg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,430,1592895600"; d="scan'208";a="507694459" Received: from sjchrist-coffee.jf.intel.com ([10.54.74.160]) by fmsmga005.fm.intel.com with ESMTP; 15 Sep 2020 12:15:06 -0700 From: Sean Christopherson To: Paolo Bonzini Cc: Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Josh Poimboeuf , Uros Bizjak , Andi Kleen Subject: [PATCH v2 0/2] KVM: VMX: Clean up IRQ/NMI handling Date: Tue, 15 Sep 2020 12:15:03 -0700 Message-Id: <20200915191505.10355-1-sean.j.christopherson@intel.com> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Clean up KVM's handling of IRQ and NMI exits to move the invocation of the IRQ handler to a standalone assembly routine, and to then consolidate the NMI handling to use the same indirect call approach instead of using INTn. The IRQ cleanup was suggested by Josh Poimboeuf in the context of a false postive objtool warning[*]. I believe Josh intended to use UNWIND hints instead of trickery to avoid objtool complaints. I opted for trickery in the form of a redundant, but explicit, restoration of RSP after the hidden IRET. AFAICT, there are no existing UNWIND hints that would let objtool know that the stack is magically being restored, and adding a new hint to save a single MOV , instruction seemed like overkill. The NMI consolidation was loosely suggested by Andi Kleen. Andi's actual suggestion was to export and directly call the NMI handler, but that's a more involved change (unless I'm misunderstanding the wants of the NMI handler), whereas piggybacking the IRQ code is simple and seems like a worthwhile intermediate step. Sean Christopherson (2): KVM: VMX: Move IRQ invocation to assembly subroutine KVM: VMX: Invoke NMI handler via indirect call instead of INTn arch/x86/kvm/vmx/vmenter.S | 34 +++++++++++++++++++++ arch/x86/kvm/vmx/vmx.c | 61 +++++++++++--------------------------- 2 files changed, 51 insertions(+), 44 deletions(-) -- 2.28.0