[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [PATCH v5 1/2] x86/vtx: add LBR_SELECT to the list of LBR MSRs


  • To: Igor Druzhinin <igor.druzhinin@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: "Tian, Kevin" <kevin.tian@xxxxxxxxx>
  • Date: Sun, 25 Apr 2021 01:07:24 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8L9IDF1wo8fsdO8mmhW6cMKtoG6+H0Br5XorqTsh0Fg=; b=lKkR3IzRkXmIExfrRaFWTjZZk77EEG2f6p1JgVg3sdAk/RXPRHzbnQTfIRRjPBOeTyuZEMv/h4n416czvoPM8bCImR5yCZdLmqJIymmUSOeQPvNY8XddEYS0vME3KX9VFliKX5ELTgYak0EO4xf2Z+AJVzIOam2WqluuQ28wFwpWyWSburO4CwP5TneyhuxlI7wxlW+MEHOCc17u8wjcZKVziJnNNe44CLLX0KGSCwLNr63moC0vlt81ciQWNpok21LHP/2UGWRIy0D9Mld8uuCVvgJLZZ7Nj3cnGXmWQ9woyxVXEwHdRpvKwUQ1Xg8Y7y+CUvls2fyWXp7PX3uaIg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lGO7iRwAqL7esG95mz5BXBYhDBSkbKat5Gat9v0BCtUpsrB57xqzcH2oxRIWsdPhIaKwiY3OZY5tpXwmwydW7H76/pC6uJZtSo+sw4/jaDXf8jEggJVraQiKQCsGmvKr0+59SINMwMrJgHiX1V/O9Kz+1sfOoC/CDV2u8zmJMXdH5Qj1UxnSiByNkHyqYT7egVmvSfT/GApQti4EAfS7s9KImunPjBSwAvo+tnG2r/7YXhFukdFE+NO0vgemkfy+2LZ7cqkOvIVWTx7DQ0YbKNoH5mWux6t4Dvz9bOLZf/TqdNq6jhzsZz01gx+whf2VxdxGl6l+X+XQW1GijLqM1A==
  • Authentication-results: citrix.com; dkim=none (message not signed) header.d=none;citrix.com; dmarc=none action=none header.from=intel.com;
  • Cc: "Nakajima, Jun" <jun.nakajima@xxxxxxxxx>, "jbeulich@xxxxxxxx" <jbeulich@xxxxxxxx>, "Cooper, Andrew" <andrew.cooper3@xxxxxxxxxx>, "roger.pau@xxxxxxxxxx" <roger.pau@xxxxxxxxxx>, "wl@xxxxxxx" <wl@xxxxxxx>
  • Delivery-date: Sun, 25 Apr 2021 01:07:52 +0000
  • Dlp-product: dlpe-windows
  • Dlp-reaction: no-action
  • Dlp-version: 11.5.1.3
  • Ironport-sdr: /yz9CIr3KbenASjIdvViSKMGvGwajklPmwjfiIscR26HNlYTfjumJPWITvgvqzFdpvegznwq3U 0vgVbFHMN+Mw==
  • Ironport-sdr: VT1JM0+AjG3ynR9DHkCT0MkyKC1c3mn6AsgWOmQP5RA7CW2W0OoZVuR/jPkJ+sBIOX27ISWMPe JvLFBomZwn0Q==
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHXMd7OCBXv5dx1tEmSENL+Sd9wparEetQA
  • Thread-topic: [PATCH v5 1/2] x86/vtx: add LBR_SELECT to the list of LBR MSRs

> From: Igor Druzhinin <igor.druzhinin@xxxxxxxxxx>
> Sent: Thursday, April 15, 2021 6:04 PM
> 
> This MSR exists since Nehalem / Silvermont and is actively used by Linux,
> for instance, to improve sampling efficiency.
> 
> Signed-off-by: Igor Druzhinin <igor.druzhinin@xxxxxxxxxx>

Reviewed-by: Kevin Tian <kevin.tian@xxxxxxxxx>

> ---
> Changes in v5:
> - added Silvermont+ LBR_SELECT support
> 
> New patch in v4 as suggested by Andrew.
> ---
>  xen/arch/x86/hvm/vmx/vmx.c      | 20 ++++++++++++++++----
>  xen/include/asm-x86/msr-index.h | 10 ++++++++--
>  2 files changed, 24 insertions(+), 6 deletions(-)
> 
> diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
> index 835b905..30c6a57 100644
> --- a/xen/arch/x86/hvm/vmx/vmx.c
> +++ b/xen/arch/x86/hvm/vmx/vmx.c
> @@ -2915,14 +2915,16 @@ static const struct lbr_info {
>  }, nh_lbr[] = {
>      { MSR_IA32_LASTINTFROMIP,       1 },
>      { MSR_IA32_LASTINTTOIP,         1 },
> -    { MSR_C2_LASTBRANCH_TOS,        1 },
> +    { MSR_NHL_LBR_SELECT,           1 },
> +    { MSR_NHL_LASTBRANCH_TOS,       1 },
>      { MSR_P4_LASTBRANCH_0_FROM_LIP,
> NUM_MSR_P4_LASTBRANCH_FROM_TO },
>      { MSR_P4_LASTBRANCH_0_TO_LIP,
> NUM_MSR_P4_LASTBRANCH_FROM_TO },
>      { 0, 0 }
>  }, sk_lbr[] = {
>      { MSR_IA32_LASTINTFROMIP,       1 },
>      { MSR_IA32_LASTINTTOIP,         1 },
> -    { MSR_SKL_LASTBRANCH_TOS,       1 },
> +    { MSR_NHL_LBR_SELECT,           1 },
> +    { MSR_NHL_LASTBRANCH_TOS,       1 },
>      { MSR_SKL_LASTBRANCH_0_FROM_IP, NUM_MSR_SKL_LASTBRANCH },
>      { MSR_SKL_LASTBRANCH_0_TO_IP,   NUM_MSR_SKL_LASTBRANCH },
>      { MSR_SKL_LASTBRANCH_0_INFO,    NUM_MSR_SKL_LASTBRANCH },
> @@ -2934,10 +2936,19 @@ static const struct lbr_info {
>      { MSR_C2_LASTBRANCH_0_FROM_IP,
> NUM_MSR_ATOM_LASTBRANCH_FROM_TO },
>      { MSR_C2_LASTBRANCH_0_TO_IP,
> NUM_MSR_ATOM_LASTBRANCH_FROM_TO },
>      { 0, 0 }
> +}, sm_lbr[] = {
> +    { MSR_IA32_LASTINTFROMIP,       1 },
> +    { MSR_IA32_LASTINTTOIP,         1 },
> +    { MSR_SM_LBR_SELECT,            1 },
> +    { MSR_SM_LASTBRANCH_TOS,        1 },
> +    { MSR_C2_LASTBRANCH_0_FROM_IP,
> NUM_MSR_ATOM_LASTBRANCH_FROM_TO },
> +    { MSR_C2_LASTBRANCH_0_TO_IP,
> NUM_MSR_ATOM_LASTBRANCH_FROM_TO },
> +    { 0, 0 }
>  }, gm_lbr[] = {
>      { MSR_IA32_LASTINTFROMIP,       1 },
>      { MSR_IA32_LASTINTTOIP,         1 },
> -    { MSR_GM_LASTBRANCH_TOS,        1 },
> +    { MSR_SM_LBR_SELECT,            1 },
> +    { MSR_SM_LASTBRANCH_TOS,        1 },
>      { MSR_GM_LASTBRANCH_0_FROM_IP,
> NUM_MSR_GM_LASTBRANCH_FROM_TO },
>      { MSR_GM_LASTBRANCH_0_TO_IP,
> NUM_MSR_GM_LASTBRANCH_FROM_TO },
>      { 0, 0 }
> @@ -2991,6 +3002,7 @@ static const struct lbr_info
> *last_branch_msr_get(void)
>              return sk_lbr;
>          /* Atom */
>          case 0x1c: case 0x26: case 0x27: case 0x35: case 0x36:
> +            return at_lbr;
>          /* Silvermont */
>          case 0x37: case 0x4a: case 0x4d: case 0x5a: case 0x5d:
>          /* Xeon Phi Knights Landing */
> @@ -2999,7 +3011,7 @@ static const struct lbr_info
> *last_branch_msr_get(void)
>          case 0x85:
>          /* Airmont */
>          case 0x4c:
> -            return at_lbr;
> +            return sm_lbr;
>          /* Goldmont */
>          case 0x5c: case 0x5f:
>              return gm_lbr;
> diff --git a/xen/include/asm-x86/msr-index.h b/xen/include/asm-x86/msr-
> index.h
> index 43d26ef..020908f 100644
> --- a/xen/include/asm-x86/msr-index.h
> +++ b/xen/include/asm-x86/msr-index.h
> @@ -606,15 +606,21 @@
>  #define NUM_MSR_C2_LASTBRANCH_FROM_TO        4
>  #define NUM_MSR_ATOM_LASTBRANCH_FROM_TO      8
> 
> +/* Nehalem (and newer) last-branch recording */
> +#define MSR_NHL_LBR_SELECT           0x000001c8
> +#define MSR_NHL_LASTBRANCH_TOS               0x000001c9
> +
>  /* Skylake (and newer) last-branch recording */
> -#define MSR_SKL_LASTBRANCH_TOS               0x000001c9
>  #define MSR_SKL_LASTBRANCH_0_FROM_IP 0x00000680
>  #define MSR_SKL_LASTBRANCH_0_TO_IP   0x000006c0
>  #define MSR_SKL_LASTBRANCH_0_INFO    0x00000dc0
>  #define NUM_MSR_SKL_LASTBRANCH               32
> 
> +/* Silvermont (and newer) last-branch recording */
> +#define MSR_SM_LBR_SELECT            0x000001c8
> +#define MSR_SM_LASTBRANCH_TOS                0x000001c9
> +
>  /* Goldmont last-branch recording */
> -#define MSR_GM_LASTBRANCH_TOS                0x000001c9
>  #define MSR_GM_LASTBRANCH_0_FROM_IP  0x00000680
>  #define MSR_GM_LASTBRANCH_0_TO_IP    0x000006c0
>  #define NUM_MSR_GM_LASTBRANCH_FROM_TO        32
> --
> 2.7.4




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.