[PATCH] video: backlight: Remove backlight sysfs uevent

Subsystems: backlight class/subsystem, framebuffer layer, the rest

STALE4688d

16 messages, 6 authors, 2013-12-16 · open the first message on its own page

[PATCH] video: backlight: Remove backlight sysfs uevent

From: Kyungmin Park <hidden>
Date: 2013-11-11 23:56:50

From: Kyungmin Park <kyungmin.park@samsung.com>

The most mobile phones have Ambient Light Sensors and it changes brightness according lux.
It means it changes backlight brightness frequently by just writing sysfs node, so it generates uevent.
 
Usually there's no user to use this backlight changes. But it forks udev worker threads and it takes about 5ms. The main problem is that it hurts other process activities. so remove it.

Kay said 
"Uevents are for the major, low-frequent, global device state-changes,
 not for carrying-out any sort of measurement data. Subsystems which
 need that should use other facilities like poll()-able sysfs file or
 any other subscription-based, client-tracking interface which does not
 cause overhead if it isn't used. Uevents are not the right thing to
 use here, and upstream udev should not paper-over broken kernel
 subsystems."

Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c
index 94a403a..441272d 100644
--- a/drivers/video/backlight/backlight.c
+++ b/drivers/video/backlight/backlight.c
@@ -88,9 +88,6 @@ static void backlight_generate_event(struct backlight_device *bd,
 	char *envp[2];
 
 	switch (reason) {
-	case BACKLIGHT_UPDATE_SYSFS:
-		envp[0] = "SOURCE=sysfs";
-		break;
 	case BACKLIGHT_UPDATE_HOTKEY:
 		envp[0] = "SOURCE=hotkey";
 		break;
@@ -172,8 +169,6 @@ static ssize_t brightness_store(struct device *dev,
 	}
 	mutex_unlock(&bd->ops_lock);
 
-	backlight_generate_event(bd, BACKLIGHT_UPDATE_SYSFS);
-
 	return rc;
 }
 static DEVICE_ATTR_RW(brightness);
diff --git a/include/linux/backlight.h b/include/linux/backlight.h
index 53b7794..d2a27dd 100644
--- a/include/linux/backlight.h
+++ b/include/linux/backlight.h
@@ -29,7 +29,6 @@
 
 enum backlight_update_reason {
 	BACKLIGHT_UPDATE_HOTKEY,
-	BACKLIGHT_UPDATE_SYSFS,
 };
 
 enum backlight_type {

Re: [PATCH] video: backlight: Remove backlight sysfs uevent

From: Jingoo Han <hidden>
Date: 2013-11-12 00:18:11

On Tuesday, November 12, 2013 8:57 AM, Kyungmin Park wrote:
quoted hunk
From: Kyungmin Park <kyungmin.park@samsung.com>

The most mobile phones have Ambient Light Sensors and it changes brightness according lux.
It means it changes backlight brightness frequently by just writing sysfs node, so it generates uevent.

Usually there's no user to use this backlight changes. But it forks udev worker threads and it takes
about 5ms. The main problem is that it hurts other process activities. so remove it.

Kay said
"Uevents are for the major, low-frequent, global device state-changes,
 not for carrying-out any sort of measurement data. Subsystems which
 need that should use other facilities like poll()-able sysfs file or
 any other subscription-based, client-tracking interface which does not
 cause overhead if it isn't used. Uevents are not the right thing to
 use here, and upstream udev should not paper-over broken kernel
 subsystems."

Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c
index 94a403a..441272d 100644
--- a/drivers/video/backlight/backlight.c
+++ b/drivers/video/backlight/backlight.c
@@ -88,9 +88,6 @@ static void backlight_generate_event(struct backlight_device *bd,
 	char *envp[2];

 	switch (reason) {
-	case BACKLIGHT_UPDATE_SYSFS:
-		envp[0] = "SOURCE=sysfs";
-		break;
 	case BACKLIGHT_UPDATE_HOTKEY:
 		envp[0] = "SOURCE=hotkey";
 		break;
@@ -172,8 +169,6 @@ static ssize_t brightness_store(struct device *dev,
 	}
 	mutex_unlock(&bd->ops_lock);

-	backlight_generate_event(bd, BACKLIGHT_UPDATE_SYSFS);
-
 	return rc;
 }
 static DEVICE_ATTR_RW(brightness);
diff --git a/include/linux/backlight.h b/include/linux/backlight.h
index 53b7794..d2a27dd 100644
--- a/include/linux/backlight.h
+++ b/include/linux/backlight.h
@@ -29,7 +29,6 @@

 enum backlight_update_reason {
 	BACKLIGHT_UPDATE_HOTKEY,
-	BACKLIGHT_UPDATE_SYSFS,
+cc Henrique de Moraes Holschuh (Maintainer of thinkpad_acpi)

Hi Henrique de Moraes Holschuh,

'thinkpad_acpi.c' uses the 'BACKLIGHT_UPDATE_SYSFS'.
Henrique, can we remove it?

drivers/platform/x86/thinkpad_acpi.c
if (!rc && ibm_backlight_device)
                backlight_force_update(ibm_backlight_device,
                                        BACKLIGHT_UPDATE_SYSFS);

Best regards,
Jingoo Han
 };

 enum backlight_type {

Re: [PATCH] video: backlight: Remove backlight sysfs uevent

From: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Date: 2013-11-12 00:56:40

On Tue, 12 Nov 2013, Jingoo Han wrote:
On Tuesday, November 12, 2013 8:57 AM, Kyungmin Park wrote:
quoted
From: Kyungmin Park <kyungmin.park@samsung.com>

The most mobile phones have Ambient Light Sensors and it changes brightness according lux.
It means it changes backlight brightness frequently by just writing sysfs node, so it generates uevent.

Usually there's no user to use this backlight changes. But it forks udev worker threads and it takes
about 5ms. The main problem is that it hurts other process activities. so remove it.

Kay said
"Uevents are for the major, low-frequent, global device state-changes,
 not for carrying-out any sort of measurement data. Subsystems which
 need that should use other facilities like poll()-able sysfs file or
 any other subscription-based, client-tracking interface which does not
 cause overhead if it isn't used. Uevents are not the right thing to
 use here, and upstream udev should not paper-over broken kernel
 subsystems."
True.

Now, let's take a look at reality: should you poll()/select() on a sysfs
node that doesn't suport it, it will wait until the poll/select timeout
happens (or EINTR happens), and userspace has absolutely NO way to detect
whether a sysfs node has poll/select support.

What happens if the sysfs interface did not provide poll/select support
since day one, but rather added it later?  Nobody will use it for a *long*
time, if ever... unless you actually took pains to version the sysfs
interface, and people actually care.
'thinkpad_acpi.c' uses the 'BACKLIGHT_UPDATE_SYSFS'.
Henrique, can we remove it?
Can't you fix this by rate-limiting, or otherwise adding an attribute that
backlight devices should set when they need to supress change events?

Is there a proper on-screen-display support path for the backlight class
nowadays?  Otherwise, you'd be removing the only way userspace ever had to
do proper OSD of backlight changes...

-- 
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh

Re: [PATCH] video: backlight: Remove backlight sysfs uevent

From: Kyungmin Park <hidden>
Date: 2013-11-12 01:07:43

On Tue, Nov 12, 2013 at 9:56 AM, Henrique de Moraes Holschuh
[off-list ref] wrote:
On Tue, 12 Nov 2013, Jingoo Han wrote:
quoted
On Tuesday, November 12, 2013 8:57 AM, Kyungmin Park wrote:
quoted
From: Kyungmin Park <kyungmin.park@samsung.com>

The most mobile phones have Ambient Light Sensors and it changes brightness according lux.
It means it changes backlight brightness frequently by just writing sysfs node, so it generates uevent.

Usually there's no user to use this backlight changes. But it forks udev worker threads and it takes
about 5ms. The main problem is that it hurts other process activities. so remove it.

Kay said
"Uevents are for the major, low-frequent, global device state-changes,
 not for carrying-out any sort of measurement data. Subsystems which
 need that should use other facilities like poll()-able sysfs file or
 any other subscription-based, client-tracking interface which does not
 cause overhead if it isn't used. Uevents are not the right thing to
 use here, and upstream udev should not paper-over broken kernel
 subsystems."
True.

Now, let's take a look at reality: should you poll()/select() on a sysfs
node that doesn't suport it, it will wait until the poll/select timeout
happens (or EINTR happens), and userspace has absolutely NO way to detect
whether a sysfs node has poll/select support.

What happens if the sysfs interface did not provide poll/select support
since day one, but rather added it later?  Nobody will use it for a *long*
time, if ever... unless you actually took pains to version the sysfs
interface, and people actually care.
quoted
'thinkpad_acpi.c' uses the 'BACKLIGHT_UPDATE_SYSFS'.
Henrique, can we remove it?
Can't you fix this by rate-limiting, or otherwise adding an attribute that
backlight devices should set when they need to supress change events?
other way is that just remove sysfs node store update then you can use
current API, force_update as is.

are there any other good ideas?

Thank you,
Kyungmin Park
Is there a proper on-screen-display support path for the backlight class
nowadays?  Otherwise, you'd be removing the only way userspace ever had to
do proper OSD of backlight changes...

--
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh

Re: [PATCH] video: backlight: Remove backlight sysfs uevent

From: Kay Sievers <hidden>
Date: 2013-11-12 01:20:03

On Tue, Nov 12, 2013 at 1:56 AM, Henrique de Moraes Holschuh
[off-list ref] wrote:
On Tue, 12 Nov 2013, Jingoo Han wrote:
quoted
On Tuesday, November 12, 2013 8:57 AM, Kyungmin Park wrote:
quoted
From: Kyungmin Park <kyungmin.park@samsung.com>

The most mobile phones have Ambient Light Sensors and it changes brightness according lux.
It means it changes backlight brightness frequently by just writing sysfs node, so it generates uevent.

Usually there's no user to use this backlight changes. But it forks udev worker threads and it takes
about 5ms. The main problem is that it hurts other process activities. so remove it.

Kay said
"Uevents are for the major, low-frequent, global device state-changes,
 not for carrying-out any sort of measurement data. Subsystems which
 need that should use other facilities like poll()-able sysfs file or
 any other subscription-based, client-tracking interface which does not
 cause overhead if it isn't used. Uevents are not the right thing to
 use here, and upstream udev should not paper-over broken kernel
 subsystems."
True.

Now, let's take a look at reality: should you poll()/select() on a sysfs
node that doesn't suport it, it will wait until the poll/select timeout
happens (or EINTR happens), and userspace has absolutely NO way to detect
whether a sysfs node has poll/select support.

What happens if the sysfs interface did not provide poll/select support
since day one, but rather added it later?  Nobody will use it for a *long*
time, if ever... unless you actually took pains to version the sysfs
interface, and people actually care.
If that's an issue, we can add a new "event" file, just for that.
quoted
'thinkpad_acpi.c' uses the 'BACKLIGHT_UPDATE_SYSFS'.
Henrique, can we remove it?
Can't you fix this by rate-limiting, or otherwise adding an attribute that
backlight devices should set when they need to supress change events?
Yeah, great idea, fix a bad hack with another bad one on top. :)
Passing measurement data through uevents is just an utterly broken
idea which cannot be fixed.
Is there a proper on-screen-display support path for the backlight class
nowadays?  Otherwise, you'd be removing the only way userspace ever had to
do proper OSD of backlight changes...
OSD drawing and event sounds usually happen as a fedback for
keypresses of brightness control, it would be weird to show up when
something else, like a light-sensor, adjusts the brightness in the
background.

Anyway, there might be the need for coordination and a new interface,
but uevents for measurement data need to die entirely; they make no
sense, never made any; and the sooner they are gone the better.

Kay

Re: [PATCH] video: backlight: Remove backlight sysfs uevent

From: Kyungmin Park <hidden>
Date: 2013-11-12 02:08:28

On Tue, Nov 12, 2013 at 10:19 AM, Kay Sievers [off-list ref] wrote:
On Tue, Nov 12, 2013 at 1:56 AM, Henrique de Moraes Holschuh
[off-list ref] wrote:
quoted
On Tue, 12 Nov 2013, Jingoo Han wrote:
quoted
On Tuesday, November 12, 2013 8:57 AM, Kyungmin Park wrote:
quoted
From: Kyungmin Park <kyungmin.park@samsung.com>

The most mobile phones have Ambient Light Sensors and it changes brightness according lux.
It means it changes backlight brightness frequently by just writing sysfs node, so it generates uevent.

Usually there's no user to use this backlight changes. But it forks udev worker threads and it takes
about 5ms. The main problem is that it hurts other process activities. so remove it.

Kay said
"Uevents are for the major, low-frequent, global device state-changes,
 not for carrying-out any sort of measurement data. Subsystems which
 need that should use other facilities like poll()-able sysfs file or
 any other subscription-based, client-tracking interface which does not
 cause overhead if it isn't used. Uevents are not the right thing to
 use here, and upstream udev should not paper-over broken kernel
 subsystems."
True.

Now, let's take a look at reality: should you poll()/select() on a sysfs
node that doesn't suport it, it will wait until the poll/select timeout
happens (or EINTR happens), and userspace has absolutely NO way to detect
whether a sysfs node has poll/select support.

What happens if the sysfs interface did not provide poll/select support
since day one, but rather added it later?  Nobody will use it for a *long*
time, if ever... unless you actually took pains to version the sysfs
interface, and people actually care.
If that's an issue, we can add a new "event" file, just for that.
quoted
quoted
'thinkpad_acpi.c' uses the 'BACKLIGHT_UPDATE_SYSFS'.
Henrique, can we remove it?
Can't you fix this by rate-limiting, or otherwise adding an attribute that
backlight devices should set when they need to supress change events?
Yeah, great idea, fix a bad hack with another bad one on top. :)
Passing measurement data through uevents is just an utterly broken
idea which cannot be fixed.
quoted
Is there a proper on-screen-display support path for the backlight class
nowadays?  Otherwise, you'd be removing the only way userspace ever had to
do proper OSD of backlight changes...
OSD drawing and event sounds usually happen as a fedback for
keypresses of brightness control, it would be weird to show up when
something else, like a light-sensor, adjusts the brightness in the
background.

Anyway, there might be the need for coordination and a new interface,
but uevents for measurement data need to die entirely; they make no
sense, never made any; and the sooner they are gone the better.
Now power_supply, especially battery uses this scheme. it passes
battery data using uevent.
do you have any idea to kill it?

Thank you,
Kyungmin Park

Re: [PATCH] video: backlight: Remove backlight sysfs uevent

From: Kay Sievers <hidden>
Date: 2013-11-12 02:23:09

On Tue, Nov 12, 2013 at 3:08 AM, Kyungmin Park [off-list ref] wrote:
On Tue, Nov 12, 2013 at 10:19 AM, Kay Sievers [off-list ref] wrote:
quoted
On Tue, Nov 12, 2013 at 1:56 AM, Henrique de Moraes Holschuh
[off-list ref] wrote:
quoted
On Tue, 12 Nov 2013, Jingoo Han wrote:
quoted
On Tuesday, November 12, 2013 8:57 AM, Kyungmin Park wrote:
quoted
From: Kyungmin Park <kyungmin.park@samsung.com>

The most mobile phones have Ambient Light Sensors and it changes brightness according lux.
It means it changes backlight brightness frequently by just writing sysfs node, so it generates uevent.

Usually there's no user to use this backlight changes. But it forks udev worker threads and it takes
about 5ms. The main problem is that it hurts other process activities. so remove it.

Kay said
"Uevents are for the major, low-frequent, global device state-changes,
 not for carrying-out any sort of measurement data. Subsystems which
 need that should use other facilities like poll()-able sysfs file or
 any other subscription-based, client-tracking interface which does not
 cause overhead if it isn't used. Uevents are not the right thing to
 use here, and upstream udev should not paper-over broken kernel
 subsystems."
True.

Now, let's take a look at reality: should you poll()/select() on a sysfs
node that doesn't suport it, it will wait until the poll/select timeout
happens (or EINTR happens), and userspace has absolutely NO way to detect
whether a sysfs node has poll/select support.

What happens if the sysfs interface did not provide poll/select support
since day one, but rather added it later?  Nobody will use it for a *long*
time, if ever... unless you actually took pains to version the sysfs
interface, and people actually care.
If that's an issue, we can add a new "event" file, just for that.
quoted
quoted
'thinkpad_acpi.c' uses the 'BACKLIGHT_UPDATE_SYSFS'.
Henrique, can we remove it?
Can't you fix this by rate-limiting, or otherwise adding an attribute that
backlight devices should set when they need to supress change events?
Yeah, great idea, fix a bad hack with another bad one on top. :)
Passing measurement data through uevents is just an utterly broken
idea which cannot be fixed.
quoted
Is there a proper on-screen-display support path for the backlight class
nowadays?  Otherwise, you'd be removing the only way userspace ever had to
do proper OSD of backlight changes...
OSD drawing and event sounds usually happen as a fedback for
keypresses of brightness control, it would be weird to show up when
something else, like a light-sensor, adjusts the brightness in the
background.

Anyway, there might be the need for coordination and a new interface,
but uevents for measurement data need to die entirely; they make no
sense, never made any; and the sooner they are gone the better.
Now power_supply, especially battery uses this scheme. it passes
battery data using uevent.
do you have any idea to kill it?
It should be removed too, the same applies to power_supply as to everything
else; uevents are a broken interface for any kind of device data which
is not meant as a trigger to re-configure the device itself.

But power_supply events are at least not as unfixable as backlight,
the number of events can be kept relatively low during normal
operation. So it can happen after the backlight thing is sorted out.

Note: The same rule as for generating uevents applies also to device
properties exported in the environment too; measurement data has no
place there. Reading the "uevent" file of a battery in sysfs (we need to
do that at bootup) sometimes synchronously blocks 1 second to return,
just because it tries to add measurement data reading it live from the
hardware to add it to the event itself.

Kay

Re: [PATCH] video: backlight: Remove backlight sysfs uevent

From: Matthew Garrett <mjg59@srcf.ucam.org>
Date: 2013-11-20 23:41:36

On Mon, 2013-11-11 at 22:56 -0200, Henrique de Moraes Holschuh wrote:
On Tue, 12 Nov 2013, Jingoo Han wrote:
quoted
'thinkpad_acpi.c' uses the 'BACKLIGHT_UPDATE_SYSFS'.
Henrique, can we remove it?
Can't you fix this by rate-limiting, or otherwise adding an attribute that
backlight devices should set when they need to supress change events?
It looks like this is just to force synchronisation to sysfs when using
the /proc interface? In which case we should probably just kill
the /proc interface.

-- 
Matthew Garrett [off-list ref]

Re: [PATCH] video: backlight: Remove backlight sysfs uevent

From: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Date: 2013-11-21 11:43:39

On Wed, 20 Nov 2013, Matthew Garrett wrote:
On Mon, 2013-11-11 at 22:56 -0200, Henrique de Moraes Holschuh wrote:
quoted
On Tue, 12 Nov 2013, Jingoo Han wrote:
quoted
'thinkpad_acpi.c' uses the 'BACKLIGHT_UPDATE_SYSFS'.
Henrique, can we remove it?
Can't you fix this by rate-limiting, or otherwise adding an attribute that
backlight devices should set when they need to supress change events?
It looks like this is just to force synchronisation to sysfs when using
the /proc interface? In which case we should probably just kill
the /proc interface.
Well, we can remove the thinkpad-acpi /proc interface as far as I'm
concerned, and that would do away with the use of BACKLIGHT_UPDATE_SYSFS by
thinkpad-acpi.  It is a major userspace ABI break, but removing everything
under /proc/acpi is one of the very few ABI breaks we actually have the
green light to do.

However, the patchset is not about this.

With this patchset applied, as far as I can tell anything that used to be
uevent-driven by the backlight class will break: when a process changes the
backlight using sysfs, other processes will not be notified of the change
anymore.  This patchset seems to break backlight uevent support in such a
way that basically renders the entire thing useless and you might as well
just remove uevent support entirely.

It is also an userspace ABI break, which we do not do lightly.

So, as far as I'm concerned, this patchset should be rejected in its present
form.  IMO, either one that preserves BACKLIGHT_UPDATE_SYSFS and fixes the
urgent issue, or one that removes uevent support entirely from the backlight
class should be proposed instead.

-- 
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh

Re: [PATCH] video: backlight: Remove backlight sysfs uevent

From: Matthew Garrett <mjg59@srcf.ucam.org>
Date: 2013-11-21 14:33:43

On Thu, Nov 21, 2013 at 09:43:32AM -0200, Henrique de Moraes Holschuh wrote:
With this patchset applied, as far as I can tell anything that used to be
uevent-driven by the backlight class will break: when a process changes the
backlight using sysfs, other processes will not be notified of the change
anymore.  This patchset seems to break backlight uevent support in such a
way that basically renders the entire thing useless and you might as well
just remove uevent support entirely.
The uevent support was initially added to handle systems where pressing 
a hotkey generates an event (good) but the firmware automatically 
changes the brightness (bad). I have absolutely no idea why I added 
BACKLIGHT_UPDATE_SYSFS - BACKLIGHT_UPDATE_HOTKEY solves the problem I 
was trying to solve. I'm not aware of any userspace that relies on 
BACKLIGHT_UPDATE_SYSFS.

-- 
Matthew Garrett | mjg59@srcf.ucam.org

Re: [PATCH] video: backlight: Remove backlight sysfs uevent

From: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Date: 2013-11-22 11:36:15

On Thu, 21 Nov 2013, Matthew Garrett wrote:
On Thu, Nov 21, 2013 at 09:43:32AM -0200, Henrique de Moraes Holschuh wrote:
quoted
With this patchset applied, as far as I can tell anything that used to be
uevent-driven by the backlight class will break: when a process changes the
backlight using sysfs, other processes will not be notified of the change
anymore.  This patchset seems to break backlight uevent support in such a
way that basically renders the entire thing useless and you might as well
just remove uevent support entirely.
The uevent support was initially added to handle systems where pressing 
a hotkey generates an event (good) but the firmware automatically 
changes the brightness (bad). I have absolutely no idea why I added 
BACKLIGHT_UPDATE_SYSFS - BACKLIGHT_UPDATE_HOTKEY solves the problem I 
was trying to solve. I'm not aware of any userspace that relies on 
BACKLIGHT_UPDATE_SYSFS.
Well, either we have userspace that rely on the uevents, or we don't. 

If we don't have any uevent users of the backlight notifications, we might
as well just rip out the feature entirely and replace it with something with
a proper design.  But that would mean all OSD is being done by time-based
open-read-close polling of sysfs or keyed to input events (and therefore
half-baked).

However, if we do have anything that rely on the uevents, it needs
BACKLIGHT_UPDATE_SYSFS.  Without it, there will be no notifications when the
backlight level is changed through sysfs.  And we *DO* have applications
that change the backlight level through sysfs.  From the top of my head, I
know KDE does when it starts, and also as a response to power management
events.  Also, userspace hotkey daemons do use the sysfs interface.

-- 
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh

Re: [PATCH] video: backlight: Remove backlight sysfs uevent

From: Matthew Garrett <mjg59@srcf.ucam.org>
Date: 2013-11-22 17:16:14

On Fri, Nov 22, 2013 at 09:36:01AM -0200, Henrique de Moraes Holschuh wrote:
On Thu, 21 Nov 2013, Matthew Garrett wrote:
quoted
The uevent support was initially added to handle systems where pressing 
a hotkey generates an event (good) but the firmware automatically 
changes the brightness (bad). I have absolutely no idea why I added 
BACKLIGHT_UPDATE_SYSFS - BACKLIGHT_UPDATE_HOTKEY solves the problem I 
was trying to solve. I'm not aware of any userspace that relies on 
BACKLIGHT_UPDATE_SYSFS.
Well, either we have userspace that rely on the uevents, or we don't. 
We have userspace that relies on uevents of type 
BACKLIGHT_UPDATE_HOTKEY. I don't know that we have userspace that relies 
on uevents of type BACKLIGHT_UPDATE_SYSFS.

-- 
Matthew Garrett | mjg59@srcf.ucam.org

Re: [ibm-acpi-devel] [PATCH] video: backlight: Remove backlight sysfs uevent

From: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Date: 2013-11-24 00:40:23

On Fri, 22 Nov 2013, Matthew Garrett wrote:
On Fri, Nov 22, 2013 at 09:36:01AM -0200, Henrique de Moraes Holschuh wrote:
quoted
On Thu, 21 Nov 2013, Matthew Garrett wrote:
quoted
The uevent support was initially added to handle systems where pressing 
a hotkey generates an event (good) but the firmware automatically 
changes the brightness (bad). I have absolutely no idea why I added 
BACKLIGHT_UPDATE_SYSFS - BACKLIGHT_UPDATE_HOTKEY solves the problem I 
was trying to solve. I'm not aware of any userspace that relies on 
BACKLIGHT_UPDATE_SYSFS.
Well, either we have userspace that rely on the uevents, or we don't. 
We have userspace that relies on uevents of type 
BACKLIGHT_UPDATE_HOTKEY. I don't know that we have userspace that relies 
on uevents of type BACKLIGHT_UPDATE_SYSFS.
Any OSD application would have to rely on both uevent types, or it is broken
(and to test that, just write a level to sysfs and watch the OSD app fail to
tell you about the backlight level change...)

I don't know about other types of applications, though.  What other type of
applications pay attention to backlight uevents?

-- 
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh

Re: [ibm-acpi-devel] [PATCH] video: backlight: Remove backlight sysfs uevent

From: Matthew Garrett <mjg59@srcf.ucam.org>
Date: 2013-11-24 01:03:12

On Sat, Nov 23, 2013 at 10:40:15PM -0200, Henrique de Moraes Holschuh wrote:
On Fri, 22 Nov 2013, Matthew Garrett wrote:
quoted
We have userspace that relies on uevents of type 
BACKLIGHT_UPDATE_HOTKEY. I don't know that we have userspace that relies 
on uevents of type BACKLIGHT_UPDATE_SYSFS.
Any OSD application would have to rely on both uevent types, or it is broken
(and to test that, just write a level to sysfs and watch the OSD app fail to
tell you about the backlight level change...)
Right, OSDs are supposed to respond to keypresses, not arbitrary changes 
of backlight. If the user's just echoed 8 into brightness, they know 
they set the brightness to 8 - they don't need an OSD to tell them that. 
BACKLIGHT_UPDATE_HOTKEY is when the firmware itself has changed the 
brightness in response to a keypress, and so reporting the keypress 
would result in additional backlight changes.

-- 
Matthew Garrett | mjg59@srcf.ucam.org

Re: [ibm-acpi-devel] [PATCH] video: backlight: Remove backlight sysfs uevent

From: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Date: 2013-11-24 03:53:18

On Sun, 24 Nov 2013, Matthew Garrett wrote:
On Sat, Nov 23, 2013 at 10:40:15PM -0200, Henrique de Moraes Holschuh wrote:
quoted
On Fri, 22 Nov 2013, Matthew Garrett wrote:
quoted
We have userspace that relies on uevents of type 
BACKLIGHT_UPDATE_HOTKEY. I don't know that we have userspace that relies 
on uevents of type BACKLIGHT_UPDATE_SYSFS.
Any OSD application would have to rely on both uevent types, or it is broken
(and to test that, just write a level to sysfs and watch the OSD app fail to
tell you about the backlight level change...)
Right, OSDs are supposed to respond to keypresses, not arbitrary changes 
of backlight. If the user's just echoed 8 into brightness, they know 
they set the brightness to 8 - they don't need an OSD to tell them that. 
It is not just the user that sets the brightness.

Still, if you're sure that all userspace users react only to the hotkey type
of event, removing the sysfs one won't break anything any further.

But it will be *really* annoying the day we revisit this because someone
started abusing the hotkey uevent and we have to deploy a proper fix (rate
limiting or switching to a proper event report interface that doesn't use
uevents).
BACKLIGHT_UPDATE_HOTKEY is when the firmware itself has changed the 
brightness in response to a keypress, and so reporting the keypress 
would result in additional backlight changes.
Yeah, I know that bug quite well, thinkpads were the first victims of
idiotic feedback event loops caused by braindead userspace.

-- 
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh

Re: [ibm-acpi-devel] [PATCH] video: backlight: Remove backlight sysfs uevent

From: Andrew Morton <akpm@linux-foundation.org>
Date: 2013-12-16 07:52:05

On Sun, 24 Nov 2013 01:53:11 -0200 Henrique de Moraes Holschuh [off-list ref] wrote:
On Sun, 24 Nov 2013, Matthew Garrett wrote:
quoted
On Sat, Nov 23, 2013 at 10:40:15PM -0200, Henrique de Moraes Holschuh wrote:
quoted
On Fri, 22 Nov 2013, Matthew Garrett wrote:
quoted
We have userspace that relies on uevents of type 
BACKLIGHT_UPDATE_HOTKEY. I don't know that we have userspace that relies 
on uevents of type BACKLIGHT_UPDATE_SYSFS.
Any OSD application would have to rely on both uevent types, or it is broken
(and to test that, just write a level to sysfs and watch the OSD app fail to
tell you about the backlight level change...)
Right, OSDs are supposed to respond to keypresses, not arbitrary changes 
of backlight. If the user's just echoed 8 into brightness, they know 
they set the brightness to 8 - they don't need an OSD to tell them that. 
It is not just the user that sets the brightness.

Still, if you're sure that all userspace users react only to the hotkey type
of event, removing the sysfs one won't break anything any further.

But it will be *really* annoying the day we revisit this because someone
started abusing the hotkey uevent and we have to deploy a proper fix (rate
limiting or switching to a proper event report interface that doesn't use
uevents).
quoted
BACKLIGHT_UPDATE_HOTKEY is when the firmware itself has changed the 
brightness in response to a keypress, and so reporting the keypress 
would result in additional backlight changes.
Yeah, I know that bug quite well, thinkpads were the first victims of
idiotic feedback event loops caused by braindead userspace.
I'm not seeing a lot of consensus here and afaict the v2 patch:
--- a/drivers/video/backlight/backlight.c~drivers-video-backlight-backlightc-remove-backlight-sysfs-uevent
+++ a/drivers/video/backlight/backlight.c
@@ -175,8 +175,6 @@ static ssize_t brightness_store(struct d
 	}
 	mutex_unlock(&bd->ops_lock);
 
-	backlight_generate_event(bd, BACKLIGHT_UPDATE_SYSFS);
-
 	return rc;
 }
 static DEVICE_ATTR_RW(brightness);
will still break userspace which relies on BACKLIGHT_UPDATE_SYSFS
uevents.  I see no way we can guarantee that there is no such userspace
so the patch is worrying.

Should we instead be looking for a way of avoiding this risk?  Say, add
a new knob which people can set if they don't want to generate this
event?  Ugly, but that's the price we pay for mucking it up originally.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help