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

Re: [PATCH v4 04/15] xen/sysctl: Nest cpufreq scaling options


  • To: Jason Andryuk <jandryuk@xxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 15 Jun 2023 16:28:59 +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=Mcpi16jFW5svy6wcXcRTb4Pq7ldv2xnKYnlaTHJbYrg=; b=DCE2l81wgo7yqAknsqJLlg10wYGK33HDFbvFQDxYeOPN3FN6RePOVhs/wboQsFS36pOTbLrrbOZkh54HOtXJSt9JFW1Itp4dszm7rEU1bE4IviNstbAJibVwlfHo5Y+An4Yo8IVbZuEr3iPJEtccsLcf/cmQ2jWReKnrMJJs3Fg3bu6SI89pRfSBOCLrN2+L0y11vkgv9ar4X3kfIDhcF4L0vEO9k5vJBA0xGX79Dn3mUztSTZnVt84AI8WoVRRByB2yiTthn6DaB+6xpEaZVDlXvPqP3vkg30se43XRzc2IpDFAdZ/evRtVr92w0N+jfE9xqkhuqEb/PpmbSqeurQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lqhpgNxHS+jwEBdK6PSxp1iGBj/brM/tgy6n/GWpdpulJ1v+hKVApxgbbs1OzDAk1UThoH88Xm07Bp6MzBBYmqUJuok/aGJxcNvO5dZcbWRuBC5zLQ71pA0iO1vNz4CPdNUPiq+jWiFH1cSbv0FZo6CQPDoHutSfqg8YzNZVd1b0SLLPVsT3ChT60AKAMjjYxFow0BbN+TiWQbfjysFoAZq6Gd+gMivzH3WD1WQDu1RvBh5kXhr8d3n5gwbeLSehq63VXqej6CSpq9qZmi2uUwnOx6rBxQqGU3UT0/TNVx6F22baczXONWzOn8EKwclKRw67b2VQ80g27g3L24Nb/w==
  • 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>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Thu, 15 Jun 2023 14:29:22 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 15.06.2023 16:07, Jason Andryuk wrote:
> On Thu, Jun 15, 2023 at 9:29 AM Jan Beulich <jbeulich@xxxxxxxx> wrote:
>>
>> On 14.06.2023 20:02, Jason Andryuk wrote:
>>> --- a/tools/include/xenctrl.h
>>> +++ b/tools/include/xenctrl.h
>>> @@ -1909,16 +1909,20 @@ struct xc_get_cpufreq_para {
>>>      uint32_t cpuinfo_cur_freq;
>>>      uint32_t cpuinfo_max_freq;
>>>      uint32_t cpuinfo_min_freq;
>>> -    uint32_t scaling_cur_freq;
>>> -
>>> -    char scaling_governor[CPUFREQ_NAME_LEN];
>>> -    uint32_t scaling_max_freq;
>>> -    uint32_t scaling_min_freq;
>>> -
>>> -    /* for specific governor */
>>>      union {
>>> -        xc_userspace_t userspace;
>>> -        xc_ondemand_t ondemand;
>>> +        struct {
>>> +            uint32_t scaling_cur_freq;
>>> +
>>> +            char scaling_governor[CPUFREQ_NAME_LEN];
>>> +            uint32_t scaling_max_freq;
>>> +            uint32_t scaling_min_freq;
>>> +
>>> +            /* for specific governor */
>>> +            union {
>>> +                xc_userspace_t userspace;
>>> +                xc_ondemand_t ondemand;
>>> +            } u;
>>> +        } s;
>>>      } u;
>>
>> There's no comment in the header that this needs to mirror the sysctl
>> struct. Does it really need changing?
> 
> Since this matched the other structure, I kept them in sync.  The
> cppc/hwp data needs to be represented somehow, and it gets introduced
> in the same way for both later.  If this doesn't get the new nested
> struct, then maybe fields could be placed into the single union.  That
> would grow the overall struct and have unused fields for hwp.

I guess I need to leave this to the maintainers then. Still ...

>>> --- a/tools/libs/ctrl/xc_pm.c
>>> +++ b/tools/libs/ctrl/xc_pm.c
>>> @@ -265,15 +265,10 @@ int xc_get_cpufreq_para(xc_interface *xch, int cpuid,
>>>          user_para->cpuinfo_cur_freq = sys_para->cpuinfo_cur_freq;
>>>          user_para->cpuinfo_max_freq = sys_para->cpuinfo_max_freq;
>>>          user_para->cpuinfo_min_freq = sys_para->cpuinfo_min_freq;
>>> -        user_para->scaling_cur_freq = sys_para->scaling_cur_freq;
>>> -        user_para->scaling_max_freq = sys_para->scaling_max_freq;
>>> -        user_para->scaling_min_freq = sys_para->scaling_min_freq;
>>>          user_para->turbo_enabled    = sys_para->turbo_enabled;
>>>
>>>          memcpy(user_para->scaling_driver,
>>>                  sys_para->scaling_driver, CPUFREQ_NAME_LEN);
>>> -        memcpy(user_para->scaling_governor,
>>> -                sys_para->scaling_governor, CPUFREQ_NAME_LEN);
>>
>> Did you really mean to remove the copying of these 4 entities, rather
>> than simply change the way the fields are accessed?
> 
> Yes, it was intentional.
> 
> The immediate following lines are:
>         /* copy to user_para no matter what cpufreq governor */
>         BUILD_BUG_ON(sizeof(((struct xc_get_cpufreq_para *)0)->u) !=
>              sizeof(((struct xen_get_cpufreq_para *)0)->u));
> 
>         memcpy(&user_para->u, &sys_para->u, sizeof(sys_para->u));

... this suggests that some matching is intended, yet it's not clear
to me why then the hole struct-s aren't assumed to be matching / made
match.

> And this memcpy copies all the moved entities.

Right, I should have gone to the source instead of going just from
patch context, sorry.

> I suppose the comment could change to "...no matter which cpufreq driver".

Yeah, well, it really would be driver/governor then, I guess.

Jan



 


Rackspace

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