Commit e52ec6a2 authored by Kuan-Ying Lee's avatar Kuan-Ying Lee Committed by Andrew Morton
Browse files

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: default avatarKuan-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: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 125e9987
Loading
Loading
Loading
Loading
+25 −33
Original line number Diff line number Diff line
@@ -122,11 +122,10 @@ 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["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:
@@ -141,8 +140,6 @@ class DumpPageOwner(gdb.Command):
            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")

    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["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"])
                continue
            except:
                gdb.write("\n")
            pfn += 1

DumpPageOwner()
+1 −2
Original line number Diff line number Diff line
@@ -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']: