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] [day] [month] [year] [list]
Message-ID: <20200514190252.ykwdpu7qwzsxjvlp@cantor>
Date:   Thu, 14 May 2020 12:02:52 -0700
From:   Jerry Snitselaar <jsnitsel@...hat.com>
To:     Joerg Roedel <joro@...tes.org>
Cc:     linux-kernel@...r.kernel.org, iommu@...ts.linux-foundation.org,
        Suravee Suthikulpanit <suravee.suthikulpanit@....com>,
        Tom Murphy <murphyt7@....ie>
Subject: Re: amd kdump failure with iommu=nopt

On Thu May 14 20, Joerg Roedel wrote:
>On Thu, May 14, 2020 at 05:36:23PM +0200, Joerg Roedel wrote:
>> This commit also removes the deferred attach of the device to its new
>> domain. Does the attached diff fix the problem for you?
>> +static int __iommu_attach_device_no_defer(struct iommu_domain *domain,
>> +					  struct device *dev)
>> +{
>>  	if (unlikely(domain->ops->attach_dev == NULL))
>>  		return -ENODEV;
>>
>>  	ret = domain->ops->attach_dev(domain, dev);
>>  	if (!ret)
>>  		trace_attach_device_to_domain(dev);
>> +
>>  	return ret;
>>  }
>
>Sorry, this didn't compile, here is an updated version that actually
>compiles:
>
>
>diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
>index 4050569188be..f54ebb964271 100644
>--- a/drivers/iommu/iommu.c
>+++ b/drivers/iommu/iommu.c
>@@ -1889,13 +1889,19 @@ void iommu_domain_free(struct iommu_domain *domain)
> }
> EXPORT_SYMBOL_GPL(iommu_domain_free);
>
>-static int __iommu_attach_device(struct iommu_domain *domain,
>-				 struct device *dev)
>+static bool __iommu_is_attach_deferred(struct iommu_domain *domain,
>+				       struct device *dev)
>+{
>+	if (!domain->ops->is_attach_deferred)
>+		return false;
>+
>+	return domain->ops->is_attach_deferred(domain, dev);
>+}
>+
>+static int __iommu_attach_device_no_defer(struct iommu_domain *domain,
>+					  struct device *dev)
> {
> 	int ret;
>-	if ((domain->ops->is_attach_deferred != NULL) &&
>-	    domain->ops->is_attach_deferred(domain, dev))
>-		return 0;
>
> 	if (unlikely(domain->ops->attach_dev == NULL))
> 		return -ENODEV;
>@@ -1903,9 +1909,19 @@ static int __iommu_attach_device(struct iommu_domain *domain,
> 	ret = domain->ops->attach_dev(domain, dev);
> 	if (!ret)
> 		trace_attach_device_to_domain(dev);
>+
> 	return ret;
> }
>
>+static int __iommu_attach_device(struct iommu_domain *domain,
>+				 struct device *dev)
>+{
>+	if (__iommu_is_attach_deferred(domain, dev))
>+		return 0;
>+
>+	return __iommu_attach_device_no_defer(domain, dev);
>+}
>+
> int iommu_attach_device(struct iommu_domain *domain, struct device *dev)
> {
> 	struct iommu_group *group;
>@@ -2023,7 +2039,12 @@ EXPORT_SYMBOL_GPL(iommu_get_domain_for_dev);
>  */
> struct iommu_domain *iommu_get_dma_domain(struct device *dev)
> {
>-	return dev->iommu_group->default_domain;
>+	struct iommu_domain *domain = dev->iommu_group->default_domain;
>+
>+	if (__iommu_is_attach_deferred(domain, dev))
>+		__iommu_attach_device_no_defer(domain, dev);
>+
>+	return domain;
> }
>
> /*
>_______________________________________________
>iommu mailing list
>iommu@...ts.linux-foundation.org
>https://lists.linuxfoundation.org/mailman/listinfo/iommu
>

Yes, that works.

Tested-by: Jerry Snitselaar <jsnitsel@...hat.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ