[SPARC64]: Fix race between MD update and dr-cpu add.
We need to make sure the MD update occurs before we try to
process dr-cpu configure requests. MD update and dr-cpu
were being processed by seperate threads so that did not
happen occaisionally.
Fix this by executing all domain services data packets from
a single thread, in order.
This will help simplify some other things as well.
Signed-off-by: David S. Miller <davem@davemloft.net>
diff --git a/arch/sparc64/kernel/mdesc.c b/arch/sparc64/kernel/mdesc.c
index 62a38979..de5310f 100644
--- a/arch/sparc64/kernel/mdesc.c
+++ b/arch/sparc64/kernel/mdesc.c
@@ -214,7 +214,7 @@
}
EXPORT_SYMBOL(mdesc_release);
-static void do_mdesc_update(struct work_struct *work)
+void mdesc_update(void)
{
unsigned long len, real_len, status;
struct mdesc_handle *hp, *orig_hp;
@@ -248,13 +248,6 @@
spin_unlock_irqrestore(&mdesc_lock, flags);
}
-static DECLARE_WORK(mdesc_update_work, do_mdesc_update);
-
-void mdesc_update(void)
-{
- schedule_work(&mdesc_update_work);
-}
-
static struct mdesc_elem *node_block(struct mdesc_hdr *mdesc)
{
return (struct mdesc_elem *) (mdesc + 1);
@@ -278,13 +271,14 @@
u64 last_node = hp->mdesc.node_sz / 16;
u64 ret;
- if (from_node == MDESC_NODE_NULL)
- from_node = 0;
-
- if (from_node >= last_node)
+ if (from_node == MDESC_NODE_NULL) {
+ ret = from_node = 0;
+ } else if (from_node >= last_node) {
return MDESC_NODE_NULL;
+ } else {
+ ret = ep[from_node].d.val;
+ }
- ret = ep[from_node].d.val;
while (ret < last_node) {
if (ep[ret].tag != MD_NODE)
return MDESC_NODE_NULL;