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: <20071217191302.7385f8cc@dhcp-252-066.norway.atmel.com>
Date:	Mon, 17 Dec 2007 19:13:02 +0100
From:	Haavard Skinnemoen <hskinnemoen@...el.com>
To:	"Remy Bohmer" <linux@...mer.net>
Cc:	"Andrew Victor" <linux@...im.org.za>,
	RT <linux-rt-users@...r.kernel.org>,
	Steven Rostedt <rostedt@...dmis.org>,
	ARM Linux Mailing List 
	<linux-arm-kernel@...ts.arm.linux.org.uk>,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH]: Atmel Serial Console interrupt handler splitup

On Mon, 17 Dec 2007 13:17:01 +0100
Haavard Skinnemoen <hskinnemoen@...el.com> wrote:

> > 3) NEW: optional:  add-atmel-serial-dma.patch, this merged the DMA
> > code (from Chip Coldwell) in your 2.6.23 patch back on top of this
> > series. Because the AT32 bug is not been fixed for a very long time, I
> > do not expect it to be fixed soon, so I think a reordering is better
> > to make preempt-RT work on AT91.  
> 
> I'll give it a shot, but first I have some comments on your other
> patches.

I found a bug. The RX DMA buffer isn't invalidated before it's handed
over to the hardware. With the below patch, it seems to behave a lot
better on AVR32, but it still does funny things now and then (it seems
to dump a good chunk of stale TX data before rebooting), and magic sysrq
doesn't work.

I think I've spotted other potential races in the DMA code as well, but
they look a bit more difficult to hunt down. I'll give it another try
tomorrow.

Haavard

From: Haavard Skinnemoen <hskinnemoen@...el.com>
Subject: [PATCH] atmel_serial: Sync DMA RX buffer after copying from it

Calling dma_sync_single_for_cpu() before reading the buffer isn't
enough. We need to call dma_sync_single_for_device() after we're done
reading as well.

Signed-off-by: Haavard Skinnemoen <hskinnemoen@...el.com>
---
 drivers/serial/atmel_serial.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/drivers/serial/atmel_serial.c b/drivers/serial/atmel_serial.c
index 0610ad9..e23a3ba 100644
--- a/drivers/serial/atmel_serial.c
+++ b/drivers/serial/atmel_serial.c
@@ -391,6 +391,8 @@ static void atmel_pdc_endrx(struct uart_port *port)
 		tty_insert_flip_string(tty, pdc->buf + pdc->ofs, count);
 		tty_flip_buffer_push(tty);
 
+		dma_sync_single_for_device(port->dev, pdc->dma_addr,
+				pdc->dma_size, DMA_FROM_DEVICE);
 		port->icount.rx += count;
 	}
 
@@ -425,6 +427,8 @@ static void atmel_pdc_timeout(struct uart_port *port)
 		tty_insert_flip_string(tty, pdc->buf + pdc->ofs, count);
 		tty_flip_buffer_push(tty);
 
+		dma_sync_single_for_device(port->dev, pdc->dma_addr,
+				pdc->dma_size, DMA_FROM_DEVICE);
 		pdc->ofs = ofs;
 		port->icount.rx += count;
 	}
-- 
1.5.3.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ