From nobody Wed Nov 27 21:30:14 2024 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=1690391877; cv=none; d=zohomail.com; s=zohoarc; b=HmKPa1Gd2U4Y0h0E7Gnt8wrMPe4q9xrkVsT/dDO1EFx+BRTIBwzlcP/rnzVqetWfa9Me/8IXzFThJenEEUoKp/nRknh1xmj86mdc3DhPRb1VqzR8pvH3CWHggpa8UJDhLJS6BcXii9pS+woKNkXNsMULRx0UIoaMqvwEfHsNWQ0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690391877; 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=imeu59UbyEmxk/60do4rzt8IPOfqsoGRviRd+fRZmSg=; b=Xg71UuBJQ7YSjdebGNpAE+zcWJ+9No34bUwGEB6UxPYXfAX47p8oYesa655E04SAk8gIA5WKZuHd6OY6YlupBJRfK7IffxzF1mTKcV4sM2W5o1QJQyuqMBryIIXTZ21CNos9WIFJZX40W31lS0VUT/0wUXXbQN+SYbZ0BGyF85o= 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) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1690391877809103.04855041480016; Wed, 26 Jul 2023 10:17:57 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.570656.892701 (Exim 4.92) (envelope-from ) id 1qOi8Y-0003l6-Vj; Wed, 26 Jul 2023 17:17:22 +0000 Received: by outflank-mailman (output) from mailman id 570656.892701; Wed, 26 Jul 2023 17:17:22 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qOi8Y-0003kz-Ro; Wed, 26 Jul 2023 17:17:22 +0000 Received: by outflank-mailman (input) for mailman id 570656; Wed, 26 Jul 2023 17:17:20 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qOi2S-0005nP-GG for xen-devel@lists.xenproject.org; Wed, 26 Jul 2023 17:11:04 +0000 Received: from mail-qv1-xf2c.google.com (mail-qv1-xf2c.google.com [2607:f8b0:4864:20::f2c]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 65880181-2bd7-11ee-8613-37d641c3527e; Wed, 26 Jul 2023 19:11:02 +0200 (CEST) Received: by mail-qv1-xf2c.google.com with SMTP id 6a1803df08f44-6378cec43ddso375246d6.2 for ; Wed, 26 Jul 2023 10:11:02 -0700 (PDT) Received: from pm2-ws13.praxislan02.com (207-172-141-204.s8906.c3-0.slvr-cbr1.lnh-slvr.md.cable.rcncustomer.com. [207.172.141.204]) by smtp.gmail.com with ESMTPSA id s17-20020a0ca611000000b0063d1aa446e2sm1248019qva.59.2023.07.26.10.10.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Jul 2023 10:11:00 -0700 (PDT) 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: 65880181-2bd7-11ee-8613-37d641c3527e DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690391461; x=1690996261; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=imeu59UbyEmxk/60do4rzt8IPOfqsoGRviRd+fRZmSg=; b=cfCWBHQN8Rx3skIwDb8tQKTb4yWLK4tNuauqP7/MkSC+Nyh3LyrBID5/Boz2Gx4Zwl KZxZirZdeRGoY15ZRY2G+pvyiZXofrEdvFGe+HJeHw13kfcszDjc4hL+p7J6SG8aZSEJ JyP8EtgLp1zRNihXxGq1XhJw2D205C8Fo2gr+u8BMiZUVdgg5DF3kjgA5x3MlZp/06LJ KmVbJ2f9CAJDW3JY3goGxrEyTyx6JDUQa/DByhUOl4Gx/7ZzqOWeBjYP0tEBkV9yqufn r6lDya10frr0lN54lmVKbYjpP3wtP9aj3BfpJbKocPFfcwiH12a10hAz22DUAeEI7/Zk boRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690391461; x=1690996261; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=imeu59UbyEmxk/60do4rzt8IPOfqsoGRviRd+fRZmSg=; b=NWCNpzIq0AdqzEat3spWQlSaS1s66TWf0CzEhCVOJzXQrEeoF34045YfwS7lI+L6Pb Jsp65jVdPj1Bn4qGhXj3W4rX9URjkNOqyNZ1w77Y66duzw/ANCYjWlovH45mo4klGPT+ R65hVukc07nrKiN5GAVNQ3/z/DjQfRsMrsFSixcspXJnhtbikrLhNarVfwak//aVV4Y1 0bxHbqQy+arzf6XU8/3pQZrH6wdvbQJbrBb1ns3ZMq6AGbJ53Rn0mHDAJnRIx5WA1crc GQR6Y6btqboQbiaSHN6tmMzl+WM+dbmr2FmjBEuUvc75CE+IC8DpjZuIIVs0GRlB4EKv 84iQ== X-Gm-Message-State: ABy/qLZtrCV8lJXPW/IvQ4w8sKyxhG72g8BWkhBfV4wzOxvGwsp2i4eZ Dq4Dr4k7nwqw0shwEh8uotaB+JQlgtU= X-Google-Smtp-Source: APBJJlE+vt1k5qigt2ot0tq2Cf86zCqHXL5I/dtYIhfnyiUGkSEF61FqmaMokrlG483z9w5brciStw== X-Received: by 2002:a0c:e305:0:b0:63c:fbd0:84a6 with SMTP id s5-20020a0ce305000000b0063cfbd084a6mr2839134qvl.5.1690391461166; Wed, 26 Jul 2023 10:11:01 -0700 (PDT) From: Jason Andryuk To: xen-devel@lists.xenproject.org Cc: Jason Andryuk , Wei Liu , Anthony PERARD , Jan Beulich Subject: [PATCH v7 11/15] xenpm: Print HWP/CPPC parameters Date: Wed, 26 Jul 2023 13:09:41 -0400 Message-ID: <20230726170945.34961-12-jandryuk@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230726170945.34961-1-jandryuk@gmail.com> References: <20230726170945.34961-1-jandryuk@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1690391878590100001 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 Reviewed-by: Jan Beulich --- v2: Style fixes Declare i outside loop Replace repearted hardware/configured limits with spaces Fixup for hw_ removal Use XEN_HWP_GOVERNOR Use HWP_ACT_WINDOW_EXPONENT_* Remove energy_perf hw autonomous - 0 doesn't mean autonomous v4: Return activity_window from calculate_hwp_activity_window Use blanks instead of _ in output Use MASK_EXTR Check XEN_HWP_DRIVER name since governor is no longer returned s/hwp/cppc v5: Add Jan's Reviewed-by --- tools/misc/xenpm.c | 66 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/tools/misc/xenpm.c b/tools/misc/xenpm.c index 21c93386de..3abd99fd20 100644 --- a/tools/misc/xenpm.c +++ b/tools/misc/xenpm.c @@ -708,6 +708,46 @@ void start_gather_func(int argc, char *argv[]) pause(); } =20 +static unsigned int calculate_activity_window(const xc_cppc_para_t *cppc, + const char **units) +{ + unsigned int mantissa =3D MASK_EXTR(cppc->activity_window, + XEN_CPPC_ACT_WINDOW_MANTISSA_MASK); + unsigned int exponent =3D MASK_EXTR(cppc->activity_window, + XEN_CPPC_ACT_WINDOW_EXPONENT_MASK); + unsigned int multiplier =3D 1; + unsigned int i; + + /* + * SDM only states a 0 register is hardware selected, and doesn't ment= ion + * a 0 mantissa with a non-0 exponent. Only special case a 0 register. + */ + if ( cppc->activity_window =3D=3D 0 ) + { + *units =3D "hardware selected"; + + return 0; + } + + 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 ( i =3D 0; i < exponent; i++ ) + multiplier *=3D 10; + + return mantissa * multiplier; +} + /* print out parameters about cpu frequency */ static void print_cpufreq_para(int cpuid, struct xc_get_cpufreq_para *p_cp= ufreq) { @@ -772,6 +812,32 @@ static void print_cpufreq_para(int cpuid, struct xc_ge= t_cpufreq_para *p_cpufreq) p_cpufreq->u.s.scaling_min_freq, p_cpufreq->u.s.scaling_cur_freq); } + else + { + const xc_cppc_para_t *cppc =3D &p_cpufreq->u.cppc_para; + + printf("cppc variables :\n"); + printf(" hardware limits : lowest [%u] lowest nonlinear [%u]\n= ", + cppc->lowest, cppc->lowest_nonlinear); + printf(" : nominal [%u] highest [%u]\n", + cppc->nominal, cppc->highest); + printf(" configured limits : min [%u] max [%u] energy perf [%u]\= n", + cppc->minimum, cppc->maximum, cppc->energy_perf); + + if ( cppc->features & XEN_SYSCTL_CPPC_FEAT_ACT_WINDOW ) + { + unsigned int activity_window; + const char *units; + + activity_window =3D calculate_activity_window(cppc, &units); + printf(" : activity_window [%u %s]\n", + activity_window, units); + } + + printf(" : desired [%u%s]\n", + cppc->desired, + cppc->desired ? "" : " hw autonomous"); + } =20 printf("turbo mode : %s\n", p_cpufreq->turbo_enabled ? "enabled" : "disabled or n/a"); --=20 2.41.0