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

Re: [PATCH v4 05/15] pmstat&xenpm: Re-arrage for cpufreq union


  • To: Jason Andryuk <jandryuk@xxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 15 Jun 2023 17:22:24 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.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=+h4Dzb+0kBzimTRBPa6/JxLJbWXkSXkr3y/YzngK4tI=; b=h2KLVjoLmaV41tNLk3iOHCum1+jB7Mu+R5TN8tBbbDvvnJae52UuETiRWY5TLeZY73LUgNH+DtTS/tBXcfiapzI81dpwLj7g9fDCXnNFkCntexJlVozlqJMJLP3MEL5MNUsII9aDIpFphBszcJMd7S83INRcaAyD8xRRsG5tgwc3e4lNH0RqHaq5neYOe0+E6rPTSTgz+UMXFg7W7/u6Omu4crkaUsHIhXqGFAlDqogwEQnbVzjyM0V3B/YYM4XA96CU9IR50aes7gSKUp2CRbwEWKAjadSP+Kgh+FwetP1NsSsm99wkPBvA8vqtHHrK9COLG05W/gezDAvg+nV2Ww==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UE55xUmQRN14Lmhnax9J5XYkv+Duque4UlYqy6ZImwNfzszUWUjjdhre67zTNwI1uK28m3goISO3mwPmRvzRxpukqOpIjoHp0OcZsyLexLx9giUrIAq9upacvEw4d+MayRQAOLkWjSqIKmDgOh4kYIn6PEmpQMHUKlxHXVai1kk5yZqsyI4bEVLdndaJQm7KTr8ZIB6nzAGfOMT7ehW6cTnPMBIVdq46za8rpMl8t1sPgzrMvjnlMM4psEmI/BdzRLMSVWRc/7GKRCimTV2yIwkTi9AAHsllagYiOkGXzrkhwgfBWmHxrj5T+fqgCf19KRfPbdeevzXAd+Zx2q7e4A==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Wei Liu <wl@xxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Thu, 15 Jun 2023 15:22:47 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 15.06.2023 17:05, Jason Andryuk wrote:
> On Thu, Jun 15, 2023 at 10:38 AM Jan Beulich <jbeulich@xxxxxxxx> wrote:
>>
>> On 14.06.2023 20:02, Jason Andryuk wrote:
>>> Move some code around now that common xen_sysctl_pm_op get_para fields
>>> are together.  In particular, the scaling governor information like
>>> scaling_available_governors is inside the union, so it is not always
>>> available.
>>>
>>> With that, gov_num may be 0, so bounce buffer handling needs
>>> to be modified.
>>>
>>> scaling_governor won't be filled for hwp, so this will simplify the
>>> change when it is introduced.
>>
>> While I think this suitably describes the tool stack side changes, ...
>>
>>> --- a/xen/drivers/acpi/pmstat.c
>>> +++ b/xen/drivers/acpi/pmstat.c
>>> @@ -239,11 +239,24 @@ static int get_cpufreq_para(struct xen_sysctl_pm_op 
>>> *op)
>>>      if ( ret )
>>>          return ret;
>>>
>>> +    op->u.get_para.cpuinfo_cur_freq =
>>> +        cpufreq_driver.get ? cpufreq_driver.get(op->cpuid) : policy->cur;
>>> +    op->u.get_para.cpuinfo_max_freq = policy->cpuinfo.max_freq;
>>> +    op->u.get_para.cpuinfo_min_freq = policy->cpuinfo.min_freq;
>>> +    op->u.get_para.turbo_enabled = cpufreq_get_turbo_status(op->cpuid);
>>> +
>>> +    if ( cpufreq_driver.name[0] )
>>> +        strlcpy(op->u.get_para.scaling_driver,
>>> +            cpufreq_driver.name, CPUFREQ_NAME_LEN);
>>> +    else
>>> +        strlcpy(op->u.get_para.scaling_driver, "Unknown", 
>>> CPUFREQ_NAME_LEN);
>>> +
>>>      if ( !(scaling_available_governors =
>>>             xzalloc_array(char, gov_num * CPUFREQ_NAME_LEN)) )
>>>          return -ENOMEM;
>>> -    if ( (ret = 
>>> read_scaling_available_governors(scaling_available_governors,
>>> -                gov_num * CPUFREQ_NAME_LEN * sizeof(char))) )
>>> +    if ( (ret = read_scaling_available_governors(
>>> +                    scaling_available_governors,
>>> +                    gov_num * CPUFREQ_NAME_LEN * sizeof(char))) )
>>>      {
>>>          xfree(scaling_available_governors);
>>>          return ret;
>>> @@ -254,26 +267,16 @@ static int get_cpufreq_para(struct xen_sysctl_pm_op 
>>> *op)
>>>      if ( ret )
>>>          return ret;
>>>
>>> -    op->u.get_para.cpuinfo_cur_freq =
>>> -        cpufreq_driver.get ? cpufreq_driver.get(op->cpuid) : policy->cur;
>>> -    op->u.get_para.cpuinfo_max_freq = policy->cpuinfo.max_freq;
>>> -    op->u.get_para.cpuinfo_min_freq = policy->cpuinfo.min_freq;
>>> -
>>>      op->u.get_para.u.s.scaling_cur_freq = policy->cur;
>>>      op->u.get_para.u.s.scaling_max_freq = policy->max;
>>>      op->u.get_para.u.s.scaling_min_freq = policy->min;
>>>
>>> -    if ( cpufreq_driver.name[0] )
>>> -        strlcpy(op->u.get_para.scaling_driver,
>>> -            cpufreq_driver.name, CPUFREQ_NAME_LEN);
>>> -    else
>>> -        strlcpy(op->u.get_para.scaling_driver, "Unknown", 
>>> CPUFREQ_NAME_LEN);
>>> -
>>>      if ( policy->governor->name[0] )
>>>          strlcpy(op->u.get_para.u.s.scaling_governor,
>>>              policy->governor->name, CPUFREQ_NAME_LEN);
>>>      else
>>> -        strlcpy(op->u.get_para.u.s.scaling_governor, "Unknown", 
>>> CPUFREQ_NAME_LEN);
>>> +        strlcpy(op->u.get_para.u.s.scaling_governor, "Unknown",
>>> +                CPUFREQ_NAME_LEN);
>>>
>>>      /* governor specific para */
>>>      if ( !strncasecmp(op->u.get_para.u.s.scaling_governor,
>>> @@ -291,7 +294,6 @@ static int get_cpufreq_para(struct xen_sysctl_pm_op *op)
>>>              &op->u.get_para.u.s.u.ondemand.sampling_rate,
>>>              &op->u.get_para.u.s.u.ondemand.up_threshold);
>>>      }
>>> -    op->u.get_para.turbo_enabled = cpufreq_get_turbo_status(op->cpuid);
>>>
>>>      return ret;
>>>  }
>>
>> ... all I see on the hypervisor side is re-ordering of steps and 
>> re-formatting
>> of over-long lines. It's not clear to me why what you do is necessary for 
>> your
>> purpose.
> 
> The purpose was to move accesses to the nested struct and union
> "op->u.get_para.u.s.u" to the end of the function, and the accesses to
> common fields (e.g. op->u.get_para.turbo_enabled) earlier.  This
> simplifies the changes in "cpufreq: Export HWP parameters to userspace
> as CPPC".

Could you mention this as (part of) the purpose in the description?

> These governor fields get indented, and that needed some re-formatting.

Would it maybe make sense to split the function?

Jan



 


Rackspace

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