From: Sudeep Holla <sudeep.holla@arm.com>
To: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Sudeep Holla <sudeep.holla@arm.com>,
linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-ia64@vger.kernel.org, x86@kernel.org,
Al Stone <al.stone@linaro.org>,
Lorenzo Pieralisi <Lorenzo.Pieralisi@arm.com>,
Mahesh Sivasubramanian <msivasub@codeaurora.org>,
Ashwin Chaugule <ashwin.chaugule@linaro.org>,
Prashanth Prakash <pprakash@codeaurora.org>
Subject: Re: [PATCH v3 5/5] ACPI / processor_idle: Add support for Low Power Idle(LPI) states
Date: Wed, 17 Feb 2016 16:10:11 +0000 [thread overview]
Message-ID: <56C49B63.9050102@arm.com> (raw)
In-Reply-To: <8070621.77MVWuTaHa@vostro.rjw.lan>
On 16/02/16 20:46, Rafael J. Wysocki wrote:
> On Wednesday, December 02, 2015 02:10:46 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>
>
> My first point here would be the same as for [4/5]: please don't introduce
> new Kconfig options if you don't have to (and you clearly don't have to in this
> case, because it all can be made work without new Kconfig options).
>
Right, this was kind of defensive approach initially so as to not break
anything on x86, rather add anything new to x86 code path. I have
removed it now.
>> ---
>> drivers/acpi/Kconfig | 3 +
>> drivers/acpi/bus.c | 8 +-
>> drivers/acpi/processor_driver.c | 2 +-
>> drivers/acpi/processor_idle.c | 440 +++++++++++++++++++++++++++++++++++-----
>> include/acpi/processor.h | 30 ++-
>> include/linux/acpi.h | 4 +
>> 6 files changed, 435 insertions(+), 52 deletions(-)
>>
>> diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
>> index 12873f0b8141..89a2d9b81feb 100644
>> --- a/drivers/acpi/Kconfig
>> +++ b/drivers/acpi/Kconfig
>> @@ -51,6 +51,9 @@ config ARCH_MIGHT_HAVE_ACPI_PDC
>> config ARCH_SUPPORTS_ACPI_PROCESSOR_CSTATE
>> bool
>>
>> +config ARCH_SUPPORTS_ACPI_PROCESSOR_LPI
>
> Not needed.
>
Done
>> + bool
>> +
>> config ACPI_GENERIC_GSI
>> bool
>>
>> diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
>> index a212cefae524..2e9e2e3fde6a 100644
>> --- a/drivers/acpi/bus.c
>> +++ b/drivers/acpi/bus.c
>> @@ -301,6 +301,7 @@ acpi_status acpi_run_osc(acpi_handle handle, struct acpi_osc_context *context)
>> EXPORT_SYMBOL(acpi_run_osc);
>>
>> bool osc_sb_apei_support_acked;
>> +bool osc_pc_lpi_support_acked;
>
> Maybe call it osc_pc_lpi_support_confirmed. And add a comment describing what
> "PC LPI" means (a pointer to the relevant spec section might be useful too).
>
Agreed and done
[...]
>> @@ -943,24 +906,407 @@ static inline void acpi_processor_cstate_first_run_checks(void)
>>
>> static inline int disabled_by_idle_boot_param(void) { return 0; }
>> static inline void acpi_processor_cstate_first_run_checks(void) { }
>> -static int acpi_processor_get_power_info(struct acpi_processor *pr)
>> +static int acpi_processor_get_cstate_info(struct acpi_processor *pr)
>> {
>> return -ENODEV;
>> }
>> -
>
> Unrelated whitespace change.
>
Removed
[...]
>> +
>> + /* There must be at least 4 elements = 3 elements + 1 package */
>> + if (!lpi || lpi->type != ACPI_TYPE_PACKAGE || lpi->package.count < 4) {
>> + pr_info("not enough elements in _LPI\n");
>
> pr_debug()? Plus maybe point to the LPI object in question in that message?
>
>> + ret = -EFAULT;
>
> -ENXIO? -EFAULT has a specific meaning which doesn't apply here.
>
Both done
>> +
>> + /* TODO this long list is looking insane now
>> + * need a cleaner and saner way to read the elements
>> + */
>
> Well, I'm not sure about the above comment. The code is what it is, anyone
> can draw their own conclusions. :-)
>
Well that's stray leftover comment. When I started adding LPI changes, I
initially thought they may be better way to do that, but I have now
realized it's only way :). I will remove it
> I would consider storing the whole buffer instead of trying to decode it
> upfront, though. You need to flatten it etc going forward, so maybe
> decode it at that time?
>
OK, I will look at this now.
> Also I'm not sure about silent discarding things that look defective. I would
> at least add a debug message to wherever this is done and maybe we can try
> to fix up or fall back to some sane defaults at least in some cases?
>
Agreed.
[...]
>> + info = kcalloc(max_leaf_depth + 1, sizeof(*info), GFP_KERNEL);
>> + if (!info)
>> + return -ENOMEM;
>> +
>> + phandle = pr->handle;
>
> phandle is easily confised with DT phandles. I'd avoind using that for an ACPI
> object handle variable name.
>
I changed it to pr_ahandle now(i.e processor acpi handle)
> Well, what if it turns out that LPI is missing? Shouldn't we fall back to using
> _CST then?
>
> Of course, the problem here is that the presence of LPI has to be checked for
> all CPUs in the system before deciding to fall back (in which case all of them
> should be using _CST if present).
>
I agree, do we do similar check for _CST too ?
>> + dev->cpu = pr->id;
>> + if (pr->flags.has_lpi)
>> + return acpi_processor_ffh_lpi_probe(pr->id);
>> + else
>> + return acpi_processor_setup_cpuidle_cx(pr, dev);
>
> Fallback here too maybe?
>
Fixed
>> +}
>> +
>> +static int acpi_processor_get_power_info(struct acpi_processor *pr)
>> +{
>> + int ret = 0;
>> +
>> + ret = acpi_processor_get_cstate_info(pr);
>> + if (ret)
>> + ret = acpi_processor_get_lpi_info(pr);
>
> Shouldn't that be done in the reverse order?
>
Yes, again kind of defensive approach I took to avoid any change, but
will change it.
>> diff --git a/include/acpi/processor.h b/include/acpi/processor.h
>> index 50f2423d31fa..f3006831d427 100644
>> --- a/include/acpi/processor.h
>> +++ b/include/acpi/processor.h
>> @@ -39,6 +39,7 @@
>> #define ACPI_CSTATE_SYSTEMIO 0
>> #define ACPI_CSTATE_FFH 1
>> #define ACPI_CSTATE_HALT 2
>> +#define ACPI_CSTATE_INTEGER 3
>
> What does this mean?
>
Ah bad naming, I introduced this to communicate to flattening algo that
it's a simple number that needs to used as is. Based on you comment
above, saving buffer and decoding later might remove the need of it.
--
Regards,
Sudeep
next prev parent reply other threads:[~2016-02-17 16:10 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-02 14:10 [PATCH v3 0/5] ACPI / processor_idle: Add ACPI v6.0 LPI support Sudeep Holla
2015-12-02 14:10 ` [PATCH v3 1/5] ACPI / processor : add support for ACPI0010 processor container Sudeep Holla
2016-02-16 20:10 ` Rafael J. Wysocki
2016-02-17 11:54 ` Sudeep Holla
2016-02-17 11:54 ` [UPDATE] " Sudeep Holla
2016-02-23 23:41 ` Rafael J. Wysocki
2015-12-02 14:10 ` [PATCH v3 2/5] ACPI / sleep: move acpi_processor_sleep to sleep.c Sudeep Holla
2016-02-16 20:13 ` Rafael J. Wysocki
2016-02-17 12:03 ` Sudeep Holla
2016-02-17 12:03 ` [UPDATE] " Sudeep Holla
2016-02-23 23:42 ` Rafael J. Wysocki
2015-12-02 14:10 ` [PATCH v3 3/5] ACPI / processor_idle: replace PREFIX with pr_fmt Sudeep Holla
2016-02-16 20:15 ` Rafael J. Wysocki
2015-12-02 14:10 ` [PATCH v3 4/5] ACPI / processor_idle : introduce ARCH_SUPPORTS_ACPI_PROCESSOR_CSTATE Sudeep Holla
2016-02-16 20:18 ` Rafael J. Wysocki
2016-02-17 12:21 ` Sudeep Holla
2016-02-22 13:46 ` Sudeep Holla
2016-02-22 23:28 ` Rafael J. Wysocki
2016-02-23 9:32 ` Sudeep Holla
2015-12-02 14:10 ` [PATCH v3 5/5] ACPI / processor_idle: Add support for Low Power Idle(LPI) states Sudeep Holla
2016-02-16 20:46 ` Rafael J. Wysocki
2016-02-17 16:10 ` Sudeep Holla [this message]
2016-04-12 4:06 ` Vikas Sajjan
2016-04-12 14:29 ` Sudeep Holla
2015-12-09 22:52 ` [PATCH v3 0/5] ACPI / processor_idle: Add ACPI v6.0 LPI support Prakash, Prashanth
2015-12-10 8:48 ` Sudeep Holla
2016-01-15 19:13 ` Prakash, Prashanth
2016-01-18 12:15 ` Sudeep Holla
2016-01-18 14:53 ` Rafael J. Wysocki
2016-01-27 18:26 ` Sudeep Holla
2016-02-16 20:08 ` Rafael J. Wysocki
2016-02-17 11:37 ` Sudeep Holla
2016-02-18 2:08 ` Rafael J. Wysocki
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=56C49B63.9050102@arm.com \
--to=sudeep.holla@arm.com \
--cc=Lorenzo.Pieralisi@arm.com \
--cc=al.stone@linaro.org \
--cc=ashwin.chaugule@linaro.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-ia64@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=msivasub@codeaurora.org \
--cc=pprakash@codeaurora.org \
--cc=rjw@rjwysocki.net \
--cc=x86@kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).