[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 09/11] sysctl: Remove the end element in sysctl table arrays
- To: Joel Granados <j.granados@xxxxxxxxxxx>
- From: Jani Nikula <jani.nikula@xxxxxxxxxxxxxxx>
- Date: Wed, 21 Jun 2023 16:15:46 +0300
- Cc: mcgrof@xxxxxxxxxx, Russell King <linux@xxxxxxxxxxxxxxx>, Catalin Marinas <catalin.marinas@xxxxxxx>, Will Deacon <will@xxxxxxxxxx>, Michael Ellerman <mpe@xxxxxxxxxxxxxx>, Heiko Carstens <hca@xxxxxxxxxxxxx>, Vasily Gorbik <gor@xxxxxxxxxxxxx>, Alexander Gordeev <agordeev@xxxxxxxxxxxxx>, Gerald Schaefer <gerald.schaefer@xxxxxxxxxxxxx>, Andy Lutomirski <luto@xxxxxxxxxx>, Thomas Gleixner <tglx@xxxxxxxxxxxxx>, Ingo Molnar <mingo@xxxxxxxxxx>, Borislav Petkov <bp@xxxxxxxxx>, Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>, x86@xxxxxxxxxx, Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>, "David S. Miller" <davem@xxxxxxxxxxxxx>, Russ Weight <russell.h.weight@xxxxxxxxx>, Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>, Phillip Potter <phil@xxxxxxxxxxxxxxxx>, Clemens Ladisch <clemens@xxxxxxxxxx>, Arnd Bergmann <arnd@xxxxxxxx>, Corey Minyard <minyard@xxxxxxx>, Theodore Ts'o <tytso@xxxxxxx>, "Jason A. Donenfeld" <Jason@xxxxxxxxx>, Joonas Lahtinen <joonas.lahtinen@xxxxxxxxxxxxxxx>, Rodrigo Vivi <rodrigo.vivi@xxxxxxxxx>, Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxxxxxxxx>, David Airlie <airlied@xxxxxxxxx>, Daniel Vetter <daniel@xxxxxxxx>, "K. Y. Srinivasan" <kys@xxxxxxxxxxxxx>, Haiyang Zhang <haiyangz@xxxxxxxxxxxxx>, Wei Liu <wei.liu@xxxxxxxxxx>, Dexuan Cui <decui@xxxxxxxxxxxxx>, Jason Gunthorpe <jgg@xxxxxxxx>, Leon Romanovsky <leon@xxxxxxxxxx>, Benjamin Herrenschmidt <benh@xxxxxxxxxxxxxxxxxxx>, Song Liu <song@xxxxxxxxxx>, Robin Holt <robinmholt@xxxxxxxxx>, Steve Wahl <steve.wahl@xxxxxxx>, David Ahern <dsahern@xxxxxxxxxx>, Eric Dumazet <edumazet@xxxxxxxxxx>, Jakub Kicinski <kuba@xxxxxxxxxx>, Paolo Abeni <pabeni@xxxxxxxxxx>, Sudip Mukherjee <sudipm.mukherjee@xxxxxxxxx>, Mark Rutland <mark.rutland@xxxxxxx>, "James E.J. Bottomley" <jejb@xxxxxxxxxxxxx>, "Martin K. Petersen" <martin.petersen@xxxxxxxxxx>, Doug Gilbert <dgilbert@xxxxxxxxxxxx>, Jiri Slaby <jirislaby@xxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Alexander Viro <viro@xxxxxxxxxxxxxxxxxx>, Christian Brauner <brauner@xxxxxxxxxx>, Benjamin LaHaise <bcrl@xxxxxxxxx>, David Howells <dhowells@xxxxxxxxxx>, Jan Harkes <jaharkes@xxxxxxxxxx>, coda@xxxxxxxxxx, Trond Myklebust <trond.myklebust@xxxxxxxxxxxxxxx>, Anna Schumaker <anna@xxxxxxxxxx>, Chuck Lever <chuck.lever@xxxxxxxxxx>, Jeff Layton <jlayton@xxxxxxxxxx>, Jan Kara <jack@xxxxxxx>, Anton Altaparmakov <anton@xxxxxxxxxx>, Mark Fasheh <mark@xxxxxxxxxx>, Joel Becker <jlbec@xxxxxxxxxxxx>, Joseph Qi <joseph.qi@xxxxxxxxxxxxxxxxx>, Kees Cook <keescook@xxxxxxxxxxxx>, Iurii Zaikin <yzaikin@xxxxxxxxxx>, Eric Biggers <ebiggers@xxxxxxxxxx>, "Darrick J. Wong" <djwong@xxxxxxxxxx>, Alexei Starovoitov <ast@xxxxxxxxxx>, Daniel Borkmann <daniel@xxxxxxxxxxxxx>, Andrii Nakryiko <andrii@xxxxxxxxxx>, Balbir Singh <bsingharora@xxxxxxxxx>, Eric Biederman <ebiederm@xxxxxxxxxxxx>, "Naveen N. Rao" <naveen.n.rao@xxxxxxxxxxxxx>, Anil S Keshavamurthy <anil.s.keshavamurthy@xxxxxxxxx>, Masami Hiramatsu <mhiramat@xxxxxxxxxx>, Peter Zijlstra <peterz@xxxxxxxxxxxxx>, Petr Mladek <pmladek@xxxxxxxx>, Sergey Senozhatsky <senozhatsky@xxxxxxxxxxxx>, Juri Lelli <juri.lelli@xxxxxxxxxx>, Vincent Guittot <vincent.guittot@xxxxxxxxxx>, John Stultz <jstultz@xxxxxxxxxx>, Steven Rostedt <rostedt@xxxxxxxxxxx>, Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>, Mike Kravetz <mike.kravetz@xxxxxxxxxx>, Muchun Song <muchun.song@xxxxxxxxx>, Naoya Horiguchi <naoya.horiguchi@xxxxxxx>, "Matthew Wilcox (Oracle)" <willy@xxxxxxxxxxxxx>, Joerg Reuter <jreuter@xxxxxxxx>, Ralf Baechle <ralf@xxxxxxxxxxxxxx>, Pablo Neira Ayuso <pablo@xxxxxxxxxxxxx>, Jozsef Kadlecsik <kadlec@xxxxxxxxxxxxx>, Florian Westphal <fw@xxxxxxxxx>, Roopa Prabhu <roopa@xxxxxxxxxx>, Nikolay Aleksandrov <razor@xxxxxxxxxxxxx>, Alexander Aring <alex.aring@xxxxxxxxx>, Stefan Schmidt <stefan@xxxxxxxxxxxxxxxxxx>, Miquel Raynal <miquel.raynal@xxxxxxxxxxx>, Steffen Klassert <steffen.klassert@xxxxxxxxxxx>, Matthieu Baerts <matthieu.baerts@xxxxxxxxxxxx>, Mat Martineau <martineau@xxxxxxxxxx>, Simon Horman <horms@xxxxxxxxxxxx>, Julian Anastasov <ja@xxxxxx>, Remi Denis-Courmont <courmisch@xxxxxxxxx>, Santosh Shilimkar <santosh.shilimkar@xxxxxxxxxx>, Marc Dionne <marc.dionne@xxxxxxxxxxxx>, Neil Horman <nhorman@xxxxxxxxxxxxx>, Marcelo Ricardo Leitner <marcelo.leitner@xxxxxxxxx>, Xin Long <lucien.xin@xxxxxxxxx>, Karsten Graul <kgraul@xxxxxxxxxxxxx>, Wenjia Zhang <wenjia@xxxxxxxxxxxxx>, Jan Karcher <jaka@xxxxxxxxxxxxx>, Jon Maloy <jmaloy@xxxxxxxxxx>, Ying Xue <ying.xue@xxxxxxxxxxxxx>, Martin Schiller <ms@xxxxxxxxxx>, John Johansen <john.johansen@xxxxxxxxxxxxx>, Paul Moore <paul@xxxxxxxxxxxxxx>, James Morris <jmorris@xxxxxxxxx>, "Serge E. Hallyn" <serge@xxxxxxxxxx>, Jarkko Sakkinen <jarkko@xxxxxxxxxx>, Nicholas Piggin <npiggin@xxxxxxxxx>, Christophe Leroy <christophe.leroy@xxxxxxxxxx>, Christian Borntraeger <borntraeger@xxxxxxxxxxxxx>, Sven Schnelle <svens@xxxxxxxxxxxxx>, "H. Peter Anvin" <hpa@xxxxxxxxx>, "Rafael J. Wysocki" <rafael@xxxxxxxxxx>, Mike Travis <mike.travis@xxxxxxx>, Oleksandr Tyshchenko <oleksandr_tyshchenko@xxxxxxxx>, Amir Goldstein <amir73il@xxxxxxxxx>, Matthew Bobrowski <repnop@xxxxxxxxxx>, John Fastabend <john.fastabend@xxxxxxxxx>, Martin KaFai Lau <martin.lau@xxxxxxxxx>, Yonghong Song <yhs@xxxxxx>, KP Singh <kpsingh@xxxxxxxxxx>, Stanislav Fomichev <sdf@xxxxxxxxxx>, Hao Luo <haoluo@xxxxxxxxxx>, Jiri Olsa <jolsa@xxxxxxxxxx>, Waiman Long <longman@xxxxxxxxxx>, Boqun Feng <boqun.feng@xxxxxxxxx>, John Ogness <john.ogness@xxxxxxxxxxxxx>, Dietmar Eggemann <dietmar.eggemann@xxxxxxx>, Ben Segall <bsegall@xxxxxxxxxx>, Mel Gorman <mgorman@xxxxxxx>, Daniel Bristot de Oliveira <bristot@xxxxxxxxxx>, Valentin Schneider <vschneid@xxxxxxxxxx>, Andy Lutomirski <luto@xxxxxxxxxxxxxx>, Will Drewry <wad@xxxxxxxxxxxx>, Stephen Boyd <sboyd@xxxxxxxxxx>, Miaohe Lin <linmiaohe@xxxxxxxxxx>, linux-arm-kernel@xxxxxxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, linux-ia64@xxxxxxxxxxxxxxx, linuxppc-dev@xxxxxxxxxxxxxxxx, linux-s390@xxxxxxxxxxxxxxx, linux-crypto@xxxxxxxxxxxxxxx, openipmi-developer@xxxxxxxxxxxxxxxxxxxxx, intel-gfx@xxxxxxxxxxxxxxxxxxxxx, dri-devel@xxxxxxxxxxxxxxxxxxxxx, linux-hyperv@xxxxxxxxxxxxxxx, linux-rdma@xxxxxxxxxxxxxxx, linux-raid@xxxxxxxxxxxxxxx, netdev@xxxxxxxxxxxxxxx, linux-scsi@xxxxxxxxxxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxxx, linux-fsdevel@xxxxxxxxxxxxxxx, linux-aio@xxxxxxxxx, linux-cachefs@xxxxxxxxxx, codalist@xxxxxxxxxxxxxxxxxxxxxxxx, linux-mm@xxxxxxxxx, linux-nfs@xxxxxxxxxxxxxxx, linux-ntfs-dev@xxxxxxxxxxxxxxxxxxxxx, ocfs2-devel@xxxxxxxxxxxxxx, fsverity@xxxxxxxxxxxxxxx, linux-xfs@xxxxxxxxxxxxxxx, bpf@xxxxxxxxxxxxxxx, kexec@xxxxxxxxxxxxxxxxxxx, linux-trace-kernel@xxxxxxxxxxxxxxx, linux-hams@xxxxxxxxxxxxxxx, netfilter-devel@xxxxxxxxxxxxxxx, coreteam@xxxxxxxxxxxxx, bridge@xxxxxxxxxxxxxxxxxxxxxxxxxx, dccp@xxxxxxxxxxxxxxx, linux-wpan@xxxxxxxxxxxxxxx, mptcp@xxxxxxxxxxxxxxx, lvs-devel@xxxxxxxxxxxxxxx, rds-devel@xxxxxxxxxxxxxx, linux-afs@xxxxxxxxxxxxxxxxxxx, linux-sctp@xxxxxxxxxxxxxxx, tipc-discussion@xxxxxxxxxxxxxxxxxxxxx, linux-x25@xxxxxxxxxxxxxxx, apparmor@xxxxxxxxxxxxxxxx, linux-security-module@xxxxxxxxxxxxxxx, keyrings@xxxxxxxxxxxxxxx
- Delivery-date: Wed, 21 Jun 2023 13:18:33 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On Wed, 21 Jun 2023, Joel Granados <j.granados@xxxxxxxxxxx> wrote:
> On Wed, Jun 21, 2023 at 02:16:55PM +0300, Jani Nikula wrote:
>> On Wed, 21 Jun 2023, Joel Granados <j.granados@xxxxxxxxxxx> 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
|