Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp64959rdb; Mon, 22 Jan 2024 12:04:18 -0800 (PST) X-Google-Smtp-Source: AGHT+IH5z4wyd63vJc8BOyeW8NtJSAiF/TLkiL/iksBSZHcu+VsfC0mr89y0BumIzwd2JKGy9yQr X-Received: by 2002:a17:902:7246:b0:1d5:f0d9:c979 with SMTP id c6-20020a170902724600b001d5f0d9c979mr2188482pll.2.1705953858286; Mon, 22 Jan 2024 12:04:18 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705953858; cv=pass; d=google.com; s=arc-20160816; b=nS5PdJL+Ct+MaAhxd+AiZQ9rvvWAH8o/nfCFv6t8XU4XDzrY8XLJF/VsSOHEnz6x9n 1je/h1wNOZfzjO3YpdjP8+9Pm31SBseSgWp02FzePyRU6dTgwaWiii2mdsrPoexdIES9 mFaDfIGV5Jw08zGNwTkX11ra/WkU5VQC03w6SLJgh/ZYxaPzzAtsj6IdIaZq9WU95Phm Qt3bZEyOqcYeRvWV9gv+iQjSgLZquuAdykjnCFlV9tpy3LNS3nqu98BuWx1ZaEhFCAwx DLvB2jRU8EmxZN46rPHvlIK0e03/1NjJUzCSn44A9mUrTEAIxhfW/vg+4COIz0liuqGz 9qAQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence; bh=nesK9y4qWZhrNCSiCMAkJgfEGumzzvprEvfcz7ekwg4=; fh=h2k8Z+lb8t2Qqa9nVC+MhTE+WUUV7jH9SnNyLsvB4Ug=; b=cn/6knYOzVEKf7QtqPK0GZVkWRWyxbcVvgKA/nhz/ftonKzUaOOQ7S+X/Y8Z3ABp/D rO0YcRK2lJiJFXq5A5BZkpfkP6y8DqVyUCG4fvaQ8L7heKdEhDInNV8o8dyUISDjBwtz IOBxqwM/Lk6aQ25Psfs3dZE77xLggAEDubZoQPSF4m5HueWbd8RUmNJTid9WL9RZXdhK h2Cqf5BDOg9WTkId2p5Rk+Ifugw2Nc2vjappqdWCT/8chIMSwXTm9O52vt3XGmyOI67f U0MrztZ5KxU/IulEWHCRwCT+fUS6x4v7JjJqcDrfoMRSbDhvkdN61jWHq/KR2ha1XBYe cnqg== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-34062-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-34062-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id j8-20020a170903024800b001d6f7879b34si8752275plh.383.2024.01.22.12.04.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 12:04:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-34062-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-34062-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-34062-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id AE4C9B28B36 for ; Mon, 22 Jan 2024 19:37:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 685293F8F7; Mon, 22 Jan 2024 19:37:27 +0000 (UTC) Received: from mail-oo1-f49.google.com (mail-oo1-f49.google.com [209.85.161.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9791E1EF07; Mon, 22 Jan 2024 19:37:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705952246; cv=none; b=Q+aLq2dng5m4yxEARRlbGPkhq+mPH5UNMM+H+6Ku4yD1jEZJvCZ+8YwpRmPo57yqKmn5E1WlEtX+dZLY9ahEZ2sohjRkzDphY/Z2DunMA0phQpgmjpE/GqeXW0q85zU5eWETIhoddj9NQkXMleAvmq/954qD82U2huxCW9tQAIY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705952246; c=relaxed/simple; bh=RoIkcs5ey0VmVT8DRVQBY+Ice/V2Jk6D5ruHVfHqb6I=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=sUG9ZSZykP0Fa36paAJxEOp75We4mw+qZwJz3nyNgZysJfAf8oEZz0Vuwrl9dPDeZBlvQqEzwmwzD0LfsAfqx2ia/3QY3US6w5YGPTN+89Nv5ithFs4KRousWHHnNunwgAYXlVvhx1ov8QdENLoM6NP9rRL7ZyPX9LoCAOF9MDM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.161.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-oo1-f49.google.com with SMTP id 006d021491bc7-5958d3f2d8aso225975eaf.1; Mon, 22 Jan 2024 11:37:25 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705952244; x=1706557044; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nesK9y4qWZhrNCSiCMAkJgfEGumzzvprEvfcz7ekwg4=; b=pFkB8C6kfiJ+Dkx0yQHLZ6JdwXEsXOb/OJiJSOY2tknnvnaDXFZBqWi+Z4TEuWUCjQ jHJAfW0C+qEdbCfY/2jiNTXKld0czbD7zpJ/sfvSXdYu76FjLkrT8OwY6oKpoLf1Xa5N KaE75jNGvPiYozIJUSlxxBptOdAzT+hJcTOGuBwqXxokIsGNhKI9APVPyYsehwHZi6BK AOclO3QYnGpXhz4q17Mp8WxdvbUPeHvDUuwhePjwnhPPN8BN2gM8iXY8uLEyxycC5GuP toCL3CKrdeI0FPR1fManrajl3KPXG5F5T24e6dVkh5zxg0K+coe5T9IucSIvk3hHfh8G pkJg== X-Gm-Message-State: AOJu0YzIo8JZU82fXKkWJyR0Iwjnu82GtZ7CN7CoWOv6M+h/1QQWiq+Q 0PFcAynTXlh57ZlsusOwJsLU6CrydzjW97+uKhfw34Nac7MYq1GLheCloTJpE3qLh46yzwv7kYK QeHVK6y8bsoA/FtZkTySLUHMmf9A= X-Received: by 2002:a4a:d744:0:b0:598:e709:7620 with SMTP id h4-20020a4ad744000000b00598e7097620mr7318381oot.1.1705952244669; Mon, 22 Jan 2024 11:37:24 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240119113319.54158-1-mario.limonciello@amd.com> In-Reply-To: From: "Rafael J. Wysocki" Date: Mon, 22 Jan 2024 20:37:13 +0100 Message-ID: Subject: Re: [PATCH] cpufreq/amd-pstate: Fix setting scaling max/min freq values To: Wyes Karny , Mario Limonciello Cc: ray.huang@amd.com, rafael@kernel.org, viresh.kumar@linaro.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, Jan 22, 2024 at 3:57=E2=80=AFPM Wyes Karny wrote= : > > On Sat, Jan 20, 2024 at 5:49=E2=80=AFAM Mario Limonciello > wrote: > > > > Scaling min/max freq values were being cached and lagging a setting > > each time. Fix the ordering of the clamp call to ensure they work. > > > > Closes: https://bugzilla.kernel.org/show_bug.cgi?id=3D217931 > > Cc: stable@vger.kernel.org > > Cc: wkarny@gmail.com > > Fixes: febab20caeba ("cpufreq/amd-pstate: Fix scaling_min_freq and scal= ing_max_freq update") > > Signed-off-by: Mario Limonciello > > Reviewed-by: Wyes Karny > > > --- > > drivers/cpufreq/amd-pstate.c | 7 +++---- > > 1 file changed, 3 insertions(+), 4 deletions(-) > > > > diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.= c > > index 1f6186475715..1791d37fbc53 100644 > > --- a/drivers/cpufreq/amd-pstate.c > > +++ b/drivers/cpufreq/amd-pstate.c > > @@ -1232,14 +1232,13 @@ static void amd_pstate_epp_update_limit(struct = cpufreq_policy *policy) > > max_limit_perf =3D div_u64(policy->max * cpudata->highest_perf,= cpudata->max_freq); > > min_limit_perf =3D div_u64(policy->min * cpudata->highest_perf,= cpudata->max_freq); > > > > + WRITE_ONCE(cpudata->max_limit_perf, max_limit_perf); > > + WRITE_ONCE(cpudata->min_limit_perf, min_limit_perf); > > + > > max_perf =3D clamp_t(unsigned long, max_perf, cpudata->min_limi= t_perf, > > cpudata->max_limit_perf); > > min_perf =3D clamp_t(unsigned long, min_perf, cpudata->min_limi= t_perf, > > cpudata->max_limit_perf); > > - > > - WRITE_ONCE(cpudata->max_limit_perf, max_limit_perf); > > - WRITE_ONCE(cpudata->min_limit_perf, min_limit_perf); > > - > > value =3D READ_ONCE(cpudata->cppc_req_cached); > > > > if (cpudata->policy =3D=3D CPUFREQ_POLICY_PERFORMANCE) > > -- Applied as 6.8-rc material, thanks!