Bug 454417 - Inconsistent documentation regarding pci_alloc_consistent
Summary: Inconsistent documentation regarding pci_alloc_consistent
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: kernel
Version: 4.8
Hardware: All
OS: Linux
low
low
Target Milestone: rc
: ---
Assignee: Prarit Bhargava
QA Contact: Martin Jenner
URL:
Whiteboard:
Depends On:
Blocks: 461304
TreeView+ depends on / blocked
 
Reported: 2008-07-08 12:01 UTC by Prarit Bhargava
Modified: 2009-05-18 19:37 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2009-05-18 19:37:12 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
RHEL4 fix for this issue (833 bytes, patch)
2008-07-08 12:01 UTC, Prarit Bhargava
no flags Details | Diff
RHEL4 fix for this issue [v2] (1.14 KB, patch)
2008-07-08 12:06 UTC, Prarit Bhargava
no flags Details | Diff
RHEL4 fix for this issue [v3] (1.06 KB, patch)
2008-07-08 12:10 UTC, Prarit Bhargava
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2009:1024 0 normal SHIPPED_LIVE Important: Red Hat Enterprise Linux 4.8 kernel security and bug fix update 2009-05-18 14:57:26 UTC

Description Prarit Bhargava 2008-07-08 12:01:41 UTC
Description of problem:

William Reich noticed the following inconsistency between the DMA-API.txt file
and the DMA-mapping.txt file.  The DMA-mapping.txt file was backported into RHEL4.


Version-Release number of selected component (if applicable): 77.EL

Additional info:

pci_alloc_consistent() calls dma_alloc_coherent()

dma_alloc_coherent() executes the following code:

     memory = dma_alloc_pages(dev, gfp, get_order(size));
                .
                .
                .
                int high, mmu;
                bus = virt_to_bus(memory);
                high = (bus + size) >= dma_mask; <<< by bumping the dma_mask,
                                                     you are simply increasing
                                                     this value.  Therefore,
                                                     high = 0 (always).
                mmu = high;
                if (force_iommu && !(gfp & GFP_DMA)) 
                        mmu = 1;
                if (no_iommu || dma_mask < 0xffffffffUL) { 
                        if (high) {
                                if (!(gfp & GFP_DMA)) { 
                                        gfp |= GFP_DMA; 
                                        free_pages((unsigned long)memory,
                                                   get_order(size));
                                        goto again;
                                }
                                goto free;
                        }
                        mmu = 0; 
                }       
                memset(memory, 0, size); 
                if (!mmu) { 
                        *dma_handle = virt_to_bus(memory);
                        return memory;  <<< we always return here because mmu=0
                }


In the case that that high evaluates to 1, we end up at another method of
getting a dma area,

        *dma_handle = dma_map_area(dev, bus, size, PCI_DMA_BIDIRECTIONAL, 0);

The call to dma_map_area *does not guarantee* any alignment.  It simply queries
the iommu for an empty area and returns pointers to the area (virtual and a dma
handle).

Comment 1 Prarit Bhargava 2008-07-08 12:01:42 UTC
Created attachment 311255 [details]
RHEL4 fix for this issue

Comment 2 Prarit Bhargava 2008-07-08 12:06:03 UTC
Created attachment 311256 [details]
RHEL4 fix for this issue [v2]

Updated patch.

Comment 3 Prarit Bhargava 2008-07-08 12:10:29 UTC
Created attachment 311259 [details]
RHEL4 fix for this issue [v3]

Updated patch.

Comment 4 Prarit Bhargava 2008-07-08 12:17:59 UTC
William (Reich) -- I submitted this patch internally to our kernel list.  That
means that this patch will be reviewed and eventually included in RHEL4.

P.

Comment 5 RHEL Program Management 2008-07-08 12:54:33 UTC
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release.  Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products.  This request is not yet committed for inclusion in an Update
release.

Comment 6 William Reich 2008-07-11 19:47:25 UTC

This was stimulated by work on report #298811

Comment 7 RHEL Program Management 2008-09-03 13:16:42 UTC
Updating PM score.

Comment 8 Vivek Goyal 2008-09-09 21:43:36 UTC
Committed in 78.8.EL . RPMS are available at http://people.redhat.com/vgoyal/rhel4/

Comment 11 errata-xmlrpc 2009-05-18 19:37:12 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHSA-2009-1024.html


Note You need to log in before you can comment on or make changes to this bug.