* [Patch] Fix XPC code which sleeps with spin_lock_irqsave().
@ 2006-02-01 14:55 Robin Holt
2006-02-02 18:30 ` Robin Holt
0 siblings, 1 reply; 2+ messages in thread
From: Robin Holt @ 2006-02-01 14:55 UTC (permalink / raw)
To: linux-ia64
During some testing, we got a warning about trying to allocate
memory while holding a lock. This fixes that problem.
Signed-off-by: Robin Holt <holt@sgi.com>
Acked-by: Dean Nelson <dcn@sgi.com>
Index: linux-2.6/arch/ia64/sn/kernel/xpc_main.c
=================================--- linux-2.6.orig/arch/ia64/sn/kernel/xpc_main.c 2006-02-01 07:26:10.156287841 -0600
+++ linux-2.6/arch/ia64/sn/kernel/xpc_main.c 2006-02-01 07:29:04.463443840 -0600
@@ -575,14 +575,19 @@ xpc_activate_partition(struct xpc_partit
spin_lock_irqsave(&part->act_lock, irq_flags);
+ DBUG_ON(part->act_state != XPC_P_INACTIVE);
+
+ part->act_state = XPC_P_ACTIVATION_REQ;
+ XPC_SET_REASON(part, xpcCloneKThread, __LINE__);
+
+ spin_unlock_irqrestore(&part->act_lock, irq_flags);
+
pid = kernel_thread(xpc_activating, (void *) ((u64) partid), 0);
- DBUG_ON(part->act_state != XPC_P_INACTIVE);
+ spin_lock_irqsave(&part->act_lock, irq_flags);
- if (pid > 0) {
- part->act_state = XPC_P_ACTIVATION_REQ;
- XPC_SET_REASON(part, xpcCloneKThread, __LINE__);
- } else {
+ if (pid <= 0) {
+ part->act_state = XPC_P_INACTIVE;
XPC_SET_REASON(part, xpcCloneKThreadFailed, __LINE__);
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Patch] Fix XPC code which sleeps with spin_lock_irqsave().
2006-02-01 14:55 [Patch] Fix XPC code which sleeps with spin_lock_irqsave() Robin Holt
@ 2006-02-02 18:30 ` Robin Holt
0 siblings, 0 replies; 2+ messages in thread
From: Robin Holt @ 2006-02-02 18:30 UTC (permalink / raw)
To: linux-ia64
During some testing, we got a warning about trying to allocate
memory while holding a lock. This fixes that problem.
Signed-off-by: Robin Holt <holt@sgi.com>
Acked-by: Dean Nelson <dcn@sgi.com>
----
This replaces the patch I sent yesterday. Dean pointed out that the
spin_lock_irqsave does not need to happen when the kernel_thread succeeds.
Tony, If you have not already taken either of the patches, please use
this one instead.
Index: linux-2.6/arch/ia64/sn/kernel/xpc_main.c
=================================--- linux-2.6.orig/arch/ia64/sn/kernel/xpc_main.c 2006-02-01 07:26:10.156287841 -0600
+++ linux-2.6/arch/ia64/sn/kernel/xpc_main.c 2006-02-02 07:25:25.611646908 -0600
@@ -575,18 +575,21 @@ xpc_activate_partition(struct xpc_partit
spin_lock_irqsave(&part->act_lock, irq_flags);
- pid = kernel_thread(xpc_activating, (void *) ((u64) partid), 0);
-
DBUG_ON(part->act_state != XPC_P_INACTIVE);
- if (pid > 0) {
- part->act_state = XPC_P_ACTIVATION_REQ;
- XPC_SET_REASON(part, xpcCloneKThread, __LINE__);
- } else {
- XPC_SET_REASON(part, xpcCloneKThreadFailed, __LINE__);
- }
+ part->act_state = XPC_P_ACTIVATION_REQ;
+ XPC_SET_REASON(part, xpcCloneKThread, __LINE__);
spin_unlock_irqrestore(&part->act_lock, irq_flags);
+
+ pid = kernel_thread(xpc_activating, (void *) ((u64) partid), 0);
+
+ if (unlikely(pid <= 0)) {
+ spin_lock_irqsave(&part->act_lock, irq_flags);
+ part->act_state = XPC_P_INACTIVE;
+ XPC_SET_REASON(part, xpcCloneKThreadFailed, __LINE__);
+ spin_unlock_irqrestore(&part->act_lock, irq_flags);
+ }
}
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-02-02 18:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-02-01 14:55 [Patch] Fix XPC code which sleeps with spin_lock_irqsave() Robin Holt
2006-02-02 18:30 ` Robin Holt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox