From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 41A20EB64D7 for ; Wed, 21 Jun 2023 18:43:31 +0000 (UTC) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=QGWZ+FFA; dkim-atps=neutral Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4QmXSx5KTLz3c1H for ; Thu, 22 Jun 2023 04:43:29 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=QGWZ+FFA; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=intel.com (client-ip=192.55.52.43; helo=mga05.intel.com; envelope-from=jani.nikula@intel.com; receiver=lists.ozlabs.org) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4QmPDn0HPyz30hJ for ; Wed, 21 Jun 2023 23:17:27 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1687353449; x=1718889449; h=from:to:cc:subject:in-reply-to:references:date: message-id:mime-version; bh=9eMWiG7JI6/9oPvFtdl/3iOGYIkGUexXwjKhm4v9hgQ=; b=QGWZ+FFAbcCUzPdvmLz5hfxXjnHJdsykuYtREUcqD+FfiRR/ZQeNEx/a pph2s9Kj6d1xT1JxL+4IZTuX29N7nwz45/QyM1Br9zdMhNPF3IFDOEcYH O+eOYSZ4pytvSTXeTHtN0WMsczBIingIUvQ4HftTm99ktfcK2ACBfmX+0 aIVvZL1N2slmGCT3Rc6cazDtLQeqx9Xrh+NvQ2AMghHLPlH/JZdY17aIC RoOJg58UGvx4ve/4KvdepEJknaAgXxY46weWp67Kc92gn3Xo/D05TUnIJ ednkWdbFldbLBiGQmmxClGkvARsycIL8gcookIWxudqYAl8dKZ2zos/dM Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10747"; a="446546924" X-IronPort-AV: E=Sophos;i="6.00,260,1681196400"; d="scan'208";a="446546924" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Jun 2023 06:16:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10747"; a="664658294" X-IronPort-AV: E=Sophos;i="6.00,260,1681196400"; d="scan'208";a="664658294" Received: from unknown (HELO localhost) ([10.237.66.162]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Jun 2023 06:15:49 -0700 From: Jani Nikula To: Joel Granados Subject: Re: [PATCH 09/11] sysctl: Remove the end element in sysctl table arrays In-Reply-To: <20230621130614.s36w4u7dzmb5d5p3@localhost> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo References: <20230621091000.424843-1-j.granados@samsung.com> <20230621094817.433842-1-j.granados@samsung.com> <87o7l92hg8.fsf@intel.com> <20230621130614.s36w4u7dzmb5d5p3@localhost> Date: Wed, 21 Jun 2023 16:15:46 +0300 Message-ID: <878rcd2by5.fsf@intel.com> MIME-Version: 1.0 Content-Type: text/plain X-Mailman-Approved-At: Thu, 22 Jun 2023 04:32:35 +1000 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Juri Lelli , Miaohe Lin , "Rafael J. Wysocki" , Catalin Marinas , dri-devel@lists.freedesktop.org, Ben Segall , linux-sctp@vger.kernel.org, ocfs2-devel@oss.oracle.com, Miquel Raynal , Alexander Gordeev , "K. Y. Srinivasan" , Stefan Schmidt , Wei Liu , Vincent Guittot , bridge@lists.linux-foundation.org, James Morris , Jozsef Kadlecsik , Eric Biggers , linux-cachefs@redhat.com, Mel Gorman , "Darrick J. Wong" , Waiman Long , Christian Borntraeger , Petr Mladek , Martin Schiller , Russ Weight , Tvrtko Ursulin , Boqun Feng , Nicholas Piggin , John Ogness , Alexander Viro , Andy Lutomirski , Remi Denis-Courmont , xen-devel@lists.xenproject.org, Thomas Gleixner , Trond Myklebust , Anton Altaparmakov , Christian Brauner , Will Drewry , Neil Horman , Greg Kroah-Hartman , linux-kernel@vger.kernel.org, Ralf Baechle , Sergey Senozhatsky , mcgrof@kernel.org, Chuck Lever , netfilter-devel@vger.kernel.org, Masami Hiramatsu , Jiri Olsa , linux-fsdevel@vger.kernel.org, Matthieu Baerts , Andrew Morton , linux-trace-kernel@vger.kernel.org, linux-wpan@vger.kernel.org, Mark Rutland , linux-aio@kvack.org, "Jason A. Donenfeld" , linux-ia64@vger.kernel.org, Naoya Horiguchi , Dave Hansen , Clemens Ladisch , Phillip Potter , Song Liu , Eric Dumazet , keyrings@vger.kernel.org, John Stultz , Stanislav Fomichev , Jan Karcher , codalist@telemann.coda.cs.cmu.edu, linux-s390@vger.kernel.org, Valentin Schneider , Stefano Stabellini , Corey Minyard , Leon Romanovsky , Oleksandr Tyshchenko , Will Deacon , John Fastabend , Andrii Nakryiko , Anil S Keshavamurthy , Mat Martineau , Matthew Bobrowski , Julian Anastasov , coreteam@netfilter.org, Roopa Prabhu , Yonghong Song , Iurii Zaikin , Sven Schnelle , Vasily Gorbik , Mike Travis , Wenjia Zhang , Simon Horman , Xin Long , linux-arm-kernel@lists.infradead.org, fsverity@lists.linux.dev, Hao Luo , Theodore Ts'o , Stephen Boyd , Muchun Song , Florian Westphal , Robin Holt , "David S. Miller" , Jon Maloy , Jarkko Sakkinen , Eric Biederman , Anna Schumaker , Daniel Bristot de Oliveira , Mike Kravetz , Marcelo Ricardo Leitner , linux-hams@vger.kernel.org, Nikolay Aleksandrov , Joonas Lahtinen , Alexei Starovoitov , Marc Dionne , Jiri Slaby , linux-afs@lists.infradead.org, Daniel Borkmann , linux-rdma@vger.kernel.org, Dexuan Cui , "Matthew Wilcox \(Oracle\)" , lvs-devel@vger.kernel.org, coda@cs.cmu.edu, Doug Gilbert , "Naveen N. Rao" , Gerald Schaefer , Paolo Abeni , Pablo Neira Ayuso , "Serge E. Hallyn" , Kees Cook , Arnd Bergmann , Haiyang Zhang , intel-gfx@lists.freedesktop.org, Steven Rostedt , linux-crypto@vger.kernel.org, Borislav Petkov , Rodrigo Vivi , openipmi-developer@lists.sourceforge.net, mptcp@lists.linux.dev, Jan Harkes , linux-nfs@vger.kernel.org, "Martin K. Petersen" , linux-mm@kvack.org, Jeff Layton , Andy Lutomirski , linux-xfs@vger.kernel.org, linux-ntfs-dev@lists.sourceforge.net, netdev@vger.kernel.org, Ying Xue , bpf@vger.kernel.org, Sudip Mukherjee , Dietmar Eggemann , Alexander Aring , Jan Kara , Steve Wahl , Peter Zijlstra , Amir Goldstein , KP Singh , David Howells , Joseph Qi , "H. Peter Anvin" , David Airlie , Steffen Klassert , rds-devel@oss.oracle.com, Herbert Xu , linux-scsi@vger.kernel.org, dccp@vger.kernel.org, Mark Fasheh , x86@kernel.org, Russell King , Jason Gunthorpe , Ingo Molnar , Jakub Kicinski , "James E.J. Bottomley" , Joerg Reuter , linux-hyperv@vger.kernel.org, Heiko Carstens , Santosh Shilimkar , apparmor@lists.ubuntu.com, linux-raid@vger.kernel.org, Paul Moore , Juergen Gross , John Johansen , linux-x25@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, David Ahern , kexec@lists.infradead.org, linux-security-module@vger.kernel.org, Benjamin LaHaise , tipc-discussion@lists.sourceforge.net, Daniel Vetter , Martin KaFai Lau , Karsten Graul , Joel Becker Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On Wed, 21 Jun 2023, Joel Granados wrote: > On Wed, Jun 21, 2023 at 02:16:55PM +0300, Jani Nikula wrote: >> On Wed, 21 Jun 2023, Joel Granados wrote: >> > Remove the empty end element from all the arrays that are passed to the >> > register sysctl calls. In some files this means reducing the explicit >> > array size by one. Also make sure that we are using the size in >> > ctl_table_header instead of evaluating the .procname element. >> >> Where's the harm in removing the end elements driver by driver? This is >> an unwieldy patch to handle. > > I totally agree. Its a big one!!! but I'm concerned of breaking bisectibility: > * I could for example separate all the removes into separate commits and > then have a final commit that removes the check for the empty element. > But this will leave the tree in a state where the for loop will have > undefined behavior when it looks for the empty end element. It might > or might not work (probably not :) until the final commit where I fix > that. > > * I could also change the logic that looks for the final element, > commit that first and then remove the empty element one commit per > driver after that. But then for all the arrays that still have an > empty element, there would again be undefined behavior as it would > think that the last element is valid (when it is really the sentinel). > > Any ideas on how to get around these? First add size to the register calls, and allow the last one to be sentinel but do not require the sentinel. Start removing sentinels, adjusting the size passed in. Once enough sentinels have been removed, add warning if the final entry is a sentinel. Never really remove the check? (But surely you can rework the logic to not count the number of elements up front, only while iterating.) BR, Jani. >> >> > diff --git a/drivers/gpu/drm/i915/i915_perf.c b/drivers/gpu/drm/i915/i915_perf.c >> > index f43950219ffc..e4d7372afb10 100644 >> > --- a/drivers/gpu/drm/i915/i915_perf.c >> > +++ b/drivers/gpu/drm/i915/i915_perf.c >> > @@ -4884,24 +4884,23 @@ int i915_perf_remove_config_ioctl(struct drm_device *dev, void *data, >> > >> > static struct ctl_table oa_table[] = { >> > { >> > - .procname = "perf_stream_paranoid", >> > - .data = &i915_perf_stream_paranoid, >> > - .maxlen = sizeof(i915_perf_stream_paranoid), >> > - .mode = 0644, >> > - .proc_handler = proc_dointvec_minmax, >> > - .extra1 = SYSCTL_ZERO, >> > - .extra2 = SYSCTL_ONE, >> > - }, >> > + .procname = "perf_stream_paranoid", >> > + .data = &i915_perf_stream_paranoid, >> > + .maxlen = sizeof(i915_perf_stream_paranoid), >> > + .mode = 0644, >> > + .proc_handler = proc_dointvec_minmax, >> > + .extra1 = SYSCTL_ZERO, >> > + .extra2 = SYSCTL_ONE, >> > + }, >> > { >> > - .procname = "oa_max_sample_rate", >> > - .data = &i915_oa_max_sample_rate, >> > - .maxlen = sizeof(i915_oa_max_sample_rate), >> > - .mode = 0644, >> > - .proc_handler = proc_dointvec_minmax, >> > - .extra1 = SYSCTL_ZERO, >> > - .extra2 = &oa_sample_rate_hard_limit, >> > - }, >> > - {} >> > + .procname = "oa_max_sample_rate", >> > + .data = &i915_oa_max_sample_rate, >> > + .maxlen = sizeof(i915_oa_max_sample_rate), >> > + .mode = 0644, >> > + .proc_handler = proc_dointvec_minmax, >> > + .extra1 = SYSCTL_ZERO, >> > + .extra2 = &oa_sample_rate_hard_limit, >> > + } >> > }; >> >> The existing indentation is off, but fixing it doesn't really belong in >> this patch. > > Agreed. But I actually was trying to fix something that checkpatch > flagged. I'll change these back (which will cause this patch to be > flagged). > > An alternative solution would be to fix the indentation as part of the > preparation patches. Tell me what you think. > > Thx > >> >> BR, >> Jani. >> >> >> -- >> Jani Nikula, Intel Open Source Graphics Center -- Jani Nikula, Intel Open Source Graphics Center