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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 23 Sep 2020 17:24:51 +0100
From:   Robin Murphy <robin.murphy@....com>
To:     Charan Teja Reddy <charante@...eaurora.org>, joro@...tes.org,
        iommu@...ts.linux-foundation.org
Cc:     linux-kernel@...r.kernel.org
Subject: Re: [PATCH] iommu: of: skip iommu_device_list traversal in
 of_iommu_xlate()

On 2020-09-23 15:53, Charan Teja Reddy wrote:
> In of_iommu_xlate(), check if iommu device is enabled before traversing
> the iommu_device_list through iommu_ops_from_fwnode(). It is of no use
> in traversing the iommu_device_list only to return NO_IOMMU because of
> iommu device node is disabled.

Well, the "use" is that it keeps the code that much smaller and simpler 
to have a single path for returning this condition. This whole callstack 
isn't exactly a high-performance code path to begin with, and we've 
always assumed that IOMMUs present but disabled in DT would be a pretty 
rare exception. Do you have a system that challenges those assumptions 
and shows any benefit from this change?

Robin.

> Signed-off-by: Charan Teja Reddy <charante@...eaurora.org>
> ---
>   drivers/iommu/of_iommu.c | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iommu/of_iommu.c b/drivers/iommu/of_iommu.c
> index e505b91..225598c 100644
> --- a/drivers/iommu/of_iommu.c
> +++ b/drivers/iommu/of_iommu.c
> @@ -94,9 +94,10 @@ static int of_iommu_xlate(struct device *dev,
>   	struct fwnode_handle *fwnode = &iommu_spec->np->fwnode;
>   	int ret;
>   
> +	if (!of_device_is_available(iommu_spec->np))
> +		return NO_IOMMU;
>   	ops = iommu_ops_from_fwnode(fwnode);
> -	if ((ops && !ops->of_xlate) ||
> -	    !of_device_is_available(iommu_spec->np))
> +	if (ops && !ops->of_xlate)
>   		return NO_IOMMU;
>   
>   	ret = iommu_fwspec_init(dev, &iommu_spec->np->fwnode, ops);
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ