All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/process: ipipe: prevent false positive in testing for preemptible section
@ 2018-10-25 13:20 Philippe Gerum
  2018-10-25 22:37 ` Alec Ari
  2018-10-26 13:28 ` Jan Kiszka
  0 siblings, 2 replies; 4+ messages in thread
From: Philippe Gerum @ 2018-10-25 13:20 UTC (permalink / raw)
  To: Henning Schild; +Cc: xenomai, Jan Kiszka, Philippe Gerum

We may call switch_to_bitmap() from the head stage when a co-kernel
switches to a new thread context, in which case IRQs are hard
disabled, although the root stage might be unstalled.

Make sure the preemption debug code in refresh_tss_limit() is aware of
this.
---
 arch/x86/include/asm/desc.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/include/asm/desc.h b/arch/x86/include/asm/desc.h
index 0e3758c0c954..7a4cb4333df3 100644
--- a/arch/x86/include/asm/desc.h
+++ b/arch/x86/include/asm/desc.h
@@ -309,7 +309,7 @@ static inline void force_reload_TR(void)
  */
 static inline void refresh_tss_limit(void)
 {
-	DEBUG_LOCKS_WARN_ON(preemptible());
+	DEBUG_LOCKS_WARN_ON(!hard_irqs_disabled() && preemptible());
 
 	if (unlikely(this_cpu_read(__tss_limit_invalid)))
 		force_reload_TR();
-- 
2.17.2



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

* Re: [PATCH] x86/process: ipipe: prevent false positive in testing for preemptible section
  2018-10-25 13:20 [PATCH] x86/process: ipipe: prevent false positive in testing for preemptible section Philippe Gerum
@ 2018-10-25 22:37 ` Alec Ari
  2018-10-26 13:28 ` Jan Kiszka
  1 sibling, 0 replies; 4+ messages in thread
From: Alec Ari @ 2018-10-25 22:37 UTC (permalink / raw)
  To: Xenomai

Hahaha, that works too! Thank you for fixing this so soon, the right way!


Alec


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

* Re: [PATCH] x86/process: ipipe: prevent false positive in testing for preemptible section
  2018-10-25 13:20 [PATCH] x86/process: ipipe: prevent false positive in testing for preemptible section Philippe Gerum
  2018-10-25 22:37 ` Alec Ari
@ 2018-10-26 13:28 ` Jan Kiszka
  2018-10-26 14:34   ` Philippe Gerum
  1 sibling, 1 reply; 4+ messages in thread
From: Jan Kiszka @ 2018-10-26 13:28 UTC (permalink / raw)
  To: Philippe Gerum, Henning Schild; +Cc: xenomai

On 25.10.18 14:20, Philippe Gerum wrote:
> We may call switch_to_bitmap() from the head stage when a co-kernel
> switches to a new thread context, in which case IRQs are hard
> disabled, although the root stage might be unstalled.
> 
> Make sure the preemption debug code in refresh_tss_limit() is aware of
> this.
> ---
>   arch/x86/include/asm/desc.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/x86/include/asm/desc.h b/arch/x86/include/asm/desc.h
> index 0e3758c0c954..7a4cb4333df3 100644
> --- a/arch/x86/include/asm/desc.h
> +++ b/arch/x86/include/asm/desc.h
> @@ -309,7 +309,7 @@ static inline void force_reload_TR(void)
>    */
>   static inline void refresh_tss_limit(void)
>   {
> -	DEBUG_LOCKS_WARN_ON(preemptible());
> +	DEBUG_LOCKS_WARN_ON(!hard_irqs_disabled() && preemptible());
>   
>   	if (unlikely(this_cpu_read(__tss_limit_invalid)))
>   		force_reload_TR();
> 

This is 4.14-only, right?

Jan

-- 
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux


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

* Re: [PATCH] x86/process: ipipe: prevent false positive in testing for preemptible section
  2018-10-26 13:28 ` Jan Kiszka
@ 2018-10-26 14:34   ` Philippe Gerum
  0 siblings, 0 replies; 4+ messages in thread
From: Philippe Gerum @ 2018-10-26 14:34 UTC (permalink / raw)
  To: Jan Kiszka, Henning Schild; +Cc: xenomai

On 10/26/18 3:28 PM, Jan Kiszka wrote:
> On 25.10.18 14:20, Philippe Gerum wrote:
>> We may call switch_to_bitmap() from the head stage when a co-kernel
>> switches to a new thread context, in which case IRQs are hard
>> disabled, although the root stage might be unstalled.
>>
>> Make sure the preemption debug code in refresh_tss_limit() is aware of
>> this.
>> ---
>>   arch/x86/include/asm/desc.h | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/arch/x86/include/asm/desc.h b/arch/x86/include/asm/desc.h
>> index 0e3758c0c954..7a4cb4333df3 100644
>> --- a/arch/x86/include/asm/desc.h
>> +++ b/arch/x86/include/asm/desc.h
>> @@ -309,7 +309,7 @@ static inline void force_reload_TR(void)
>>    */
>>   static inline void refresh_tss_limit(void)
>>   {
>> -    DEBUG_LOCKS_WARN_ON(preemptible());
>> +    DEBUG_LOCKS_WARN_ON(!hard_irqs_disabled() && preemptible());
>>         if (unlikely(this_cpu_read(__tss_limit_invalid)))
>>           force_reload_TR();
>>
> 
> This is 4.14-only, right?
> 

it is.

-- 
Philippe.


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

end of thread, other threads:[~2018-10-26 14:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-25 13:20 [PATCH] x86/process: ipipe: prevent false positive in testing for preemptible section Philippe Gerum
2018-10-25 22:37 ` Alec Ari
2018-10-26 13:28 ` Jan Kiszka
2018-10-26 14:34   ` Philippe Gerum

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.