Skip to content

Commit b44290a

Browse files
committed
Merge tag 'pm-5.1-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull power management fixes from Rafael Wysocki: "These rearrange some code in the generic power domains (genpd) framework to avoid a potential deadlock and make the turbostat utility behave more as expected. Specifics: - Rearrange the generic power domains (genpd) code to avoid a potential deadlock possible due to its interactions with the clock framework (Jiada Wang) - Make turbostat return the exit status of the command run under it if that command fails (David Arcari)" * tag 'pm-5.1-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: PM / Domains: Avoid a potential deadlock tools/power turbostat: return the exit status of a command
2 parents 599beed + 112a04f commit b44290a

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

drivers/base/power/domain.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1469,22 +1469,21 @@ static int genpd_add_device(struct generic_pm_domain *genpd, struct device *dev,
14691469
if (IS_ERR(gpd_data))
14701470
return PTR_ERR(gpd_data);
14711471

1472-
genpd_lock(genpd);
1473-
14741472
ret = genpd->attach_dev ? genpd->attach_dev(genpd, dev) : 0;
14751473
if (ret)
14761474
goto out;
14771475

1476+
genpd_lock(genpd);
1477+
14781478
dev_pm_domain_set(dev, &genpd->domain);
14791479

14801480
genpd->device_count++;
14811481
genpd->max_off_time_changed = true;
14821482

14831483
list_add_tail(&gpd_data->base.list_node, &genpd->dev_list);
14841484

1485-
out:
14861485
genpd_unlock(genpd);
1487-
1486+
out:
14881487
if (ret)
14891488
genpd_free_dev_data(dev, gpd_data);
14901489
else
@@ -1533,15 +1532,15 @@ static int genpd_remove_device(struct generic_pm_domain *genpd,
15331532
genpd->device_count--;
15341533
genpd->max_off_time_changed = true;
15351534

1536-
if (genpd->detach_dev)
1537-
genpd->detach_dev(genpd, dev);
1538-
15391535
dev_pm_domain_set(dev, NULL);
15401536

15411537
list_del_init(&pdd->list_node);
15421538

15431539
genpd_unlock(genpd);
15441540

1541+
if (genpd->detach_dev)
1542+
genpd->detach_dev(genpd, dev);
1543+
15451544
genpd_free_dev_data(dev, gpd_data);
15461545

15471546
return 0;

tools/power/x86/turbostat/turbostat.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5077,6 +5077,9 @@ int fork_it(char **argv)
50775077
signal(SIGQUIT, SIG_IGN);
50785078
if (waitpid(child_pid, &status, 0) == -1)
50795079
err(status, "waitpid");
5080+
5081+
if (WIFEXITED(status))
5082+
status = WEXITSTATUS(status);
50805083
}
50815084
/*
50825085
* n.b. fork_it() does not check for errors from for_all_cpus()

0 commit comments

Comments
 (0)