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]
Date:	Sun, 19 Sep 2010 19:43:20 +0200
From:	Wolfgang Mües <wolfgang@...w-muees.de>
To:	Ming Lei <tom.leiming@...il.com>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: USB: free coherent buffer into atomic context

Hi Ming,

Am Samstag, 18. September 2010 10:50:20 schrieb Ming Lei:
> IMO, it is not necessary for a coherent buffer to be kept for
> the whole time a driver operates on a device.

>From DMA-mapping.txt:
>There are two types of DMA mappings:
>
>- Consistent DMA mappings which are usually mapped at driver
>  initialization, unmapped at the end and for which the hardware should
>  guarantee that the device and the CPU can access the data
>  in parallel and will see updates made by each other without any
>  explicit software flushing.

>- Streaming DMA mappings which are usually mapped for one DMA transfer,
>  unmapped right after it (unless you use pci_dma_sync_* below) and for which
>  hardware can optimize for sequential accesses.

You wrote:
> Also, coherent buffer
> is very limited in some arch(such as ARM), maybe we should use it
> more dynamically, instead of keeping it for long time.

No, this is against the design (see above).

If you want to be dynamic, please use streaming DMA mapping.

If a DMA buffer is needed often and you want to avoid the overhead of streaming 
dma mapping, use a coherent buffer.

> irqs_disabled() doesn't mean the buffer is freed in an interrupt context.

I am very sure that the writer of this code has used irqs_disabled() as an 
indication of interrupt context. Maybe in_interrupt() will be more precise.

> If it is only a misuse, seems WARN_ON can be removed.

How on earth will you detect the misuse if there is no visible indication at 
runtime?

best regards
Wolfgang
-- 
Wahre Worte sind nicht schön - Schöne Worte sind nicht wahr. (Laotse)
--
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