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] [day] [month] [year] [list]
Date:	Mon, 25 Feb 2008 08:32:01 +0000
From:	Alan Cox <alan@...rguk.ukuu.org.uk>
To:	Eliot Blennerhassett <linux@...ioscience.com>
Cc:	linux-kernel@...r.kernel.org
Subject: Re: Q: volatile vs barriers to access memory data changed by device
 DMA

> === after conversion
> struct bus_master_interface *interface;
> while (interface->ack != OK) { 
>         delay(a short while);
>         rmb(); 
>         [ after X loops device changes interface->ack by dma ]
> };
> 
> All I need is for the read of interface->ack in the loop not to be optimised 
> away - is rmb() the appropriate incantation to achieve this?

Yes - ish.  You want the equivalent of 

	do {
		rmb();
		if (interface->ack == OK)
			break;
	} while(1);

(eg putting another rmb before the while in your case)

You want a barrier before the *first* read in case the
compiler has managed to cache the value before you enter the loop.


> struct bus_master_interface *interface;
> interface->cmd = command;
> wmb();
> iowrite(device_interrupt, 1);

Yes.

--
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