lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120125114417.GE19255@amd.com>
Date:	Wed, 25 Jan 2012 12:44:17 +0100
From:	Joerg Roedel <joerg.roedel@....com>
To:	KyongHo Cho <pullip.cho@...sung.com>
CC:	Joerg Roedel <joro@...tes.org>,
	<linux-samsung-soc@...r.kernel.org>,
	<linux-kernel@...r.kernel.org>, <iommu@...ts.linux-foundation.org>,
	Younglak Kim <younglak1004.kim@...sung.com>,
	Subash Patel <subash.ramaswamy@...aro.org>,
	Kukjin Kim <kgene.kim@...sung.com>,
	Kyungmin Park <kyungmin.park@...sung.com>,
	Sanghyun Lee <sanghyun75.lee@...sung.com>,
	<linux-arm-kernel@...ts.infradead.org>
Subject: Re: [PATCH v8 2/2] iommu/exynos: Add iommu driver for Exynos
 Platforms

On Wed, Jan 25, 2012 at 03:51:58PM +0900, KyongHo Cho wrote:
> > This isn't really a problem. We allow destroying a domain with devices
> > attached. So this WARN_ON is not necessary.
> >
> BTW, Isn't it a problem when a device driver does not know that its
> iommu domain is destroyed?
> Can we regards that it is the faulty use of iommu API?

Yes we could, but we don't ;) The domain_destroy path has to take care
of this anyway to be robust, so we can also take away the need to unattach
everything from a domain from the iommu-api user.

> > This looks like you are partially re-implementing behavior of generic
> > code because you are mapping multiple sections at once. The generic map
> > code already splits up the address range correctly, so no need to do
> > this in the driver (unless there is some benefit in the hardware, like
> > an IOTLB entry that can cover multiple sections or something similar).
> >
> Yes, I wanted to avoid repeated function call by iommu_map().
> s5p_iommu_map() maps once for the same page size since it is efficient
> and simple.
> That's why this driver initializes domain->pgsize_bitmap with 0xFFFFF000
> even though our IOMMU driver just supports 3 different page sizes
> including 4KB, 64KB and 1MB.

Repeated function calls are not a real performance problem in the
iommu-code in my experience. The overhead is usualle somewhere else.

> Do you think it is better for s5p_iommu_map() to map just one page at once?

In general I think we should not duplicate code. This logic was moved to
the generic part for a reason and iommu drivers should use it unless
there is a very good reason not to do so.

> 
> >> +static size_t exynos_iommu_unmap(struct iommu_domain *domain,
> >> +                                            unsigned long iova, size_t size)
> >> +{
> >> +     struct exynos_iommu_domain *priv = domain->priv;
> >> +     struct iommu_client *client;
> >> +     unsigned long flags;
> >> +
> >> +     BUG_ON(priv->pgtable == NULL);
> >> +
> >> +     spin_lock_irqsave(&priv->pgtablelock, flags);
> >> +
> >> +     while (size != 0) {
> >> +             int i, nent, order;
> >> +             unsigned long *pent, *sent;
> >
> > Same with this while-loop. This looks like it re-implements behavior
> > from the generic code.
> >
> If a region to unmap consists of tens of pages
> there is no way to avoid flushing IOTLB repeatedly.
> 
> Out iommu driver doesn't need to flush IOTLB more than once for a
> region to unmap.
> 
> Do you think the driver is better to unmaps just one page at once
> though flushing IOTLB repeatedly?

Is I/O-TLB flushing an expensive operation?


	Joerg

-- 
AMD Operating System Research Center

Advanced Micro Devices GmbH Einsteinring 24 85609 Dornach
General Managers: Alberto Bozzo
Registration: Dornach, Landkr. Muenchen; Registerger. Muenchen, HRB Nr. 43632

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ