From patchwork Mon Nov 28 16:38:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Pisati X-Patchwork-Id: 1709867 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=wQrMmNMe; dkim-atps=neutral Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4NLWPz6rnYz23mg for ; Tue, 29 Nov 2022 03:39:03 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1ozh9j-0004Zq-LM; Mon, 28 Nov 2022 16:38:55 +0000 Received: from smtp-relay-internal-1.internal ([10.131.114.114] helo=smtp-relay-internal-1.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1ozh9g-0004Z7-RT for kernel-team@lists.ubuntu.com; Mon, 28 Nov 2022 16:38:52 +0000 Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id 9B0DB3F04C for ; Mon, 28 Nov 2022 16:38:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1669653532; bh=kJE462XOjV6QRE0Hwv8k9cDPZ/Nj2AGnoOSdR8Ev9fg=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=wQrMmNMeCaNUUW9saH0Tw/SSTI3jb5uv+C4VhaGZTkies/nOPVO+BFPopaHT9or2i fESnmyfG5Cwpf+aTjbhNKWMIl4DmqDu9MThyGMWHwmlr+ayx/AZBiPm6I9dHlFLL2w luApbPZIhbkqzAypQrroOiQBoF9qjo5ei+lRsJ0KWUmyWK1qBLmoGYfnbKhbanS5DQ MDLi5F4by7UKDgKIOOk02ScUILOOCijxixhHQICcWcUReQ7VgC8uZVEFx9WYmH41Po nRBvegaPXSlilje5h7HOc5Kd8qx1aJ/5R6R6DOeLgDyCF/CTZNLxbs76Cd5dUwhuA7 CKpN5OpGggFRA== Received: by mail-wr1-f72.google.com with SMTP id p2-20020adfaa02000000b00241d7fb17d7so2140958wrd.5 for ; Mon, 28 Nov 2022 08:38:52 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kJE462XOjV6QRE0Hwv8k9cDPZ/Nj2AGnoOSdR8Ev9fg=; b=aFsWntaXJHQE4qL5fbJ8UWthp3qP2xcTWYw0yS49HsTltgLet7DTwDWNXyaOnRDR6y pAFmhmLmvAG+NzBmiO8N6bdmye738NKzgWouwv5E6cO2OBFM3wl1uihywDCgPFFDS4A+ pinM6xWi3OYGGiSn1Nh01guzkq787W5u4RvyFhhv2bb0uZzO5g4iFIEoKkYXsLCD46wO dFsP8k1+LoHaYkaAw3B9Hwgsk+6TyxhdLDKXr55es3tRWraeK9Mc0zzjtovK0hQ/XvgK +pDUoOzODTJgG52UpknTxqP/xxuBdAnTRsqpNShfHQJ4C7CHgMvk04FmlRa6/OScUW6A E/ZA== X-Gm-Message-State: ANoB5pnvrR7fjz3poVQAAJkN365+xVZb3gXzySOANgpxeLbMCqBgXNKI UWo7ioEqcia5hatFoYPK8nEJYMpq0EbYB61Hc3qOoauo4ADy97XOtZGVVB1jP3h9mamUEexNiRi o78ZfEDrhOx0J6v58cyzbFwMwOWFY+Jx2HhYlIwQ8pQ== X-Received: by 2002:a05:600c:548b:b0:3cf:b0e4:30d9 with SMTP id iv11-20020a05600c548b00b003cfb0e430d9mr31311024wmb.66.1669653531905; Mon, 28 Nov 2022 08:38:51 -0800 (PST) X-Google-Smtp-Source: AA0mqf4J8rQZUS/3yS5mtEYEbE9IeyCx14iT/kvzEqY8y9xl/vZCDkiLoxWezKQDKpftcSb3EinM+A== X-Received: by 2002:a05:600c:548b:b0:3cf:b0e4:30d9 with SMTP id iv11-20020a05600c548b00b003cfb0e430d9mr31311003wmb.66.1669653531624; Mon, 28 Nov 2022 08:38:51 -0800 (PST) Received: from canonical.com (net-93-65-52-3.cust.vodafonedsl.it. [93.65.52.3]) by smtp.gmail.com with ESMTPSA id m1-20020a056000024100b00228cbac7a25sm11016204wrz.64.2022.11.28.08.38.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Nov 2022 08:38:51 -0800 (PST) From: Paolo Pisati To: kernel-team@lists.ubuntu.com Subject: [PATCH 1/6] Documentation: amd-pstate: Add unit test introduction Date: Mon, 28 Nov 2022 17:38:43 +0100 Message-Id: <20221128163848.362359-2-paolo.pisati@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221128163848.362359-1-paolo.pisati@canonical.com> References: <20221128163848.362359-1-paolo.pisati@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Meng Li BugLink: https://bugs.launchpad.net/bugs/1998106 Introduce the AMD P-State unit test module design and implementation. It also talks about kselftest and how to use. Signed-off-by: Meng Li Acked-by: Huang Rui Reviewed-by: Shuah Khan Signed-off-by: Shuah Khan (cherry picked from commit 7fe3629729ce5466f865b75c506d7cb6223838ba) Signed-off-by: Paolo Pisati --- Documentation/admin-guide/pm/amd-pstate.rst | 76 +++++++++++++++++++++ 1 file changed, 76 insertions(+) diff --git a/Documentation/admin-guide/pm/amd-pstate.rst b/Documentation/admin-guide/pm/amd-pstate.rst index 83b58eb4ab4d..8f3d30c5a0d8 100644 --- a/Documentation/admin-guide/pm/amd-pstate.rst +++ b/Documentation/admin-guide/pm/amd-pstate.rst @@ -182,6 +182,7 @@ to the ``struct sugov_cpu`` that the utilization update belongs to. Then, ``amd-pstate`` updates the desired performance according to the CPU scheduler assigned. +.. _processor_support: Processor Support ======================= @@ -282,6 +283,8 @@ efficiency frequency management method on AMD processors. Kernel Module Options for ``amd-pstate`` ========================================= +.. _shared_mem: + ``shared_mem`` Use a module param (shared_mem) to enable related processors manually with **amd_pstate.shared_mem=1**. @@ -393,6 +396,76 @@ about part of the output. :: CPU_005 712 116384 39 49 166 0.7565 9645075 2214891 38431470 25.1 11.646 469 2.496 kworker/5:0-40 CPU_006 712 116408 39 49 166 0.6769 8950227 1839034 37192089 24.06 11.272 470 2.496 kworker/6:0-1264 +Unit Tests for amd-pstate +------------------------- + +``amd-pstate-ut`` is a test module for testing the ``amd-pstate`` driver. + + * It can help all users to verify their processor support (SBIOS/Firmware or Hardware). + + * Kernel can have a basic function test to avoid the kernel regression during the update. + + * We can introduce more functional or performance tests to align the result together, it will benefit power and performance scale optimization. + +1. Test case decriptions + + +---------+--------------------------------+------------------------------------------------------------------------------------+ + | Index | Functions | Description | + +=========+================================+====================================================================================+ + | 0 | amd_pstate_ut_acpi_cpc_valid || Check whether the _CPC object is present in SBIOS. | + | | || | + | | || The detail refer to `Processor Support `_. | + +---------+--------------------------------+------------------------------------------------------------------------------------+ + | 1 | amd_pstate_ut_check_enabled || Check whether AMD P-State is enabled. | + | | || | + | | || AMD P-States and ACPI hardware P-States always can be supported in one processor. | + | | | But AMD P-States has the higher priority and if it is enabled with | + | | | :c:macro:`MSR_AMD_CPPC_ENABLE` or ``cppc_set_enable``, it will respond to the | + | | | request from AMD P-States. | + +---------+--------------------------------+------------------------------------------------------------------------------------+ + | 2 | amd_pstate_ut_check_perf || Check if the each performance values are reasonable. | + | | || highest_perf >= nominal_perf > lowest_nonlinear_perf > lowest_perf > 0. | + +---------+--------------------------------+------------------------------------------------------------------------------------+ + | 3 | amd_pstate_ut_check_freq || Check if the each frequency values and max freq when set support boost mode | + | | | are reasonable. | + | | || max_freq >= nominal_freq > lowest_nonlinear_freq > min_freq > 0 | + | | || If boost is not active but supported, this maximum frequency will be larger than | + | | | the one in ``cpuinfo``. | + +---------+--------------------------------+------------------------------------------------------------------------------------+ + +#. How to execute the tests + + We use test module in the kselftest frameworks to implement it. + We create amd-pstate-ut module and tie it into kselftest.(for + details refer to Linux Kernel Selftests [4]_). + + 1. Build + + + open the :c:macro:`CONFIG_X86_AMD_PSTATE` configuration option. + + set the :c:macro:`CONFIG_X86_AMD_PSTATE_UT` configuration option to M. + + make project + + make selftest :: + + $ cd linux + $ make -C tools/testing/selftests + + #. Installation & Steps :: + + $ make -C tools/testing/selftests install INSTALL_PATH=~/kselftest + $ sudo ./kselftest/run_kselftest.sh -c amd-pstate + TAP version 13 + 1..1 + # selftests: amd-pstate: amd-pstate-ut.sh + # amd-pstate-ut: ok + ok 1 selftests: amd-pstate: amd-pstate-ut.sh + + #. Results :: + + $ dmesg | grep "amd_pstate_ut" | tee log.txt + [12977.570663] amd_pstate_ut: 1 amd_pstate_ut_acpi_cpc_valid success! + [12977.570673] amd_pstate_ut: 2 amd_pstate_ut_check_enabled success! + [12977.571207] amd_pstate_ut: 3 amd_pstate_ut_check_perf success! + [12977.571212] amd_pstate_ut: 4 amd_pstate_ut_check_freq success! Reference =========== @@ -405,3 +478,6 @@ Reference .. [3] Processor Programming Reference (PPR) for AMD Family 19h Model 51h, Revision A1 Processors https://www.amd.com/system/files/TechDocs/56569-A1-PUB.zip + +.. [4] Linux Kernel Selftests, + https://www.kernel.org/doc/html/latest/dev-tools/kselftest.html From patchwork Mon Nov 28 16:38:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Pisati X-Patchwork-Id: 1709868 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=etcOh5aH; dkim-atps=neutral Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4NLWQ20DnMz23mg for ; Tue, 29 Nov 2022 03:39:06 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1ozh9l-0004bI-Cp; Mon, 28 Nov 2022 16:38:57 +0000 Received: from smtp-relay-internal-1.internal ([10.131.114.114] helo=smtp-relay-internal-1.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1ozh9j-0004Ze-Sh for kernel-team@lists.ubuntu.com; Mon, 28 Nov 2022 16:38:55 +0000 Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id D5E013F04C for ; Mon, 28 Nov 2022 16:38:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1669653533; bh=klMhPDzbx6LQiXuW6JtPWu5huidi0uFoZAndvKX2u0I=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=etcOh5aHVSMoalvZUmczNUToKZb3Hjtz+Wpz6cwWAJt5sG7nHohqRg6uTgFQjfE0I FYwqhCe2sixAlN8zxmLKxYPfrexw0uLtIMDtu/nB9xqdvb8hYqhOUFxxkoOuEPXgLp /dBqMl0uocrkzgtCKka794oXleYSx1bXh2oxCAdFKn9PuFmIiGztK2tLkjuNRIu3kS 8fwjNz8Wn2FuaQqFz6U5oYBDc60ZHDf4kGJloAz/6jVHvVNKayIhQKiYNYHKa0khaY AsVF0xvOStj2XuLSpAY24c6toy+ZMXQszv2nBgAXsInhASHLp50I8yrScgdva7Kd+P oLlO9KqQ4DM5g== Received: by mail-wr1-f72.google.com with SMTP id t12-20020adfa2cc000000b0022adcbb248bso2118168wra.1 for ; Mon, 28 Nov 2022 08:38:53 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=klMhPDzbx6LQiXuW6JtPWu5huidi0uFoZAndvKX2u0I=; b=z1Baqf/qH8qoUmvLcjOLnk2VXT+s8Ss1E0xUkFFiKVgDY9C+wAM8B8mKLLy5dtwK/R /TEN7Pt//69xWCNIGIheozp6m2tmB+WSx7o3LuH/hR2USlAJnV8C9LIfslNnqbtOxpqR s9/VmQ9k+AHLGTr6iL9gMsU4NgPDk2AeY7TTcTAcj2jqcp8A6rTn0tfZDHeDgU6xjHTM ANkLT+JLJ+huvXXogH0pR6l55cQ8hTuF1TI25ye0effTvaKzyL0Jpy1SSwNiAdg24Arv O1mqNjaLSuWJwNLoGknNNxg/f4SZRonMY4Uu/Zxm+gDYZKs6QrrCNtTAY6eVmjdoHWnn sjRw== X-Gm-Message-State: ANoB5pm5myHR7ENObivnY1u1X5Tr7chukz8KyeGEQIHTQqW+Kqm17AQr akt5WKyHBGKhTJG8UvGp1wMpxAx1EsLQa6NaQ5asorUxv5blOuYC+THxOp6EC8ugEa5/DaiYtDl 6sn3/a5xcK8FRqBD2U+pL2DFm9ga2N/YAOhLYgsiZUw== X-Received: by 2002:a05:600c:20b:b0:3cf:f2aa:4f24 with SMTP id 11-20020a05600c020b00b003cff2aa4f24mr37287335wmi.48.1669653533172; Mon, 28 Nov 2022 08:38:53 -0800 (PST) X-Google-Smtp-Source: AA0mqf7Db5UASs8udTAotyPxwRpTahvowfAL8R1fh+2sNQ70fFI3aEeodqFW++wQVj/MSJi/tlsu7Q== X-Received: by 2002:a05:600c:20b:b0:3cf:f2aa:4f24 with SMTP id 11-20020a05600c020b00b003cff2aa4f24mr37287324wmi.48.1669653532904; Mon, 28 Nov 2022 08:38:52 -0800 (PST) Received: from canonical.com (net-93-65-52-3.cust.vodafonedsl.it. [93.65.52.3]) by smtp.gmail.com with ESMTPSA id p9-20020adfce09000000b0022dc6e76bbdsm11231296wrn.46.2022.11.28.08.38.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Nov 2022 08:38:52 -0800 (PST) From: Paolo Pisati To: kernel-team@lists.ubuntu.com Subject: [PATCH 2/6] cpufreq: amd-pstate: cpufreq: amd-pstate: reset MSR_AMD_PERF_CTL register at init Date: Mon, 28 Nov 2022 17:38:44 +0100 Message-Id: <20221128163848.362359-3-paolo.pisati@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221128163848.362359-1-paolo.pisati@canonical.com> References: <20221128163848.362359-1-paolo.pisati@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Wyes Karny BugLink: https://bugs.launchpad.net/bugs/1998106 MSR_AMD_PERF_CTL is guaranteed to be 0 on a cold boot. However, on a kexec boot, for instance, it may have a non-zero value (if the cpu was in a non-P0 Pstate). In such cases, the cores with non-P0 Pstates at boot will never be pushed to P0, let alone boost frequencies. Kexec is a common workflow for reboot on Linux and this creates a regression in performance. Fix it by explicitly setting the MSR_AMD_PERF_CTL to 0 during amd_pstate driver init. Cc: All applicable Acked-by: Huang Rui Reviewed-by: Gautham R. Shenoy Tested-by: Wyes Karny Signed-off-by: Wyes Karny Signed-off-by: Perry Yuan Signed-off-by: Rafael J. Wysocki (cherry picked from commit 919f4557696939625085435ebde09a539de2349c) Signed-off-by: Paolo Pisati --- drivers/cpufreq/amd-pstate.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c index d63a28c5f95a..3147a53bd3a6 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -483,12 +483,22 @@ static void amd_pstate_boost_init(struct amd_cpudata *cpudata) amd_pstate_driver.boost_enabled = true; } +static void amd_perf_ctl_reset(unsigned int cpu) +{ + wrmsrl_on_cpu(cpu, MSR_AMD_PERF_CTL, 0); +} + static int amd_pstate_cpu_init(struct cpufreq_policy *policy) { int min_freq, max_freq, nominal_freq, lowest_nonlinear_freq, ret; struct device *dev; struct amd_cpudata *cpudata; + /* + * Resetting PERF_CTL_MSR will put the CPU in P0 frequency, + * which is ideal for initialization process. + */ + amd_perf_ctl_reset(policy->cpu); dev = get_cpu_device(policy->cpu); if (!dev) return -ENODEV; From patchwork Mon Nov 28 16:38:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Pisati X-Patchwork-Id: 1709870 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=g1yMeq4S; dkim-atps=neutral Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4NLWQ51gfKz23mg for ; Tue, 29 Nov 2022 03:39:09 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1ozh9o-0004ef-9d; Mon, 28 Nov 2022 16:39:00 +0000 Received: from smtp-relay-internal-0.internal ([10.131.114.225] helo=smtp-relay-internal-0.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1ozh9j-0004Za-Hn for kernel-team@lists.ubuntu.com; Mon, 28 Nov 2022 16:38:55 +0000 Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id C8BCD3F120 for ; Mon, 28 Nov 2022 16:38:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1669653534; bh=1XpZW1BceFWZO5j9f4QNnRxPqZRP7eYWE2+ghPYgci0=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=g1yMeq4SYfBslL2MDKHt02EYvVtPLFU8qzvDDULmLBQ0Bjj+gdw8gU5vL3rquPy9p FAN3BdQs7xzbA8yaiTO8mHKVfzbebRfSdAC1qbcmRkocOd1Nx9tiIDigjiWHYJx+a9 coLfDf2Esf4acAY5zUuMB2ACjjO0p+2f6OdAA95HSi1SebVcxtIQ5Qjp+zyma6L69/ O/+62TJpTHKcLYCHmbfcSlf5HWlGnmPEsErZ0f28HVKDkkVSZfORJFOSe4ptLcKo6c YHvGh12dHBWv7T4R6wp7Jvf9f0VIEb8NMOnXI4Yqq5yeVFsRN52UiVyWqLonpCYXJ0 78bZBc01ZHtNA== Received: by mail-wm1-f70.google.com with SMTP id o5-20020a05600c510500b003cfca1a327fso6492099wms.8 for ; Mon, 28 Nov 2022 08:38:54 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1XpZW1BceFWZO5j9f4QNnRxPqZRP7eYWE2+ghPYgci0=; b=T4OP1P6iVI0xK1tB3W4J9B0AzP3zyKZyYAoiv327jfGRtvk+u6aP/WB1f8SIDu9O9I PXZN5yXbpFtsAOTKSzXuUIalQTZclS/BG2aTjYJdgkfq5gnV/COHilWRYS9K6RkEloJ0 nBC7oHoIPXDtWg+ND06BwxZHic/2NcPEEobKgsNZ0S062c12ZQWN3LV5FAffuraZpkLV rFvRaJritJCXHMytWd4YhfjtmQUk4ZjYvlbP/lb8W5wvErYk0NgHPHY6hZm5mTCvYcaK MT89Hs4GV8+M0zxKEP4ZPisiA4qBpbmdh2kQRU5oOozTpfvpgiob22UWR9RoojMBLmiI uOYA== X-Gm-Message-State: ANoB5pljMr5qTgoV0Ihns5+CRE6fD9oHAktPi/w/ZyZARieK8aarvv8j scZEtTHAWLYPFziL+XUnEDCZtZVldQhYYIsvuGgCm69m2Qzcuo3dRd19lrOtbn7S27xh7cNyqLq Rep3wNE7H6dEJeHcfAeKAlXCSgE9xQt6YRejKmtmW1g== X-Received: by 2002:a05:600c:4f05:b0:3d0:3d33:a629 with SMTP id l5-20020a05600c4f0500b003d03d33a629mr15365688wmq.126.1669653534226; Mon, 28 Nov 2022 08:38:54 -0800 (PST) X-Google-Smtp-Source: AA0mqf6nqHuawGdVlBdfK18zZG2kuN5m5RS0A7+O/ygQ+xH7AnOKqi6J6+kJnILcx4WrSN8uEHIjwA== X-Received: by 2002:a05:600c:4f05:b0:3d0:3d33:a629 with SMTP id l5-20020a05600c4f0500b003d03d33a629mr15365681wmq.126.1669653534028; Mon, 28 Nov 2022 08:38:54 -0800 (PST) Received: from canonical.com (net-93-65-52-3.cust.vodafonedsl.it. [93.65.52.3]) by smtp.gmail.com with ESMTPSA id h16-20020a05600c315000b003cfb7c02542sm16463257wmo.11.2022.11.28.08.38.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Nov 2022 08:38:53 -0800 (PST) From: Paolo Pisati To: kernel-team@lists.ubuntu.com Subject: [PATCH 3/6] cpufreq: amd-pstate: change amd-pstate driver to be built-in type Date: Mon, 28 Nov 2022 17:38:45 +0100 Message-Id: <20221128163848.362359-4-paolo.pisati@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221128163848.362359-1-paolo.pisati@canonical.com> References: <20221128163848.362359-1-paolo.pisati@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Perry Yuan BugLink: https://bugs.launchpad.net/bugs/1998106 Currently when the amd-pstate and acpi_cpufreq are both built into kernel as module driver, amd-pstate will not be loaded by default in this case. Change amd-pstate driver as built-in type, it will resolve the loading sequence problem to allow user to make amd-pstate driver as the default cpufreq scaling driver. Acked-by: Huang Rui Reviewed-by: Gautham R. Shenoy Tested-by: Wyes Karny Signed-off-by: Perry Yuan Fixes: ec437d71db77 ("cpufreq: amd-pstate: Introduce a new AMD P-State driver to support future processors") Signed-off-by: Rafael J. Wysocki (cherry picked from commit 456ca88d8a5258fc66edc42a10053ac8473de2b1) Signed-off-by: Paolo Pisati --- drivers/cpufreq/Kconfig.x86 | 2 +- drivers/cpufreq/amd-pstate.c | 11 +---------- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/drivers/cpufreq/Kconfig.x86 b/drivers/cpufreq/Kconfig.x86 index 55516043b656..8184378f67ef 100644 --- a/drivers/cpufreq/Kconfig.x86 +++ b/drivers/cpufreq/Kconfig.x86 @@ -35,7 +35,7 @@ config X86_PCC_CPUFREQ If in doubt, say N. config X86_AMD_PSTATE - tristate "AMD Processor P-State driver" + bool "AMD Processor P-State driver" depends on X86 && ACPI select ACPI_PROCESSOR select ACPI_CPPC_LIB if X86_64 diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c index 3147a53bd3a6..5b788492ce5e 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -728,16 +728,7 @@ static int __init amd_pstate_init(void) return ret; } - -static void __exit amd_pstate_exit(void) -{ - cpufreq_unregister_driver(&amd_pstate_driver); - - amd_pstate_enable(false); -} - -module_init(amd_pstate_init); -module_exit(amd_pstate_exit); +device_initcall(amd_pstate_init); MODULE_AUTHOR("Huang Rui "); MODULE_DESCRIPTION("AMD Processor P-state Frequency Driver"); From patchwork Mon Nov 28 16:38:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Pisati X-Patchwork-Id: 1709869 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=FUS1m77d; dkim-atps=neutral Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4NLWQ21BkPz23nq for ; Tue, 29 Nov 2022 03:39:06 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1ozh9m-0004cs-RW; Mon, 28 Nov 2022 16:38:58 +0000 Received: from smtp-relay-internal-1.internal ([10.131.114.114] helo=smtp-relay-internal-1.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1ozh9k-0004ai-Lv for kernel-team@lists.ubuntu.com; Mon, 28 Nov 2022 16:38:56 +0000 Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id E7EB03F04C for ; Mon, 28 Nov 2022 16:38:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1669653535; bh=jt3EGVSR7mtHTrvlfUD0Tu3035JL24pQssPHw910Urs=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=FUS1m77d/W5ZfkaWg7VsCkXsXAirp3S2ODc0BqtLV6z4ouexkCdqB6ljKCHNlQzyp FpUvj/tM3VjebbT3aYrx0Kk5v1oZawxIBtc/EYJxwSebj8osbYwlv6zP959x3tZjRM o+ltOS91Eni3XtUn2bhZ4yXSiUfXq00jHmdbZDB8pxDfEOd0wiIoaEpWSbWgSd110u WuobynR0xsoj2PpzFgg9af/L80NkNLGWBW33rbUbvCyhHPC7PJNJvwbxxK16yEuE8T WOiJ5SHbeqoWhYM9rEjvFjDlEC6z6o3QiRm5F9Lg84GSi5MK0rpi6cznQsZF2GO8wZ glExVkXW+PdiA== Received: by mail-wm1-f69.google.com with SMTP id 8-20020a05600c228800b003d0376e42deso3897189wmf.4 for ; Mon, 28 Nov 2022 08:38:55 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jt3EGVSR7mtHTrvlfUD0Tu3035JL24pQssPHw910Urs=; b=PRIHXjFPWEekMq6UX+P/QDW3fIy+OzkvCDLhQf1duJTvIppQMO2ahldFI9Gs18QMOT OBZhyA+5pDnUUDsrcxgm0cA1cpKgaODy+VMgLEsyJqOC+drZRTA+0MiRcI7ur4X3am8h 8JQThjwuT0Snen6eF/LtyiKVDtY1PFnf4tcZBpTQmWmPd1UwLSJmzQGWAlI2baXHEWgG fn4IL73jgl4/EFYLj61mpNqEGY8xKwFhilBThj33AzSArGWYcxAmLL7SFe7rMNeR8Ze4 T7QS5omvldisSnclux8IpbeiocJrYkYM2/v5Ghx5YhFssbSm5iFO15neTdvwXaYHNT/2 5qnQ== X-Gm-Message-State: ANoB5pmghY+Vq6VrQInez6ncRWkbz3V4a/mcUhV/dmN0Tet0u43HBRQe xujTjFmIl1eq3SVRF/UmBvNdZJ7mrIwMn7ndpgsIajDYjVJtTA09sbMb5XvjMNkBF1alndcthsL PwfFgEUDgTHTHj8dMjYRujeDAqKfVFRjvMQW7Iforiw== X-Received: by 2002:a1c:ed17:0:b0:3cf:cfce:9d9e with SMTP id l23-20020a1ced17000000b003cfcfce9d9emr26283244wmh.66.1669653535350; Mon, 28 Nov 2022 08:38:55 -0800 (PST) X-Google-Smtp-Source: AA0mqf4qg80D0A8ZIlRSt4JRW4/HP29XiD8OuENaknsM3996dWYA7p4zKOfstp4i6AG0E+OfugBn9A== X-Received: by 2002:a1c:ed17:0:b0:3cf:cfce:9d9e with SMTP id l23-20020a1ced17000000b003cfcfce9d9emr26283227wmh.66.1669653535093; Mon, 28 Nov 2022 08:38:55 -0800 (PST) Received: from canonical.com (net-93-65-52-3.cust.vodafonedsl.it. [93.65.52.3]) by smtp.gmail.com with ESMTPSA id a4-20020adffac4000000b002420a2cdc96sm7581672wrs.70.2022.11.28.08.38.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Nov 2022 08:38:54 -0800 (PST) From: Paolo Pisati To: kernel-team@lists.ubuntu.com Subject: [PATCH 4/6] cpufreq: amd-pstate: add amd-pstate driver parameter for mode selection Date: Mon, 28 Nov 2022 17:38:46 +0100 Message-Id: <20221128163848.362359-5-paolo.pisati@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221128163848.362359-1-paolo.pisati@canonical.com> References: <20221128163848.362359-1-paolo.pisati@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Perry Yuan BugLink: https://bugs.launchpad.net/bugs/1998106 When the amd_pstate driver is built-in users still need a method to be able enable or disable it depending upon their circumstance. Add support for an early parameter to do this. There is some performance degradation on a number of ASICs in the passive mode. This performance issue was originally discovered in shared memory systems but it has been proven that certain workloads on MSR systems also suffer performance issues. Set the amd-pstate driver as disabled by default to temporarily mitigate the performance problem. 1) with `amd_pstate=disable`, pstate driver will be disabled to load at kernel booting. 2) with `amd_pstate=passive`, pstate driver will be enabled and loaded as non-autonomous working mode supported in the low-level power management firmware. 3) If neither parameter is specified, the driver will be disabled by default to avoid triggering performance regressions in certain ASICs Acked-by: Huang Rui Reviewed-by: Gautham R. Shenoy Tested-by: Wyes Karny Signed-off-by: Perry Yuan Signed-off-by: Rafael J. Wysocki (cherry picked from commit 202e683df37cdf4c38e06e56ac91cc170ef49058) Signed-off-by: Paolo Pisati --- drivers/cpufreq/amd-pstate.c | 36 +++++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c index 5b788492ce5e..3101a0c47a76 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -58,12 +58,8 @@ * we disable it by default to go acpi-cpufreq on these processors and add a * module parameter to be able to enable it manually for debugging. */ -static bool shared_mem = false; -module_param(shared_mem, bool, 0444); -MODULE_PARM_DESC(shared_mem, - "enable amd-pstate on processors with shared memory solution (false = disabled (default), true = enabled)"); - static struct cpufreq_driver amd_pstate_driver; +static int cppc_load __initdata; /** * struct amd_aperf_mperf @@ -691,6 +687,15 @@ static int __init amd_pstate_init(void) if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD) return -ENODEV; + /* + * by default the pstate driver is disabled to load + * enable the amd_pstate passive mode driver explicitly + * with amd_pstate=passive in kernel command line + */ + if (!cppc_load) { + pr_debug("driver load is disabled, boot with amd_pstate=passive to enable this\n"); + return -ENODEV; + } if (!acpi_cpc_valid()) { pr_debug("the _CPC object is not present in SBIOS\n"); @@ -705,13 +710,11 @@ static int __init amd_pstate_init(void) if (boot_cpu_has(X86_FEATURE_CPPC)) { pr_debug("AMD CPPC MSR based functionality is supported\n"); amd_pstate_driver.adjust_perf = amd_pstate_adjust_perf; - } else if (shared_mem) { + } else { + pr_debug("AMD CPPC shared memory based functionality is supported\n"); static_call_update(amd_pstate_enable, cppc_enable); static_call_update(amd_pstate_init_perf, cppc_init_perf); static_call_update(amd_pstate_update_perf, cppc_update_perf); - } else { - pr_info("This processor supports shared memory solution, you can enable it with amd_pstate.shared_mem=1\n"); - return -ENODEV; } /* enable amd pstate feature */ @@ -730,6 +733,21 @@ static int __init amd_pstate_init(void) } device_initcall(amd_pstate_init); +static int __init amd_pstate_param(char *str) +{ + if (!str) + return -EINVAL; + + if (!strcmp(str, "disable")) { + cppc_load = 0; + pr_info("driver is explicitly disabled\n"); + } else if (!strcmp(str, "passive")) + cppc_load = 1; + + return 0; +} +early_param("amd_pstate", amd_pstate_param); + MODULE_AUTHOR("Huang Rui "); MODULE_DESCRIPTION("AMD Processor P-state Frequency Driver"); MODULE_LICENSE("GPL"); From patchwork Mon Nov 28 16:38:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Pisati X-Patchwork-Id: 1709871 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=wXUhnRgw; dkim-atps=neutral Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4NLWQ849ZVz23mg for ; Tue, 29 Nov 2022 03:39:12 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1ozh9s-0004jS-Ey; Mon, 28 Nov 2022 16:39:04 +0000 Received: from smtp-relay-internal-1.internal ([10.131.114.114] helo=smtp-relay-internal-1.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1ozh9l-0004bD-BQ for kernel-team@lists.ubuntu.com; Mon, 28 Nov 2022 16:38:57 +0000 Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id 0EA2F3F04C for ; Mon, 28 Nov 2022 16:38:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1669653537; bh=LonQPqpFTthbvTcgSn7Wq2MmpQbagkMIWI6xh7ssTiA=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=wXUhnRgwAydXp/iKpavuEK+mZaJ2lxSDk82uNKLZx8pcJWxAstCteNclSS7UUGZlZ qoYUmkIq5CZpm8YaG4lIrOgxwAma7KpqkyP9/zWdseEHe0UCXZWsPnEpmi1V/OfRM6 5ZvNnU0JqNpstnmqcKHnYONEx1gymWDaDDf3GrJuATVG7tDuSfuDfNYOqI3N/qC6yQ HyPl2EAdoDjhH7o8+v17tiA7fdE6oER7UB8RSk9LuBABQY/GenHO5y7GgxQbCDcEi2 q7hpsGUhpcf35xWNCsufekbz1PgzHcdqPPDbp+4lhXqaViEIuQWYwk2P2PIWfvImP3 sFDhgi88urjhQ== Received: by mail-wm1-f72.google.com with SMTP id 1-20020a05600c028100b003cf7833293cso8825114wmk.3 for ; Mon, 28 Nov 2022 08:38:57 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LonQPqpFTthbvTcgSn7Wq2MmpQbagkMIWI6xh7ssTiA=; b=pfinsSaIZFSqcadnngk/em04nLEqGbmT4/jhYSDoUeZdcc5PTkPkQMesWkDrta5lNB ZhM6Tobw2YcZAI5BkO2pQ8rfKc5B3QvPgnUdnSF2ID/gYF/qO924A5cdrR81dlOHE1H4 YLAMeyFT3TxaK7lmPVPO7zzVGYAoVdrGqHZ72ceQaFwX9uhEC2NG/Y6yozU5++oFhG9Z M++MXs4pz+Cs6wcDTk39glSVPKecdi4aN3bG9DmGOCf2+YGvXZAVZ6si92vv2NqXwzgR VCIl/w0yWycRPwTIcm3MuKrWqqS2qrNyR0xj67HyGUuYxSqQaE4vbU+P85qWF/XXIf+t jz9A== X-Gm-Message-State: ANoB5pmDKQNHrNUFv114jkitkhIWsIvVjmEogBAbZriu+bhyucORPwVL v6cHX7VV1VR9s1AgRdwVZZyuLYQL00ISf+LHk8GM0U5YWXusaGPa+zQgPsBSDLBnwoF8FrDNN5C /6SSuqSb0X+PHWLUO81X/Had5NTg+o9JXSwc+/IZmwQ== X-Received: by 2002:adf:db10:0:b0:236:58c8:2ba2 with SMTP id s16-20020adfdb10000000b0023658c82ba2mr31521218wri.224.1669653536490; Mon, 28 Nov 2022 08:38:56 -0800 (PST) X-Google-Smtp-Source: AA0mqf52yMU+p8pGwvvf7dXaHsazooH4RaiZpSVVkYd/0OUtOLnLvnI+5uuYrltq8QKeyFt8ksPblg== X-Received: by 2002:adf:db10:0:b0:236:58c8:2ba2 with SMTP id s16-20020adfdb10000000b0023658c82ba2mr31521204wri.224.1669653536171; Mon, 28 Nov 2022 08:38:56 -0800 (PST) Received: from canonical.com (net-93-65-52-3.cust.vodafonedsl.it. [93.65.52.3]) by smtp.gmail.com with ESMTPSA id p16-20020a05600c1d9000b003b3307fb98fsm15305055wms.24.2022.11.28.08.38.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Nov 2022 08:38:55 -0800 (PST) From: Paolo Pisati To: kernel-team@lists.ubuntu.com Subject: [PATCH 5/6] Documentation: amd-pstate: add driver working mode introduction Date: Mon, 28 Nov 2022 17:38:47 +0100 Message-Id: <20221128163848.362359-6-paolo.pisati@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221128163848.362359-1-paolo.pisati@canonical.com> References: <20221128163848.362359-1-paolo.pisati@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Perry Yuan BugLink: https://bugs.launchpad.net/bugs/1998106 Introduce the `amd_pstate` driver new working mode with `amd_pstate=passive` added to kernel command line. If there is no passive mode enabled by user, amd_pstate driver will be disabled by default for now. Acked-by: Huang Rui Reviewed-by: Gautham R. Shenoy Tested-by: Wyes Karny Signed-off-by: Perry Yuan Signed-off-by: Rafael J. Wysocki (cherry picked from commit 8a2cbf72a43ade1ed00760f65914e322599fe662) Signed-off-by: Paolo Pisati --- Documentation/admin-guide/pm/amd-pstate.rst | 30 +++++++++------------ 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/Documentation/admin-guide/pm/amd-pstate.rst b/Documentation/admin-guide/pm/amd-pstate.rst index 8f3d30c5a0d8..06e23538f79c 100644 --- a/Documentation/admin-guide/pm/amd-pstate.rst +++ b/Documentation/admin-guide/pm/amd-pstate.rst @@ -283,23 +283,19 @@ efficiency frequency management method on AMD processors. Kernel Module Options for ``amd-pstate`` ========================================= -.. _shared_mem: - -``shared_mem`` -Use a module param (shared_mem) to enable related processors manually with -**amd_pstate.shared_mem=1**. -Due to the performance issue on the processors with `Shared Memory Support -`_, we disable it presently and will re-enable this by default -once we address performance issue with this solution. - -To check whether the current processor is using `Full MSR Support `_ -or `Shared Memory Support `_ : :: - - ray@hr-test1:~$ lscpu | grep cppc - Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid aperfmperf rapl pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb cat_l3 cdp_l3 hw_pstate ssbd mba ibrs ibpb stibp vmmcall fsgsbase bmi1 avx2 smep bmi2 erms invpcid cqm rdt_a rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local clzero irperf xsaveerptr rdpru wbnoinvd cppc arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif v_spec_ctrl umip pku ospke vaes vpclmulqdq rdpid overflow_recov succor smca fsrm - -If the CPU flags have ``cppc``, then this processor supports `Full MSR Support -`_. Otherwise, it supports `Shared Memory Support `_. +Passive Mode +------------ + +``amd_pstate=passive`` + +It will be enabled if the ``amd_pstate=passive`` is passed to the kernel in the command line. +In this mode, ``amd_pstate`` driver software specifies a desired QoS target in the CPPC +performance scale as a relative number. This can be expressed as percentage of nominal +performance (infrastructure max). Below the nominal sustained performance level, +desired performance expresses the average performance level of the processor subject +to the Performance Reduction Tolerance register. Above the nominal performance level, +processor must provide at least nominal performance requested and go higher if current +operating conditions allow. ``cpupower`` tool support for ``amd-pstate`` From patchwork Mon Nov 28 16:38:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Pisati X-Patchwork-Id: 1709872 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=mih6kKCI; dkim-atps=neutral Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4NLWQC2Fvgz23mg for ; Tue, 29 Nov 2022 03:39:15 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1ozh9v-0004og-Mu; Mon, 28 Nov 2022 16:39:07 +0000 Received: from smtp-relay-internal-1.internal ([10.131.114.114] helo=smtp-relay-internal-1.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1ozh9m-0004cr-RN for kernel-team@lists.ubuntu.com; Mon, 28 Nov 2022 16:38:58 +0000 Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id 2E9F83F04C for ; Mon, 28 Nov 2022 16:38:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1669653538; bh=URfXV4tMxMekIP5Pw57J9q0pVrqkkgYQ+tqRAM8eGsE=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=mih6kKCIx9ylMxed8Ydml18J9Bsp4+mBGBlBM8vv4Dx3PvI5aagE4HBivB0YS/fre 0L8afw/S80lYt7kpXlkk/Z8nLPB2QKYRpCI0FFLt0utcV4dKgtGLUfGxhv5mJ0IsHu hWf8NQOpeMVzZGpUJuhxSPNvhJFUfPYlEN1RVaulVpZpE198rCnOYZJRCX5pun0rzQ JcSDiH+2VP2/kZk9t3U7SLli7j1LX8OjieKSVgLzlkqUM5+ypJMoAyLmhCd+Tq8dVs fgmPp5J7wYYrMARVn8krdbLfzLxLtFuwAYbZJx7bLqM+S3i2t5fqbTHnKfgOdNXike 39IwXbbyji36Q== Received: by mail-wm1-f69.google.com with SMTP id 83-20020a1c0256000000b003d05a7cfe00so1885372wmc.6 for ; Mon, 28 Nov 2022 08:38:58 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=URfXV4tMxMekIP5Pw57J9q0pVrqkkgYQ+tqRAM8eGsE=; b=Ku8Vhn1krF+cShg6yxDRNwXUg+p6ey0Me/TELnEdpmBe+VvsDP1pCMuDuQrNEexffb ZbVQ1hLZsdbgyfirjy7afJhm9oChieRHgYHawrZWsgdUId8I2NZkU9s/aOYoaFpDyIDW TqFoS7r1j+HAQY8Ofg71zjLEDAO6nTlXZs9LsP6gdkRJOD5pShnTBAebrqkmzHqcLKEY 19CiRqrF71+qtRGitow1J3eYVoTicxAaNE2ttWPb7wgpldv4HvkPmo/VOy6AXYP5yqhP l6F42Koph0mszYSaGVzrI6wiu1fYCICluDm7MXqer5ePjqrVbEcwvrt+XbNQ5/Y+UuBg 0kFw== X-Gm-Message-State: ANoB5pkudISjLWB7twm3IweFUFZ7HX5LUoRXNCypgIjV6a1Yp1BYWxdL JAny0JYZolxReAnp22ruFXotJ4jXYkygYrrZQ/Al7dYJrLP5kdu7tDshcGLr4IRj1mAsPB/QiaQ MZAMdFYVgUt874+wpk44qcJ4OtRZp8ESeQgpgDgDm/A== X-Received: by 2002:adf:e6c8:0:b0:242:18c4:694e with SMTP id y8-20020adfe6c8000000b0024218c4694emr3178278wrm.175.1669653537559; Mon, 28 Nov 2022 08:38:57 -0800 (PST) X-Google-Smtp-Source: AA0mqf752b1zTSbrXG/1EB/ArG1YsFKWVrscHo7Avrnt2EHJ1wLk7IqTCOKj7IMAl1t8jTP4Cu331g== X-Received: by 2002:adf:e6c8:0:b0:242:18c4:694e with SMTP id y8-20020adfe6c8000000b0024218c4694emr3178270wrm.175.1669653537310; Mon, 28 Nov 2022 08:38:57 -0800 (PST) Received: from canonical.com (net-93-65-52-3.cust.vodafonedsl.it. [93.65.52.3]) by smtp.gmail.com with ESMTPSA id o13-20020a05600c4fcd00b003cfa26c410asm21311587wmq.20.2022.11.28.08.38.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Nov 2022 08:38:57 -0800 (PST) From: Paolo Pisati To: kernel-team@lists.ubuntu.com Subject: [PATCH 6/6] Documentation: add amd-pstate kernel command line options Date: Mon, 28 Nov 2022 17:38:48 +0100 Message-Id: <20221128163848.362359-7-paolo.pisati@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221128163848.362359-1-paolo.pisati@canonical.com> References: <20221128163848.362359-1-paolo.pisati@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Perry Yuan BugLink: https://bugs.launchpad.net/bugs/1998106 Add a new amd pstate driver command line option to enable driver passive working mode via MSR and shared memory interface to request desired performance within abstract scale and the power management firmware (SMU) convert the perf requests into actual hardware pstates. Also the `disable` parameter can disable the pstate driver loading by adding `amd_pstate=disable` to kernel command line. Acked-by: Huang Rui Reviewed-by: Gautham R. Shenoy Tested-by: Wyes Karny Signed-off-by: Perry Yuan Signed-off-by: Rafael J. Wysocki (cherry picked from commit 1056d314709d0607a22e589c54b1e47e0da57b9d) Signed-off-by: Paolo Pisati --- Documentation/admin-guide/kernel-parameters.txt | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index 18417e6e26d2..364f1d6f4be4 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -6878,3 +6878,14 @@ memory, and other data can't be written using xmon commands. off xmon is disabled. + + amd_pstate= [X86] + disable + Do not enable amd_pstate as the default + scaling driver for the supported processors + passive + Use amd_pstate as a scaling driver, driver requests a + desired performance on this abstract scale and the power + management firmware translates the requests into actual + hardware states (core frequency, data fabric and memory + clocks etc.)