[Xenomai] [PULL] ipipe 4.9 update

2018-04-06 Thread Jan Kiszka
The following changes since commit 3d21f886ffae3ffdef54a19ec53393482626a84c:

  ipipe-core-4.9.90-x86-6 (2018-03-26 17:36:13 +0200)

are available in the git repository at:

  git://git.xenomai.org/ipipe-jki 

for you to fetch changes up to 3fac4646875dbbab6969cf080a02467b578c55be:

  Merge tag 'v4.9.92' into for-upstream/4.9 (2018-04-06 18:45:31 +0200)


(excluding stable merge)
Jan Kiszka (4):
  arm/ipipe: Avoid open-coded __ipipe_call_mayday
  ipipe: Fix root domain guard in preempt_schedule_notrace
  x86/ipipe: Deny JUMP_LABEL over I-pipe
  x86/ipipe: Disable access_ok context under I-pipe

 arch/arm/kernel/ipipe.c| 3 +--
 arch/x86/Kconfig   | 2 +-
 arch/x86/include/asm/uaccess.h | 2 +-
 kernel/sched/core.c| 2 +-
 4 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/arch/arm/kernel/ipipe.c b/arch/arm/kernel/ipipe.c
index b95c8128c5de..e7642bd28871 100644
--- a/arch/arm/kernel/ipipe.c
+++ b/arch/arm/kernel/ipipe.c
@@ -354,8 +354,7 @@ void __ipipe_exit_irq(struct pt_regs *regs)
 * so prefer test then maybe clear over
 * test_and_clear.
 */
-   ipipe_clear_thread_flag(TIP_MAYDAY);
-   __ipipe_notify_trap(IPIPE_TRAP_MAYDAY, regs);
+   __ipipe_call_mayday(regs);
}
 }
 
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 1bc07b02..f553d85db062 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -83,7 +83,7 @@ config X86
select HAVE_ARCH_AUDITSYSCALL
select HAVE_ARCH_HARDENED_USERCOPY
select HAVE_ARCH_HUGE_VMAP  if X86_64 || X86_PAE
-   select HAVE_ARCH_JUMP_LABEL
+   select HAVE_ARCH_JUMP_LABEL if !IPIPE
select HAVE_ARCH_KASAN  if X86_64 && SPARSEMEM_VMEMMAP
select HAVE_ARCH_KGDB
select HAVE_ARCH_KMEMCHECK
diff --git a/arch/x86/include/asm/uaccess.h b/arch/x86/include/asm/uaccess.h
index a8d85a687cf4..bffa3f09067e 100644
--- a/arch/x86/include/asm/uaccess.h
+++ b/arch/x86/include/asm/uaccess.h
@@ -68,7 +68,7 @@ static inline bool __chk_range_not_ok(unsigned long addr, 
unsigned long size, un
__chk_range_not_ok((unsigned long __force)(addr), size, limit); \
 })
 
-#ifdef CONFIG_DEBUG_ATOMIC_SLEEP
+#if defined(CONFIG_DEBUG_ATOMIC_SLEEP) && !defined(CONFIG_IPIPE)
 # define WARN_ON_IN_IRQ()  WARN_ON_ONCE(!in_task())
 #else
 # define WARN_ON_IN_IRQ()
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 37a9420059e3..2f781dcede7a 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -3582,7 +3582,7 @@ asmlinkage __visible void __sched notrace 
preempt_schedule_notrace(void)
 {
enum ctx_state prev_ctx;
 
-   if (likely(!preemptible() || !ipipe_root_p))
+   if (likely(!preemptible() || !ipipe_root_p || hard_irqs_disabled()))
return;
 
do {

___
Xenomai mailing list
Xenomai@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai


Re: [Xenomai] [PULL] ipipe 4.9 update

2018-04-07 Thread Philippe Gerum
On 04/06/2018 07:21 PM, Jan Kiszka wrote:
> The following changes since commit 3d21f886ffae3ffdef54a19ec53393482626a84c:
> 
>   ipipe-core-4.9.90-x86-6 (2018-03-26 17:36:13 +0200)
> 
> are available in the git repository at:
> 
>   git://git.xenomai.org/ipipe-jki 
> 
> for you to fetch changes up to 3fac4646875dbbab6969cf080a02467b578c55be:
> 
>   Merge tag 'v4.9.92' into for-upstream/4.9 (2018-04-06 18:45:31 +0200)
> 
> 
> (excluding stable merge)
> Jan Kiszka (4):
>   arm/ipipe: Avoid open-coded __ipipe_call_mayday
>   ipipe: Fix root domain guard in preempt_schedule_notrace
>   x86/ipipe: Deny JUMP_LABEL over I-pipe
>   x86/ipipe: Disable access_ok context under I-pipe
> 
>  arch/arm/kernel/ipipe.c| 3 +--
>  arch/x86/Kconfig   | 2 +-
>  arch/x86/include/asm/uaccess.h | 2 +-
>  kernel/sched/core.c| 2 +-
>  4 files changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/arm/kernel/ipipe.c b/arch/arm/kernel/ipipe.c
> index b95c8128c5de..e7642bd28871 100644
> --- a/arch/arm/kernel/ipipe.c
> +++ b/arch/arm/kernel/ipipe.c
> @@ -354,8 +354,7 @@ void __ipipe_exit_irq(struct pt_regs *regs)
>* so prefer test then maybe clear over
>* test_and_clear.
>*/
> - ipipe_clear_thread_flag(TIP_MAYDAY);
> - __ipipe_notify_trap(IPIPE_TRAP_MAYDAY, regs);
> + __ipipe_call_mayday(regs);
>   }
>  }

Nack. If the purpose is to prevent open coding, then you should provide
a light __ipipe_call_mayday() which does not fiddle with the IRQ state
uselessly. __ipipe_irq_exit does run with hard IRQs off by design.

-- 
Philippe.

___
Xenomai mailing list
Xenomai@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai


Re: [Xenomai] [PULL] ipipe 4.9 update

2018-04-07 Thread Jan Kiszka
On 2018-04-07 18:58, Philippe Gerum wrote:
> On 04/06/2018 07:21 PM, Jan Kiszka wrote:
>> The following changes since commit 3d21f886ffae3ffdef54a19ec53393482626a84c:
>>
>>   ipipe-core-4.9.90-x86-6 (2018-03-26 17:36:13 +0200)
>>
>> are available in the git repository at:
>>
>>   git://git.xenomai.org/ipipe-jki 
>>
>> for you to fetch changes up to 3fac4646875dbbab6969cf080a02467b578c55be:
>>
>>   Merge tag 'v4.9.92' into for-upstream/4.9 (2018-04-06 18:45:31 +0200)
>>
>> 
>> (excluding stable merge)
>> Jan Kiszka (4):
>>   arm/ipipe: Avoid open-coded __ipipe_call_mayday
>>   ipipe: Fix root domain guard in preempt_schedule_notrace
>>   x86/ipipe: Deny JUMP_LABEL over I-pipe
>>   x86/ipipe: Disable access_ok context under I-pipe
>>
>>  arch/arm/kernel/ipipe.c| 3 +--
>>  arch/x86/Kconfig   | 2 +-
>>  arch/x86/include/asm/uaccess.h | 2 +-
>>  kernel/sched/core.c| 2 +-
>>  4 files changed, 4 insertions(+), 5 deletions(-)
>>
>> diff --git a/arch/arm/kernel/ipipe.c b/arch/arm/kernel/ipipe.c
>> index b95c8128c5de..e7642bd28871 100644
>> --- a/arch/arm/kernel/ipipe.c
>> +++ b/arch/arm/kernel/ipipe.c
>> @@ -354,8 +354,7 @@ void __ipipe_exit_irq(struct pt_regs *regs)
>>   * so prefer test then maybe clear over
>>   * test_and_clear.
>>   */
>> -ipipe_clear_thread_flag(TIP_MAYDAY);
>> -__ipipe_notify_trap(IPIPE_TRAP_MAYDAY, regs);
>> +__ipipe_call_mayday(regs);
>>  }
>>  }
> 
> Nack. If the purpose is to prevent open coding, then you should provide
> a light __ipipe_call_mayday() which does not fiddle with the IRQ state
> uselessly. __ipipe_irq_exit does run with hard IRQs off by design.

You already merged this into 4.4. This is just the same thing with the
same reasoning.

Jan

-- next part --
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: OpenPGP digital signature
URL: 

___
Xenomai mailing list
Xenomai@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai


Re: [Xenomai] [PULL] ipipe 4.9 update

2018-04-07 Thread Philippe Gerum
On 04/07/2018 07:04 PM, Jan Kiszka wrote:
> On 2018-04-07 18:58, Philippe Gerum wrote:
>> On 04/06/2018 07:21 PM, Jan Kiszka wrote:
>>> The following changes since commit 3d21f886ffae3ffdef54a19ec53393482626a84c:
>>>
>>>   ipipe-core-4.9.90-x86-6 (2018-03-26 17:36:13 +0200)
>>>
>>> are available in the git repository at:
>>>
>>>   git://git.xenomai.org/ipipe-jki 
>>>
>>> for you to fetch changes up to 3fac4646875dbbab6969cf080a02467b578c55be:
>>>
>>>   Merge tag 'v4.9.92' into for-upstream/4.9 (2018-04-06 18:45:31 +0200)
>>>
>>> 
>>> (excluding stable merge)
>>> Jan Kiszka (4):
>>>   arm/ipipe: Avoid open-coded __ipipe_call_mayday
>>>   ipipe: Fix root domain guard in preempt_schedule_notrace
>>>   x86/ipipe: Deny JUMP_LABEL over I-pipe
>>>   x86/ipipe: Disable access_ok context under I-pipe
>>>
>>>  arch/arm/kernel/ipipe.c| 3 +--
>>>  arch/x86/Kconfig   | 2 +-
>>>  arch/x86/include/asm/uaccess.h | 2 +-
>>>  kernel/sched/core.c| 2 +-
>>>  4 files changed, 4 insertions(+), 5 deletions(-)
>>>
>>> diff --git a/arch/arm/kernel/ipipe.c b/arch/arm/kernel/ipipe.c
>>> index b95c8128c5de..e7642bd28871 100644
>>> --- a/arch/arm/kernel/ipipe.c
>>> +++ b/arch/arm/kernel/ipipe.c
>>> @@ -354,8 +354,7 @@ void __ipipe_exit_irq(struct pt_regs *regs)
>>>  * so prefer test then maybe clear over
>>>  * test_and_clear.
>>>  */
>>> -   ipipe_clear_thread_flag(TIP_MAYDAY);
>>> -   __ipipe_notify_trap(IPIPE_TRAP_MAYDAY, regs);
>>> +   __ipipe_call_mayday(regs);
>>> }
>>>  }
>>
>> Nack. If the purpose is to prevent open coding, then you should provide
>> a light __ipipe_call_mayday() which does not fiddle with the IRQ state
>> uselessly. __ipipe_irq_exit does run with hard IRQs off by design.
> 
> You already merged this into 4.4. This is just the same thing with the
> same reasoning.
> 

Yes, but my comment made clear that it was useless. Maybe the second
submission could account for this.

-- 
Philippe.

___
Xenomai mailing list
Xenomai@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai


Re: [Xenomai] [PULL] ipipe 4.9 update

2018-04-07 Thread Jan Kiszka
On 2018-04-07 19:06, Philippe Gerum wrote:
> On 04/07/2018 07:04 PM, Jan Kiszka wrote:
>> On 2018-04-07 18:58, Philippe Gerum wrote:
>>> On 04/06/2018 07:21 PM, Jan Kiszka wrote:
 The following changes since commit 
 3d21f886ffae3ffdef54a19ec53393482626a84c:

   ipipe-core-4.9.90-x86-6 (2018-03-26 17:36:13 +0200)

 are available in the git repository at:

   git://git.xenomai.org/ipipe-jki 

 for you to fetch changes up to 3fac4646875dbbab6969cf080a02467b578c55be:

   Merge tag 'v4.9.92' into for-upstream/4.9 (2018-04-06 18:45:31 +0200)

 
 (excluding stable merge)
 Jan Kiszka (4):
   arm/ipipe: Avoid open-coded __ipipe_call_mayday
   ipipe: Fix root domain guard in preempt_schedule_notrace
   x86/ipipe: Deny JUMP_LABEL over I-pipe
   x86/ipipe: Disable access_ok context under I-pipe

  arch/arm/kernel/ipipe.c| 3 +--
  arch/x86/Kconfig   | 2 +-
  arch/x86/include/asm/uaccess.h | 2 +-
  kernel/sched/core.c| 2 +-
  4 files changed, 4 insertions(+), 5 deletions(-)

 diff --git a/arch/arm/kernel/ipipe.c b/arch/arm/kernel/ipipe.c
 index b95c8128c5de..e7642bd28871 100644
 --- a/arch/arm/kernel/ipipe.c
 +++ b/arch/arm/kernel/ipipe.c
 @@ -354,8 +354,7 @@ void __ipipe_exit_irq(struct pt_regs *regs)
 * so prefer test then maybe clear over
 * test_and_clear.
 */
 -  ipipe_clear_thread_flag(TIP_MAYDAY);
 -  __ipipe_notify_trap(IPIPE_TRAP_MAYDAY, regs);
 +  __ipipe_call_mayday(regs);
}
  }
>>>
>>> Nack. If the purpose is to prevent open coding, then you should provide
>>> a light __ipipe_call_mayday() which does not fiddle with the IRQ state
>>> uselessly. __ipipe_irq_exit does run with hard IRQs off by design.
>>
>> You already merged this into 4.4. This is just the same thing with the
>> same reasoning.
>>
> 
> Yes, but my comment made clear that it was useless. Maybe the second
> submission could account for this.
> 

I doubt this reasoning: __ipipe_call_mayday is not hot-path. So I see no
value in optimizing the - granted - unneeded hard_local_irq_save away by
providing a variant of __ipipe_call_mayday that does not do that.

Jan

-- next part --
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: OpenPGP digital signature
URL: 

___
Xenomai mailing list
Xenomai@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai


Re: [Xenomai] [PULL] ipipe 4.9 update

2018-04-07 Thread Philippe Gerum
On 04/07/2018 07:16 PM, Jan Kiszka wrote:
> On 2018-04-07 19:06, Philippe Gerum wrote:
>> On 04/07/2018 07:04 PM, Jan Kiszka wrote:
>>> On 2018-04-07 18:58, Philippe Gerum wrote:
 On 04/06/2018 07:21 PM, Jan Kiszka wrote:
> The following changes since commit 
> 3d21f886ffae3ffdef54a19ec53393482626a84c:
>
>   ipipe-core-4.9.90-x86-6 (2018-03-26 17:36:13 +0200)
>
> are available in the git repository at:
>
>   git://git.xenomai.org/ipipe-jki 
>
> for you to fetch changes up to 3fac4646875dbbab6969cf080a02467b578c55be:
>
>   Merge tag 'v4.9.92' into for-upstream/4.9 (2018-04-06 18:45:31 +0200)
>
> 
> (excluding stable merge)
> Jan Kiszka (4):
>   arm/ipipe: Avoid open-coded __ipipe_call_mayday
>   ipipe: Fix root domain guard in preempt_schedule_notrace
>   x86/ipipe: Deny JUMP_LABEL over I-pipe
>   x86/ipipe: Disable access_ok context under I-pipe
>
>  arch/arm/kernel/ipipe.c| 3 +--
>  arch/x86/Kconfig   | 2 +-
>  arch/x86/include/asm/uaccess.h | 2 +-
>  kernel/sched/core.c| 2 +-
>  4 files changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/arch/arm/kernel/ipipe.c b/arch/arm/kernel/ipipe.c
> index b95c8128c5de..e7642bd28871 100644
> --- a/arch/arm/kernel/ipipe.c
> +++ b/arch/arm/kernel/ipipe.c
> @@ -354,8 +354,7 @@ void __ipipe_exit_irq(struct pt_regs *regs)
>* so prefer test then maybe clear over
>* test_and_clear.
>*/
> - ipipe_clear_thread_flag(TIP_MAYDAY);
> - __ipipe_notify_trap(IPIPE_TRAP_MAYDAY, regs);
> + __ipipe_call_mayday(regs);
>   }
>  }

 Nack. If the purpose is to prevent open coding, then you should provide
 a light __ipipe_call_mayday() which does not fiddle with the IRQ state
 uselessly. __ipipe_irq_exit does run with hard IRQs off by design.
>>>
>>> You already merged this into 4.4. This is just the same thing with the
>>> same reasoning.
>>>
>>
>> Yes, but my comment made clear that it was useless. Maybe the second
>> submission could account for this.
>>
> 
> I doubt this reasoning: __ipipe_call_mayday is not hot-path. So I see no
> value in optimizing the - granted - unneeded hard_local_irq_save away by
> providing a variant of __ipipe_call_mayday that does not do that.
> 

Again, please provide specifics.

-- 
Philippe.

___
Xenomai mailing list
Xenomai@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai


Re: [Xenomai] [PULL] ipipe 4.9 update

2018-04-07 Thread Philippe Gerum
On 04/07/2018 07:21 PM, Philippe Gerum wrote:
> On 04/07/2018 07:16 PM, Jan Kiszka wrote:
>> On 2018-04-07 19:06, Philippe Gerum wrote:
>>> On 04/07/2018 07:04 PM, Jan Kiszka wrote:
 On 2018-04-07 18:58, Philippe Gerum wrote:
> On 04/06/2018 07:21 PM, Jan Kiszka wrote:
>> The following changes since commit 
>> 3d21f886ffae3ffdef54a19ec53393482626a84c:
>>
>>   ipipe-core-4.9.90-x86-6 (2018-03-26 17:36:13 +0200)
>>
>> are available in the git repository at:
>>
>>   git://git.xenomai.org/ipipe-jki 
>>
>> for you to fetch changes up to 3fac4646875dbbab6969cf080a02467b578c55be:
>>
>>   Merge tag 'v4.9.92' into for-upstream/4.9 (2018-04-06 18:45:31 +0200)
>>
>> 
>> (excluding stable merge)
>> Jan Kiszka (4):
>>   arm/ipipe: Avoid open-coded __ipipe_call_mayday
>>   ipipe: Fix root domain guard in preempt_schedule_notrace
>>   x86/ipipe: Deny JUMP_LABEL over I-pipe
>>   x86/ipipe: Disable access_ok context under I-pipe
>>
>>  arch/arm/kernel/ipipe.c| 3 +--
>>  arch/x86/Kconfig   | 2 +-
>>  arch/x86/include/asm/uaccess.h | 2 +-
>>  kernel/sched/core.c| 2 +-
>>  4 files changed, 4 insertions(+), 5 deletions(-)
>>
>> diff --git a/arch/arm/kernel/ipipe.c b/arch/arm/kernel/ipipe.c
>> index b95c8128c5de..e7642bd28871 100644
>> --- a/arch/arm/kernel/ipipe.c
>> +++ b/arch/arm/kernel/ipipe.c
>> @@ -354,8 +354,7 @@ void __ipipe_exit_irq(struct pt_regs *regs)
>>   * so prefer test then maybe clear over
>>   * test_and_clear.
>>   */
>> -ipipe_clear_thread_flag(TIP_MAYDAY);
>> -__ipipe_notify_trap(IPIPE_TRAP_MAYDAY, regs);
>> +__ipipe_call_mayday(regs);
>>  }
>>  }
>
> Nack. If the purpose is to prevent open coding, then you should provide
> a light __ipipe_call_mayday() which does not fiddle with the IRQ state
> uselessly. __ipipe_irq_exit does run with hard IRQs off by design.

 You already merged this into 4.4. This is just the same thing with the
 same reasoning.

>>>
>>> Yes, but my comment made clear that it was useless. Maybe the second
>>> submission could account for this.
>>>
>>
>> I doubt this reasoning: __ipipe_call_mayday is not hot-path. So I see no
>> value in optimizing the - granted - unneeded hard_local_irq_save away by
>> providing a variant of __ipipe_call_mayday that does not do that.
>>
> 
> Again, please provide specifics.
> 

Sorry, I was responding to another post of yours. Misrouting on my end.
Agreed on the non hot-path stuff. I'm reverting my Nack on this one.

-- 
Philippe.

___
Xenomai mailing list
Xenomai@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai