[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180118150658.GE2249@hirez.programming.kicks-ass.net>
Date: Thu, 18 Jan 2018 16:06:58 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Jia-Ju Bai <baijiaju1990@...il.com>
Cc: nic_swsd@...ltek.com, romieu@...zoreil.com,
alexander.h.duyck@...hat.com, David Miller <davem@...emloft.net>,
dhowells@...hat.com, paulmck@...ux.vnet.ibm.com,
will.deacon@....com, netdev@...r.kernel.org,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: net: r8169: a question of memory barrier in the r8169 driver
On Thu, Jan 18, 2018 at 10:06:17PM +0800, Jia-Ju Bai wrote:
> 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?
There is only 1 variable afaict. Memory barriers need at least 2 in
order to be able to do _anything_.
Powered by blists - more mailing lists