Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions drivers/ras/aest/aest-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,31 @@ static struct notifier_block aest_cpu_pm_nb = {
.notifier_call = aest_cpu_pm_notify,
};

/*
* platform_driver_register() walks matching devices synchronously in
* the calling thread (this driver does not opt into async probing, and
* aest_device_probe() never returns -EPROBE_DEFER), so repeated probes
* are strictly sequential, not concurrent -- a plain bool is sufficient
* and no additional locking is required here.
*/
static bool aest_cpu_pm_nb_registered;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why non of this has been sent upstream? Why do we need a global? where are the locks, protecting it from the read-modify happening at the same time? Device probing can happen in parallel.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even without async probing, the probe can happen in parallel if they are caused by other devices (e.g. if PCIe is built as a module).


static void aest_cpu_pm_init(void)
{
if (aest_cpu_pm_nb_registered)
return;

cpu_pm_register_notifier(&aest_cpu_pm_nb);
aest_cpu_pm_nb_registered = true;
}

static void aest_cpu_pm_exit(void)
{
if (!aest_cpu_pm_nb_registered)
return;

cpu_pm_unregister_notifier(&aest_cpu_pm_nb);
aest_cpu_pm_nb_registered = false;
}
#else
static inline void aest_cpu_pm_init(void) { }
Expand Down