Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1169735

Re: [PATCH] stmmac: explicitly zero des0 & des1 on init

From Alexey Brodkin <Alexey.Brodkin@synopsys.com>
Newsgroups linux.kernel
Subject Re: [PATCH] stmmac: explicitly zero des0 & des1 on init
Date 2015-06-22 08:50 +0200
Message-ID <pE3Im-4mu-13@gated-at.bofh.it> (permalink)
References <pC39M-13x-5@gated-at.bofh.it> <pDQ8q-1I3-27@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hi David,

On Sun, 2015-06-21 at 09:29 -0700, David Miller wrote:
+AD4- From: Alexey Brodkin +ADw-Alexey.Brodkin+AEA-synopsys.com+AD4-
+AD4- Date: Tue, 16 Jun 2015 20:40:41 +-0300
+AD4- 
+AD4- +AD4- Current implementtion of descriptor init procedure only takes care 
+AD4- +AD4- about
+AD4- +AD4- ownership flag. While it is perfectly possible to have underlying 
+AD4- +AD4- memory
+AD4- +AD4- filled with garbage on boot or driver installation.
+AD4- +AD4- 
+AD4- +AD4- And randomly set flags in non-zeroed des0 and des1 fields may lead 
+AD4- +AD4- to
+AD4- +AD4- unpredictable behavior of the GMAC DMA block.
+AD4- +AD4- 
+AD4- +AD4- Solution to this problem is as simple as explicit zeroing of both 
+AD4- +AD4- des0
+AD4- +AD4- and des1 fields of all buffer descriptors.
+AD4- +AD4- 
+AD4- +AD4- Signed-off-by: Alexey Brodkin +ADw-abrodkin+AEA-synopsys.com+AD4-
+AD4- 
+AD4- If you need the memory zero initialized, use dma+AF8-zalloc+AF8-coherent().

Indeed usage of dma+AF8-zalloc+AF8-coherent() will resolve observed issue.
But since buffer descriptors are reused extensively I would say that
explicit zeroing of fields with flags is useful. Probably I need to add
this clarification in commit message.

And then if we do that explicit zeroing of flags and other fields which
hold data size and addresses of data buffer and the next descriptor in
chain are all get set later we may not care about allocation of zeroed
memory.

-Alexey--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH] stmmac: explicitly zero des0 & des1 on init Alexey Brodkin <Alexey.Brodkin@synopsys.com> - 2015-06-16 19:50 +0200
  Re: [PATCH] stmmac: explicitly zero des0 & des1 on init David Miller <davem@davemloft.net> - 2015-06-21 18:20 +0200
    Re: [PATCH] stmmac: explicitly zero des0 & des1 on init Alexey Brodkin <Alexey.Brodkin@synopsys.com> - 2015-06-22 08:50 +0200

csiph-web