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

Re: [PATCH 1/2] x86/vmx: Calculate model-specific LBRs once at start of day


  • To: Jan Beulich <jbeulich@xxxxxxxx>, Andrew Cooper <Andrew.Cooper3@xxxxxxxxxx>
  • From: Andrew Cooper <Andrew.Cooper3@xxxxxxxxxx>
  • Date: Tue, 10 Jan 2023 16:28:28 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=2+qcYU4UZAVz66L4Kyc9H4n1d6XZgfoIpmG0t1Jr0c4=; b=nf/7FVjxemscHXp/rjCgDdwlEbsBMNLWqOFsM9LIPw2rqS5d9rq3K0sgMGT1P4ctKyZH5REVYyOQbE8II/UXylEDsSHXlw7hHkfaESF3/giWmjuZQuhI56grVvSjMKj30pQf6WWyFrAOjVsMp5GwAtH/dPLDWgYPtIFvb6Osaml/7CXf9XWVV+lly1drRgtZSei2pwWH1Tij267DkewcjsM0/+UpSXyArBhGYHs7xM52Y/z2sSR162D3vORnEXypmaV1h9cz0RL07tOqKB/zaHBbWUCcuqgFSev9jXIJ4mg4lHhhtwstZvle7WOiE4t+JZFa9Y8SKjR/Bo6j3jjIRg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gKVNRsikJofMAuxFMCazZQ/8Cn9/k7LfAg8UNl43nd5X8advfHg2KUUyeQMes+Ds4wERlaNNF937U46CtjIih0g7Hq12P0mFuk0lbcqk3GoySCYEAH09uogdRS1dIZG/3uCS016SKX0PLLnNQhK1Fcxfqh8G3mIpJ0xzkDbZuVv2ue11HRdYVh1RX2GsJVJLtfHFFdR7Cukqhsj/LHORYNJYLXRGzyTnGrZJmM+9ETMtrzUEW/kESa4KdQPBXQgUKSXx7UdOPI+SHQlfu556ls/g1Hg9h9LlyXwTm9bg/E3YM2WfODQsiP2N47SxZXbK5k99SyJLBESjkSgySjbTyA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Roger Pau Monne <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Jun Nakajima <jun.nakajima@xxxxxxxxx>, Kevin Tian <kevin.tian@xxxxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Tue, 10 Jan 2023 16:28:51 +0000
  • Ironport-data: A9a23:38j9TqlkxtYV1tD8TzN9LYzo5gxRJ0RdPkR7XQ2eYbSJt1+Wr1Gzt xIWUD/Ta62DN2KjfIgjaI2190sBuceHyt5qGQNq+C1kQSMWpZLJC+rCIxarNUt+DCFhoGFPt JxCN4aafKjYaleG+39B55C49SEUOZmgH+a6U6icf3grHmeIcQ954Tp7gek1n4V0ttawBgKJq LvartbWfVSowFaYCEpNg064gE4p7aqaVA8w5ARkPqgS5QeGzBH5MbpETU2PByqgKmVrNrbSq 9brlNmR4m7f9hExPdKp+p6TnpoiG+O60aCm0xK6aoD66vRwjnVaPpUTbZLwXXx/mTSR9+2d/ f0W3XCGpaXFCYWX8AgVe0Ew/yiTpsSq8pefSZS0mZT7I0Er7xIAahihZa07FdRwxwp5PY1B3 cQCLTtXUzaDvPP10qC0QfZLrMQOKeC+aevzulk4pd3YJdAPZMiZBp7svJpf1jp2gd1SF/HDY cZfcSBocBnLfxxIPBEQFY46m+CrwHL4dlW0qnrM/fZxvzeVkVM3jOCF3Nn9I7RmQe18mEqCq 32A1GP+GhwAb/SUyCaf82LqjejK9c/+cNNITOXiqaI06LGV7nFLECVVSEKXm+nnj3O1We9PC mJX4QN7+MDe82TuFLERRSaQonSJoxodUNp4CPAh5UeGza+8yxmdLngJSHhGctNOnM0rQ3os3 1yAndLsDBRutqGYTTSW8bL8hTC/JykTa3MDbCksTA0Z7t2lq4Y25jrfQ9AmHKOrg9ndHTDr3 yvMvCU4n68Uj8MAy+O851+vvt63jp3ATwpw/QOOWGugtll9fNT9O9Tu7kXH5/FdKorfVkOGo HUPh8mZ6qYJEI2JkyuOBu4KGdlF+sq4DdEVunY3d7FJythn0yTyFWyMyFmS/HtUD/s=
  • Ironport-hdrordr: A9a23:UdxFhaofos3pBEv4+QSmJG0aV5oReYIsimQD101hICG9JPbo8P xG+85rtiMc6QxwZJhOo7u90cW7K080lqQV3WByB9iftVLdyQ+VxehZhOPfKlvbdhEWndQy6U 4PScRD4HKbNykdsS5XijPIcerJYbO8gcWVuds=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHZJCMapaYe8MLA1UOWoaXJDH0eEq6X2D6AgAAAnoA=
  • Thread-topic: [PATCH 1/2] x86/vmx: Calculate model-specific LBRs once at start of day

On 10/01/2023 4:26 pm, Jan Beulich wrote:
> On 09.01.2023 13:08, Andrew Cooper wrote:
>> There is no point repeating this calculation at runtime, especially as it is
>> in the fallback path of the WRSMR/RDMSR handlers.
>>
>> Move the infrastructure higher in vmx.c to avoid forward declarations,
>> renaming last_branch_msr_get() to get_model_specific_lbr() to highlight that
>> these are model-specific only.
>>
>> No practical change.
>>
>> Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
> Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
> with one nit:
>
>> --- a/xen/arch/x86/hvm/vmx/vmx.c
>> +++ b/xen/arch/x86/hvm/vmx/vmx.c
>> @@ -396,6 +396,142 @@ void vmx_pi_hooks_deassign(struct domain *d)
>>      domain_unpause(d);
>>  }
>>  
>> +static const struct lbr_info {
>> +    u32 base, count;
>> +} p4_lbr[] = {
>> +    { MSR_P4_LER_FROM_LIP,          1 },
>> +    { MSR_P4_LER_TO_LIP,            1 },
>> +    { MSR_P4_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 }
>> +}, c2_lbr[] = {
>> +    { MSR_IA32_LASTINTFROMIP,       1 },
>> +    { MSR_IA32_LASTINTTOIP,         1 },
>> +    { MSR_C2_LASTBRANCH_TOS,        1 },
>> +    { MSR_C2_LASTBRANCH_0_FROM_IP,  NUM_MSR_C2_LASTBRANCH_FROM_TO },
>> +    { MSR_C2_LASTBRANCH_0_TO_IP,    NUM_MSR_C2_LASTBRANCH_FROM_TO },
>> +    { 0, 0 }
>> +}, nh_lbr[] = {
>> +    { MSR_IA32_LASTINTFROMIP,       1 },
>> +    { MSR_IA32_LASTINTTOIP,         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_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 },
>> +    { 0, 0 }
>> +}, at_lbr[] = {
>> +    { MSR_IA32_LASTINTFROMIP,       1 },
>> +    { MSR_IA32_LASTINTTOIP,         1 },
>> +    { MSR_C2_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 }
>> +}, 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_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 }
>> +};
>> +static const struct lbr_info * __ro_after_init model_specific_lbr;
>> +
>> +static const struct __init lbr_info *get_model_specific_lbr(void)
> Please move __init:
>
> static const struct lbr_info *__init get_model_specific_lbr(void)

Yeah, I noticed and fixed both style errors here.  Also an extraneous
space before __ro_after_init.

~Andrew

 


Rackspace

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