Received: by 2002:a05:6520:4d:b0:139:a872:a4c9 with SMTP id i13csp2567074lkm; Mon, 20 Sep 2021 18:54:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxCuDhVEmSJPM+txWdDm4fmg94cEl84uw2CcO46pLVGh1HxcTTchgz6ZStpb1Bi27zlmvHY X-Received: by 2002:a05:6e02:1305:: with SMTP id g5mr19751818ilr.9.1632189270467; Mon, 20 Sep 2021 18:54:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632189270; cv=none; d=google.com; s=arc-20160816; b=NU9OyT2mdIIi4D7Gf4K6Bk/pmQhuM86Rr+F8/mnpGltcQ1k50BXytgtLgfKFs0286s nZySOXDvxJEghV+ST4kROBXnBvfWz/077I+yAbtiAsr7ZuLCl2V/755Ad+w+OsKlBlWb mfhyzFFjT0KYPq7SnwDtSejcyEXSzD7CACOQkbHRwFKDkxjqfQ64BIXUFvgNv1Wfj+ZA eelxMvy4BXYX+drjPVQRL5apeiFSbRX3vK+txg35WK4HKYqLRVD+BhyW8/NDFzRzFdax h+Bg24/oMCT1aRQ/Pem/Bjrzh8TQKgZmPXWJ8uT5GobtsLqBg07+iJvOyi4UvTEPJCA5 F4Kg== 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=GOZIKft4BbXc0D4QSvXkOPWUOu3iBhYXv0uEUZH5IdY=; b=lQQZMIo4Wx6WmID6xOzj8GUl7GFdmwqKOct0vcf0C4L1R+V+Owyb9q58O+SlYIU6vP LNmQ1d+zdK0CmNKmLCnr0aeOAdoeSzO7+cnR5H4HKMBWXZuLSh4/7Y1H6RVhcukvKN3c JIbfF4EndIyx0fZ1+GzDutndmd5tQ1S5X68fBNYBpwrCA37z4acBNvg482y0ZFeKL5Bu ToWGRo6hca9r6mZQwF9JqingqRjoH8niR/weEzsuITUS8ZZbakkT+DDF8OiQtxXZD+Km 8sEsYxySF6642eLoAjA3qA/KM3mnVv8baAC9HcC7gcwmbnyYhPNVwr8sss+LuZIhNzOI k9BQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=NMJN0ho1; 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 l11si2202059ilv.110.2021.09.20.18.54.19; Mon, 20 Sep 2021 18:54:30 -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=NMJN0ho1; 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 S1346352AbhITSTi (ORCPT + 99 others); Mon, 20 Sep 2021 14:19:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:60636 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357777AbhITSE7 (ORCPT ); Mon, 20 Sep 2021 14:04:59 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 00E2E61A53; Mon, 20 Sep 2021 17:17:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1632158243; bh=PmciNb1mslTz2KO6YkVfzL4onW7x4xImscmzoQGHHek=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NMJN0ho17859Sq/gX26eNaabMvr4MbcM36bqmd83KmIxsLlcMTSUP5k4PVjIKEqGj mEB1U6UJeoalbQtDM97rhBKWurvICL1rbGk6jZpeozKKISuBolTJ3sL6fv5yHHWvfH CNzgQ8VViukc8ypG7LZ6nsLN0GT1Wn91HyF2Y4GQ= 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.4 049/260] dma-debug: fix debugfs initialization order Date: Mon, 20 Sep 2021 18:41:07 +0200 Message-Id: <20210920163932.773468371@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210920163931.123590023@linuxfoundation.org> References: <20210920163931.123590023@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 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); -- 2.30.2