Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp901488imm; Wed, 4 Jul 2018 07:54:52 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdh4UJOhAg3POgaWU8LLwt9C1Vn1HDNGE7RoGkCKDGIXFabU4RW/zAhSWi+uT/rdEJm6rKz X-Received: by 2002:a63:bc0a:: with SMTP id q10-v6mr2229351pge.70.1530716092378; Wed, 04 Jul 2018 07:54:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530716092; cv=none; d=google.com; s=arc-20160816; b=H/tsLFmBIoEbps6gZiKXrtZgkblLjiomYJ12KkmowIqpnt8UXFF6YT76402z6bbpMa /L6jEGPidUW6kAD5dnpKWGNQ/Jms+Ie8F3cGwiVPsy3QsX9nu+ZOaAsbuacQGkIiPpE4 KJ+aEP1jxaPakq7r6Gq2LTiy3pai0UoXtwUsZ1gZHg0EWB4SsxYZM71LdYw96lWb4Sng 7qZtBP9WeHHhBokYmrQ9Xk7++3Xkx1Em/MxD2+9KsrA8pmOJZLR0/3FNDv0LBUq13i7S Ag7EpXSZ4omhsNtsTvtd4eBd2GPzsZAbhY/494bSRnrNNlLLsdLATsY+3KRiR+0gqwk2 3dTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date :arc-authentication-results; bh=vzxL4SNrpnafwpuHlOSzUpk2pyZwfKHWmZVgFjMi6hg=; b=GMa4360B+tjz88NTwSiclqviz78caI8JkAWBtVlfV4DLaPaDzpZRgjb6vJQa32VL5U XOpqATekOU2+m40aom33xj0DrT8TRjAo6d6lMgml5mNQi7uu9UqKWbH82SixDI3uesm8 wxWNb6hGVgkFzi/NNAJrDC03nR5uDZFwYbbPcGYNrOKx3AKHtKC6FUWqa+YiIszaj3Ia jQO1IXRYwLstppuL8XvDxEpCiQ3nO6JB2mUjbbKfFsNEj1TNJ+mMvJsv/n4laK1l5h7y xoIwQieJNZRFaXjSNGriHbiSQ80Ilj6Lgh56UXySLmfLHxyXM+rV1801KeM9BlkXkq4C Ul6w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v17-v6si2241418pgk.135.2018.07.04.07.54.37; Wed, 04 Jul 2018 07:54:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752664AbeGDOv6 (ORCPT + 99 others); Wed, 4 Jul 2018 10:51:58 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:47846 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753294AbeGDOv4 (ORCPT ); Wed, 4 Jul 2018 10:51:56 -0400 Received: from hsi-kbw-5-158-153-52.hsi19.kabel-badenwuerttemberg.de ([5.158.153.52] helo=nanos) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1faj8F-0000at-9m; Wed, 04 Jul 2018 16:51:47 +0200 Date: Wed, 4 Jul 2018 16:51:46 +0200 (CEST) From: Thomas Gleixner To: Paolo Bonzini cc: Jingqi Liu , rkrcmar@redhat.com, mingo@redhat.com, hpa@zytor.com, x86@kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, wei.w.wang@intel.com, Robert Hoo Subject: Re: [PATCH v2] KVM: Expose the split lock detection feature to guest VM In-Reply-To: <7813a04b-8058-538b-8c9b-cdd01ce119ac@redhat.com> Message-ID: References: <1530709593-87702-1-git-send-email-jingqi.liu@intel.com> <7813a04b-8058-538b-8c9b-cdd01ce119ac@redhat.com> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 4 Jul 2018, Paolo Bonzini wrote: > On 04/07/2018 15:06, Jingqi Liu wrote: > > A new control bit(bit 29) in the TEST_CTRL MSR will be introduced > > to enable detection of split locks. > > > > When bit 29 of the TEST_CTRL(33H) MSR is set, the processor > > causes an #AC exception to be issued instead of suppressing LOCK on > > bus(during split lock access). A previous control bit (bit 31) > > in this MSR causes the processor to disable LOCK# assertion for > > split locked accesses when set. When bits 29 and 31 are both set, > > bit 29 takes precedence. > > > > The release document ref below link: > > https://software.intel.com/sites/default/files/managed/c5/15/\ > > architecture-instruction-set-extensions-programming-reference.pdf > > This patch has a dependency on https://lkml.org/lkml/2018/5/27/78. That dependency is useless, because that series is going nowhere. > > Signed-off-by: Jingqi Liu > > --- > > arch/x86/include/asm/kvm_host.h | 1 + > > arch/x86/kvm/vmx.c | 77 +++++++++++++++++++++++++++++++++++++++++ > > arch/x86/kvm/x86.c | 10 ++++++ > > arch/x86/kvm/x86.h | 5 +++ > > include/uapi/linux/kvm.h | 1 + > > 5 files changed, 94 insertions(+) > > Checking for split lock is done with the MSR_TEST_CTL too, so you should > not use a capability to expose the availability to KVM userspace. > Instead you should expose the contents of MSR_TEST_CTL on the host, in a > similar way to https://marc.info/?l=kvm&m=152998661713547&w=2. > > Please coordinate with Robert Hu on the QEMU patches too, because he's > working on the infrastructure to use KVM_GET_MSR_FEATURE_INDEX_LIST in QEMU. Can we please sort out the whole AC mess on the host first including the detection stuff? There is no rush for this to be in KVM/QEMU now because all what exists for this new split lock thing is 'silicon' running on an emulator. And w/o support in the kernel proper this is completely useless. So this needs the following things: 1) Proper enumeration via CPUID or MISC_FEATURES. The current detection hack is just broken. 2) A proper host side implementation, which then automatically makes the stuff usable in a guest once it is exposed. 3) A proper way how to expose MSR_TEST_CTL to the guest, but surely not with extra split_lock_ctrl voodoo. It's an MSR nothing else. KVM/QEMU have standartized ways to deal with MSRs and the required selective bitwise access control. Thanks, tglx