All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sergey Shtylyov <s.shtylyov@omp.ru>
To: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>,
	"davem@davemloft.net" <davem@davemloft.net>,
	"kuba@kernel.org" <kuba@kernel.org>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-renesas-soc@vger.kernel.org" 
	<linux-renesas-soc@vger.kernel.org>
Subject: Re: [PATCH] net: renesas: sh_eth: Fix freeing wrong tx descriptor
Date: Wed, 8 Sep 2021 12:46:17 +0300	[thread overview]
Message-ID: <9f3a0195-8218-e73c-eb63-bbd7b6ff9777@omp.ru> (raw)
In-Reply-To: <TY2PR01MB36924D8258BD1C8E3287136DD8D49@TY2PR01MB3692.jpnprd01.prod.outlook.com>

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 <yoshihiro.shimoda.uh@renesas.com>
>>
>> Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru>
> 
> 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

  reply	other threads:[~2021-09-08  9:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-07 11:29 [PATCH] net: renesas: sh_eth: Fix freeing wrong tx descriptor Yoshihiro Shimoda
2021-09-07 13:10 ` patchwork-bot+netdevbpf
2021-09-07 19:29 ` Sergey Shtylyov
2021-09-08  5:45   ` Yoshihiro Shimoda
2021-09-08  9:46     ` Sergey Shtylyov [this message]
2021-09-08 11:43       ` Yoshihiro Shimoda

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9f3a0195-8218-e73c-eb63-bbd7b6ff9777@omp.ru \
    --to=s.shtylyov@omp.ru \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=yoshihiro.shimoda.uh@renesas.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.