linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* net: r8169: a question of memory barrier in the r8169 driver
@ 2018-01-18 14:06 Jia-Ju Bai
  2018-01-18 15:06 ` Peter Zijlstra
  2018-01-19  1:11 ` Francois Romieu
  0 siblings, 2 replies; 8+ messages in thread
From: Jia-Ju Bai @ 2018-01-18 14:06 UTC (permalink / raw)
  To: nic_swsd, romieu, alexander.h.duyck, David Miller, dhowells,
	paulmck, will.deacon, peterz
  Cc: netdev, Linux Kernel Mailing List

In the rt8169 driver, the function "rtl_tx" uses "smp_mb" to sync the 
writing operation with rtl8169_start_xmit:
     if (tp->dirty_tx != dirty_tx) {
         tp->dirty_tx = dirty_tx;
         smp_mb();
         ...
     }
The function rtl8169_start_xmit reads tp->dirty_tx in TX_FRAGS_READY_FOR:
     if (unlikely(!TX_FRAGS_READY_FOR(tp, skb_shinfo(skb)->nr_frags))) {
         netif_err(tp, drv, dev, "BUG! Tx Ring full when queue awake!\n");
         goto err_stop_0;
     }
But there is no memory barrier around this code.

Is there a possible data race here?
If not, how this data race is avoided?


Thanks,
Jia-Ju Bai

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-01-20  0:01 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-18 14:06 net: r8169: a question of memory barrier in the r8169 driver Jia-Ju Bai
2018-01-18 15:06 ` Peter Zijlstra
2018-01-19  1:11   ` Francois Romieu
2018-01-19 17:14     ` Peter Zijlstra
2018-01-20  0:00       ` Francois Romieu
2018-01-19  1:11 ` Francois Romieu
2018-01-19  1:24   ` Jia-Ju Bai
2018-01-19 23:59     ` Francois Romieu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).