All of lore.kernel.org
 help / color / mirror / Atom feed
From: gaurav jindal <gauravjindal1104@gmail.com>
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Daniel Lezcano <daniel.lezcano@linaro.org>,
	Linux PM <linux-pm@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH]cpuidle: preventive check in cpuidle_select against crash
Date: Wed, 27 Dec 2017 07:27:22 +0530	[thread overview]
Message-ID: <20171227015722.GA3413@gaurav.jindal> (raw)
In-Reply-To: <CAJZ5v0g36rdGVDT==CMCsnDFQ6ph2PxOyF0mgdMSfP4Wiv74TQ@mail.gmail.com>

On Wed, Dec 27, 2017 at 01:42:58AM +0100, Rafael J. Wysocki wrote:
> On Tue, Dec 26, 2017 at 8:26 AM, gaurav jindal
> <gauravjindal1104@gmail.com> wrote:
> > When selecting the idle state using cpuidle_select, there is no
> > check on cpuidle_curr_governor. In cpuidle_switch_governor,
> > cpuidle_currr_governor can be set to NULL to specify "disabled".
> 
> How exactly?

In cpuidle_switch_governor:
 
/**
 * cpuidle_switch_governor - changes the governor
 * @gov: the new target governor
 *
 * NOTE: "gov" can be NULL to specify disabled
 * Must be called with cpuidle_lock acquired.
 */
int cpuidle_switch_governor(struct cpuidle_governor *gov)
{
	struct cpuidle_device *dev;

	if (gov == cpuidle_curr_governor)
		return 0;

	cpuidle_uninstall_idle_handler();

	if (cpuidle_curr_governor) {
		list_for_each_entry(dev, &cpuidle_detected_devices, device_list)
			cpuidle_disable_device(dev);
	}

	cpuidle_curr_governor = gov;

This allows to set the cpuidle_switch_governor as NULL. Although there is no
current code flow leading here, but it has a potential for bug in future. So
may be better to have prevention.

  reply	other threads:[~2017-12-27  1:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-26  7:26 [PATCH]cpuidle: preventive check in cpuidle_select against crash gaurav jindal
2017-12-27  0:42 ` Rafael J. Wysocki
2017-12-27  1:57   ` gaurav jindal [this message]
2017-12-27  2:30     ` Rafael J. Wysocki
2017-12-29 18:45       ` gaurav jindal
2018-01-03 11:16         ` Rafael J. Wysocki
2018-01-04 18:09           ` gaurav jindal

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=20171227015722.GA3413@gaurav.jindal \
    --to=gauravjindal1104@gmail.com \
    --cc=daniel.lezcano@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=rjw@rjwysocki.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.