From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5AFDFC433F5 for ; Wed, 8 Sep 2021 09:46:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2FEA161102 for ; Wed, 8 Sep 2021 09:46:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348506AbhIHJrj (ORCPT ); Wed, 8 Sep 2021 05:47:39 -0400 Received: from mxout03.lancloud.ru ([45.84.86.113]:45850 "EHLO mxout03.lancloud.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245528AbhIHJri (ORCPT ); Wed, 8 Sep 2021 05:47:38 -0400 Received: from LanCloud DKIM-Filter: OpenDKIM Filter v2.11.0 mxout03.lancloud.ru 92A3520A742D Received: from LanCloud Received: from LanCloud Received: from LanCloud From: Sergey Shtylyov Subject: Re: [PATCH] net: renesas: sh_eth: Fix freeing wrong tx descriptor To: Yoshihiro Shimoda , "davem@davemloft.net" , "kuba@kernel.org" CC: "netdev@vger.kernel.org" , "linux-renesas-soc@vger.kernel.org" References: <20210907112940.967985-1-yoshihiro.shimoda.uh@renesas.com> Organization: Open Mobile Platform Message-ID: <9f3a0195-8218-e73c-eb63-bbd7b6ff9777@omp.ru> Date: Wed, 8 Sep 2021 12:46:17 +0300 User-Agent: Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [192.168.11.198] X-ClientProxiedBy: LFEXT01.lancloud.ru (fd00:f066::141) To LFEX1907.lancloud.ru (fd00:f066::207) Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On 08.09.2021 8:45, Yoshihiro Shimoda wrote: >>> The cur_tx counter must be incremented after TACT bit of >>> txdesc->status was set. However, a CPU is possible to reorder >>> instructions and/or memory accesses between cur_tx and >>> txdesc->status. And then, if TX interrupt happened at such a >>> timing, the sh_eth_tx_free() may free the descriptor wrongly. >>> So, add wmb() before cur_tx++. >> >> Not dma_wmb()? :-) > > On armv8, dma_wmb() is DMB OSHST, and wmb() is DSB ST. > IIUC, DMB OSHST is not affected the ordering of instructions. > So, we have to use wmb(). I should really read up the ARM manuals on the barrier instructions... :-) >>> Otherwise NETDEV WATCHDOG timeout is possible to happen. >>> >>> Fixes: 86a74ff21a7a ("net: sh_eth: add support for Renesas SuperH Ethernet") >>> Signed-off-by: Yoshihiro Shimoda >> >> Reviewed-by: Sergey Shtylyov > > Thank you for your review! Out of curiosity: have you really experienced the bug or found it by review? > Best regards, > Yoshihiro Shimoda MBR, Sergey