From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 3885C60A82 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 4AC6960A7D DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20230621134353euoutp018c6ff8dabdeed1eb9c37b5ba647c330d~qsHZ_CVub2580325803euoutp01E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1687355033; bh=SetH/myydi6dk+ldkx72EVQztsegim0VSf5FSMMJW28=; h=Date:From:To:CC:Subject:In-Reply-To:References:From; b=PTZBv1Kz5BEVObNa7leJ/yxGfQakTivesF5jb6tBj4a7mw0z2DwCV8KG/lz6Htp2A zjthU/P8T1sIWZ42nVHC5ArvGqiQK48scKj0Re/P/DwFQFC0M/FPQnfLTFYC/Ucswv L2oK3I/5AOGeZQ+wBCu+TIiCshDxA9TJNwfHFkfQ= Date: Wed, 21 Jun 2023 15:43:48 +0200 From: Joel Granados Message-ID: <20230621134348.rcdzl7fi7yq2uj6h@localhost> MIME-Version: 1.0 Content-Type: multipart/signed; micalg="pgp-sha512"; protocol="application/pgp-signature"; boundary="nwcq3i6cyedok5cv" Content-Disposition: inline In-Reply-To: <878rcd2by5.fsf@intel.com> References: <20230621091000.424843-1-j.granados@samsung.com> <20230621094817.433842-1-j.granados@samsung.com> <87o7l92hg8.fsf@intel.com> <20230621130614.s36w4u7dzmb5d5p3@localhost> <878rcd2by5.fsf@intel.com> Subject: Re: [Bridge] [PATCH 09/11] sysctl: Remove the end element in sysctl table arrays List-Id: Linux Ethernet Bridging List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jani Nikula 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 , Michael Ellerman , bridge@lists.linux-foundation.org, James Morris , Christophe Leroy , 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 , Benjamin Herrenschmidt , 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 , Balbir Singh , 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 --nwcq3i6cyedok5cv Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Jun 21, 2023 at 04:15:46PM +0300, Jani Nikula wrote: > 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. > >>=20 > >> 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 bisecti= bility: > > * 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? >=20 > First add size to the register calls, and allow the last one to be > sentinel but do not require the sentinel. >=20 > Start removing sentinels, adjusting the size passed in. This is a great idea! and I think I don't even have to adjust the size because if I change the logic to stop on the sentinel or the size; so when the sentinel is there, it will stop before the size. And when the sentinel is not there, it will stop on the correct size. There might be issues with indirection calls. And there might also be lots of places where I need to adjust a for loop (as dan has pointed out) but its worth a try for V2. Best >=20 > Once enough sentinels have been removed, add warning if the final entry > is a sentinel. >=20 > Never really remove the check? (But surely you can rework the logic to > not count the number of elements up front, only while iterating.) >=20 >=20 > BR, > Jani. >=20 > >>=20 > >> > 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, > >> > =20 > >> > static struct ctl_table oa_table[] =3D { > >> > { > >> > - .procname =3D "perf_stream_paranoid", > >> > - .data =3D &i915_perf_stream_paranoid, > >> > - .maxlen =3D sizeof(i915_perf_stream_paranoid), > >> > - .mode =3D 0644, > >> > - .proc_handler =3D proc_dointvec_minmax, > >> > - .extra1 =3D SYSCTL_ZERO, > >> > - .extra2 =3D SYSCTL_ONE, > >> > - }, > >> > + .procname =3D "perf_stream_paranoid", > >> > + .data =3D &i915_perf_stream_paranoid, > >> > + .maxlen =3D sizeof(i915_perf_stream_paranoid), > >> > + .mode =3D 0644, > >> > + .proc_handler =3D proc_dointvec_minmax, > >> > + .extra1 =3D SYSCTL_ZERO, > >> > + .extra2 =3D SYSCTL_ONE, > >> > + }, > >> > { > >> > - .procname =3D "oa_max_sample_rate", > >> > - .data =3D &i915_oa_max_sample_rate, > >> > - .maxlen =3D sizeof(i915_oa_max_sample_rate), > >> > - .mode =3D 0644, > >> > - .proc_handler =3D proc_dointvec_minmax, > >> > - .extra1 =3D SYSCTL_ZERO, > >> > - .extra2 =3D &oa_sample_rate_hard_limit, > >> > - }, > >> > - {} > >> > + .procname =3D "oa_max_sample_rate", > >> > + .data =3D &i915_oa_max_sample_rate, > >> > + .maxlen =3D sizeof(i915_oa_max_sample_rate), > >> > + .mode =3D 0644, > >> > + .proc_handler =3D proc_dointvec_minmax, > >> > + .extra1 =3D SYSCTL_ZERO, > >> > + .extra2 =3D &oa_sample_rate_hard_limit, > >> > + } > >> > }; > >>=20 > >> 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 > > > >>=20 > >> BR, > >> Jani. > >>=20 > >>=20 > >> --=20 > >> Jani Nikula, Intel Open Source Graphics Center >=20 > --=20 > Jani Nikula, Intel Open Source Graphics Center --=20 Joel Granados --nwcq3i6cyedok5cv Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEErkcJVyXmMSXOyyeQupfNUreWQU8FAmSS/pIACgkQupfNUreW QU8FZgv+NJjIGObr29DU3w9gC84AcnW6dJTp9wHS00NxSXpo+c714JQ2xV0z8i/m wZbyBR21D/CkjJCTL0pwjCh1xi+PdMHmpB9mDlQSxEg6i+fJXBb7GvWvkOfNagP8 Z2t/NzP/RPP+/BjBP3QOGNyQWgZ4Jl6lMvzlt0aJlHMx7/QD7PRgnNN3KYiFzB+I FTf5QLbTT85TSPPoGBQCzF6Ych5vKNmIzRZxD2o1zPJFftGIcYOfYOC7vX/1tuOa 1l2+maHSi22uTAHFL3XKvcQBxuLeBCoAIgYOGeO0B+wApLgDVUdHb3PPMw74sOuD RtgKG6gEgO937g+zKo5xP6M5iLH8xYavJRYPNGH5FBfL7DDROXI6t9tjBpvpUbPS VQDducT3r8p7hbIhb+3MnRgJri1yF7SjRZF6iewJ9G3Rd7o8PlcLC3aTZLvilO9j 4YYKID1bOqsI9tcLY5oeM6HROqdmLhzFQQlzZCCz4Y/1XVO7ZKpJHP97wqBETkbq DRVhBHDj =lxdq -----END PGP SIGNATURE----- --nwcq3i6cyedok5cv--