[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <200711011453.35268.nickpiggin@yahoo.com.au>
Date: Thu, 1 Nov 2007 14:53:35 +1100
From: Nick Piggin <nickpiggin@...oo.com.au>
To: Stefan Richter <stefanr@...6.in-berlin.de>
Cc: linux1394-devel@...ts.sourceforge.net,
linux-kernel@...r.kernel.org,
Kristian Høgsberg <krh@...hat.com>
Subject: Re: [PATCH] firewire: fw-core: enforce write order when updating fw_device.generation
On Thursday 01 November 2007 12:49, Stefan Richter wrote:
> fw_device.node_id and fw_device.generation are accessed without mutexes.
> We have to ensure that all readers will get to see node_id updates
> before generation updates.
>
Hi, a few points:
- can change it to use spinlocks instead? This would be most
preferable.
- if not, you need comments.
- you also seem to be missing rmb()s now. I see a couple in the
firewire directory, but nothing that seems to be ordering loads
of these particular fields.
- use smp_*mb() if you are just ordering regular cacheable RAM
accesses.
Also, diffstat is a bit wrong... maybe you posted the wrong version?
> Signed-off-by: Stefan Richter <stefanr@...6.in-berlin.de>
> ---
> drivers/firewire/fw-device.c | 6 ++++++
> drivers/firewire/fw-topology.c | 1 +
> 2 files changed, 7 insertions(+)
>
> Index: linux/drivers/firewire/fw-device.c
> ===================================================================
> --- linux.orig/drivers/firewire/fw-device.c
> +++ linux/drivers/firewire/fw-device.c
> @@ -808,6 +813,7 @@ void fw_node_event(struct fw_card *card,
>
> device = node->data;
> device->node_id = node->node_id;
> + wmb();
> device->generation = card->generation;
> if (atomic_read(&device->state) == FW_DEVICE_RUNNING) {
> PREPARE_DELAYED_WORK(&device->work, fw_device_update);
> Index: linux/drivers/firewire/fw-topology.c
> ===================================================================
> --- linux.orig/drivers/firewire/fw-topology.c
> +++ linux/drivers/firewire/fw-topology.c
> @@ -518,6 +518,7 @@ fw_core_handle_bus_reset(struct fw_card
> card->bm_retries = 0;
>
> card->node_id = node_id;
> + wmb();
> card->generation = generation;
> card->reset_jiffies = jiffies;
> schedule_delayed_work(&card->work, 0);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists