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

Re: [PATCH v4 12/15] xen: Add SET_CPUFREQ_HWP xen_sysctl_pm_op


  • To: Jason Andryuk <jandryuk@xxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Wed, 21 Jun 2023 17:27:34 +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=cY5YGSielma6L4kluSLfNYfLGtEZqe6VTMMwv8D4USY=; b=MBNt6EfU0QPoehkgYQ5lMr6J9V+fm9t9rhxfESplXtDgtvBBVPhIMj3CGyB2LTeGkNei6xE/21ajtR4SApvsUncc9MsN4e1r5qM4C5Z9yARsWDQ0VOySn9OOO9IHxVCXqEBpk2gdYK4/l8Axpko+wsoQg5+T9wTYVX51YVRyJ0FFKPTRucR/hxxHLy47Ly3dbD1bcISYQBvqqvCFM9UECySJsJNmNl2hMQpWGmvJJn9XL9o3jokmnkvsbvGLKyB7pdC2X6qykUJXD4mh1j4a61MOmDhXG3O1UCcUawb3W4aJydnbs7tBr/9IvPqKbK3TSA4XQE9Fjz+nkaOelnlkyA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PQN9Vr0zFvd7aJYtrZPLLK3wwa9cUgqpnxcKXSYKhuJ7Mlb7xN2jEq98YhQXDRv3xYqefs0UdN7rxge/TBhvHUFYrqPhbXsZimh35gKTzR4LxbAe7LAWWXCFfEDDLXkcrQRJNInlpgPYHUt//m54k/zwPYSXIlGgutYmposZsjcywE0J+4GQy5jJwq4aD6gl2gBpD6ZJgzsZA5/3XFltow0gL51JG85lh1n2wzAjLra9m/dCH7rdQlMkiCmJ1aroJJhK1p68RGJWdDewLmj92iQz2ggOHjN0iJ4eH/G5Kbo8zSNk6ePkVjNRxuaVqEwA0xR3nECUV16LySnf/5qXXw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Wed, 21 Jun 2023 15:28:00 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

(re-adding xen-devel@)

On 21.06.2023 16:16, Jason Andryuk wrote:
> On Mon, Jun 19, 2023 at 10:47 AM Jan Beulich <jbeulich@xxxxxxxx> wrote:
>> On 14.06.2023 20:02, Jason Andryuk wrote:
>>> +    if ( !(set_cppc->set_params & XEN_SYSCTL_CPPC_SET_ACT_WINDOW) &&
>>> +         set_cppc->activity_window )
>>> +        return -EINVAL;
> 
> There were a few aspects intended to be checked, but I have failed to
> implement them all properly and consistently.  The 32bit fields of the
> CPPC interface are larger than the 8 bit HWP fields (10 bits for
> activity window).  So the first aspect was supposed to ensure all
> those out-of-range bits are 0.
> 
> The second aspect, which wasn't implemented properly, was that fields
> would be 0 unless the corresponding bit was set in set_params.
> 
> The third aspect was to fail if a field was specified but hardware
> support isn't available.  That is now only activity window.
> 
> Do aspects #1 and #2 sound appropriate?  We can discuss #3 below.

Personally I'd prefer if inapplicable fields weren't checked, unless we
expect re-use of those fields with a different way of indicating that
the field holds an applicable value. But my primary desire is for
checking to be as consistent as possible.

>> Feels like I have wondered before what good this check does. I'm
>> inclined to suggest to ...
> 
> This check was supposed to enforce #2.
> 
>>> +    if ( set_cppc->activity_window & ~XEN_SYSCTL_CPPC_ACT_WINDOW_MASK )
>>> +        return -EINVAL;
>>
>> ... fold the two relevant checks, omitting the middle one:
>>
>>     if ( (set_cppc->set_params & XEN_SYSCTL_CPPC_SET_ACT_WINDOW) &&
>>          (!feature_hwp_activity_window ||
>>           (set_cppc->activity_window & ~XEN_SYSCTL_CPPC_ACT_WINDOW_MASK))
>>         return -EINVAL;
>>
>> Yet I'm also a little worried about the feature check, requiring the
>> caller to first figure out whether that feature is available. Would
>> it be an alternative to make such "best effort", preferably with
>> some indication that this aspect of the request was not carried out?
> 
> Yes, it would be nice to try and apply on a "best effort" basis as
> it's only activity window which may not be supported.
> 
> The SDM says, "Processors may support a subset of IA32_HWP_REQUEST
> fields as indicated by CPUID. Reads of non-supported fields will
> return 0. Writes to non-supported fields are ignored."
> 
> I'll have to test this, but potentially we just let the writes go
> through?  If the user checks xenpm, they will see that the activity
> window isn't supported?  Hmmm, I don't have a machine without activity
> window support, so I can't test it.  Skylake introduced HWP, but my
> skylake test system supports activity window.
> 
> Or do you want to make xen_set_cppc_para have an in/out and return the
> applied features?

Yes, that was what I meant with "indication of some sort". You could
e.g. simply clear the respective control bit in the request (and then
arrange for it to be copied back).

Jan



 


Rackspace

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