Subject: pci_alloc_consistent question

Hi List,

Is there any limitation on the amount of contiguous dmaable memory that
can be allocated using a single call to pci_alloc_consistent() ?

Regards,
-hiren


2001-10-19 18:51:24

by Francois Romieu

[permalink] [raw]
Subject: Re: pci_alloc_consistent question

MEHTA,HIREN (A-SanJose,ex1) <[email protected]> :
[...]
> Is there any limitation on the amount of contiguous dmaable memory that
> can be allocated using a single call to pci_alloc_consistent() ?

See comment in arch/i386/kernel/pci-dma.c for pc world:
/*
* Dynamic DMA mapping support.
*
* On i386 there is no hardware dynamic DMA address translation,
* so consistent alloc/free are merely page allocation/freeing.
[...]

It fails as __get_free_pages does.

--
Ueimor

2001-10-19 20:57:48

by Ralf Baechle

[permalink] [raw]
Subject: Re: pci_alloc_consistent question

On Fri, Oct 19, 2001 at 12:32:19PM -0600, MEHTA,HIREN (A-SanJose,ex1) wrote:

> Is there any limitation on the amount of contiguous dmaable memory that
> can be allocated using a single call to pci_alloc_consistent() ?

Entirely platform dependant. On some systems the total available DMA memory
for DMA may be as limited as 1mb, others have limits like 16mb yet other can
support the entire 32-bit address space for DMA. So in case of doubt be
conservative.

Ralf

Subject: RE: pci_alloc_consistent question

so, what is the conservative number ? 1MB ?

-hiren

-----Original Message-----
From: Ralf Baechle [mailto:[email protected]]
Sent: Friday, October 19, 2001 1:58 PM
To: MEHTA,HIREN (A-SanJose,ex1)
Cc: '[email protected]'
Subject: Re: pci_alloc_consistent question


On Fri, Oct 19, 2001 at 12:32:19PM -0600, MEHTA,HIREN (A-SanJose,ex1) wrote:

> Is there any limitation on the amount of contiguous dmaable memory that
> can be allocated using a single call to pci_alloc_consistent() ?

Entirely platform dependant. On some systems the total available DMA memory
for DMA may be as limited as 1mb, others have limits like 16mb yet other can
support the entire 32-bit address space for DMA. So in case of doubt be
conservative.

Ralf

2001-10-19 21:37:42

by Jeff Garzik

[permalink] [raw]
Subject: Re: pci_alloc_consistent question

"MEHTA,HIREN (A-SanJose,ex1)" wrote:
> so, what is the conservative number ? 1MB ?

FWIW, if you need more than 1-4MB, you can use alloc_bootmem at system
boot to reserve huge amounts of contiguous memory... (not that anything
but lame hardware requires that anymore)

> -----Original Message-----
> On Fri, Oct 19, 2001 at 12:32:19PM -0600, MEHTA,HIREN (A-SanJose,ex1) wrote:
>
> > Is there any limitation on the amount of contiguous dmaable memory that
> > can be allocated using a single call to pci_alloc_consistent() ?
>
> Entirely platform dependant. On some systems the total available DMA memory
> for DMA may be as limited as 1mb, others have limits like 16mb yet other can
> support the entire 32-bit address space for DMA. So in case of doubt be
> conservative.

--
Jeff Garzik | Only so many songs can be sung
Building 1024 | with two lips, two lungs, and one tongue.
MandrakeSoft | - nomeansno

2001-10-19 22:00:07

by Ralf Baechle

[permalink] [raw]
Subject: Re: pci_alloc_consistent question

On Fri, Oct 19, 2001 at 03:24:14PM -0600, MEHTA,HIREN (A-SanJose,ex1) wrote:

> so, what is the conservative number ? 1MB ?

Even far below that. Most systems will allocate that memory using
get_free_pages and by allocating large pages such as 1mb you'll produce
high memory pressure. Try to get away with PAGE_SIZE * 2 if you can.
Large allocation are only ok if they're rare.

Ralf