Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1699822pxb; Thu, 16 Sep 2021 13:19:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxAa7e0S3SnaFk2frVzD/fjp9PNCEwnwEk5sTtz7iyY91U6mUBenfNL9M0KHG/XZfj0jSeF X-Received: by 2002:a50:9d42:: with SMTP id j2mr8568289edk.330.1631823580544; Thu, 16 Sep 2021 13:19:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631823580; cv=none; d=google.com; s=arc-20160816; b=APJ+9sICWzFg97JzvjfirptbRNbSZIzKnLdBXPdEidU982q3R36rEB6oHHKm6DjAyr /RwzEyeWB56i4yknNQpBjLZz97qWoeebPj8oUZhLLwpRLaEgz2IhT8MMBn0LAuubRfaC s38iqvVGvMsQmxQwEE3Wkn+rplH0NLSpmNKLr7fR9teFrr3PCSQFZIvT4BJmP4hhueF6 o8mnlWTDkyaqfxEzrwoJp7jkJnUPqNiNY2ZOzss2m6so7aOYjAiwyQE/99lP43AQD6al dlg6PxTJuRMkhOjJYVDwi6/9xq9vCfJadd+CXbHhIajSiL6CtYpDbpb206lhPGMi7ggI 9+Xw== 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=CFMJkDf3RKzX5Zb8uHVLsWRsxeEN7PS7679u/rF+RTranPpq/LpZmqMYCiWDl3JQgd AQLieBUGIHztEaOxW6ylj7GciaqKGsF3db3uS89Kzgu/EL+FHgyJ/9Z2brN/McyUCOgz huSFWQRij3pXWVbC4b+PGYJGTzDzzKzfOPk1RUpF4yRmU3zvGgDECccyZeaHJ5jA52MY D1TEC5MahwI6uPOByWJnb9uHxNck9dDDh4wTP7XE6VB+1IxH9+g42h+C67zCqndfJb45 uFYJGJBDC3dWIlcg77bdd3wxaqBH0JcBFzoHaQavmCvyuYJ63Mponi4SN/cArFhfZ2pq /84Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=XQxFDAEA; 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 hd17si4305176ejc.727.2021.09.16.13.19.16; Thu, 16 Sep 2021 13:19:40 -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=XQxFDAEA; 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 S241274AbhIPQTU (ORCPT + 99 others); Thu, 16 Sep 2021 12:19:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:46774 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234606AbhIPQJe (ORCPT ); Thu, 16 Sep 2021 12:09:34 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5881B60F5B; Thu, 16 Sep 2021 16:07:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631808479; bh=G1ZlR/KPppvgOA8cyS27zxnrqtMOzXMJDSDxRLDiTBE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XQxFDAEAADota2qXu0FqbWz6rXJkBQQASz+s/J3Oln/bicVcX09v9kDQo10gWhO71 tMEe5UQqyuEOE78Nz5ei9tCtQakpA0/JAUnWYmDGqhQ1nQ2RBMv/2ygQmo0U4L4308 vjY3Law5aTLbvG8p7sMIsVQHenh021C5QD9nV27A= 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.10 074/306] dma-debug: fix debugfs initialization order Date: Thu, 16 Sep 2021 17:56:59 +0200 Message-Id: <20210916155756.581873333@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210916155753.903069397@linuxfoundation.org> References: <20210916155753.903069397@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