public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Wolfram Sang <wsa+renesas@sang-engineering.com>,
	Douglas Anderson <dianders@chromium.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"Rafael J . Wysocki" <rafael@kernel.org>,
	Danilo Krummrich <dakr@kernel.org>,
	stable@vger.kernel.org, Andrew Lunn <andrew@lunn.ch>,
	Daniel Scally <djrscally@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Fabio Estevam <festevam@gmail.com>, Frank Li <Frank.Li@nxp.com>,
	Heikki Krogerus <heikki.krogerus@linux.intel.com>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	Jakub Kicinski <kuba@kernel.org>, Len Brown <lenb@kernel.org>,
	Mark Brown <broonie@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Pengutronix Kernel Team <kernel@pengutronix.de>,
	Rob Herring <robh@kernel.org>,
	Russell King <linux@armlinux.org.uk>,
	Sakari Ailus <sakari.ailus@linux.intel.com>,
	Saravana Kannan <saravanak@kernel.org>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	devicetree@vger.kernel.org, driver-core@lists.linux.dev,
	imx@lists.linux.dev, linux-acpi@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org,
	netdev@vger.kernel.org
Subject: Re: [PATCH] device property: Make modifications of fwnode "flags" thread safe
Date: Wed, 18 Mar 2026 11:06:41 +0200	[thread overview]
Message-ID: <abprIZ4_LUScJrSd@ashevche-desk.local> (raw)
In-Reply-To: <CAMuHMdVX4tfko8iv-EdwO-bBcwCd+cPkb9aP8qJbcM1F4zdz4g@mail.gmail.com>

On Wed, Mar 18, 2026 at 09:41:44AM +0100, Geert Uytterhoeven wrote:
> On Tue, 17 Mar 2026 at 08:34, Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> > On Tue, Mar 17, 2026 at 08:26:53AM +0100, Wolfram Sang wrote:

...

> > > Thanks for tackling this issue! I agree it should be fixed, just
> > > wondered about one thing:
> > >
> > > > While flags are often modified while under the "fwnode_link_lock",
> > > > this is not universally true.
> > >
> > > Is it a possibility to use the lock in all code paths instead?
> > > Because...
> > >
> > > >     struct list_head consumers;
> > > > -   u8 flags;
> > > > +   unsigned long flags;
> > >
> > > ... this change costs some memory on every system. Maybe it can be
> > > avoided?
> >
> > How much memory does it cost? On most 64-bit architectures is +4 bytes,
> > rarely +0 bytes, on m68k it might be +2bytes. On 32-bit it most likely
> > +0 bytes. I expect that 64-bit machines will cope with this bump.
> 
> On all architectures with natural alignment of pointers and longs,
> it won't cost a thing: struct list_head contains pointers, so the
> struct must be padded to a multiple of 4 or 8 bytes anyway.
> On m68k[*],  it will cost 2 bytes, as the existing padding is just a
> single byte.
> 
> [*] Iff m68k ever switches to 32-bit alignment, there won't be an
>     additional cost due to the change of flags here, but of course
>     there would be a cost all over the place.

Thanks!

Yes, the worst case is 64-bit architecture with 4-byte alignment. This
will cost +4 bytes.

But I think we are really wasting time on this part of the discussion
(and any similar) as long as nobody targets struct device or any other
BIG FAT data type, that will bring much more benefit than saving 4 bytes
in some struct fwnode_handle.

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2026-03-18  9:06 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-16 22:42 [PATCH] device property: Make modifications of fwnode "flags" thread safe Douglas Anderson
2026-03-17  7:10 ` Andy Shevchenko
2026-03-17  7:26 ` Wolfram Sang
2026-03-17  7:34   ` Andy Shevchenko
2026-03-17  7:42     ` Wolfram Sang
2026-03-17  8:04       ` Andy Shevchenko
2026-03-17  8:05         ` Andy Shevchenko
2026-03-17  8:42           ` Wolfram Sang
2026-03-17 10:02             ` Danilo Krummrich
2026-03-17 10:16             ` Andy Shevchenko
2026-03-17 10:34               ` Wolfram Sang
2026-03-17 10:44                 ` Rafael J. Wysocki
2026-03-17 14:27                   ` Wolfram Sang
2026-03-18  8:41     ` Geert Uytterhoeven
2026-03-18  9:06       ` Andy Shevchenko [this message]
2026-03-17 13:42 ` Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=abprIZ4_LUScJrSd@ashevche-desk.local \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=Frank.Li@nxp.com \
    --cc=andrew@lunn.ch \
    --cc=broonie@kernel.org \
    --cc=dakr@kernel.org \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=dianders@chromium.org \
    --cc=djrscally@gmail.com \
    --cc=driver-core@lists.linux.dev \
    --cc=edumazet@google.com \
    --cc=festevam@gmail.com \
    --cc=geert@linux-m68k.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=hkallweit1@gmail.com \
    --cc=imx@lists.linux.dev \
    --cc=kernel@pengutronix.de \
    --cc=kuba@kernel.org \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=rafael@kernel.org \
    --cc=robh@kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=sakari.ailus@linux.intel.com \
    --cc=saravanak@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=wsa+renesas@sang-engineering.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox