In commit d78e0ac577 ("iommu/vt-d: Change scope lists to struct device, bus, devfn") I converted the 'struct device *' arrays into an array of 'struct dmar_dev_scope', where:
struct dmar_dev_scope { struct device *dev; u8 bus; u8 devfn; }; That commit contained changes such as this: -extern void dmar_free_dev_scope(struct pci_dev __rcu ***devices, int *cnt); +extern void dmar_free_dev_scope(struct dmar_dev_scope __rcu **devices, int *cnt); This was wrong; it is the device pointer which needs to be protected with RCU, and the above-cited change was moving the __rcu annotation so that it actually referred to the enclosing structure, not the device pointer itself. Reported by the Intel 0-day build testing infrastructure. Thanks, Fengguang. Signed-off-by: David Woodhouse <david.woodho...@intel.com> --- drivers/iommu/dmar.c | 8 ++++---- drivers/iommu/intel-iommu.c | 4 ++-- include/linux/dmar.h | 10 +++++----- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/iommu/dmar.c b/drivers/iommu/dmar.c index cd05a4b..56e1c79 100644 --- a/drivers/iommu/dmar.c +++ b/drivers/iommu/dmar.c @@ -100,7 +100,7 @@ void *dmar_alloc_dev_scope(void *start, void *end, int *cnt) return kcalloc(*cnt, sizeof(struct dmar_dev_scope), GFP_KERNEL); } -void dmar_free_dev_scope(struct dmar_dev_scope __rcu **devices, int *cnt) +void dmar_free_dev_scope(struct dmar_dev_scope **devices, int *cnt) { int i; struct device *tmp_dev; @@ -191,7 +191,7 @@ static bool dmar_match_pci_path(struct dmar_pci_notify_info *info, int bus, /* Return: > 0 if match found, 0 if no match found, < 0 if error happens */ int dmar_insert_dev_scope(struct dmar_pci_notify_info *info, void *start, void*end, u16 segment, - struct dmar_dev_scope __rcu *devices, + struct dmar_dev_scope *devices, int devices_cnt) { int i, level; @@ -235,7 +235,7 @@ int dmar_insert_dev_scope(struct dmar_pci_notify_info *info, } int dmar_remove_dev_scope(struct dmar_pci_notify_info *info, u16 segment, - struct dmar_dev_scope __rcu *devices, int count) + struct dmar_dev_scope *devices, int count) { int index; struct device *tmp; @@ -565,7 +565,7 @@ parse_dmar_table(void) return ret; } -static int dmar_pci_device_match(struct dmar_dev_scope __rcu devices[], +static int dmar_pci_device_match(struct dmar_dev_scope devices[], int cnt, struct pci_dev *dev) { int index; diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index 53996d9..6fbce01 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c @@ -381,14 +381,14 @@ struct dmar_rmrr_unit { struct acpi_dmar_header *hdr; /* ACPI header */ u64 base_address; /* reserved base address*/ u64 end_address; /* reserved end address */ - struct dmar_dev_scope __rcu *devices; /* target devices */ + struct dmar_dev_scope *devices; /* target devices */ int devices_cnt; /* target device count */ }; struct dmar_atsr_unit { struct list_head list; /* list of ATSR units */ struct acpi_dmar_header *hdr; /* ACPI header */ - struct dmar_dev_scope __rcu *devices; /* target devices */ + struct dmar_dev_scope *devices; /* target devices */ int devices_cnt; /* target device count */ u8 include_all:1; /* include all ports */ }; diff --git a/include/linux/dmar.h b/include/linux/dmar.h index 4c2caab..23c8db1 100644 --- a/include/linux/dmar.h +++ b/include/linux/dmar.h @@ -37,7 +37,7 @@ struct acpi_dmar_header; struct intel_iommu; struct dmar_dev_scope { - struct device *dev; + struct device __rcu *dev; u8 bus; u8 devfn; }; @@ -48,7 +48,7 @@ struct dmar_drhd_unit { struct list_head list; /* list of drhd units */ struct acpi_dmar_header *hdr; /* ACPI header */ u64 reg_base_addr; /* register base address*/ - struct dmar_dev_scope __rcu *devices;/* target device array */ + struct dmar_dev_scope *devices;/* target device array */ int devices_cnt; /* target device count */ u16 segment; /* PCI domain */ u8 ignored:1; /* ignore drhd */ @@ -103,13 +103,13 @@ extern int dmar_dev_scope_init(void); extern int dmar_parse_dev_scope(void *start, void *end, int *cnt, struct dmar_dev_scope **devices, u16 segment); extern void *dmar_alloc_dev_scope(void *start, void *end, int *cnt); -extern void dmar_free_dev_scope(struct dmar_dev_scope __rcu **devices, int *cnt); +extern void dmar_free_dev_scope(struct dmar_dev_scope **devices, int *cnt); extern int dmar_insert_dev_scope(struct dmar_pci_notify_info *info, void *start, void*end, u16 segment, - struct dmar_dev_scope __rcu *devices, + struct dmar_dev_scope *devices, int devices_cnt); extern int dmar_remove_dev_scope(struct dmar_pci_notify_info *info, - u16 segment, struct dmar_dev_scope __rcu *devices, + u16 segment, struct dmar_dev_scope *devices, int count); /* Intel IOMMU detection */ extern int detect_intel_iommu(void); -- 1.8.5.3 -- David Woodhouse Open Source Technology Centre david.woodho...@intel.com Intel Corporation
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu