Received: by 2002:a17:90a:2044:0:0:0:0 with SMTP id n62csp8021883pjc; Mon, 27 May 2019 23:12:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqyVF2fQrtiRglvY+0MKjp60CxFTFOK2H6nfvJ3KDTQSSR0h7B2xL6fkZ8iMyvafoOEsFlRM X-Received: by 2002:a65:5a42:: with SMTP id z2mr11771994pgs.421.1559023961411; Mon, 27 May 2019 23:12:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559023961; cv=none; d=google.com; s=arc-20160816; b=1IaNLZF1Mt4z9yh6N22LcUbvY986AKo9aYKW8IRPM2aK/416YYzvzxL+4tlZNh+RxZ zjr5hUeRdi5KnVaCZG/O9Dqe05arD6k5+cZSmVgnzjijFAFh5+H+Ku7603Q0LwBACOxE m2yzSgkcL26ecfBhUSQrCduksXe2GmgCGLUPvBB6RiWb3FFjWbT8PpoBHPM6TtdqoMuK lYauqDTUOjobqXwlFXFy5SF2DM4ox4xwUhoaixs63/th4ds1+iDQgQsIMCGRXjE6vagM lfc6ZnCvPH4h0c9kpsU0gU+2tOtA1m0s9s5bM3J2nFfGSGszPcXsimEyMgFc3sgzdrEB csHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=fBewjNEj/uZLnzd5cPgjsqFHK+r7svr6zmAyQSTmTS8=; b=SvqHPSbU0ZFJxqzy13j3oucLtoKfKzKRspJl6lotO0IqrVtdjiLePbT49iMsYuphIN Li0tvnmpwS6/QV87JYkccoB8cqkm69V0pUvOduglBIhPqqFUWQB9lvv0DxLZp+zq8CQf Y0j6exBMSFqnByfXea/rcNIE3jpbg1PDMQm708GoFdZzMtXlkV8eeeM1qf7QMahtlciS 085L0Gse1SGxA5TkWxxlyBX2fvKN85ABEsi0uNtj38PxFgaKQhbH3jX/vaaFffWbqcgu jutm2rXVzGWVvcLuP/xa7yYfOHppyJ1lqes64OtVMixspSzSMd9r8Be6Y2iEWw0+IVYi m+fQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ho2JQOaQ; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d10si21716730pla.406.2019.05.27.23.12.26; Mon, 27 May 2019 23:12:41 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ho2JQOaQ; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727611AbfE1GLM (ORCPT + 99 others); Tue, 28 May 2019 02:11:12 -0400 Received: from mail-ot1-f65.google.com ([209.85.210.65]:41618 "EHLO mail-ot1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726657AbfE1GLM (ORCPT ); Tue, 28 May 2019 02:11:12 -0400 Received: by mail-ot1-f65.google.com with SMTP id l25so16649143otp.8; Mon, 27 May 2019 23:11:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=fBewjNEj/uZLnzd5cPgjsqFHK+r7svr6zmAyQSTmTS8=; b=ho2JQOaQKE4CptzxByMEKyRRuT0MJv2VE9omRHYfZyze8qjnrNWWeq1DpkJoh/3hU+ PLgbGKR/70FNgRrmdum8iI9ehJzGhBImvfd9nZV+YrHao23j6ZFyV/1fALReiyoHjT5d NX+0HuMNaBt522IF7Ha6MFXWa/n2eIIQYymP3izlgMzpXHM5v/9XgTssX6DR/zL+loCK Tt8geRZG24qn+XtQffesw977eCC+0BSnAt/EbnGgd7MryLxXfuE112YM5mCz7xtB3rpy 1otdtdYXEbDFUrLKXNa/sX70L6Ncr0WBvk7ms9qCRAOdp9qa+vKjXn8ylCNwGOIhSZ51 vz7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=fBewjNEj/uZLnzd5cPgjsqFHK+r7svr6zmAyQSTmTS8=; b=CGermeW+cTk5yau/TtMGLTO9mrjS8YFPhp9zjoBzGdzrpIBjJnRFXABuXI91rkFMGm DwmKL0e6m5mpJ1RF+o2ZRaJGH/22I4/dsjEDziXlz6kaEG9oQDvbQYwQN69jZ9/0ZcdL EEYhRktwg1AUlwyoY/YnMbr1SldCRCLYu+WUgNvNvjT9ScuQsVyZOVEIYAkab62KiKIA yNfMrFTzVxWHqH1pjOpDvcGsEr4GHdWpwhYLygMWPF1/wAx9V901iDgo+s6BrjVZEH/R TMsHCar3hlWehpYdHE5cLb40nIo4aw/yk/fSxgAgp5Wq8r4+VIri8HGj/HeKYdGWWcQL dbfg== X-Gm-Message-State: APjAAAUYfTDyBdJW4M38gL3jPAfkG/tZKHcCeFzzh0ia4Bml02dpR26O glevPAcSfsEuI0a/SGKgrs/G5PSkAr035ucSob8= X-Received: by 2002:a9d:6312:: with SMTP id q18mr24589147otk.45.1559023871580; Mon, 27 May 2019 23:11:11 -0700 (PDT) MIME-Version: 1.0 References: <20190524075637.29496-1-tao3.xu@intel.com> <20190524075637.29496-2-tao3.xu@intel.com> <20190527103003.GX2623@hirez.programming.kicks-ass.net> <43e2a62a-e992-2138-f038-1e4b2fb79ad1@intel.com> In-Reply-To: <43e2a62a-e992-2138-f038-1e4b2fb79ad1@intel.com> From: Wanpeng Li Date: Tue, 28 May 2019 14:11:04 +0800 Message-ID: Subject: Re: [PATCH v2 1/3] KVM: x86: add support for user wait instructions To: Tao Xu Cc: Peter Zijlstra , Paolo Bonzini , Radim Krcmar , Jonathan Corbet , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Sean Christopherson , "the arch/x86 maintainers" , kvm , linux-doc@vger.kernel.org, LKML , jingqi.liu@intel.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 28 May 2019 at 13:16, Tao Xu wrote: > > > On 27/05/2019 18:30, Peter Zijlstra wrote: > > On Fri, May 24, 2019 at 03:56:35PM +0800, Tao Xu wrote: > >> This patch adds support for UMONITOR, UMWAIT and TPAUSE instructions > >> in kvm, and by default dont't expose it to kvm and provide a capability > >> to enable it. > > > > I'm thinking this should be conditional on the guest being a 1:1 guest, > > and I also seem to remember we have bits for that already -- they were > > used to disable paravirt spinlocks for example. > > > > Hi Peter, > > I am wondering if "1:1 guest" means different guests in the same host > should have different settings on user wait instructions? > > User wait instructions(UMONITOR, UMWAIT and TPAUSE) can use in guest > only when the VMCS Secondary Processor-Based VM-Execution Control bit 26 > is 1, otherwise any execution of TPAUSE, UMONITOR, or UMWAIT causes a #UD. > > So with a capability to enable it, we use qemu kvm_vm_ioctl_enable_cap() > to enable it. The qemu link is blew: > https://lists.gnu.org/archive/html/qemu-devel/2019-05/msg05810.html > > By using different QEMU parameters, different guests in the same host > would have different features with or without user wait instructions. > > About "disable paravirt spinlocks" case, I am wondering if it uses Please refer to a4429e53c9 (KVM: Introduce paravirtualization hints and KVM_HINTS_DEDICATED) and b2798ba0b87 (KVM: X86: Choose qspinlock when dedicated physical CPUs are available). > kernel parameters? If it uses kernel parameters, different guests in the > same host may have same settings on user wait instructions. > > Or when we uses kernel parameters to disable user wait instructions, for > a host chooses to enable user wait instructions, we should do some work > on QEMU to choose disable or enable user wait instructions? > > Thanks > > Tao