mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-08 14:23:19 +00:00
scripts/gdb: remove exception handling and refine print format
1. When we crash on a page, we want to check what happened on this page instead of skipping this page by try-except block. Thus, removing the try-except block. 2. Remove redundant comma and print the task name properly. Link: https://lkml.kernel.org/r/20231127070404.4192-4-Kuan-Ying.Lee@mediatek.com Signed-off-by: Kuan-Ying Lee <Kuan-Ying.Lee@mediatek.com> Cc: Andrey Konovalov <andreyknvl@google.com> Cc: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Cc: Chinwen Chang <chinwen.chang@mediatek.com> Cc: Matthias Brugger <matthias.bgg@gmail.com> Cc: Oleg Nesterov <oleg@redhat.com> Cc: Qun-Wei Lin <qun-wei.lin@mediatek.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
parent
125e9987a2
commit
e52ec6a2db
@ -122,27 +122,24 @@ class DumpPageOwner(gdb.Command):
|
||||
if not (page_ext['flags'] & (1 << PAGE_EXT_OWNER_ALLOCATED)):
|
||||
gdb.write("page_owner is not allocated\n")
|
||||
|
||||
try:
|
||||
page_owner = self.get_page_owner(page_ext)
|
||||
gdb.write("Page last allocated via order %d, gfp_mask: 0x%x, pid: %d, tgid: %d (%s), ts %u ns, free_ts %u ns\n" %\
|
||||
(page_owner["order"], page_owner["gfp_mask"],\
|
||||
page_owner["pid"], page_owner["tgid"], page_owner["comm"],\
|
||||
page_owner["ts_nsec"], page_owner["free_ts_nsec"]))
|
||||
gdb.write("PFN: %d, Flags: 0x%x\n" % (pfn, page['flags']))
|
||||
if page_owner["handle"] == 0:
|
||||
gdb.write('page_owner allocation stack trace missing\n')
|
||||
else:
|
||||
stackdepot.stack_depot_print(page_owner["handle"])
|
||||
page_owner = self.get_page_owner(page_ext)
|
||||
gdb.write("Page last allocated via order %d, gfp_mask: 0x%x, pid: %d, tgid: %d (%s), ts %u ns, free_ts %u ns\n" %\
|
||||
(page_owner["order"], page_owner["gfp_mask"],\
|
||||
page_owner["pid"], page_owner["tgid"], page_owner["comm"].string(),\
|
||||
page_owner["ts_nsec"], page_owner["free_ts_nsec"]))
|
||||
gdb.write("PFN: %d, Flags: 0x%x\n" % (pfn, page['flags']))
|
||||
if page_owner["handle"] == 0:
|
||||
gdb.write('page_owner allocation stack trace missing\n')
|
||||
else:
|
||||
stackdepot.stack_depot_print(page_owner["handle"])
|
||||
|
||||
if page_owner["free_handle"] == 0:
|
||||
gdb.write('page_owner free stack trace missing\n')
|
||||
else:
|
||||
gdb.write('page last free stack trace:\n')
|
||||
stackdepot.stack_depot_print(page_owner["free_handle"])
|
||||
if page_owner['last_migrate_reason'] != -1:
|
||||
gdb.write('page has been migrated, last migrate reason: %s\n' % self.migrate_reason_names[page_owner['last_migrate_reason']])
|
||||
except:
|
||||
gdb.write("\n")
|
||||
if page_owner["free_handle"] == 0:
|
||||
gdb.write('page_owner free stack trace missing\n')
|
||||
else:
|
||||
gdb.write('page last free stack trace:\n')
|
||||
stackdepot.stack_depot_print(page_owner["free_handle"])
|
||||
if page_owner['last_migrate_reason'] != -1:
|
||||
gdb.write('page has been migrated, last migrate reason: %s\n' % self.migrate_reason_names[page_owner['last_migrate_reason']])
|
||||
|
||||
def read_page_owner(self):
|
||||
pfn = self.min_pfn
|
||||
@ -173,18 +170,13 @@ class DumpPageOwner(gdb.Command):
|
||||
pfn += 1
|
||||
continue
|
||||
|
||||
try:
|
||||
page_owner = self.get_page_owner(page_ext)
|
||||
gdb.write("Page allocated via order %d, gfp_mask: 0x%x, pid: %d, tgid: %d (%s), ts %u ns, free_ts %u ns\n" %\
|
||||
(page_owner["order"], page_owner["gfp_mask"],\
|
||||
page_owner["pid"], page_owner["tgid"], page_owner["comm"],\
|
||||
page_owner["ts_nsec"], page_owner["free_ts_nsec"]))
|
||||
gdb.write("PFN: %d, Flags: 0x%x\n" % (pfn, page['flags']))
|
||||
stackdepot.stack_depot_print(page_owner["handle"])
|
||||
pfn += (1 << page_owner["order"])
|
||||
continue
|
||||
except:
|
||||
gdb.write("\n")
|
||||
pfn += 1
|
||||
page_owner = self.get_page_owner(page_ext)
|
||||
gdb.write("Page allocated via order %d, gfp_mask: 0x%x, pid: %d, tgid: %d (%s), ts %u ns, free_ts %u ns\n" %\
|
||||
(page_owner["order"], page_owner["gfp_mask"],\
|
||||
page_owner["pid"], page_owner["tgid"], page_owner["comm"].string(),\
|
||||
page_owner["ts_nsec"], page_owner["free_ts_nsec"]))
|
||||
gdb.write("PFN: %d, Flags: 0x%x\n" % (pfn, page['flags']))
|
||||
stackdepot.stack_depot_print(page_owner["handle"])
|
||||
pfn += (1 << page_owner["order"])
|
||||
|
||||
DumpPageOwner()
|
||||
|
@ -228,8 +228,7 @@ def slabtrace(alloc, cache_name):
|
||||
nr_cpu = gdb.parse_and_eval('__num_online_cpus')['counter']
|
||||
if nr_cpu > 1:
|
||||
gdb.write(" cpus=")
|
||||
for i in loc['cpus']:
|
||||
gdb.write("%d," % i)
|
||||
gdb.write(','.join(str(cpu) for cpu in loc['cpus']))
|
||||
gdb.write("\n")
|
||||
if constants.LX_CONFIG_STACKDEPOT:
|
||||
if loc['handle']:
|
||||
|
Loading…
Reference in New Issue
Block a user