Re: [linux-yocto][v4.19/standard/preempt-rt/base][PATCH] sched/core: Fix CPU offline/online process

2020-11-19 Thread Bruce Ashfield
Thanks for the fixups!

These are now merged.

Bruce

In message: [linux-yocto][v4.19/standard/preempt-rt/base][PATCH] sched/core: 
Fix CPU offline/online process
on 16/11/2020 Daniel Dragomir wrote:

> From: Daniel Dragomir 
> 
> This error was introduced in commit d02636e8d3 ("Merge branch
> 'v4.19/standard/base' into v4.19/standard/preempt-rt/base")
> when a merge conflict has overwrited the changes from commit
> 373491f1f4 ("sched/core: Fix illegal RCU from offline CPUs").
> 
> This BUG occurs when running cpu_hotplug_stress testcase from
> KTS or when stressing one CPU by switching it online/offline
> (echo 0 and 1 in /sys/devices/system/cpu/cpu0/online).
> 
> kernel BUG at kernel/fork.c:633!
> Internal error: Oops - BUG: 0 [#1] PREEMPT SMP
> Modules linked in:
> Process sh (pid: 2016, stack limit = 0xca5ad524)
> CPU: 10 PID: 2016 Comm: sh Not tainted 4.19.131-rt30 axxia_gen2
> Hardware name: AXM56xx Victoria (DT)
> pstate: 6005 (nZCv daif -PAN -UAO)
> pc : __mmdrop+0x120/0x138
> lr : finish_cpu+0x68/0x70
> sp : ff8012153a40
> x29: ff8012153a40 x28: ffc07b389e00
> x27:  x26: 00407610f000
> x25: ffc07ee62ee0 x24: 
> x23: ff80080dfc20 x22: ff8008d9a9d8
> x21: ff8008d53ee0 x20: 0055
> x19: ff8008dc1b58 x18: 0001
> x17:  x16: 
> x15:  x14: ff8008d89688
> x13: ff8088d918d7 x12: ff8008d918e0
> x11: ff8008da4000 x10: ff8012153a00
> x9 : ffd0 x8 : ff80121539d0
> x7 :  x6 : 0001
> x5 : fffb x4 : 0030
> x3 : 0030 x2 : ff8008dc1b58
> x1 : ff8008dc1ba4 x0 : ff8008dc1b58
> Call trace:
>  __mmdrop+0x120/0x138
>  finish_cpu+0x68/0x70
>  cpuhp_invoke_callback+0xa8/0x800
>  _cpu_down+0x100/0x220
>  do_cpu_down+0x48/0x70
>  cpu_down+0x24/0x30
>  cpu_subsys_offline+0x20/0x30
>  device_offline+0xa4/0xd0
>  online_store+0x60/0xc0
>  dev_attr_store+0x44/0x60
>  sysfs_kf_write+0x5c/0x78
>  kernfs_fop_write+0xd8/0x1d0
>  __vfs_write+0x60/0x178
>  vfs_write+0xac/0x1b0
>  ksys_write+0x74/0xe8
>  __arm64_sys_write+0x24/0x30
>  el0_svc_common+0xa4/0x1a0
>  el0_svc_compat_handler+0x30/0x40
>  el0_svc_compat+0x8/0x18
>  Code: a94153f3 a9425bf5 a8c37bfd d65f03c0 (d421)
> ---[ end trace 0002 ]---
> BUG: Bad rss-counter state mm:1136ddcb idx:0 val:1012
> BUG: Bad rss-counter state mm:1136ddcb idx:1 val:5902
> BUG: non-zero pgtables_bytes on freeing mm: 180224
> 
> Signed-off-by: Daniel Dragomir 
> ---
>  kernel/sched/core.c | 7 ++-
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index 218b93a..c62dbf9 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -5702,11 +5702,8 @@ void idle_task_exit(void)
>   switch_mm(mm, _mm, current);
>   finish_arch_post_lock_switch();
>   }
> - /*
> -  * Defer the cleanup to an alive cpu. On RT we can neither
> -  * call mmdrop() nor mmdrop_delayed() from here.
> -  */
> - per_cpu(idle_last_mm, smp_processor_id()) = mm;
> +
> + /* finish_cpu(), as ran on the BP, will clean up the active_mm state */
>  }
>  
>  /*
> -- 
> 2.7.4
> 

> 
> 
> 



-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#9173): 
https://lists.yoctoproject.org/g/linux-yocto/message/9173
Mute This Topic: https://lists.yoctoproject.org/mt/78366960/21656
Group Owner: linux-yocto+ow...@lists.yoctoproject.org
Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[linux-yocto][v4.19/standard/preempt-rt/base][PATCH] sched/core: Fix CPU offline/online process

2020-11-16 Thread Daniel Dragomir
From: Daniel Dragomir 

This error was introduced in commit d02636e8d3 ("Merge branch
'v4.19/standard/base' into v4.19/standard/preempt-rt/base")
when a merge conflict has overwrited the changes from commit
373491f1f4 ("sched/core: Fix illegal RCU from offline CPUs").

This BUG occurs when running cpu_hotplug_stress testcase from
KTS or when stressing one CPU by switching it online/offline
(echo 0 and 1 in /sys/devices/system/cpu/cpu0/online).

kernel BUG at kernel/fork.c:633!
Internal error: Oops - BUG: 0 [#1] PREEMPT SMP
Modules linked in:
Process sh (pid: 2016, stack limit = 0xca5ad524)
CPU: 10 PID: 2016 Comm: sh Not tainted 4.19.131-rt30 axxia_gen2
Hardware name: AXM56xx Victoria (DT)
pstate: 6005 (nZCv daif -PAN -UAO)
pc : __mmdrop+0x120/0x138
lr : finish_cpu+0x68/0x70
sp : ff8012153a40
x29: ff8012153a40 x28: ffc07b389e00
x27:  x26: 00407610f000
x25: ffc07ee62ee0 x24: 
x23: ff80080dfc20 x22: ff8008d9a9d8
x21: ff8008d53ee0 x20: 0055
x19: ff8008dc1b58 x18: 0001
x17:  x16: 
x15:  x14: ff8008d89688
x13: ff8088d918d7 x12: ff8008d918e0
x11: ff8008da4000 x10: ff8012153a00
x9 : ffd0 x8 : ff80121539d0
x7 :  x6 : 0001
x5 : fffb x4 : 0030
x3 : 0030 x2 : ff8008dc1b58
x1 : ff8008dc1ba4 x0 : ff8008dc1b58
Call trace:
 __mmdrop+0x120/0x138
 finish_cpu+0x68/0x70
 cpuhp_invoke_callback+0xa8/0x800
 _cpu_down+0x100/0x220
 do_cpu_down+0x48/0x70
 cpu_down+0x24/0x30
 cpu_subsys_offline+0x20/0x30
 device_offline+0xa4/0xd0
 online_store+0x60/0xc0
 dev_attr_store+0x44/0x60
 sysfs_kf_write+0x5c/0x78
 kernfs_fop_write+0xd8/0x1d0
 __vfs_write+0x60/0x178
 vfs_write+0xac/0x1b0
 ksys_write+0x74/0xe8
 __arm64_sys_write+0x24/0x30
 el0_svc_common+0xa4/0x1a0
 el0_svc_compat_handler+0x30/0x40
 el0_svc_compat+0x8/0x18
 Code: a94153f3 a9425bf5 a8c37bfd d65f03c0 (d421)
---[ end trace 0002 ]---
BUG: Bad rss-counter state mm:1136ddcb idx:0 val:1012
BUG: Bad rss-counter state mm:1136ddcb idx:1 val:5902
BUG: non-zero pgtables_bytes on freeing mm: 180224

Signed-off-by: Daniel Dragomir 
---
 kernel/sched/core.c | 7 ++-
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 218b93a..c62dbf9 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -5702,11 +5702,8 @@ void idle_task_exit(void)
switch_mm(mm, _mm, current);
finish_arch_post_lock_switch();
}
-   /*
-* Defer the cleanup to an alive cpu. On RT we can neither
-* call mmdrop() nor mmdrop_delayed() from here.
-*/
-   per_cpu(idle_last_mm, smp_processor_id()) = mm;
+
+   /* finish_cpu(), as ran on the BP, will clean up the active_mm state */
 }
 
 /*
-- 
2.7.4


-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#9160): 
https://lists.yoctoproject.org/g/linux-yocto/message/9160
Mute This Topic: https://lists.yoctoproject.org/mt/78299586/21656
Group Owner: linux-yocto+ow...@lists.yoctoproject.org
Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-