Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp5906384pxj; Wed, 23 Jun 2021 11:31:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzlDtGgqE0f1v29vi2ugtQcofBGMe+JDVElZad49Q9VsCjX9345FQr875uf+5R6WqNMMAWa X-Received: by 2002:a17:907:831d:: with SMTP id mq29mr1397400ejc.509.1624473060513; Wed, 23 Jun 2021 11:31:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624473060; cv=none; d=google.com; s=arc-20160816; b=Nv1dPwi1CceTX3ZWWm+aOGp/UFdGsNaq0elDeSDICBRWS0wzyHSzj7FYk1O2TqYHWu I4/WTuxBafAR51IQKfox0XaNZqdHwvwLifWw709i5gRBSHzJQ4gJ3wY9Bf5NgVMQLTCL n6kOLPjIrhhv8AGd1OCX61VvyKJ/DkHM2aPlf3mfC1JBtnSjvQqKATNa0CU6UkQSzAWQ bA1bb0nLE7BI/MjGZLERwJQgpWspDjKpo/liPpXF99KWtsUgUjnbkL0NCepHHKoJhYxp dUFSbLWhPc9H1RzEiKi866pOnxxT8InkRwOx6CJzvvVeydVCfvwuo+H0ZlC1CJ+LvP6f u8xA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=iYHrGTC3a+TqzndzZD+u5HI/qQGjEDtBrwf4IIOjVpc=; b=SsoZAuS+AYXnwdABLKgfhApWeoeHkNHQJwu/ZAnRAMnEHL8LJlTRby2wB4j+MT8Xd8 rD1/cCInJFeFa9VYACIwcZsFeM+zmSutoXFFTGr33zW6LlEu10MOLGuPX1ucZWk7VlT2 weW2+pE/voEl0ypUKdfM+fCSEHNBe4NopSKBZfkJpj003UklnJyPJvDawcpTIh1s/b+n yvfME7ETIBEQb8UxZCrVc5eac2a93x3qdwJNURStivA1cWxeldGWzITmOZiWjsdO6G7A FH2NOzk2IkUOcc7dIwx/Ped77KNKntGlAyO2ZVpil5eyq3GWxHSH9MoKMd9hy/3uqIK4 EDJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=BiVfxgiC; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h24si421712ejl.97.2021.06.23.11.30.36; Wed, 23 Jun 2021 11:31:00 -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; dkim=pass header.i=@google.com header.s=20161025 header.b=BiVfxgiC; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229906AbhFWSbi (ORCPT + 99 others); Wed, 23 Jun 2021 14:31:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229796AbhFWSbi (ORCPT ); Wed, 23 Jun 2021 14:31:38 -0400 Received: from mail-oi1-x232.google.com (mail-oi1-x232.google.com [IPv6:2607:f8b0:4864:20::232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 39DB1C061574 for ; Wed, 23 Jun 2021 11:29:20 -0700 (PDT) Received: by mail-oi1-x232.google.com with SMTP id 14so4325919oir.11 for ; Wed, 23 Jun 2021 11:29:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=iYHrGTC3a+TqzndzZD+u5HI/qQGjEDtBrwf4IIOjVpc=; b=BiVfxgiCIq2RxLoQpd7S7dkCTcu1xTw2fQeBWRTjRkQDSBhKdKImTub0Y5Oh8klQCJ ehfKpoeDIlEI4fhyf4mN6c9YLPkvnK653/qhRKRojgbq4Hjam0QAZsxfpFjuzr1AmzoB zxrj4x9XvcZefmyJU29MteOHarcyCXGxCi5DthOrNf9g+te2X2YjME6buhuAf5lvmmMt gETBRmWaKW5r6UKjV+E9s8BkAUKZgInkD6CPhDU2dSfcn5fE9qcwrnbbd7t+MpJJ1WCz 5e3xnd0rlx/8McyRa/2Rgh2y1zmqyi1MW0xZmpjXxDqunJ8hnMtirU7phYOHeginJFgp hhiQ== 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=iYHrGTC3a+TqzndzZD+u5HI/qQGjEDtBrwf4IIOjVpc=; b=b08ZrhMLo/7deDr247gR+hvVKZudYzq0yWwNyKstPl4lvQ68621yFJE0ZZU5YjTkVt fFfIh4T0iFP3QXMy5fo8ontTEt9xY5NsxYY9wBdJHvoRPLXk4IHVYWYPdMXkpwNgGDUI Za3mhGAY+2euOrafna6VUz8FGyhPEK3M4Fu8VtjsMoq7B1JynqvigA5v4CJqh29HZPlE zFXKJ2vouTBN63DOTH8AO2LEWs9w0odL6TTN+A7Y/BPotOe7nhlR3K+D/iPMahCoZ6Tm nmGJjvY7ooND5shq2UyJMtbr9c1fKEE3Tr5C4OQZLpBcbFe/H4SBsyPlPrJQmpa/tSz2 AnLA== X-Gm-Message-State: AOAM530rQsowEU7LFdu+O6T3UsURQkkdeXC7r6yvLmMFQ+dBo65ghvCF zKCZP/8PcPZyrK4lxQ59BvfFdQ74A00g+L3iRwtHHQ== X-Received: by 2002:a54:4586:: with SMTP id z6mr4270825oib.6.1624472959242; Wed, 23 Jun 2021 11:29:19 -0700 (PDT) MIME-Version: 1.0 References: <20210510081535.94184-1-like.xu@linux.intel.com> <20210510081535.94184-5-like.xu@linux.intel.com> In-Reply-To: <20210510081535.94184-5-like.xu@linux.intel.com> From: Jim Mattson Date: Wed, 23 Jun 2021 11:29:08 -0700 Message-ID: Subject: Re: [RESEND PATCH v4 04/10] KVM: vmx/pmu: Add MSR_ARCH_LBR_CTL emulation for Arch LBR To: Like Xu Cc: Paolo Bonzini , Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Joerg Roedel , Yang Weijiang , Wei Wang , kvm list , LKML Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 10, 2021 at 1:16 AM Like Xu wrote: > > Arch LBRs are enabled by setting MSR_ARCH_LBR_CTL.LBREn to 1. A new guest > state field named "Guest IA32_LBR_CTL" is added to enhance guest LBR usage. > When guest Arch LBR is enabled, a guest LBR event will be created like the > model-specific LBR does. > > On processors that support Arch LBR, MSR_IA32_DEBUGCTLMSR[bit 0] has no > meaning. It can be written to 0 or 1, but reads will always return 0. > Like IA32_DEBUGCTL, IA32_ARCH_LBR_CTL msr is also reserved on INIT. > > Signed-off-by: Like Xu > --- > arch/x86/events/intel/lbr.c | 2 -- > arch/x86/include/asm/msr-index.h | 1 + > arch/x86/include/asm/vmx.h | 2 ++ > arch/x86/kvm/vmx/pmu_intel.c | 31 ++++++++++++++++++++++++++----- > arch/x86/kvm/vmx/vmx.c | 9 +++++++++ > 5 files changed, 38 insertions(+), 7 deletions(-) > Same comments as on the previous patch. Your guard for ensuring that the new VMCS fields exist can be spoofed by a malicious userspace, and the new MSR has to be enumerated by KVM_GET_MSR_INDEX_LIST.