[PATCH] dell_rbu: fix Bug 5854

This fixes http://bugzilla.kernel.org/show_bug.cgi?id=5854

Root cause:

The dell_rbu driver creates entries in /sys/class/firmware/dell_rbu/ by
calling request_firmware_nowait (without hotplug ) this function inturn
starts a kernel thread which creates the entries in
/sys/class/firmware/dell_rbu/loading , data and the thread waits on the
user action to return control back to the callback fucntion of dell_rbu.
The thread calls wait_on_completion which puts it in a D state until the
user action happens. If there is no user action happening the load average
goes up as the thread D state is taken in to account. Also after
downloading the BIOS image the enrties go away momentarily but they are
recreated from the callback function in dell_rbu. This causes the thread
to get recreated causing the load average to permenently stay around 1.

Fix:

The dell_rbu also creates the entry
/sys/devices/platform/dell_rbu/image_type at driver load time. The image
type by default is mono if required the user can echo packet to image_type
to make the BIOS update mechanism using packets. Also by echoing init in
to image_type the /sys/class/firmware/dell_rbu entries can be created.

The driver code was changed to not create /sys/class/firmware/dell_rbu
entries during load time, and also to not create the above entries from the
callback function. The entries are only created by echoing init to
/sys/devices/platform/dell_rbu/image_type The user now needs to create the
entries to download the image monolithic or packet. This fixes the issue
since the kernel thread only is created when ever the user is ready to
download the BIOS image; this minimizes the life span of the kernel thread
and the load average goes back to normal.

Signed off by Abhay Salunke <abhay_salunke@dell.com>

Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by Abhay Salunke and committed by Linus Torvalds 2c560840 d063389e

+4 -22
+4 -22
drivers/firmware/dell_rbu.c
··· 49 MODULE_AUTHOR("Abhay Salunke <abhay_salunke@dell.com>"); 50 MODULE_DESCRIPTION("Driver for updating BIOS image on DELL systems"); 51 MODULE_LICENSE("GPL"); 52 - MODULE_VERSION("3.1"); 53 54 #define BIOS_SCAN_LIMIT 0xffffffff 55 #define MAX_IMAGE_LENGTH 16 ··· 564 565 static void callbackfn_rbu(const struct firmware *fw, void *context) 566 { 567 - int rc = 0; 568 569 - if (!fw || !fw->size) { 570 - rbu_data.entry_created = 0; 571 return; 572 - } 573 574 spin_lock(&rbu_data.lock); 575 if (!strcmp(image_type, "mono")) { ··· 590 } else 591 pr_debug("invalid image type specified.\n"); 592 spin_unlock(&rbu_data.lock); 593 - 594 - rc = request_firmware_nowait(THIS_MODULE, FW_ACTION_NOHOTPLUG, 595 - "dell_rbu", &rbu_device->dev, &context, callbackfn_rbu); 596 - if (rc) 597 - printk(KERN_ERR 598 - "dell_rbu:%s request_firmware_nowait failed" 599 - " %d\n", __FUNCTION__, rc); 600 - else 601 - rbu_data.entry_created = 1; 602 } 603 604 static ssize_t read_rbu_image_type(struct kobject *kobj, char *buffer, ··· 724 sysfs_create_bin_file(&rbu_device->dev.kobj, 725 &rbu_packet_size_attr); 726 727 - rc = request_firmware_nowait(THIS_MODULE, FW_ACTION_NOHOTPLUG, 728 - "dell_rbu", &rbu_device->dev, &context, callbackfn_rbu); 729 - if (rc) 730 - printk(KERN_ERR "dell_rbu:%s:request_firmware_nowait" 731 - " failed %d\n", __FUNCTION__, rc); 732 - else 733 - rbu_data.entry_created = 1; 734 - 735 return rc; 736 737 }
··· 49 MODULE_AUTHOR("Abhay Salunke <abhay_salunke@dell.com>"); 50 MODULE_DESCRIPTION("Driver for updating BIOS image on DELL systems"); 51 MODULE_LICENSE("GPL"); 52 + MODULE_VERSION("3.2"); 53 54 #define BIOS_SCAN_LIMIT 0xffffffff 55 #define MAX_IMAGE_LENGTH 16 ··· 564 565 static void callbackfn_rbu(const struct firmware *fw, void *context) 566 { 567 + rbu_data.entry_created = 0; 568 569 + if (!fw || !fw->size) 570 return; 571 572 spin_lock(&rbu_data.lock); 573 if (!strcmp(image_type, "mono")) { ··· 592 } else 593 pr_debug("invalid image type specified.\n"); 594 spin_unlock(&rbu_data.lock); 595 } 596 597 static ssize_t read_rbu_image_type(struct kobject *kobj, char *buffer, ··· 735 sysfs_create_bin_file(&rbu_device->dev.kobj, 736 &rbu_packet_size_attr); 737 738 + rbu_data.entry_created = 0; 739 return rc; 740 741 }