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-next>] [day] [month] [year] [list]
Date: Mon, 5 Feb 2024 14:54:08 +0100
From: Bartosz Golaszewski <brgl@...ev.pl>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: Linus Walleij <linus.walleij@...aro.org>, Kent Gibson <warthog618@...il.com>, 
	Alex Elder <elder@...aro.org>, Geert Uytterhoeven <geert+renesas@...der.be>, 
	"Paul E . McKenney" <paulmck@...nel.org>, Wolfram Sang <wsa@...-dreams.de>, linux-gpio@...r.kernel.org, 
	linux-kernel@...r.kernel.org, 
	Bartosz Golaszewski <bartosz.golaszewski@...aro.org>
Subject: Re: [PATCH v2 06/23] gpio: add SRCU infrastructure to struct gpio_desc

On Mon, Feb 5, 2024 at 2:48 PM Andy Shevchenko
<andriy.shevchenko@...ux.intel.com> wrote:
>
> On Mon, Feb 05, 2024 at 10:34:01AM +0100, Bartosz Golaszewski wrote:
> > From: Bartosz Golaszewski <bartosz.golaszewski@...aro.org>
> >
> > Extend the GPIO descriptor with an SRCU structure in order to serialize
> > the access to the label. Initialize and clean it up where applicable.
>
> ...
>
> > +     for (i = 0; i < gdev->ngpio; i++)
> > +             cleanup_srcu_struct(&gdev->descs[i].srcu);
>
> for_each_gpio_desc()?

That works with chips not devices, we'd need to add a variant for
gpio_device, but see below:

>
> (It might be that the latter should be reworked a bit first, dunno)
>
> ...
>
> > +                     for (j = 0; j < i; j++)
> > +                             cleanup_srcu_struct(&desc->srcu);
>
> What does this loop mean?

I open-coded it because I want to store the value of i to go back and
destroy the SRCU structs on failure.

>
> > +                     goto err_remove_of_chip;
> > +             }
>
> ...
>
> > +err_cleanup_desc_srcu:
> > +     for (i = 0; i < gdev->ngpio; i++)
> > +             cleanup_srcu_struct(&gdev->descs[i].srcu);
>
> As per above (use existing for_each macro),
>
> ...
>
> > +     struct srcu_struct      srcu;
> >  };
>
> I am wondering if moving it to the top of the struct will give a more
> performant code.
>

Nah, that would be strictly theoretical. It could matter with
container_of() but not with a simple pointer dereference.

Bart

> --
> With Best Regards,
> Andy Shevchenko
>
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ