Thread (1 message) 1 message, 1 author, 2016-05-24

Re: [PATCH v2] ethernet:arc: Fix racing of TX ring buffer

From: Francois Romieu <hidden>
Date: 2016-05-24 19:02:35
Also in: linux-rockchip

Lino Sanfilippo [off-list ref] :
[...]
I dont agree here. A dma_wmb would have an effect to "data" and "info", yes,
but it would have absolutely no effect to skb_tx_timestamp(), since there
is no dma access involved here. In fact skb_tx_timestamp() could probably
be even reordered to appear after the dma_wmb.

Anyway, there is the wmb() directly after the assignment to "info". _This_
barrier  should ensure that skb_tx_timestamp() (along with a flush of data
and info to DMA) is executed before "txbd_curr" is advanced.
This means that the corresponding skb cant be freed prematurely by tx_clean().
The concern here is about sending adequate PTP payload on the network.

skb_tx_timestamp() is used for network clock synchronization. Some extra
information must be transmitted. Be it through direct payload change
or through indirect control, it _is_ related to dma.

Several (most ?) skb_tx_timestamp() misuses blur the picture: CPU vs device
sync is of course way below the radar when the driver crashes because of
plain use-after-free skb_tx_timestamp() :o/

-- 
Ueimor
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help