* Re: [PATCH] scripts/gdb: fix get_thread_info
2018-01-18 21:01 [PATCH] scripts/gdb: fix get_thread_info Xi Kangjie
@ 2018-01-18 15:43 ` Jan Kiszka
2018-01-18 15:47 ` Kieran Bingham
0 siblings, 1 reply; 4+ messages in thread
From: Jan Kiszka @ 2018-01-18 15:43 UTC (permalink / raw)
To: Xi Kangjie, kieran, Andrew Morton; +Cc: linux-kernel
On 2018-01-18 22:01, Xi Kangjie wrote:
> Since kernel 4.9, the thread_info has been moved into task_struct,
> no longer locates at the bottom of kernel stack.
>
> See commits:
> - commit c65eacbe290b ("sched/core: Allow putting thread_info into
> task_struct")
> - commit 15f4eae70d36 ("x86: Move thread_info into task_struct")
>
> Before fix:
> (gdb) set $current = $lx_current()
> (gdb) p $lx_thread_info($current)
> $1 = {flags = 1470918301}
> (gdb) p $current.thread_info
> $2 = {flags = 2147483648}
>
> After fix:
> (gdb) p $lx_thread_info($current)
> $1 = {flags = 2147483648}
> (gdb) p $current.thread_info
> $2 = {flags = 2147483648}
>
> Signed-off-by: Xi Kangjie <imxikangjie@gmail.com>
> ---
> scripts/gdb/linux/tasks.py | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/scripts/gdb/linux/tasks.py b/scripts/gdb/linux/tasks.py
> index 1bf949c43b76..f6ab3ccf698f 100644
> --- a/scripts/gdb/linux/tasks.py
> +++ b/scripts/gdb/linux/tasks.py
> @@ -96,6 +96,8 @@ def get_thread_info(task):
> thread_info_addr = task.address + ia64_task_size
> thread_info = thread_info_addr.cast(thread_info_ptr_type)
> else:
> + if task.type.fields()[0].type == thread_info_type.get_type():
> + return task['thread_info']
> thread_info = task['stack'].cast(thread_info_ptr_type)
> return thread_info.dereference()
>
>
Acked-by: Jan Kiszka <jan.kiszka@siemens.com>
Andrew, please pick up.
Thanks,
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] scripts/gdb: fix get_thread_info
2018-01-18 15:43 ` Jan Kiszka
@ 2018-01-18 15:47 ` Kieran Bingham
2018-01-18 15:50 ` Jan Kiszka
0 siblings, 1 reply; 4+ messages in thread
From: Kieran Bingham @ 2018-01-18 15:47 UTC (permalink / raw)
To: Jan Kiszka, Xi Kangjie, Andrew Morton; +Cc: linux-kernel
On 18/01/18 15:43, Jan Kiszka wrote:
> On 2018-01-18 22:01, Xi Kangjie wrote:
>> Since kernel 4.9, the thread_info has been moved into task_struct,
>> no longer locates at the bottom of kernel stack.
>>
>> See commits:
>> - commit c65eacbe290b ("sched/core: Allow putting thread_info into
>> task_struct")
>> - commit 15f4eae70d36 ("x86: Move thread_info into task_struct")
>>
>> Before fix:
>> (gdb) set $current = $lx_current()
>> (gdb) p $lx_thread_info($current)
>> $1 = {flags = 1470918301}
>> (gdb) p $current.thread_info
>> $2 = {flags = 2147483648}
>>
>> After fix:
>> (gdb) p $lx_thread_info($current)
>> $1 = {flags = 2147483648}
>> (gdb) p $current.thread_info
>> $2 = {flags = 2147483648}
>>
>> Signed-off-by: Xi Kangjie <imxikangjie@gmail.com>
>> ---
>> scripts/gdb/linux/tasks.py | 2 ++
>> 1 file changed, 2 insertions(+)
>>
>> diff --git a/scripts/gdb/linux/tasks.py b/scripts/gdb/linux/tasks.py
>> index 1bf949c43b76..f6ab3ccf698f 100644
>> --- a/scripts/gdb/linux/tasks.py
>> +++ b/scripts/gdb/linux/tasks.py
>> @@ -96,6 +96,8 @@ def get_thread_info(task):
>> thread_info_addr = task.address + ia64_task_size
>> thread_info = thread_info_addr.cast(thread_info_ptr_type)
>> else:
>> + if task.type.fields()[0].type == thread_info_type.get_type():
>> + return task['thread_info']
>> thread_info = task['stack'].cast(thread_info_ptr_type)
>> return thread_info.dereference()
>>
>>
>
> Acked-by: Jan Kiszka <jan.kiszka@siemens.com>
>
> Andrew, please pick up.
Acked-by: Kieran Bingham <kbingham@kernel.org>
However, should we mark this as:
Cc: <stable@vger.kernel.org> # 4.9+ ?
Regards
--
Kieran
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] scripts/gdb: fix get_thread_info
2018-01-18 15:47 ` Kieran Bingham
@ 2018-01-18 15:50 ` Jan Kiszka
0 siblings, 0 replies; 4+ messages in thread
From: Jan Kiszka @ 2018-01-18 15:50 UTC (permalink / raw)
To: Kieran Bingham, Xi Kangjie, Andrew Morton; +Cc: linux-kernel
On 2018-01-18 16:47, Kieran Bingham wrote:
>
> On 18/01/18 15:43, Jan Kiszka wrote:
>> On 2018-01-18 22:01, Xi Kangjie wrote:
>>> Since kernel 4.9, the thread_info has been moved into task_struct,
>>> no longer locates at the bottom of kernel stack.
>>>
>>> See commits:
>>> - commit c65eacbe290b ("sched/core: Allow putting thread_info into
>>> task_struct")
>>> - commit 15f4eae70d36 ("x86: Move thread_info into task_struct")
>>>
>>> Before fix:
>>> (gdb) set $current = $lx_current()
>>> (gdb) p $lx_thread_info($current)
>>> $1 = {flags = 1470918301}
>>> (gdb) p $current.thread_info
>>> $2 = {flags = 2147483648}
>>>
>>> After fix:
>>> (gdb) p $lx_thread_info($current)
>>> $1 = {flags = 2147483648}
>>> (gdb) p $current.thread_info
>>> $2 = {flags = 2147483648}
>>>
>>> Signed-off-by: Xi Kangjie <imxikangjie@gmail.com>
>>> ---
>>> scripts/gdb/linux/tasks.py | 2 ++
>>> 1 file changed, 2 insertions(+)
>>>
>>> diff --git a/scripts/gdb/linux/tasks.py b/scripts/gdb/linux/tasks.py
>>> index 1bf949c43b76..f6ab3ccf698f 100644
>>> --- a/scripts/gdb/linux/tasks.py
>>> +++ b/scripts/gdb/linux/tasks.py
>>> @@ -96,6 +96,8 @@ def get_thread_info(task):
>>> thread_info_addr = task.address + ia64_task_size
>>> thread_info = thread_info_addr.cast(thread_info_ptr_type)
>>> else:
>>> + if task.type.fields()[0].type == thread_info_type.get_type():
>>> + return task['thread_info']
>>> thread_info = task['stack'].cast(thread_info_ptr_type)
>>> return thread_info.dereference()
>>>
>>>
>>
>> Acked-by: Jan Kiszka <jan.kiszka@siemens.com>
>>
>> Andrew, please pick up.
>
> Acked-by: Kieran Bingham <kbingham@kernel.org>
>
> However, should we mark this as:
> Cc: <stable@vger.kernel.org> # 4.9+ ?
>
Yes, good point.
Jan
--
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] scripts/gdb: fix get_thread_info
@ 2018-01-18 21:01 Xi Kangjie
2018-01-18 15:43 ` Jan Kiszka
0 siblings, 1 reply; 4+ messages in thread
From: Xi Kangjie @ 2018-01-18 21:01 UTC (permalink / raw)
To: jan.kiszka, kieran; +Cc: linux-kernel, Xi Kangjie
Since kernel 4.9, the thread_info has been moved into task_struct,
no longer locates at the bottom of kernel stack.
See commits:
- commit c65eacbe290b ("sched/core: Allow putting thread_info into
task_struct")
- commit 15f4eae70d36 ("x86: Move thread_info into task_struct")
Before fix:
(gdb) set $current = $lx_current()
(gdb) p $lx_thread_info($current)
$1 = {flags = 1470918301}
(gdb) p $current.thread_info
$2 = {flags = 2147483648}
After fix:
(gdb) p $lx_thread_info($current)
$1 = {flags = 2147483648}
(gdb) p $current.thread_info
$2 = {flags = 2147483648}
Signed-off-by: Xi Kangjie <imxikangjie@gmail.com>
---
scripts/gdb/linux/tasks.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/scripts/gdb/linux/tasks.py b/scripts/gdb/linux/tasks.py
index 1bf949c43b76..f6ab3ccf698f 100644
--- a/scripts/gdb/linux/tasks.py
+++ b/scripts/gdb/linux/tasks.py
@@ -96,6 +96,8 @@ def get_thread_info(task):
thread_info_addr = task.address + ia64_task_size
thread_info = thread_info_addr.cast(thread_info_ptr_type)
else:
+ if task.type.fields()[0].type == thread_info_type.get_type():
+ return task['thread_info']
thread_info = task['stack'].cast(thread_info_ptr_type)
return thread_info.dereference()
--
2.13.2
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-01-18 16:17 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-18 21:01 [PATCH] scripts/gdb: fix get_thread_info Xi Kangjie
2018-01-18 15:43 ` Jan Kiszka
2018-01-18 15:47 ` Kieran Bingham
2018-01-18 15:50 ` Jan Kiszka
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®