All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lino Sanfilippo <lsanfil@marvell.com>
To: Elad Kanfi <eladkan@mellanox.com>, <davem@davemloft.net>
Cc: <noamca@mellanox.com>, <linux-kernel@vger.kernel.org>,
	<abrodkin@synopsys.com>, <talz@mellanox.com>,
	<netdev@vger.kernel.org>
Subject: Re: [PATCH v2 1/2] net: nps_enet: Sync access to packet sent flag
Date: Wed, 27 Apr 2016 15:56:04 +0200	[thread overview]
Message-ID: <5720C4F4.3050700@marvell.com> (raw)
In-Reply-To: <1461763110-15263-2-git-send-email-eladkan@mellanox.com>

Hi,

On 27.04.2016 15:18, Elad Kanfi wrote:
> From: Elad Kanfi <eladkan@mellanox.com>
>
> Below is a description of a possible problematic
> sequence. CPU-A is sending a frame and CPU-B handles
> the interrupt that indicates the frame was sent. CPU-B
> reads an invalid value of tx_packet_sent.
>
> 	CPU-A				CPU-B
> 	-----				-----
> 	nps_enet_send_frame
> 	.
> 	.
> 	tx_packet_sent = true
> 	order HW to start tx
> 	.
> 	.
> 	HW complete tx
> 			    ------> 	get tx complete interrupt
> 					.
> 					.
> 					if(tx_packet_sent == true)
>
> 	end memory transaction
> 	(tx_packet_sent actually
> 	 written)
>
> Problem solution:
>
> Add a memory barrier after setting tx_packet_sent,
> in order to make sure that it is written before
> the packet is sent.

Should not those SMP memory barriers be paired? AFAIK you do not only have to make sure
that the value written by CPU-A actually is written to memory but also that CPU-B
reads that value from memory. At least this is what I have understood from memory-barriers.txt...

Regards,
Lino

  reply	other threads:[~2016-04-27 13:56 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-27 13:18 [PATCH v2 0/2] Net driver bugs fix Elad Kanfi
2016-04-27 13:18 ` [PATCH v2 1/2] net: nps_enet: Sync access to packet sent flag Elad Kanfi
2016-04-27 13:56   ` Lino Sanfilippo [this message]
2016-04-28 21:11   ` David Miller
2016-05-02 10:21     ` Elad Kanfi
2016-05-02 11:15       ` Lino Sanfilippo
2016-05-08 13:44         ` Elad Kanfi
2016-05-10 18:32           ` Lino Sanfilippo
2016-04-27 13:18 ` [PATCH v2 2/2] net: nps_enet: bug fix - handle lost tx interrupts Elad Kanfi

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=5720C4F4.3050700@marvell.com \
    --to=lsanfil@marvell.com \
    --cc=abrodkin@synopsys.com \
    --cc=davem@davemloft.net \
    --cc=eladkan@mellanox.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=noamca@mellanox.com \
    --cc=talz@mellanox.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.