From nobody Mon Feb 9 00:42:59 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1615237396; cv=none; d=zohomail.com; s=zohoarc; b=RB0f/XbZWglcuhzSIvzdy7Rv6BFBa6k0EX/xMw2sRpeBX7SLt9MiZLgur6mZ7k3XkpX0T9FmoRffCTwyZ5F8PKKSuI8EnJ9vrIJZwuCs0yKBXiGYECmkHPvwZH4ts8Z5JbWYBEZVJO5FGsvkyd9wFfp9jzDEBYQpjGOEXZBPvWY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615237396; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=N7yhEOqzJ0+x+JlQs3Sjsvl85JThC2zfENNxFodtLhk=; b=mcWigF2QaPAd0GAOihkMRJ4I9eIw1PgZOEK5u/Ex8F0pj900s9fzzqT43DKWUwcuLAnKEQ4SZ8G/B3aB88WDTS++OyC0SbMvLjew+kIJ665RU/7d1nQ8G9f9WrZUjok/vs+2OBik/fqebAasuBEiiLFIf7BpLDidb1wAcUL2Yvg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1615237396905622.5983124330984; Mon, 8 Mar 2021 13:03:16 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.95093.179448 (Exim 4.92) (envelope-from ) id 1lJN1s-0006yX-OD; Mon, 08 Mar 2021 21:03:04 +0000 Received: by outflank-mailman (output) from mailman id 95093.179448; Mon, 08 Mar 2021 21:03:04 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lJN1s-0006yB-Ho; Mon, 08 Mar 2021 21:03:04 +0000 Received: by outflank-mailman (input) for mailman id 95093; Mon, 08 Mar 2021 21:03:02 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lJN1q-0006P0-JW for xen-devel@lists.xenproject.org; Mon, 08 Mar 2021 21:03:02 +0000 Received: from mail-qt1-x829.google.com (unknown [2607:f8b0:4864:20::829]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id af455b62-6776-4542-b122-5dd34a88e29a; Mon, 08 Mar 2021 21:02:39 +0000 (UTC) Received: by mail-qt1-x829.google.com with SMTP id d11so8625308qtx.9 for ; Mon, 08 Mar 2021 13:02:39 -0800 (PST) Received: from pm2-ws13.praxislan02.com ([2001:470:8:67e:a33e:daa7:46a1:a7eb]) by smtp.gmail.com with ESMTPSA id r2sm8514070qti.4.2021.03.08.13.02.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Mar 2021 13:02:38 -0800 (PST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: af455b62-6776-4542-b122-5dd34a88e29a DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=N7yhEOqzJ0+x+JlQs3Sjsvl85JThC2zfENNxFodtLhk=; b=XwM+qLg2re6gp7d448+Z4XdF/EiedVpR0jSynMw3g0qTHhS+Schv8AjGvL+oKpNBcs aEEDdUOtQqtTmnZou2IGTaWScV60rmV3M77Qi4OzeRe5pbz4+3r14j2xh4/ZD9A8M/if pYeBWXijdo3EIVNXKgw1UhHD3YYZJ4iRqcLCl/kKogzReEEQDFU2MfLzprkBCslk1Hwh u7XytJhJSDyx36+Wq6c2Da+mdBXEh+CMID5qDo9/aqpzGx2p5pkUsAvZqHgYGNJvWcxn 3Rrv1pT6jaSyFusmAzGA8N5fuw93FhJBQcvztMZeP5ZS2Cp71fkluy6xbYy4jeYrpiWn IwKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=N7yhEOqzJ0+x+JlQs3Sjsvl85JThC2zfENNxFodtLhk=; b=RiHfa1JTGh2w71SVvqDmoYYSL8GrhtlOwV4ZKUZQKs3VHpiBx+QtJPGKNwsNDD/4Ye HbB7Vqn3A8685P5OE3vsn5769Rp6ETIBFNsMNJWhuTN76HDsztu6znLtKTTRXHOg3kEa cS9d0GWmP5vXebkW8hIxzRNDdwys9AzH3oSINR3hQOA5ohW9UwQoZANy6quleycc0/y0 /AyGZs7EvMYVLBwP9pZAW++TnrNmPYST7NeOtZzAEFHtD0AZJOGsM3PrAjWu0TDfF9GU iuJHrgueeXrzeAwg3qPw2maKdX+xPRZjUuzEMlAwpijdx407LJHaDo+YbpTceW+uBq/D bA3Q== X-Gm-Message-State: AOAM532J+447TjJFohYC2dUPkZMr0eHFgRj9SBfr5R5rZZWlu7Ofn2s2 /sdscRf3ByU3mj1Wj0A68MnN1z1kJrM= X-Google-Smtp-Source: ABdhPJwf/dEzlun0+1V5RJMcQcxl6otvf+cIsUSOblP40ak/2X+oSRlaOUr+jhESxrlKhl+kVu61eg== X-Received: by 2002:ac8:6988:: with SMTP id o8mr22523226qtq.24.1615237358791; Mon, 08 Mar 2021 13:02:38 -0800 (PST) From: Jason Andryuk To: xen-devel@lists.xenproject.org Cc: pawel@invisiblethingslab.com, marmarek@invisiblethingslab.com, Jason Andryuk , Ian Jackson , Wei Liu Subject: [RFC 08/12] xenpm: Print HWP parameters Date: Mon, 8 Mar 2021 16:02:06 -0500 Message-Id: <20210308210210.116278-9-jandryuk@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210308210210.116278-1-jandryuk@gmail.com> References: <20210308210210.116278-1-jandryuk@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) Content-Type: text/plain; charset="utf-8" Print HWP-specific parameters. Some are always present, but others depend on hardware support. Signed-off-by: Jason Andryuk --- tools/misc/xenpm.c | 75 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 73 insertions(+), 2 deletions(-) diff --git a/tools/misc/xenpm.c b/tools/misc/xenpm.c index 35223b98df..9588dac991 100644 --- a/tools/misc/xenpm.c +++ b/tools/misc/xenpm.c @@ -708,6 +708,43 @@ void start_gather_func(int argc, char *argv[]) pause(); } =20 +static void calculate_hwp_activity_window(const xc_hwp_para_t *hwp, + unsigned int *activity_window, + const char **units) +{ + unsigned int mantissa =3D hwp->activity_window & 0x7f; + unsigned int exponent =3D ( hwp->activity_window >> 7 ) & 0x7; + unsigned int multiplier =3D 1; + + if ( hwp->activity_window =3D=3D 0 ) + { + *units =3D "hardware selected"; + *activity_window =3D 0; + + return; + } + + if ( exponent >=3D 6 ) + { + *units =3D "s"; + exponent -=3D 6; + } + else if ( exponent >=3D 3 ) + { + *units =3D "ms"; + exponent -=3D 3; + } + else + { + *units =3D "us"; + } + + for ( unsigned int i =3D 0; i < exponent; i++ ) + multiplier *=3D 10; + + *activity_window =3D mantissa * multiplier; +} + /* print out parameters about cpu frequency */ static void print_cpufreq_para(int cpuid, struct xc_get_cpufreq_para *p_cp= ufreq) { @@ -721,7 +758,7 @@ static void print_cpufreq_para(int cpuid, struct xc_get= _cpufreq_para *p_cpufreq) printf(" %d", p_cpufreq->affected_cpus[i]); printf("\n"); =20 - if (internal) + if ( internal ) { printf("cpuinfo frequency : base [%u] turbo [%u]\n", p_cpufreq->cpuinfo_min_freq, @@ -760,7 +797,7 @@ static void print_cpufreq_para(int cpuid, struct xc_get= _cpufreq_para *p_cpufreq) p_cpufreq->u.ondemand.up_threshold); } =20 - if (!internal) + if ( !internal ) { printf("scaling_avail_freq :"); for ( i =3D 0; i < p_cpufreq->freq_num; i++ ) @@ -777,6 +814,40 @@ static void print_cpufreq_para(int cpuid, struct xc_ge= t_cpufreq_para *p_cpufreq) p_cpufreq->scaling_cur_freq); } =20 + if ( strcmp(p_cpufreq->scaling_governor, "hwp-internal") =3D=3D 0 ) + { + const xc_hwp_para_t *hwp =3D &p_cpufreq->u.hwp_para; + + printf("hwp variables :\n"); + printf(" hardware limits : lowest [%u] most_efficient [%u]\n", + hwp->hw_lowest, hwp->hw_most_efficient); + printf(" hardware limits : guaranteed [%u] highest [%u]\n", + hwp->hw_guaranteed, hwp->hw_highest); + printf(" configured limits : min [%u] max [%u] energy_perf [%u]\= n", + hwp->minimum, hwp->maximum, hwp->energy_perf); + + if ( hwp->hw_feature & XEN_SYSCTL_HWP_FEAT_ENERGY_PERF ) + { + printf(" configured limits : energy_perf [%u%s]\n", + hwp->energy_perf, + hwp->energy_perf ? "" : " hw autonomous"); + } + + if ( hwp->hw_feature & XEN_SYSCTL_HWP_FEAT_ACT_WINDOW ) + { + unsigned int activity_window; + const char *units; + + calculate_hwp_activity_window(hwp, &activity_window, &units); + printf(" configured limits : activity_window [%u %s]\n", + activity_window, units); + } + + printf(" configured limits : desired [%u%s]\n", + hwp->desired, + hwp->desired ? "" : " hw autonomous"); + } + printf("turbo mode : %s\n", p_cpufreq->turbo_enabled ? "enabled" : "disabled or n/a"); printf("\n"); --=20 2.29.2