summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnthony Iliopoulos <ailiop@suse.com>2021-07-22 16:10:55 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-09-22 12:26:24 +0200
commitbe09cbd6a35fda58cf3a781a41ffd8fd76586da1 (patch)
treed9091b28278538fdc14a07018869d685264c342d
parent9315497b1750e7c316fddfbf46dff8e886c3671c (diff)
downloadlinux-stable-be09cbd6a35fda58cf3a781a41ffd8fd76586da1.tar.gz
linux-stable-be09cbd6a35fda58cf3a781a41ffd8fd76586da1.tar.bz2
linux-stable-be09cbd6a35fda58cf3a781a41ffd8fd76586da1.zip
dma-debug: fix debugfs initialization order
[ Upstream commit 173735c346c412d9f084825ecb04f24ada0e2986 ] 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: 15b28bbcd567 ("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>
-rw-r--r--kernel/dma/debug.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/kernel/dma/debug.c b/kernel/dma/debug.c
index cb6425e52bf7..01e893cf9b9f 100644
--- a/kernel/dma/debug.c
+++ b/kernel/dma/debug.c
@@ -846,7 +846,7 @@ static int dump_show(struct seq_file *seq, void *v)
}
DEFINE_SHOW_ATTRIBUTE(dump);
-static void dma_debug_fs_init(void)
+static int __init dma_debug_fs_init(void)
{
struct dentry *dentry = debugfs_create_dir("dma-api", NULL);
@@ -859,7 +859,10 @@ static void dma_debug_fs_init(void)
debugfs_create_u32("nr_total_entries", 0444, dentry, &nr_total_entries);
debugfs_create_file("driver_filter", 0644, dentry, NULL, &filter_fops);
debugfs_create_file("dump", 0444, dentry, NULL, &dump_fops);
+
+ return 0;
}
+core_initcall_sync(dma_debug_fs_init);
static int device_dma_allocations(struct device *dev, struct dma_debug_entry **out_entry)
{
@@ -944,8 +947,6 @@ static int dma_debug_init(void)
spin_lock_init(&dma_entry_hash[i].lock);
}
- dma_debug_fs_init();
-
nr_pages = DIV_ROUND_UP(nr_prealloc_entries, DMA_DEBUG_DYNAMIC_ENTRIES);
for (i = 0; i < nr_pages; ++i)
dma_debug_create_entries(GFP_KERNEL);