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

Re: [PATCH v3 09/14 RESEND] xenpm: Print HWP parameters


  • To: Jason Andryuk <jandryuk@xxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 11 May 2023 08:25:14 +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=BXrwMBcrWt2CFGtRdG26GLGiO6lMsVKCulPnAkeuZQg=; b=G7omN41XQ9NAc2tNaA+HGrbkwcodEry6uA73zXUqAYui9cIG6u6GHrcf8pE2A+LxbMAUKJDo+/z97KJbih2T3fkhWuOPVJqR7KoxLEgc/jjF/8HPRXy+OkeF5mREl+HUvoE0Ag8C/OBuaBbFlKQZclHS3V566suiVsN/aztqHpwxUKuUeh/2NnCEXX05SHWG4rkkNkTALjKYPmaHe2AbcDjDA36NEFzU7hnl8zSqFxrf42/LktNBhWnwfnyFufX3Q+CuSIH4rLun9R/hvWjDJ0wI3HkBChzds+ysSsrLcSaBSkiV2XPv2As+O4JD1GgyMVlBCXHa2bXEG4SzwUmgLA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZeeUcyFCRI82HHdCj8qbYaZlTDR9M0IHjFz+XiBDfVSjSekrN2hxLmTaUkkUOfSdNUmA1RHdmk3RqMNOkSBM8tJb2+EuZwGhPA22Xfs+kaHTlds63fWnKEVMnVTvCocKEYAT59snP6Sa82AcULbURKYygog6yoVhtAiOP+6tLcbFXv1MJxC29NmGoYFCuuyagSlPDP5AJQzz/+uLOB2C0FnzkSH78jt5Gzkjq52YeerQb/NhCo5JYlyek32O44PxfuNJDlEa83UzrUKzHWUIk7eqMDskxdELBT1EBpwWg1CSQs0TLQTRZqRv7bbDarhHCZ2vj9sgMT1Sst9Q47BzVQ==
  • 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>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Thu, 11 May 2023 06:25:34 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 10.05.2023 20:11, Jason Andryuk wrote:
> On Mon, May 8, 2023 at 6:43 AM Jan Beulich <jbeulich@xxxxxxxx> wrote:
>> On 01.05.2023 21:30, Jason Andryuk wrote:
>>> --- a/tools/misc/xenpm.c
>>> +++ b/tools/misc/xenpm.c
>>> @@ -708,6 +708,44 @@ void start_gather_func(int argc, char *argv[])
>>>      pause();
>>>  }
>>>
>>> +static void calculate_hwp_activity_window(const xc_hwp_para_t *hwp,
>>> +                                          unsigned int *activity_window,
>>> +                                          const char **units)
>>> +{
>>> +    unsigned int mantissa = hwp->activity_window & 
>>> HWP_ACT_WINDOW_MANTISSA_MASK;
>>> +    unsigned int exponent =
>>> +        (hwp->activity_window >> HWP_ACT_WINDOW_EXPONENT_SHIFT) &
>>> +            HWP_ACT_WINDOW_EXPONENT_MASK;
>>
>> I wish we had MASK_EXTR() in common-macros.h. While really a comment on
>> patch 7 - HWP_ACT_WINDOW_EXPONENT_SHIFT is redundant information and
>> should imo be omitted from the public interface, in favor of just a
>> (suitably shifted) mask value. Also note how those constants all lack
>> proper XEN_ prefixes.
> 
> I'll add a patch adding MASK_EXTR() & MASK_INSR() to common-macros.h
> and use those - is there any reason not to do that?

I don't think there is, but I'm also not a maintainer of that code.

>>> +    unsigned int multiplier = 1;
>>> +    unsigned int i;
>>> +
>>> +    if ( hwp->activity_window == 0 )
>>> +    {
>>> +        *units = "hardware selected";
>>> +        *activity_window = 0;
>>> +
>>> +        return;
>>> +    }
>>
>> While in line with documentation, any mantissa of 0 results in a 0us
>> window, which I assume would then also mean "hardware selected".
> 
> I hadn't considered that.  The hardware seems to allow you to write a
> 0 mantissa, non-0 exponent.  From the SDM, it's unclear what that
> would mean.  The code as written would display "0 us", "0 ms", or "0
> s" - not "0 hardware selected".  Do you want more explicity printing
> for those cases?  I think it's fine to have a distinction between the
> output.  "0 hardware selected" is the known valid value that is
> working as expected.  The other ones being something different seems
> good to me since we don't really know what they mean.

Keeping things - apart from perhaps adding a respective comment - is
okay, as long as we don't know any better.

Jan



 


Rackspace

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