[patch 01/10] ieee1394: use correct barrier types between accesses of nodeid and generation

Stefan Richter stefanr at s5r6.in-berlin.de
Mon Sep 29 17:16:35 UTC 2008


Date: Wed, 27 Aug 2008 01:18:32 +0200 (CEST)
From: Stefan Richter <stefanr at s5r6.in-berlin.de>

A compiler barrier (explicit on the read side, implicit on the write
side) is not quite enough for what has to be accomplished here.  Use
hardware memory barriers on systems which need them.

(Of course a full fix of generation handling would require much more
than this.  The ieee1394 core's bus generation counter had to be tied to
the controller's bus generation counter; cf. Kristian's stack.  It's
just that I have other current business with the code around these
barrier()s, so why not do at least this small fix.)

Signed-off-by: Stefan Richter <stefanr at s5r6.in-berlin.de>
---
 drivers/ieee1394/nodemgr.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Index: linux/drivers/ieee1394/nodemgr.c
===================================================================
--- linux.orig/drivers/ieee1394/nodemgr.c
+++ linux/drivers/ieee1394/nodemgr.c
@@ -1308,7 +1308,8 @@ static void nodemgr_update_node(struct n
 	if (ne->in_limbo)
 		nodemgr_resume_ne(ne);
 
-	/* Mark the node current */
+	/* Finally, mark the node current */
+	smp_wmb();
 	ne->generation = generation;
 }
 
@@ -1869,7 +1870,7 @@ void hpsb_node_fill_packet(struct node_e
 {
 	packet->host = ne->host;
 	packet->generation = ne->generation;
-	barrier();
+	smp_rmb();
 	packet->node_id = ne->nodeid;
 }
 
@@ -1878,7 +1879,7 @@ int hpsb_node_write(struct node_entry *n
 {
 	unsigned int generation = ne->generation;
 
-	barrier();
+	smp_rmb();
 	return hpsb_write(ne->host, ne->nodeid, generation,
 			  addr, buffer, length);
 }

-- 
Stefan Richter
-=====-==--- =--= ===-=
http://arcgraph.de/sr/




More information about the devel mailing list