lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=whqX8r3EaaO48dgi=wEBZxJETg1m67HrScRbH1FK7GTRw@mail.gmail.com>
Date:   Mon, 17 Jul 2023 11:09:56 -0700
From:   Linus Torvalds <torvalds@...ux-foundation.org>
To:     "Paul E. McKenney" <paulmck@...nel.org>
Cc:     rcu@...r.kernel.org, linux-kernel@...r.kernel.org,
        kernel-team@...a.com, rostedt@...dmis.org,
        atthias Brugger <matthias.bgg@...il.com>,
        "Rafael J. Wysocki" <rafael.j.wysocki@...el.com>,
        Michał Mirosław <mirq-linux@...e.qmqm.pl>,
        Dmitry Osipenko <dmitry.osipenko@...labora.com>,
        Sachin Sant <sachinp@...ux.ibm.com>,
        Joel Fernandes <joel@...lfernandes.org>
Subject: Re: [PATCH rcu 3/6] srcu,notifier: Remove #ifdefs in favor of SRCU
 Tiny srcu_usage

On Mon, 17 Jul 2023 at 11:03, Paul E. McKenney <paulmck@...nel.org> wrote:
>
> +// Dummy structure for srcu_notifier_head.
> +struct srcu_usage {
> +       char srcuu_dummy;
> +};
> +
> +#define __SRCU_USAGE_INIT(name) { .srcuu_dummy = 0, }

You really should be able to just do

   struct srcu_usage { };
   #define __SRCU_USAGE_INIT(name) { }

which is something we've done for ages for spinlocks in

    include/linux/spinlock_types_up.h

because while we had a gcc bug wrt empty structures, that was ages ago
(ie "gcc-2.x").

See commit a1365647022e ("[PATCH] remove gcc-2 checks") from 2006.

So we've already had these kinds of empty dummy structs for literally
over a decade in active use. Exactly so that you can avoid having to
use #ifdef's etc, and can just always assume you have a spinlock, even
if it doesn't generate any code or any data overhead.

               Linus

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ