[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJZ5v0iScM-1nTXuex3rhhWOhe+NcVj1X-ObKY=c5TnZk_eB7A@mail.gmail.com>
Date: Wed, 4 Feb 2026 13:11:09 +0100
From: "Rafael J. Wysocki" <rafael@...nel.org>
To: Xuewen Yan <xuewen.yan94@...il.com>
Cc: "Rafael J. Wysocki" <rafael@...nel.org>, Linux PM <linux-pm@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>, Ulf Hansson <ulf.hansson@...aro.org>,
Saravana Kannan <saravanak@...gle.com>, Xuewen Yan <xuewen.yan@...soc.com>
Subject: Re: [PATCH v1] PM: sleep: core: Clear device async state upfront
during suspend
On Wed, Feb 4, 2026 at 3:57 AM Xuewen Yan <xuewen.yan94@...il.com> wrote:
>
> Hi Rafael,
>
> On Wed, Feb 4, 2026 at 4:38 AM Rafael J. Wysocki <rafael@...nel.org> wrote:
> >
> > From: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
> >
> > In all of the system suspend transition phases, async state of all
> > devices needs to be cleared before starting async processing for any of
> > them because the latter may race with power.work_in_progress updates for
> > the device's parent or suppliers and if it touches bit fields from the
> > same group (for example, power.must_resume or power.wakeup_path), bit
> > field corruption is possible.
> >
> > Rearrange the code accordingly.
>
> Could we use the following patch:
Yes, we can make this change.
> diff --git a/include/linux/pm.h b/include/linux/pm.h
> index 98a899858ece..afcaaa37a812 100644
> --- a/include/linux/pm.h
> +++ b/include/linux/pm.h
> @@ -681,10 +681,10 @@ struct dev_pm_info {
> struct list_head entry;
> struct completion completion;
> struct wakeup_source *wakeup;
> + bool work_in_progress; /* Owned by
> the PM core */
> bool wakeup_path:1;
> bool syscore:1;
> bool no_pm_callbacks:1; /* Owned by
> the PM core */
> - bool work_in_progress:1; /* Owned by
> the PM core */
> bool smart_suspend:1; /* Owned by
> the PM core */
> bool must_resume:1; /* Owned by
> the PM core */
> bool may_skip_resume:1; /* Set by subsystems */
>
> Due to byte alignment, the size of struct dev_pm_info remains unchanged,
I had considered making it, but I thought it would cause struct
dev_pm_info to grow.
> while also preventing concurrency issues between work_in_progress and
> other variables. Additionally, with this modification, there’s no need to traverse the
> device list twice.
Sure.
I'll just commit the above change with your sign-off, please let me
know if there are any issues with that.
Thanks!
Powered by blists - more mailing lists