linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>,
	Len Brown <len.brown@intel.com>, Pavel Machek <pavel@ucw.cz>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Kevin Hilman <khilman@kernel.org>,
	Ulf Hansson <ulf.hansson@linaro.org>,
	Daniel Lezcano <daniel.lezcano@linaro.org>,
	Lorenzo Pieralisi <lpieralisi@kernel.org>,
	Sudeep Holla <sudeep.holla@arm.com>,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	Adrien Thierry <athierry@redhat.com>,
	Brian Masney <bmasney@redhat.com>,
	linux-rt-users@vger.kernel.org
Subject: Re: [PATCH v2 1/5] PM: domains: Add GENPD_FLAG_RT_SAFE for PREEMPT_RT
Date: Thu, 12 Jan 2023 12:31:01 +0100	[thread overview]
Message-ID: <b6d0aa40-5d25-df4e-f8fb-64d056b24c84@linaro.org> (raw)
In-Reply-To: <Y7/h2n271HBeXDl6@linutronix.de>

On 12/01/2023 11:32, Sebastian Andrzej Siewior wrote:
> On 2022-12-19 16:14:59 [+0100], Krzysztof Kozlowski wrote:
>> Realtime kernels with PREEMPT_RT must use raw_spinlock_t for domains
>> which are invoked from CPU idle (thus from atomic section).  Example is
>> cpuidle PSCI domain driver which itself is PREEMPT_RT safe, but is being
>> called as part of cpuidle.
> 
> I think it needs to be clarified what PREEMPT_RT safe means. 

OK

> PSCI is an
> external interface which does not inform us what it does and how long
> the operation will take.
> The ACPI table for instance populate several idle states and their
> entry/exit time. Then you can decide if and when an entry/exit latency
> of 500us is PREEMPT_RT safe.
> 
>> Add a flag allowing a power domain provider to indicate it is RT safe.
>> The flag is supposed to be used with existing GENPD_FLAG_IRQ_SAFE.
>>
>> Cc: Adrien Thierry <athierry@redhat.com>
>> Cc: Brian Masney <bmasney@redhat.com>
>> Cc: linux-rt-users@vger.kernel.org
>> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
>>
> …
>> index 1cd41bdf73cf..0a1600244963 100644
>> --- a/include/linux/pm_domain.h
>> +++ b/include/linux/pm_domain.h
>> @@ -61,6 +61,14 @@
>>   * GENPD_FLAG_MIN_RESIDENCY:	Enable the genpd governor to consider its
>>   *				components' next wakeup when determining the
>>   *				optimal idle state.
>> + *
>> + * GENPD_FLAG_RT_SAFE:		When used with GENPD_FLAG_IRQ_SAFE, this informs
>> + *				genpd that its backend callbacks, ->power_on|off(),
>> + *				do not use other spinlocks. They might use
>> + *				raw_spinlocks or other pre-emption-disable
>> + *				methods, all of which are PREEMPT_RT safe. Note
> 
> Please use spinlock_t and raw_spinlock_t. Wouldn't it be better to write
> "preemption" instead "pre-emption"?

Sure.

> The important part is probably that once a raw_spinlock_t has been
> acquired, it is not possible to invoke any function that acquries
> sleeping locks (which includes memory allocations). While even without
> that flag it is possible to invoke a function which disables and enables
> preemption on its own.
> 
>> + *				that, a genpd having this flag set, requires its
>> + *				masterdomains to also have it set.
> 
> This could be verified upon registration, no?

It is, just like the IRQ_SAFE flag. The code is symmetrical to IRQ_SAFE.

> It might be worth noting that preemption-off section during PM
> operations contribute to the system's max latency.

You mean in the commit msg? In the doc, I don't want to deviate from
IRQ_SAFE. It's not really related to the flag.

> Depending on how low
> the operation is, it may or may not be a problem.
> The ->power_on|off() refers to the sate of the component, right?

It refers to genpd framework.

Best regards,
Krzysztof


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2023-01-12 11:32 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-19 15:14 [PATCH v2 0/5] PM: Fixes for Realtime systems Krzysztof Kozlowski
2022-12-19 15:14 ` [PATCH v2 1/5] PM: domains: Add GENPD_FLAG_RT_SAFE for PREEMPT_RT Krzysztof Kozlowski
2023-01-04 15:45   ` Ulf Hansson
2023-01-06 14:52     ` Krzysztof Kozlowski
2023-01-12 10:36       ` Sebastian Andrzej Siewior
2023-01-12 11:27         ` Krzysztof Kozlowski
2023-01-12 10:32   ` Sebastian Andrzej Siewior
2023-01-12 11:31     ` Krzysztof Kozlowski [this message]
2022-12-19 15:15 ` [PATCH v2 2/5] cpuidle: psci: Mark as PREEMPT_RT safe Krzysztof Kozlowski
2023-01-12 11:00   ` Sebastian Andrzej Siewior
2023-01-12 11:32     ` Krzysztof Kozlowski
2023-01-17 15:27   ` Ulf Hansson
2023-01-19 15:40     ` Krzysztof Kozlowski
2023-01-19 17:06       ` Krzysztof Kozlowski
2022-12-19 15:15 ` [PATCH v2 3/5] cpuidle: psci: Do not suspend topology CPUs on PREEMPT_RT Krzysztof Kozlowski
2023-01-12 11:09   ` Sebastian Andrzej Siewior
2023-01-12 11:34     ` Krzysztof Kozlowski
2023-01-30  9:51       ` Sebastian Andrzej Siewior
2022-12-19 15:15 ` [PATCH v2 4/5] PM: Allow calling dev_pm_domain_set() with raw spinlock Krzysztof Kozlowski
2023-01-12 11:13   ` Sebastian Andrzej Siewior
2022-12-19 15:15 ` [PATCH v2 5/5] PM: domains: Do not call device_pm_check_callbacks() when holding genpd_lock() Krzysztof Kozlowski
2023-01-12 11:31   ` Sebastian Andrzej Siewior
2023-01-12 11:37     ` Krzysztof Kozlowski
2023-01-17 15:11   ` Ulf Hansson
2023-01-19 15:58     ` Krzysztof Kozlowski
2022-12-20 21:36 ` [PATCH v2 0/5] PM: Fixes for Realtime systems Adrien Thierry
2023-01-04 15:15   ` Ulf Hansson

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=b6d0aa40-5d25-df4e-f8fb-64d056b24c84@linaro.org \
    --to=krzysztof.kozlowski@linaro.org \
    --cc=athierry@redhat.com \
    --cc=bigeasy@linutronix.de \
    --cc=bmasney@redhat.com \
    --cc=daniel.lezcano@linaro.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=khilman@kernel.org \
    --cc=len.brown@intel.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=lpieralisi@kernel.org \
    --cc=pavel@ucw.cz \
    --cc=rafael@kernel.org \
    --cc=sudeep.holla@arm.com \
    --cc=ulf.hansson@linaro.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).