Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp7140313rwl; Wed, 22 Mar 2023 23:05:32 -0700 (PDT) Authentication-Results: mx.google.com; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b="SpbbEOe/" X-Google-Smtp-Source: AK7set+26MMVdDief7+I9uZTW4zziLSTUqQ2VojD9piN8Thv9ThuP2ZAF7vKqTazmVHnHwkFmVTb X-Received: by 2002:a17:90b:1d90:b0:23b:2c51:6e7 with SMTP id pf16-20020a17090b1d9000b0023b2c5106e7mr6410416pjb.21.1679551531801; Wed, 22 Mar 2023 23:05:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679551531; cv=none; d=google.com; s=arc-20160816; b=mLwGuAlxluWa2uQxrFalEklT6kJbLb8vmnyB+kqKTRBziWwPcbqu4VEE71cRgwh3UM WTarD+cipeAOFJC12pPa/rbDgnjf6qOmh33Qp0rUfO4MfeTzk6GhgMKxjul5TaZFD6an HLvrdVivWQH2TukwnAvoPeYc+XJz++XxoshcQYIPrrrdax1JRk7ibp71Hmu51vqTxodt aqK6pT6qR7sJU5TiG7ILEDX/Pb9azVtayos8YiE0hvAOqucZdGkaQxDJkuO9e1cCj2h6 p47CSD0BgXXeVIojWe5xn0VPR3wYWO0AH0crCprfE7SXu4f3t4Y7GIV65jyzj+RErSfT zNHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:date:subject:from:message-id:cc:to:feedback-id :dkim-signature; bh=YhuEjAxKe5DSpWbcQtZChqj8VvtOc3qtdr+kNcEXltE=; b=i8tDfSnXefFnmgUfn1IsgrBo+zN0Q0TSu6Z/cjJ1ZWpegHl5RB7APsSxSchexvw1/Y ff0tGebHh7TxIfZx6+cxMH7H4laHRdoT/DcmJWhpBYIgKtgTaLLJooi9J+SnNrDbav0C ntIc3tTmANurqDJocvjfLIyl3RsnJAgWqtIOTEPrIhyMTBJybUL75+qSSt8HtCsNZ5/j 3GDOgwRS0xDf/CQuVlUtp5FM4qq8k91Vhe6iUkKOIrfi04iJ1jPRUvi5A8t8pIo0bKWn 2gzx7CvZkICkaeTpaH1znh7kYqOPcWMYSIjoidLiu/tN5SB5XOupJXvyvnG7NZc17E3w It6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b="SpbbEOe/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r18-20020a17090b051200b0023d2e945affsi966580pjz.33.2023.03.22.23.05.20; Wed, 22 Mar 2023 23:05:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b="SpbbEOe/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229484AbjCWGCy (ORCPT + 99 others); Thu, 23 Mar 2023 02:02:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45002 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229451AbjCWGCx (ORCPT ); Thu, 23 Mar 2023 02:02:53 -0400 Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E305D1EBCE for ; Wed, 22 Mar 2023 23:02:51 -0700 (PDT) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 049255C01AB; Thu, 23 Mar 2023 02:02:48 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Thu, 23 Mar 2023 02:02:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:feedback-id :feedback-id:from:from:in-reply-to:message-id:reply-to:sender :subject:subject:to:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; t=1679551368; x=1679637768; bh=Y huEjAxKe5DSpWbcQtZChqj8VvtOc3qtdr+kNcEXltE=; b=SpbbEOe/KjGW0U2Vl 0X6m7HfWMeKhg0U/El6/KYl2/eyV9n3fg0ByWfk5c1eL/Q2iYdaVS6LgHMr2Omzs wjLv9o1WMdG+JAdSqcV9OYoK+Ol2x1wtsQSq2TBXzLKwmMRtGWtINyxEjJYjuxV+ rf1gS4YTeCCFy0qiHuYMzFwbMz+z9bbcmEdwSwSSz6cdoqpu8EjX1C/L8c02nyUW 9BjpzAHN0+zjtLE5e1l6eVScfvQdigyrSfvdeKASaFaR0bWHuhvNHbsi9XiMUS3p ii/zRBW7UZ5FfrPVPD5JUbW3uLHM0wZL3Snxb+QzSIORUCJN3tl//dgj+AsM8/aX QT+lw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrvdegfedgkeelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepvfevkffhufffsedttdertddttddtnecuhfhrohhmpefhihhnnhcuvfhhrghi nhcuoehfthhhrghinheslhhinhhugidqmheikehkrdhorhhgqeenucggtffrrghtthgvrh hnpeehfffggeefveegvedtiefffeevuedtgefhueehieetffejfefggeevfeeuvdduleen ucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehfthhhrg hinheslhhinhhugidqmheikehkrdhorhhg X-ME-Proxy: Feedback-ID: i58a146ae:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 23 Mar 2023 02:02:44 -0400 (EDT) To: Geert Uytterhoeven Cc: linux-m68k@lists.linux-m68k.org, linux-kernel@vger.kernel.org Message-Id: <5b7c473247d66776343d82a55b9815195b1b11fb.1679551394.git.fthain@linux-m68k.org> From: Finn Thain Subject: [PATCH v2] nubus: Don't list card resources by default Date: Thu, 23 Mar 2023 17:03:14 +1100 X-Spam-Status: No, score=-0.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS, SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Some Nubus cards have many ROM resources. A single Radius video card produced well over a thousand entries under /proc/bus/nubus/. Populating /proc/bus/nubus on a slow machine with several such cards installed takes long enough that the user may think that the system is wedged. All those procfs entries also consume significant RAM though they are not normally needed (except by developers). Omit these resources from /proc/bus/nubus/ by default and add a kernel parameter to enable them when needed. On the test machine, this saved 300 kB and 10 seconds. Tested-by: Stan Johnson Signed-off-by: Finn Thain --- Checkpatch says "externs should be avoided in .c files" and if this one appeared twice I would agree. But as it only appears once, I can't see any advantage to putting it in a new .h file instead of the .c file... --- drivers/nubus/nubus.c | 7 ++++++- drivers/nubus/proc.c | 10 ++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/nubus/nubus.c b/drivers/nubus/nubus.c index f70ba58dbc55..925aec257e1b 100644 --- a/drivers/nubus/nubus.c +++ b/drivers/nubus/nubus.c @@ -34,6 +34,9 @@ LIST_HEAD(nubus_func_rsrcs); +bool procfs_rsrcs; +module_param(procfs_rsrcs, bool, 0444); + /* Meaning of "bytelanes": The card ROM may appear on any or all bytes of each long word in @@ -574,7 +577,9 @@ nubus_get_functional_resource(struct nubus_board *board, int slot, default: /* Local/Private resources have their own function */ - nubus_get_private_resource(fres, dir.procdir, &ent); + if (procfs_rsrcs) + nubus_get_private_resource(fres, dir.procdir, + &ent); } } diff --git a/drivers/nubus/proc.c b/drivers/nubus/proc.c index 2c320a84fd72..844e86636798 100644 --- a/drivers/nubus/proc.c +++ b/drivers/nubus/proc.c @@ -51,11 +51,13 @@ static struct proc_dir_entry *proc_bus_nubus_dir; * /proc/bus/nubus/x/ stuff */ +extern bool procfs_rsrcs; + struct proc_dir_entry *nubus_proc_add_board(struct nubus_board *board) { char name[2]; - if (!proc_bus_nubus_dir) + if (!proc_bus_nubus_dir || !procfs_rsrcs) return NULL; snprintf(name, sizeof(name), "%x", board->slot); return proc_mkdir(name, proc_bus_nubus_dir); @@ -72,7 +74,7 @@ struct proc_dir_entry *nubus_proc_add_rsrc_dir(struct proc_dir_entry *procdir, char name[9]; int lanes = board->lanes; - if (!procdir) + if (!procdir || !procfs_rsrcs) return NULL; snprintf(name, sizeof(name), "%x", ent->type); remove_proc_subtree(name, procdir); @@ -157,7 +159,7 @@ void nubus_proc_add_rsrc_mem(struct proc_dir_entry *procdir, char name[9]; struct nubus_proc_pde_data *pded; - if (!procdir) + if (!procdir || !procfs_rsrcs) return; snprintf(name, sizeof(name), "%x", ent->type); @@ -176,7 +178,7 @@ void nubus_proc_add_rsrc(struct proc_dir_entry *procdir, char name[9]; unsigned char *data = (unsigned char *)ent->data; - if (!procdir) + if (!procdir || !procfs_rsrcs) return; snprintf(name, sizeof(name), "%x", ent->type); -- 2.37.5