Message ID | 20231129065142.13375-2-Kuan-Ying.Lee@mediatek.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Fix GDB commands error | expand |
On 11/29, Kuan-Ying Lee wrote: > > Since commit 8e1f385104ac ("kill task_struct->thread_group") remove > the thread_group, we will encounter below issue. > > (gdb) lx-ps > TASK PID COMM > 0xffff800086503340 0 swapper/0 > Python Exception <class 'gdb.error'>: There is no member named thread_group. > Error occurred in Python: There is no member named thread_group. > > We use signal->thread_head to iterate all threads instead. Thanks again, Acked-by: Oleg Nesterov <oleg@redhat.com> > Fixes: 8e1f385104ac ("kill task_struct->thread_group") > Cc: stable@vger.kernel.org Is it possible to merge this simple change before v6.7 ? Then "cc: stable" can be removed. Oleg.
On Wed, 29 Nov 2023 09:10:09 +0100 Oleg Nesterov <oleg@redhat.com> wrote: > > Fixes: 8e1f385104ac ("kill task_struct->thread_group") > > Cc: stable@vger.kernel.org > > Is it possible to merge this simple change before v6.7 ? > Then "cc: stable" can be removed. Yes, I shall do all that.
On 11/28/23 22:51, Kuan-Ying Lee wrote: > Since commit 8e1f385104ac ("kill task_struct->thread_group") remove > the thread_group, we will encounter below issue. > > (gdb) lx-ps > TASK PID COMM > 0xffff800086503340 0 swapper/0 > Python Exception <class 'gdb.error'>: There is no member named thread_group. > Error occurred in Python: There is no member named thread_group. > > We use signal->thread_head to iterate all threads instead. > > Fixes: 8e1f385104ac ("kill task_struct->thread_group") > Cc: stable@vger.kernel.org > Signed-off-by: Kuan-Ying Lee <Kuan-Ying.Lee@mediatek.com> Tested-by: Florian Fainelli <florian.fainelli@broadcom.com>
diff --git a/scripts/gdb/linux/tasks.py b/scripts/gdb/linux/tasks.py index 17ec19e9b5bf..aa5ab6251f76 100644 --- a/scripts/gdb/linux/tasks.py +++ b/scripts/gdb/linux/tasks.py @@ -13,7 +13,7 @@ import gdb -from linux import utils +from linux import utils, lists task_type = utils.CachedType("struct task_struct") @@ -22,19 +22,15 @@ task_type = utils.CachedType("struct task_struct") def task_lists(): task_ptr_type = task_type.get_type().pointer() init_task = gdb.parse_and_eval("init_task").address - t = g = init_task + t = init_task while True: - while True: - yield t + thread_head = t['signal']['thread_head'] + for thread in lists.list_for_each_entry(thread_head, task_ptr_type, 'thread_node'): + yield thread - t = utils.container_of(t['thread_group']['next'], - task_ptr_type, "thread_group") - if t == g: - break - - t = g = utils.container_of(g['tasks']['next'], - task_ptr_type, "tasks") + t = utils.container_of(t['tasks']['next'], + task_ptr_type, "tasks") if t == init_task: return
Since commit 8e1f385104ac ("kill task_struct->thread_group") remove the thread_group, we will encounter below issue. (gdb) lx-ps TASK PID COMM 0xffff800086503340 0 swapper/0 Python Exception <class 'gdb.error'>: There is no member named thread_group. Error occurred in Python: There is no member named thread_group. We use signal->thread_head to iterate all threads instead. Fixes: 8e1f385104ac ("kill task_struct->thread_group") Cc: stable@vger.kernel.org Signed-off-by: Kuan-Ying Lee <Kuan-Ying.Lee@mediatek.com> --- scripts/gdb/linux/tasks.py | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-)