lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200610151818.1.I666ecd9c6f3c6405bd75831a21001b8109b6438c@changeid>
Date:   Wed, 10 Jun 2020 15:18:43 -0700
From:   Douglas Anderson <dianders@...omium.org>
To:     Benson Leung <bleung@...omium.org>,
        Enric Balletbo i Serra <enric.balletbo@...labora.com>
Cc:     hsinyi@...omium.org, joelaf@...gle.com, peterz@...radead.org,
        drinkcat@...omium.org, gwendal@...omium.org, qperret@...gle.com,
        ctheegal@...eaurora.org, Douglas Anderson <dianders@...omium.org>,
        Guenter Roeck <groeck@...omium.org>,
        linux-kernel@...r.kernel.org
Subject: [PATCH] cros_ec_spi: Even though we're RT priority, don't bump cpu freq

The cros_ec_spi driver is realtime priority so that it doesn't get
preempted by other taks while it's talking to the EC but overall it
really doesn't need lots of compute power.  Unfortunately, by default,
the kernel assumes that all realtime tasks should cause the cpufreq to
jump to max and burn through power to get things done as quickly as
possible.  That's just not the correct behavior for cros_ec_spi.

Switch to manually overriding the default.

This won't help us if our work moves over to the SPI pump thread but
that's not the common code path.

Signed-off-by: Douglas Anderson <dianders@...omium.org>
---
NOTE: This would cause a conflict if the patch
https://lore.kernel.org/r/20200422112831.870192415@infradead.org lands
first

 drivers/platform/chrome/cros_ec_spi.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/platform/chrome/cros_ec_spi.c b/drivers/platform/chrome/cros_ec_spi.c
index debea5c4c829..76d59d5e7efd 100644
--- a/drivers/platform/chrome/cros_ec_spi.c
+++ b/drivers/platform/chrome/cros_ec_spi.c
@@ -709,8 +709,11 @@ static void cros_ec_spi_high_pri_release(void *worker)
 static int cros_ec_spi_devm_high_pri_alloc(struct device *dev,
 					   struct cros_ec_spi *ec_spi)
 {
-	struct sched_param sched_priority = {
-		.sched_priority = MAX_RT_PRIO / 2,
+	struct sched_attr sched_attr = {
+		.sched_policy	= SCHED_FIFO,
+		.sched_priority	= MAX_RT_PRIO / 2,
+		.sched_flags	= SCHED_FLAG_UTIL_CLAMP_MIN,
+		.sched_util_min	= 0,
 	};
 	int err;
 
@@ -728,8 +731,7 @@ static int cros_ec_spi_devm_high_pri_alloc(struct device *dev,
 	if (err)
 		return err;
 
-	err = sched_setscheduler_nocheck(ec_spi->high_pri_worker->task,
-					 SCHED_FIFO, &sched_priority);
+	err = sched_setattr_nocheck(ec_spi->high_pri_worker->task, &sched_attr);
 	if (err)
 		dev_err(dev, "Can't set cros_ec high pri priority: %d\n", err);
 	return err;
-- 
2.27.0.290.gba653c62da-goog

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ