Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1909781pxb; Thu, 16 Sep 2021 19:57:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwVn5gAQgTsLwEtJCff9BXIvEylZErWyrjd+xT7LxKBMSdk6tBzAqDjl2BLe3hS4Wguqr/o X-Received: by 2002:a05:6402:1cb9:: with SMTP id cz25mr10069918edb.364.1631847463624; Thu, 16 Sep 2021 19:57:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631847463; cv=none; d=google.com; s=arc-20160816; b=lbisGYLeZEiekllYRf5yclAGe90ss0NN3twnbdBnyPALZTOePsQJlEY9nYXTZKM9W8 Gl0zNB+S9MosejrvYfl7FShoY5Uqz0yOY2I++qMaF7g0yvmNYxpkhwBEzs3uZktoPrli bckXadBjzZhiLzq1LRCAcY4NM84uF+SyFo80Q882FfZVEhPLBcqjnlwkjLYbDYOBW6Pa CmHOettKM09MTMMVfYl98CPlPjjp3NGKr09AGJanHEpL1ebaZJZnBajOrl+Hy+mjrIOG 60KAzigEJvpZHgrzdlaYvBqh79+/9UG4wk9uvzTgHRo+tSxXQfKv5PzfVHUVRhH0sslG H3Kw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=nOGE7tVpNIGLgZmoZzn6armeddyDnGPy0PbLx/r0oYQ=; b=nUTRB3RId2aF9xujnkWaLL2FlA2aqCNiD4PZceYz+lfVKMrmtxHzrYEiMyqdj+MG9+ y8fzVPrYUnfdc8tmlazciESoT0gu5bQfgOKAWS2hNbMKe2pvRaQl/wUfoSbqc9kj2TlU m/NvTwC97I4P9dhI1A1D0p+/4p5T10newf3Yrbca9nTFBXdgYotdS208EesenxH0S/xl ZcGk3IRuVX/qetcO6eN2BswqWDRrQBCH8/LMsnSHstIq3Etm79XrLejgLbvABfEUcKJ6 n6acG/jKjkTtu9a+xm5AMX1rjNYO52tLbDNVXh5Qyea6SVZtz68c4jvYypZgYPdj8/ma YSlw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YXZsg0oa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dz15si787015edb.601.2021.09.16.19.57.20; Thu, 16 Sep 2021 19:57:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YXZsg0oa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352192AbhIPRUr (ORCPT + 99 others); Thu, 16 Sep 2021 13:20:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:41020 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344343AbhIPRNX (ORCPT ); Thu, 16 Sep 2021 13:13:23 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3E24561409; Thu, 16 Sep 2021 16:38:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631810330; bh=OoEyDpXIJdbSmFMG7xNFLhc81oUX6ApQpA9y8K1LQn8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YXZsg0oameqrHD9e21zVisSr19xp1ExVJMT3Wl/BBGuWjHP9FEuIEqUwiZIYd+Gn6 q/d2kkqc8DIZzyjaoHqy+jGwwtUoOB181LUCFpqdvoz084FqZvQ0W4/ldVdOAq+nNj XljuCaptd0vb4Kqe/t/Bg3H6V+ovx7hJ/O1LI97c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Anthony Iliopoulos , Christoph Hellwig , Sasha Levin Subject: [PATCH 5.14 102/432] dma-debug: fix debugfs initialization order Date: Thu, 16 Sep 2021 17:57:31 +0200 Message-Id: <20210916155814.237799470@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210916155810.813340753@linuxfoundation.org> References: <20210916155810.813340753@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Anthony Iliopoulos [ 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 Signed-off-by: Christoph Hellwig Signed-off-by: Sasha Levin --- kernel/dma/debug.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/kernel/dma/debug.c b/kernel/dma/debug.c index dadae6255d05..f2faa13534e5 100644 --- a/kernel/dma/debug.c +++ b/kernel/dma/debug.c @@ -792,7 +792,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); @@ -805,7 +805,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) { @@ -890,8 +893,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); -- 2.30.2