Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1389073 > unrolled thread

Re: [PATCH v2 1/2] net: nps_enet: Sync access to packet sent flag

Started byLino Sanfilippo <lsanfil@marvell.com>
First post2016-04-27 16:00 +0200
Last post2016-04-27 16:00 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH v2 1/2] net: nps_enet: Sync access to packet sent flag Lino Sanfilippo <lsanfil@marvell.com> - 2016-04-27 16:00 +0200

#1389073 — Re: [PATCH v2 1/2] net: nps_enet: Sync access to packet sent flag

FromLino Sanfilippo <lsanfil@marvell.com>
Date2016-04-27 16:00 +0200
SubjectRe: [PATCH v2 1/2] net: nps_enet: Sync access to packet sent flag
Message-ID<rsyau-26F-5@gated-at.bofh.it>
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

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web