From: "Gautham R. Shenoy" <gautham.shenoy@amd.com>
To: Mario Limonciello <mario.limonciello@amd.com>
Cc: Perry Yuan <perry.yuan@amd.com>,
linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org,
Dhananjay Ugwekar <Dhananjay.Ugwekar@amd.com>
Subject: Re: [PATCH v2 12/16] cpufreq/amd-pstate: Always write EPP value when updating perf
Date: Tue, 10 Dec 2024 16:40:11 +0530 [thread overview]
Message-ID: <Z1ghk3qDbeYVCs1Z@BLRRASHENOY1.amd.com> (raw)
In-Reply-To: <ca241dad-d11d-4145-8753-d5f18291bd65@amd.com>
On Mon, Dec 09, 2024 at 11:15:49AM -0600, Mario Limonciello wrote:
> On 12/9/2024 10:49, Mario Limonciello wrote:
> > On 12/9/2024 02:42, Gautham R. Shenoy wrote:
> > > Hello Mario,
> > >
> > > On Sun, Dec 08, 2024 at 12:30:27AM -0600, Mario Limonciello wrote:
> > > > For MSR systems the EPP value is in the same register as perf targets
> > > > and so divding them into two separate MSR writes is wasteful.
> > > >
> > > > In msr_update_perf(), update both EPP and perf values in one write to
> > > > MSR_AMD_CPPC_REQ, and cache them if successful.
> > > >
> > > > To accomplish this plumb the EPP value into the update_perf call
> > > > and modify
> > > > all its callers to check the return value.
> > > >
> > > > Reviewed-and-tested-by: Dhananjay Ugwekar <dhananjay.ugwekar@amd.com>
> > > > Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
> > > > ---
> > > > drivers/cpufreq/amd-pstate.c | 71 ++++++++++++++++++++++--------------
> > > > 1 file changed, 43 insertions(+), 28 deletions(-)
> > > >
> > > > diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
> > > > index d21acd961edcd..dd11ba6c00cc3 100644
> > > > --- a/drivers/cpufreq/amd-pstate.c
> > > > +++ b/drivers/cpufreq/amd-pstate.c
> > > > @@ -222,25 +222,36 @@ static s16 shmem_get_epp(struct
> > > > amd_cpudata *cpudata)
> > > > }
> > > > static int msr_update_perf(struct amd_cpudata *cpudata, u32 min_perf,
> > > > - u32 des_perf, u32 max_perf, bool fast_switch)
> > > > + u32 des_perf, u32 max_perf, u32 epp, bool fast_switch)
> > > > {
> > > > + u64 value;
> > > > +
> > > > + value = READ_ONCE(cpudata->cppc_req_cached);
> > >
> > >
> > > There seems to be a mismatch here between what the API is passing and
> > > parameters and how this function is *not* using them, and instead
> > > using cpudata->cppc_req_cached.
> > >
> > > The expectation seems to be that the max_perf, min_perf, des_perf and
> > > epp fields in cpudata->cppc_req_cached would be the same as @des_perf,
> > > @max_perf, @min_perf and @ep, no ?
> > >
> > > Or is it that for the MSR update, the value in
> > > cpudata->cppc_req_cached take precedence over the arguments passed ?
> > >
> > > Ideally, the "value" should be recomputed here using (@min_perf |
> > > @max_perf | @des_perf | @epp) and that value should be cached as you
> > > are doing below.
> > >
> >
> > Yeah - that's what the next patch does (which I think you probably saw
> > after you reviewed it).
> >
> > Do you think maybe I should just squash the two? Or would you be
> > happier if I re-ordered the two?
>
> FYI - I looked into re-ordering and it's not feasible because you need EPP
> plumbed in order to validate the result.
>
> So I'm going to squash the two patches, and I'll do another one that adjusts
> tracing locations for your other feedback.
Yeah, it is not possible to reorder the two. I like the newer version
better.
--
Thanks and Regards
gautham.
next prev parent reply other threads:[~2024-12-10 11:10 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-08 6:30 [PATCH v2 00/16] amd-pstate fixes and improvements for 6.14 Mario Limonciello
2024-12-08 6:30 ` [PATCH v2 01/16] cpufreq/amd-pstate: Store the boost numerator as highest perf again Mario Limonciello
2024-12-08 6:30 ` [PATCH v2 02/16] cpufreq/amd-pstate: Use boost numerator for upper bound of frequencies Mario Limonciello
2024-12-08 6:30 ` [PATCH v2 03/16] cpufreq/amd-pstate: Add trace event for EPP perf updates Mario Limonciello
2024-12-08 6:30 ` [PATCH v2 04/16] cpufreq/amd-pstate: convert mutex use to guard() Mario Limonciello
2024-12-08 6:30 ` [PATCH v2 05/16] cpufreq/amd-pstate: Drop cached epp_policy variable Mario Limonciello
2024-12-08 6:30 ` [PATCH v2 06/16] cpufreq/amd-pstate: Use FIELD_PREP and FIELD_GET macros Mario Limonciello
2024-12-08 6:30 ` [PATCH v2 07/16] cpufreq/amd-pstate: Only update the cached value in msr_set_epp() on success Mario Limonciello
2024-12-08 6:30 ` [PATCH v2 08/16] cpufreq/amd-pstate: store all values in cpudata struct in khz Mario Limonciello
2024-12-08 6:30 ` [PATCH v2 09/16] cpufreq/amd-pstate: Change amd_pstate_update_perf() to return an int Mario Limonciello
2024-12-08 6:30 ` [PATCH v2 10/16] cpufreq/amd-pstate: Move limit updating code Mario Limonciello
2024-12-08 6:30 ` [PATCH v2 11/16] cpufreq/amd-pstate: Cache EPP value and use that everywhere Mario Limonciello
2024-12-08 6:30 ` [PATCH v2 12/16] cpufreq/amd-pstate: Always write EPP value when updating perf Mario Limonciello
2024-12-09 8:42 ` Gautham R. Shenoy
2024-12-09 16:49 ` Mario Limonciello
2024-12-09 17:15 ` Mario Limonciello
2024-12-10 11:10 ` Gautham R. Shenoy [this message]
2024-12-08 6:30 ` [PATCH v2 13/16] cpufreq/amd-pstate: Check if CPPC request has changed before writing to the MSR or shared memory Mario Limonciello
2024-12-09 8:56 ` Gautham R. Shenoy
2024-12-09 16:41 ` Mario Limonciello
2024-12-08 6:30 ` [PATCH v2 14/16] cpufreq/amd-pstate: Drop ret variable from amd_pstate_set_energy_pref_index() Mario Limonciello
2024-12-09 9:25 ` Gautham R. Shenoy
2024-12-08 6:30 ` [PATCH v2 15/16] cpufreq/amd-pstate: Set different default EPP policy for Epyc and Ryzen Mario Limonciello
2024-12-09 9:27 ` Gautham R. Shenoy
2024-12-08 6:30 ` [PATCH v2 16/16] cpufreq/amd-pstate: Drop boost_state variable Mario Limonciello
2024-12-09 10:24 ` Gautham R. Shenoy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Z1ghk3qDbeYVCs1Z@BLRRASHENOY1.amd.com \
--to=gautham.shenoy@amd.com \
--cc=Dhananjay.Ugwekar@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=mario.limonciello@amd.com \
--cc=perry.yuan@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox