Re: GFP_ATOMIC page allocation failures.

Jeff Garzik
2008-04-02T19:07:49Z

David Miller wrote:
> From: Peter Zijlstra <peterz@infradead.org>
> Date: Wed, 02 Apr 2008 13:04:59 +0200
>
>> Would we not hope that most net drivers can handle {,net}dev_alloc_skb()
>> failing? Otherwise we have some serious trouble.
>
> False presumption.
>
> Most can but some legacy ones really do not handle this well.

Correct...

In addition, I remain worried about potential edge cases in drivers that
do "burst refill" style allocations, rather than the [IMO safer]
as-you-go style that tg3 employs.

I haven't done a serious audit, but I have nagging doubts about the
behavior of burst-refill drivers when faced with a burst of failed
allocations... do they stop DMA operation, or do they permit hardware
to wander into part of the DMA ring where, in the previous "cycle"
through the ring, valid DMA addresses were placed. But now with a
string of allocation failures, you have a sequence of DMA ring
descriptors that point to invalid memory. If the DMA engine is not
stopped, or in some other way made to avoid those invalid DMA
descriptors, then you can easily run into problems.

Sometimes, it's as easy as making sure to properly police the 'OWN' bit
of each descriptor, something easily and commonly done as a matter of
course. But modern hardware with multi-descriptor packets make things
more complex, so it is actually getting more difficult to get these
details right.

</ramble>

Jeff