Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1213583rwl; Sat, 25 Mar 2023 20:53:21 -0700 (PDT) X-Google-Smtp-Source: AKy350ZCDZGyS01W87vVMF6dgfeXym5NLW62SQMR0NmtKdNW63g4UJwBP2wMg548zv0vohAKqTsJ X-Received: by 2002:aa7:9821:0:b0:627:e69c:8488 with SMTP id q1-20020aa79821000000b00627e69c8488mr7584272pfl.14.1679802801052; Sat, 25 Mar 2023 20:53:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679802801; cv=none; d=google.com; s=arc-20160816; b=IbBAl3nEiC0e+AnvCZpj9HO3XVChKGz71n1jcaCZYkH72SlSu0jqNA+qee6BSppuVi kiAmFjI5j1JErbLco0p4zQBhcouMK2mR40vwPREPVURWuciRi5vjhGU3h7+oWIyTgjJq X6IK+zxwLSU2VAK7hUoiI7UFJ3k1U7/CQdROFQs92h2FW1EZ7cvNFbokfd2SJOamS6UW ttTmId5uzrchPWdm04PkuT+ytFANUqqP7Nk5tRnco1BjjICpn4V1CK7uGxQ9AJZsRn/d FwnHikC+sfDjyWcpIk3pgU5d4Fx495gJOq0+RVjaGrNsSnSNEaORZsf3GiCwnIaAp3/N oOPA== 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=qq1ZKMz/iBR+IZ3gektncVGgPKUeoeZtWWTf8ymo2A4=; b=gSluISDkOYgYvTYOCY0zMbUnZeM3tfaqwCMhstO5OB18Roh2ttV0sK7IZQ7xElFZgS qCjhsQaqhmsvnU/X3vyFalDPjUpQatkgMAzaHFAMhrEcSRicA0YE/MW5H0xyHAIRNe0U 9NSpVHbuJpp4yEdaX5iNoqIXQe/PSDKSUjbT2Tue9E64YGiACC+kQ1PZyKHW4fFigN0x +zQyyES3cEau1Un3XRaCFoaFP7jY8gCBk+xN7Phup0p6nwa9ubW6kM7ay1sozoKcsabW 1eGlnIooU9eVgSU8lDAIFvXrQcddrh9Jj26KnSmNRhy7f2OF14RkW3mVkxfCP0ULHckJ Y24w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=aYO5+GLF; 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 g21-20020a056a00079500b0059248a91d9bsi19533542pfu.127.2023.03.25.20.53.07; Sat, 25 Mar 2023 20:53:21 -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=aYO5+GLF; 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 S231443AbjCZDjD (ORCPT + 99 others); Sat, 25 Mar 2023 23:39:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46758 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231642AbjCZDjA (ORCPT ); Sat, 25 Mar 2023 23:39:00 -0400 Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9432F6590 for ; Sat, 25 Mar 2023 20:38:58 -0700 (PDT) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id F34775C011B; Sat, 25 Mar 2023 23:38:57 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Sat, 25 Mar 2023 23:38:57 -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=1679801937; x=1679888337; bh=q q1ZKMz/iBR+IZ3gektncVGgPKUeoeZtWWTf8ymo2A4=; b=aYO5+GLF8hzOdVT8j I+Lzzd+rtO/UfggkJnMSSKmjQKWFYHaapikdJIihqD+hiNRNH7WWizVRXarP7mgg YpPfxXpKgmWsh1dxdUdazR/hjSq+Kln22/XgDzVWIwVVCbF3OgjMl7RsmsdjWvwq AEMSEP0r4kSrdnNgitynJplgmvoRrozqrKKBrE7d85AcTfbyWujvS92b40b5dJyN bvaVrWbCy/PU+2bSb4CLao1HDM9oVVelckNe5lHmBSe5XVFcBfcPud36mbdCbkdL wAOtJ5oDq8ZuSXjYtrkPR7vygADxkS52aTLH9iU/uXgJ9v5KLRBkq8IxXrZKGL+p b7f5A== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrvdegledgiedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepvfevkffhufffsedttdertddttddtnecuhfhrohhmpefhihhnnhcuvfhhrghi nhcuoehfthhhrghinheslhhinhhugidqmheikehkrdhorhhgqeenucggtffrrghtthgvrh hnpeehfffggeefveegvedtiefffeevuedtgefhueehieetffejfefggeevfeeuvdduleen ucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehfthhhrg hinheslhhinhhugidqmheikehkrdhorhhg X-ME-Proxy: Feedback-ID: i58a146ae:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 25 Mar 2023 23:38:54 -0400 (EDT) To: Geert Uytterhoeven Cc: "Brad Boyer" , linux-m68k@lists.linux-m68k.org, linux-kernel@vger.kernel.org Message-Id: <62e815b947d6d602def8294040529db80278c561.1679801822.git.fthain@linux-m68k.org> From: Finn Thain Subject: [RFC PATCH v3] nubus: Don't list slot resources by default Date: Sun, 26 Mar 2023 14:37:02 +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 card ROMs contain many slot 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. Cc: Brad Boyer Tested-by: Stan Johnson Signed-off-by: Finn Thain --- drivers/nubus/nubus.c | 12 +++++++++--- drivers/nubus/proc.c | 8 ++++---- include/linux/nubus.h | 1 + 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/drivers/nubus/nubus.c b/drivers/nubus/nubus.c index f70ba58dbc55..d2d2b580f646 100644 --- a/drivers/nubus/nubus.c +++ b/drivers/nubus/nubus.c @@ -32,6 +32,12 @@ /* Globals */ +/* This parameter makes slot resources available in procfs. It's deprecated and + * disabled by default as procfs is no longer thought to be suitable for that. + */ +bool populate_procfs; +module_param(populate_procfs, bool, 0); + LIST_HEAD(nubus_func_rsrcs); /* Meaning of "bytelanes": @@ -572,9 +578,9 @@ nubus_get_functional_resource(struct nubus_board *board, int slot, nubus_proc_add_rsrc(dir.procdir, &ent); break; default: - /* Local/Private resources have their own - function */ - nubus_get_private_resource(fres, dir.procdir, &ent); + if (populate_procfs) + nubus_get_private_resource(fres, dir.procdir, + &ent); } } diff --git a/drivers/nubus/proc.c b/drivers/nubus/proc.c index 2c320a84fd72..1808accb8214 100644 --- a/drivers/nubus/proc.c +++ b/drivers/nubus/proc.c @@ -55,7 +55,7 @@ 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 || !populate_procfs) return NULL; snprintf(name, sizeof(name), "%x", board->slot); return proc_mkdir(name, proc_bus_nubus_dir); @@ -72,7 +72,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 || !populate_procfs) return NULL; snprintf(name, sizeof(name), "%x", ent->type); remove_proc_subtree(name, procdir); @@ -157,7 +157,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 || !populate_procfs) return; snprintf(name, sizeof(name), "%x", ent->type); @@ -176,7 +176,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 || !populate_procfs) return; snprintf(name, sizeof(name), "%x", ent->type); diff --git a/include/linux/nubus.h b/include/linux/nubus.h index 392fc6c53e96..50c9145808d1 100644 --- a/include/linux/nubus.h +++ b/include/linux/nubus.h @@ -93,6 +93,7 @@ extern struct bus_type nubus_bus_type; /* Generic NuBus interface functions, modelled after the PCI interface */ #ifdef CONFIG_PROC_FS +extern bool populate_procfs; void nubus_proc_init(void); struct proc_dir_entry *nubus_proc_add_board(struct nubus_board *board); struct proc_dir_entry *nubus_proc_add_rsrc_dir(struct proc_dir_entry *procdir, -- 2.37.5