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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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?

> +int __init init_dmars(void)
> +{
> +	struct dmar_drhd_unit *drhd;
> +	struct dmar_rmrr_unit *rmrr;
> +	struct pci_dev *pdev;
> +	struct intel_iommu *iommu;
> +	int ret, unit = 0;
> +
> +	/*
> +	 * for each drhd
> +	 *    allocate root
> +	 *    initialize and program root entry to not present
> +	 * endfor
> +	 */
> +	for_each_drhd_unit(drhd) {
> +		if (drhd->ignored)
> +			continue;
> +		iommu = alloc_iommu(drhd);

GFP_KERNEL alloc possible?

> +{
> +	int ret = 0;
> +
> +	iommu_devinfo_cache = kmem_cache_create("iommu_devinfo",
> +					 sizeof(struct device_domain_info),
> +					 0,
> +					 SLAB_HWCACHE_ALIGN,
> +					 NULL,

Replace by

iommu_devinfo_cache = KMEM_CACHE(iommu_devinfo, SLAB_HWCACHE_ALIGN)

> +static inline int iommu_iova_cache_init(void)
> +{
> +	int ret = 0;
> +
> +	iommu_iova_cache = kmem_cache_create("iommu_iova",
> +					 sizeof(struct iova),
> +					 0,
> +					 SLAB_HWCACHE_ALIGN,
> +					 NULL,
> +					 NULL);

Ditto

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

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux