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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1554603364-10500-1-git-send-email-hofrat@opentech.at>
Date:   Sun,  7 Apr 2019 04:16:02 +0200
From:   Nicholas Mc Guire <hofrat@...ntech.at>
To:     Sakari Ailus <sakari.ailus@....fi>
Cc:     Mauro Carvalho Chehab <mchehab@...nel.org>,
        linux-media@...r.kernel.org, linux-kernel@...r.kernel.org,
        Nicholas Mc Guire <hofrat@...ntech.at>
Subject: [PATCH 1/3] media: smiapp: core: add range to usleep_range

Allow the hrtimer subsystem to coalesce delay timers of lower accuracy
by providing a suitable range

Signed-off-by: Nicholas Mc Guire <hofrat@...ntech.at>
---

Problem located by an experimental coccinelle script

hrtimers in atomic context have limited accuracy due to possible
context-switching and interruption so the accuracy is limited 
anyway. Giving the hrtimer subsystem a reasonable range for merging
hrtimers helps to reduce the load on the hrtimer subsystem. As this
delays do not seem to mandate high accuracy the range of a factor
two seems acceptable.

Patch was compile tested with: x86_64_defconfig + MEDIA_SUPPORT=m,
MEDIA_CAMERA_SUPPORT=y, MEDIA_CONTROLLER=y, VIDEO_V4L2_SUBDEV_API=y,
VIDEO_SMIAPP=m                                                                                               
(with a number of sparse warnings on sizeof() usage)

Patch is against 5.1-rc3 (localversion-next is next-20190405)

 drivers/media/i2c/smiapp/smiapp-core.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/media/i2c/smiapp/smiapp-core.c b/drivers/media/i2c/smiapp/smiapp-core.c
index 58a45c3..c0c29ec 100644
--- a/drivers/media/i2c/smiapp/smiapp-core.c
+++ b/drivers/media/i2c/smiapp/smiapp-core.c
@@ -1222,19 +1222,19 @@ static int smiapp_power_on(struct device *dev)
 		dev_err(&client->dev, "failed to enable vana regulator\n");
 		return rval;
 	}
-	usleep_range(1000, 1000);
+	usleep_range(1000, 2000);
 
 	rval = clk_prepare_enable(sensor->ext_clk);
 	if (rval < 0) {
 		dev_dbg(&client->dev, "failed to enable xclk\n");
 		goto out_xclk_fail;
 	}
-	usleep_range(1000, 1000);
+	usleep_range(1000, 2000);
 
 	gpiod_set_value(sensor->xshutdown, 1);
 
 	sleep = SMIAPP_RESET_DELAY(sensor->hwcfg->ext_clk);
-	usleep_range(sleep, sleep);
+	usleep_range(sleep, sleep*2);
 
 	mutex_lock(&sensor->mutex);
 
@@ -1381,7 +1381,7 @@ static int smiapp_power_off(struct device *dev)
 
 	gpiod_set_value(sensor->xshutdown, 0);
 	clk_disable_unprepare(sensor->ext_clk);
-	usleep_range(5000, 5000);
+	usleep_range(5000, 10000);
 	regulator_disable(sensor->vana);
 	sensor->streaming = false;
 
-- 
2.1.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ