Skip to content

Commit fa55e76

Browse files
Anthony Iliopoulosgregkh
authored andcommitted
dma-debug: fix debugfs initialization order
[ Upstream commit 173735c ] Due to link order, dma_debug_init is called before debugfs has a chance to initialize (via debugfs_init which also happens in the core initcall stage), so the directories for dma-debug are never created. Decouple dma_debug_fs_init from dma_debug_init and defer its init until core_initcall_sync (after debugfs has been initialized) while letting dma-debug initialization occur as soon as possible to catch any early mappings, as suggested in [1]. [1] https://lore.kernel.org/linux-iommu/YIgGa6yF%2Fadg8OSN@kroah.com/ Fixes: 15b28bb ("dma-debug: move initialization to common code") Signed-off-by: Anthony Iliopoulos <ailiop@suse.com> Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent ca7f7e3 commit fa55e76

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

‎kernel/dma/debug.c‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -794,7 +794,7 @@ static int dump_show(struct seq_file *seq, void *v)
794794
}
795795
DEFINE_SHOW_ATTRIBUTE(dump);
796796

797-
static void dma_debug_fs_init(void)
797+
static int __init dma_debug_fs_init(void)
798798
{
799799
struct dentry *dentry = debugfs_create_dir("dma-api", NULL);
800800

@@ -807,7 +807,10 @@ static void dma_debug_fs_init(void)
807807
debugfs_create_u32("nr_total_entries", 0444, dentry, &nr_total_entries);
808808
debugfs_create_file("driver_filter", 0644, dentry, NULL, &filter_fops);
809809
debugfs_create_file("dump", 0444, dentry, NULL, &dump_fops);
810+
811+
return 0;
810812
}
813+
core_initcall_sync(dma_debug_fs_init);
811814

812815
static int device_dma_allocations(struct device *dev, struct dma_debug_entry **out_entry)
813816
{
@@ -892,8 +895,6 @@ static int dma_debug_init(void)
892895
spin_lock_init(&dma_entry_hash[i].lock);
893896
}
894897

895-
dma_debug_fs_init();
896-
897898
nr_pages = DIV_ROUND_UP(nr_prealloc_entries, DMA_DEBUG_DYNAMIC_ENTRIES);
898899
for (i = 0; i < nr_pages; ++i)
899900
dma_debug_create_entries(GFP_KERNEL);

0 commit comments

Comments
 (0)