Re: [discuss] Re: [PATCH 2/4] x86-64: Calgary IOMMU - move valid_dma_direction into the callers

Jeff Garzik
2006-05-26T08:55:30Z

Andi Kleen wrote:
> On Thursday 25 May 2006 11:58, Jeff Garzik wrote:
>> Muli Ben-Yehuda wrote:
>>> On Thu, May 25, 2006 at 12:35:07AM -0400, Jeff Garzik wrote:
>>>> Jon Mason wrote:
>>>>> >From Andi Kleen's comments on the original Calgary patch, move
>>>>> valid_dma_direction into the calling functions.
>>>>>
>>>>> Signed-off-by: Muli Ben-Yehuda <muli@il.ibm.com>
>>>>> Signed-off-by: Jon Mason <jdmason@us.ibm.com>
>>>> Even though BUG_ON() includes unlikely(), this introduces additional
>>>> tests in very hot paths.
>>> Are they really very hot? I mean if you're calling the DMA API, you're
>>> about to frob the hardware or have already frobbed it - does this
>>> check really matter?
>> When you are adding a check that will _never_ be hit in production, to
>> the _hottest_ paths in the kernel, you can be assured it matters...
>
> pci_dma_* shouldn't be that hot. Or at least IO usually has so much
> overhead that some more bugging shouldn't matter.

I respectfully disagree with that logic. If its a key hot path -- which
it is, every modern network or disk I/O runs through these paths -- then
it deserves at least _some_ consideration before adding more CPU cycles.

> On the other hand if the problem of passing wrong parameters here
> isn't common I would be ok with dropping them.

As the author noted, it was only used in early platform bring-up. And
simply reviewing the patch... it is clear that screwing up the
parameters would cause massive, noticeable problems immediately -- such
as on EM64T with swiotlb.

Jeff