From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932647AbeASBZX (ORCPT ); Thu, 18 Jan 2018 20:25:23 -0500 Received: from mail-pg0-f42.google.com ([74.125.83.42]:39274 "EHLO mail-pg0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754833AbeASBZS (ORCPT ); Thu, 18 Jan 2018 20:25:18 -0500 X-Google-Smtp-Source: ACJfBovkgW6M5xCF0xPBS596zl//E8kE8innIYZJHKxjCDI1U19BPf011+6wAWjTkAaBdTITZ6zS9Q== Subject: Re: net: r8169: a question of memory barrier in the r8169 driver To: Francois Romieu Cc: nic_swsd@realtek.com, alexander.h.duyck@redhat.com, David Miller , dhowells@redhat.com, paulmck@linux.vnet.ibm.com, will.deacon@arm.com, peterz@infradead.org, netdev@vger.kernel.org, Linux Kernel Mailing List References: <9a373156-41e5-a78b-cd31-c4b9bdba2696@gmail.com> <20180119011101.GA15920@electric-eye.fr.zoreil.com> From: Jia-Ju Bai Message-ID: <31c256b2-b527-89b1-168b-b2a529811d74@gmail.com> Date: Fri, 19 Jan 2018 09:24:55 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0 MIME-Version: 1.0 In-Reply-To: <20180119011101.GA15920@electric-eye.fr.zoreil.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018/1/19 9:11, Francois Romieu wrote: > Jia-Ju Bai : > [...] >> 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? > This code would not even be needed if rtl8169_start_xmit was only your > usual ndo_start_xmit handler: Realtek {ab / re}used it for GSO handling > (see r8169_csum_workaround). > > If the test is not a no-op in this GSO context, it's racy. > Thanks for reply. I didn't clearly understand your meaning... I wonder whether there is a possible data race and whether a "smp_mb" is needed before this code? By the way, do you mean that this code can be removed? Thanks, Jia-Ju Bai