All of lore.kernel.org
 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 2/5] cpuidle: psci: Mark as PREEMPT_RT safe
Date: Thu, 12 Jan 2023 12:32:19 +0100	[thread overview]
Message-ID: <428c9a9e-f5f3-661f-d3d1-19ca38a75336@linaro.org> (raw)
In-Reply-To: <Y7/oO8s26SKU8eOz@linutronix.de>

On 12/01/2023 12:00, Sebastian Andrzej Siewior wrote:
> On 2022-12-19 16:15:00 [+0100], Krzysztof Kozlowski wrote:
>> The PSCI cpuidle power domain in power_off callback uses
>> __this_cpu_write() so it is PREEMPT_RT safe.  This allows to use it in
> 
> Why does __this_cpu_write() matter here?

I'll reword to "not using sleeping primitives nor spinlock_t"

> 
>> Realtime kernels and solves errors like:
>>
>>   BUG: scheduling while atomic: swapper/2/0/0x00000002
>>   Hardware name: Qualcomm Technologies, Inc. Robotics RB5 (DT)
>>   Call trace:
>>    dump_backtrace.part.0+0xe0/0xf0
>>    show_stack+0x18/0x40
>>    dump_stack_lvl+0x68/0x84
>>    dump_stack+0x18/0x34
>>    __schedule_bug+0x60/0x80
>>    __schedule+0x628/0x800
>>    schedule_rtlock+0x28/0x5c
>>    rtlock_slowlock_locked+0x360/0xd30
>>    rt_spin_lock+0x88/0xb0
>>    genpd_lock_nested_spin+0x1c/0x30
>>    genpd_power_off.part.0.isra.0+0x20c/0x2a0
>>    genpd_runtime_suspend+0x150/0x2bc
>>    __rpm_callback+0x48/0x170
>>    rpm_callback+0x6c/0x7c
>>    rpm_suspend+0x108/0x660
>>    __pm_runtime_suspend+0x4c/0x8c
>>    __psci_enter_domain_idle_state.constprop.0+0x54/0xe0
>>    psci_enter_domain_idle_state+0x18/0x2c
>>    cpuidle_enter_state+0x8c/0x4e0
>>    cpuidle_enter+0x38/0x50
>>    do_idle+0x248/0x2f0
>>    cpu_startup_entry+0x24/0x30
>>    secondary_start_kernel+0x130/0x154
>>    __secondary_switched+0xb0/0xb4
> 
> This is to a sleeping lock (spinlock_t) in an IRQ-off region which
> starts in do_idle(). You could describe the problem and to solution you
> aim for instead pasting a backtrace into the commit description and
> adding a flow in the code.

I'll extend the description.

> 
> I don't see how your commit description matches your change in code. One
> might think "Oh. If I see this pattern, I need an irqsafe lock to fix
> it".


Best regards,
Krzysztof


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

WARNING: multiple messages have this Message-ID (diff)
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 2/5] cpuidle: psci: Mark as PREEMPT_RT safe
Date: Thu, 12 Jan 2023 12:32:19 +0100	[thread overview]
Message-ID: <428c9a9e-f5f3-661f-d3d1-19ca38a75336@linaro.org> (raw)
In-Reply-To: <Y7/oO8s26SKU8eOz@linutronix.de>

On 12/01/2023 12:00, Sebastian Andrzej Siewior wrote:
> On 2022-12-19 16:15:00 [+0100], Krzysztof Kozlowski wrote:
>> The PSCI cpuidle power domain in power_off callback uses
>> __this_cpu_write() so it is PREEMPT_RT safe.  This allows to use it in
> 
> Why does __this_cpu_write() matter here?

I'll reword to "not using sleeping primitives nor spinlock_t"

> 
>> Realtime kernels and solves errors like:
>>
>>   BUG: scheduling while atomic: swapper/2/0/0x00000002
>>   Hardware name: Qualcomm Technologies, Inc. Robotics RB5 (DT)
>>   Call trace:
>>    dump_backtrace.part.0+0xe0/0xf0
>>    show_stack+0x18/0x40
>>    dump_stack_lvl+0x68/0x84
>>    dump_stack+0x18/0x34
>>    __schedule_bug+0x60/0x80
>>    __schedule+0x628/0x800
>>    schedule_rtlock+0x28/0x5c
>>    rtlock_slowlock_locked+0x360/0xd30
>>    rt_spin_lock+0x88/0xb0
>>    genpd_lock_nested_spin+0x1c/0x30
>>    genpd_power_off.part.0.isra.0+0x20c/0x2a0
>>    genpd_runtime_suspend+0x150/0x2bc
>>    __rpm_callback+0x48/0x170
>>    rpm_callback+0x6c/0x7c
>>    rpm_suspend+0x108/0x660
>>    __pm_runtime_suspend+0x4c/0x8c
>>    __psci_enter_domain_idle_state.constprop.0+0x54/0xe0
>>    psci_enter_domain_idle_state+0x18/0x2c
>>    cpuidle_enter_state+0x8c/0x4e0
>>    cpuidle_enter+0x38/0x50
>>    do_idle+0x248/0x2f0
>>    cpu_startup_entry+0x24/0x30
>>    secondary_start_kernel+0x130/0x154
>>    __secondary_switched+0xb0/0xb4
> 
> This is to a sleeping lock (spinlock_t) in an IRQ-off region which
> starts in do_idle(). You could describe the problem and to solution you
> aim for instead pasting a backtrace into the commit description and
> adding a flow in the code.

I'll extend the description.

> 
> I don't see how your commit description matches your change in code. One
> might think "Oh. If I see this pattern, I need an irqsafe lock to fix
> it".


Best regards,
Krzysztof


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

Thread overview: 54+ 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 ` Krzysztof Kozlowski
2022-12-19 15:14 ` [PATCH v2 1/5] PM: domains: Add GENPD_FLAG_RT_SAFE for PREEMPT_RT Krzysztof Kozlowski
2022-12-19 15:14   ` Krzysztof Kozlowski
2023-01-04 15:45   ` Ulf Hansson
2023-01-04 15:45     ` Ulf Hansson
2023-01-06 14:52     ` Krzysztof Kozlowski
2023-01-06 14:52       ` Krzysztof Kozlowski
2023-01-12 10:36       ` Sebastian Andrzej Siewior
2023-01-12 10:36         ` Sebastian Andrzej Siewior
2023-01-12 11:27         ` Krzysztof Kozlowski
2023-01-12 11:27           ` Krzysztof Kozlowski
2023-01-12 10:32   ` Sebastian Andrzej Siewior
2023-01-12 10:32     ` Sebastian Andrzej Siewior
2023-01-12 11:31     ` Krzysztof Kozlowski
2023-01-12 11:31       ` Krzysztof Kozlowski
2022-12-19 15:15 ` [PATCH v2 2/5] cpuidle: psci: Mark as PREEMPT_RT safe Krzysztof Kozlowski
2022-12-19 15:15   ` Krzysztof Kozlowski
2023-01-12 11:00   ` Sebastian Andrzej Siewior
2023-01-12 11:00     ` Sebastian Andrzej Siewior
2023-01-12 11:32     ` Krzysztof Kozlowski [this message]
2023-01-12 11:32       ` Krzysztof Kozlowski
2023-01-17 15:27   ` Ulf Hansson
2023-01-17 15:27     ` Ulf Hansson
2023-01-19 15:40     ` Krzysztof Kozlowski
2023-01-19 15:40       ` Krzysztof Kozlowski
2023-01-19 17:06       ` 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
2022-12-19 15:15   ` Krzysztof Kozlowski
2023-01-12 11:09   ` Sebastian Andrzej Siewior
2023-01-12 11:09     ` Sebastian Andrzej Siewior
2023-01-12 11:34     ` Krzysztof Kozlowski
2023-01-12 11:34       ` Krzysztof Kozlowski
2023-01-30  9:51       ` Sebastian Andrzej Siewior
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
2022-12-19 15:15   ` Krzysztof Kozlowski
2023-01-12 11:13   ` Sebastian Andrzej Siewior
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
2022-12-19 15:15   ` Krzysztof Kozlowski
2023-01-12 11:31   ` Sebastian Andrzej Siewior
2023-01-12 11:31     ` Sebastian Andrzej Siewior
2023-01-12 11:37     ` Krzysztof Kozlowski
2023-01-12 11:37       ` Krzysztof Kozlowski
2023-01-17 15:11   ` Ulf Hansson
2023-01-17 15:11     ` Ulf Hansson
2023-01-19 15:58     ` Krzysztof Kozlowski
2023-01-19 15:58       ` Krzysztof Kozlowski
2022-12-20 21:36 ` [PATCH v2 0/5] PM: Fixes for Realtime systems Adrien Thierry
2022-12-20 21:36   ` Adrien Thierry
2023-01-04 15:15   ` Ulf Hansson
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=428c9a9e-f5f3-661f-d3d1-19ca38a75336@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 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.