mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sudeep Holla <sudeep.holla@arm.com>
To: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Sudeep Holla <sudeep.holla@arm.com>,
	ACPI List <linux-acpi@vger.kernel.org>,
	Vikas Sajjan <vikas.cha.sajjan@hpe.com>, Sunil <sunil.vl@hpe.com>,
	Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
	PrashanthPrakash <pprakash@codeaurora.org>,
	Al Stone <al.stone@linaro.org>,
	Ashwin Chaugule <ashwin.chaugule@linaro.org>,
	Daniel Lezcano <daniel.lezcano@linaro.org>,
	LKML <linux-kernel@vger.kernel.org>,
	ALKML <linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH v10 2/7] ACPI / processor_idle: Add support for Low Power Idle(LPI) states
Date: Thu, 21 Jul 2016 16:55:27 +0100	[thread overview]
Message-ID: <8b69bd1a-a729-cca4-43f1-84ff4de111a4@arm.com> (raw)
In-Reply-To: <21001224.LAfp2rRWeu@vostro.rjw.lan>



On 21/07/16 14:34, Rafael J. Wysocki wrote:
> On Tuesday, July 19, 2016 06:52:54 PM Sudeep Holla wrote:
>> ACPI 6.0 introduced an optional object _LPI that provides an alternate
>> method to describe Low Power Idle states. It defines the local power
>> states for each node in a hierarchical processor topology. The OSPM can
>> use _LPI object to select a local power state for each level of processor
>> hierarchy in the system. They used to produce a composite power state
>> request that is presented to the platform by the OSPM.
>>
>> Since multiple processors affect the idle state for any non-leaf hierarchy
>> node, coordination of idle state requests between the processors is
>> required. ACPI supports two different coordination schemes: Platform
>> coordinated and  OS initiated.
>>
>> This patch adds initial support for Platform coordination scheme of LPI.
>>
>> Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
>> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
>> ---
>>  drivers/acpi/bus.c              |  14 +-
>>  drivers/acpi/processor_driver.c |   2 +-
>>  drivers/acpi/processor_idle.c   | 462 +++++++++++++++++++++++++++++++++++-----
>>  include/acpi/processor.h        |  24 ++-
>>  include/linux/acpi.h            |   4 +
>>  5 files changed, 446 insertions(+), 60 deletions(-)
>>
>
> [cut]
>
>> +static int acpi_processor_get_lpi_info(struct acpi_processor *pr)
>> +{
>> +	int ret, i;
>> +	acpi_status status;
>> +	acpi_handle handle = pr->handle, pr_ahandle;
>> +	struct acpi_device *d = NULL;
>> +	struct acpi_lpi_states_array info[2], *tmp, *prev, *curr;
>> +
>> +	if (!osc_pc_lpi_support_confirmed)
>> +		return -EOPNOTSUPP;
>> +
>> +	if (!acpi_has_method(handle, "_LPI"))
>> +		return -EINVAL;
>> +
>> +	flat_state_cnt = 0;
>> +	prev = &info[0];
>> +	curr = &info[1];
>> +	handle = pr->handle;
>> +	ret = acpi_processor_evaluate_lpi(handle, prev);
>> +	if (ret)
>> +		return ret;
>> +	flatten_lpi_states(pr, prev, NULL);
>> +
>> +	while (ACPI_SUCCESS(status = acpi_get_parent(handle, &pr_ahandle))) {
>
> I should have mentioned that earlier, but forgot, sorry about that.
>
> Assignments under while () etc are generally discouraged as (a) error-prone
> and (b) confusing to static analysis tools.
>
> So I'd do
>
> 	status = acpi_get_parent(handle, &pr_ahandle);
> 	while (ACPI_SUCCESS(status)) {
>

Sure, will update accordingly.

>> +		acpi_bus_get_device(pr_ahandle, &d);
>> +		handle = pr_ahandle;
>> +
>> +		if (strcmp(acpi_device_hid(d), ACPI_PROCESSOR_CONTAINER_HID))
>> +			break;
>> +
>> +		/* can be optional ? */
>> +		if (!acpi_has_method(handle, "_LPI"))
>> +			break;
>> +
>> +		ret = acpi_processor_evaluate_lpi(handle, curr);
>> +		if (ret)
>> +			break;
>> +
>> +		/* flatten all the LPI states in this level of hierarchy */
>> +		flatten_lpi_states(pr, curr, prev);
>> +
>> +		tmp = prev, prev = curr, curr = tmp;
>
>
> 		status = acpi_get_parent(handle, &pr_ahandle);
>> +	}
>> +
>

OK

> Apart from this the patch looks OK to me, so please only update this one
> and I'll queue up the series.
>

Thanks, will do it shortly.

Also I found a bug in my testing creating some fake tables to test this
non-recursive logic. I have missed a pointer update in the inner loop. I
will include the below one liner in the update.


-->8

diff --git i/drivers/acpi/processor_idle.c w/drivers/acpi/processor_idle.c
index fced1df535bd..c8800b55268d 100644
--- i/drivers/acpi/processor_idle.c
+++ w/drivers/acpi/processor_idle.c
@@ -1142,6 +1142,7 @@ static int flatten_lpi_states(struct 
acpi_processor *pr,
                             combine_lpi_states(p, t, flpi)) {
                                 stash_composite_state(curr_level, flpi);
                                 flat_state_cnt++;
+                               flpi++;
                         }
                 }
         }

-- 
Regards,
Sudeep

  reply	other threads:[~2016-07-21 15:55 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-19 17:52 [PATCH v10 0/7] ACPI / processor_idle: Add ACPI v6.0 LPI support Sudeep Holla
2016-07-19 17:52 ` [PATCH v10 1/7] ACPI / processor_idle: introduce ACPI_PROCESSOR_CSTATE Sudeep Holla
2016-07-19 17:52 ` [PATCH v10 2/7] ACPI / processor_idle: Add support for Low Power Idle(LPI) states Sudeep Holla
2016-07-21 13:34   ` Rafael J. Wysocki
2016-07-21 15:55     ` Sudeep Holla [this message]
2016-07-21 16:18   ` Sudeep Holla
2016-07-19 17:52 ` [PATCH v10 3/7] arm64: cpuidle: drop __init section marker to arm_cpuidle_init Sudeep Holla
2016-07-19 17:52 ` [PATCH v10 4/7] cpuidle: introduce CPU_PM_CPU_IDLE_ENTER macro for ARM{32,64} Sudeep Holla
2016-07-19 17:52 ` [PATCH v10 5/7] drivers: firmware: psci: initialise idle states using ACPI LPI Sudeep Holla
2016-07-19 17:52 ` [PATCH v10 6/7] arm64: add support for ACPI Low Power Idle(LPI) Sudeep Holla
2016-07-19 17:52 ` [PATCH v10 7/7] ACPI : enable ACPI_PROCESSOR_IDLE on ARM64 Sudeep Holla
2016-07-29 19:05   ` Christopher Covington
2016-08-02 13:00     ` Sudeep Holla
2016-08-15 14:47       ` Christopher Covington
2016-08-15 14:51         ` Sudeep Holla

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=8b69bd1a-a729-cca4-43f1-84ff4de111a4@arm.com \
    --to=sudeep.holla@arm.com \
    --cc=al.stone@linaro.org \
    --cc=ashwin.chaugule@linaro.org \
    --cc=daniel.lezcano@linaro.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=pprakash@codeaurora.org \
    --cc=rjw@rjwysocki.net \
    --cc=sunil.vl@hpe.com \
    --cc=vikas.cha.sajjan@hpe.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®