From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1254E156D0; Wed, 21 Jun 2023 13:43:58 +0000 (UTC) Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1DEC9E6E; Wed, 21 Jun 2023 06:43:56 -0700 (PDT) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20230621134353euoutp02d57583f1260e1c228507969bf2dd64df~qsHaHGgl22310523105euoutp02y; Wed, 21 Jun 2023 13:43:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20230621134353euoutp02d57583f1260e1c228507969bf2dd64df~qsHaHGgl22310523105euoutp02y 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= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20230621134353eucas1p1dcc5fd6f5a9f46b250ca7cb322bfcb62~qsHZwC8jc0795907959eucas1p1j; Wed, 21 Jun 2023 13:43:53 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 7F.CE.42423.89EF2946; Wed, 21 Jun 2023 14:43:52 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20230621134351eucas1p2f16d6185751b35072bbf7492517dd17b~qsHYhPi3_0645106451eucas1p2x; Wed, 21 Jun 2023 13:43:51 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20230621134351eusmtrp12ede84df94c73be5d139021f7caaec4e~qsHYfbU5Z3178131781eusmtrp1O; Wed, 21 Jun 2023 13:43:51 +0000 (GMT) X-AuditID: cbfec7f2-a51ff7000002a5b7-2b-6492fe98f38e Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id B0.8C.10549.79EF2946; Wed, 21 Jun 2023 14:43:51 +0100 (BST) Received: from CAMSVWEXC02.scsc.local (unknown [106.1.227.72]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20230621134351eusmtip295329994762b412f6d02a3f47b794c24~qsHX0_Bhu0221102211eusmtip2V; Wed, 21 Jun 2023 13:43:51 +0000 (GMT) Received: from localhost (106.210.248.248) by CAMSVWEXC02.scsc.local (2002:6a01:e348::6a01:e348) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 21 Jun 2023 14:43:50 +0100 Date: Wed, 21 Jun 2023 15:43:48 +0200 From: Joel Granados To: Jani Nikula CC: , Russell King , Catalin Marinas , Will Deacon , Michael Ellerman , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Gerald Schaefer , Andy Lutomirski , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , , Herbert Xu , "David S. Miller" , Russ Weight , Greg Kroah-Hartman , Phillip Potter , Clemens Ladisch , Arnd Bergmann , Corey Minyard , Theodore Ts'o , "Jason A. Donenfeld" , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , David Airlie , Daniel Vetter , "K. Y. Srinivasan" , Haiyang Zhang , Wei Liu , Dexuan Cui , Jason Gunthorpe , Leon Romanovsky , Benjamin Herrenschmidt , Song Liu , Robin Holt , Steve Wahl , David Ahern , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Sudip Mukherjee , Mark Rutland , "James E.J. Bottomley" , "Martin K. Petersen" , Doug Gilbert , Jiri Slaby , Juergen Gross , Stefano Stabellini , Alexander Viro , Christian Brauner , Benjamin LaHaise , David Howells , Jan Harkes , , Trond Myklebust , Anna Schumaker , Chuck Lever , Jeff Layton , Jan Kara , Anton Altaparmakov , Mark Fasheh , Joel Becker , Joseph Qi , Kees Cook , Iurii Zaikin , Eric Biggers , "Darrick J. Wong" , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Balbir Singh , Eric Biederman , "Naveen N. Rao" , Anil S Keshavamurthy , Masami Hiramatsu , Peter Zijlstra , Petr Mladek , Sergey Senozhatsky , Juri Lelli , Vincent Guittot , John Stultz , Steven Rostedt , Andrew Morton , Mike Kravetz , Muchun Song , Naoya Horiguchi , "Matthew Wilcox (Oracle)" , Joerg Reuter , Ralf Baechle , Pablo Neira Ayuso , Jozsef Kadlecsik , Florian Westphal , Roopa Prabhu , Nikolay Aleksandrov , Alexander Aring , Stefan Schmidt , Miquel Raynal , Steffen Klassert , Matthieu Baerts , Mat Martineau , Simon Horman , Julian Anastasov , Remi Denis-Courmont , Santosh Shilimkar , Marc Dionne , Neil Horman , Marcelo Ricardo Leitner , Xin Long , Karsten Graul , Wenjia Zhang , Jan Karcher , Jon Maloy , Ying Xue , Martin Schiller , John Johansen , Paul Moore , James Morris , "Serge E. Hallyn" , Jarkko Sakkinen , Nicholas Piggin , Christophe Leroy , Christian Borntraeger , Sven Schnelle , "H. Peter Anvin" , "Rafael J. Wysocki" , Mike Travis , Oleksandr Tyshchenko , Amir Goldstein , Matthew Bobrowski , John Fastabend , Martin KaFai Lau , Yonghong Song , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Waiman Long , Boqun Feng , John Ogness , Dietmar Eggemann , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Valentin Schneider , Andy Lutomirski , Will Drewry , Stephen Boyd , Miaohe Lin , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: Re: [PATCH 09/11] sysctl: Remove the end element in sysctl table arrays Message-ID: <20230621134348.rcdzl7fi7yq2uj6h@localhost> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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> X-Originating-IP: [106.210.248.248] X-ClientProxiedBy: CAMSVWEXC01.scsc.local (2002:6a01:e347::6a01:e347) To CAMSVWEXC02.scsc.local (2002:6a01:e348::6a01:e348) X-Brightmail-Tracker: H4sIAAAAAAAAA2WTa1ATZxSG59tddkM0do1Yv8HbCFItAi0dW45t6Vir7eroTMsPW53xEmVB WxKUiEV7SyUUBNSAg5GgyCVGI1cxRC4DakAQUISKAl4KQrCKmqhAFFEocbF1pv+e77zve+Y9 Pz4RKdWI3EWbFdv4CIUszIMWU+aawcu+B4eTg9/v6v8YLKoAKL97g4KY0hEK+gdvMNBXXUvD /aonCA7du8iA3ZCIQH/hNgGO3DYCyvNtBLwsjSVhxJxEwt3C2FHfZTUFleoiBLZdQxT0aIpJ uGKdAC0Ddhryy2KIUa+agZ6aLgZ2d43QYI9eC006hwtEZxfQYKk9w0BC7zSILh5AcODkFEjT nCIgTRtNQPKgBkHnVXfIajMTcKj9A7AdngaDhhMM1DU6KMgvyCZgV8lxAi70x9BgbjmCoCKT AKPhGQODe8dBavzoFvuBNAJ2Pz1KgabeHx7r6xm4dvoWASlJj2h4FGdzgaazDS4Qe6QMwR3L HgoSWktouLnfQEHZixIGLCkVCHLyVKOF+7rJhTKu48FListNz0XclWvN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uDyhJ2SlaszpcFLYmYnV4xJpQwVL+J8lZYi9qtziFTWTZ ZFb2bw7jzfNJx14rj+b39kWHUfmOwWfLtqZtKGyK2bbxHWnDzMXEzE11On/O05KqRCx0eeQB ZXP9l2Oxm6vaskb2ZSyMexRZNmPSKg853/dTHrlq74oZ1dbtutUbW5zNDRgwtK/aMCeub7d2 bKwONvM+1G1eqf0mkPatXcCUSFZsbeHXLo61Zx+q2h83zbdEPezeVZ4xaFI1bHkQ/ldfiGVs 27vOj5fs32LjHLm7zP/rLzhj7UFXZj/1zzhlL8hv/Oin7G8XKy/c//7UxX1nkjQamyC49Yq+ QFauN43qo1dszxO9GT/Sn39wSUJRaWxkSaC5O+as/fHWxEnbAi8/UbI5IumrxDv6hNwd00Jm SEDI94hFAbhMLv4bHgGuKMgEAAA= X-CMS-MailID: 20230621134351eucas1p2f16d6185751b35072bbf7492517dd17b X-Msg-Generator: CA X-RootMTR: 20230621094824eucas1p2b6adfbd3f15ff3665674917f419b25d3 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20230621094824eucas1p2b6adfbd3f15ff3665674917f419b25d3 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> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net --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--