Skip to content

Commit 09e1d93

Browse files
iostapyshynakpm00
authored andcommitted
scripts/gdb: update documentation for lx_per_cpu
Commit db08c53 ("scripts/gdb: fix parameter handling in $lx_per_cpu") changed the parameter handling of lx_per_cpu to use GdbValue instead of parsing the variable name. Update the documentation to reflect the new lx_per_cpu usage. Update the hrtimer_bases example to use rb_tree instead of the timerqueue_head.next pointer removed in commit 511885d ("lib/timerqueue: Rely on rbtree semantics for next timer"). Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Illia Ostapyshyn <[email protected]> Cc: Alex Shi <[email protected]> Cc: Brendan Jackman <[email protected]> Cc: Dongliang Mu <[email protected]> Cc: Florian Rommel <[email protected]> Cc: Hu Haowen <[email protected]> Cc: Jan Kiszka <[email protected]> Cc: Jonathan Corbet <[email protected]> Cc: Kieran Bingham <[email protected]> Cc: Yanteng Si <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 6be7045 commit 09e1d93

File tree

4 files changed

+47
-59
lines changed

4 files changed

+47
-59
lines changed

Documentation/process/debugging/gdb-kernel-debugging.rst

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -127,35 +127,31 @@ Examples of using the Linux-provided gdb helpers
127127

128128
- Make use of the per-cpu function for the current or a specified CPU::
129129

130-
(gdb) p $lx_per_cpu("runqueues").nr_running
130+
(gdb) p $lx_per_cpu(runqueues).nr_running
131131
$3 = 1
132-
(gdb) p $lx_per_cpu("runqueues", 2).nr_running
132+
(gdb) p $lx_per_cpu(runqueues, 2).nr_running
133133
$4 = 0
134134

135135
- Dig into hrtimers using the container_of helper::
136136

137-
(gdb) set $next = $lx_per_cpu("hrtimer_bases").clock_base[0].active.next
138-
(gdb) p *$container_of($next, "struct hrtimer", "node")
137+
(gdb) set $leftmost = $lx_per_cpu(hrtimer_bases).clock_base[0].active.rb_root.rb_leftmost
138+
(gdb) p *$container_of($leftmost, "struct hrtimer", "node")
139139
$5 = {
140140
node = {
141141
node = {
142-
__rb_parent_color = 18446612133355256072,
143-
rb_right = 0x0 <irq_stack_union>,
144-
rb_left = 0x0 <irq_stack_union>
142+
__rb_parent_color = 18446612686384860673,
143+
rb_right = 0xffff888231da8b00,
144+
rb_left = 0x0
145145
},
146-
expires = {
147-
tv64 = 1835268000000
148-
}
146+
expires = 1228461000000
149147
},
150-
_softexpires = {
151-
tv64 = 1835268000000
152-
},
153-
function = 0xffffffff81078232 <tick_sched_timer>,
154-
base = 0xffff88003fd0d6f0,
155-
state = 1,
156-
start_pid = 0,
157-
start_site = 0xffffffff81055c1f <hrtimer_start_range_ns+20>,
158-
start_comm = "swapper/2\000\000\000\000\000\000"
148+
_softexpires = 1228461000000,
149+
function = 0xffffffff8137ab20 <tick_nohz_handler>,
150+
base = 0xffff888231d9b4c0,
151+
state = 1 '\001',
152+
is_rel = 0 '\000',
153+
is_soft = 0 '\000',
154+
is_hard = 1 '\001'
159155
}
160156

161157

Documentation/translations/zh_CN/dev-tools/gdb-kernel-debugging.rst

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -120,35 +120,31 @@ Kgdb内核调试器、QEMU等虚拟机管理程序或基于JTAG的硬件接口
120120

121121
- 对当前或指定的CPU使用per-cpu函数::
122122

123-
(gdb) p $lx_per_cpu("runqueues").nr_running
123+
(gdb) p $lx_per_cpu(runqueues).nr_running
124124
$3 = 1
125-
(gdb) p $lx_per_cpu("runqueues", 2).nr_running
125+
(gdb) p $lx_per_cpu(runqueues, 2).nr_running
126126
$4 = 0
127127

128128
- 使用container_of查看更多hrtimers信息::
129129

130-
(gdb) set $next = $lx_per_cpu("hrtimer_bases").clock_base[0].active.next
131-
(gdb) p *$container_of($next, "struct hrtimer", "node")
130+
(gdb) set $leftmost = $lx_per_cpu(hrtimer_bases).clock_base[0].active.rb_root.rb_leftmost
131+
(gdb) p *$container_of($leftmost, "struct hrtimer", "node")
132132
$5 = {
133133
node = {
134134
node = {
135-
__rb_parent_color = 18446612133355256072,
136-
rb_right = 0x0 <irq_stack_union>,
137-
rb_left = 0x0 <irq_stack_union>
135+
__rb_parent_color = 18446612686384860673,
136+
rb_right = 0xffff888231da8b00,
137+
rb_left = 0x0
138138
},
139-
expires = {
140-
tv64 = 1835268000000
141-
}
139+
expires = 1228461000000
142140
},
143-
_softexpires = {
144-
tv64 = 1835268000000
145-
},
146-
function = 0xffffffff81078232 <tick_sched_timer>,
147-
base = 0xffff88003fd0d6f0,
148-
state = 1,
149-
start_pid = 0,
150-
start_site = 0xffffffff81055c1f <hrtimer_start_range_ns+20>,
151-
start_comm = "swapper/2\000\000\000\000\000\000"
141+
_softexpires = 1228461000000,
142+
function = 0xffffffff8137ab20 <tick_nohz_handler>,
143+
base = 0xffff888231d9b4c0,
144+
state = 1 '\001',
145+
is_rel = 0 '\000',
146+
is_soft = 0 '\000',
147+
is_hard = 1 '\001'
152148
}
153149

154150

Documentation/translations/zh_TW/dev-tools/gdb-kernel-debugging.rst

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -116,35 +116,31 @@ Kgdb內核調試器、QEMU等虛擬機管理程序或基於JTAG的硬件接口
116116

117117
- 對當前或指定的CPU使用per-cpu函數::
118118

119-
(gdb) p $lx_per_cpu("runqueues").nr_running
119+
(gdb) p $lx_per_cpu(runqueues).nr_running
120120
$3 = 1
121-
(gdb) p $lx_per_cpu("runqueues", 2).nr_running
121+
(gdb) p $lx_per_cpu(runqueues, 2).nr_running
122122
$4 = 0
123123

124124
- 使用container_of查看更多hrtimers信息::
125125

126-
(gdb) set $next = $lx_per_cpu("hrtimer_bases").clock_base[0].active.next
127-
(gdb) p *$container_of($next, "struct hrtimer", "node")
126+
(gdb) set $leftmost = $lx_per_cpu(hrtimer_bases).clock_base[0].active.rb_root.rb_leftmost
127+
(gdb) p *$container_of($leftmost, "struct hrtimer", "node")
128128
$5 = {
129129
node = {
130130
node = {
131-
__rb_parent_color = 18446612133355256072,
132-
rb_right = 0x0 <irq_stack_union>,
133-
rb_left = 0x0 <irq_stack_union>
131+
__rb_parent_color = 18446612686384860673,
132+
rb_right = 0xffff888231da8b00,
133+
rb_left = 0x0
134134
},
135-
expires = {
136-
tv64 = 1835268000000
137-
}
135+
expires = 1228461000000
138136
},
139-
_softexpires = {
140-
tv64 = 1835268000000
141-
},
142-
function = 0xffffffff81078232 <tick_sched_timer>,
143-
base = 0xffff88003fd0d6f0,
144-
state = 1,
145-
start_pid = 0,
146-
start_site = 0xffffffff81055c1f <hrtimer_start_range_ns+20>,
147-
start_comm = "swapper/2\000\000\000\000\000\000"
137+
_softexpires = 1228461000000,
138+
function = 0xffffffff8137ab20 <tick_nohz_handler>,
139+
base = 0xffff888231d9b4c0,
140+
state = 1 '\001',
141+
is_rel = 0 '\000',
142+
is_soft = 0 '\000',
143+
is_hard = 1 '\001'
148144
}
149145

150146

scripts/gdb/linux/cpus.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ def invoke(self, arg, from_tty):
141141
class PerCpu(gdb.Function):
142142
"""Return per-cpu variable.
143143
144-
$lx_per_cpu("VAR"[, CPU]): Return the per-cpu variable called VAR for the
144+
$lx_per_cpu(VAR[, CPU]): Return the per-cpu variable called VAR for the
145145
given CPU number. If CPU is omitted, the CPU of the current context is used.
146146
Note that VAR has to be quoted as string."""
147147

@@ -158,7 +158,7 @@ def invoke(self, var, cpu=-1):
158158
class PerCpuPtr(gdb.Function):
159159
"""Return per-cpu pointer.
160160
161-
$lx_per_cpu_ptr("VAR"[, CPU]): Return the per-cpu pointer called VAR for the
161+
$lx_per_cpu_ptr(VAR[, CPU]): Return the per-cpu pointer called VAR for the
162162
given CPU number. If CPU is omitted, the CPU of the current context is used.
163163
Note that VAR has to be quoted as string."""
164164

0 commit comments

Comments
 (0)