mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Nick Piggin <nickpiggin@yahoo.com.au>
To: Stefan Richter <stefanr@s5r6.in-berlin.de>
Cc: linux1394-devel@lists.sourceforge.net,
	linux-kernel@vger.kernel.org,
	"Kristian Høgsberg" <krh@redhat.com>
Subject: Re: [PATCH] firewire: fw-core: enforce write order when updating fw_device.generation
Date: Thu, 1 Nov 2007 14:53:35 +1100	[thread overview]
Message-ID: <200711011453.35268.nickpiggin@yahoo.com.au> (raw)
In-Reply-To: <tkrat.66a8b3070e07d80f@s5r6.in-berlin.de>

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@s5r6.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);

  parent reply	other threads:[~2007-11-01  5:00 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-01  1:49 Stefan Richter
2007-11-01  1:50 ` [PATCH] firewire: fw-core: react on bus resets while the config ROM is being fetched Stefan Richter
2007-11-01  1:51   ` [PATCH] firewire: fw-sbp2: enforce read order of device generation and node ID Stefan Richter
2007-11-01  3:53 ` Nick Piggin [this message]
2007-11-01  9:51   ` dealing with barriers (was Re: [PATCH] firewire: fw-core: enforce write order when updating fw_device.generation) Stefan Richter
2007-11-01 11:32     ` Nick Piggin
2008-01-24  0:52     ` [PATCH 0/4] firewire: order of memory accesses (bus generation vs. node ID) Stefan Richter
2008-01-24  0:53       ` [PATCH 1/4] firewire: fw-sbp2: use device generation, not card generation Stefan Richter
2008-01-24 16:04         ` Jarod Wilson
2008-01-24  0:53       ` [PATCH 2/4] firewire: fw-cdev: " Stefan Richter
2008-01-24 16:05         ` Jarod Wilson
2008-01-24  0:54       ` [PATCH 3/4] firewire: enforce access order between generation and node ID Stefan Richter
2008-01-24  4:55         ` Nick Piggin
2008-01-24 16:06         ` Jarod Wilson
2008-01-25 16:35           ` Stefan Richter
2008-01-25 17:57             ` Stefan Richter
     [not found]               ` <59ad55d30801251024j6ff43953tb86aaa52fdea5ec9@mail.gmail.com>
2008-01-25 22:25                 ` Stefan Richter
2008-01-24  0:55       ` [PATCH 4/4] firewire: fw-core: react on bus resets while the config ROM is being fetched Stefan Richter
2008-01-24 16:11         ` Jarod Wilson
2008-01-24 19:26           ` Jarod Wilson
2008-01-25 16:53             ` [PATCH 4/4 update] " Stefan Richter
2008-01-25 17:16               ` Jarod Wilson
2008-01-25 17:21                 ` Stefan Richter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200711011453.35268.nickpiggin@yahoo.com.au \
    --to=nickpiggin@yahoo.com.au \
    --cc=krh@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux1394-devel@lists.sourceforge.net \
    --cc=stefanr@s5r6.in-berlin.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®