video: backlight: Remove backlight sysfs uevent
Subsystems (3)
PATCH 1/1 video: backlight: Remove backlight sysfs uevent
From: Kyungmin Park <[email protected]>
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."
---
drivers/video/backlight/backlight.c +0 -5
@@ -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);
include/linux/backlight.h +0 -1
@@ -29,7 +29,6 @@enum backlight_update_reason {BACKLIGHT_UPDATE_HOTKEY , -BACKLIGHT_UPDATE_SYSFS , };enum backlight_type {
Quoted 48 lines · Kyungmin Park
From: Kyungmin Park <[email protected]>
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 <[email protected]>---
drivers/video/backlight/backlight.c +0
-5@@ -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);include/linux/backlight.h +0
-0
include/linux/backlight.h line 32
Quoted 4 lines
include/linux/backlight.h +0
-1@@ -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
Quoted 3 lines
include/linux/backlight.h +0
-0};enum backlight_type {
Quoted 9 lines · Jingoo Han
Quoted 8 lines · Kyungmin Park
From: Kyungmin Park <[email protected]>
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.
Quoted 8 lines
Quoted 8 lines
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 2 lines
'
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...
Signature · 4 lines
"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
Quoted 31 lines · Henrique de Moraes Holschuh
Quoted 9 lines · Jingoo Han
Quoted 8 lines · Kyungmin Park
From: Kyungmin Park <[email protected]>
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.
Quoted 8 lines
Quoted 8 lines
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 5 lines
Quoted 2 lines
'
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
Quoted 10 lines
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
Quoted 26 lines · Henrique de Moraes Holschuh
Quoted 9 lines · Jingoo Han
Quoted 8 lines · Kyungmin Park
From: Kyungmin Park <[email protected]>
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.
Quoted 8 lines
Quoted 8 lines
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.
Quoted 4 lines
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 5 lines
Quoted 2 lines
'
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 3 lines
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
Quoted 49 lines · Kay Sievers
Quoted 26 lines · Henrique de Moraes Holschuh
Quoted 9 lines · Jingoo Han
Quoted 8 lines · Kyungmin Park
From: Kyungmin Park <[email protected]>
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.
Quoted 8 lines
Quoted 8 lines
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.
Quoted 4 lines
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 5 lines
Quoted 2 lines
'
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 3 lines
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...
Quoted 8 lines
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
Quoted 55 lines · Kyungmin Park
Quoted 54 lines · Kay Sievers
Quoted 26 lines · Henrique de Moraes Holschuh
Quoted 9 lines · Jingoo Han
Quoted 8 lines · Kyungmin Park
From: Kyungmin Park <[email protected]>
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.
Quoted 8 lines
Quoted 8 lines
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.
Quoted 4 lines
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 5 lines
Quoted 2 lines
'
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 3 lines
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.
Quoted 7 lines
Quoted 3 lines
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
Quoted 6 lines · Henrique de Moraes Holschuh
Quoted 2 lines · Jingoo Han
'
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.
Signature · 1 line
Matthew Garrett <[email protected]>
Quoted 11 lines · Matthew Garrett
Quoted 6 lines · Henrique de Moraes Holschuh
Quoted 2 lines · Jingoo Han
'
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.
Signature · 4 lines
"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
Quoted 6 lines · Henrique de Moraes Holschuh
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.
Signature · 1 line
Matthew Garrett | [email protected]
Quoted 8 lines · Matthew Garrett
Quoted 6 lines · Henrique de Moraes Holschuh
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.
Quoted 6 lines
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_HOTKEYsolves the problem I was trying to solve. I'm not aware of any userspace that relies onBACKLIGHT_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.
Signature · 4 lines
"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
Quoted 9 lines · Henrique de Moraes Holschuh
Quoted 6 lines · Matthew Garrett
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_HOTKEYsolves the problem I was trying to solve. I'm not aware of any userspace that relies onBACKLIGHT_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.
Signature · 1 line
Matthew Garrett | [email protected]
Quoted 9 lines · Matthew Garrett
Quoted 8 lines · Henrique de Moraes Holschuh
Quoted 6 lines · Matthew Garrett
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_HOTKEYsolves the problem I was trying to solve. I'm not aware of any userspace that relies onBACKLIGHT_UPDATE_SYSFS.
Quoted 5 lines
Quoted 1 line
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 typeBACKLIGHT_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?
Signature · 4 lines
"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
Quoted 8 lines · Henrique de Moraes Holschuh
Quoted 3 lines · Matthew Garrett
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 typeBACKLIGHT_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.
Signature · 1 line
Matthew Garrett | [email protected]
Quoted 6 lines · Matthew Garrett
Quoted 5 lines · Henrique de Moraes Holschuh
Quoted 3 lines · Matthew Garrett
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 typeBACKLIGHT_UPDATE_SYSFS.
Quoted 7 lines
Quoted 3 lines
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 3 lines
BACKLIGHT_UPDATE_HOTKEYis 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.
Signature · 4 lines
"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
Quoted 25 lines · On Sun, 24 Nov 2013 01:53:11 -0200 Henrique de Moraes Holschuh…
Quoted 6 lines · Matthew Garrett
Quoted 5 lines · Henrique de Moraes Holschuh
Quoted 3 lines · Matthew Garrett
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 typeBACKLIGHT_UPDATE_SYSFS.Quoted 7 lines
Quoted 3 lines
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 6 lines
Quoted 3 lines
BACKLIGHT_UPDATE_HOTKEYis 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:
drivers/video/backlight/backlight.c renamed from drivers/video/backlight/backlight.c~drivers-video-backlight-backlightc-remove-backlight-sysfs-uevent +0 -2
@@ -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.
Quoted 47 lines · Andrew Morton
Quoted 25 lines · On Sun, 24 Nov 2013 01:53:11 -0200 Henrique de Moraes Holschuh…
Quoted 6 lines · Matthew Garrett
Quoted 5 lines · Henrique de Moraes Holschuh
Quoted 3 lines · Matthew Garrett
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 typeBACKLIGHT_UPDATE_SYSFS.Quoted 7 lines
Quoted 3 lines
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 6 lines
Quoted 3 lines
BACKLIGHT_UPDATE_HOTKEYis 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:
drivers/video/backlight/backlight.c renamed from drivers/video/backlight/backlight.c~drivers-video-backlight-backlightc-remove-backlight-sysfs-uevent +0
-2@@ -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);
Quoted 7 lines
will still break userspace which relies on
BACKLIGHT_UPDATE_SYSFSuevents. 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.
Well, either that, or a smart rate limiter with a sane default. It could well be configurable to suppress all events, for the benefit of embedded devices.
Signature · 4 lines
"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