All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [dovetail][PATCH] irq_pipeline: Mark inband stalled also on exceptions
@ 2021-06-09 16:24 Jan Kiszka
  2021-06-09 16:40 ` Philippe Gerum
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Kiszka @ 2021-06-09 16:24 UTC (permalink / raw
  To: Xenomai, Philippe Gerum

From: Philippe Gerum <rpm@xenomai.org>

Make sure that inband is marked stalled when entering from user mode,
taking an exception.

This affects x86 which is currently the only arch using generic
irqentry_enter_from_user_mode on exceptions. It fixes this lockdep
warning:

DEBUG_LOCKS_WARN_ON(!lockdep_stage_disabled())
WARNING: CPU: 2 PID: 1477 at ../kernel/locking/lockdep.c:4129 lockdep_hardirqs_on_prepare+0x160/0x1a0

Signed-off-by: Philippe Gerum <rpm@xenomai.org>
Tested-by: Jan Kiszka <jan.kiszka@siemens.com>
---

Works as it should here. If the wording is fine, please add.

 kernel/entry/common.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/entry/common.c b/kernel/entry/common.c
index 995123075375..51af58e61cb8 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);
-- 
2.26.2


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

* Re: [dovetail][PATCH] irq_pipeline: Mark inband stalled also on exceptions
  2021-06-09 16:24 [dovetail][PATCH] irq_pipeline: Mark inband stalled also on exceptions Jan Kiszka
@ 2021-06-09 16:40 ` Philippe Gerum
  2021-06-09 18:34   ` Jan Kiszka
  0 siblings, 1 reply; 3+ messages in thread
From: Philippe Gerum @ 2021-06-09 16:40 UTC (permalink / raw
  To: Jan Kiszka; +Cc: Xenomai


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

> From: Philippe Gerum <rpm@xenomai.org>
>
> Make sure that inband is marked stalled when entering from user mode,
> taking an exception.
>
> This affects x86 which is currently the only arch using generic
> irqentry_enter_from_user_mode on exceptions. It fixes this lockdep
> warning:
>
> DEBUG_LOCKS_WARN_ON(!lockdep_stage_disabled())
> WARNING: CPU: 2 PID: 1477 at ../kernel/locking/lockdep.c:4129 lockdep_hardirqs_on_prepare+0x160/0x1a0
>
> Signed-off-by: Philippe Gerum <rpm@xenomai.org>
> Tested-by: Jan Kiszka <jan.kiszka@siemens.com>
> ---
>
> Works as it should here. If the wording is fine, please add.
>
>  kernel/entry/common.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/entry/common.c b/kernel/entry/common.c
> index 995123075375..51af58e61cb8 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);

Ok, picked it. Thanks.

-- 
Philippe.


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

* Re: [dovetail][PATCH] irq_pipeline: Mark inband stalled also on exceptions
  2021-06-09 16:40 ` Philippe Gerum
@ 2021-06-09 18:34   ` Jan Kiszka
  0 siblings, 0 replies; 3+ messages in thread
From: Jan Kiszka @ 2021-06-09 18:34 UTC (permalink / raw
  To: Philippe Gerum; +Cc: Xenomai

On 09.06.21 18:40, Philippe Gerum wrote:
> 
> Jan Kiszka <jan.kiszka@siemens.com> writes:
> 
>> From: Philippe Gerum <rpm@xenomai.org>
>>
>> Make sure that inband is marked stalled when entering from user mode,
>> taking an exception.
>>
>> This affects x86 which is currently the only arch using generic
>> irqentry_enter_from_user_mode on exceptions. It fixes this lockdep
>> warning:
>>
>> DEBUG_LOCKS_WARN_ON(!lockdep_stage_disabled())
>> WARNING: CPU: 2 PID: 1477 at ../kernel/locking/lockdep.c:4129 lockdep_hardirqs_on_prepare+0x160/0x1a0
>>
>> Signed-off-by: Philippe Gerum <rpm@xenomai.org>
>> Tested-by: Jan Kiszka <jan.kiszka@siemens.com>
>> ---
>>
>> Works as it should here. If the wording is fine, please add.
>>
>>  kernel/entry/common.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/kernel/entry/common.c b/kernel/entry/common.c
>> index 995123075375..51af58e61cb8 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);
> 
> Ok, picked it. Thanks.
> 

For the sake of completeness: CONFIG_PROVE_RAW_LOCK_NESTING=y papered
over this. But I still don't get why as that only affects complete_all()...

Jan

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


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

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

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-06-09 16:24 [dovetail][PATCH] irq_pipeline: Mark inband stalled also on exceptions Jan Kiszka
2021-06-09 16:40 ` Philippe Gerum
2021-06-09 18:34   ` 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.