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]
Date:   Fri, 27 Oct 2023 04:30:31 +0000
From:   Henry Willard <henry.willard@...cle.com>
To:     Lu Baolu <baolu.lu@...ux.intel.com>
CC:     Joerg Roedel <joro@...tes.org>, Will Deacon <will@...nel.org>,
        Robin Murphy <robin.murphy@....com>,
        Jason Gunthorpe <jgg@...pe.ca>,
        Kevin Tian <kevin.tian@...el.com>,
        "iommu@...ts.linux.dev" <iommu@...ts.linux.dev>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/1] iommu: Avoid unnecessary cache invalidations

On Oct 26, 2023, at 1:49 AM, Lu Baolu <baolu.lu@...ux.intel.com> wrote:
> 
> The iommu_create_device_direct_mappings() only needs to flush the caches
> when the mappings are changed in the affected domain. This is not true
> for non-DMA domains, or for devices attached to the domain that have no
> reserved regions. To avoid unnecessary cache invalidations, add a check
> before iommu_flush_iotlb_all().

This also fixes a boot failure on Sapphire Rapids built with 
CONFIG_IOMMU_DEFAULT_PASSTHROUGH=y or the equivalent via 
kernel command line parameters. 

> 
> Fixes: a48ce36e2786 ("iommu: Prevent RESV_DIRECT devices from blocking domains")
> Signed-off-by: Lu Baolu <baolu.lu@...ux.intel.com>
Tested-by:  Henry Willard <henry.willard@...cle.com>
> ---
> drivers/iommu/iommu.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
> index 00d0a2b5d7dc..0cb676590bfa 100644
> --- a/drivers/iommu/iommu.c
> +++ b/drivers/iommu/iommu.c
> @@ -1114,7 +1114,8 @@ static int iommu_create_device_direct_mappings(struct iommu_domain *domain,
> 
> 	}
> 
> -	iommu_flush_iotlb_all(domain);
> +	if (!list_empty(&mappings) && iommu_is_dma_domain(domain))
> +		iommu_flush_iotlb_all(domain);
> 
> out:
> 	iommu_put_resv_regions(dev, &mappings);
> -- 
> 2.34.1
> 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ