* [KJ] hotplug
@ 2006-01-09 11:33 carlos neira
2006-01-09 15:11 ` Matthew Wilcox
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: carlos neira @ 2006-01-09 11:33 UTC (permalink / raw)
To: kernel-janitors
[-- Attachment #1: Type: text/plain, Size: 469 bytes --]
Greetings :
linux-2.6.15-rc7/drivers/pci/hotplug/pciehp_ctrl.c
linux-2.6.15-rc7/drivers/pci/hotplug/cpqphp_ctrl.c
linux-2.6.15-rc7/drivers/pci/hotplug/cpci_hotplug_core.c
Replaced lock_kernel() with spinlocks , compile tested ok , using it.
As always if someone knows this patch breaks anything please tell me so.
--
"Employ your time in improving yourself by other men's writings, so that you
shall gain easily what others have labored hard for."
Socrates
[-- Attachment #2: hotplug.patch --]
[-- Type: text/x-diff, Size: 3670 bytes --]
diff -uN /usr/src/linux-2.6.15-rc7/drivers/pci/hotplug/cpci_hotplug_core.c /home/cneira/Linuxjanitoring/linux-janitorpatching/drivers/pci/hotplug/cpci_hotplug_core.c
--- /usr/src/linux-2.6.15-rc7/drivers/pci/hotplug/cpci_hotplug_core.c 2005-12-24 20:47:48.000000000 -0300
+++ /home/cneira/Linuxjanitoring/linux-janitorpatching/drivers/pci/hotplug/cpci_hotplug_core.c 2006-01-08 23:41:07.000000000 -0300
@@ -35,6 +35,7 @@
#include <linux/smp_lock.h>
#include <asm/atomic.h>
#include <linux/delay.h>
+#include <linux/spinlock.h>
#include "pci_hotplug.h"
#include "cpci_hotplug.h"
@@ -525,9 +526,9 @@
{
int rc;
- lock_kernel();
+ spin_lock(&event_thread);
daemonize("cpci_hp_eventd");
- unlock_kernel();
+ spin_unlock(&event_thread);
dbg("%s - event thread started", __FUNCTION__);
while (1) {
@@ -566,9 +567,9 @@
{
int rc;
- lock_kernel();
+ spin_lock(&poll_thread);
daemonize("cpci_hp_polld");
- unlock_kernel();
+ spin_unlock(&poll_thread);
while (1) {
if (thread_finished || signal_pending(current))
diff -uN /usr/src/linux-2.6.15-rc7/drivers/pci/hotplug/cpqphp_ctrl.c /home/cneira/Linuxjanitoring/linux-janitorpatching/drivers/pci/hotplug/cpqphp_ctrl.c
--- /usr/src/linux-2.6.15-rc7/drivers/pci/hotplug/cpqphp_ctrl.c 2005-12-24 20:47:48.000000000 -0300
+++ /home/cneira/Linuxjanitoring/linux-janitorpatching/drivers/pci/hotplug/cpqphp_ctrl.c 2006-01-08 23:37:19.000000000 -0300
@@ -37,6 +37,7 @@
#include <linux/wait.h>
#include <linux/smp_lock.h>
#include <linux/pci.h>
+#include <linux/spinlock.h>
#include "cpqphp.h"
static u32 configure_new_device(struct controller* ctrl, struct pci_func *func,
@@ -1794,12 +1795,11 @@
static int event_thread(void* data)
{
struct controller *ctrl;
- lock_kernel();
+ spin_lock(&event_thread);
daemonize("phpd_event");
+ spin_unlock(&event_thread);
- unlock_kernel();
-
- while (1) {
+ while (1) {
dbg("!!!!event_thread sleeping\n");
down_interruptible (&event_semaphore);
dbg("event_thread woken finished = %d\n", event_finished);
diff -uN /usr/src/linux-2.6.15-rc7/drivers/pci/hotplug/pciehp_ctrl.c /home/cneira/Linuxjanitoring/linux-janitorpatching/drivers/pci/hotplug/pciehp_ctrl.c
--- /usr/src/linux-2.6.15-rc7/drivers/pci/hotplug/pciehp_ctrl.c 2005-12-24 20:47:48.000000000 -0300
+++ /home/cneira/Linuxjanitoring/linux-janitorpatching/drivers/pci/hotplug/pciehp_ctrl.c 2006-01-08 23:34:39.000000000 -0300
@@ -32,6 +32,7 @@
#include <linux/types.h>
#include <linux/smp_lock.h>
#include <linux/pci.h>
+#include <linux/spinlock.h>
#include "../pci.h"
#include "pciehp.h"
@@ -517,10 +518,9 @@
static int event_thread(void* data)
{
struct controller *ctrl;
- lock_kernel();
+ spin_lock(&event_thread);
daemonize("pciehpd_event");
-
- unlock_kernel();
+ spin_unlock(&event_thread);
while (1) {
dbg("!!!!event_thread sleeping\n");
diff -uN /usr/src/linux-2.6.15-rc7/drivers/pci/hotplug/shpchp_ctrl.c /home/cneira/Linuxjanitoring/linux-janitorpatching/drivers/pci/hotplug/shpchp_ctrl.c
--- /usr/src/linux-2.6.15-rc7/drivers/pci/hotplug/shpchp_ctrl.c 2005-12-24 20:47:48.000000000 -0300
+++ /home/cneira/Linuxjanitoring/linux-janitorpatching/drivers/pci/hotplug/shpchp_ctrl.c 2006-01-09 00:30:06.000000000 -0300
@@ -32,6 +32,7 @@
#include <linux/types.h>
#include <linux/smp_lock.h>
#include <linux/pci.h>
+#include <linux/spinlock.h>
#include "../pci.h"
#include "shpchp.h"
@@ -693,9 +694,9 @@
static int event_thread(void* data)
{
struct controller *ctrl;
- lock_kernel();
+ spin_lock(&event_thread);
daemonize("shpchpd_event");
- unlock_kernel();
+ spin_unlock(&event_thread);
while (1) {
dbg("!!!!event_thread sleeping\n");
[-- Attachment #3: Type: text/plain, Size: 168 bytes --]
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [KJ] hotplug
2006-01-09 11:33 [KJ] hotplug carlos neira
@ 2006-01-09 15:11 ` Matthew Wilcox
2006-01-09 16:41 ` Alexey Dobriyan
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Matthew Wilcox @ 2006-01-09 15:11 UTC (permalink / raw)
To: kernel-janitors
[-- Attachment #1: Type: text/plain, Size: 566 bytes --]
On Mon, Jan 09, 2006 at 11:33:52AM +0000, carlos neira wrote:
> Replaced lock_kernel() with spinlocks , compile tested ok , using it.
I can only imagine you're either doing this with a uniprocessor
kernel or don't actually have the hardware in question.
> - lock_kernel();
> + spin_lock(&event_thread);
> daemonize("cpci_hp_eventd");
> - unlock_kernel();
> + spin_unlock(&event_thread);
void daemonize(const char *name, ...)
{
[...]
down(&tty_sem);
current->signal->tty = NULL;
up(&tty_sem);
The first line of down() is
might_sleep();
[-- Attachment #2: Type: text/plain, Size: 168 bytes --]
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [KJ] hotplug
2006-01-09 11:33 [KJ] hotplug carlos neira
2006-01-09 15:11 ` Matthew Wilcox
@ 2006-01-09 16:41 ` Alexey Dobriyan
2006-01-09 17:05 ` Greg KH
2006-01-09 17:32 ` Kristen Accardi
3 siblings, 0 replies; 5+ messages in thread
From: Alexey Dobriyan @ 2006-01-09 16:41 UTC (permalink / raw)
To: kernel-janitors
[-- Attachment #1: Type: text/plain, Size: 1127 bytes --]
On Mon, Jan 09, 2006 at 11:33:52AM +0000, carlos neira wrote:
> Replaced lock_kernel() with spinlocks , compile tested ok ,
Not true.
CC drivers/pci/hotplug/cpqphp_ctrl.o
drivers/pci/hotplug/cpqphp_ctrl.c: In function `event_thread':
drivers/pci/hotplug/cpqphp_ctrl.c:1798: warning: passing arg 1 of `_spin_lock' from incompatible pointer type
drivers/pci/hotplug/cpqphp_ctrl.c:1800: warning: passing arg 1 of `_spin_unlock' from incompatible pointer type
> using it.
Well, I'm impressed.
> diff -uN /usr/src/linux-2.6.15-rc7/drivers/pci/hotplug/cpci_hotplug_core.c /home/cneira/Linuxjanitoring/linux-janitorpatching/drivers/pci/hotplug/cpci_hotplug_core.c
> --- /usr/src/linux-2.6.15-rc7/drivers/pci/hotplug/cpci_hotplug_core.c 2005-12-24 20:47:48.000000000 -0300
> +++ /home/cneira/Linuxjanitoring/linux-janitorpatching/drivers/pci/hotplug/cpci_hotplug_core.c 2006-01-08 23:41:07.000000000 -0300
> @@ -525,9 +526,9 @@
> {
> int rc;
>
> - lock_kernel();
> + spin_lock(&event_thread);
> daemonize("cpci_hp_eventd");
> - unlock_kernel();
> + spin_unlock(&event_thread);
static int
event_thread(void *data)
[-- Attachment #2: Type: text/plain, Size: 168 bytes --]
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [KJ] hotplug
2006-01-09 11:33 [KJ] hotplug carlos neira
2006-01-09 15:11 ` Matthew Wilcox
2006-01-09 16:41 ` Alexey Dobriyan
@ 2006-01-09 17:05 ` Greg KH
2006-01-09 17:32 ` Kristen Accardi
3 siblings, 0 replies; 5+ messages in thread
From: Greg KH @ 2006-01-09 17:05 UTC (permalink / raw)
To: kernel-janitors
[-- Attachment #1: Type: text/plain, Size: 475 bytes --]
On Mon, Jan 09, 2006 at 11:33:52AM +0000, carlos neira wrote:
> Greetings :
> linux-2.6.15-rc7/drivers/pci/hotplug/pciehp_ctrl.c
> linux-2.6.15-rc7/drivers/pci/hotplug/cpqphp_ctrl.c
> linux-2.6.15-rc7/drivers/pci/hotplug/cpci_hotplug_core.c
>
> Replaced lock_kernel() with spinlocks , compile tested ok , using it.
Do you have a pci hotplug system to test this with?
And as others pointed out, this patch is pretty broken, please consider
it rejected.
thanks,
greg k-h
[-- Attachment #2: Type: text/plain, Size: 168 bytes --]
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [KJ] hotplug
2006-01-09 11:33 [KJ] hotplug carlos neira
` (2 preceding siblings ...)
2006-01-09 17:05 ` Greg KH
@ 2006-01-09 17:32 ` Kristen Accardi
3 siblings, 0 replies; 5+ messages in thread
From: Kristen Accardi @ 2006-01-09 17:32 UTC (permalink / raw)
To: kernel-janitors
[-- Attachment #1: Type: text/plain, Size: 524 bytes --]
On Mon, 2006-01-09 at 11:33 +0000, carlos neira wrote:
> Greetings :
> linux-2.6.15-rc7/drivers/pci/hotplug/pciehp_ctrl.c
> linux-2.6.15-rc7/drivers/pci/hotplug/cpqphp_ctrl.c
> linux-2.6.15-rc7/drivers/pci/hotplug/cpci_hotplug_core.c
>
> Replaced lock_kernel() with spinlocks , compile tested ok , using it.
>
> As always if someone knows this patch breaks anything please tell me so.
>
The proper usage of spin_lock is with a spinlock_t *, also, you cannot
sleep while holding a spinlock, and daemonize may sleep.
[-- Attachment #2: Type: text/plain, Size: 168 bytes --]
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2006-01-09 17:32 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-01-09 11:33 [KJ] hotplug carlos neira
2006-01-09 15:11 ` Matthew Wilcox
2006-01-09 16:41 ` Alexey Dobriyan
2006-01-09 17:05 ` Greg KH
2006-01-09 17:32 ` Kristen Accardi
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.