Re: [PATCH] net/usb: rtl8150: allocate URB transfer_buffer and setup_packet separately

3 messages, 3 authors, 2013-08-10 · open the first message on its own page

Re: [PATCH] net/usb: rtl8150: allocate URB transfer_buffer and setup_packet separately

From: Jussi Kivilinna <hidden>
Date: 2013-08-08 19:43:16

On 08.08.2013 18:14, Petko Manolov wrote:
On Wed, 7 Aug 2013, Jussi Kivilinna wrote:
quoted
rtl8150 allocates URB transfer_buffer and setup_packet as part of same 
structure 'struct async_req'. This can cause same cacheline to be 
DMA-mapped twice with same URB. This can lead to memory corruption on 
some systems.
I can see performance impact due to the double mapping.  However, memory 
corruption seems a bit too much for sane cache and DMA controllers.  Out 
of interest - which is the architecture that will potentially corrupt the 
memory.
rtlwifi driver had similar structure to allocate both setup_packet and transfer_buffer in single go (overlapping dma-mapping cachelines) and this caused problems on ARM/sunxi. Problems means: memory corruptions at random locations, device freezes and lock-ups.

-Jussi

cheers,
Petko
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Re: [PATCH] net/usb: rtl8150: allocate URB transfer_buffer and setup_packet separately

From: Petko Manolov <petkan@nucleusys.com>
Date: 2013-08-09 18:50:24

On Thu, 8 Aug 2013, Jussi Kivilinna wrote:
On 08.08.2013 18:14, Petko Manolov wrote:
quoted
On Wed, 7 Aug 2013, Jussi Kivilinna wrote:
quoted
rtl8150 allocates URB transfer_buffer and setup_packet as part of same 
structure 'struct async_req'. This can cause same cacheline to be 
DMA-mapped twice with same URB. This can lead to memory corruption on 
some systems.
I can see performance impact due to the double mapping.  However, memory 
corruption seems a bit too much for sane cache and DMA controllers.  Out 
of interest - which is the architecture that will potentially corrupt the 
memory.
rtlwifi driver had similar structure to allocate both setup_packet and 
transfer_buffer in single go (overlapping dma-mapping cachelines) and 
this caused problems on ARM/sunxi. Problems means: memory corruptions at 
random locations, device freezes and lock-ups.
Broken controllers?..

Re: [PATCH] net/usb: rtl8150: allocate URB transfer_buffer and setup_packet separately

From: Jussi Kivilinna <hidden>
Date: 2013-08-10 07:38:27

On 09.08.2013 21:50, Petko Manolov wrote:
On Thu, 8 Aug 2013, Jussi Kivilinna wrote:
quoted
On 08.08.2013 18:14, Petko Manolov wrote:
quoted
On Wed, 7 Aug 2013, Jussi Kivilinna wrote:
quoted
rtl8150 allocates URB transfer_buffer and setup_packet as part of same 
structure 'struct async_req'. This can cause same cacheline to be 
DMA-mapped twice with same URB. This can lead to memory corruption on 
some systems.
I can see performance impact due to the double mapping.  However, memory 
corruption seems a bit too much for sane cache and DMA controllers.  Out 
of interest - which is the architecture that will potentially corrupt the 
memory.
rtlwifi driver had similar structure to allocate both setup_packet and 
transfer_buffer in single go (overlapping dma-mapping cachelines) and 
this caused problems on ARM/sunxi. Problems means: memory corruptions at 
random locations, device freezes and lock-ups.
Broken controllers?..
At first I thought so too, but I discussed about this at linux-usb, and answer
was that driver which uses same (dma/-)cacheline for multiple buffers is buggy..
  http://marc.info/?l=linux-usb&m=137130407121137&w=2 (at end)
  http://marc.info/?l=linux-usb&m=137137080902265&w=2
  http://marc.info/?l=linux-usb&m=137242422120782&w=2

-Jussi
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help