Re: pci_alloc_consistent from interrupt == BAD

Dan Malek (dan@embeddededge.com)
Fri, 18 Jan 2002 16:43:01 -0500


David S. Miller wrote:

> If it specifies GFP_ATOMIC, there are no problems from interrupts.
> You will see that every port other than the mentioned two above use
> GFP_ATOMIC in their pci_alloc_consistent implementation, for this very
> reason.

The PowerPC does use (or is supposed to use) GFP_ATOMIC. I don't
know why ARM doesn't.

I guess I'm just trying to understand the value of calling it from interrupt.
If the purpose is to allocate a page of memory, and that doesn't happen,
all you have done is pushed added complexity to a device driver. If
an interrupt handler (and the remainder of the driver) must handle the
condition of wanting a page but not getting one in the interrupt handler,
why bother trying to do it at all?

> The ARM and PPC ports could set __GFP_HIGH in their page table
> allocation calls when invoked via pci_alloc_consistent,

How does this solve anything? All it does is make more memory potentially
available. If memory isn't available, the call is still going to fail.

> ...... It is a trivial fix whereas backing
> out this ability to call pci_alloc_consistent from interrupts is not
> a trivial change at all.

You can call pci_alloc_consistent from anywhere on any architecture,
but anyone calling it and not handling an error condition is a broken
implementation.

I have to apologize to hozer, because the allocation of page tables would
be a condition where pci_alloc_consistent could return an error. However,
he must be looking into the future because that is the way it will be
later today when I'm done changing the functions, not the current implementation.

Thanks.

-- Dan

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