All of lore.kernel.org
 help / color / mirror / Atom feed
* dovetail: DEBUG_LOCKS_WARN_ON(!lockdep_stage_disabled())
@ 2021-06-09 12:27 Jan Kiszka
  2021-06-09 16:00 ` Philippe Gerum
  0 siblings, 1 reply; 5+ messages in thread
From: Jan Kiszka @ 2021-06-09 12:27 UTC (permalink / raw)
  To: Philippe Gerum; +Cc: Xenomai

Hi Philippe,

currently trying to understand [1]: The check in
lockdep_hardirqs_on_prepare triggers, e.g. over exc_int3 ->
do_int3_user, and then on cond_local_irq_enable().

Where should have the current stage be stalled after exc_int3 so that
lockdep is happy?

Interestingly, I do not get this with my local .config, and I still
didn't find the switches that make the difference.

Jan

[1] https://source.denx.de/Xenomai/xenomai-images/-/jobs/276895#L946

-- 
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: dovetail: DEBUG_LOCKS_WARN_ON(!lockdep_stage_disabled())
  2021-06-09 12:27 dovetail: DEBUG_LOCKS_WARN_ON(!lockdep_stage_disabled()) Jan Kiszka
@ 2021-06-09 16:00 ` Philippe Gerum
  2021-06-09 16:03   ` Philippe Gerum
  2021-06-09 16:05   ` Philippe Gerum
  0 siblings, 2 replies; 5+ messages in thread
From: Philippe Gerum @ 2021-06-09 16:00 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: Xenomai


Jan Kiszka <jan.kiszka@siemens.com> writes:

> Hi Philippe,
>
> currently trying to understand [1]: The check in
> lockdep_hardirqs_on_prepare triggers, e.g. over exc_int3 ->
> do_int3_user, and then on cond_local_irq_enable().
>
> Where should have the current stage be stalled after exc_int3 so that
> lockdep is happy?
>

Nowhere. v5.8 introduced irqentry_enter_from_user_mode() which raw
(debug) traps invoke directly, and this one does not reconcile the hard
irq state with the stall bit.

> Interestingly, I do not get this with my local .config, and I still
> didn't find the switches that make the difference.
>
> Jan
>
> [1] https://source.denx.de/Xenomai/xenomai-images/-/jobs/276895#L946


-- 
Philippe.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: dovetail: DEBUG_LOCKS_WARN_ON(!lockdep_stage_disabled())
  2021-06-09 16:00 ` Philippe Gerum
@ 2021-06-09 16:03   ` Philippe Gerum
  2021-06-09 16:05   ` Philippe Gerum
  1 sibling, 0 replies; 5+ messages in thread
From: Philippe Gerum @ 2021-06-09 16:03 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: Xenomai


Philippe Gerum <rpm@xenomai.org> writes:

> Jan Kiszka <jan.kiszka@siemens.com> writes:
>
>> Hi Philippe,
>>
>> currently trying to understand [1]: The check in
>> lockdep_hardirqs_on_prepare triggers, e.g. over exc_int3 ->
>> do_int3_user, and then on cond_local_irq_enable().
>>
>> Where should have the current stage be stalled after exc_int3 so that
>> lockdep is happy?
>>
>
> Nowhere. v5.8 introduced irqentry_enter_from_user_mode() which raw
> (debug) traps invoke directly, and this one does not reconcile the hard
> irq state with the stall bit.
>
>> Interestingly, I do not get this with my local .config, and I still
>> didn't find the switches that make the difference.
>>
>> Jan
>>
>> [1] https://source.denx.de/Xenomai/xenomai-images/-/jobs/276895#L946

Something like this may help:

diff --git a/kernel/entry/common.c b/kernel/entry/common.c
index 4e81c0c03e5726a..b52f4ac50fd04bb 100644
--- a/kernel/entry/common.c
+++ b/kernel/entry/common.c
@@ -343,6 +343,8 @@ __visible noinstr void syscall_exit_to_user_mode(struct pt_regs *regs)
 
 noinstr void irqentry_enter_from_user_mode(struct pt_regs *regs)
 {
+	WARN_ON_ONCE(irq_pipeline_debug() && irqs_disabled());
+	stall_inband_nocheck();
 	enter_from_user_mode(regs);
 }
 
@@ -373,8 +375,6 @@ noinstr irqentry_state_t irqentry_enter(struct pt_regs *regs)
 
 	if (user_mode(regs)) {
 #ifdef CONFIG_IRQ_PIPELINE
-		WARN_ON_ONCE(irq_pipeline_debug() && irqs_disabled());
-		stall_inband_nocheck();
 		ret.stage_info = IRQENTRY_INBAND_UNSTALLED;
 #endif
 		irqentry_enter_from_user_mode(regs);

-- 
Philippe.


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: dovetail: DEBUG_LOCKS_WARN_ON(!lockdep_stage_disabled())
  2021-06-09 16:00 ` Philippe Gerum
  2021-06-09 16:03   ` Philippe Gerum
@ 2021-06-09 16:05   ` Philippe Gerum
  2021-06-09 16:07     ` Jan Kiszka
  1 sibling, 1 reply; 5+ messages in thread
From: Philippe Gerum @ 2021-06-09 16:05 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: Xenomai


Philippe Gerum <rpm@xenomai.org> writes:

> Jan Kiszka <jan.kiszka@siemens.com> writes:
>
>> Hi Philippe,
>>
>> currently trying to understand [1]: The check in
>> lockdep_hardirqs_on_prepare triggers, e.g. over exc_int3 ->
>> do_int3_user, and then on cond_local_irq_enable().
>>
>> Where should have the current stage be stalled after exc_int3 so that
>> lockdep is happy?
>>
>
> Nowhere. v5.8 introduced irqentry_enter_from_user_mode() which raw
> (debug) traps invoke directly, and this one does not reconcile the hard
> irq state with the stall bit.
>

Unfortunately, arm and arm64 do not use the generic kernel entry code
yet, so we can exercise the Dovetail-related code only with x86.

-- 
Philippe.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: dovetail: DEBUG_LOCKS_WARN_ON(!lockdep_stage_disabled())
  2021-06-09 16:05   ` Philippe Gerum
@ 2021-06-09 16:07     ` Jan Kiszka
  0 siblings, 0 replies; 5+ messages in thread
From: Jan Kiszka @ 2021-06-09 16:07 UTC (permalink / raw)
  To: Philippe Gerum; +Cc: Xenomai

On 09.06.21 18:05, Philippe Gerum wrote:
> 
> Philippe Gerum <rpm@xenomai.org> writes:
> 
>> Jan Kiszka <jan.kiszka@siemens.com> writes:
>>
>>> Hi Philippe,
>>>
>>> currently trying to understand [1]: The check in
>>> lockdep_hardirqs_on_prepare triggers, e.g. over exc_int3 ->
>>> do_int3_user, and then on cond_local_irq_enable().
>>>
>>> Where should have the current stage be stalled after exc_int3 so that
>>> lockdep is happy?
>>>
>>
>> Nowhere. v5.8 introduced irqentry_enter_from_user_mode() which raw
>> (debug) traps invoke directly, and this one does not reconcile the hard
>> irq state with the stall bit.
>>
> 
> Unfortunately, arm and arm64 do not use the generic kernel entry code
> yet, so we can exercise the Dovetail-related code only with x86.
> 

Yeah, but once they do, things should Just Work (TM) by then. ;)

Testing your fix right now.

Thanks,
Jan

-- 
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-06-09 16:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-09 12:27 dovetail: DEBUG_LOCKS_WARN_ON(!lockdep_stage_disabled()) Jan Kiszka
2021-06-09 16:00 ` Philippe Gerum
2021-06-09 16:03   ` Philippe Gerum
2021-06-09 16:05   ` Philippe Gerum
2021-06-09 16:07     ` Jan Kiszka

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.