From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Joshua Crofts <crofts@kernel.org>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>,
Len Brown <lenb@kernel.org>, Pavel Machek <pavel@kernel.org>,
Danilo Krummrich <dakr@kernel.org>,
Johan Hovold <johan@kernel.org>,
linux-pm@vger.kernel.org, driver-core@lists.linux.dev,
linux-kernel@vger.kernel.org,
Dominik Brodowski <linux@dominikbrodowski.net>
Subject: Re: [PATCH 2/3] PM: add sysfs attributes for additional suspend/resume metrics
Date: Tue, 10 Nov 2026 13:58:34 -0500 [thread overview]
Message-ID: <2026111004-landmine-residue-a660@gregkh> (raw)
In-Reply-To: <2026111027-purifier-revolver-37c3@gregkh>
On Tue, Nov 10, 2026 at 01:54:05PM -0500, Greg Kroah-Hartman wrote:
> On Tue, Nov 10, 2026 at 07:50:20PM +0100, Joshua Crofts wrote:
> > On Tue, 10 Nov 2026 12:29:11 -0500
> > Greg Kroah-Hartman <gregkh@linuxfoundation.org> wrote:
> >
> > ...
> >
> > > > +static ssize_t runtime_resume_count_show(struct device *dev,
> > > > + struct device_attribute *attr,
> > > > + char *buf)
> > > > +{
> > > > + u64 count;
> > > > +
> > > > + spin_lock_irq(&dev->power.lock);
> > > > + count = dev->power.resume_count;
> > > > + spin_unlock_irq(&dev->power.lock);
> > >
> > > Why is a lock needed at all? The value isn't going to "smear", it will
> > > change right after the lock anyway.
> >
> > On 64-bit systems an aligned u64 read is atomic, but on 32-bit systems it
> > gets split into two 32-bit loads. Without locking, the read can tear
> > between the upper and lower halves.
>
> Are you sure? ANd if so, is that so bad? The value is "best effort" as
> it can, and will, change right after reading it.
And even more relevant, what specific 32bit system are you using that
this new api is going to be relying on?
thanks,
greg k-h
next prev parent reply other threads:[~2026-11-10 18:58 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-10 10:43 [PATCH 0/3] PM: runtime: add new runtime metrics and summary Joshua Crofts
2026-11-10 10:43 ` [PATCH 1/3] PM: runtime: add additional suspend/resume metrics Joshua Crofts
2026-11-10 10:43 ` [PATCH 2/3] PM: add sysfs attributes for " Joshua Crofts
2026-11-10 17:29 ` Greg Kroah-Hartman
2026-11-10 18:50 ` Joshua Crofts
2026-11-10 18:54 ` Greg Kroah-Hartman
2026-11-10 18:58 ` Greg Kroah-Hartman [this message]
2026-11-10 19:02 ` Joshua Crofts
2026-11-10 10:43 ` [PATCH 3/3] PM: runtime: add debugfs entry for pm_runtime_summary Joshua Crofts
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=2026111004-landmine-residue-a660@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=crofts@kernel.org \
--cc=dakr@kernel.org \
--cc=driver-core@lists.linux.dev \
--cc=johan@kernel.org \
--cc=lenb@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux@dominikbrodowski.net \
--cc=pavel@kernel.org \
--cc=rafael@kernel.org \
/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
all inboxes | Powered by JetHome®