- hdaps-limit-hardware-query-rate.patch removed from -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled

     hdaps: Limit hardware query rate

has been removed from the -mm tree.  Its filename is

     hdaps-limit-hardware-query-rate.patch

This patch was dropped because we shall not be accepting anonymous contributions, sorry.

------------------------------------------------------
Subject: hdaps: Limit hardware query rate
From: Shem Multinymous <multinymous@xxxxxxxxx>

The current hdaps driver queries the hardware on (almost) any sysfs read. 
Since fresh readouts are genereated by the hardware at a constant rate, this
means apps are eating each other's events.  Also, polling multiple attributes
will genereate excessive hardware queries and excessive CPU load due to the
duration of the hardware query transaction.

With this patch, the driver will normally update its cached readouts only in
its timer function (which exists anyway, for the input device).  If that read
failed, it will be retried upon the actual sysfs access.  In all cases, query
rate is bounded and apps will get reasonably fresh and usually cached
readouts.

The polling rate is increased to 50Hz, as needed by the hdaps daemon.  A later
patch makes this configurable.

Signed-off-by: Shem Multinymous <multinymous@xxxxxxxxx>
Signed-off-by: Pavel Machek <pavel@xxxxxxx>
Acked-by: Robert Love <rml@xxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxx>
---

 drivers/hwmon/hdaps.c |   19 +++++++++++++------
 1 files changed, 13 insertions(+), 6 deletions(-)

diff -puN drivers/hwmon/hdaps.c~hdaps-limit-hardware-query-rate drivers/hwmon/hdaps.c
--- a/drivers/hwmon/hdaps.c~hdaps-limit-hardware-query-rate
+++ a/drivers/hwmon/hdaps.c
@@ -57,7 +57,7 @@ static const struct thinkpad_ec_row ec_a
 #define READ_TIMEOUT_MSECS	100	/* wait this long for device read */
 #define RETRY_MSECS		3	/* retry delay */
 
-#define HDAPS_POLL_PERIOD	(HZ/20)	/* poll for input every 1/20s */
+#define HDAPS_POLL_PERIOD	(HZ/50)	/* poll for input every 1/50s */
 #define HDAPS_INPUT_FUZZ	4	/* input event threshold */
 #define HDAPS_INPUT_FLAT	4
 #define KMACT_REMEMBER_PERIOD   (HZ/10) /* keyboard/mouse persistance */
@@ -67,10 +67,11 @@ static struct platform_device *pdev;
 static struct input_dev *hdaps_idev;
 static unsigned int hdaps_invert;
 
-/* Latest state readout */
-static int pos_x, pos_y;   /* position */
-static int temperature;    /* temperature */
-static int rest_x, rest_y; /* calibrated rest position */
+/* Latest state readout: */
+static int pos_x, pos_y;      /* position */
+static int temperature;       /* temperature */
+static int stale_readout = 1; /* last read invalid */
+static int rest_x, rest_y;    /* calibrated rest position */
 
 /* Last time we saw keyboard and mouse activity: */
 static u64 last_keyboard_jiffies = INITIAL_JIFFIES;
@@ -135,6 +136,7 @@ static int __hdaps_update(int fast)
 
 	temperature = data.val[EC_ACCEL_IDX_TEMP1];
 
+	stale_readout = 0;
 	return 0;
 }
 
@@ -149,6 +151,8 @@ static int __hdaps_update(int fast)
 static int hdaps_update(void)
 {
 	int total, ret;
+	if (!stale_readout) /* already updated recently? */
+		return 0;
 	for (total=0; total<READ_TIMEOUT_MSECS; total+=RETRY_MSECS) {
 		ret = thinkpad_ec_lock();
 		if (ret)
@@ -244,6 +248,7 @@ bad:
 	thinkpad_ec_invalidate();
 	ret = -ENXIO;
 good:
+	stale_readout = 1;
 	thinkpad_ec_unlock();
 	return ret;
 }
@@ -295,6 +300,8 @@ static void hdaps_mousedev_poll(unsigned
 {
 	int ret;
 
+	stale_readout = 1;
+
 	/* Cannot sleep.  Try nonblockingly.  If we fail, try again later. */
 	if (thinkpad_ec_try_lock())
 		goto keep_active;
@@ -304,7 +311,7 @@ static void hdaps_mousedev_poll(unsigned
 	/* Any of "successful", "not yet ready" and "not prefetched"? */
 	if (ret!=0 && ret!=-EBUSY && ret!=-ENODATA) {
 		printk(KERN_ERR
-		       "hdaps: poll failed, disabling mousedev updates\n");
+		       "hdaps: poll failed, disabling updates\n");
 		return;
 	}
 
_

Patches currently in -mm which might be from multinymous@xxxxxxxxx are

dmi-decode-and-save-oem-string-information.patch
hdaps-limit-hardware-query-rate.patch
hdaps-delay-calibration-to-first-hardware-query.patch
hdaps-add-explicit-hardware-configuration-functions.patch
hdaps-add-explicit-hardware-configuration-functions-fix.patch
hdaps-add-new-sysfs-attributes.patch
hdaps-power-off-accelerometer-on-suspend-and-unload.patch
hdaps-stop-polling-timer-when-suspended.patch
hdaps-simplify-whitelist.patch

-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux