Skip to content

Commit

Permalink
Merge tag 'pm-5.1-rc2' of git://git.kernel.org/pub/scm/linux/kernel/g…
Browse files Browse the repository at this point in the history
…it/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
  • Loading branch information
torvalds committed Mar 22, 2019
2 parents 599beed + 112a04f commit b44290a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
13 changes: 6 additions & 7 deletions drivers/base/power/domain.c
Original file line number Diff line number Diff line change
Expand Up @@ -1469,22 +1469,21 @@ static int genpd_add_device(struct generic_pm_domain *genpd, struct device *dev,
if (IS_ERR(gpd_data))
return PTR_ERR(gpd_data);

genpd_lock(genpd);

ret = genpd->attach_dev ? genpd->attach_dev(genpd, dev) : 0;
if (ret)
goto out;

genpd_lock(genpd);

dev_pm_domain_set(dev, &genpd->domain);

genpd->device_count++;
genpd->max_off_time_changed = true;

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

out:
genpd_unlock(genpd);

out:
if (ret)
genpd_free_dev_data(dev, gpd_data);
else
Expand Down Expand Up @@ -1533,15 +1532,15 @@ static int genpd_remove_device(struct generic_pm_domain *genpd,
genpd->device_count--;
genpd->max_off_time_changed = true;

if (genpd->detach_dev)
genpd->detach_dev(genpd, dev);

dev_pm_domain_set(dev, NULL);

list_del_init(&pdd->list_node);

genpd_unlock(genpd);

if (genpd->detach_dev)
genpd->detach_dev(genpd, dev);

genpd_free_dev_data(dev, gpd_data);

return 0;
Expand Down
3 changes: 3 additions & 0 deletions tools/power/x86/turbostat/turbostat.c
Original file line number Diff line number Diff line change
Expand Up @@ -5077,6 +5077,9 @@ int fork_it(char **argv)
signal(SIGQUIT, SIG_IGN);
if (waitpid(child_pid, &status, 0) == -1)
err(status, "waitpid");

if (WIFEXITED(status))
status = WEXITSTATUS(status);
}
/*
* n.b. fork_it() does not check for errors from for_all_cpus()
Expand Down

0 comments on commit b44290a

Please sign in to comment.