blink driver power saving
The blink driver wakes up every jiffies which wastes power unnecessarily. Using a notifier gives same effect. Also add ability to unload module.
drivers/misc/blink.c +20 -2
@@ -16,12 +16,30 @@ static void do_blink(unsigned long data)add_timer (&blink_timer); } -static int blink_init (void ) +static int blink_panic_event (struct notifier_block *blk, +unsigned long event,void *arg) { -printk (KERN_INFO "Enabling keyboard blinking\n" );do_blink (0 );return 0 ; } +static struct notifier_block blink_notify = { + .notifier_call = blink_panic_event, +}; + +static __init int blink_init (void ) +{ +printk (KERN_INFO "Enabling keyboard blinking\n" ); +atomic_notifier_chain_register (&panic_notifier_list, &blink_notify); +return 0 ; +} + +static __exit void blink_remove(void) +{ +del_timer_sync (&blink_timer); +atomic_notifier_chain_unregister (&panic_notifier_list, &blink_notify); +} +module_init (blink_init); +module_exit (blink_remove);
Quoted 3 lines · Stephen Hemminger
The blink driver wakes up every jiffies which wastes power unnecessarily. Using a notifier gives same effect. Also add ability to unload module.
I really get the feeling this thing should be removed entirely. Wasting power is the _least_ of its problems.
I'll apply the patch, but I wonder if I should also just mark it BROKEN in the config file to make sure nobody enables it without realizing how bad it is to do so.
Linus
Quoted 8 lines · On Sunday 01 July 2007 20:07:21 Linus Torvalds wrote:
Quoted 3 lines · Stephen Hemminger
The blink driver wakes up every jiffies which wastes power unnecessarily. Using a notifier gives same effect. Also add ability to unload module.
I really get the feeling this thing should be removed entirely. Wasting power is the _least_ of its problems.
What is so bad with it? Note it's a debugging facility and used for kcrash kernels where the video output doesn't work. But they normally only run a few minutes to dump the previous state to disk and then reboot.
Quoted 3 lines
I'll apply the patch, but I wonder if I should also just mark it BROKEN in the config file to make sure nobody enables it without realizing how bad it is to do so.
Well I suspect it will not work anymore after Stephen's patch (or rather try to blink redundantly after panic which is quite dumb) If that is your aim then it might be cleaner to remove it.
But then I don't think it hurts anybody. It's main problem is that it won't blink for people with USB keyboard.
-Andi
Quoted 5 lines · Andi Kleen
What is so bad with it? Note it's a debugging facility and used for kcrash kernels where the video output doesn't work. But they normally only run a few minutes to dump the previous state to disk and then reboot.
It has been a total disaster from beginning to end.
It wastes power.
It hangs machines when it tries to blink.
To quote an earlier thread:
"The driver uses panic_blink - something that we expect to work after
panic. It rapidly polls KBC status register to detect when it accepted led command and does it without taking i8042_lock (because it may have been taken before kernel panicked) so it is quite possible that that interferes with atkbd operation."
and it has been confirmed to render unusable at least some thinkpads. I think it was Pavel who reported it last.
Quoted 2 lines
But then I don't think it hurts anybody. It's main problem is that it won't blink for people with USB keyboard.
No, its main problem is that PEOPLE SHOULD NOT USE IT, but it sounds cool, so people end up configuring the damn thing even though they shouldn't.
Which is why I think it should be marked broken.
And yes, it *does* hurt people.
Linus
Quoted 9 lines · Linus Torvalds
Quoted 4 lines · Andi Kleen
What is so bad with it? Note it's a debugging facility and used for kcrash kernels where the video output doesn't work. But they normally only run a few minutes to dump the previous state to disk and then reboot.
It has been a total disaster from beginning to end.
It wastes power.
Again:
It's not intended for normal kernels. It's a debugging feature. It's not intended for normal kernels. It's a debugging feature. It's not intended for normal kernels. It's a debugging feature.
Got it now? Power wasting or not just doesn't matter for it.
Quoted 1 line
It hangs machines when it tries to blink.
Yes, there seem to be more buggy keyboard controllers around than I anticipated. Very sad that IBM couldn't even get such a simple thing right.
Well only those that could be already hung from user space with setleds (that was also confirmed). Actually I thought they didn't hang completely, but just stopped reacting to the keyboard (which is actually pretty bad for every user to be able to trigger)
I guess the better way to handle those would be to find out the minimum frequency of blinking that is still ok and rate limit it to that in the keyboard driver.
Anyways, Stephen's patch just doesn't make sense:
he clearly didn't understand the code at all. Before you apply it and cripple it better drop the driver completely.
-Andi
Quoted 6 lines · Andi Kleen
It's not intended for normal kernels. It's a debugging feature. It's not intended for normal kernels. It's a debugging feature. It's not intended for normal kernels. It's a debugging feature.
Got it now?
You seem to have some reading comprehension problems.
The email you replied to had this in it:
"No, its main problem is that PEOPLE SHOULD NOT USE IT, but it sounds cool,
so people end up configuring the damn thing even though they shouldn't."
but you seem to not have understood.
Got it now?
Quoted 5 lines
Quoted 1 line
It hangs machines when it tries to blink.
Yes, there seem to be more buggy keyboard controllers around than I anticipated. Very sad that IBM couldn't even get such a simple thing right.
Well, I would say that the driver itself is buggy. It calls "panic_blink()", which doesn't do the proper locking (i8042_lock is required to protect the accesses, otherwise you can have different entities in the system writing to the command ports concurrently, and get random stuff happening!).
So blaming "buggy keyboard controllers" is pretty damn silly of you, when the real problem is that the driver is broken. That interface is for panic, and panic *only*, and avoids the lock exactly because it's meant to be called when the system is basically dead.
Why did you think that function is called "panic_blink()"?
Yes, it could be hidden by making it do the buggy calls less often. That makes some machines work, but it doesn't change the fact that it would still be buggy.
Quoted 3 lines
Anyways, Stephen's patch just doesn't make sense:
he clearly didn't understand the code at all. Before you apply it and cripple it better drop the driver completely.
I think I will have to.
Linus
Quoted 5 lines
Quoted 3 lines
Anyways, Stephen's patch just doesn't make sense:
he clearly didn't understand the code at all. Before you apply it and cripple it better drop the driver completely.I think I will have to.
Make it depend on the kernel debug options and if you are really paranoid also add a module option to enable it at boot time. The module option works pretty well and various old and new IDE drivers do it to stop make allyesconfig accidents
Quoted 7 lines · On Mon, 2 Jul 2007 01:59:50 +0200 Andi Kleen <[email protected]> wrote:
Quoted 6 lines · Linus Torvalds
Quoted 4 lines · Andi Kleen
What is so bad with it? Note it's a debugging facility and used for kcrash kernels where the video output doesn't work. But they normally only run a few minutes to dump the previous state to disk and then reboot.
Quoted 8 lines
Quoted 3 lines
It has been a total disaster from beginning to end.
It wastes power.
Again:
It's not intended for normal kernels. It's a debugging feature. It's not intended for normal kernels. It's a debugging feature. It's not intended for normal kernels. It's a debugging feature.
It can be generally useful. Until/unless we get proper screen support, how do you know hang from panic? If you can talk to some other device it would help.
Quoted 14 lines
Got it now? Power wasting or not just doesn't matter for it.
Quoted 1 line
It hangs machines when it tries to blink.
Yes, there seem to be more buggy keyboard controllers around than I anticipated. Very sad that IBM couldn't even get such a simple thing right.
Well only those that could be already hung from user space with setleds (that was also confirmed). Actually I thought they didn't hang completely, but just stopped reacting to the keyboard (which is actually pretty bad for every user to be able to trigger)
Quoted 7 lines
I guess the better way to handle those would be to find out the minimum frequency of blinking that is still ok and rate limit it to that in the keyboard driver.
Anyways, Stephen's patch just doesn't make sense:
he clearly didn't understand the code at all. Before you apply it and cripple it better drop the driver completely.
The patch makes sense. You don't need to poll every jiffie to find out if system has panic. But I agree with Linus, it is the kind of patch that doesn't belong in the mainline kernel. Every developer seems to have built up a set of crappy/fragile debug tools, but these don't belong in the wild.
Signature · 1 line
Stephen Hemminger <[email protected]>
Quoted 7 lines · Stephen Hemminger
The patch makes sense. You don't need to poll every jiffie to find out if system has panic. But I agree with Linus, it is the kind of patch that doesn't belong in the mainline kernel. Every developer seems to have built up a set of crappy/fragile debug tools, but these don't belong in the wild.
Stephen,
The drivers blinks LEDs when kernel operates normally. During panic the panic_blink() routine in i8042 gets called directly, without involving the blink driver.
Signature · 1 line
Dmitry
Quoted 2 lines · On Monday 02 July 2007 19:50:00 Stephen Hemminger wrote:
The patch makes sense. You don't need to poll every jiffie to find out if system has panic.
The blink driver doesn't run on panic (or at least not on panic on the same kernel). It runs always. It was designed to do the blinking while the kdump kernel runs and writes the dump.
Quoted 4 lines
But I agree with Linus, it is the kind
of patch that doesn't belong in the mainline kernel. Every developer seems to have built up a set of crappy/fragile debug tools, but these don't belong in the wild.
Would you argue then that kdump also doesn't belong into the kernel? The patch was designed to plug a hole in kdump (no visual feedback)
-Andi
Hi!
Quoted 7 lines
Quoted 2 lines
The patch makes sense. You don't need to poll every jiffie to find out if system has panic.
The blink driver doesn't run on panic (or at least not on panic on the same kernel). It runs always. It was designed to do the blinking while the kdump kernel runs and writes the dump.
Quoted 7 lines
Quoted 4 lines
But I agree with Linus, it is the kind
of patch that doesn't belong in the mainline kernel. Every developer seems to have built up a set of crappy/fragile debug tools, but these don't belong in the wild.Would you argue then that kdump also doesn't belong into the kernel? The patch was designed to plug a hole in kdump (no visual feedback)
kexec -p <dump-capture-kernel-vmlinux-image> \ --initrd=<initrd-for-dump-capture-kernel> --args-linux \ --append="root=<root-dev> <arch-specific-options>"
....so we are already using initrd for dumping...? I'd say providing visual feedback is surely an userspace task.
Heck, with the keyboard leds you could probably blink them in a way telling user how much dump was done. Blink once then pause - 10%, blink twice then pause - 20%, ...
And yes, we already have LED subsystem capable of doing all this.
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Quoted 2 lines · On Sunday 01 July 2007 18:50:35 Stephen Hemminger wrote:
The blink driver wakes up every jiffies which wastes power unnecessarily. Using a notifier gives same effect. Also add ability to unload module.
It's really a debugging tool where you normally don't care about details like this. I wrote it to get visual feedback during kdump, but it is nothing you should ever run during normal operation.
But I don't get how your patch is supposed to work. The blink driver is not supposed to blink after panic -- panic does that anyways -- but always. So hooking it into the panic notifier chain which is only called on panic makes about zero sense.
If it's really needed to fix the wakeup issue the interface to the keyboard blinking would need to be changed.
-Andi