From nobody Fri Apr 26 18:23:13 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=1620070125; cv=none; d=zohomail.com; s=zohoarc; b=i2KnxUFaG2u8LMFXRGfnX65QplMTFCgbe7ii2WPep2PZGlUk8WbnviHd7wrIx2JbxbVP8i72oqf5XZN50KEyGLG5VG1k8jVoRlrXcYP9jxpqUeT6Z+S6EyC4C30IjN/RXqLyuT1tpRRvNXxARwSXPDnxC7HC7nugwip2heKxpzg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1620070125; 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=g57GzuZpsCctvWoQCtrFFJcfB/69BgTCkSLuWAk+2XM=; b=HO9M32/FRq2HxMmGm1+0jrWJAJdgHYPBsBqEqft1ysbx9g20Ns0gVbI4bJEJPqBRCZ6IxbrkQMBt6kBw+PDoeVRRpfu0G1Sq6CfVJvlfH+ZarcqDWDKfe8FluNZ1o7F89y+9wK852iDYMleeUP1wVzEORTpdWgywOqG5aakiz6A= 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 1620070125743157.1486721471142; Mon, 3 May 2021 12:28:45 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.121805.229730 (Exim 4.92) (envelope-from ) id 1ldeF3-0005ju-1p; Mon, 03 May 2021 19:28:29 +0000 Received: by outflank-mailman (output) from mailman id 121805.229730; Mon, 03 May 2021 19:28:29 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ldeF2-0005jm-Uj; Mon, 03 May 2021 19:28:28 +0000 Received: by outflank-mailman (input) for mailman id 121805; Mon, 03 May 2021 19:28:27 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ldeF1-0005i5-MB for xen-devel@lists.xenproject.org; Mon, 03 May 2021 19:28:27 +0000 Received: from mail-qk1-x729.google.com (unknown [2607:f8b0:4864:20::729]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 289b7eb7-366a-4be4-b57f-3045304d52a9; Mon, 03 May 2021 19:28:27 +0000 (UTC) Received: by mail-qk1-x729.google.com with SMTP id o5so6300921qkb.0 for ; Mon, 03 May 2021 12:28:27 -0700 (PDT) Received: from pm2-ws13.praxislan02.com ([2001:470:8:67e:8710:5560:a711:776f]) by smtp.gmail.com with ESMTPSA id g18sm9225209qke.21.2021.05.03.12.28.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 May 2021 12:28:25 -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: 289b7eb7-366a-4be4-b57f-3045304d52a9 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=g57GzuZpsCctvWoQCtrFFJcfB/69BgTCkSLuWAk+2XM=; b=YBSpjJP205ldCrlB+abWxu+m8VbeuPWIJ/XXExUz8EYyTkZUFjL7+LVAckObklbecq sPObnk2qR7dwOPgGgFzMo5rBmIb1D7OBaPvJ9SkIf6BJYqvOKybVkKht3Dzq74FhtPHv kw9pke3JThZ4BAXAMsWRUDC/bKESzyHV4xcS/vnc1V2z0FG8IDDfyjmYh9mFcjz3eoI1 9+zZBOGyKlx4LFybEC/LGuvK/i9AAIdT0YTkCXdCxD7EOWOSwspc7zdAoJ0IVbOIWhOp E+bDacQAsydRaewH0NtCDSLYfl5pbxI0m5JCQT6cuCi0V9Qjk+SZC5BAstHdQbOfBKeL urWA== 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=g57GzuZpsCctvWoQCtrFFJcfB/69BgTCkSLuWAk+2XM=; b=t4hf6fIQpv6sFu+hCTiVgGK6AKE54Ct28Ux/sfJCwrTrNZiBgHVPFQyStCnTyo6uOg WDeD9xV576EFubHH7Q0qykN3m0tgzN2l7ZkFABHMVLgSjnOoDTabDdiKwM0W0P1v0jVh nZ7tW6FiGpLRtHMNK1BInCfB1txZxDbOTzEgvOHInb7gpaMz1zJReGRA2QzFXeZVVIM3 yGCk4dKWNxlgx1DYz51kQkM1K7DTKcgix6XYSepsyN9EarKEXYLr4cUypldwf5LpwWMf xf6ElMXPF2FCs7awwUeMUXAz5JK6GkmHjqOpsb1QYA4z0xa6fkYrVjlGMee5lbax5C8h 4juw== X-Gm-Message-State: AOAM5317CPuYjK9hmeG1Qsy7CTqFA/vhh9L1mxKBbg6BaJLB4AK+OTuM dCLrHzYHxMnvDZ5V0rJEzQqO1U6d9OE= X-Google-Smtp-Source: ABdhPJzItvGOOofE9kprenmOUVxW3jLCJ50TJvXYSkBUnqLA6shwxoxlgBVFLmzU5Z/p3pGvKbu5lg== X-Received: by 2002:a37:a5d8:: with SMTP id o207mr17798356qke.13.1620070106436; Mon, 03 May 2021 12:28:26 -0700 (PDT) From: Jason Andryuk To: xen-devel@lists.xenproject.org Cc: Jason Andryuk , Jan Beulich Subject: [PATCH 01/13] cpufreq: Allow restricting to internal governors only Date: Mon, 3 May 2021 15:27:58 -0400 Message-Id: <20210503192810.36084-2-jandryuk@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210503192810.36084-1-jandryuk@gmail.com> References: <20210503192810.36084-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" For hwp, the standard governors are not usable, and only the internal one is applicable. Add the cpufreq_governor_internal boolean to indicate when an internal governor, like hwp-internal, will be used. This is set during presmp_initcall, so that it can suppress governor registration during initcall. Only a governor with a name containing "internal" will be allowed in that case. This way, the unuseable governors are not registered, so they internal one is the only one returned to userspace. This means incompatible governors won't be advertised to userspace. Signed-off-by: Jason Andryuk --- xen/drivers/cpufreq/cpufreq.c | 4 ++++ xen/include/acpi/cpufreq/cpufreq.h | 1 + 2 files changed, 5 insertions(+) diff --git a/xen/drivers/cpufreq/cpufreq.c b/xen/drivers/cpufreq/cpufreq.c index 419aae83ee..6cbf150538 100644 --- a/xen/drivers/cpufreq/cpufreq.c +++ b/xen/drivers/cpufreq/cpufreq.c @@ -57,6 +57,7 @@ struct cpufreq_dom { }; static LIST_HEAD_READ_MOSTLY(cpufreq_dom_list_head); =20 +bool __read_mostly cpufreq_governor_internal; struct cpufreq_governor *__read_mostly cpufreq_opt_governor; LIST_HEAD_READ_MOSTLY(cpufreq_governor_list); =20 @@ -122,6 +123,9 @@ int __init cpufreq_register_governor(struct cpufreq_gov= ernor *governor) if (!governor) return -EINVAL; =20 + if (cpufreq_governor_internal && strstr(governor->name, "internal") = =3D=3D NULL) + return -EINVAL; + if (__find_governor(governor->name) !=3D NULL) return -EEXIST; =20 diff --git a/xen/include/acpi/cpufreq/cpufreq.h b/xen/include/acpi/cpufreq/= cpufreq.h index e88b20bfed..56df5eebed 100644 --- a/xen/include/acpi/cpufreq/cpufreq.h +++ b/xen/include/acpi/cpufreq/cpufreq.h @@ -115,6 +115,7 @@ extern struct cpufreq_governor cpufreq_gov_dbs; extern struct cpufreq_governor cpufreq_gov_userspace; extern struct cpufreq_governor cpufreq_gov_performance; extern struct cpufreq_governor cpufreq_gov_powersave; +extern bool cpufreq_governor_internal; =20 extern struct list_head cpufreq_governor_list; =20 --=20 2.30.2 From nobody Fri Apr 26 18:23:13 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=1620070125; cv=none; d=zohomail.com; s=zohoarc; b=Mzdaky6XX6H5EWrnMsKDBba2aJeKuy9IgFh857GcFqcxeSp68ob+tr+NQd0GbRRUqCXyD3AqTC/M/cqYB5EYJgALLTdpJsmgE02LChNLEIPXLpoHsNVNEBv+jBxZHRSTANghqtYBSQpIn7mSy2tVuUWeSqxe1Pb4sV/AK5XZgYI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1620070125; 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=o6aeco73TVtnG2vnCKcrrr9RATvAYWd7uArT6elgZ4M=; b=dfghRrHuSxgKO4RYVBz+5HELzGhqMdGyHbvP6E2Wv+H7rvks9K4sxzTx1XXipWUAhMbAP1v38noOCiWuUkbMEmDnY12gFh4S9ydlcRJQbWlZTYlsnnWC0RNJ0UKR3r9RSqTOkWrCA9slNVPB06dUqbE1j38/Ne4U49GnefZ74g0= 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 1620070125167221.9579764539767; Mon, 3 May 2021 12:28:45 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.121806.229742 (Exim 4.92) (envelope-from ) id 1ldeF7-0005nm-De; Mon, 03 May 2021 19:28:33 +0000 Received: by outflank-mailman (output) from mailman id 121806.229742; Mon, 03 May 2021 19:28:33 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ldeF7-0005nf-9z; Mon, 03 May 2021 19:28:33 +0000 Received: by outflank-mailman (input) for mailman id 121806; Mon, 03 May 2021 19:28:32 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ldeF6-0005i5-Ie for xen-devel@lists.xenproject.org; Mon, 03 May 2021 19:28:32 +0000 Received: from mail-qk1-x72b.google.com (unknown [2607:f8b0:4864:20::72b]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 4ea1e9d3-6db0-433a-9af7-bf527518f5d2; Mon, 03 May 2021 19:28:30 +0000 (UTC) Received: by mail-qk1-x72b.google.com with SMTP id i67so3146897qkc.4 for ; Mon, 03 May 2021 12:28:30 -0700 (PDT) Received: from pm2-ws13.praxislan02.com ([2001:470:8:67e:8710:5560:a711:776f]) by smtp.gmail.com with ESMTPSA id g18sm9225209qke.21.2021.05.03.12.28.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 May 2021 12:28:29 -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: 4ea1e9d3-6db0-433a-9af7-bf527518f5d2 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=o6aeco73TVtnG2vnCKcrrr9RATvAYWd7uArT6elgZ4M=; b=jM9llCt0QXCGnbPlb2cvcWJKAmrDSwo4oWznuSXdih4WXdBIIY4x+Yysl99fS+iCtn K9hA03/FWdkpL2tmB6NjdnJaqql+sc+6eIL+mfxpMi2Fhkj75eF5IGrtQl+38SCjKGAf p4c8czJCGJODZux5wP737n2+HFbKfGOP4nJaeDCkGDIV8P+A6oNYFFBJk7cM3mTLhSTE re3LhBQd3hHCToEu/ZXmTnOPyVhvA6zCEJmyf0v31gy9m5sW6R862AlUJX1BUwvMXGNX 62Xc/51OOE6g3uPf2Evvq80SkGeaDXUO94f0bhIrQWcX7917rGllkm17dViKf2tBIfSA FoFg== 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=o6aeco73TVtnG2vnCKcrrr9RATvAYWd7uArT6elgZ4M=; b=g8iEJflMYM7i7doqae5epiTktyLcCiEqc0Z0Pu6xsUm1NayH8w3G65PXC7MbNoXkxw VyVQY0BZ1pHq2xUIhsTFiWcE8BYiWOSGWXpDE1qm5hfMmL+EwzAyuMxXm7njbKOsbbmL QuPw15GzWjs7dlUwkqIYeRpA8MjhS63fkUOTLUdI8Eq+l1yqqIfpXFoDgXK97RUCW/mR 9qyDRJYvMzMlw0bX5RQ25SZ+JXG2j+7hCGK1s5GeuzTJgFIZWAokD4epTwqBTC/i1Hdu osE5+jyXIl0A/vBQqAhbpdbOypSAbEeZpmpIAwsTqvlM+M71qlrfXIOQQP6QWuM9JaJq xm8g== X-Gm-Message-State: AOAM533vM9Fbv62N4S+5VdM3Zvk6gl67w+7NIBr8fBd41aQGG54kNHeF q5rhJ6O7ZJam4oVrsMuGKxWyKNzmcYQ= X-Google-Smtp-Source: ABdhPJzy3E49jxtVyfMBYZkW+p55Hjn3fb981MdlPPXBkc0anCD6xoEj5zqOSMI3ZDWCGDmaiPnFJA== X-Received: by 2002:ae9:df46:: with SMTP id t67mr20677355qkf.269.1620070109951; Mon, 03 May 2021 12:28:29 -0700 (PDT) From: Jason Andryuk To: xen-devel@lists.xenproject.org Cc: Jason Andryuk , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Wei Liu Subject: [PATCH 02/13] cpufreq: Add perf_freq to cpuinfo Date: Mon, 3 May 2021 15:27:59 -0400 Message-Id: <20210503192810.36084-3-jandryuk@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210503192810.36084-1-jandryuk@gmail.com> References: <20210503192810.36084-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" acpi-cpufreq scales the aperf/mperf measurements by max_freq, but HWP needs to scale by base frequency. Settings max_freq to base_freq "works" but the code is not obvious, and returning values to userspace is tricky. Add an additonal perf_freq member which is used for scaling aperf/mperf measurements. Signed-off-by: Jason Andryuk --- I don't like this, but it seems the best way to re-use the common aperf/mperf code. The other option would be to add wrappers that then do the acpi vs. hwp scaling. --- xen/arch/x86/acpi/cpufreq/cpufreq.c | 2 +- xen/drivers/cpufreq/utility.c | 1 + xen/include/acpi/cpufreq/cpufreq.h | 3 +++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/xen/arch/x86/acpi/cpufreq/cpufreq.c b/xen/arch/x86/acpi/cpufre= q/cpufreq.c index f1f3c6923f..5eac2f7321 100644 --- a/xen/arch/x86/acpi/cpufreq/cpufreq.c +++ b/xen/arch/x86/acpi/cpufreq/cpufreq.c @@ -317,7 +317,7 @@ unsigned int get_measured_perf(unsigned int cpu, unsign= ed int flag) else perf_percent =3D 0; =20 - return policy->cpuinfo.max_freq * perf_percent / 100; + return policy->cpuinfo.perf_freq * perf_percent / 100; } =20 static unsigned int get_cur_freq_on_cpu(unsigned int cpu) diff --git a/xen/drivers/cpufreq/utility.c b/xen/drivers/cpufreq/utility.c index b93895d4dd..788929e079 100644 --- a/xen/drivers/cpufreq/utility.c +++ b/xen/drivers/cpufreq/utility.c @@ -236,6 +236,7 @@ int cpufreq_frequency_table_cpuinfo(struct cpufreq_poli= cy *policy, =20 policy->min =3D policy->cpuinfo.min_freq =3D min_freq; policy->max =3D policy->cpuinfo.max_freq =3D max_freq; + policy->cpuinfo.perf_freq =3D max_freq; policy->cpuinfo.second_max_freq =3D second_max_freq; =20 if (policy->min =3D=3D ~0) diff --git a/xen/include/acpi/cpufreq/cpufreq.h b/xen/include/acpi/cpufreq/= cpufreq.h index 56df5eebed..b91859ce5d 100644 --- a/xen/include/acpi/cpufreq/cpufreq.h +++ b/xen/include/acpi/cpufreq/cpufreq.h @@ -37,6 +37,9 @@ extern struct acpi_cpufreq_data *cpufreq_drv_data[NR_CPUS= ]; struct cpufreq_cpuinfo { unsigned int max_freq; unsigned int second_max_freq; /* P1 if Turbo Mode is on */ + unsigned int perf_freq; /* Scaling freq for aperf/mpref. + acpi-cpufreq uses max_freq, but HWP = uses + base_freq.*/ unsigned int min_freq; unsigned int transition_latency; /* in 10^(-9) s =3D nanosecond= s */ }; --=20 2.30.2 From nobody Fri Apr 26 18:23:13 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=1620070130; cv=none; d=zohomail.com; s=zohoarc; b=TTN9b+KkYdCypNtcFOxX2E1/ytWkeL0uxOWv3rDd1liioddpLNRlobF3AeXLPDO/OyeAeUuVNBxwhPaWBHjMkHZgheCdb6/1Q1pa/lwYbRGa6Q9GJ+KmxTfvN6lruU4H/cFe9ZIMb/obDg+xawUC1M130EYm2AiGZFMrNXrQRWE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1620070130; 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=n5SMtjJiYtnXZ6qrr9jd+Aepky6pd8C0k6PHUjXrSqU=; b=Ou5y2zozo+WHLBwfFyhvGZtnjbCaJNk+/mwnNj9F3SZU8SLHJpQT1jr4st5ffw6kdoOxS8dFr6s9mCgBGYJBtNbft9+a123cB3LJFF8EGCb4ZFKD/x3Y0tEt/hpWr+NLIXlJE6D5YOO+Wj93jmCqVBXcIxW2ZcHFCP38ehaNjwU= 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 1620070130831159.72362655073016; Mon, 3 May 2021 12:28:50 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.121807.229754 (Exim 4.92) (envelope-from ) id 1ldeFC-0005sp-Nn; Mon, 03 May 2021 19:28:38 +0000 Received: by outflank-mailman (output) from mailman id 121807.229754; Mon, 03 May 2021 19:28:38 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ldeFC-0005sg-Jn; Mon, 03 May 2021 19:28:38 +0000 Received: by outflank-mailman (input) for mailman id 121807; Mon, 03 May 2021 19:28:37 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ldeFB-0005i5-Il for xen-devel@lists.xenproject.org; Mon, 03 May 2021 19:28:37 +0000 Received: from mail-qv1-xf2c.google.com (unknown [2607:f8b0:4864:20::f2c]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 3aa841dc-cbbf-4658-b61b-53c596a891d0; Mon, 03 May 2021 19:28:33 +0000 (UTC) Received: by mail-qv1-xf2c.google.com with SMTP id dl3so3214318qvb.3 for ; Mon, 03 May 2021 12:28:33 -0700 (PDT) Received: from pm2-ws13.praxislan02.com ([2001:470:8:67e:8710:5560:a711:776f]) by smtp.gmail.com with ESMTPSA id g18sm9225209qke.21.2021.05.03.12.28.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 May 2021 12:28:32 -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: 3aa841dc-cbbf-4658-b61b-53c596a891d0 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=n5SMtjJiYtnXZ6qrr9jd+Aepky6pd8C0k6PHUjXrSqU=; b=GPA8CR2Qwl41wS71H7Nrs1TOtettIUx/IgqSGziPcU99C+sHnTjMaToTZL/tTmcdt/ 23214F+Lqdlhzh5/9b/t/MdewCySeHLfdLAq0fCeptshVx6a39sYtoHH50dTV/IrwYIo C3J4GFLp2o+rK4DjzTlzj1aqRTTrFuAECppfXNlL2wrqcec+XjejgKSf4muKQZXSNVSd AInPzb8U7DswIQAlvV1HcIOkIvqpH6BYGhbvRuY6UGJKsgTfVG+zv0GYIkRabg2OC4GF UlziXpnMpqCK+MEhyuM035V6bGYQ4LaoT5Tyy2adfogGWLdvyCjSxmSUvoRRkEcQJv/w UaBQ== 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=n5SMtjJiYtnXZ6qrr9jd+Aepky6pd8C0k6PHUjXrSqU=; b=GGzzNNQlQg/X8+SGxEvwekG4an1Hl00F/iwcroWN2OSiX5W/smOMKfgiZEMFtfCRJW rRZxbIznQGnR3jWTtAp3vCHD3rHqiCw/lOJjIz7gJHdhB7QwcrqHgE4/D4Bm4pEHB0U7 oLFMc76tVTVLKOaQtU7cC1IOOeHQRbXOi9OBvzRB0pBNLanF2QThes2Od8IzdwVYBC74 tsMf8gVvL7k6F8sHnPl0mmN4EUkf9DID9/Laxw/GPEEEotYRiW/q3At8NMQXkDkegE3R rx/8DMUU7vpkbnn2kG+HRBGL0g3vApcwpRBvDPNZ/xZGmAR1HzeguxBtCJrWnpP90qAK 8oaQ== X-Gm-Message-State: AOAM530EmsLtAcnpVPej/pGb7V5VWFM1QCsMYqHgkc9AuUMfiCyxpNR1 Zx6TXL/cze9BNq6LkzWCT/9B3Hg2w3w= X-Google-Smtp-Source: ABdhPJxQRpBOQfnCcqOD0VJ2BEUNTsF095m+CkUd/TlpLDyVfgsU/URliWZUx2FLVrEwsNb8kmP/1A== X-Received: by 2002:ad4:4bc4:: with SMTP id l4mr6967742qvw.46.1620070113001; Mon, 03 May 2021 12:28:33 -0700 (PDT) From: Jason Andryuk To: xen-devel@lists.xenproject.org Cc: Jason Andryuk , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Wei Liu Subject: [PATCH 03/13] cpufreq: Export intel_feature_detect Date: Mon, 3 May 2021 15:28:00 -0400 Message-Id: <20210503192810.36084-4-jandryuk@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210503192810.36084-1-jandryuk@gmail.com> References: <20210503192810.36084-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" Export feature_detect as intel_feature_detect so it can be re-used by HWP. Signed-off-by: Jason Andryuk Acked-by: Jan Beulich --- xen/arch/x86/acpi/cpufreq/cpufreq.c | 4 ++-- xen/include/acpi/cpufreq/processor_perf.h | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/acpi/cpufreq/cpufreq.c b/xen/arch/x86/acpi/cpufre= q/cpufreq.c index 5eac2f7321..8aae9b534d 100644 --- a/xen/arch/x86/acpi/cpufreq/cpufreq.c +++ b/xen/arch/x86/acpi/cpufreq/cpufreq.c @@ -340,7 +340,7 @@ static unsigned int get_cur_freq_on_cpu(unsigned int cp= u) return extract_freq(get_cur_val(cpumask_of(cpu)), data); } =20 -static void feature_detect(void *info) +void intel_feature_detect(void *info) { struct cpufreq_policy *policy =3D info; unsigned int eax; @@ -596,7 +596,7 @@ acpi_cpufreq_cpu_init(struct cpufreq_policy *policy) /* Check for APERF/MPERF support in hardware * also check for boost support */ if (c->x86_vendor =3D=3D X86_VENDOR_INTEL && c->cpuid_level >=3D 6) - on_selected_cpus(cpumask_of(cpu), feature_detect, policy, 1); + on_selected_cpus(cpumask_of(cpu), intel_feature_detect, policy, 1); =20 /* * the first call to ->target() should result in us actually diff --git a/xen/include/acpi/cpufreq/processor_perf.h b/xen/include/acpi/c= pufreq/processor_perf.h index d8a1ba68a6..e2c08f0e6d 100644 --- a/xen/include/acpi/cpufreq/processor_perf.h +++ b/xen/include/acpi/cpufreq/processor_perf.h @@ -7,6 +7,8 @@ =20 #define XEN_PX_INIT 0x80000000 =20 +void intel_feature_detect(void *info); + int powernow_cpufreq_init(void); unsigned int powernow_register_driver(void); unsigned int get_measured_perf(unsigned int cpu, unsigned int flag); --=20 2.30.2 From nobody Fri Apr 26 18:23:13 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=1620070138; cv=none; d=zohomail.com; s=zohoarc; b=H+HR3a6QgjAC4dJboKy2gjwU/H72glDoIOqL6Nes7YqjEjSUVxsLUU9CivV3rdzDLx9llck54atmkS6btq8fwcFLeVCXiRGmvUURzanwOCt9w7Ig8wO+fLxluu3FHMSH6YRKJwLPPnc0/rmXDF+RUZAn01VIiaY8I62yCaAsoao= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1620070138; 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=K9DM60LHgbrjnKk6ipk/EiTHiRh7kQUIe70xmtDrRvs=; b=O9OlUCjP7pkCR5X+ClGUarZEnck9HPyWAfEJ7meWS4Anx8zLnhCs1R5lzCRl5oTQncX8kMG9tqi0Shok6aSLmmutG21wPBGGHs3MRFdDGBRnVK3xTn/FkuE/XBFB1Nf5yEk+sS5yq2OedoF8t+/ZwlD0iUUyIktMLQOYsWkcjhI= 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 1620070138200312.0427995529708; Mon, 3 May 2021 12:28:58 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.121809.229766 (Exim 4.92) (envelope-from ) id 1ldeFI-0005yQ-2o; Mon, 03 May 2021 19:28:44 +0000 Received: by outflank-mailman (output) from mailman id 121809.229766; Mon, 03 May 2021 19:28:44 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ldeFH-0005yH-Uz; Mon, 03 May 2021 19:28:43 +0000 Received: by outflank-mailman (input) for mailman id 121809; Mon, 03 May 2021 19:28:42 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ldeFG-0005i5-It for xen-devel@lists.xenproject.org; Mon, 03 May 2021 19:28:42 +0000 Received: from mail-qk1-x734.google.com (unknown [2607:f8b0:4864:20::734]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id dd0d2f7c-7ff6-4225-af94-1de9a427986a; Mon, 03 May 2021 19:28:37 +0000 (UTC) Received: by mail-qk1-x734.google.com with SMTP id o27so6262492qkj.9 for ; Mon, 03 May 2021 12:28:37 -0700 (PDT) Received: from pm2-ws13.praxislan02.com ([2001:470:8:67e:8710:5560:a711:776f]) by smtp.gmail.com with ESMTPSA id g18sm9225209qke.21.2021.05.03.12.28.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 May 2021 12:28:35 -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: dd0d2f7c-7ff6-4225-af94-1de9a427986a 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=K9DM60LHgbrjnKk6ipk/EiTHiRh7kQUIe70xmtDrRvs=; b=P5Aw84DYh1kRXQ5q+yHsFjYfqLSNrAfPHZ9jm+TcO8POWbtHCSO4ouh7MVnMLN8FDS iRLfMTTPKeE4HObIsBrvkZ65umxSsZODudoQwF8kmoytYNhenb8BAmKRUeLLYE2fChqH ASQwYCgdusZ/HHnzLNK2GPyNanIGTYnZJKO/Ikpj/v+FXCtIdLYIP3YGlu4Qly0kg7qI K3zcgpq1+09x7uPMMDDbIx/pwiuFJ0Jvw+/F7IBUIroEaL0/pqRaWMU8QXwTheGPh3D6 GIZc8mOL6rui+P+znBoRMZ6fK2uzj9O8e4iv3+TANhJKPs/5Rr0X7Cv6bqV42ThKrUWS rhTQ== 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=K9DM60LHgbrjnKk6ipk/EiTHiRh7kQUIe70xmtDrRvs=; b=BM2uLiMhnboBTfffEvX8Oxl7ykCxWrtnjFdeEMBV77ngipRdYZZiAp/G69IRj1Vz7k sVQaX8El+Ny0Jmb4qfsdNwOgx15wXJd79HbAiekzMGvMtTvBJd7CVCgiNMheZsA/d2+9 DYFgxl7TiOpaxl+gelZoYUorxEbs/Us3X7GED5at2hHhtu/8bwnqylXEYnCevEgNFDli YoBlrzLGqi9TZ+IQIgL5OfR7E34EtkRd22RPkSmabedXIvqHgphj/Ex6gzfIEHtaJMb4 IxER7cB2gand73AcSGfP9GG184vGL7gWn/94YLCrgACKHdXWOwu3bTJ+TEaLMerHhVnV VOKw== X-Gm-Message-State: AOAM531GWP7ALh4V5NhabJCLMojN0/7oP58t1pBM/qG6RL0TyBfS1hHy f4CgZhEGfoD3K4LS0waEshv4MNMnhH4= X-Google-Smtp-Source: ABdhPJx4FLGBNxhoZUHMAUeQ/UHTXIvtNfrRi/JKbCGannSxELP/eThBg90JzOo4DSv2CWkTZ9YerA== X-Received: by 2002:a37:6004:: with SMTP id u4mr21062213qkb.369.1620070116261; Mon, 03 May 2021 12:28:36 -0700 (PDT) From: Jason Andryuk To: xen-devel@lists.xenproject.org Cc: Jason Andryuk , Andrew Cooper , George Dunlap , Ian Jackson , Jan Beulich , Julien Grall , Stefano Stabellini , Wei Liu , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH 04/13] cpufreq: Add Hardware P-State (HWP) driver Date: Mon, 3 May 2021 15:28:01 -0400 Message-Id: <20210503192810.36084-5-jandryuk@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210503192810.36084-1-jandryuk@gmail.com> References: <20210503192810.36084-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" From the Intel SDM: "Hardware-Controlled Performance States (HWP), which autonomously selects performance states while utilizing OS supplied performance guidance hints." Enable HWP to run in autonomous mode by poking the correct MSRs. There is no interface to configure - it hardcodes the default 0x80 (out of 0x0-0xff) energy/performance preference. xen_sysctl_pm_op/xenpm will be to be extended to configure in subsequent patches. Unscientific powertop measurement of an mostly idle, customized OpenXT install: A 10th gen 6-core laptop showed battery discharge drop from ~9.x to ~7.x watts. A 8th gen 4-core laptop dropped from ~10 to ~9 Power usage depends on many factors, especially display brightness, but this does show an power saving in balanced mode when CPU utilization is low. HWP isn't compatible with an external governor - it doesn't take explicit frequency requests. Therefore a minimal internal governor, hwp-internal, is also added as a placeholder. Signed-off-by: Jason Andryuk --- We disable on cpuid_level < 0x16. cpuid(0x16) is used to get the cpu frequencies for calculating the APERF/MPERF. Without it, things would still work, but the averge cpufrequency output would be wrong. If HWP Energy_Performance_Preference isn't supported, the code falls back to IA32_ENERGY_PERF_BIAS. Right now, we don't check CPUID.06H:ECX.SETBH[bit 3] before using that MSR. The SDM reads like it'll be available, and I assume it was available by the time Skylake introduced HWP. My 8th & 10th gen test systems both report: (XEN) HWP: 1 notify: 1 act_window: 1 energy_perf: 1 pkg_level: 0 peci: 0 (XEN) HWP: FAST_IA32_HWP_REQUEST not supported (XEN) HWP: Hardware Duty Cycling (HDC) supported (XEN) HWP: HW_FEEDBACK not supported So FAST_IA32_HWP_REQUEST and IA32_ENERGY_PERF_BIAS have not been tested. --- docs/misc/xen-command-line.pandoc | 9 + xen/arch/x86/acpi/cpufreq/Makefile | 1 + xen/arch/x86/acpi/cpufreq/cpufreq.c | 9 +- xen/arch/x86/acpi/cpufreq/hwp.c | 533 ++++++++++++++++++++++ xen/include/acpi/cpufreq/processor_perf.h | 3 + xen/include/asm-x86/cpufeature.h | 11 +- xen/include/asm-x86/msr-index.h | 17 + 7 files changed, 579 insertions(+), 4 deletions(-) create mode 100644 xen/arch/x86/acpi/cpufreq/hwp.c diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line= .pandoc index c32a397a12..66363a3d71 100644 --- a/docs/misc/xen-command-line.pandoc +++ b/docs/misc/xen-command-line.pandoc @@ -1355,6 +1355,15 @@ Specify whether guests are to be given access to phy= sical port 80 (often used for debugging purposes), to override the DMI based detection of systems known to misbehave upon accesses to that port. =20 +### hwp (x86) +> `=3D ` + +> Default: `true` + +Specifies whether Xen uses Hardware-Controlled Performance States (HWP) +on supported Intel hardware. HWP is a Skylake+ feature which provides +better CPU power management. + ### idle_latency_factor (x86) > `=3D ` =20 diff --git a/xen/arch/x86/acpi/cpufreq/Makefile b/xen/arch/x86/acpi/cpufreq= /Makefile index f75da9b9ca..db83aa6b14 100644 --- a/xen/arch/x86/acpi/cpufreq/Makefile +++ b/xen/arch/x86/acpi/cpufreq/Makefile @@ -1,2 +1,3 @@ obj-y +=3D cpufreq.o +obj-y +=3D hwp.o obj-y +=3D powernow.o diff --git a/xen/arch/x86/acpi/cpufreq/cpufreq.c b/xen/arch/x86/acpi/cpufre= q/cpufreq.c index 8aae9b534d..966490bda1 100644 --- a/xen/arch/x86/acpi/cpufreq/cpufreq.c +++ b/xen/arch/x86/acpi/cpufreq/cpufreq.c @@ -641,9 +641,12 @@ static int __init cpufreq_driver_init(void) int ret =3D 0; =20 if ((cpufreq_controller =3D=3D FREQCTL_xen) && - (boot_cpu_data.x86_vendor =3D=3D X86_VENDOR_INTEL)) - ret =3D cpufreq_register_driver(&acpi_cpufreq_driver); - else if ((cpufreq_controller =3D=3D FREQCTL_xen) && + (boot_cpu_data.x86_vendor =3D=3D X86_VENDOR_INTEL)) { + if (hwp_available()) + ret =3D hwp_register_driver(); + else + ret =3D cpufreq_register_driver(&acpi_cpufreq_driver); + } else if ((cpufreq_controller =3D=3D FREQCTL_xen) && (boot_cpu_data.x86_vendor & (X86_VENDOR_AMD | X86_VENDOR_HYGON))) ret =3D powernow_register_driver(); diff --git a/xen/arch/x86/acpi/cpufreq/hwp.c b/xen/arch/x86/acpi/cpufreq/hw= p.c new file mode 100644 index 0000000000..f8e6fdbd41 --- /dev/null +++ b/xen/arch/x86/acpi/cpufreq/hwp.c @@ -0,0 +1,533 @@ +/* + * hwp.c cpufreq driver to run Intel Hardware P-States (HWP) + * + * Copyright (C) 2021 Jason Andryuk + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; If not, see . + */ + +#include +#include +#include +#include +#include +#include +#include + +static bool feature_hwp; +static bool feature_hwp_notification; +static bool feature_hwp_activity_window; +static bool feature_hwp_energy_perf; +static bool feature_hwp_pkg_level_ctl; +static bool feature_hwp_peci; + +static bool feature_hdc; +static bool feature_fast_msr; + +bool opt_hwp =3D true; +boolean_param("hwp", opt_hwp); + +union hwp_request +{ + struct + { + uint64_t min_perf:8; + uint64_t max_perf:8; + uint64_t desired:8; + uint64_t energy_perf:8; + uint64_t activity_window:10; + uint64_t package_control:1; + uint64_t reserved:16; + uint64_t activity_window_valid:1; + uint64_t energy_perf_valid:1; + uint64_t desired_valid:1; + uint64_t max_perf_valid:1; + uint64_t min_perf_valid:1; + }; + uint64_t raw; +}; + +struct hwp_drv_data +{ + union + { + uint64_t hwp_caps; + struct + { + uint64_t hw_highest:8; + uint64_t hw_guaranteed:8; + uint64_t hw_most_efficient:8; + uint64_t hw_lowest:8; + uint64_t hw_reserved:32; + }; + }; + union hwp_request curr_req; + uint16_t activity_window; + uint8_t minimum; + uint8_t maximum; + uint8_t desired; + uint8_t energy_perf; +}; +struct hwp_drv_data *hwp_drv_data[NR_CPUS]; + +#define hwp_err(...) printk(XENLOG_ERR __VA_ARGS__) +#define hwp_info(...) printk(XENLOG_INFO __VA_ARGS__) +#define hwp_verbose(...) \ +({ \ + if ( cpufreq_verbose ) \ + { \ + printk(XENLOG_DEBUG __VA_ARGS__); \ + } \ +}) +#define hwp_verbose_cont(...) \ +({ \ + if ( cpufreq_verbose ) \ + { \ + printk( __VA_ARGS__); \ + } \ +}) + +static int hwp_governor(struct cpufreq_policy *policy, + unsigned int event) +{ + int ret; + + if ( policy =3D=3D NULL ) + return -EINVAL; + + switch (event) + { + case CPUFREQ_GOV_START: + ret =3D 0; + break; + case CPUFREQ_GOV_STOP: + ret =3D -EINVAL; + break; + case CPUFREQ_GOV_LIMITS: + ret =3D 0; + break; + default: + ret =3D -EINVAL; + } + + return ret; +} + +static struct cpufreq_governor hwp_cpufreq_governor =3D +{ + .name =3D "hwp-internal", + .governor =3D hwp_governor, +}; + +static int __init cpufreq_gov_hwp_init(void) +{ + return cpufreq_register_governor(&hwp_cpufreq_governor); +} +__initcall(cpufreq_gov_hwp_init); + +bool hwp_available(void) +{ + uint32_t eax; + uint64_t val; + bool use_hwp; + + if ( boot_cpu_data.cpuid_level < CPUID_PM_LEAF ) + { + hwp_verbose("cpuid_level (%u) lacks HWP support\n", boot_cpu_data.= cpuid_level); + + return false; + } + + eax =3D cpuid_eax(CPUID_PM_LEAF); + feature_hwp =3D !!(eax & CPUID6_EAX_HWP); + feature_hwp_notification =3D !!(eax & CPUID6_EAX_HWP_Notification); + feature_hwp_activity_window =3D !!(eax & CPUID6_EAX_HWP_Activity_Windo= w); + feature_hwp_energy_perf =3D + !!(eax & CPUID6_EAX_HWP_Energy_Performance_Preference); + feature_hwp_pkg_level_ctl =3D + !!(eax & CPUID6_EAX_HWP_Package_Level_Request); + feature_hwp_peci =3D !!(eax & CPUID6_EAX_HWP_PECI); + + hwp_verbose("HWP: %d notify: %d act_window: %d energy_perf: %d pkg_lev= el: %d peci: %d\n", + feature_hwp, feature_hwp_notification, + feature_hwp_activity_window, feature_hwp_energy_perf, + feature_hwp_pkg_level_ctl, feature_hwp_peci); + + if ( !feature_hwp ) + { + hwp_verbose("Hardware does not support HWP\n"); + + return false; + } + + if ( boot_cpu_data.cpuid_level < 0x16 ) + { + hwp_info("HWP disabled: cpuid_level %x < 0x16 lacks CPU freq info\= n", + boot_cpu_data.cpuid_level); + + return false; + } + + hwp_verbose("HWP: FAST_IA32_HWP_REQUEST %ssupported\n", + eax & CPUID6_EAX_FAST_HWP_MSR ? "" : "not "); + if ( eax & CPUID6_EAX_FAST_HWP_MSR ) + { + if ( rdmsr_safe(MSR_FAST_UNCORE_MSRS_CAPABILITY, val) ) + hwp_err("error rdmsr_safe(MSR_FAST_UNCORE_MSRS_CAPABILITY)\n"); + + hwp_verbose("HWP: MSR_FAST_UNCORE_MSRS_CAPABILITY: %016lx\n", val); + if (val & FAST_IA32_HWP_REQUEST ) + { + hwp_verbose("HWP: FAST_IA32_HWP_REQUEST MSR available\n"); + feature_fast_msr =3D true; + } + } + + feature_hdc =3D !!(eax & CPUID6_EAX_HDC); + + hwp_verbose("HWP: Hardware Duty Cycling (HDC) %ssupported\n", + feature_hdc ? "" : "not "); + + hwp_verbose("HWP: HW_FEEDBACK %ssupported\n", + (eax & CPUID6_EAX_HW_FEEDBACK) ? "" : "not "); + + use_hwp =3D feature_hwp && opt_hwp; + cpufreq_governor_internal =3D use_hwp; + + if ( use_hwp ) + hwp_info("Using HWP for cpufreq\n"); + + return use_hwp; +} + +static void hdc_set_pkg_hdc_ctl(bool val) +{ + uint64_t msr; + + if ( rdmsr_safe(MSR_IA32_PKG_HDC_CTL, msr) ) + { + hwp_err("error rdmsr_safe(MSR_IA32_PKG_HDC_CTL)\n"); + + return; + } + + msr =3D val ? IA32_PKG_HDC_CTL_HDC_PKG_Enable : 0; + + if ( wrmsr_safe(MSR_IA32_PKG_HDC_CTL, msr) ) + hwp_err("error wrmsr_safe(MSR_IA32_PKG_HDC_CTL): %016lx\n", msr); +} + +static void hdc_set_pm_ctl1(bool val) +{ + uint64_t msr; + + if ( rdmsr_safe(MSR_IA32_PM_CTL1, msr) ) + { + hwp_err("error rdmsr_safe(MSR_IA32_PM_CTL1)\n"); + + return; + } + + msr =3D val ? IA32_PM_CTL1_HDC_Allow_Block : 0; + + if ( wrmsr_safe(MSR_IA32_PM_CTL1, msr) ) + hwp_err("error wrmsr_safe(MSR_IA32_PM_CTL1): %016lx\n", msr); +} + +static void hwp_fast_uncore_msrs_ctl(bool val) +{ + uint64_t msr; + + if ( rdmsr_safe(MSR_FAST_UNCORE_MSRS_CTL, msr) ) + hwp_err("error rdmsr_safe(MSR_FAST_UNCORE_MSRS_CTL)\n"); + + msr =3D val; + + if ( wrmsr_safe(MSR_FAST_UNCORE_MSRS_CTL, msr) ) + hwp_err("error wrmsr_safe(MSR_FAST_UNCORE_MSRS_CTL): %016lx\n", ms= r); +} + +static void hwp_get_cpu_speeds(struct cpufreq_policy *policy) +{ + uint32_t base_khz, max_khz, bus_khz, edx; + + cpuid(0x16, &base_khz, &max_khz, &bus_khz, &edx); + + /* aperf/mperf scales base. */ + policy->cpuinfo.perf_freq =3D base_khz * 1000; + policy->cpuinfo.min_freq =3D base_khz * 1000; + policy->cpuinfo.max_freq =3D max_khz * 1000; + policy->min =3D base_khz * 1000; + policy->max =3D max_khz * 1000; + policy->cur =3D 0; +} + +static void hwp_read_capabilities(void *info) +{ + struct cpufreq_policy *policy =3D info; + struct hwp_drv_data *data =3D hwp_drv_data[policy->cpu]; + + if ( rdmsr_safe(MSR_IA32_HWP_CAPABILITIES, data->hwp_caps) ) + { + hwp_err("CPU%u: error rdmsr_safe(MSR_IA32_HWP_CAPABILITIES)\n", + policy->cpu); + + return; + } + + if ( rdmsr_safe(MSR_IA32_HWP_REQUEST, data->curr_req.raw) ) + { + hwp_err("CPU%u: error rdmsr_safe(MSR_IA32_HWP_REQUEST)\n", policy-= >cpu); + + return; + } +} + +static void hwp_init_msrs(void *info) +{ + struct cpufreq_policy *policy =3D info; + uint64_t val; + + /* Package level MSR, but we don't have a good idea of packages here, = so + * just do it everytime. */ + if ( rdmsr_safe(MSR_IA32_PM_ENABLE, val) ) + { + hwp_err("CPU%u: error rdmsr_safe(MSR_IA32_PM_ENABLE)\n", policy->c= pu); + + return; + } + + hwp_verbose("CPU%u: MSR_IA32_PM_ENABLE: %016lx\n", policy->cpu, val); + if ( val !=3D IA32_PM_ENABLE_HWP_ENABLE ) + { + val =3D IA32_PM_ENABLE_HWP_ENABLE; + if ( wrmsr_safe(MSR_IA32_PM_ENABLE, val) ) + hwp_err("CPU%u: error wrmsr_safe(MSR_IA32_PM_ENABLE, %lx)\n", + policy->cpu, val); + } + + hwp_read_capabilities(info); + + /* Check for APERF/MPERF support in hardware + * also check for boost/turbo support */ + intel_feature_detect(policy); + + if ( feature_hdc ) + { + hdc_set_pkg_hdc_ctl(true); + hdc_set_pm_ctl1(true); + } + + if ( feature_fast_msr ) + hwp_fast_uncore_msrs_ctl(true); + + hwp_get_cpu_speeds(policy); +} + +static int hwp_cpufreq_verify(struct cpufreq_policy *policy) +{ + unsigned int cpu =3D policy->cpu; + struct hwp_drv_data *data =3D hwp_drv_data[cpu]; + + if ( !feature_hwp_energy_perf && data->energy_perf ) + { + if ( data->energy_perf > 15 ) + { + hwp_err("energy_perf %d exceeds IA32_ENERGY_PERF_BIAS range 0-= 15\n", + data->energy_perf); + + return -EINVAL; + } + } + + if ( !feature_hwp_activity_window && data->activity_window ) + { + hwp_err("HWP activity window not supported.\n"); + + return -EINVAL; + } + + return 0; +} + +/* val 0 - highest performance, 15 - maximum energy savings */ +static void hwp_energy_perf_bias(void *info) +{ + uint64_t msr; + struct hwp_drv_data *data =3D info; + uint8_t val =3D data->energy_perf; + + ASSERT(val <=3D 15); + + if ( rdmsr_safe(MSR_IA32_ENERGY_PERF_BIAS, msr) ) + { + hwp_err("error rdmsr_safe(MSR_IA32_ENERGY_PERF_BIAS)\n"); + + return; + } + + msr &=3D ~(0xf); + msr |=3D val; + + if ( wrmsr_safe(MSR_IA32_ENERGY_PERF_BIAS, msr) ) + hwp_err("error wrmsr_safe(MSR_IA32_ENERGY_PERF_BIAS): %016lx\n", m= sr); +} + +static void hwp_write_request(void *info) +{ + struct cpufreq_policy *policy =3D info; + struct hwp_drv_data *data =3D hwp_drv_data[policy->cpu]; + union hwp_request hwp_req =3D data->curr_req; + + BUILD_BUG_ON(sizeof(union hwp_request) !=3D sizeof(uint64_t)); + if ( wrmsr_safe(MSR_IA32_HWP_REQUEST, hwp_req.raw) ) + { + hwp_err("CPU%u: error wrmsr_safe(MSR_IA32_HWP_REQUEST, %lx)\n", + policy->cpu, hwp_req.raw); + rdmsr_safe(MSR_IA32_HWP_REQUEST, data->curr_req.raw); + } +} + +static int hwp_cpufreq_target(struct cpufreq_policy *policy, + unsigned int target_freq, unsigned int relat= ion) +{ + unsigned int cpu =3D policy->cpu; + struct hwp_drv_data *data =3D hwp_drv_data[cpu]; + union hwp_request hwp_req; + + /* Zero everything to ensure reserved bits are zero... */ + hwp_req.raw =3D 0; + /* .. and update from there */ + hwp_req.min_perf =3D data->minimum; + hwp_req.max_perf =3D data->maximum; + hwp_req.desired =3D data->desired; + if ( feature_hwp_energy_perf ) + hwp_req.energy_perf =3D data->energy_perf; + if ( feature_hwp_activity_window ) + hwp_req.activity_window =3D data->activity_window; + + if ( hwp_req.raw =3D=3D data->curr_req.raw ) + return 0; + + data->curr_req.raw =3D hwp_req.raw; + + hwp_verbose("CPU%u: wrmsr HWP_REQUEST %016lx\n", cpu, hwp_req.raw); + on_selected_cpus(cpumask_of(cpu), hwp_write_request, policy, 1); + + if ( !feature_hwp_energy_perf && data->energy_perf ) + { + on_selected_cpus(cpumask_of(cpu), hwp_energy_perf_bias, + data, 1); + } + + return 0; +} + +static int hwp_cpufreq_cpu_init(struct cpufreq_policy *policy) +{ + unsigned int cpu =3D policy->cpu; + struct hwp_drv_data *data; + + if ( cpufreq_opt_governor ) + { + printk(XENLOG_WARNING + "HWP: governor \"%s\" is incompatible with hwp. Using defau= lt \"%s\"\n", + cpufreq_opt_governor->name, hwp_cpufreq_governor.name); + } + policy->governor =3D &hwp_cpufreq_governor; + + data =3D xzalloc(typeof(*data)); + if ( !data ) + return -ENOMEM; + + hwp_drv_data[cpu] =3D data; + + on_selected_cpus(cpumask_of(cpu), hwp_init_msrs, policy, 1); + + data->minimum =3D data->hw_lowest; + data->maximum =3D data->hw_highest; + data->desired =3D 0; /* default to HW autonomous */ + if ( feature_hwp_energy_perf ) + data->energy_perf =3D 0x80; + else + data->energy_perf =3D 7; + + hwp_verbose("CPU%u: IA32_HWP_CAPABILITIES: %016lx\n", cpu, data->hwp_c= aps); + + hwp_verbose("CPU%u: rdmsr HWP_REQUEST %016lx\n", cpu, data->curr_req.r= aw); + + return 0; +} + +static int hwp_cpufreq_cpu_exit(struct cpufreq_policy *policy) +{ + unsigned int cpu =3D policy->cpu; + + xfree(hwp_drv_data[cpu]); + hwp_drv_data[cpu] =3D NULL; + + return 0; +} + +/* The SDM reads like turbo should be disabled with MSR_IA32_PERF_CTL and + * PERF_CTL_TURBO_DISENGAGE, but that does not seem to actually work, at l= east + * with my HWP testing. MSR_IA32_MISC_ENABLE and MISC_ENABLE_TURBO_DISENG= AGE + * is what Linux uses and seems to work. */ +static void hwp_set_misc_turbo(void *info) +{ + struct cpufreq_policy *policy =3D info; + uint64_t msr; + + if ( rdmsr_safe(MSR_IA32_MISC_ENABLE, msr) ) + { + hwp_err("CPU%u: error rdmsr_safe(MSR_IA32_MISC_ENABLE)\n", policy-= >cpu); + + return; + } + + if ( policy->turbo =3D=3D CPUFREQ_TURBO_ENABLED ) + msr &=3D ~MSR_IA32_MISC_ENABLE_TURBO_DISENGAGE; + else + msr |=3D MSR_IA32_MISC_ENABLE_TURBO_DISENGAGE; + + if ( wrmsr_safe(MSR_IA32_MISC_ENABLE, msr) ) + hwp_err("CPU%u: error wrmsr_safe(MSR_IA32_MISC_ENABLE): %016lx\n", + policy->cpu, msr); +} + +static int hwp_cpufreq_update(int cpuid, struct cpufreq_policy *policy) +{ + on_selected_cpus(cpumask_of(cpuid), hwp_set_misc_turbo, policy, 1); + + return 0; +} + +static const struct cpufreq_driver __initconstrel hwp_cpufreq_driver =3D +{ + .name =3D "hwp-cpufreq", + .verify =3D hwp_cpufreq_verify, + .target =3D hwp_cpufreq_target, + .init =3D hwp_cpufreq_cpu_init, + .exit =3D hwp_cpufreq_cpu_exit, + .update =3D hwp_cpufreq_update, +}; + +int hwp_register_driver(void) +{ + int ret; + + ret =3D cpufreq_register_driver(&hwp_cpufreq_driver); + + return ret; +} diff --git a/xen/include/acpi/cpufreq/processor_perf.h b/xen/include/acpi/c= pufreq/processor_perf.h index e2c08f0e6d..2e67e667e0 100644 --- a/xen/include/acpi/cpufreq/processor_perf.h +++ b/xen/include/acpi/cpufreq/processor_perf.h @@ -9,6 +9,9 @@ =20 void intel_feature_detect(void *info); =20 +bool hwp_available(void); +int hwp_register_driver(void); + int powernow_cpufreq_init(void); unsigned int powernow_register_driver(void); unsigned int get_measured_perf(unsigned int cpu, unsigned int flag); diff --git a/xen/include/asm-x86/cpufeature.h b/xen/include/asm-x86/cpufeat= ure.h index 33b2257888..1900c90f90 100644 --- a/xen/include/asm-x86/cpufeature.h +++ b/xen/include/asm-x86/cpufeature.h @@ -26,7 +26,16 @@ #define CPUID5_ECX_EXTENSIONS_SUPPORTED 0x1 #define CPUID5_ECX_INTERRUPT_BREAK 0x2 =20 -#define CPUID_PM_LEAF 6 +#define CPUID_PM_LEAF 6 +#define CPUID6_EAX_HWP (_AC(1, U) << 7) +#define CPUID6_EAX_HWP_Notification (_AC(1, U) << 8) +#define CPUID6_EAX_HWP_Activity_Window (_AC(1, U) << 9) +#define CPUID6_EAX_HWP_Energy_Performance_Preference (_AC(1, U) << 10) +#define CPUID6_EAX_HWP_Package_Level_Request (_AC(1, U) << 11) +#define CPUID6_EAX_HDC (_AC(1, U) << 13) +#define CPUID6_EAX_HWP_PECI (_AC(1, U) << 16) +#define CPUID6_EAX_FAST_HWP_MSR (_AC(1, U) << 18) +#define CPUID6_EAX_HW_FEEDBACK (_AC(1, U) << 19) #define CPUID6_ECX_APERFMPERF_CAPABILITY 0x1 =20 /* CPUID level 0x00000001.edx */ diff --git a/xen/include/asm-x86/msr-index.h b/xen/include/asm-x86/msr-inde= x.h index bd3a3a1e7f..b8f712e1a3 100644 --- a/xen/include/asm-x86/msr-index.h +++ b/xen/include/asm-x86/msr-index.h @@ -101,6 +101,12 @@ #define MSR_RTIT_ADDR_A(n) (0x00000580 + (n) * 2) #define MSR_RTIT_ADDR_B(n) (0x00000581 + (n) * 2) =20 +#define MSR_FAST_UNCORE_MSRS_CTL 0x00000657 +#define FAST_IA32_HWP_REQUEST_MSR_ENABLE (_AC(1, ULL) << 0) + +#define MSR_FAST_UNCORE_MSRS_CAPABILITY 0x0000065f +#define FAST_IA32_HWP_REQUEST (_AC(1, ULL) << 0) + #define MSR_U_CET 0x000006a0 #define MSR_S_CET 0x000006a2 #define CET_SHSTK_EN (_AC(1, ULL) << 0) @@ -112,10 +118,20 @@ #define MSR_PL3_SSP 0x000006a7 #define MSR_INTERRUPT_SSP_TABLE 0x000006a8 =20 +#define MSR_IA32_PM_ENABLE 0x00000770 +#define IA32_PM_ENABLE_HWP_ENABLE (_AC(1, ULL) << 0) +#define MSR_IA32_HWP_CAPABILITIES 0x00000771 +#define MSR_IA32_HWP_REQUEST 0x00000774 + #define MSR_PASID 0x00000d93 #define PASID_PASID_MASK 0x000fffff #define PASID_VALID (_AC(1, ULL) << 31) =20 +#define MSR_IA32_PKG_HDC_CTL 0x00000db0 +#define IA32_PKG_HDC_CTL_HDC_PKG_Enable (_AC(1, ULL) << 0) +#define MSR_IA32_PM_CTL1 0x00000db1 +#define IA32_PM_CTL1_HDC_Allow_Block (_AC(1, ULL) << 0) + #define MSR_K8_VM_CR 0xc0010114 #define VM_CR_INIT_REDIRECTION (_AC(1, ULL) << 1) #define VM_CR_SVM_DISABLE (_AC(1, ULL) << 4) @@ -460,6 +476,7 @@ #define MSR_IA32_MISC_ENABLE_LIMIT_CPUID (1<<22) #define MSR_IA32_MISC_ENABLE_XTPR_DISABLE (1<<23) #define MSR_IA32_MISC_ENABLE_XD_DISABLE (1ULL << 34) +#define MSR_IA32_MISC_ENABLE_TURBO_DISENGAGE (1ULL << 38) =20 #define MSR_IA32_TSC_DEADLINE 0x000006E0 #define MSR_IA32_ENERGY_PERF_BIAS 0x000001b0 --=20 2.30.2 From nobody Fri Apr 26 18:23:13 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=1620070140; cv=none; d=zohomail.com; s=zohoarc; b=fNi934h8cgbaZzpcwKkvIwSWDfKSDTv3h5eKzEt+TwwPa0wj20ANqGnEXZ/PCJ2s63b0j7SB5ivg3MvuCFXqmYmSJ5YBXCI3DAyO9XPQWEb+4aBhKTeqMZWvWa5+yFHQyZd+XzI5gM9aP5dydAWJWWpgjgG7kCLMdfqAIWm4low= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1620070140; 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=A+tWllvHyW52JnCKAHpzVsmBO/u0B8vwweaHzsv0x+g=; b=LkRmXSev2v7Vf2NGI/B78Usr47CvYuQ7B90CvmMgehz6aGCi7vaiW3yfeY25rIggIDFzeCbdOkRySMppR8PpaAfZu/3DNCecl3UNjgm//KVGLv6/17KSxAAI5epNRuG9MJdZ4/Y7LEXL8Jyv9yce6p3sGB13Y4oNu2AHMYkgE5U= 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 1620070140678321.79981214592567; Mon, 3 May 2021 12:29:00 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.121811.229778 (Exim 4.92) (envelope-from ) id 1ldeFM-000642-Jn; Mon, 03 May 2021 19:28:48 +0000 Received: by outflank-mailman (output) from mailman id 121811.229778; Mon, 03 May 2021 19:28:48 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ldeFM-00063s-GB; Mon, 03 May 2021 19:28:48 +0000 Received: by outflank-mailman (input) for mailman id 121811; Mon, 03 May 2021 19:28:47 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ldeFL-0005i5-J7 for xen-devel@lists.xenproject.org; Mon, 03 May 2021 19:28:47 +0000 Received: from mail-qk1-x730.google.com (unknown [2607:f8b0:4864:20::730]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 03167565-5537-404f-b71c-fa23f9918af9; Mon, 03 May 2021 19:28:39 +0000 (UTC) Received: by mail-qk1-x730.google.com with SMTP id 197so5973125qkl.12 for ; Mon, 03 May 2021 12:28:39 -0700 (PDT) Received: from pm2-ws13.praxislan02.com ([2001:470:8:67e:8710:5560:a711:776f]) by smtp.gmail.com with ESMTPSA id g18sm9225209qke.21.2021.05.03.12.28.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 May 2021 12:28:38 -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: 03167565-5537-404f-b71c-fa23f9918af9 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=A+tWllvHyW52JnCKAHpzVsmBO/u0B8vwweaHzsv0x+g=; b=c3ma4whvihZMr+XtT6Dsf4OvPW1Pd0zYSsA7yv0QPFWlH7p7BuQcQ2rtZziOWKLerT QaUC1k0ZsuNbbBHRsmyI5i/82bSOdyDg6ZGDgvxlKgAnxYIXJC5fc+rV5VwY+XKqpHpy LS9UTUig3LOABNY1ZWkONeNr2OJpkj9XjTdNSyxIpQgodbKxHkOiiZA6/8Nz707q5vrJ 2GUOI9OCX0BZKNIWpMIFQBXDrEP/9aEklkD7xjIbYY7zBYn8SJjqzqIHRDTxCzvzGRH8 d8Mu8fAfzzswLtYjMDAWdPgJaToPoK1kMIr4oolqmMT9WGyRJ+an+624OzwBCrWZRTLP 31TQ== 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=A+tWllvHyW52JnCKAHpzVsmBO/u0B8vwweaHzsv0x+g=; b=typfibQoJ2RX0HlYtl40cgBCp+73WBABo+9PNGLjXENR5/UsQFMwOuNx2suvTedgzc Z18x8vg4ECx9NJbAUIp4i4syooELzoQHXDn6FnddMFWGdnaDV6yBb6IFb+ljws8X8qhA N4lQbQ2ZR4g7HT4Egj4ShY7pbxkXYHac7bO9ckv7omN5tlpIYVb/zGY/d+0g3FQvRhQ1 2EDNEtcP8o2/K4oYoh6C4zK7aWhObyFi74PL82zXHPXAmltM/b6Ftc0yvk8RQn22vJ1o pm6n2CZIOgXrVlgjW3LbjTfIkldjibQWg4Z3nStqZ7VcacBC6DYBboYu6aMPqzozx05K ZIXA== X-Gm-Message-State: AOAM5308ZAV39HkCTvYgKrNiCKG2tsJ9JREvcnS2Ghf3pRF0nk1/QDn6 No7f+hBGnayhbVWnVYdMuHEEHJUICWs= X-Google-Smtp-Source: ABdhPJxhn3QpGVO522p42qDm0dV7XUUdhgdWu+j8lIrefXpjNxHG18JFiuo2CLCG8JYNeqhK+e05BA== X-Received: by 2002:ae9:dc47:: with SMTP id q68mr21053462qkf.197.1620070119123; Mon, 03 May 2021 12:28:39 -0700 (PDT) From: Jason Andryuk To: xen-devel@lists.xenproject.org Cc: Jason Andryuk , Ian Jackson , Wei Liu Subject: [PATCH 05/13] xenpm: Change get-cpufreq-para output for internal Date: Mon, 3 May 2021 15:28:02 -0400 Message-Id: <20210503192810.36084-6-jandryuk@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210503192810.36084-1-jandryuk@gmail.com> References: <20210503192810.36084-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" When using HWP, some of the returned data is not applicable. In that case, we should just omit it to avoid confusing the user. So switch to printing the base and turbo frequencies since those are relevant to HWP. Similarly, stop printing the CPU frequencies since those do not apply. Signed-off-by: Jason Andryuk --- tools/misc/xenpm.c | 45 +++++++++++++++++++++++++++++---------------- 1 file changed, 29 insertions(+), 16 deletions(-) diff --git a/tools/misc/xenpm.c b/tools/misc/xenpm.c index d0191d4984..562bf939f9 100644 --- a/tools/misc/xenpm.c +++ b/tools/misc/xenpm.c @@ -711,6 +711,7 @@ void start_gather_func(int argc, char *argv[]) /* print out parameters about cpu frequency */ static void print_cpufreq_para(int cpuid, struct xc_get_cpufreq_para *p_cp= ufreq) { + bool internal =3D strstr(p_cpufreq->scaling_governor, "internal"); int i; =20 printf("cpu id : %d\n", cpuid); @@ -720,10 +721,19 @@ static void print_cpufreq_para(int cpuid, struct xc_g= et_cpufreq_para *p_cpufreq) printf(" %d", p_cpufreq->affected_cpus[i]); printf("\n"); =20 - printf("cpuinfo frequency : max [%u] min [%u] cur [%u]\n", - p_cpufreq->cpuinfo_max_freq, - p_cpufreq->cpuinfo_min_freq, - p_cpufreq->cpuinfo_cur_freq); + if ( internal ) + { + printf("cpuinfo frequency : base [%u] turbo [%u]\n", + p_cpufreq->cpuinfo_min_freq, + p_cpufreq->cpuinfo_max_freq); + } + else + { + printf("cpuinfo frequency : max [%u] min [%u] cur [%u]\n", + p_cpufreq->cpuinfo_max_freq, + p_cpufreq->cpuinfo_min_freq, + p_cpufreq->cpuinfo_cur_freq); + } =20 printf("scaling_driver : %s\n", p_cpufreq->scaling_driver); =20 @@ -750,19 +760,22 @@ static void print_cpufreq_para(int cpuid, struct xc_g= et_cpufreq_para *p_cpufreq) p_cpufreq->u.ondemand.up_threshold); } =20 - printf("scaling_avail_freq :"); - for ( i =3D 0; i < p_cpufreq->freq_num; i++ ) - if ( p_cpufreq->scaling_available_frequencies[i] =3D=3D - p_cpufreq->scaling_cur_freq ) - printf(" *%d", p_cpufreq->scaling_available_frequencies[i]); - else - printf(" %d", p_cpufreq->scaling_available_frequencies[i]); - printf("\n"); + if ( !internal ) + { + printf("scaling_avail_freq :"); + for ( i =3D 0; i < p_cpufreq->freq_num; i++ ) + if ( p_cpufreq->scaling_available_frequencies[i] =3D=3D + p_cpufreq->scaling_cur_freq ) + printf(" *%d", p_cpufreq->scaling_available_frequencies[i]= ); + else + printf(" %d", p_cpufreq->scaling_available_frequencies[i]); + printf("\n"); =20 - printf("scaling frequency : max [%u] min [%u] cur [%u]\n", - p_cpufreq->scaling_max_freq, - p_cpufreq->scaling_min_freq, - p_cpufreq->scaling_cur_freq); + printf("scaling frequency : max [%u] min [%u] cur [%u]\n", + p_cpufreq->scaling_max_freq, + p_cpufreq->scaling_min_freq, + p_cpufreq->scaling_cur_freq); + } =20 printf("turbo mode : %s\n", p_cpufreq->turbo_enabled ? "enabled" : "disabled or n/a"); --=20 2.30.2 From nobody Fri Apr 26 18:23:13 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=1620070145; cv=none; d=zohomail.com; s=zohoarc; b=I/Iv98AM8e1Ap/0G86wE8cVbE9GqCeDMVnCnY/DcicgpfxkzfeXVUIaugFBpQrWdV1aw1rpSoF2evCVbZJO8wNa1Bkb4tF3hAsTBADgKtMeF8cXkYqRkYcY8RCa4LSV1y2glP6k/XcrMYPnU725QkE/Lye8K+Q1XC/FZ4pXTces= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1620070145; 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=zxg8tmL3kR+kA95W5jp8RRRSYuidUeimNwqoUj/JiLc=; b=Z949H9XtbesvYPg9D86I/YiBvZy/obcoQBpEPtVXpwyBP2+1C7cfNMiOrHKPdLPYjVOyxo50qwdrOmejNVPJnttCzyb4M2GhE8+15z5pCsAEq73MzlsW/PjsQ/ND9ye0pwcA0My3mtHCIh+dXozth1Wm4Wwp+V2IuTas1Sa5zNU= 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 1620070145405404.0233553052268; Mon, 3 May 2021 12:29:05 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.121816.229790 (Exim 4.92) (envelope-from ) id 1ldeFR-0006A6-VU; Mon, 03 May 2021 19:28:53 +0000 Received: by outflank-mailman (output) from mailman id 121816.229790; Mon, 03 May 2021 19:28:53 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ldeFR-00069v-Rk; Mon, 03 May 2021 19:28:53 +0000 Received: by outflank-mailman (input) for mailman id 121816; Mon, 03 May 2021 19:28:52 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ldeFQ-0005i5-JK for xen-devel@lists.xenproject.org; Mon, 03 May 2021 19:28:52 +0000 Received: from mail-qv1-xf2f.google.com (unknown [2607:f8b0:4864:20::f2f]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 2a172d8b-12a9-47aa-99e3-a987c7197e98; Mon, 03 May 2021 19:28:42 +0000 (UTC) Received: by mail-qv1-xf2f.google.com with SMTP id h3so3191784qve.13 for ; Mon, 03 May 2021 12:28:42 -0700 (PDT) Received: from pm2-ws13.praxislan02.com ([2001:470:8:67e:8710:5560:a711:776f]) by smtp.gmail.com with ESMTPSA id g18sm9225209qke.21.2021.05.03.12.28.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 May 2021 12:28:41 -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: 2a172d8b-12a9-47aa-99e3-a987c7197e98 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=zxg8tmL3kR+kA95W5jp8RRRSYuidUeimNwqoUj/JiLc=; b=OTQJH6lAkxr/0mZotzGTfOrTZs9LaA1POMdgMjB7jyiSkmDZfcpbpZAEM0BcfddfLD Dw6RBH69CKalNwQBzEgpkD71Txqi6A51Dx8lo54SoFaM6dVnQah6+uKJJQF3bkX36mJF UPJqgrsccGunCV8P/J4xMrAkooV05O78kBAsUZDzMfcwN6bnKfmswcZok1VHbZBcfpxX tCafV/2XFQHgL1rQuBO/cClJvPtL5qc4NBZ4HIxWotg9JeNM7Dwd2kmUH8pm9VnjdqV7 K1F0ulBKbmdXP8hDvfMXRBvFGAyKc2XPH3MKW2ORXqhpQxFJkWYzcHKr1ZTWeCtTOoVY iE4Q== 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=zxg8tmL3kR+kA95W5jp8RRRSYuidUeimNwqoUj/JiLc=; b=Pc2JJA0jzOBUbMqFu2VYa/+anPOqUCgWeBYTdxT61XnJvv+WEJNq6ycynm9f7sEGFT rwZSv9liNsz8wtnyWQmc71vwK3kB0iE6Hlg2e2r2o/rDjYQFETlZjF5dDqOAxiy02Dzy +BBAmvXTwIo3Wv5FtheQDSMkfd5VqWEiucINwEqfMJgOMI8m1DauMSdr4YyS42wWdKin gW+lowsgNXG6F3IlMsBKs5T8poki2Qw5iiIVKiXWSswVeM/AK+3u+KS4IXgM3B8TDXl+ b8ooROwPU3dQfDCHkoD5jgI1DH9xpNj6KtQ0o5Q+8YMsjCs337D4nx3sCqBHe11hjFsy 0Tww== X-Gm-Message-State: AOAM532cCMpBJVfkg4J/qD1JU7JEv5yyBSN8L5TuSZbfpPF5iJpvjWzJ yQg0VqIeWyKxiJ76ICYJOmyZSc9Bzrk= X-Google-Smtp-Source: ABdhPJzIZGwlNdJ88kvoudaoCZRg4pJghjAdxq+KJiFs4RJwCeJsWtKiGg7so4U+USFNQt5LqdFI0g== X-Received: by 2002:a05:6214:2b0:: with SMTP id m16mr21927389qvv.4.1620070122177; Mon, 03 May 2021 12:28:42 -0700 (PDT) From: Jason Andryuk To: xen-devel@lists.xenproject.org Cc: Jason Andryuk , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Wei Liu , George Dunlap , Ian Jackson , Julien Grall , Stefano Stabellini Subject: [PATCH 06/13] cpufreq: Export HWP parameters to userspace Date: Mon, 3 May 2021 15:28:03 -0400 Message-Id: <20210503192810.36084-7-jandryuk@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210503192810.36084-1-jandryuk@gmail.com> References: <20210503192810.36084-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" Extend xen_get_cpufreq_para to return hwp parameters. These match the hardware rather closely. We need the hw_features bitmask to indicated fields supported by the actual hardware. The use of uint8_t parameters matches the hardware size. uint32_t entries grows the sysctl_t past the build assertion in setup.c. The uint8_t ranges are supported across multiple generations, so hopefully they won't change. Increment XEN_SYSCTL_INTERFACE_VERSION for the new fields. Signed-off-by: Jason Andryuk --- xen/arch/x86/acpi/cpufreq/hwp.c | 24 ++++++++++++++++++++++++ xen/drivers/acpi/pmstat.c | 6 ++++++ xen/include/acpi/cpufreq/cpufreq.h | 3 +++ xen/include/public/sysctl.h | 20 +++++++++++++++++++- 4 files changed, 52 insertions(+), 1 deletion(-) diff --git a/xen/arch/x86/acpi/cpufreq/hwp.c b/xen/arch/x86/acpi/cpufreq/hw= p.c index f8e6fdbd41..92222d6d85 100644 --- a/xen/arch/x86/acpi/cpufreq/hwp.c +++ b/xen/arch/x86/acpi/cpufreq/hwp.c @@ -523,6 +523,30 @@ static const struct cpufreq_driver __initconstrel hwp_= cpufreq_driver =3D .update =3D hwp_cpufreq_update, }; =20 +int get_hwp_para(struct cpufreq_policy *policy, struct xen_hwp_para *hwp_p= ara) +{ + unsigned int cpu =3D policy->cpu; + struct hwp_drv_data *data =3D hwp_drv_data[cpu]; + + if ( data =3D=3D NULL ) + return -EINVAL; + + hwp_para->hw_feature =3D + feature_hwp_activity_window ? XEN_SYSCTL_HWP_FEAT_ACT_WINDOW : 0 | + feature_hwp_energy_perf ? XEN_SYSCTL_HWP_FEAT_ENERGY_PERF : 0; + hwp_para->hw_lowest =3D data->hw_lowest; + hwp_para->hw_most_efficient =3D data->hw_most_efficient; + hwp_para->hw_guaranteed =3D data->hw_guaranteed; + hwp_para->hw_highest =3D data->hw_highest; + hwp_para->minimum =3D data->minimum; + hwp_para->maximum =3D data->maximum; + hwp_para->energy_perf =3D data->energy_perf; + hwp_para->activity_window =3D data->activity_window; + hwp_para->desired =3D data->desired; + + return 0; +} + int hwp_register_driver(void) { int ret; diff --git a/xen/drivers/acpi/pmstat.c b/xen/drivers/acpi/pmstat.c index 1bae635101..3e35c42949 100644 --- a/xen/drivers/acpi/pmstat.c +++ b/xen/drivers/acpi/pmstat.c @@ -290,6 +290,12 @@ static int get_cpufreq_para(struct xen_sysctl_pm_op *o= p) &op->u.get_para.u.ondemand.sampling_rate, &op->u.get_para.u.ondemand.up_threshold); } + + if ( !strncasecmp(op->u.get_para.scaling_governor, + "hwp-internal", CPUFREQ_NAME_LEN) ) + { + ret =3D get_hwp_para(policy, &op->u.get_para.u.hwp_para); + } op->u.get_para.turbo_enabled =3D cpufreq_get_turbo_status(op->cpuid); =20 return ret; diff --git a/xen/include/acpi/cpufreq/cpufreq.h b/xen/include/acpi/cpufreq/= cpufreq.h index b91859ce5d..42146ca2cf 100644 --- a/xen/include/acpi/cpufreq/cpufreq.h +++ b/xen/include/acpi/cpufreq/cpufreq.h @@ -246,4 +246,7 @@ int write_userspace_scaling_setspeed(unsigned int cpu, = unsigned int freq); void cpufreq_dbs_timer_suspend(void); void cpufreq_dbs_timer_resume(void); =20 +/********************** hwp hypercall helper *************************/ +int get_hwp_para(struct cpufreq_policy *policy, struct xen_hwp_para *hwp_p= ara); + #endif /* __XEN_CPUFREQ_PM_H__ */ diff --git a/xen/include/public/sysctl.h b/xen/include/public/sysctl.h index 039ccf885c..1a6c6397ea 100644 --- a/xen/include/public/sysctl.h +++ b/xen/include/public/sysctl.h @@ -35,7 +35,7 @@ #include "domctl.h" #include "physdev.h" =20 -#define XEN_SYSCTL_INTERFACE_VERSION 0x00000013 +#define XEN_SYSCTL_INTERFACE_VERSION 0x00000014 =20 /* * Read console content from Xen buffer ring. @@ -301,6 +301,23 @@ struct xen_ondemand { uint32_t up_threshold; }; =20 +struct xen_hwp_para { + uint16_t activity_window; /* 7bit mantissa and 3bit exponent */ +#define XEN_SYSCTL_HWP_FEAT_ENERGY_PERF (1 << 0) /* energy_perf range 0-25= 5 if + 1. Otherwise 0-15 */ +#define XEN_SYSCTL_HWP_FEAT_ACT_WINDOW (1 << 1) /* activity_window suppor= ted + if 1 */ + uint8_t hw_feature; /* bit flags for features */ + uint8_t hw_lowest; + uint8_t hw_most_efficient; + uint8_t hw_guaranteed; + uint8_t hw_highest; + uint8_t minimum; + uint8_t maximum; + uint8_t desired; + uint8_t energy_perf; +}; + /* * cpufreq para name of this structure named * same as sysfs file name of native linux @@ -332,6 +349,7 @@ struct xen_get_cpufreq_para { union { struct xen_userspace userspace; struct xen_ondemand ondemand; + struct xen_hwp_para hwp_para; } u; =20 int32_t turbo_enabled; --=20 2.30.2 From nobody Fri Apr 26 18:23:13 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=1620070155; cv=none; d=zohomail.com; s=zohoarc; b=eDvhgVE8fKA1S0vK6zia4K8sEEfitEZkGzVF9xBdbMvNb6szS+SdbVt5GLw4OJzHBWR4K0xgENvcbo6XoFGdTF0J/nGoeoFZB7L3y8ZVhIJA+aAZzsl1Bth2aeeLkV+MYhayVO35mMPuzzHEkzNryo1F0fNOVBUs9bMMx4YnPWg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1620070155; 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=uqmeaN/4AXKtgJwT/eGJDLG2d8Jq2K3MPeafs5T5nYM=; b=eHkjgeoaoOoQqj2SMT3cp0rCPhT6o1ZFj0awR79yG1cKNUgZczlhl6vPPJfmirPdhay2pdHJ1lRh1Iucd52hZjDa2FWL7dk13yjgAgEMJNv3Le9TwlpUkOvNTBZn3b3+lL7FF8yPUGodWN860E1GJSrV5Uw3M9q97KunC3JhhmA= 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 1620070155868932.3465068730438; Mon, 3 May 2021 12:29:15 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.121823.229802 (Exim 4.92) (envelope-from ) id 1ldeFc-0006Iw-97; Mon, 03 May 2021 19:29:04 +0000 Received: by outflank-mailman (output) from mailman id 121823.229802; Mon, 03 May 2021 19:29: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 1ldeFc-0006Il-5L; Mon, 03 May 2021 19:29:04 +0000 Received: by outflank-mailman (input) for mailman id 121823; Mon, 03 May 2021 19:29: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 1ldeFa-0005i5-Jn for xen-devel@lists.xenproject.org; Mon, 03 May 2021 19:29:02 +0000 Received: from mail-qk1-x72a.google.com (unknown [2607:f8b0:4864:20::72a]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 987927ca-06df-4976-8231-de24dc5622a7; Mon, 03 May 2021 19:28:46 +0000 (UTC) Received: by mail-qk1-x72a.google.com with SMTP id 197so5973479qkl.12 for ; Mon, 03 May 2021 12:28:46 -0700 (PDT) Received: from pm2-ws13.praxislan02.com ([2001:470:8:67e:8710:5560:a711:776f]) by smtp.gmail.com with ESMTPSA id g18sm9225209qke.21.2021.05.03.12.28.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 May 2021 12:28:45 -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: 987927ca-06df-4976-8231-de24dc5622a7 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=uqmeaN/4AXKtgJwT/eGJDLG2d8Jq2K3MPeafs5T5nYM=; b=O/puGUfut9mjkvqGS86rfWewHK5E599cwLjEx2+bHI6TOIOUpS4ZZ9oNcqv64wwHK0 q64nPMyLnCGNL3Fw+sllS/T/vFIOtu+Mv+Ul+uPQI8xdQJKtmvMCWpAN8zP0t3OrvxLp 3Efpb6rDVyYF+PCKjAjx4oPbKKF6sMAs5uQdixPlakV7IBxVtdzzJIwO2kT/Cww1k0xO LJsYSJCkJ2UcPEZ7+zKyFFoTMnsi5U1O7DTKpJo1FXK5XFWkFEAG2V/bu1/jDg6bEvUW JdhIKB+xJ5HSvhF3bKXWpt1otDoigLP4X+VLeAOGW6rpUBxs24bKmmY8LzvvL8/Yt7K0 DrLA== 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=uqmeaN/4AXKtgJwT/eGJDLG2d8Jq2K3MPeafs5T5nYM=; b=EogcMaZAhCEo1wIQ51f8la57OqKB71wXegTyaiybm4ekVOe2lQ5xppNz0SMgus4Bw2 97dxO3OCrkvmA2p/UA0BaFs6uyUu9AX/SCUrzl70q+X9/MmGK58KxtRSXkIjpUZukR/V uvD6MAfc6uGiMELEYaD0a4jWlaAKHhQ+AGZ4gvF0WUw1r9Tcx9DmjWN1aXIPtPqSy7vf kCAT3c3mbsK6Vc3Wo0dAUgyvHCx56Gknr+t5f8/7G1svb3ai8OxP/cudpEasVWdzvbxi cj1lJM3iCqu1een1fbl3kyAlRwF7G83cnZtgGepLyBtyGTzfFRDAmxln3OKgULXIS2fo KftQ== X-Gm-Message-State: AOAM532bxZXgjU6UxUtoLlXs0iO/C9Yp43kNID1SvHXs3lqT21VLEfLD j2J1DhScbX+pTF0wSb/1nek+kfXIC5Y= X-Google-Smtp-Source: ABdhPJx6ttFNkIn5dzIsgKI9wOkqyfRGwETpXC7M8/giqwZN9obtfIXDzSEvqWjAmhLcaCATHTdqBw== X-Received: by 2002:a37:a5d8:: with SMTP id o207mr17799675qke.13.1620070125776; Mon, 03 May 2021 12:28:45 -0700 (PDT) From: Jason Andryuk To: xen-devel@lists.xenproject.org Cc: Jason Andryuk , Ian Jackson , Wei Liu Subject: [PATCH 07/13] libxc: Include hwp_para in definitions Date: Mon, 3 May 2021 15:28:04 -0400 Message-Id: <20210503192810.36084-8-jandryuk@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210503192810.36084-1-jandryuk@gmail.com> References: <20210503192810.36084-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" Expose the hwp_para fields through libxc. Signed-off-by: Jason Andryuk --- tools/include/xenctrl.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/include/xenctrl.h b/tools/include/xenctrl.h index 27cec1b93f..82dfa1613a 100644 --- a/tools/include/xenctrl.h +++ b/tools/include/xenctrl.h @@ -1960,6 +1960,7 @@ int xc_smt_disable(xc_interface *xch); */ typedef struct xen_userspace xc_userspace_t; typedef struct xen_ondemand xc_ondemand_t; +typedef struct xen_hwp_para xc_hwp_para_t; =20 struct xc_get_cpufreq_para { /* IN/OUT variable */ @@ -1987,6 +1988,7 @@ struct xc_get_cpufreq_para { union { xc_userspace_t userspace; xc_ondemand_t ondemand; + xc_hwp_para_t hwp_para; } u; =20 int32_t turbo_enabled; --=20 2.30.2 From nobody Fri Apr 26 18:23:13 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=1620070161; cv=none; d=zohomail.com; s=zohoarc; b=QPDxa/eLy/8RQ39SO6Wg9iJH/rrw5iiWmUbvI7ONgACqm1Mz1U9ouYsXZybZkkZzL8J3i83O1Jh7aL/yCcV9IrtLfO6KufoGYsDlltHQXxGnYvH8H9csgiAZPueC0yxr5aL9yWY8rAR+rPCB7iA2T5llCOPsUYCRknbPfGooeoU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1620070161; 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=gt85a9/jfQ7Ok17ZWY+qwgah9qHuJa+K9OUnjKLsOOc=; b=fkMJ43Uv6YJieV5Eym6Vz1Lx0n9QvoLryQNuWPGJQvUkpFZANzfQJ2De3Yb1cXzdupQAddQxuHH7lJ1qUwnD4/tzqt3AhH+kBt8FoOyfPFzzcMAws7zkR/V6YaZCo54ZTpLS7+Vz/ai8Obq1V/EeUFxbf5Olteuci9LcfU8i3sA= 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 1620070161961655.135244686959; Mon, 3 May 2021 12:29:21 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.121825.229814 (Exim 4.92) (envelope-from ) id 1ldeFh-0006Np-JN; Mon, 03 May 2021 19:29:09 +0000 Received: by outflank-mailman (output) from mailman id 121825.229814; Mon, 03 May 2021 19:29:09 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ldeFh-0006Na-FI; Mon, 03 May 2021 19:29:09 +0000 Received: by outflank-mailman (input) for mailman id 121825; Mon, 03 May 2021 19:29:07 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ldeFf-0005i5-Jn for xen-devel@lists.xenproject.org; Mon, 03 May 2021 19:29:07 +0000 Received: from mail-qk1-x736.google.com (unknown [2607:f8b0:4864:20::736]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id e4ed6410-658a-4a0f-b3e0-88195cd685b6; Mon, 03 May 2021 19:28:49 +0000 (UTC) Received: by mail-qk1-x736.google.com with SMTP id x8so6283459qkl.2 for ; Mon, 03 May 2021 12:28:49 -0700 (PDT) Received: from pm2-ws13.praxislan02.com ([2001:470:8:67e:8710:5560:a711:776f]) by smtp.gmail.com with ESMTPSA id g18sm9225209qke.21.2021.05.03.12.28.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 May 2021 12:28:48 -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: e4ed6410-658a-4a0f-b3e0-88195cd685b6 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=gt85a9/jfQ7Ok17ZWY+qwgah9qHuJa+K9OUnjKLsOOc=; b=m22f79isZGNQAsYaUIL3/HfQVDpVWzxexpINlOO7hIcVSY8G1Z3YESSEokpdYnOQ6L ufFHbXjfy5TsQpgDkum9bIdbZ54wXP5ix2KuyWgd8ab1SeWYd/V+rCEPIlO9P864Mfjc gnw0Az+nem/YdygO/CAen/ToQa9H/d4S/1/F/oNLNqc2sA7COQOT0ay6JP/cujrcqiRA FDh16mVHQDxquhIGGmKtg8XpvN1SwdPqcwEy903e1B3LaNyrBR42sXw1uqqg53o1kFdH TP1+7ipZeIxSMpU6CWn5KMPEfLkbeyArvRhuvoaad0BGn5XwHju6x+Gn6xZc2KG89We1 qGHQ== 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=gt85a9/jfQ7Ok17ZWY+qwgah9qHuJa+K9OUnjKLsOOc=; b=Nfaf4FAs7rID2AMuKS7VPONwLlBKH6e6275urV1JW44vt0ZKvG2Fuld0tzbaTEHzqO X59gT2vdKOzjN7OHhckNwzLBRxOpCqVures7MYYaza0Ae5DUAG5bvhXqJe8gggTag+YR cfwG3awdan5/gJbktCt33sxpbzUCRtvSNqAl8GUSn9Angdd1Lk/hmdR4eGIKQQ/6LDdD 9qTkmAhAr/m+kksUFi535Zgp8eSEXCrVWfs2WW17xYOjRpUmZa8vnFx2242HN/kpl1RS 8sIEFpX16d6ZN41FMYEXk9hxLniJhuviwuTnfzz3KuEZjkp0aHT+Us5vPxlS8MrkOty+ 5Q8g== X-Gm-Message-State: AOAM533Aqo4MHR1bIo6VI9huVOdiUIG3oWS5egRdlvMVINUcMJmVeIyX wdV4ykKss0j9Zq80g08bDQpBh4pC7HY= X-Google-Smtp-Source: ABdhPJz/03LMfmKp0x6zG8POk2wzTrZRWriHbDwMe0oz2I8oEm/pX7v3mJQspxQxqeARe/iXRkXpjg== X-Received: by 2002:a37:a683:: with SMTP id p125mr14770669qke.332.1620070128657; Mon, 03 May 2021 12:28:48 -0700 (PDT) From: Jason Andryuk To: xen-devel@lists.xenproject.org Cc: Jason Andryuk , Ian Jackson , Wei Liu Subject: [PATCH 08/13] xenpm: Print HWP parameters Date: Mon, 3 May 2021 15:28:05 -0400 Message-Id: <20210503192810.36084-9-jandryuk@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210503192810.36084-1-jandryuk@gmail.com> References: <20210503192810.36084-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 | 71 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) diff --git a/tools/misc/xenpm.c b/tools/misc/xenpm.c index 562bf939f9..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) { @@ -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.30.2 From nobody Fri Apr 26 18:23:13 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=1620070522; cv=none; d=zohomail.com; s=zohoarc; b=ILzXV2F1HnPpcab2f/dxCnr2Buc8UmJ+MvCV5E1k0IUxShKwjow8hoykz1YQJMpld00tveQhMXIpVtbPLeSktH+rcXuFLzqNvIwVV2/nnXehzgg/RvfbfE69bmiPIi0mjXW5prugmaVOIiWGDH8SPGANesCZi8KzQFiCPTCDjsM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1620070522; 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=SA2GZ9hF2Qvi9qam8q5O9Sh0EYcwTdRBSgnWrRejxiQ=; b=VH3xKZ3HrDCw5NJ4DnyNOQdrFi6uCtCpUNzRpWf71+wciA+duur206/Q/VV+rAiih4yvtI4QKi6hWgwMgpfN6RlmqTZas5f8b0kyas3AoE4UXlRaW6lv3AIrgBUOAC7blOHWgkR4RwkNCp+rx3hmBr/9Ljc87uGWE2NXTmsowkw= 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 1620070522955611.0569393726028; Mon, 3 May 2021 12:35:22 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.121847.229850 (Exim 4.92) (envelope-from ) id 1ldeLU-0007a9-U2; Mon, 03 May 2021 19:35:08 +0000 Received: by outflank-mailman (output) from mailman id 121847.229850; Mon, 03 May 2021 19:35:08 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ldeLU-0007a2-QJ; Mon, 03 May 2021 19:35:08 +0000 Received: by outflank-mailman (input) for mailman id 121847; Mon, 03 May 2021 19:35:07 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ldeFp-0005i5-KA for xen-devel@lists.xenproject.org; Mon, 03 May 2021 19:29:17 +0000 Received: from mail-qv1-xf35.google.com (unknown [2607:f8b0:4864:20::f35]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 7961687f-6128-4146-ae23-04d37fbfe793; Mon, 03 May 2021 19:28:52 +0000 (UTC) Received: by mail-qv1-xf35.google.com with SMTP id h1so2412836qvv.10 for ; Mon, 03 May 2021 12:28:52 -0700 (PDT) Received: from pm2-ws13.praxislan02.com ([2001:470:8:67e:8710:5560:a711:776f]) by smtp.gmail.com with ESMTPSA id g18sm9225209qke.21.2021.05.03.12.28.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 May 2021 12:28:50 -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: 7961687f-6128-4146-ae23-04d37fbfe793 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=SA2GZ9hF2Qvi9qam8q5O9Sh0EYcwTdRBSgnWrRejxiQ=; b=K7QccnrtgPJmjHYg6sNoXTWMoj+Vc0zwioEjc6/VfQ+P0fQm0cm07QvcejGvl0LYkp bjiUU8UfMyEa2DA+5i2PnVXzdLx0eH0sfJhMkV7ivzXalX07OeohPWBpbK66CkPG1qKs uak6gkfwR3PBhDcfrkQ1ZwJHMJ0vjnkN9rPc3P4dHTar58C+p+kfMGtAdkN7aevBVBl0 G3CaB18hkpLlvhi1jUxxOXu5GDRk3c/BtzZSmfpSBOIcl189O6xwIoLOmDW0ga3u92tb 3z0OsWME0xR6HW2gcMLZGtMvXsvnz6MI3Ub6yBnR4rRwncBZFkQHN/7Gmro27zlmJAiL /qRA== 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=SA2GZ9hF2Qvi9qam8q5O9Sh0EYcwTdRBSgnWrRejxiQ=; b=UKJTV6rSV43TJ4DuLtWHCyVKZ2FEdIEh13BSkHe9V9M1oGfxqeXEFmHiLtpTXTCkfw qP7VUx+uD8cjSznOjq41BvcarV2GQB/ZzXlroaNEy7nvJLAQ/EY37FXZ5ZP2s29v72oi b4BhbDx6FiPxqvBdNtGFCzPWPnyJ39bjfnZg5V2Q691IhDsQPEHUWdJuZVrtbMF6BM6u QNj69LLNJ5An45pNJbGa0oxDx43nCPuDK5Nqq7QlnmgNIk9kM0TGsj2uu0bEsgxiZb4z Lb9wg8zQgxSgUsq0qaWifHvFTzAUJwU1zGYXgaIJC7TnH+eC8ixZZi4SMqFXvKFoqMju QK+Q== X-Gm-Message-State: AOAM532Z+/mgz6mxzkvjMFLrv2PFRD0COGoOfb62I4MpWtoufWXV/Fy5 no0Dn+BEJLsbxYE74aiQOOET1hMpMsU= X-Google-Smtp-Source: ABdhPJz+bMqGsKQPk/vjNNXpvY12fF1VAf59hcwKRvYkQrYHSjWtbGiQ8W9IwjoiBfMqfMcklYxxug== X-Received: by 2002:ad4:59c7:: with SMTP id el7mr21549307qvb.26.1620070131409; Mon, 03 May 2021 12:28:51 -0700 (PDT) From: Jason Andryuk To: xen-devel@lists.xenproject.org Cc: Jason Andryuk , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Wei Liu , George Dunlap , Ian Jackson , Julien Grall , Stefano Stabellini Subject: [PATCH 09/13] xen: Add SET_CPUFREQ_HWP xen_sysctl_pm_op Date: Mon, 3 May 2021 15:28:06 -0400 Message-Id: <20210503192810.36084-10-jandryuk@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210503192810.36084-1-jandryuk@gmail.com> References: <20210503192810.36084-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" Add SET_CPUFREQ_HWP xen_sysctl_pm_op to set HWP parameters. The sysctl supports setting multiple values simultaneously as indicated by the set_params bits. This allows atomically applying new HWP configuration via a single wrmsr. XEN_SYSCTL_HWP_SET_PRESET_BALANCE/PERFORMANCE/POWERSAVE provide three common presets. Setting them depends on hardware limits which the hypervisor is already caching. So using them allows skipping a hypercall to query the limits (hw_lowest/highest) to then set those same values. The code is organized to allow a preset to be refined with additional stuff if desired. "most_efficient" and "guaranteed" could be additional presets in the future, but the are not added now. Those levels can change at runtime, but we don't have code in place to monitor and update for those events. Signed-off-by: Jason Andryuk --- xen/arch/x86/acpi/cpufreq/hwp.c | 114 +++++++++++++++++++++++++++++ xen/drivers/acpi/pmstat.c | 24 ++++++ xen/include/acpi/cpufreq/cpufreq.h | 2 + xen/include/public/sysctl.h | 32 ++++++++ 4 files changed, 172 insertions(+) diff --git a/xen/arch/x86/acpi/cpufreq/hwp.c b/xen/arch/x86/acpi/cpufreq/hw= p.c index 92222d6d85..0fd70d76a8 100644 --- a/xen/arch/x86/acpi/cpufreq/hwp.c +++ b/xen/arch/x86/acpi/cpufreq/hwp.c @@ -547,6 +547,120 @@ int get_hwp_para(struct cpufreq_policy *policy, struc= t xen_hwp_para *hwp_para) return 0; } =20 +int set_hwp_para(struct cpufreq_policy *policy, + struct xen_set_hwp_para *set_hwp) +{ + unsigned int cpu =3D policy->cpu; + struct hwp_drv_data *data =3D hwp_drv_data[cpu]; + + if ( data =3D=3D NULL ) + return -EINVAL; + + /* Validate all parameters first */ + if ( set_hwp->set_params & ~XEN_SYSCTL_HWP_SET_PARAM_MASK ) + { + hwp_err("Invalid bits in hwp set_params %u\n", + set_hwp->set_params); + + return -EINVAL; + } + + if ( set_hwp->activity_window & ~XEN_SYSCTL_HWP_ACT_WINDOW_MASK ) + { + hwp_err("Invalid bits in activity window %u\n", + set_hwp->activity_window); + + return -EINVAL; + } + + if ( !feature_hwp_energy_perf && + set_hwp->set_params & XEN_SYSCTL_HWP_SET_ENERGY_PERF && + set_hwp->energy_perf > 0xf ) + { + hwp_err("energy_perf %u out of range for IA32_ENERGY_PERF_BIAS\n", + set_hwp->energy_perf); + + return -EINVAL; + } + + if ( set_hwp->set_params & XEN_SYSCTL_HWP_SET_DESIRED && + set_hwp->desired !=3D 0 && + ( set_hwp->desired < data->hw_lowest || + set_hwp->desired > data->hw_highest ) ) + { + hwp_err("hwp desired %u is out of range (%u ... %u)\n", + set_hwp->desired, data->hw_lowest, data->hw_highest); + + return -EINVAL; + } + + /* + * minimum & maximum are not validated as hardware doesn't seem to care + * and the SDM says CPUs will clip internally. + */ + + /* Apply presets */ + switch ( set_hwp->set_params & XEN_SYSCTL_HWP_SET_PRESET_MASK ) + { + case XEN_SYSCTL_HWP_SET_PRESET_POWERSAVE: + data->minimum =3D data->hw_lowest; + data->maximum =3D data->hw_lowest; + data->activity_window =3D 0; + if ( feature_hwp_energy_perf ) + data->energy_perf =3D 0xff; + else + data->energy_perf =3D 0xf; + data->desired =3D 0; + break; + case XEN_SYSCTL_HWP_SET_PRESET_PERFORMANCE: + data->minimum =3D data->hw_highest; + data->maximum =3D data->hw_highest; + data->activity_window =3D 0; + data->energy_perf =3D 0; + data->desired =3D 0; + break; + case XEN_SYSCTL_HWP_SET_PRESET_BALANCE: + data->minimum =3D data->hw_lowest; + data->maximum =3D data->hw_highest; + data->activity_window =3D 0; + data->energy_perf =3D 0x80; + if ( feature_hwp_energy_perf ) + data->energy_perf =3D 0x80; + else + data->energy_perf =3D 0x7; + data->desired =3D 0; + break; + case XEN_SYSCTL_HWP_SET_PRESET_NONE: + break; + default: + printk("HWP: Invalid preset value: %u\n", + set_hwp->set_params & XEN_SYSCTL_HWP_SET_PRESET_MASK); + + return -EINVAL; + } + + /* Further customize presets if needed */ + if ( set_hwp->set_params & XEN_SYSCTL_HWP_SET_MINIMUM ) + data->minimum =3D set_hwp->minimum; + + if ( set_hwp->set_params & XEN_SYSCTL_HWP_SET_MAXIMUM ) + data->maximum =3D set_hwp->maximum; + + if ( set_hwp->set_params & XEN_SYSCTL_HWP_SET_ENERGY_PERF ) + data->energy_perf =3D set_hwp->energy_perf; + + if ( set_hwp->set_params & XEN_SYSCTL_HWP_SET_DESIRED ) + data->desired =3D set_hwp->desired; + + if ( set_hwp->set_params & XEN_SYSCTL_HWP_SET_ACT_WINDOW ) + data->activity_window =3D set_hwp->activity_window & + XEN_SYSCTL_HWP_ACT_WINDOW_MASK; + + hwp_cpufreq_target(policy, 0, 0); + + return 0; +} + int hwp_register_driver(void) { int ret; diff --git a/xen/drivers/acpi/pmstat.c b/xen/drivers/acpi/pmstat.c index 3e35c42949..016b0445ec 100644 --- a/xen/drivers/acpi/pmstat.c +++ b/xen/drivers/acpi/pmstat.c @@ -318,6 +318,24 @@ static int set_cpufreq_gov(struct xen_sysctl_pm_op *op) return __cpufreq_set_policy(old_policy, &new_policy); } =20 +static int set_cpufreq_hwp(struct xen_sysctl_pm_op *op) +{ + struct cpufreq_policy *policy; + + if ( !cpufreq_governor_internal ) + return -EINVAL; + + policy =3D per_cpu(cpufreq_cpu_policy, op->cpuid); + + if ( !policy || !policy->governor ) + return -EINVAL; + + if ( strncasecmp(policy->governor->name, "hwp-internal", CPUFREQ_NAME_= LEN) ) + return -EINVAL; + + return set_hwp_para(policy, &op->u.set_hwp); +} + static int set_cpufreq_para(struct xen_sysctl_pm_op *op) { int ret =3D 0; @@ -465,6 +483,12 @@ int do_pm_op(struct xen_sysctl_pm_op *op) break; } =20 + case SET_CPUFREQ_HWP: + { + ret =3D set_cpufreq_hwp(op); + break; + } + case SET_CPUFREQ_PARA: { ret =3D set_cpufreq_para(op); diff --git a/xen/include/acpi/cpufreq/cpufreq.h b/xen/include/acpi/cpufreq/= cpufreq.h index 42146ca2cf..7ff7d0d4bb 100644 --- a/xen/include/acpi/cpufreq/cpufreq.h +++ b/xen/include/acpi/cpufreq/cpufreq.h @@ -248,5 +248,7 @@ void cpufreq_dbs_timer_resume(void); =20 /********************** hwp hypercall helper *************************/ int get_hwp_para(struct cpufreq_policy *policy, struct xen_hwp_para *hwp_p= ara); +int set_hwp_para(struct cpufreq_policy *policy, + struct xen_set_hwp_para *set_hwp); =20 #endif /* __XEN_CPUFREQ_PM_H__ */ diff --git a/xen/include/public/sysctl.h b/xen/include/public/sysctl.h index 1a6c6397ea..3f18a3d522 100644 --- a/xen/include/public/sysctl.h +++ b/xen/include/public/sysctl.h @@ -318,6 +318,36 @@ struct xen_hwp_para { uint8_t energy_perf; }; =20 +/* set multiple values simultaneously when set_args bit is set */ +struct xen_set_hwp_para { + uint16_t set_params; /* bitflags for valid values */ +#define XEN_SYSCTL_HWP_SET_DESIRED (1U << 0) +#define XEN_SYSCTL_HWP_SET_ENERGY_PERF (1U << 1) +#define XEN_SYSCTL_HWP_SET_ACT_WINDOW (1U << 2) +#define XEN_SYSCTL_HWP_SET_MINIMUM (1U << 3) +#define XEN_SYSCTL_HWP_SET_MAXIMUM (1U << 4) +#define XEN_SYSCTL_HWP_SET_PRESET_MASK (0xf000) +#define XEN_SYSCTL_HWP_SET_PRESET_NONE (0x0000) +#define XEN_SYSCTL_HWP_SET_PRESET_BALANCE (0x1000) +#define XEN_SYSCTL_HWP_SET_PRESET_POWERSAVE (0x2000) +#define XEN_SYSCTL_HWP_SET_PRESET_PERFORMANCE (0x3000) +#define XEN_SYSCTL_HWP_SET_PARAM_MASK ((uint16_t)( \ + XEN_SYSCTL_HWP_SET_PRESET_MASK | \ + XEN_SYSCTL_HWP_SET_DESIRED | \ + XEN_SYSCTL_HWP_SET_ENERGY_PERF | \ + XEN_SYSCTL_HWP_SET_ACT_WINDOW | \ + XEN_SYSCTL_HWP_SET_MINIMUM | \ + XEN_SYSCTL_HWP_SET_MAXIMUM )) + + uint16_t activity_window; /* 7bit mantissa and 3bit exponent */ +#define XEN_SYSCTL_HWP_ACT_WINDOW_MASK (0x03ff) + uint8_t minimum; + uint8_t maximum; + uint8_t desired; + uint8_t energy_perf; /* 0-255 or 0-15 depending on HW support */ +}; + + /* * cpufreq para name of this structure named * same as sysfs file name of native linux @@ -379,6 +409,7 @@ struct xen_sysctl_pm_op { #define SET_CPUFREQ_GOV (CPUFREQ_PARA | 0x02) #define SET_CPUFREQ_PARA (CPUFREQ_PARA | 0x03) #define GET_CPUFREQ_AVGFREQ (CPUFREQ_PARA | 0x04) + #define SET_CPUFREQ_HWP (CPUFREQ_PARA | 0x05) =20 /* set/reset scheduler power saving option */ #define XEN_SYSCTL_pm_op_set_sched_opt_smt 0x21 @@ -405,6 +436,7 @@ struct xen_sysctl_pm_op { struct xen_get_cpufreq_para get_para; struct xen_set_cpufreq_gov set_gov; struct xen_set_cpufreq_para set_para; + struct xen_set_hwp_para set_hwp; uint64_aligned_t get_avgfreq; uint32_t set_sched_opt_smt; #define XEN_SYSCTL_CX_UNLIMITED 0xffffffff --=20 2.30.2 From nobody Fri Apr 26 18:23:13 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=1620070520; cv=none; d=zohomail.com; s=zohoarc; b=DAQc8eP31G/PbUv/8khE9pTw+TSl4oV3+0f/srDxTK3Fc/MW/Wprsa0hpKaK+K3/9t53N1Yrw7xUCmpJWQcnHt7BHhShRymq+/x+8Zc5ViBqCKVSeLZCorgZIQBEgKIQIvc3HNZf67m+FegnoTbawXoM0aKBwAU62wlnz5lwv4c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1620070520; 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=W0dWQDpwEXoVAFtJGqplAcn8R3hLDan97osHedktuzA=; b=FqpB8b7ETQw4H22+fi3SmJVRCQ4KWzMM2elihTBqc4hVEKccDFKubiMeLWu3CqxCAaLCqyLu5fFvPvETyX8yW0HxqT0Vte63rQhSGEWkSlE+C/tV1bOQ8ehYazFHVZo1r+f78XJgj3Di5Wd76k0VppZUJPLXMVOVwFW1nFxuW0E= 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 16200705205839.747098450891372; Mon, 3 May 2021 12:35:20 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.121844.229838 (Exim 4.92) (envelope-from ) id 1ldeLR-0007Wv-Jb; Mon, 03 May 2021 19:35:05 +0000 Received: by outflank-mailman (output) from mailman id 121844.229838; Mon, 03 May 2021 19:35:05 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ldeLR-0007Wo-GK; Mon, 03 May 2021 19:35:05 +0000 Received: by outflank-mailman (input) for mailman id 121844; Mon, 03 May 2021 19:35:04 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ldeFu-0005i5-KF for xen-devel@lists.xenproject.org; Mon, 03 May 2021 19:29:22 +0000 Received: from mail-qk1-x729.google.com (unknown [2607:f8b0:4864:20::729]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 67c84692-857f-406e-b7f5-ce41fbc9cc96; Mon, 03 May 2021 19:28:54 +0000 (UTC) Received: by mail-qk1-x729.google.com with SMTP id q127so6277958qkb.1 for ; Mon, 03 May 2021 12:28:54 -0700 (PDT) Received: from pm2-ws13.praxislan02.com ([2001:470:8:67e:8710:5560:a711:776f]) by smtp.gmail.com with ESMTPSA id g18sm9225209qke.21.2021.05.03.12.28.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 May 2021 12:28:53 -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: 67c84692-857f-406e-b7f5-ce41fbc9cc96 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=W0dWQDpwEXoVAFtJGqplAcn8R3hLDan97osHedktuzA=; b=jeAjy/+B/nRqPMGmVF+3m+72zaVTjLaZvFYZSePfzwkhZoOAiPKLpoeYT4Y7f8KNru IN8zHh5ajNrJHuLR8D9RfEz7Rb9Qv3hrAlwuXlfu9kj4iM6om55UeBgPlcPbehR7btBj FEoF+XgPnyMAhDwL7Cwx+JHYcj8th2ikK4EDPnsJI3y0qfBkm7oyOyAJ6Jh5zBsaML+1 avV3KbPga57bSfIcmSu0a5y9BwGkLtwzZN1NgW3iZXKBPjABpprnwM6w3DCTewcQgI+U GnwxM+wsrY2jsnTmSfGAVi4ngq5nYKDqoR6sHQ7dRVecGh5wtL2TsnbeMBiksn4MOGPP SNiQ== 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=W0dWQDpwEXoVAFtJGqplAcn8R3hLDan97osHedktuzA=; b=W7vmTRBLEq59hle7farg74MjR34dQLgcLsX+182+L13IFRoEzKmE9DTLgugww0XSqb Ll6jyNQRf5jZCqgYbpa+xK417IF63vSQeDdg/JPyWSehBJsHariUAiudZTJDoPJgrPQ2 PIZxdTiqP7QfNV1uDdw9zU1TtlvT1llQxOWyVKbZm1C0J5WocLO8GJW3U0JJUvOosOJH U01YwjImPKVmU989ibfgNvVqWVSvf//sLBfIOpPfXw7t/QTjLDS3OmPIPle/ZKOLpBwO mIA09iPUSNMzgAyG1S64Jzehl7tAVRn5yWwM1AOrqjMP5IhTiuKXVPLWNdz4rvlb+Aht Cqqg== X-Gm-Message-State: AOAM530VrBtfAghkJylPN6hZSN781xo6+KSsw0IULQ20PgrwL32TqkM+ AZSovIfpL4kPI4sTiYow2Y4W1+P8TLI= X-Google-Smtp-Source: ABdhPJxRgtng+6wCpftZbN46/DsbYWTqBEYMoYU4Bv7uuJjFVyruFKXM/P3Mof7Bhs5NjIskLYxNGQ== X-Received: by 2002:ae9:c014:: with SMTP id u20mr21902294qkk.387.1620070133953; Mon, 03 May 2021 12:28:53 -0700 (PDT) From: Jason Andryuk To: xen-devel@lists.xenproject.org Cc: Jason Andryuk , Ian Jackson , Wei Liu Subject: [PATCH 10/13] libxc: Add xc_set_cpufreq_hwp Date: Mon, 3 May 2021 15:28:07 -0400 Message-Id: <20210503192810.36084-11-jandryuk@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210503192810.36084-1-jandryuk@gmail.com> References: <20210503192810.36084-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" Add xc_set_cpufreq_hwp to allow calling xen_systctl_pm_op SET_CPUFREQ_HWP. Signed-off-by: Jason Andryuk --- Am I allowed to do set_hwp =3D *set_hwp struct assignment? --- tools/include/xenctrl.h | 4 ++++ tools/libs/ctrl/xc_pm.c | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/tools/include/xenctrl.h b/tools/include/xenctrl.h index 82dfa1613a..0fd1e756cb 100644 --- a/tools/include/xenctrl.h +++ b/tools/include/xenctrl.h @@ -1994,11 +1994,15 @@ struct xc_get_cpufreq_para { int32_t turbo_enabled; }; =20 +typedef struct xen_set_hwp_para xc_set_hwp_para_t; + int xc_get_cpufreq_para(xc_interface *xch, int cpuid, struct xc_get_cpufreq_para *user_para); int xc_set_cpufreq_gov(xc_interface *xch, int cpuid, char *govname); int xc_set_cpufreq_para(xc_interface *xch, int cpuid, int ctrl_type, int ctrl_value); +int xc_set_cpufreq_hwp(xc_interface *xch, int cpuid, + xc_set_hwp_para_t *set_hwp); int xc_get_cpufreq_avgfreq(xc_interface *xch, int cpuid, int *avg_freq); =20 int xc_set_sched_opt_smt(xc_interface *xch, uint32_t value); diff --git a/tools/libs/ctrl/xc_pm.c b/tools/libs/ctrl/xc_pm.c index 76d7eb7f26..407a24d2aa 100644 --- a/tools/libs/ctrl/xc_pm.c +++ b/tools/libs/ctrl/xc_pm.c @@ -330,6 +330,24 @@ int xc_set_cpufreq_para(xc_interface *xch, int cpuid, return xc_sysctl(xch, &sysctl); } =20 +int xc_set_cpufreq_hwp(xc_interface *xch, int cpuid, + xc_set_hwp_para_t *set_hwp) +{ + DECLARE_SYSCTL; + + if ( !xch ) + { + errno =3D EINVAL; + return -1; + } + sysctl.cmd =3D XEN_SYSCTL_pm_op; + sysctl.u.pm_op.cmd =3D SET_CPUFREQ_HWP; + sysctl.u.pm_op.cpuid =3D cpuid; + sysctl.u.pm_op.u.set_hwp =3D *set_hwp; + + return xc_sysctl(xch, &sysctl); +} + int xc_get_cpufreq_avgfreq(xc_interface *xch, int cpuid, int *avg_freq) { int ret =3D 0; --=20 2.30.2 From nobody Fri Apr 26 18:23:13 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=1620070534; cv=none; d=zohomail.com; s=zohoarc; b=OZjAws9UTRxDx4JqU/GxWLy3PgrF15wr80h7abBp7d3TucOa1iBac0cit+KXwh48OOG9xd025VARhc3Fj38NOyctbSaA4hsSpWu+RClgfuq9nE/IWnEfMcgRhlDmCGGiiYywU6n1Luf1VkuQWvjIVXSLTit881GYIbBvv+1lCFI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1620070534; 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=q7njXXxu6B3Y8DrhUPNrHywzinnQvdu6zM4xzDyyuko=; b=UcKxU+Si/9K6299YKXFuZcCHYE+TTar0okiTjeLymAFmeyL/GwEiKbrXPKYvjTBaoAhEKN7mC/eL/qaknJ7TCTowEcmlZpkaY8AQ++9462HIEOeRZ9I4Qsqy91SFGE4XAr5ZfIg1oWXDQgyWKMR0+lReMTMztGk6OEgAZDDphKo= 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 1620070534545928.8387076145507; Mon, 3 May 2021 12:35:34 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.121849.229862 (Exim 4.92) (envelope-from ) id 1ldeLi-0007jK-7G; Mon, 03 May 2021 19:35:22 +0000 Received: by outflank-mailman (output) from mailman id 121849.229862; Mon, 03 May 2021 19:35: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 1ldeLi-0007jD-43; Mon, 03 May 2021 19:35:22 +0000 Received: by outflank-mailman (input) for mailman id 121849; Mon, 03 May 2021 19:35:20 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ldeFz-0005i5-KQ for xen-devel@lists.xenproject.org; Mon, 03 May 2021 19:29:27 +0000 Received: from mail-qk1-x72a.google.com (unknown [2607:f8b0:4864:20::72a]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id d36e909b-5832-42f6-8902-22621205925b; Mon, 03 May 2021 19:28:57 +0000 (UTC) Received: by mail-qk1-x72a.google.com with SMTP id o27so6263552qkj.9 for ; Mon, 03 May 2021 12:28:57 -0700 (PDT) Received: from pm2-ws13.praxislan02.com ([2001:470:8:67e:8710:5560:a711:776f]) by smtp.gmail.com with ESMTPSA id g18sm9225209qke.21.2021.05.03.12.28.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 May 2021 12:28:56 -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: d36e909b-5832-42f6-8902-22621205925b 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=q7njXXxu6B3Y8DrhUPNrHywzinnQvdu6zM4xzDyyuko=; b=nqheekHalLG6tkckUcUjkQBwapbD9B61k9PGZDqmegukYvyYBQGZTl71KVWEqyJePK 3dl4xE2E2qC+DEFfu+QxxTpPflf+l9Avm16huLJLACvu4i+x9mMpVhFqDIV3WUqONFnz xQI6t3BqYhtc6DVOB0u6/vgODsRBEGBjctfvAn3BtNQ4uzUQXrvEOBjyJr9MiVSGCGXc eHnsfIxSr9RShifWy3LXVHblEJ2zGvjJ3LCyWaU89jRUnRjda4W2LUJKQ2abbhuRDOWk G7liIE5f0+Lm4IbMTsgNExRr5Radb2M4LeF2XxnsfF7cisodMEJO+Mb4RjQ6UwA0QRT8 hc7w== 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=q7njXXxu6B3Y8DrhUPNrHywzinnQvdu6zM4xzDyyuko=; b=g8g5iB+/xCCQO8HLNxli6Bk3+c0HwAfZ+dOLFxKXoe5AJSJT4R6conY3z2K8NuGO0P 9IVomnZKRZtkBkkCxG6g5rwcp4ajehpI7reWZQTYkRvW7rMZvcBOuhp/P2NRlJXcBogg Mw3CNwc8BrHO9kb9lEXBOL68ttKD0OWZ7NWu7N5rniKmwlgFRu73S/6lELIEeth+MUDY JUcf1bdbUxTA354/hrrBiAzilx2vEGqPyN3yW8w2Oe9yTiA17A1dUoMEq12HmVM5URX3 JKjVfWggllKh9eWI5bJKLTb+x/S0AcjWV+gLN5X0YcKgHjghYqt//PzMyUW8nqjZh9Aj DZtQ== X-Gm-Message-State: AOAM532jnqk7C4t+uMPFjdLsPjRtxihGgmY6X91qmLy1QN3T+xtM5t2R ZrfWxsKfYgjQ8h+vzYgpB5eYY2XErv4= X-Google-Smtp-Source: ABdhPJzYLBRfeN46ykpr3WELiAXepylc6nrMXcD8iVLEyQ3AOfKghnhhLA1pHjHVDIRAhiqWl+Hkyw== X-Received: by 2002:a05:620a:1036:: with SMTP id a22mr8961172qkk.186.1620070136565; Mon, 03 May 2021 12:28:56 -0700 (PDT) From: Jason Andryuk To: xen-devel@lists.xenproject.org Cc: Jason Andryuk , Ian Jackson , Wei Liu Subject: [PATCH 11/13] xenpm: Factor out a non-fatal cpuid_parse variant Date: Mon, 3 May 2021 15:28:08 -0400 Message-Id: <20210503192810.36084-12-jandryuk@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210503192810.36084-1-jandryuk@gmail.com> References: <20210503192810.36084-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" Allow cpuid_prase to be re-used without terminating xenpm. HWP will re-use it to optionally parse a cpuid. Signed-off-by: Jason Andryuk --- tools/misc/xenpm.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/tools/misc/xenpm.c b/tools/misc/xenpm.c index 9588dac991..a686f8f46e 100644 --- a/tools/misc/xenpm.c +++ b/tools/misc/xenpm.c @@ -79,17 +79,26 @@ void help_func(int argc, char *argv[]) show_help(); } =20 -static void parse_cpuid(const char *arg, int *cpuid) +static int parse_cpuid_non_fatal(const char *arg, int *cpuid) { if ( sscanf(arg, "%d", cpuid) !=3D 1 || *cpuid < 0 ) { if ( strcasecmp(arg, "all") ) - { - fprintf(stderr, "Invalid CPU identifier: '%s'\n", arg); - exit(EINVAL); - } + return -1; + *cpuid =3D -1; } + + return 0; +} + +static void parse_cpuid(const char *arg, int *cpuid) +{ + if ( parse_cpuid_non_fatal(arg, cpuid) ) + { + fprintf(stderr, "Invalid CPU identifier: '%s'\n", arg); + exit(EINVAL); + } } =20 static void parse_cpuid_and_int(int argc, char *argv[], --=20 2.30.2 From nobody Fri Apr 26 18:23:13 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=1620070520; cv=none; d=zohomail.com; s=zohoarc; b=hJ4uGP/9Mp/HZyR59ZEzjvZc9RE6bnCmEy0BbEFPkZcr6G1bSAC2on3HCGWIY4GJEIArl/V7rCWls/EYv9diq6YSU+uIZaw/zaoLVLZ4+Wk43SupfyqDuBXIKgzmbUUQ+mohoMuyjgKlP7Wj5npNAP4Ok0Dl4w/KY6RBLtQdLXE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1620070520; 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=SBP/WUCHYsHwmvFvXna4dIQQTPCdqZeigE28a+rXW1E=; b=nDHsL4L7VhhczdIcPeN6qM7BY4uc79SpY+marp57KrS8WLmTOkIeOCB2k1o6jYof5yby4DL1/Cb6Dz7R1sEGVlg0x6TeN8aEXYuXKIbdn/YIxHIaKhYwEMSTTsfEixCOVOMkuEq4+2NUrcMPtKMb/oX4sWncjW5TPXyvuh8IXoo= 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 1620070520452710.4274632758307; Mon, 3 May 2021 12:35:20 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.121843.229826 (Exim 4.92) (envelope-from ) id 1ldeLO-0007Up-7c; Mon, 03 May 2021 19:35:02 +0000 Received: by outflank-mailman (output) from mailman id 121843.229826; Mon, 03 May 2021 19:35:02 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ldeLO-0007Ui-4P; Mon, 03 May 2021 19:35:02 +0000 Received: by outflank-mailman (input) for mailman id 121843; Mon, 03 May 2021 19:35:00 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ldeG4-0005i5-KY for xen-devel@lists.xenproject.org; Mon, 03 May 2021 19:29:32 +0000 Received: from mail-qv1-xf2f.google.com (unknown [2607:f8b0:4864:20::f2f]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 8fdb1852-9169-42f7-9597-236b74c2a607; Mon, 03 May 2021 19:28:59 +0000 (UTC) Received: by mail-qv1-xf2f.google.com with SMTP id jm10so3210244qvb.5 for ; Mon, 03 May 2021 12:28:59 -0700 (PDT) Received: from pm2-ws13.praxislan02.com ([2001:470:8:67e:8710:5560:a711:776f]) by smtp.gmail.com with ESMTPSA id g18sm9225209qke.21.2021.05.03.12.28.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 May 2021 12:28:58 -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: 8fdb1852-9169-42f7-9597-236b74c2a607 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=SBP/WUCHYsHwmvFvXna4dIQQTPCdqZeigE28a+rXW1E=; b=O6BVnc4qd3xwHDBJXfoQIucfK9gnTGxsJRVTZbya52yOkKK+3zh0/rVotSg+Sl9Hpp Tql0xvakVp3Q29gD1H39GXvBQzEipXCd/8vKYbYfC9b8eILOcHb72QlNF9Nh3PIjmc/z FWZHtDC2IixKzDJ5IbkNZVIG6TZrQbFfMN7UrNco4svOIsNz8xNIj2DD7zD40z/HDIKK cJqcv7PvqopYvl3GimbTVrtMB4SIxB/hPMryBcsl5ZKwcWW2Aqd325ZLdVUXk+KV5te0 1pTIAso0lQiqiDltBky+pPfwXFXPqRtOsrRAtPf0vDlM+ZN1bTIq96pj+CroXFhOVzDe fWcg== 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=SBP/WUCHYsHwmvFvXna4dIQQTPCdqZeigE28a+rXW1E=; b=a58Arko+9KvYrQgPLfaRTRZO8xjMkq8ycF42IjFHPmW5egk3cZcp7RsuwCGAqAdovP kzuUxieFtmiIe8ALXZtut24/emQdDmxMf7ZJmu/1532FXBPOcy/xKtrahwoyCfA8maBh 1NIDegU1R3e+a+FdUe6p+fttEKOrboGaQo0rPpbqucuu+HrhaBpjGSJ7BzUaKCUilkcw x6ABd5YXxpyW616FPZ3+ZsB5QG9wT8JPOIQt3WBNklT5mUFPE8hN45XbDghOr13kTPPp E72XsmlTwt9fVQLGRCQXXJGsadSvo5rUQ9sVnEwYaEKkbKIUNnVoOa6kDIZ7XbjkIBHn aICg== X-Gm-Message-State: AOAM531rnk1IDXK6CIn8Bw0IaSuDYbJMbNSjXQbMpgwB4eXdEWIOssRI h9sh9ixh3/zf3vNfjoqMZKSd450OGPM= X-Google-Smtp-Source: ABdhPJw9qRujRfcqvQQOj/Nh1hz+fW3OuLKeqluU/Upmh5MZLqNoVIeI+WS4P/Ajl4B+ngqLCxMG+A== X-Received: by 2002:a0c:c488:: with SMTP id u8mr21113740qvi.47.1620070139057; Mon, 03 May 2021 12:28:59 -0700 (PDT) From: Jason Andryuk To: xen-devel@lists.xenproject.org Cc: Jason Andryuk , Ian Jackson , Wei Liu Subject: [PATCH 12/13] xenpm: Add set-cpufreq-hwp subcommand Date: Mon, 3 May 2021 15:28:09 -0400 Message-Id: <20210503192810.36084-13-jandryuk@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210503192810.36084-1-jandryuk@gmail.com> References: <20210503192810.36084-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" set-cpufreq-hwp allows setting the Hardware P-State (HWP) parameters. It can be run on all or just a single cpu. There are presets of balance, powersave & performance. Those can be further tweaked by param:val arguments as explained in the usage description. Parameter names are just checked to the first 3 characters to shorten typing. Some options are hardware dependent, and ranges can be found in get-cpufreq-para. Signed-off-by: Jason Andryuk --- tools/misc/xenpm.c | 240 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 240 insertions(+) diff --git a/tools/misc/xenpm.c b/tools/misc/xenpm.c index a686f8f46e..d3bcaf3b58 100644 --- a/tools/misc/xenpm.c +++ b/tools/misc/xenpm.c @@ -67,6 +67,25 @@ void show_help(void) " set-max-cstate |'unlimited' [|'unlimited']= \n" " set the C-State limitati= on ( >=3D 0) and\n" " optionally the C-sub-sta= te limitation ( >=3D 0)\n" + " set-cpufreq-hwp [cpuid] [balance|performance|powersave= ] *\n" + " set Hardware P-State (HW= P) parameters\n" + " optionally a preset of o= ne of\n" + " balance|performance|po= wersave\n" + " an optional list of para= m:val arguments\n" + " minimum:N hw_lowest .= .. hw_highest\n" + " maximum:N hw_lowest .= .. hw_highest\n" + " desired:N hw_lowest .= .. hw_highest\n" + " Set explicit perfo= rmance target.\n" + " non-zero disables = auto-HWP mode.\n" + " energy_perf:0-255 (or = 0-15)\n" + " energy/per= formance hint\n" + " lower favo= r performance\n" + " higher fav= or powersave\n" + " 127 (or 7)= balance\n" + " act_window:N{,m,u}s ra= nge 0us-1270s\n" + " window for interna= l calculations.\n" + " 0 lets the hardwar= e decide.\n" + " get-cpufreq-para returns= hw_lowest/highest.\n" " start [seconds] start collect Cx/Px stat= istics,\n" " output after CTRL-C or S= IGINT or several seconds.\n" " enable-turbo-mode [cpuid] enable Turbo Mode for pr= ocessors that support it.\n" @@ -1309,6 +1328,226 @@ void disable_turbo_mode(int argc, char *argv[]) errno, strerror(errno)); } =20 +/* + * Parse activity_window:NNN{us,ms,s} and validate range. + * + * Activity window is a 7bit mantissa (0-127) with a 3bit exponent (0-7) b= ase + * 10 in microseconds. So the range is 1 microsecond to 1270 seconds. A = value + * of 0 lets the hardware autonomously select the window. + * + * Return 0 on success + * -1 on error + * 1 Not activity_window. i.e. try parsing as another argument + */ +static int parse_activity_window(xc_set_hwp_para_t *set_hwp, char *p) +{ + char *param =3D NULL, *val =3D NULL, *suffix =3D NULL; + unsigned int u; + unsigned int exponent =3D 0; + unsigned int multiplier =3D 1; + int ret; + + ret =3D sscanf(p, "%m[a-z_A-Z]:%ms", ¶m, &val); + if ( ret !=3D 2 ) + { + return -1; + } + + if ( strncasecmp(param, "act", 3) !=3D 0 ) + { + ret =3D 1; + + goto out; + } + + free(param); + param =3D NULL; + + ret =3D sscanf(val, "%u%ms", &u, &suffix); + if ( ret !=3D 1 && ret !=3D 2 ) + { + fprintf(stderr, "invalid activity window: %s\n", val); + + ret =3D -1; + + goto out; + } + + if ( ret =3D=3D 2 && suffix ) + { + if ( strcasecmp(suffix, "s") =3D=3D 0 ) + { + multiplier =3D 1000 * 1000; + exponent =3D 6; + } + else if ( strcasecmp(suffix, "ms") =3D=3D 0 ) + { + multiplier =3D 1000; + exponent =3D 3; + } + else if ( strcasecmp(suffix, "us") =3D=3D 0 ) + { + multiplier =3D 1; + exponent =3D 0; + } + else + { + fprintf(stderr, "invalid activity window units: %s\n", suffix); + + ret =3D -1; + goto out; + } + } + + if ( u > 1270 * 1000 * 1000 / multiplier ) + { + fprintf(stderr, "activity window %s too large\n", val); + + ret =3D -1; + goto out; + } + + /* looking for 7 bits of mantissa and 3 bits of exponent */ + while ( u > 127 ) + { + u /=3D 10; + exponent +=3D 1; + } + + set_hwp->activity_window =3D ( exponent & 0x7 ) << 7 | ( u & 0x7f ); + set_hwp->set_params |=3D XEN_SYSCTL_HWP_SET_ACT_WINDOW; + + ret =3D 0; + + out: + free(suffix); + free(param); + free(val); + + return ret; +} + +static int parse_hwp_opts(xc_set_hwp_para_t *set_hwp, int *cpuid, + int argc, char *argv[]) +{ + int i =3D 0; + + if ( argc < 1 ) + return -1; + + if ( parse_cpuid_non_fatal(argv[i], cpuid) =3D=3D 0 ) + { + i++; + } + + if ( i =3D=3D argc ) + return -1; + + if ( strcasecmp(argv[i], "powersave") =3D=3D 0 ) + { + set_hwp->set_params =3D XEN_SYSCTL_HWP_SET_PRESET_POWERSAVE; + i++; + } + else if ( strcasecmp(argv[i], "performance") =3D=3D 0 ) + { + set_hwp->set_params =3D XEN_SYSCTL_HWP_SET_PRESET_PERFORMANCE; + i++; + } + else if ( strcasecmp(argv[i], "balance") =3D=3D 0 ) + { + set_hwp->set_params =3D XEN_SYSCTL_HWP_SET_PRESET_BALANCE; + i++; + } + + for ( ; i < argc; i++) + { + unsigned int val; + char *param; + int ret; + + ret =3D parse_activity_window(set_hwp, argv[i]); + switch ( ret ) + { + case -1: + return -1; + case 0: + continue; + break; + case 1: + /* try other parsing */ + break; + } + + /* sscanf can't handle split on ':' for "%ms:%u' */ + ret =3D sscanf(argv[i], "%m[a-zA-Z_]:%u", ¶m, &val); + if ( ret !=3D 2 ) + { + fprintf(stderr, "%s is an invalid hwp parameter.\n", argv[i]); + return -1; + } + + if ( val > 255 ) + { + fprintf(stderr, "%s value %u is out of range.\n", param, val); + return -1; + } + + if ( strncasecmp(param, "min", 3) =3D=3D 0 ) + { + set_hwp->minimum =3D val; + set_hwp->set_params |=3D XEN_SYSCTL_HWP_SET_MINIMUM; + } + else if ( strncasecmp(param, "max", 3) =3D=3D 0 ) + { + set_hwp->maximum =3D val; + set_hwp->set_params |=3D XEN_SYSCTL_HWP_SET_MAXIMUM; + } + else if ( strncasecmp(param, "des", 3) =3D=3D 0 ) + { + set_hwp->desired =3D val; + set_hwp->set_params |=3D XEN_SYSCTL_HWP_SET_DESIRED; + } + else if ( strncasecmp(param, "ene", 3) =3D=3D 0 ) + { + set_hwp->energy_perf =3D val; + set_hwp->set_params |=3D XEN_SYSCTL_HWP_SET_ENERGY_PERF; + } + else + { + fprintf(stderr, "%s is an invalid parameter\n.", param); + return -1; + } + + free(param); + } + + return 0; +} + +static void hwp_set_func(int argc, char *argv[]) +{ + xc_set_hwp_para_t set_hwp =3D {}; + int cpuid =3D -1; + int i =3D 0; + + if ( parse_hwp_opts(&set_hwp, &cpuid, argc, argv) ) + { + fprintf(stderr, "Missing, excess, or invalid argument(s)\n"); + exit(EINVAL); + } + + if ( cpuid !=3D -1 ) + { + i =3D cpuid; + max_cpu_nr =3D i + 1; + } + + for ( ; i < max_cpu_nr; i++ ) + if ( xc_set_cpufreq_hwp(xc_handle, i, &set_hwp) ) + fprintf(stderr, "[CPU%d] failed to set hwp params (%d - %s)\n", + i, errno, strerror(errno)); +} + struct { const char *name; void (*function)(int argc, char *argv[]); @@ -1319,6 +1558,7 @@ struct { { "get-cpufreq-average", cpufreq_func }, { "start", start_gather_func }, { "get-cpufreq-para", cpufreq_para_func }, + { "set-cpufreq-hwp", hwp_set_func }, { "set-scaling-maxfreq", scaling_max_freq_func }, { "set-scaling-minfreq", scaling_min_freq_func }, { "set-scaling-governor", scaling_governor_func }, --=20 2.30.2 From nobody Fri Apr 26 18:23:13 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=1620070537; cv=none; d=zohomail.com; s=zohoarc; b=eC4LQ9CnngMDaO2z0fK0+SWDhK9b7hNRUVYYhO0uGxbfue39H7sJOghCZloYpbo07t7K1js4wb1HCGSmre7s7XQYs898skDYHN5LL2hH1lLmTsMSYxN/mGC4XBMyEK3AQhpplD6uiw4NeRgJwGu8yzCrR+nhfsoEmmeCrkqsXEU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1620070537; 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=erQS8MRQTBPyaLr9w4i+Rj4rOpKDbVN/1THD8knRDvQ=; b=gBfpbxXJooO3CHidUmaNP2d0m1lPDmhqwiWja5GeyOKCNL24oo1DDV1wZiUcaAS5nDk6SaKW8wCYS9JQGsoCGELvsjWbiV8NTzoQ7EEzTg4bdPpV2bNzPXaHotCj5rwRj/x24G11RluTye6f4DKZpzlLAMeZIK7JBn0YzIbM2RY= 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 1620070537908148.72180627327202; Mon, 3 May 2021 12:35:37 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.121851.229874 (Exim 4.92) (envelope-from ) id 1ldeLk-0007ls-IK; Mon, 03 May 2021 19:35:24 +0000 Received: by outflank-mailman (output) from mailman id 121851.229874; Mon, 03 May 2021 19:35:24 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ldeLk-0007lj-Dx; Mon, 03 May 2021 19:35:24 +0000 Received: by outflank-mailman (input) for mailman id 121851; Mon, 03 May 2021 19:35:23 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ldeG9-0005i5-Kh for xen-devel@lists.xenproject.org; Mon, 03 May 2021 19:29:37 +0000 Received: from mail-qk1-x734.google.com (unknown [2607:f8b0:4864:20::734]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 4c8daf29-0926-4ea5-aa7a-809e84392228; Mon, 03 May 2021 19:29:02 +0000 (UTC) Received: by mail-qk1-x734.google.com with SMTP id a2so6255843qkh.11 for ; Mon, 03 May 2021 12:29:02 -0700 (PDT) Received: from pm2-ws13.praxislan02.com ([2001:470:8:67e:8710:5560:a711:776f]) by smtp.gmail.com with ESMTPSA id g18sm9225209qke.21.2021.05.03.12.29.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 May 2021 12:29:01 -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: 4c8daf29-0926-4ea5-aa7a-809e84392228 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=erQS8MRQTBPyaLr9w4i+Rj4rOpKDbVN/1THD8knRDvQ=; b=dQKe7cyABPeD48VAX3db6u/qUzVypeOxvLgjMiBKfIpOVibjTxeqgre/U83sc9GrFc AR7pYs/BDNWM50OPm82rfAKqYpRBektJDSp7cey9NoIPTLDg3AS3sFvrhnJpuI7rNUhU TKQNAF8+A4cvjClJ608AzTjs9pu5WbLbYOEQTbXw2J52ePciHcTLLVjdVKjCqgC74vf1 gpxF8JGBCUy1zAHcsz9eLjL0fX40KyAjbtbbNEF2qH/W4X/q2CXhrqWLE0odGNBo4e5n pb1aEtdDQfHr4o49IkPhCdLf79/JTUy5PspEGfEK9D/qpzc2Oj63iDzYnQSfHvRSElyi EX3Q== 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=erQS8MRQTBPyaLr9w4i+Rj4rOpKDbVN/1THD8knRDvQ=; b=BVGwDR1WEWGsuHzSOHVIxu+ovVQa1+LIlSSzSrWMYfV+vP7nQyhSdnNIPtSgPyogk/ wTtO3M65pjrwXV/mZ3vlOv5AE8eah3VFAByzGD7LCHVfjgonnnR/EM9D/UOEzLKE4IS3 heqiccjbhC5Z62W+dLcsAMiW3Ls0h1B6hcAKwpLRNH1vZng+q4cUx97RPaJY7kGOtbnY Zy40hSvQ45NQJaUqBhrKwhQyFaBOL17t45Lr+cm3SYpBHZY0KxHqZ54aaIWuXL9hKgBI w3C/OURAFAMvFjL77x+0Yrd4KwJylNrqYY+9vEr3zq6T/hEFg5+XbS6KY1rijQzTKBUx SqCg== X-Gm-Message-State: AOAM532YLWHQZmcdouqPmXkV8svYdiOEZLaFqZstaLq99W1ZdrdLBFTD xpkmsFt5twzs5wD39eF1wsLxTAXBxNE= X-Google-Smtp-Source: ABdhPJyvhYdeVdpTZBj+YymLg3IRFM/mMFSZg3WdY7wyW3IoyBL6i7mCWd0IT67+lDvZ9fiTkPtjZw== X-Received: by 2002:a37:8443:: with SMTP id g64mr21293992qkd.185.1620070141508; Mon, 03 May 2021 12:29:01 -0700 (PDT) From: Jason Andryuk To: xen-devel@lists.xenproject.org Cc: Jason Andryuk , Ian Jackson , Community Manager Subject: [PATCH 13/13] CHANGELOG: Add Intel HWP entry Date: Mon, 3 May 2021 15:28:10 -0400 Message-Id: <20210503192810.36084-14-jandryuk@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210503192810.36084-1-jandryuk@gmail.com> References: <20210503192810.36084-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" Signed-off-by: Jason Andryuk --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0106fccec1..bbca67bc0b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ Notable changes to Xen will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.= 0.0/) =20 ## [unstable UNRELEASED](https://xenbits.xen.org/gitweb/?p=3Dxen.git;a=3Ds= hortlog;h=3Dstaging) - TBD +### Added / support upgraded + - Intel Hardware P-States (HWP) cpufreq driver =20 ## [4.15.0 UNRELEASED](https://xenbits.xen.org/gitweb/?p=3Dxen.git;a=3Dsho= rtlog;h=3DRELEASE-4.15.0) - TBD =20 --=20 2.30.2