lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <35289ca1-3116-3e5a-49a0-e6996ad2b2f5@intel.com>
Date:   Thu, 13 Apr 2023 14:04:36 -0700
From:   Jacob Keller <jacob.e.keller@...el.com>
To:     Heiner Kallweit <hkallweit1@...il.com>,
        Jakub Kicinski <kuba@...nel.org>,
        David Miller <davem@...emloft.net>,
        Paolo Abeni <pabeni@...hat.com>,
        "Eric Dumazet" <edumazet@...gle.com>,
        Realtek linux nic maintainers <nic_swsd@...ltek.com>
CC:     "netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: Re: [PATCH net-next 3/3] r8169: use new macro
 netif_subqueue_completed_wake in the tx cleanup path



On 4/13/2023 12:36 PM, Heiner Kallweit wrote:
> On 13.04.2023 21:25, Jacob Keller wrote:
>>
>>
>> On 4/13/2023 12:16 PM, Heiner Kallweit wrote:
>>> Use new net core macro netif_subqueue_completed_wake to simplify
>>> the code of the tx cleanup path.
>>>
>>> Signed-off-by: Heiner Kallweit <hkallweit1@...il.com>
>>> ---
>>>  drivers/net/ethernet/realtek/r8169_main.c | 16 ++++------------
>>>  1 file changed, 4 insertions(+), 12 deletions(-)
>>>
>>> diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c
>>> index 3f0b78fd9..5cfdb60ab 100644
>>> --- a/drivers/net/ethernet/realtek/r8169_main.c
>>> +++ b/drivers/net/ethernet/realtek/r8169_main.c
>>> @@ -4372,20 +4372,12 @@ static void rtl_tx(struct net_device *dev, struct rtl8169_private *tp,
>>>  	}
>>>  
>>>  	if (tp->dirty_tx != dirty_tx) {
>>> -		netdev_completed_queue(dev, pkts_compl, bytes_compl);
>>>  		dev_sw_netstats_tx_add(dev, pkts_compl, bytes_compl);
>>> +		WRITE_ONCE(tp->dirty_tx, dirty_tx);
>>>  
>>> -		/* Sync with rtl8169_start_xmit:
>>> -		 * - publish dirty_tx ring index (write barrier)
>>> -		 * - refresh cur_tx ring index and queue status (read barrier)
>>> -		 * May the current thread miss the stopped queue condition,
>>> -		 * a racing xmit thread can only have a right view of the
>>> -		 * ring status.
>>> -		 */
>>> -		smp_store_mb(tp->dirty_tx, dirty_tx);
>>
>>
>> We used to use a smp_store_mb here, but now its safe to just WRITE_ONCE?
>> Assuming that's correct:
>>
> netdev_completed_queue() has a smp_mb() and is called from
> netif_subqueue_completed_wake(). So it's supposed to be safe.
> 

Perfect, thanks for the explanation!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ