Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp908883pxk; Thu, 10 Sep 2020 01:38:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJySQneDA1TLj7PnMp9eZsfttFeQAUB9F6+goGUqXipp5LDmhC43YX6VLzYdP1UHSVWiGilf X-Received: by 2002:a17:906:6409:: with SMTP id d9mr7539616ejm.344.1599727082656; Thu, 10 Sep 2020 01:38:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599727082; cv=none; d=google.com; s=arc-20160816; b=kfj8ULQOxZZGLCYo1THYhFIIJnewOvIlq+CQu7eR3ZlaEXpPfn7wuIEm7TjQ+l5Sq+ Ww4+Oe24CnX7xRtlwsfvgEKfqunuJ76IQFiJouxa2oHoYxvHYFPiRSqeA6/jUtSr5ctH 44vN8NyY6wDJGLQNxT2bVHt0IeOyMo2Qapj0uCVwx4drdMgkeYPY+lfw6L4CRAyaEMzz n7H8d2Gx6rbD5f6n3r1WhKQh7iRJ6EZNU1naoIo5bZ1oOg53gsTbppYsDgU6lTtMxSYn tmEjt5h80K5AZrSnjSdOVq4PNNFwWsVPYxCrH/88+Lo8qlZBSo0ATarAnJGxPpG1YLIQ 5LXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :ironport-sdr:ironport-sdr; bh=xU/bEN47PUTQQizygwrAfq1MrS4thP9N8sMoUVRdNik=; b=KmQIh3cDLjOfth4qNrNUuA5PncHajCneyjqORegLhCzAWlwIlBukvZDkuIzxHRDhiH tcQ3VOCE3SBd9Ia+gElkssZTg7et1XSjHJC/MBt6ZMDO2PKjqtbMM7S5Z3DEF/4KVG2A 7XhUwX8mvulUw7Nmvna75ReAG8IP2q0weCBm88XIL7u8jyHFriRDPsr7Os/08+3fVXXi Vpnh8znKKDoh0/+XTwpZcWk0Nrq7Zo4/H9VYCeFQS/D3AMCFHGHImO2IGzWhVWr3VGGj dXhhIT+rJuJtQrebS+gkGbys8ey30fbG4MqYSymmze90uVV3/VYP9ofIgldhMlQwMb4Q +l0w== 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 p2si3093984ejf.310.2020.09.10.01.37.39; Thu, 10 Sep 2020 01:38:02 -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 S1730309AbgIJIgo (ORCPT + 99 others); Thu, 10 Sep 2020 04:36:44 -0400 Received: from mga07.intel.com ([134.134.136.100]:48998 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730346AbgIJIfq (ORCPT ); Thu, 10 Sep 2020 04:35:46 -0400 IronPort-SDR: oKWDyBjojvbgK3SNWUf6HyewwVHFW60J/EJcQQk4sRLzRYLO7PgvJLm0NTRnoYVm0Yk4qxqI/d kWVMWKsmm0Bg== X-IronPort-AV: E=McAfee;i="6000,8403,9739"; a="222691425" X-IronPort-AV: E=Sophos;i="5.76,412,1592895600"; d="scan'208";a="222691425" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Sep 2020 01:35:43 -0700 IronPort-SDR: BTIMnXWE+znZbEUeoD4BA2CV+WEJFdC4OUy+ocjqMKI4jNZqnmA2BNleP0I/YjZWV8w5bD7Cg2 vf5HoTnDUupg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,412,1592895600"; d="scan'208";a="329255926" Received: from chenyi-pc.sh.intel.com ([10.239.159.72]) by fmsmga004.fm.intel.com with ESMTP; 10 Sep 2020 01:35:41 -0700 From: Chenyi Qiang To: Paolo Bonzini , Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Xiaoyao Li Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC v3 0/2] add bus lock VM exit support Date: Thu, 10 Sep 2020 16:37:49 +0800 Message-Id: <20200910083751.26686-1-chenyi.qiang@intel.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org v2->v3 changelogs: - use a bitmap to get/set the capability of bus lock detection. we support exit and off mode currently. - put the handle of exiting to userspace in vmx.c, thus no need to define a shadow to track vmx->exit_reason.bus_lock_detected. - remove the vcpu->stats.bus_locks since every bus lock exits to userspace. --- Add the support for bus lock VM exit in KVM. It is a sub-feature of bus lock detection and the detailed info can be found in the patch 2/2. In this patch series, the first patch applies Sean's refactor to vcpu_vmx.exit_reason available at https://patchwork.kernel.org/patch/11500659. It is necessary as bus lock VM exit adds a new modifier bit(bit 26) in exit_reason field in VMCS. The second patch is the enabling work for bus lock VM exit. Add the support to set the capability to enable bus lock vm exit. The current implementation just exit to user space when handling the bus lock detected in guest. The concrete throttling policy in user space still needs to be discussed. We can enforce ratelimit on bus lock in guest, just inject some sleep time, or maybe other ideas. Document for Bus Lock Detection is now available at the latest "Intel Architecture Instruction Set Extensions Programming Reference" (see below). Note that the section 9.1 for Bus Lock Debug Exception requires modification due to the feedback from kernel community: https://lore.kernel.org/lkml/87r1stmi1x.fsf@nanos.tec.linutronix.de/ Document Link: https://software.intel.com/content/www/us/en/develop/download/intel-architecture-instruction-set-extensions-programming-reference.html Chenyi Qiang (1): KVM: VMX: Enable bus lock VM exit Sean Christopherson (1): KVM: VMX: Convert vcpu_vmx.exit_reason to a union arch/x86/include/asm/kvm_host.h | 5 ++ arch/x86/include/asm/vmx.h | 1 + arch/x86/include/asm/vmxfeatures.h | 1 + arch/x86/include/uapi/asm/kvm.h | 1 + arch/x86/include/uapi/asm/vmx.h | 4 +- arch/x86/kvm/vmx/capabilities.h | 6 ++ arch/x86/kvm/vmx/nested.c | 42 ++++++++---- arch/x86/kvm/vmx/vmx.c | 106 ++++++++++++++++++++--------- arch/x86/kvm/vmx/vmx.h | 25 ++++++- arch/x86/kvm/x86.c | 27 +++++++- arch/x86/kvm/x86.h | 5 ++ include/uapi/linux/kvm.h | 7 ++ 12 files changed, 179 insertions(+), 51 deletions(-) -- 2.17.1