Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1550084pxb; Thu, 16 Sep 2021 09:43:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxjMqWg6rmz1uzj8kDc09TNp8DD4WxesRaSJLExuChbXdSBxwgA1tO7J3FhHMZT+txd9Lp+ X-Received: by 2002:a17:906:a018:: with SMTP id p24mr7111599ejy.349.1631810603124; Thu, 16 Sep 2021 09:43:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631810603; cv=none; d=google.com; s=arc-20160816; b=fYcWF492QRuJ6AMpKOgnnS4Ar+VrR28yDzgwyA3aMBBnPK7iUa0q0Zg/PwhEubB2VG TiZTka+EVt0hi5wpvoH8zthaBO07t0mMJTgmSgSEKiun8CnLO9JsiA+3zBUcBSlI20iH hBd4e7Qinb4vy6yefEfZpzQlMDzwdzphK5lpdAVFAQ3ciYbTnPG2J06eID/guohfusL8 Z9bypitzLg0AELmIbBtSAjZ6sPLUIK2OR4Q/s69ZbitNlyI7iWJzq9aK1ibCP9eOFRQU FgVsdXLFfXMDZGhBAubgjoFsWwKTIEyMIyyWqGAoorGCU7Zphhq27OFDbfZcmDWrK0XQ 1/hA== 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=uEsK5XgXlKCOxr036CfTRnaw/r+yiazk6KuDro/DHlQ=; b=ZKzrNemPr+apn6xyQyO+7ZSqrKJVYGLZbgZYOkSQ1rILo9gZHxcWe0/ttu6BRleElb 0D5rFhA/Z4+RJZEm1FVqd0oTRoaYuTZjk3t6xzz/wSP9/7mto8XTjFEhjX4/erhGpfMo spYoFCwnE77lGqvs7f4IjYFGY858LOnhgX6MeGa8o96a+H4jqKdZEzQb+HMVMpB8JmIx xjJZ9xw/OcapwkicBOl0ulYIzL3PZkx3UQUsQ7YM+u5x1lWg5s9BtNq+m/xm6urZ+Tg7 y2CTqAO/pV2TWgZc34HDVJydxSHN25t4CaBz7/rJiHl1spejAJ4R4AQ4lZRscluS2ixB LUCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0roHYB2r; 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 y7si4322886edm.197.2021.09.16.09.42.58; Thu, 16 Sep 2021 09:43:23 -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=0roHYB2r; 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 S240954AbhIPQlS (ORCPT + 99 others); Thu, 16 Sep 2021 12:41:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:44350 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244224AbhIPQfB (ORCPT ); Thu, 16 Sep 2021 12:35:01 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0CA7561989; Thu, 16 Sep 2021 16:21:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631809268; bh=G1ZlR/KPppvgOA8cyS27zxnrqtMOzXMJDSDxRLDiTBE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0roHYB2rM4T8+37zdLvYouqQOQbnTYv3CWmIK8+N/A26tDU+oCyPm5Erpy4BVaNEX /VVIq1hB/4CqSGTf0hptivH5tLA4p4zd8nNiPKRvudSV414cC7wu76/+qA8jlKrpBr Xxrf/6/93iM4VHGfkTAYTkMwxPSRO2q3K39ogBAw= 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.13 092/380] dma-debug: fix debugfs initialization order Date: Thu, 16 Sep 2021 17:57:29 +0200 Message-Id: <20210916155807.168210663@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210916155803.966362085@linuxfoundation.org> References: <20210916155803.966362085@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 14de1271463f..445754529917 100644 --- a/kernel/dma/debug.c +++ b/kernel/dma/debug.c @@ -794,7 +794,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); @@ -807,7 +807,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) { @@ -892,8 +895,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