Message ID | 20240217213010.2466-1-dsmythies@telus.net |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-70095-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp514045dyc; Sat, 17 Feb 2024 13:31:28 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWDtqKKeChEZfEO7ltQrKTsdtRL5ZGt7+1DJICDt0IwZVJGAal7o9apNLwMdKVoNxaS703XJyB5YUxyoxZCl5qJ+bCewQ== X-Google-Smtp-Source: AGHT+IE/Fm+GKTokoBLZOomFOHndlW9waKgWjERs2iNPa7n5+kCrnSaw9oqdWMD7hhGOUk8bxpZJ X-Received: by 2002:a05:6e02:1a87:b0:365:1aaf:609b with SMTP id k7-20020a056e021a8700b003651aaf609bmr2974404ilv.4.1708205487889; Sat, 17 Feb 2024 13:31:27 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708205487; cv=pass; d=google.com; s=arc-20160816; b=RQ6ZF6x2x+Fk4LSyAhRFbmlbDLGEzvhPioDDEtC5CnQwJCmh3jPElwXetgHlgLscIA xn33cX2Asir/VqLLh9VP3iHpPOBkKGaPqS5UGf07QkUHfz8R3w263rs4MLAn7RDUpH/H 95VOPBtiEVi/VBfdHPjaeS4n1EBLQHJ6XwHo6mO8VzUUw3DnP65k9/Bes1+Y5ZzmQxfP WWP2Pmv0kLLB3TnnOb9AjMLkRWDlgNgBGBWhBK2OfEZTqZ7NBGIvbv2JRZ2CM00FZ49w +oL4aVPCUaD2tIZvEUmtkP9CgdE7yzjmVerJbq1j/LstsFo5u20Ymew3494RgMUpWGRB MgnQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=O2TjNiYVkyOnt5bo8I4KiLztzjuw78NyYvMLjikMof0=; fh=XjLsNfnfz6Znzs/O6beK+XZwgwCuZH1UJRJYOIfFr+E=; b=RTwBRnZ7s90XGdDQ2nYVGnyjYyLFgwudjgKfiGuT3bOYLqyBgk5AUHWsmf8eGVXB4c WZ910EhpRrAtZOpyeAojwppsJgM2z0dVWt+KWVw5/jUIiQACWwCoEPSwadeWNCd3rzLx L6E71uCqT6KUSll5mp2IzbwcNhDoDBVk6lfCm+6a+KbMShLYxzz9Xlf1GGy83dKtIFse rvErJmEl1bu9tTDshJ4bSATaK+OfpYMWNoHTd/M4qkz9f0UFvcUMUFxftG1Wn+cKkvW+ cJJhC1ypifZw7pDkK+9xQhJeeeVAbUWM2amyTTKGgvlemtxFZlaYO+sxv4MBSflmbLgz 2W7g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@telus.net header.s=google header.b=eI7TuNtg; arc=pass (i=1 spf=pass spfdomain=telus.net dkim=pass dkdomain=telus.net dmarc=pass fromdomain=telus.net); spf=pass (google.com: domain of linux-kernel+bounces-70095-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70095-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=telus.net Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id x7-20020a170902a38700b001d8dbb867a5si1909063pla.592.2024.02.17.13.31.27 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Feb 2024 13:31:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-70095-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@telus.net header.s=google header.b=eI7TuNtg; arc=pass (i=1 spf=pass spfdomain=telus.net dkim=pass dkdomain=telus.net dmarc=pass fromdomain=telus.net); spf=pass (google.com: domain of linux-kernel+bounces-70095-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70095-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=telus.net 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 6474928272E for <ouuuleilei@gmail.com>; Sat, 17 Feb 2024 21:30:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 011958003A; Sat, 17 Feb 2024 21:30:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=telus.net header.i=@telus.net header.b="eI7TuNtg" Received: from mail-ot1-f46.google.com (mail-ot1-f46.google.com [209.85.210.46]) (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 C21FF1D6A4 for <linux-kernel@vger.kernel.org>; Sat, 17 Feb 2024 21:30:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708205417; cv=none; b=E7i3OjleJxc9LTzk1bJzqjWgZ5ld19BOFphM8/3f5JbDyXp5LXmNpMJif5LA/uXGXS3Y9x/44zV7Iyfjsd9n/YAK8uE5oPFj9L5RdYFPRJgh46angFo4rBp2nKG6+O9s8D3luKeOxNJn4iUpQ256klYf2aMOmqtfCaRgGZauwY8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708205417; c=relaxed/simple; bh=oHOAKuTy7J71OhteqliHHPUc4sWlt3H4+04j1XqQTGg=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=tV/VzShUlU+/BzhYR6dT/DYg6LXG+fqfIqTjLj7BY+RGI8T7y0V7jC8MzyVqjRSVw5yYT3/HRQuf7Zg0RSKtP26wpGNJszoqg3af7Zl2SiMaFvByIKTZKRSo3Utc7EjDvT/fjvlg0DwsMjd3mVQMZkrbkf3PKK0qFA4OF36iSrU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=telus.net; spf=pass smtp.mailfrom=telus.net; dkim=pass (2048-bit key) header.d=telus.net header.i=@telus.net header.b=eI7TuNtg; arc=none smtp.client-ip=209.85.210.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=telus.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=telus.net Received: by mail-ot1-f46.google.com with SMTP id 46e09a7af769-6e2fb9263a6so580007a34.1 for <linux-kernel@vger.kernel.org>; Sat, 17 Feb 2024 13:30:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telus.net; s=google; t=1708205415; x=1708810215; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=O2TjNiYVkyOnt5bo8I4KiLztzjuw78NyYvMLjikMof0=; b=eI7TuNtgEx7EeRlZ6+A6ndoN5Rt3ObQbScF+xb2faOkiIkPec17KMIpgOibgKfnb/A 5OvILmB0I7kRbscJa1/JNPUZshEl4tgyKU7WXDJj21IMEMrPQmFcPsh/G5FDoVaB+FqW /YaG2vzeiWUHJu+jOlY+oFAqNVwwIxBbANlJ5QSwRuGZTIbNZLka5NXFsXauISXpU1Kz RrHfLCOVG5UyaEhHy4qBybdav1l/nlqPbb4WDZqHIgEl2TfD0AEI+FJhTSFVWC8PJTDE HJC//Am+NdlXZJde62EvnbogEOy301ZRn/vIxPn+tCFSLMIgf5uAmjFTZUyXoOhsoSBU 8Byw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708205415; x=1708810215; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=O2TjNiYVkyOnt5bo8I4KiLztzjuw78NyYvMLjikMof0=; b=rCmXE1qdgcxmXSn1sxdws1ywa1YtrwJxmWVbx1zWTGNrnNIrivv9rbiJ1G7TuPdJyl lp3xVxgrnp/VU4R1aqzZ2KpQeqDJFrQlkCwUOPKeDkmd75acIgCZVelO143spFMa6fOX WFlz75/OXwk4Uozg62q3mcl4O1ynb5KADmnODS+dfLah9cEps73LX/d+V7jtaQ0Otrr4 S6CPyQ+qhKR9QK/WlahdLa43IRfX3FV4MU50GwaO3E0p1C0q5vLqUXKm0inePhedgREe i33WdqGPzK8W2sNhLM8dkbbtLLZwu4S+bSsVmejBRCxiVEHQW/5SIjOnHlhhxxCIBI1E bMBA== X-Gm-Message-State: AOJu0YxKc4Fv6/C4IX/b3M0xmpkvwmM9DFCA0i+ZzWsk318JI/gMAdFj bg3cRM9yazh6mD+tRV2xqzuCyfVC1kB1tm9WZP5GjU1sAq5S5FtYgd3pl9mBeek= X-Received: by 2002:a05:6830:1b6d:b0:6e4:41bb:b30 with SMTP id d13-20020a0568301b6d00b006e441bb0b30mr2472025ote.19.1708205414732; Sat, 17 Feb 2024 13:30:14 -0800 (PST) Received: from s19.smythies.com (s66-183-142-209.bc.hsia.telus.net. [66.183.142.209]) by smtp.gmail.com with ESMTPSA id bn16-20020a056a00325000b006e0cfe94fc5sm2090721pfb.107.2024.02.17.13.30.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Feb 2024 13:30:14 -0800 (PST) From: Doug Smythies <dsmythies@telus.net> To: srinivas.pandruvada@linux.intel.com, rafael@kernel.org, lenb@kernel.org Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, vincent.guittot@linaro.org, dsmythies@telus.net Subject: [PATCH] cpufreq: intel_pstate: fix pstate limits enforcement for adjust_perf call back Date: Sat, 17 Feb 2024 13:30:10 -0800 Message-Id: <20240217213010.2466-1-dsmythies@telus.net> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791183277565913757 X-GMAIL-MSGID: 1791183277565913757 |
Series |
cpufreq: intel_pstate: fix pstate limits enforcement for adjust_perf call back
|
|
Commit Message
Doug Smythies
Feb. 17, 2024, 9:30 p.m. UTC
There is a loophole in pstate limit clamping for the intel_cpufreq CPU
frequency scaling driver (intel_pstate in passive mode), schedutil CPU
frequency scaling governor, HWP (HardWare Pstate) control enabled, when
the adjust_perf call back path is used.
Fix it.
Signed-off-by: Doug Smythies <dsmythies@telus.net>
---
drivers/cpufreq/intel_pstate.c | 3 +++
1 file changed, 3 insertions(+)
Comments
On Sat, Feb 17, 2024 at 10:30 PM Doug Smythies <dsmythies@telus.net> wrote: > > There is a loophole in pstate limit clamping for the intel_cpufreq CPU > frequency scaling driver (intel_pstate in passive mode), schedutil CPU > frequency scaling governor, HWP (HardWare Pstate) control enabled, when > the adjust_perf call back path is used. > > Fix it. > > Signed-off-by: Doug Smythies <dsmythies@telus.net> > --- > drivers/cpufreq/intel_pstate.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c > index ca94e60e705a..79619227ea51 100644 > --- a/drivers/cpufreq/intel_pstate.c > +++ b/drivers/cpufreq/intel_pstate.c > @@ -2987,6 +2987,9 @@ static void intel_cpufreq_adjust_perf(unsigned int cpunum, > if (min_pstate < cpu->min_perf_ratio) > min_pstate = cpu->min_perf_ratio; > > + if (min_pstate > cpu->max_perf_ratio) > + min_pstate = cpu->max_perf_ratio; > + > max_pstate = min(cap_pstate, cpu->max_perf_ratio); > if (max_pstate < min_pstate) > max_pstate = min_pstate; > -- Applied as 6.9 material, thanks!
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c index ca94e60e705a..79619227ea51 100644 --- a/drivers/cpufreq/intel_pstate.c +++ b/drivers/cpufreq/intel_pstate.c @@ -2987,6 +2987,9 @@ static void intel_cpufreq_adjust_perf(unsigned int cpunum, if (min_pstate < cpu->min_perf_ratio) min_pstate = cpu->min_perf_ratio; + if (min_pstate > cpu->max_perf_ratio) + min_pstate = cpu->max_perf_ratio; + max_pstate = min(cap_pstate, cpu->max_perf_ratio); if (max_pstate < min_pstate) max_pstate = min_pstate;