Re: [Intel IOMMU 05/10] Intel IOMMU driver

From: Keshavamurthy, Anil S
Date: Tue Jun 19 2007 - 19:55:17 EST


On Tue, Jun 19, 2007 at 04:32:23PM -0700, Christoph Lameter wrote:
> On Tue, 19 Jun 2007, Keshavamurthy, Anil S wrote:
>
> > +static inline void *alloc_pgtable_page(void)
> > +{
> > + return (void *)get_zeroed_page(GFP_ATOMIC);
> > +}
>
> Need to pass gfp_t parameter. Repeates a couple of times.
>
> > + addr &= (((u64)1) << addr_width) - 1;
> > + parent = domain->pgd;
> > +
> > + spin_lock_irqsave(&domain->mapping_lock, flags);
> > + while (level > 0) {
> > + void *tmp_page;
> > +
> > + offset = address_level_offset(addr, level);
> > + pte = &parent[offset];
> > + if (level == 1)
> > + break;
> > +
> > + if (!dma_pte_present(*pte)) {
> > + tmp_page = alloc_pgtable_page();
>
> Is it not possible here to drop the lock and do the alloc with GFP_KERNEL
> and deal with the resulting race? That is done in other parts of the
> kernel.
>
> > +/* iommu handling */
> > +static int iommu_alloc_root_entry(struct intel_iommu *iommu)
> > +{
> > + struct root_entry *root;
> > + unsigned long flags;
> > +
> > + root = (struct root_entry *)alloc_pgtable_page();
>
> This may be able to become a GFP_KERNEL alloc since interrupts are enabled
> at this point?

Memory allocated during driver init is very less and not much benefit
with the suggested changes I think. Please correct me If I am wrong.

The biggest benifit will be when we can figure out GPF_XXXX flags
during runtime when DMA map api's are called.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/