Rebase to upstream crash-8.0.2
Release: crash-8.0.2-1 Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
This commit is contained in:
parent
a76f3f3679
commit
8edbb22a5c
1
.gitignore
vendored
1
.gitignore
vendored
@ -46,5 +46,6 @@ crash-5.0.6.tar.gz
|
||||
/crash-7.3.0.tar.gz
|
||||
/crash-8.0.0.tar.gz
|
||||
/crash-8.0.1.tar.gz
|
||||
/crash-8.0.2.tar.gz
|
||||
/gdb-7.6.tar.gz
|
||||
/gdb-10.2.tar.gz
|
||||
|
@ -1,31 +0,0 @@
|
||||
From ae52398a13fa9a238279114ed671c7c514c154ee Mon Sep 17 00:00:00 2001
|
||||
From: Sourabh Jain <sourabhjain@linux.ibm.com>
|
||||
Date: Mon, 9 May 2022 12:49:56 +0530
|
||||
Subject: [PATCH 01/16] ppc64: update the NR_CPUS to 8192
|
||||
|
||||
Since the kernel commit 2d8ae638bb86 ("powerpc: Make the NR_CPUS max 8192")
|
||||
the NR_CPUS on Linux kernel ranges from 1-8192. So let's match NR_CPUS with
|
||||
the max NR_CPUS count on the Linux kernel.
|
||||
|
||||
Signed-off-by: Sourabh Jain <sourabhjain@linux.ibm.com>
|
||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
|
||||
---
|
||||
defs.h | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/defs.h b/defs.h
|
||||
index 1e8360d65a3b..a6735d07b32f 100644
|
||||
--- a/defs.h
|
||||
+++ b/defs.h
|
||||
@@ -136,7 +136,7 @@
|
||||
#define NR_CPUS (4096)
|
||||
#endif
|
||||
#ifdef PPC64
|
||||
-#define NR_CPUS (2048)
|
||||
+#define NR_CPUS (8192)
|
||||
#endif
|
||||
#ifdef S390
|
||||
#define NR_CPUS (512)
|
||||
--
|
||||
2.30.2
|
||||
|
@ -1,44 +0,0 @@
|
||||
From 6bc3b74c6e2b0aaebe1bc164594e53b010efef56 Mon Sep 17 00:00:00 2001
|
||||
From: Kazuhito Hagio <k-hagio-ab@nec.com>
|
||||
Date: Fri, 10 Jun 2022 15:52:34 +0900
|
||||
Subject: [PATCH 01/29] sbitmapq: Fix for kernels without struct
|
||||
wait_queue_head
|
||||
|
||||
The current struct wait_queue_head was renamed by kernel commit
|
||||
9d9d676f595b ("sched/wait: Standardize internal naming of wait-queue heads")
|
||||
at Linux 4.13. Without the patch, on earlier kernels the "sbitmapq"
|
||||
command fails with the following error:
|
||||
|
||||
crash> sbitmapq ffff8801790b3b50
|
||||
depth = 128
|
||||
busy = 0
|
||||
bits_per_word = 32
|
||||
...
|
||||
sbitmapq: invalid structure member offset: wait_queue_head_head
|
||||
FILE: sbitmap.c LINE: 344 FUNCTION: sbitmap_queue_show()
|
||||
|
||||
Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
|
||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
|
||||
---
|
||||
sbitmap.c | 5 ++++-
|
||||
1 file changed, 4 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/sbitmap.c b/sbitmap.c
|
||||
index bb2f19e6207b..be5d30a8ea88 100644
|
||||
--- a/sbitmap.c
|
||||
+++ b/sbitmap.c
|
||||
@@ -341,7 +341,10 @@ static void sbitmap_queue_show(const struct sbitmap_queue_context *sqc,
|
||||
sbq_wait_state_size = SIZE(sbq_wait_state);
|
||||
wait_cnt_off = OFFSET(sbq_wait_state_wait_cnt);
|
||||
wait_off = OFFSET(sbq_wait_state_wait);
|
||||
- list_head_off = OFFSET(wait_queue_head_head);
|
||||
+ if (VALID_MEMBER(wait_queue_head_head)) /* 4.13 and later */
|
||||
+ list_head_off = OFFSET(wait_queue_head_head);
|
||||
+ else
|
||||
+ list_head_off = OFFSET(__wait_queue_head_task_list);
|
||||
|
||||
sbq_wait_state_buf = GETBUF(sbq_wait_state_size);
|
||||
|
||||
--
|
||||
2.37.1
|
||||
|
@ -1,43 +0,0 @@
|
||||
From b8f2ae6b494d706b1e4855b439c4930a6a6a2f5c Mon Sep 17 00:00:00 2001
|
||||
From: Kazuhito Hagio <k-hagio-ab@nec.com>
|
||||
Date: Fri, 10 Jun 2022 16:00:14 +0900
|
||||
Subject: [PATCH 02/29] sbitmapq: Limit kernels without sbitmap again
|
||||
|
||||
commit 364b2e413c69 ("sbitmapq: remove struct and member validation
|
||||
in sbitmapq_init()") allowed the use of the "sbitmapq" command
|
||||
unconditionally. Without the patch, the command fails with the
|
||||
following error on kernels without sbitmap:
|
||||
|
||||
crash> sbitmapq ffff88015796e550
|
||||
|
||||
sbitmapq: invalid structure member offset: sbitmap_queue_sb
|
||||
FILE: sbitmap.c LINE: 385 FUNCTION: sbitmap_queue_context_load()
|
||||
|
||||
Now the command supports Linux 4.9 and later kernels since it was
|
||||
abstracted out, so it can be limited by the non-existence of the
|
||||
sbitmap structure.
|
||||
|
||||
Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
|
||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
|
||||
---
|
||||
sbitmap.c | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/sbitmap.c b/sbitmap.c
|
||||
index be5d30a8ea88..12d6512a1e4d 100644
|
||||
--- a/sbitmap.c
|
||||
+++ b/sbitmap.c
|
||||
@@ -540,6 +540,10 @@ void sbitmapq_init(void)
|
||||
STRUCT_SIZE_INIT(sbitmap_queue, "sbitmap_queue");
|
||||
STRUCT_SIZE_INIT(sbq_wait_state, "sbq_wait_state");
|
||||
|
||||
+ /* sbitmap was abstracted out by commit 88459642cba4 on Linux 4.9. */
|
||||
+ if (INVALID_SIZE(sbitmap))
|
||||
+ command_not_supported();
|
||||
+
|
||||
MEMBER_OFFSET_INIT(sbitmap_word_depth, "sbitmap_word", "depth");
|
||||
MEMBER_OFFSET_INIT(sbitmap_word_word, "sbitmap_word", "word");
|
||||
MEMBER_OFFSET_INIT(sbitmap_word_cleared, "sbitmap_word", "cleared");
|
||||
--
|
||||
2.37.1
|
||||
|
@ -1,62 +0,0 @@
|
||||
From 364b2e413c69daf189d2bc0238e3ba9b0dcbd937 Mon Sep 17 00:00:00 2001
|
||||
From: Lianbo Jiang <lijiang@redhat.com>
|
||||
Date: Mon, 23 May 2022 18:04:13 +0800
|
||||
Subject: [PATCH 02/16] sbitmapq: remove struct and member validation in
|
||||
sbitmapq_init()
|
||||
|
||||
Let's remove the struct and member validation from sbitmapq_init(), which
|
||||
will help the crash to display the actual error when the sbitmapq fails.
|
||||
|
||||
Without the patch:
|
||||
crash> sbitmapq ffff8e99d0dc8010
|
||||
sbitmapq: command not supported or applicable on this architecture or kernel
|
||||
|
||||
With the patch:
|
||||
crash> sbitmapq ffff8e99d0dc8010
|
||||
|
||||
sbitmapq: invalid structure member offset: sbitmap_queue_alloc_hint
|
||||
FILE: sbitmap.c LINE: 365 FUNCTION: sbitmap_queue_context_load()
|
||||
|
||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
|
||||
---
|
||||
sbitmap.c | 24 ------------------------
|
||||
1 file changed, 24 deletions(-)
|
||||
|
||||
diff --git a/sbitmap.c b/sbitmap.c
|
||||
index 96a61e6c2c71..7693eef6cebd 100644
|
||||
--- a/sbitmap.c
|
||||
+++ b/sbitmap.c
|
||||
@@ -525,30 +525,6 @@ void sbitmapq_init(void)
|
||||
MEMBER_OFFSET_INIT(sbq_wait_state_wait_cnt, "sbq_wait_state", "wait_cnt");
|
||||
MEMBER_OFFSET_INIT(sbq_wait_state_wait, "sbq_wait_state", "wait");
|
||||
|
||||
- if (!VALID_SIZE(sbitmap_word) ||
|
||||
- !VALID_SIZE(sbitmap) ||
|
||||
- !VALID_SIZE(sbitmap_queue) ||
|
||||
- !VALID_SIZE(sbq_wait_state) ||
|
||||
- INVALID_MEMBER(sbitmap_word_depth) ||
|
||||
- INVALID_MEMBER(sbitmap_word_word) ||
|
||||
- INVALID_MEMBER(sbitmap_word_cleared) ||
|
||||
- INVALID_MEMBER(sbitmap_depth) ||
|
||||
- INVALID_MEMBER(sbitmap_shift) ||
|
||||
- INVALID_MEMBER(sbitmap_map_nr) ||
|
||||
- INVALID_MEMBER(sbitmap_map) ||
|
||||
- INVALID_MEMBER(sbitmap_queue_sb) ||
|
||||
- INVALID_MEMBER(sbitmap_queue_alloc_hint) ||
|
||||
- INVALID_MEMBER(sbitmap_queue_wake_batch) ||
|
||||
- INVALID_MEMBER(sbitmap_queue_wake_index) ||
|
||||
- INVALID_MEMBER(sbitmap_queue_ws) ||
|
||||
- INVALID_MEMBER(sbitmap_queue_ws_active) ||
|
||||
- INVALID_MEMBER(sbitmap_queue_round_robin) ||
|
||||
- INVALID_MEMBER(sbitmap_queue_min_shallow_depth) ||
|
||||
- INVALID_MEMBER(sbq_wait_state_wait_cnt) ||
|
||||
- INVALID_MEMBER(sbq_wait_state_wait)) {
|
||||
- command_not_supported();
|
||||
- }
|
||||
-
|
||||
sb_flags |= SB_FLAG_INIT;
|
||||
}
|
||||
|
||||
--
|
||||
2.30.2
|
||||
|
@ -1,146 +0,0 @@
|
||||
From 85f39061390f095e73d9037f015cec077441eb13 Mon Sep 17 00:00:00 2001
|
||||
From: Kazuhito Hagio <k-hagio-ab@nec.com>
|
||||
Date: Wed, 15 Jun 2022 10:50:13 +0900
|
||||
Subject: [PATCH 03/29] Fix for "dev" command on Linux 5.11 and later
|
||||
|
||||
The following kernel commits eventually removed the bdev_map array in
|
||||
Linux v5.11 kernel:
|
||||
|
||||
e418de3abcda ("block: switch gendisk lookup to a simple xarray")
|
||||
22ae8ce8b892 ("block: simplify bdev/disk lookup in blkdev_get")
|
||||
|
||||
Without the patch, the "dev" command fails to dump block device data
|
||||
with the following error:
|
||||
|
||||
crash> dev
|
||||
...
|
||||
dev: blkdevs or all_bdevs: symbols do not exist
|
||||
|
||||
To get block device's gendisk, search blockdev_superblock.s_inodes
|
||||
instead of bdev_map.
|
||||
|
||||
Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
|
||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
|
||||
---
|
||||
dev.c | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++++++----
|
||||
1 file changed, 72 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/dev.c b/dev.c
|
||||
index db97f8aebdc2..75d30bd022a1 100644
|
||||
--- a/dev.c
|
||||
+++ b/dev.c
|
||||
@@ -24,6 +24,7 @@ static void dump_blkdevs_v2(ulong);
|
||||
static void dump_blkdevs_v3(ulong);
|
||||
static ulong search_cdev_map_probes(char *, int, int, ulong *);
|
||||
static ulong search_bdev_map_probes(char *, int, int, ulong *);
|
||||
+static ulong search_blockdev_inodes(int, ulong *);
|
||||
static void do_pci(void);
|
||||
static void do_pci2(void);
|
||||
static void do_io(void);
|
||||
@@ -493,9 +494,10 @@ dump_blkdevs(ulong flags)
|
||||
ulong ops;
|
||||
} blkdevs[MAX_DEV], *bp;
|
||||
|
||||
- if (kernel_symbol_exists("major_names") &&
|
||||
- kernel_symbol_exists("bdev_map")) {
|
||||
- dump_blkdevs_v3(flags);
|
||||
+ if (kernel_symbol_exists("major_names") &&
|
||||
+ (kernel_symbol_exists("bdev_map") ||
|
||||
+ kernel_symbol_exists("blockdev_superblock"))) {
|
||||
+ dump_blkdevs_v3(flags);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -717,6 +719,7 @@ dump_blkdevs_v3(ulong flags)
|
||||
char buf[BUFSIZE];
|
||||
uint major;
|
||||
ulong gendisk, addr, fops;
|
||||
+ int use_bdev_map = kernel_symbol_exists("bdev_map");
|
||||
|
||||
if (!(len = get_array_length("major_names", NULL, 0)))
|
||||
len = MAX_DEV;
|
||||
@@ -745,8 +748,11 @@ dump_blkdevs_v3(ulong flags)
|
||||
strncpy(buf, blk_major_name_buf +
|
||||
OFFSET(blk_major_name_name), 16);
|
||||
|
||||
- fops = search_bdev_map_probes(buf, major == i ? major : i,
|
||||
- UNUSED, &gendisk);
|
||||
+ if (use_bdev_map)
|
||||
+ fops = search_bdev_map_probes(buf, major == i ? major : i,
|
||||
+ UNUSED, &gendisk);
|
||||
+ else /* v5.11 and later */
|
||||
+ fops = search_blockdev_inodes(major, &gendisk);
|
||||
|
||||
if (CRASHDEBUG(1))
|
||||
fprintf(fp, "blk_major_name: %lx block major: %d name: %s gendisk: %lx fops: %lx\n",
|
||||
@@ -829,6 +835,67 @@ search_bdev_map_probes(char *name, int major, int minor, ulong *gendisk)
|
||||
return fops;
|
||||
}
|
||||
|
||||
+/* For bdev_inode. See block/bdev.c */
|
||||
+#define I_BDEV(inode) (inode - SIZE(block_device))
|
||||
+
|
||||
+static ulong
|
||||
+search_blockdev_inodes(int major, ulong *gendisk)
|
||||
+{
|
||||
+ struct list_data list_data, *ld;
|
||||
+ ulong addr, bd_sb, disk, fops = 0;
|
||||
+ int i, inode_count, gendisk_major;
|
||||
+ char *gendisk_buf;
|
||||
+
|
||||
+ ld = &list_data;
|
||||
+ BZERO(ld, sizeof(struct list_data));
|
||||
+
|
||||
+ get_symbol_data("blockdev_superblock", sizeof(void *), &bd_sb);
|
||||
+
|
||||
+ addr = bd_sb + OFFSET(super_block_s_inodes);
|
||||
+ if (!readmem(addr, KVADDR, &ld->start, sizeof(ulong),
|
||||
+ "blockdev_superblock.s_inodes", QUIET|RETURN_ON_ERROR))
|
||||
+ return 0;
|
||||
+
|
||||
+ if (empty_list(ld->start))
|
||||
+ return 0;
|
||||
+
|
||||
+ ld->flags |= LIST_ALLOCATE;
|
||||
+ ld->end = bd_sb + OFFSET(super_block_s_inodes);
|
||||
+ ld->list_head_offset = OFFSET(inode_i_sb_list);
|
||||
+
|
||||
+ inode_count = do_list(ld);
|
||||
+
|
||||
+ gendisk_buf = GETBUF(SIZE(gendisk));
|
||||
+
|
||||
+ for (i = 0; i < inode_count; i++) {
|
||||
+ addr = I_BDEV(ld->list_ptr[i]) + OFFSET(block_device_bd_disk);
|
||||
+ if (!readmem(addr, KVADDR, &disk, sizeof(ulong),
|
||||
+ "block_device.bd_disk", QUIET|RETURN_ON_ERROR))
|
||||
+ continue;
|
||||
+
|
||||
+ if (!disk)
|
||||
+ continue;
|
||||
+
|
||||
+ if (!readmem(disk, KVADDR, gendisk_buf, SIZE(gendisk),
|
||||
+ "gendisk buffer", QUIET|RETURN_ON_ERROR))
|
||||
+ continue;
|
||||
+
|
||||
+ gendisk_major = INT(gendisk_buf + OFFSET(gendisk_major));
|
||||
+ if (gendisk_major != major)
|
||||
+ continue;
|
||||
+
|
||||
+ fops = ULONG(gendisk_buf + OFFSET(gendisk_fops));
|
||||
+ if (fops) {
|
||||
+ *gendisk = disk;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ FREEBUF(ld->list_ptr);
|
||||
+ FREEBUF(gendisk_buf);
|
||||
+ return fops;
|
||||
+}
|
||||
+
|
||||
void
|
||||
dump_dev_table(void)
|
||||
{
|
||||
--
|
||||
2.37.1
|
||||
|
@ -1,118 +0,0 @@
|
||||
From a295cb40cd5d24fb5995cc78d29c5def3843d285 Mon Sep 17 00:00:00 2001
|
||||
From: Lianbo Jiang <lijiang@redhat.com>
|
||||
Date: Mon, 23 May 2022 18:04:14 +0800
|
||||
Subject: [PATCH 03/16] sbitmapq: fix invalid offset for
|
||||
"sbitmap_queue_alloc_hint" on Linux v5.13-rc1
|
||||
|
||||
Kernel commit c548e62bcf6a ("scsi: sbitmap: Move allocation hint
|
||||
into sbitmap") moved the alloc_hint member from struct sbitmap_queue
|
||||
to struct sbitmap. Without the patch, the sbitmapq will fail:
|
||||
|
||||
crash> sbitmapq 0xffff8e99d0dc8010
|
||||
|
||||
sbitmapq: invalid structure member offset: sbitmap_queue_alloc_hint
|
||||
FILE: sbitmap.c LINE: 365 FUNCTION: sbitmap_queue_context_load()
|
||||
|
||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
|
||||
---
|
||||
defs.h | 2 ++
|
||||
sbitmap.c | 14 ++++++++++++--
|
||||
symbols.c | 2 ++
|
||||
3 files changed, 16 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/defs.h b/defs.h
|
||||
index a6735d07b32f..0aeb98c4f654 100644
|
||||
--- a/defs.h
|
||||
+++ b/defs.h
|
||||
@@ -2168,6 +2168,7 @@ struct offset_table { /* stash of commonly-used offsets */
|
||||
long sbitmap_queue_min_shallow_depth;
|
||||
long sbq_wait_state_wait_cnt;
|
||||
long sbq_wait_state_wait;
|
||||
+ long sbitmap_alloc_hint;
|
||||
};
|
||||
|
||||
struct size_table { /* stash of commonly-used sizes */
|
||||
@@ -5907,6 +5908,7 @@ struct sbitmap_context {
|
||||
unsigned shift;
|
||||
unsigned map_nr;
|
||||
ulong map_addr;
|
||||
+ ulong alloc_hint;
|
||||
};
|
||||
|
||||
typedef bool (*sbitmap_for_each_fn)(unsigned int idx, void *p);
|
||||
diff --git a/sbitmap.c b/sbitmap.c
|
||||
index 7693eef6cebd..2921d5447c65 100644
|
||||
--- a/sbitmap.c
|
||||
+++ b/sbitmap.c
|
||||
@@ -285,6 +285,7 @@ void sbitmap_for_each_set(const struct sbitmap_context *sc,
|
||||
static void sbitmap_queue_show(const struct sbitmap_queue_context *sqc,
|
||||
const struct sbitmap_context *sc)
|
||||
{
|
||||
+ ulong alloc_hint_addr = 0;
|
||||
int cpus = get_cpus_possible();
|
||||
int sbq_wait_state_size, wait_cnt_off, wait_off, list_head_off;
|
||||
char *sbq_wait_state_buf;
|
||||
@@ -297,6 +298,11 @@ static void sbitmap_queue_show(const struct sbitmap_queue_context *sqc,
|
||||
fprintf(fp, "bits_per_word = %u\n", 1U << sc->shift);
|
||||
fprintf(fp, "map_nr = %u\n", sc->map_nr);
|
||||
|
||||
+ if (VALID_MEMBER(sbitmap_queue_alloc_hint))
|
||||
+ alloc_hint_addr = sqc->alloc_hint;
|
||||
+ else if (VALID_MEMBER(sbitmap_alloc_hint)) /* 5.13 and later */
|
||||
+ alloc_hint_addr = sc->alloc_hint;
|
||||
+
|
||||
fputs("alloc_hint = {", fp);
|
||||
first = true;
|
||||
for (i = 0; i < cpus; i++) {
|
||||
@@ -307,7 +313,7 @@ static void sbitmap_queue_show(const struct sbitmap_queue_context *sqc,
|
||||
fprintf(fp, ", ");
|
||||
first = false;
|
||||
|
||||
- ptr = kt->__per_cpu_offset[i] + sqc->alloc_hint;
|
||||
+ ptr = kt->__per_cpu_offset[i] + alloc_hint_addr;
|
||||
readmem(ptr, KVADDR, &val, sizeof(val), "alloc_hint", FAULT_ON_ERROR);
|
||||
|
||||
fprintf(fp, "%u", val);
|
||||
@@ -362,7 +368,8 @@ static void sbitmap_queue_context_load(ulong addr, struct sbitmap_queue_context
|
||||
error(FATAL, "cannot read sbitmap_queue\n");
|
||||
}
|
||||
|
||||
- sqc->alloc_hint = ULONG(sbitmap_queue_buf + OFFSET(sbitmap_queue_alloc_hint));
|
||||
+ if (VALID_MEMBER(sbitmap_queue_alloc_hint))
|
||||
+ sqc->alloc_hint = ULONG(sbitmap_queue_buf + OFFSET(sbitmap_queue_alloc_hint));
|
||||
sqc->wake_batch = UINT(sbitmap_queue_buf + OFFSET(sbitmap_queue_wake_batch));
|
||||
sqc->wake_index = INT(sbitmap_queue_buf + OFFSET(sbitmap_queue_wake_index));
|
||||
sqc->ws_addr = ULONG(sbitmap_queue_buf + OFFSET(sbitmap_queue_ws));
|
||||
@@ -387,6 +394,8 @@ void sbitmap_context_load(ulong addr, struct sbitmap_context *sc)
|
||||
sc->shift = UINT(sbitmap_buf + OFFSET(sbitmap_shift));
|
||||
sc->map_nr = UINT(sbitmap_buf + OFFSET(sbitmap_map_nr));
|
||||
sc->map_addr = ULONG(sbitmap_buf + OFFSET(sbitmap_map));
|
||||
+ if (VALID_MEMBER(sbitmap_alloc_hint))
|
||||
+ sc->alloc_hint = ULONG(sbitmap_buf + OFFSET(sbitmap_alloc_hint));
|
||||
|
||||
FREEBUF(sbitmap_buf);
|
||||
}
|
||||
@@ -512,6 +521,7 @@ void sbitmapq_init(void)
|
||||
MEMBER_OFFSET_INIT(sbitmap_shift, "sbitmap", "shift");
|
||||
MEMBER_OFFSET_INIT(sbitmap_map_nr, "sbitmap", "map_nr");
|
||||
MEMBER_OFFSET_INIT(sbitmap_map, "sbitmap", "map");
|
||||
+ MEMBER_OFFSET_INIT(sbitmap_alloc_hint, "sbitmap", "alloc_hint");
|
||||
|
||||
MEMBER_OFFSET_INIT(sbitmap_queue_sb, "sbitmap_queue", "sb");
|
||||
MEMBER_OFFSET_INIT(sbitmap_queue_alloc_hint, "sbitmap_queue", "alloc_hint");
|
||||
diff --git a/symbols.c b/symbols.c
|
||||
index ba5e2741347d..fd0eb06899f0 100644
|
||||
--- a/symbols.c
|
||||
+++ b/symbols.c
|
||||
@@ -10708,6 +10708,8 @@ dump_offset_table(char *spec, ulong makestruct)
|
||||
OFFSET(sbitmap_map_nr));
|
||||
fprintf(fp, " sbitmap_map: %ld\n",
|
||||
OFFSET(sbitmap_map));
|
||||
+ fprintf(fp, " sbitmap_alloc_hint: %ld\n",
|
||||
+ OFFSET(sbitmap_alloc_hint));
|
||||
fprintf(fp, " sbitmap_queue_sb: %ld\n",
|
||||
OFFSET(sbitmap_queue_sb));
|
||||
fprintf(fp, " sbitmap_queue_alloc_hint: %ld\n",
|
||||
--
|
||||
2.30.2
|
||||
|
@ -1,84 +0,0 @@
|
||||
From d8869b08548362345fc34e4cf17a1eac9bddec6b Mon Sep 17 00:00:00 2001
|
||||
From: Kazuhito Hagio <k-hagio-ab@nec.com>
|
||||
Date: Wed, 22 Jun 2022 08:32:59 +0900
|
||||
Subject: [PATCH 04/29] Extend field length of task attributes
|
||||
|
||||
Nowadays, some machines have many CPU cores and memory, and some
|
||||
distributions have a larger kernel.pid_max parameter, e.g. 7 digits.
|
||||
This impairs the readability of a few commands, especially "ps" and
|
||||
"ps -l|-m" options.
|
||||
|
||||
Let's extend the field length of the task attributes, PID, CPU, VSZ,
|
||||
and RSS to improve the readability.
|
||||
|
||||
Without the patch:
|
||||
crash> ps
|
||||
PID PPID CPU TASK ST %MEM VSZ RSS COMM
|
||||
...
|
||||
2802197 2699997 2 ffff916f63c40000 IN 0.0 307212 10688 timer
|
||||
2802277 1 0 ffff9161a25bb080 IN 0.0 169040 2744 gpg-agent
|
||||
2806711 3167854 10 ffff9167fc498000 IN 0.0 127208 6508 su
|
||||
2806719 2806711 1 ffff91633c3a48c0 IN 0.0 29452 6416 bash
|
||||
2988346 1 5 ffff916f7c629840 IN 2.8 9342476 1917384 qemu-kvm
|
||||
|
||||
With the patch:
|
||||
crash> ps
|
||||
PID PPID CPU TASK ST %MEM VSZ RSS COMM
|
||||
...
|
||||
2802197 2699997 2 ffff916f63c40000 IN 0.0 307212 10688 timer
|
||||
2802277 1 0 ffff9161a25bb080 IN 0.0 169040 2744 gpg-agent
|
||||
2806711 3167854 10 ffff9167fc498000 IN 0.0 127208 6508 su
|
||||
2806719 2806711 1 ffff91633c3a48c0 IN 0.0 29452 6416 bash
|
||||
2988346 1 5 ffff916f7c629840 IN 2.8 9342476 1917384 qemu-kvm
|
||||
|
||||
Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
|
||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
|
||||
---
|
||||
task.c | 10 +++++-----
|
||||
1 file changed, 5 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/task.c b/task.c
|
||||
index 864c838637ee..071c787fbfa5 100644
|
||||
--- a/task.c
|
||||
+++ b/task.c
|
||||
@@ -3828,7 +3828,7 @@ show_ps_data(ulong flag, struct task_context *tc, struct psinfo *psi)
|
||||
} else
|
||||
fprintf(fp, " ");
|
||||
|
||||
- fprintf(fp, "%5ld %5ld %2s %s %3s",
|
||||
+ fprintf(fp, "%7ld %7ld %3s %s %3s",
|
||||
tc->pid, task_to_pid(tc->ptask),
|
||||
task_cpu(tc->processor, buf2, !VERBOSE),
|
||||
task_pointer_string(tc, flag & PS_KSTACKP, buf3),
|
||||
@@ -3838,8 +3838,8 @@ show_ps_data(ulong flag, struct task_context *tc, struct psinfo *psi)
|
||||
if (strlen(buf1) == 3)
|
||||
mkstring(buf1, 4, CENTER|RJUST, NULL);
|
||||
fprintf(fp, "%s ", buf1);
|
||||
- fprintf(fp, "%7ld ", (tm->total_vm * PAGESIZE())/1024);
|
||||
- fprintf(fp, "%6ld ", (tm->rss * PAGESIZE())/1024);
|
||||
+ fprintf(fp, "%8ld ", (tm->total_vm * PAGESIZE())/1024);
|
||||
+ fprintf(fp, "%8ld ", (tm->rss * PAGESIZE())/1024);
|
||||
if (is_kernel_thread(tc->task))
|
||||
fprintf(fp, "[%s]\n", tc->comm);
|
||||
else
|
||||
@@ -3856,7 +3856,7 @@ show_ps(ulong flag, struct psinfo *psi)
|
||||
|
||||
if (!(flag & ((PS_EXCLUSIVE & ~PS_ACTIVE)|PS_NO_HEADER)))
|
||||
fprintf(fp,
|
||||
- " PID PPID CPU %s ST %%MEM VSZ RSS COMM\n",
|
||||
+ " PID PPID CPU %s ST %%MEM VSZ RSS COMM\n",
|
||||
flag & PS_KSTACKP ?
|
||||
mkstring(buf, VADDR_PRLEN, CENTER|RJUST, "KSTACKP") :
|
||||
mkstring(buf, VADDR_PRLEN, CENTER, "TASK"));
|
||||
@@ -7713,7 +7713,7 @@ print_task_header(FILE *out, struct task_context *tc, int newline)
|
||||
char buf[BUFSIZE];
|
||||
char buf1[BUFSIZE];
|
||||
|
||||
- fprintf(out, "%sPID: %-5ld TASK: %s CPU: %-2s COMMAND: \"%s\"\n",
|
||||
+ fprintf(out, "%sPID: %-7ld TASK: %s CPU: %-3s COMMAND: \"%s\"\n",
|
||||
newline ? "\n" : "", tc->pid,
|
||||
mkstring(buf1, VADDR_PRLEN, LJUST|LONG_HEX, MKSTR(tc->task)),
|
||||
task_cpu(tc->processor, buf, !VERBOSE), tc->comm);
|
||||
--
|
||||
2.37.1
|
||||
|
@ -1,103 +0,0 @@
|
||||
From 530fe6ad7e4d7ff6254596c1219d25ed929e3867 Mon Sep 17 00:00:00 2001
|
||||
From: Lianbo Jiang <lijiang@redhat.com>
|
||||
Date: Mon, 23 May 2022 18:04:15 +0800
|
||||
Subject: [PATCH 04/16] sbitmapq: fix invalid offset for
|
||||
"sbitmap_queue_round_robin" on Linux v5.13-rc1
|
||||
|
||||
Kernel commit efe1f3a1d583 ("scsi: sbitmap: Maintain allocation
|
||||
round_robin in sbitmap") moved the round_robin member from struct
|
||||
sbitmap_queue to struct sbitmap. Without the patch, the sbitmapq
|
||||
will fail:
|
||||
|
||||
crash> sbitmapq 0xffff8e99d0dc8010
|
||||
|
||||
sbitmapq: invalid structure member offset: sbitmap_queue_round_robin
|
||||
FILE: sbitmap.c LINE: 378 FUNCTION: sbitmap_queue_context_load()
|
||||
|
||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
|
||||
---
|
||||
defs.h | 2 ++
|
||||
sbitmap.c | 12 ++++++++++--
|
||||
symbols.c | 2 ++
|
||||
3 files changed, 14 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/defs.h b/defs.h
|
||||
index 0aeb98c4f654..ecbced24d2e3 100644
|
||||
--- a/defs.h
|
||||
+++ b/defs.h
|
||||
@@ -2169,6 +2169,7 @@ struct offset_table { /* stash of commonly-used offsets */
|
||||
long sbq_wait_state_wait_cnt;
|
||||
long sbq_wait_state_wait;
|
||||
long sbitmap_alloc_hint;
|
||||
+ long sbitmap_round_robin;
|
||||
};
|
||||
|
||||
struct size_table { /* stash of commonly-used sizes */
|
||||
@@ -5909,6 +5910,7 @@ struct sbitmap_context {
|
||||
unsigned map_nr;
|
||||
ulong map_addr;
|
||||
ulong alloc_hint;
|
||||
+ bool round_robin;
|
||||
};
|
||||
|
||||
typedef bool (*sbitmap_for_each_fn)(unsigned int idx, void *p);
|
||||
diff --git a/sbitmap.c b/sbitmap.c
|
||||
index 2921d5447c65..7b318b533702 100644
|
||||
--- a/sbitmap.c
|
||||
+++ b/sbitmap.c
|
||||
@@ -352,7 +352,11 @@ static void sbitmap_queue_show(const struct sbitmap_queue_context *sqc,
|
||||
|
||||
FREEBUF(sbq_wait_state_buf);
|
||||
|
||||
- fprintf(fp, "round_robin = %d\n", sqc->round_robin);
|
||||
+ if (VALID_MEMBER(sbitmap_queue_round_robin))
|
||||
+ fprintf(fp, "round_robin = %d\n", sqc->round_robin);
|
||||
+ else if (VALID_MEMBER(sbitmap_round_robin)) /* 5.13 and later */
|
||||
+ fprintf(fp, "round_robin = %d\n", sc->round_robin);
|
||||
+
|
||||
fprintf(fp, "min_shallow_depth = %u\n", sqc->min_shallow_depth);
|
||||
}
|
||||
|
||||
@@ -374,7 +378,8 @@ static void sbitmap_queue_context_load(ulong addr, struct sbitmap_queue_context
|
||||
sqc->wake_index = INT(sbitmap_queue_buf + OFFSET(sbitmap_queue_wake_index));
|
||||
sqc->ws_addr = ULONG(sbitmap_queue_buf + OFFSET(sbitmap_queue_ws));
|
||||
sqc->ws_active = INT(sbitmap_queue_buf + OFFSET(sbitmap_queue_ws_active));
|
||||
- sqc->round_robin = BOOL(sbitmap_queue_buf + OFFSET(sbitmap_queue_round_robin));
|
||||
+ if (VALID_MEMBER(sbitmap_queue_round_robin))
|
||||
+ sqc->round_robin = BOOL(sbitmap_queue_buf + OFFSET(sbitmap_queue_round_robin));
|
||||
sqc->min_shallow_depth = UINT(sbitmap_queue_buf + OFFSET(sbitmap_queue_min_shallow_depth));
|
||||
|
||||
FREEBUF(sbitmap_queue_buf);
|
||||
@@ -396,6 +401,8 @@ void sbitmap_context_load(ulong addr, struct sbitmap_context *sc)
|
||||
sc->map_addr = ULONG(sbitmap_buf + OFFSET(sbitmap_map));
|
||||
if (VALID_MEMBER(sbitmap_alloc_hint))
|
||||
sc->alloc_hint = ULONG(sbitmap_buf + OFFSET(sbitmap_alloc_hint));
|
||||
+ if (VALID_MEMBER(sbitmap_round_robin))
|
||||
+ sc->round_robin = BOOL(sbitmap_buf + OFFSET(sbitmap_round_robin));
|
||||
|
||||
FREEBUF(sbitmap_buf);
|
||||
}
|
||||
@@ -522,6 +529,7 @@ void sbitmapq_init(void)
|
||||
MEMBER_OFFSET_INIT(sbitmap_map_nr, "sbitmap", "map_nr");
|
||||
MEMBER_OFFSET_INIT(sbitmap_map, "sbitmap", "map");
|
||||
MEMBER_OFFSET_INIT(sbitmap_alloc_hint, "sbitmap", "alloc_hint");
|
||||
+ MEMBER_OFFSET_INIT(sbitmap_round_robin, "sbitmap", "round_robin");
|
||||
|
||||
MEMBER_OFFSET_INIT(sbitmap_queue_sb, "sbitmap_queue", "sb");
|
||||
MEMBER_OFFSET_INIT(sbitmap_queue_alloc_hint, "sbitmap_queue", "alloc_hint");
|
||||
diff --git a/symbols.c b/symbols.c
|
||||
index fd0eb06899f0..5d12a021c769 100644
|
||||
--- a/symbols.c
|
||||
+++ b/symbols.c
|
||||
@@ -10710,6 +10710,8 @@ dump_offset_table(char *spec, ulong makestruct)
|
||||
OFFSET(sbitmap_map));
|
||||
fprintf(fp, " sbitmap_alloc_hint: %ld\n",
|
||||
OFFSET(sbitmap_alloc_hint));
|
||||
+ fprintf(fp, " sbitmap_round_robin: %ld\n",
|
||||
+ OFFSET(sbitmap_round_robin));
|
||||
fprintf(fp, " sbitmap_queue_sb: %ld\n",
|
||||
OFFSET(sbitmap_queue_sb));
|
||||
fprintf(fp, " sbitmap_queue_alloc_hint: %ld\n",
|
||||
--
|
||||
2.30.2
|
||||
|
@ -1,45 +0,0 @@
|
||||
From c67ce5bbb8e37d28f1c26b239b203a6561f574c1 Mon Sep 17 00:00:00 2001
|
||||
From: Hari Bathini <hbathini@linux.ibm.com>
|
||||
Date: Mon, 4 Jul 2022 10:55:41 +0530
|
||||
Subject: [PATCH 05/29] ppc64: fix bt for '-S' case
|
||||
|
||||
Passing '-S' option to 'bt' command was intended to specify the stack
|
||||
pointer manually. But get_stack_frame() handling on ppc64 is ignoring
|
||||
this option altogether. Fix it.
|
||||
|
||||
Signed-off-by: Hari Bathini <hbathini@linux.ibm.com>
|
||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
|
||||
---
|
||||
ppc64.c | 16 ++++++++++++++++
|
||||
1 file changed, 16 insertions(+)
|
||||
|
||||
diff --git a/ppc64.c b/ppc64.c
|
||||
index 975caa53b812..0e1d8678eef5 100644
|
||||
--- a/ppc64.c
|
||||
+++ b/ppc64.c
|
||||
@@ -2330,6 +2330,22 @@ ppc64_vmcore_stack_frame(struct bt_info *bt_in, ulong *nip, ulong *ksp)
|
||||
|
||||
pt_regs = (struct ppc64_pt_regs *)bt_in->machdep;
|
||||
if (!pt_regs || !pt_regs->gpr[1]) {
|
||||
+ if (bt_in->hp) {
|
||||
+ if (bt_in->hp->esp) {
|
||||
+ *ksp = bt_in->hp->esp;
|
||||
+ if (!bt_in->hp->eip) {
|
||||
+ if (IS_KVADDR(*ksp)) {
|
||||
+ readmem(*ksp+16, KVADDR, &unip, sizeof(ulong),
|
||||
+ "Regs NIP value", FAULT_ON_ERROR);
|
||||
+ *nip = unip;
|
||||
+ }
|
||||
+ } else
|
||||
+ *nip = bt_in->hp->eip;
|
||||
+
|
||||
+ }
|
||||
+ return TRUE;
|
||||
+ }
|
||||
+
|
||||
/*
|
||||
* Not collected regs. May be the corresponding CPU not
|
||||
* responded to an IPI in case of KDump OR f/w has not
|
||||
--
|
||||
2.37.1
|
||||
|
@ -1,101 +0,0 @@
|
||||
From 3750803f6ae5f5ad071f86ca916dbbb17b7a83a5 Mon Sep 17 00:00:00 2001
|
||||
From: Lianbo Jiang <lijiang@redhat.com>
|
||||
Date: Mon, 23 May 2022 18:04:16 +0800
|
||||
Subject: [PATCH 05/16] sbitmapq: fix invalid offset for "sbitmap_word_depth"
|
||||
on Linux v5.18-rc1
|
||||
|
||||
Kernel commit 3301bc53358a ("lib/sbitmap: kill 'depth' from sbitmap_word")
|
||||
removed the depth member from struct sbitmap_word. Without the patch, the
|
||||
sbitmapq will fail:
|
||||
|
||||
crash> sbitmapq 0xffff8e99d0dc8010
|
||||
|
||||
sbitmapq: invalid structure member offset: sbitmap_word_depth
|
||||
FILE: sbitmap.c LINE: 84 FUNCTION: __sbitmap_weight()
|
||||
|
||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
|
||||
---
|
||||
sbitmap.c | 19 +++++++++++--------
|
||||
1 file changed, 11 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/sbitmap.c b/sbitmap.c
|
||||
index 7b318b533702..e8ebd62fe01c 100644
|
||||
--- a/sbitmap.c
|
||||
+++ b/sbitmap.c
|
||||
@@ -78,10 +78,16 @@ static unsigned long bitmap_weight(unsigned long bitmap, unsigned int bits)
|
||||
return w;
|
||||
}
|
||||
|
||||
+static inline unsigned int __map_depth(const struct sbitmap_context *sc, int index)
|
||||
+{
|
||||
+ if (index == sc->map_nr - 1)
|
||||
+ return sc->depth - (index << sc->shift);
|
||||
+ return 1U << sc->shift;
|
||||
+}
|
||||
+
|
||||
static unsigned int __sbitmap_weight(const struct sbitmap_context *sc, bool set)
|
||||
{
|
||||
const ulong sbitmap_word_size = SIZE(sbitmap_word);
|
||||
- const ulong w_depth_off = OFFSET(sbitmap_word_depth);
|
||||
const ulong w_word_off = OFFSET(sbitmap_word_word);
|
||||
const ulong w_cleared_off = OFFSET(sbitmap_word_cleared);
|
||||
|
||||
@@ -99,7 +105,7 @@ static unsigned int __sbitmap_weight(const struct sbitmap_context *sc, bool set)
|
||||
error(FATAL, "cannot read sbitmap_word\n");
|
||||
}
|
||||
|
||||
- depth = ULONG(sbitmap_word_buf + w_depth_off);
|
||||
+ depth = __map_depth(sc, i);
|
||||
|
||||
if (set) {
|
||||
word = ULONG(sbitmap_word_buf + w_word_off);
|
||||
@@ -142,7 +148,6 @@ static void sbitmap_emit_byte(unsigned int offset, uint8_t byte)
|
||||
static void sbitmap_bitmap_show(const struct sbitmap_context *sc)
|
||||
{
|
||||
const ulong sbitmap_word_size = SIZE(sbitmap_word);
|
||||
- const ulong w_depth_off = OFFSET(sbitmap_word_depth);
|
||||
const ulong w_word_off = OFFSET(sbitmap_word_word);
|
||||
const ulong w_cleared_off = OFFSET(sbitmap_word_cleared);
|
||||
|
||||
@@ -165,7 +170,7 @@ static void sbitmap_bitmap_show(const struct sbitmap_context *sc)
|
||||
|
||||
word = ULONG(sbitmap_word_buf + w_word_off);
|
||||
cleared = ULONG(sbitmap_word_buf + w_cleared_off);
|
||||
- word_bits = ULONG(sbitmap_word_buf + w_depth_off);
|
||||
+ word_bits = __map_depth(sc, i);
|
||||
|
||||
word &= ~cleared;
|
||||
|
||||
@@ -213,7 +218,6 @@ static void __sbitmap_for_each_set(const struct sbitmap_context *sc,
|
||||
unsigned int start, sbitmap_for_each_fn fn, void *data)
|
||||
{
|
||||
const ulong sbitmap_word_size = SIZE(sbitmap_word);
|
||||
- const ulong w_depth_off = OFFSET(sbitmap_word_depth);
|
||||
const ulong w_word_off = OFFSET(sbitmap_word_word);
|
||||
const ulong w_cleared_off = OFFSET(sbitmap_word_cleared);
|
||||
|
||||
@@ -232,7 +236,7 @@ static void __sbitmap_for_each_set(const struct sbitmap_context *sc,
|
||||
|
||||
while (scanned < sc->depth) {
|
||||
unsigned long w_addr = sc->map_addr + (sbitmap_word_size * index);
|
||||
- unsigned long w_depth, w_word, w_cleared;
|
||||
+ unsigned long w_word, w_cleared;
|
||||
unsigned long word, depth;
|
||||
|
||||
if (!readmem(w_addr, KVADDR, sbitmap_word_buf, sbitmap_word_size, "sbitmap_word", RETURN_ON_ERROR)) {
|
||||
@@ -240,11 +244,10 @@ static void __sbitmap_for_each_set(const struct sbitmap_context *sc,
|
||||
error(FATAL, "cannot read sbitmap_word\n");
|
||||
}
|
||||
|
||||
- w_depth = ULONG(sbitmap_word_buf + w_depth_off);
|
||||
w_word = ULONG(sbitmap_word_buf + w_word_off);
|
||||
w_cleared = ULONG(sbitmap_word_buf + w_cleared_off);
|
||||
|
||||
- depth = min(w_depth - nr, sc->depth - scanned);
|
||||
+ depth = min(__map_depth(sc, index) - nr, sc->depth - scanned);
|
||||
|
||||
scanned += depth;
|
||||
word = w_word & ~w_cleared;
|
||||
--
|
||||
2.30.2
|
||||
|
@ -1,27 +0,0 @@
|
||||
From 9705669a49c341402efd8528e8fe809379dd798d Mon Sep 17 00:00:00 2001
|
||||
From: Kazuhito Hagio <k-hagio-ab@nec.com>
|
||||
Date: Mon, 23 May 2022 14:48:50 +0900
|
||||
Subject: [PATCH 06/16] Makefile: add missing crash_target.o to be cleaned
|
||||
|
||||
Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
|
||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
|
||||
---
|
||||
Makefile | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/Makefile b/Makefile
|
||||
index e520b1217a9d..162c2baa5164 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -184,7 +184,7 @@ GDB_7.6_FILES=
|
||||
GDB_7.6_OFILES=${GDB}/gdb/symtab.o
|
||||
|
||||
GDB_10.2_FILES=
|
||||
-GDB_10.2_OFILES=${GDB}/gdb/symtab.o
|
||||
+GDB_10.2_OFILES=${GDB}/gdb/symtab.o crash_target.o
|
||||
|
||||
#
|
||||
# GDB_FLAGS is passed up from the gdb Makefile.
|
||||
--
|
||||
2.30.2
|
||||
|
@ -1,147 +0,0 @@
|
||||
From 3ee5956721d9a67fe8d4c6d5022aa022c5f9a11c Mon Sep 17 00:00:00 2001
|
||||
From: Hari Bathini <hbathini@linux.ibm.com>
|
||||
Date: Mon, 4 Jul 2022 10:55:42 +0530
|
||||
Subject: [PATCH 06/29] ppc64: dynamically allocate h/w interrupt stack
|
||||
|
||||
Only older kernel (v2.4) used h/w interrupt stack to store frames when
|
||||
CPU received IPI. Memory used for this in 'struct machine_specific' is
|
||||
useless for later kernels. For the sake of backward compatibility keep
|
||||
h/w interrupt stack but dynamically allocate memory for it and save
|
||||
some bytes from being wasted.
|
||||
|
||||
Signed-off-by: Hari Bathini <hbathini@linux.ibm.com>
|
||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
|
||||
---
|
||||
defs.h | 2 +-
|
||||
ppc64.c | 51 +++++++++++++++++++++------------------------------
|
||||
2 files changed, 22 insertions(+), 31 deletions(-)
|
||||
|
||||
diff --git a/defs.h b/defs.h
|
||||
index 7d3b73422f48..d1d3ea919e70 100644
|
||||
--- a/defs.h
|
||||
+++ b/defs.h
|
||||
@@ -6303,7 +6303,7 @@ struct ppc64_vmemmap {
|
||||
* Used to store the HW interrupt stack. It is only for 2.4.
|
||||
*/
|
||||
struct machine_specific {
|
||||
- ulong hwintrstack[NR_CPUS];
|
||||
+ ulong *hwintrstack;
|
||||
char *hwstackbuf;
|
||||
uint hwstacksize;
|
||||
|
||||
diff --git a/ppc64.c b/ppc64.c
|
||||
index 0e1d8678eef5..272eb207074a 100644
|
||||
--- a/ppc64.c
|
||||
+++ b/ppc64.c
|
||||
@@ -256,7 +256,7 @@ static int set_ppc64_max_physmem_bits(void)
|
||||
}
|
||||
|
||||
struct machine_specific ppc64_machine_specific = {
|
||||
- .hwintrstack = { 0 },
|
||||
+ .hwintrstack = NULL,
|
||||
.hwstackbuf = 0,
|
||||
.hwstacksize = 0,
|
||||
.pte_rpn_shift = PTE_RPN_SHIFT_DEFAULT,
|
||||
@@ -275,7 +275,7 @@ struct machine_specific ppc64_machine_specific = {
|
||||
};
|
||||
|
||||
struct machine_specific book3e_machine_specific = {
|
||||
- .hwintrstack = { 0 },
|
||||
+ .hwintrstack = NULL,
|
||||
.hwstackbuf = 0,
|
||||
.hwstacksize = 0,
|
||||
.pte_rpn_shift = PTE_RPN_SHIFT_L4_BOOK3E_64K,
|
||||
@@ -676,6 +676,9 @@ ppc64_init(int when)
|
||||
*/
|
||||
offset = MEMBER_OFFSET("paca_struct", "xHrdIntStack");
|
||||
paca_sym = symbol_value("paca");
|
||||
+ if (!(machdep->machspec->hwintrstack =
|
||||
+ (ulong *)calloc(NR_CPUS, sizeof(ulong))))
|
||||
+ error(FATAL, "cannot malloc hwintrstack space.");
|
||||
for (cpu = 0; cpu < kt->cpus; cpu++) {
|
||||
readmem(paca_sym + (paca_size * cpu) + offset,
|
||||
KVADDR,
|
||||
@@ -686,14 +689,9 @@ ppc64_init(int when)
|
||||
machdep->machspec->hwstacksize = 8 * machdep->pagesize;
|
||||
if ((machdep->machspec->hwstackbuf = (char *)
|
||||
malloc(machdep->machspec->hwstacksize)) == NULL)
|
||||
- error(FATAL, "cannot malloc hwirqstack space.");
|
||||
- } else
|
||||
- /*
|
||||
- * 'xHrdIntStack' member in "paca_struct" is not
|
||||
- * available for 2.6 kernel.
|
||||
- */
|
||||
- BZERO(&machdep->machspec->hwintrstack,
|
||||
- NR_CPUS*sizeof(ulong));
|
||||
+ error(FATAL, "cannot malloc hwirqstack buffer space.");
|
||||
+ }
|
||||
+
|
||||
if (!machdep->hz) {
|
||||
machdep->hz = HZ;
|
||||
if (THIS_KERNEL_VERSION >= LINUX(2,6,0))
|
||||
@@ -846,23 +844,15 @@ ppc64_dump_machdep_table(ulong arg)
|
||||
fprintf(fp, " is_vmaddr: %s\n",
|
||||
machdep->machspec->is_vmaddr == book3e_is_vmaddr ?
|
||||
"book3e_is_vmaddr()" : "ppc64_is_vmaddr()");
|
||||
- fprintf(fp, " hwintrstack[%d]: ", NR_CPUS);
|
||||
- for (c = 0; c < NR_CPUS; c++) {
|
||||
- for (others = 0, i = c; i < NR_CPUS; i++) {
|
||||
- if (machdep->machspec->hwintrstack[i])
|
||||
- others++;
|
||||
+ if (machdep->machspec->hwintrstack) {
|
||||
+ fprintf(fp, " hwintrstack[%d]: ", NR_CPUS);
|
||||
+ for (c = 0; c < NR_CPUS; c++) {
|
||||
+ fprintf(fp, "%s%016lx ",
|
||||
+ ((c % 4) == 0) ? "\n " : "",
|
||||
+ machdep->machspec->hwintrstack[c]);
|
||||
}
|
||||
- if (!others) {
|
||||
- fprintf(fp, "%s%s",
|
||||
- c && ((c % 4) == 0) ? "\n " : "",
|
||||
- c ? "(remainder unused)" : "(unused)");
|
||||
- break;
|
||||
- }
|
||||
-
|
||||
- fprintf(fp, "%s%016lx ",
|
||||
- ((c % 4) == 0) ? "\n " : "",
|
||||
- machdep->machspec->hwintrstack[c]);
|
||||
- }
|
||||
+ } else
|
||||
+ fprintf(fp, " hwintrstack: (unused)");
|
||||
fprintf(fp, "\n");
|
||||
fprintf(fp, " hwstackbuf: %lx\n", (ulong)machdep->machspec->hwstackbuf);
|
||||
fprintf(fp, " hwstacksize: %d\n", machdep->machspec->hwstacksize);
|
||||
@@ -1683,9 +1673,10 @@ ppc64_check_sp_in_HWintrstack(ulong sp, struct bt_info *bt)
|
||||
*
|
||||
* Note: HW Interrupt stack is used only in 2.4 kernel.
|
||||
*/
|
||||
- if (is_task_active(bt->task) && (tt->panic_task != bt->task) &&
|
||||
- machdep->machspec->hwintrstack[bt->tc->processor]) {
|
||||
+ if (machdep->machspec->hwintrstack && is_task_active(bt->task) &&
|
||||
+ (bt->task != tt->panic_task)) {
|
||||
ulong newsp;
|
||||
+
|
||||
readmem(machdep->machspec->hwintrstack[bt->tc->processor],
|
||||
KVADDR, &newsp, sizeof(ulong),
|
||||
"stack pointer", FAULT_ON_ERROR);
|
||||
@@ -1958,7 +1949,7 @@ ppc64_back_trace(struct gnu_request *req, struct bt_info *bt)
|
||||
bt->stackbase = irqstack;
|
||||
bt->stacktop = bt->stackbase + STACKSIZE();
|
||||
alter_stackbuf(bt);
|
||||
- } else if (ms->hwintrstack[bt->tc->processor]) {
|
||||
+ } else if (ms->hwintrstack) {
|
||||
bt->stacktop = ms->hwintrstack[bt->tc->processor] +
|
||||
sizeof(ulong);
|
||||
bt->stackbase = ms->hwintrstack[bt->tc->processor] -
|
||||
@@ -2555,7 +2546,7 @@ retry:
|
||||
goto retry;
|
||||
}
|
||||
|
||||
- if (check_intrstack && ms->hwintrstack[bt->tc->processor]) {
|
||||
+ if (check_intrstack && ms->hwintrstack) {
|
||||
bt->stacktop = ms->hwintrstack[bt->tc->processor] +
|
||||
sizeof(ulong);
|
||||
bt->stackbase = ms->hwintrstack[bt->tc->processor] -
|
||||
--
|
||||
2.37.1
|
||||
|
@ -1,205 +0,0 @@
|
||||
From 6833262bf87177d8affe4f91b2e7d2c76ecdf636 Mon Sep 17 00:00:00 2001
|
||||
From: Qi Zheng <zhengqi.arch@bytedance.com>
|
||||
Date: Tue, 24 May 2022 20:25:53 +0800
|
||||
Subject: [PATCH 07/16] bt: x86_64: filter out idle task stack
|
||||
|
||||
When we use crash to troubleshoot softlockup and other problems,
|
||||
we often use the 'bt -a' command to print the stacks of running
|
||||
processes on all CPUs. But now some servers have hundreds of CPUs
|
||||
(such as AMD machines), which causes the 'bt -a' command to output
|
||||
a lot of process stacks. And many of these stacks are the stacks
|
||||
of the idle process, which are not needed by us.
|
||||
|
||||
Therefore, in order to reduce this part of the interference information,
|
||||
this patch adds the -n option to the bt command. When we specify
|
||||
'-n idle' (meaning no idle), the stack of the idle process will be
|
||||
filtered out, thus speeding up our troubleshooting.
|
||||
|
||||
And the option works only for crash dumps captured by kdump.
|
||||
|
||||
The command output is as follows:
|
||||
crash> bt -a -n idle
|
||||
[...]
|
||||
PID: 0 TASK: ffff889ff8c34380 CPU: 8 COMMAND: "swapper/8"
|
||||
|
||||
PID: 0 TASK: ffff889ff8c32d00 CPU: 9 COMMAND: "swapper/9"
|
||||
|
||||
PID: 0 TASK: ffff889ff8c31680 CPU: 10 COMMAND: "swapper/10"
|
||||
|
||||
PID: 0 TASK: ffff889ff8c35a00 CPU: 11 COMMAND: "swapper/11"
|
||||
|
||||
PID: 0 TASK: ffff889ff8c3c380 CPU: 12 COMMAND: "swapper/12"
|
||||
|
||||
PID: 150773 TASK: ffff889fe85a1680 CPU: 13 COMMAND: "bash"
|
||||
#0 [ffffc9000d35bcd0] machine_kexec at ffffffff8105a407
|
||||
#1 [ffffc9000d35bd28] __crash_kexec at ffffffff8113033d
|
||||
#2 [ffffc9000d35bdf0] panic at ffffffff81081930
|
||||
#3 [ffffc9000d35be70] sysrq_handle_crash at ffffffff814e38d1
|
||||
#4 [ffffc9000d35be78] __handle_sysrq.cold.12 at ffffffff814e4175
|
||||
#5 [ffffc9000d35bea8] write_sysrq_trigger at ffffffff814e404b
|
||||
#6 [ffffc9000d35beb8] proc_reg_write at ffffffff81330d86
|
||||
#7 [ffffc9000d35bed0] vfs_write at ffffffff812a72d5
|
||||
#8 [ffffc9000d35bf00] ksys_write at ffffffff812a7579
|
||||
#9 [ffffc9000d35bf38] do_syscall_64 at ffffffff81004259
|
||||
RIP: 00007fa7abcdc274 RSP: 00007fffa731f678 RFLAGS: 00000246
|
||||
RAX: ffffffffffffffda RBX: 0000000000000002 RCX: 00007fa7abcdc274
|
||||
RDX: 0000000000000002 RSI: 0000563ca51ee6d0 RDI: 0000000000000001
|
||||
RBP: 0000563ca51ee6d0 R8: 000000000000000a R9: 00007fa7abd6be80
|
||||
R10: 000000000000000a R11: 0000000000000246 R12: 00007fa7abdad760
|
||||
R13: 0000000000000002 R14: 00007fa7abda8760 R15: 0000000000000002
|
||||
ORIG_RAX: 0000000000000001 CS: 0033 SS: 002b
|
||||
[...]
|
||||
|
||||
Signed-off-by: Qi Zheng <zhengqi.arch@bytedance.com>
|
||||
Acked-by: Kazuhito Hagio <k-hagio-ab@nec.com>
|
||||
Acked-by: Lianbo Jiang <lijiang@redhat.com>
|
||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
|
||||
---
|
||||
defs.h | 1 +
|
||||
help.c | 33 ++++++++++++++++++++++++++++++++-
|
||||
kernel.c | 13 ++++++++++++-
|
||||
x86_64.c | 8 ++++++++
|
||||
4 files changed, 53 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/defs.h b/defs.h
|
||||
index ecbced24d2e3..c8444b4e54eb 100644
|
||||
--- a/defs.h
|
||||
+++ b/defs.h
|
||||
@@ -5832,6 +5832,7 @@ ulong cpu_map_addr(const char *type);
|
||||
#define BT_SHOW_ALL_REGS (0x2000000000000ULL)
|
||||
#define BT_REGS_NOT_FOUND (0x4000000000000ULL)
|
||||
#define BT_OVERFLOW_STACK (0x8000000000000ULL)
|
||||
+#define BT_SKIP_IDLE (0x10000000000000ULL)
|
||||
#define BT_SYMBOL_OFFSET (BT_SYMBOLIC_ARGS)
|
||||
|
||||
#define BT_REF_HEXVAL (0x1)
|
||||
diff --git a/help.c b/help.c
|
||||
index 51a0fe3d687c..e1bbc5abe029 100644
|
||||
--- a/help.c
|
||||
+++ b/help.c
|
||||
@@ -1909,12 +1909,14 @@ char *help_bt[] = {
|
||||
"bt",
|
||||
"backtrace",
|
||||
"[-a|-c cpu(s)|-g|-r|-t|-T|-l|-e|-E|-f|-F|-o|-O|-v|-p] [-R ref] [-s [-x|d]]"
|
||||
-"\n [-I ip] [-S sp] [pid | task]",
|
||||
+"\n [-I ip] [-S sp] [-n idle] [pid | task]",
|
||||
" Display a kernel stack backtrace. If no arguments are given, the stack",
|
||||
" trace of the current context will be displayed.\n",
|
||||
" -a displays the stack traces of the active task on each CPU.",
|
||||
" (only applicable to crash dumps)",
|
||||
" -A same as -a, but also displays vector registers (S390X only).",
|
||||
+" -n idle filter the stack of idle tasks (x86_64).",
|
||||
+" (only applicable to crash dumps)",
|
||||
" -p display the stack trace of the panic task only.",
|
||||
" (only applicable to crash dumps)",
|
||||
" -c cpu display the stack trace of the active task on one or more CPUs,",
|
||||
@@ -2004,6 +2006,35 @@ char *help_bt[] = {
|
||||
" DS: 002b ESI: bfffc8a0 ES: 002b EDI: 00000000 ",
|
||||
" SS: 002b ESP: bfffc82c EBP: bfffd224 ",
|
||||
" CS: 0023 EIP: 400d032e ERR: 0000008e EFLAGS: 00000246 ",
|
||||
+" ",
|
||||
+" Display the stack trace of the active task(s) when the kernel panicked,",
|
||||
+" and filter out the stack of the idle tasks:",
|
||||
+" ",
|
||||
+" %s> bt -a -n idle",
|
||||
+" ...",
|
||||
+" PID: 0 TASK: ffff889ff8c35a00 CPU: 11 COMMAND: \"swapper/11\"",
|
||||
+" ",
|
||||
+" PID: 0 TASK: ffff889ff8c3c380 CPU: 12 COMMAND: \"swapper/12\"",
|
||||
+" ",
|
||||
+" PID: 150773 TASK: ffff889fe85a1680 CPU: 13 COMMAND: \"bash\"",
|
||||
+" #0 [ffffc9000d35bcd0] machine_kexec at ffffffff8105a407",
|
||||
+" #1 [ffffc9000d35bd28] __crash_kexec at ffffffff8113033d",
|
||||
+" #2 [ffffc9000d35bdf0] panic at ffffffff81081930",
|
||||
+" #3 [ffffc9000d35be70] sysrq_handle_crash at ffffffff814e38d1",
|
||||
+" #4 [ffffc9000d35be78] __handle_sysrq.cold.12 at ffffffff814e4175",
|
||||
+" #5 [ffffc9000d35bea8] write_sysrq_trigger at ffffffff814e404b",
|
||||
+" #6 [ffffc9000d35beb8] proc_reg_write at ffffffff81330d86",
|
||||
+" #7 [ffffc9000d35bed0] vfs_write at ffffffff812a72d5",
|
||||
+" #8 [ffffc9000d35bf00] ksys_write at ffffffff812a7579",
|
||||
+" #9 [ffffc9000d35bf38] do_syscall_64 at ffffffff81004259",
|
||||
+" RIP: 00007fa7abcdc274 RSP: 00007fffa731f678 RFLAGS: 00000246",
|
||||
+" RAX: ffffffffffffffda RBX: 0000000000000002 RCX: 00007fa7abcdc274",
|
||||
+" RDX: 0000000000000002 RSI: 0000563ca51ee6d0 RDI: 0000000000000001",
|
||||
+" RBP: 0000563ca51ee6d0 R8: 000000000000000a R9: 00007fa7abd6be80",
|
||||
+" R10: 000000000000000a R11: 0000000000000246 R12: 00007fa7abdad760",
|
||||
+" R13: 0000000000000002 R14: 00007fa7abda8760 R15: 0000000000000002",
|
||||
+" ORIG_RAX: 0000000000000001 CS: 0033 SS: 002b",
|
||||
+" ...",
|
||||
"\n Display the stack trace of the active task on CPU 0 and 1:\n",
|
||||
" %s> bt -c 0,1",
|
||||
" PID: 0 TASK: ffffffff81a8d020 CPU: 0 COMMAND: \"swapper\"",
|
||||
diff --git a/kernel.c b/kernel.c
|
||||
index d0921cf567d9..411e9da1e54f 100644
|
||||
--- a/kernel.c
|
||||
+++ b/kernel.c
|
||||
@@ -2503,7 +2503,7 @@ cmd_bt(void)
|
||||
if (kt->flags & USE_OPT_BT)
|
||||
bt->flags |= BT_OPT_BACK_TRACE;
|
||||
|
||||
- while ((c = getopt(argcnt, args, "D:fFI:S:c:aAloreEgstTdxR:Ovp")) != EOF) {
|
||||
+ while ((c = getopt(argcnt, args, "D:fFI:S:c:n:aAloreEgstTdxR:Ovp")) != EOF) {
|
||||
switch (c)
|
||||
{
|
||||
case 'f':
|
||||
@@ -2672,6 +2672,13 @@ cmd_bt(void)
|
||||
active++;
|
||||
break;
|
||||
|
||||
+ case 'n':
|
||||
+ if (machine_type("X86_64") && STREQ(optarg, "idle"))
|
||||
+ bt->flags |= BT_SKIP_IDLE;
|
||||
+ else
|
||||
+ option_not_supported(c);
|
||||
+ break;
|
||||
+
|
||||
case 'r':
|
||||
bt->flags |= BT_RAW;
|
||||
break;
|
||||
@@ -3092,6 +3099,10 @@ back_trace(struct bt_info *bt)
|
||||
} else
|
||||
machdep->get_stack_frame(bt, &eip, &esp);
|
||||
|
||||
+ /* skip idle task stack */
|
||||
+ if (bt->flags & BT_SKIP_IDLE)
|
||||
+ return;
|
||||
+
|
||||
if (bt->flags & BT_KSTACKP) {
|
||||
bt->stkptr = esp;
|
||||
return;
|
||||
diff --git a/x86_64.c b/x86_64.c
|
||||
index ecaefd2f46a8..cfafbcc4dabe 100644
|
||||
--- a/x86_64.c
|
||||
+++ b/x86_64.c
|
||||
@@ -4918,6 +4918,9 @@ x86_64_get_stack_frame(struct bt_info *bt, ulong *pcp, ulong *spp)
|
||||
if (bt->flags & BT_DUMPFILE_SEARCH)
|
||||
return x86_64_get_dumpfile_stack_frame(bt, pcp, spp);
|
||||
|
||||
+ if (bt->flags & BT_SKIP_IDLE)
|
||||
+ bt->flags &= ~BT_SKIP_IDLE;
|
||||
+
|
||||
if (pcp)
|
||||
*pcp = x86_64_get_pc(bt);
|
||||
if (spp)
|
||||
@@ -4960,6 +4963,9 @@ x86_64_get_dumpfile_stack_frame(struct bt_info *bt_in, ulong *rip, ulong *rsp)
|
||||
estack = -1;
|
||||
panic = FALSE;
|
||||
|
||||
+ if (bt_in->flags & BT_SKIP_IDLE)
|
||||
+ bt_in->flags &= ~BT_SKIP_IDLE;
|
||||
+
|
||||
panic_task = tt->panic_task == bt->task ? TRUE : FALSE;
|
||||
|
||||
if (panic_task && bt->machdep) {
|
||||
@@ -5098,6 +5104,8 @@ next_sysrq:
|
||||
if (!panic_task && STREQ(sym, "crash_nmi_callback")) {
|
||||
*rip = *up;
|
||||
*rsp = bt->stackbase + ((char *)(up) - bt->stackbuf);
|
||||
+ if ((bt->flags & BT_SKIP_IDLE) && is_idle_thread(bt->task))
|
||||
+ bt_in->flags |= BT_SKIP_IDLE;
|
||||
return;
|
||||
}
|
||||
|
||||
--
|
||||
2.30.2
|
||||
|
@ -1,56 +0,0 @@
|
||||
From 4d1b968abb286ea39ea080ae073b0e2b5bfe6c4e Mon Sep 17 00:00:00 2001
|
||||
From: Hari Bathini <hbathini@linux.ibm.com>
|
||||
Date: Mon, 4 Jul 2022 10:55:43 +0530
|
||||
Subject: [PATCH 07/29] ppc64: rename ppc64_paca_init to
|
||||
ppc64_paca_percpu_offset_init
|
||||
|
||||
ppc64_paca_init() function is specifically used to initialize percpu
|
||||
data_offset for kernels older than v2.6.36. So, the name is slightly
|
||||
misleading. Rename it to ppc64_paca_percpu_offset_init to reflect its
|
||||
purpose.
|
||||
|
||||
Signed-off-by: Hari Bathini <hbathini@linux.ibm.com>
|
||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
|
||||
---
|
||||
ppc64.c | 9 +++++----
|
||||
1 file changed, 5 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/ppc64.c b/ppc64.c
|
||||
index 272eb207074a..0a3aa5f7af91 100644
|
||||
--- a/ppc64.c
|
||||
+++ b/ppc64.c
|
||||
@@ -52,7 +52,7 @@ static char * ppc64_check_eframe(struct ppc64_pt_regs *);
|
||||
static void ppc64_print_eframe(char *, struct ppc64_pt_regs *,
|
||||
struct bt_info *);
|
||||
static void parse_cmdline_args(void);
|
||||
-static int ppc64_paca_init(int);
|
||||
+static int ppc64_paca_percpu_offset_init(int);
|
||||
static void ppc64_init_cpu_info(void);
|
||||
static int ppc64_get_cpu_map(void);
|
||||
static void ppc64_clear_machdep_cache(void);
|
||||
@@ -3285,7 +3285,7 @@ parse_cmdline_args(void)
|
||||
* Initialize the per cpu data_offset values from paca structure.
|
||||
*/
|
||||
static int
|
||||
-ppc64_paca_init(int map)
|
||||
+ppc64_paca_percpu_offset_init(int map)
|
||||
{
|
||||
int i, cpus, nr_paca;
|
||||
char *cpu_paca_buf;
|
||||
@@ -3387,10 +3387,11 @@ ppc64_init_cpu_info(void)
|
||||
* which was removed post v2.6.15 ppc64 and now we get the per cpu
|
||||
* data_offset from __per_cpu_offset symbol during kernel_init()
|
||||
* call. Hence for backward (pre-2.6.36) compatibility, call
|
||||
- * ppc64_paca_init() only if symbol __per_cpu_offset does not exist.
|
||||
+ * ppc64_paca_percpu_offset_init() only if symbol __per_cpu_offset
|
||||
+ * does not exist.
|
||||
*/
|
||||
if (!symbol_exists("__per_cpu_offset"))
|
||||
- cpus = ppc64_paca_init(map);
|
||||
+ cpus = ppc64_paca_percpu_offset_init(map);
|
||||
else {
|
||||
if (!(nr_cpus = get_array_length("__per_cpu_offset", NULL, 0)))
|
||||
nr_cpus = (kt->kernel_NR_CPUS ? kt->kernel_NR_CPUS :
|
||||
--
|
||||
2.37.1
|
||||
|
@ -1,96 +0,0 @@
|
||||
From 0f162febebc4d11a165dd40cee00f3b0ba691a52 Mon Sep 17 00:00:00 2001
|
||||
From: Qi Zheng <zhengqi.arch@bytedance.com>
|
||||
Date: Tue, 24 May 2022 20:25:54 +0800
|
||||
Subject: [PATCH 08/16] bt: arm64: add support for 'bt -n idle'
|
||||
|
||||
The '-n idle' option of bt command can help us filter the
|
||||
stack of the idle process when debugging the dumpfiles
|
||||
captured by kdump.
|
||||
|
||||
This patch supports this feature on ARM64.
|
||||
|
||||
Signed-off-by: Qi Zheng <zhengqi.arch@bytedance.com>
|
||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
|
||||
---
|
||||
arm64.c | 19 ++++++++++++++++---
|
||||
help.c | 2 +-
|
||||
kernel.c | 3 ++-
|
||||
3 files changed, 19 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/arm64.c b/arm64.c
|
||||
index 65f6cdf69fa6..0f615cf52bef 100644
|
||||
--- a/arm64.c
|
||||
+++ b/arm64.c
|
||||
@@ -3681,6 +3681,12 @@ arm64_get_dumpfile_stackframe(struct bt_info *bt, struct arm64_stackframe *frame
|
||||
{
|
||||
struct machine_specific *ms = machdep->machspec;
|
||||
struct arm64_pt_regs *ptregs;
|
||||
+ bool skip = false;
|
||||
+
|
||||
+ if (bt->flags & BT_SKIP_IDLE) {
|
||||
+ skip = true;
|
||||
+ bt->flags &= ~BT_SKIP_IDLE;
|
||||
+ }
|
||||
|
||||
if (!ms->panic_task_regs ||
|
||||
(!ms->panic_task_regs[bt->tc->processor].sp &&
|
||||
@@ -3713,8 +3719,11 @@ try_kernel:
|
||||
}
|
||||
|
||||
if (arm64_in_kdump_text(bt, frame) ||
|
||||
- arm64_in_kdump_text_on_irq_stack(bt))
|
||||
+ arm64_in_kdump_text_on_irq_stack(bt)) {
|
||||
bt->flags |= BT_KDUMP_ADJUST;
|
||||
+ if (skip && is_idle_thread(bt->task))
|
||||
+ bt->flags |= BT_SKIP_IDLE;
|
||||
+ }
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -3738,10 +3747,14 @@ arm64_get_stack_frame(struct bt_info *bt, ulong *pcp, ulong *spp)
|
||||
int ret;
|
||||
struct arm64_stackframe stackframe = { 0 };
|
||||
|
||||
- if (DUMPFILE() && is_task_active(bt->task))
|
||||
+ if (DUMPFILE() && is_task_active(bt->task)) {
|
||||
ret = arm64_get_dumpfile_stackframe(bt, &stackframe);
|
||||
- else
|
||||
+ } else {
|
||||
+ if (bt->flags & BT_SKIP_IDLE)
|
||||
+ bt->flags &= ~BT_SKIP_IDLE;
|
||||
+
|
||||
ret = arm64_get_stackframe(bt, &stackframe);
|
||||
+ }
|
||||
|
||||
if (!ret)
|
||||
error(WARNING,
|
||||
diff --git a/help.c b/help.c
|
||||
index e1bbc5abe029..99214c1590fa 100644
|
||||
--- a/help.c
|
||||
+++ b/help.c
|
||||
@@ -1915,7 +1915,7 @@ char *help_bt[] = {
|
||||
" -a displays the stack traces of the active task on each CPU.",
|
||||
" (only applicable to crash dumps)",
|
||||
" -A same as -a, but also displays vector registers (S390X only).",
|
||||
-" -n idle filter the stack of idle tasks (x86_64).",
|
||||
+" -n idle filter the stack of idle tasks (x86_64, arm64).",
|
||||
" (only applicable to crash dumps)",
|
||||
" -p display the stack trace of the panic task only.",
|
||||
" (only applicable to crash dumps)",
|
||||
diff --git a/kernel.c b/kernel.c
|
||||
index 411e9da1e54f..a521ef30cdb0 100644
|
||||
--- a/kernel.c
|
||||
+++ b/kernel.c
|
||||
@@ -2673,7 +2673,8 @@ cmd_bt(void)
|
||||
break;
|
||||
|
||||
case 'n':
|
||||
- if (machine_type("X86_64") && STREQ(optarg, "idle"))
|
||||
+ if ((machine_type("X86_64") || machine_type("ARM64")) &&
|
||||
+ STREQ(optarg, "idle"))
|
||||
bt->flags |= BT_SKIP_IDLE;
|
||||
else
|
||||
option_not_supported(c);
|
||||
--
|
||||
2.30.2
|
||||
|
@ -1,352 +0,0 @@
|
||||
From cdd57e8b16aba2f5714673368d6dbc7565d59841 Mon Sep 17 00:00:00 2001
|
||||
From: Hari Bathini <hbathini@linux.ibm.com>
|
||||
Date: Mon, 4 Jul 2022 10:55:44 +0530
|
||||
Subject: [PATCH 08/29] ppc64: handle backtrace when CPU is in an emergency
|
||||
stack
|
||||
|
||||
A CPU could be in an emergency stack when it is running in real mode
|
||||
or any special scenario like TM bad thing. Also, there are dedicated
|
||||
emergency stacks for machine check and system reset interrupt. Right
|
||||
now, no backtrace is provided if a CPU is in any of these stacks.
|
||||
This change ensures backtrace is processed appropriately even when
|
||||
a CPU is in any one of these emergency stacks. Also, if stack info
|
||||
cannot be found, print that message always instead of only when
|
||||
verbose logs are enabled.
|
||||
|
||||
Related kernel commits:
|
||||
729b0f715371 ("powerpc/book3s: Introduce exclusive emergency stack for machine check exception.")
|
||||
b1ee8a3de579 ("powerpc/64s: Dedicated system reset interrupt stack")
|
||||
|
||||
Signed-off-by: Hari Bathini <hbathini@linux.ibm.com>
|
||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
|
||||
---
|
||||
defs.h | 12 ++++
|
||||
ppc64.c | 203 ++++++++++++++++++++++++++++++++++++++++++++++++++++----
|
||||
2 files changed, 203 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/defs.h b/defs.h
|
||||
index d1d3ea919e70..9b1b69a4f421 100644
|
||||
--- a/defs.h
|
||||
+++ b/defs.h
|
||||
@@ -6288,6 +6288,13 @@ struct ppc64_elf_prstatus {
|
||||
|
||||
#ifdef PPC64
|
||||
|
||||
+enum emergency_stack_type {
|
||||
+ NONE_STACK = 0,
|
||||
+ EMERGENCY_STACK,
|
||||
+ NMI_EMERGENCY_STACK,
|
||||
+ MC_EMERGENCY_STACK
|
||||
+};
|
||||
+
|
||||
struct ppc64_opal {
|
||||
uint64_t base;
|
||||
uint64_t entry;
|
||||
@@ -6307,6 +6314,11 @@ struct machine_specific {
|
||||
char *hwstackbuf;
|
||||
uint hwstacksize;
|
||||
|
||||
+ /* Emergency stacks */
|
||||
+ ulong *emergency_sp;
|
||||
+ ulong *nmi_emergency_sp;
|
||||
+ ulong *mc_emergency_sp;
|
||||
+
|
||||
uint l4_index_size;
|
||||
uint l3_index_size;
|
||||
uint l2_index_size;
|
||||
diff --git a/ppc64.c b/ppc64.c
|
||||
index 0a3aa5f7af91..03047a85955d 100644
|
||||
--- a/ppc64.c
|
||||
+++ b/ppc64.c
|
||||
@@ -48,6 +48,10 @@ static ulong ppc64_get_stackbase(ulong);
|
||||
static ulong ppc64_get_stacktop(ulong);
|
||||
void ppc64_compiler_warning_stub(void);
|
||||
static ulong ppc64_in_irqstack(ulong);
|
||||
+static enum emergency_stack_type ppc64_in_emergency_stack(int cpu, ulong addr,
|
||||
+ bool verbose);
|
||||
+static void ppc64_set_bt_emergency_stack(enum emergency_stack_type type,
|
||||
+ struct bt_info *bt);
|
||||
static char * ppc64_check_eframe(struct ppc64_pt_regs *);
|
||||
static void ppc64_print_eframe(char *, struct ppc64_pt_regs *,
|
||||
struct bt_info *);
|
||||
@@ -56,6 +60,7 @@ static int ppc64_paca_percpu_offset_init(int);
|
||||
static void ppc64_init_cpu_info(void);
|
||||
static int ppc64_get_cpu_map(void);
|
||||
static void ppc64_clear_machdep_cache(void);
|
||||
+static void ppc64_init_paca_info(void);
|
||||
static void ppc64_vmemmap_init(void);
|
||||
static int ppc64_get_kvaddr_ranges(struct vaddr_range *);
|
||||
static uint get_ptetype(ulong pte);
|
||||
@@ -692,6 +697,8 @@ ppc64_init(int when)
|
||||
error(FATAL, "cannot malloc hwirqstack buffer space.");
|
||||
}
|
||||
|
||||
+ ppc64_init_paca_info();
|
||||
+
|
||||
if (!machdep->hz) {
|
||||
machdep->hz = HZ;
|
||||
if (THIS_KERNEL_VERSION >= LINUX(2,6,0))
|
||||
@@ -1204,6 +1211,70 @@ ppc64_kvtop(struct task_context *tc, ulong kvaddr,
|
||||
return ppc64_vtop(kvaddr, (ulong *)vt->kernel_pgd[0], paddr, verbose);
|
||||
}
|
||||
|
||||
+static void
|
||||
+ppc64_init_paca_info(void)
|
||||
+{
|
||||
+ struct machine_specific *ms = machdep->machspec;
|
||||
+ ulong *paca_ptr;
|
||||
+ int i;
|
||||
+
|
||||
+ if (!(paca_ptr = (ulong *)calloc(kt->cpus, sizeof(ulong))))
|
||||
+ error(FATAL, "cannot malloc paca pointers space.\n");
|
||||
+
|
||||
+ /* Get paca pointers for all CPUs. */
|
||||
+ if (symbol_exists("paca_ptrs")) {
|
||||
+ ulong paca_loc;
|
||||
+
|
||||
+ readmem(symbol_value("paca_ptrs"), KVADDR, &paca_loc, sizeof(void *),
|
||||
+ "paca double pointer", FAULT_ON_ERROR);
|
||||
+ readmem(paca_loc, KVADDR, paca_ptr, sizeof(void *) * kt->cpus,
|
||||
+ "paca pointers", FAULT_ON_ERROR);
|
||||
+ } else if (symbol_exists("paca") &&
|
||||
+ (get_symbol_type("paca", NULL, NULL) == TYPE_CODE_PTR)) {
|
||||
+ readmem(symbol_value("paca"), KVADDR, paca_ptr, sizeof(void *) * kt->cpus,
|
||||
+ "paca pointers", FAULT_ON_ERROR);
|
||||
+ } else {
|
||||
+ free(paca_ptr);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ /* Initialize emergency stacks info. */
|
||||
+ if (MEMBER_EXISTS("paca_struct", "emergency_sp")) {
|
||||
+ ulong offset = MEMBER_OFFSET("paca_struct", "emergency_sp");
|
||||
+
|
||||
+ if (!(ms->emergency_sp = (ulong *)calloc(kt->cpus, sizeof(ulong))))
|
||||
+ error(FATAL, "cannot malloc emergency stack space.\n");
|
||||
+ for (i = 0; i < kt->cpus; i++)
|
||||
+ readmem(paca_ptr[i] + offset, KVADDR, &ms->emergency_sp[i],
|
||||
+ sizeof(void *), "paca->emergency_sp",
|
||||
+ FAULT_ON_ERROR);
|
||||
+ }
|
||||
+
|
||||
+ if (MEMBER_EXISTS("paca_struct", "nmi_emergency_sp")) {
|
||||
+ ulong offset = MEMBER_OFFSET("paca_struct", "nmi_emergency_sp");
|
||||
+
|
||||
+ if (!(ms->nmi_emergency_sp = (ulong *)calloc(kt->cpus, sizeof(ulong))))
|
||||
+ error(FATAL, "cannot malloc NMI emergency stack space.\n");
|
||||
+ for (i = 0; i < kt->cpus; i++)
|
||||
+ readmem(paca_ptr[i] + offset, KVADDR, &ms->nmi_emergency_sp[i],
|
||||
+ sizeof(void *), "paca->nmi_emergency_sp",
|
||||
+ FAULT_ON_ERROR);
|
||||
+ }
|
||||
+
|
||||
+ if (MEMBER_EXISTS("paca_struct", "mc_emergency_sp")) {
|
||||
+ ulong offset = MEMBER_OFFSET("paca_struct", "mc_emergency_sp");
|
||||
+
|
||||
+ if (!(ms->mc_emergency_sp = (ulong *)calloc(kt->cpus, sizeof(ulong))))
|
||||
+ error(FATAL, "cannot malloc machine check emergency stack space.\n");
|
||||
+ for (i = 0; i < kt->cpus; i++)
|
||||
+ readmem(paca_ptr[i] + offset, KVADDR, &ms->mc_emergency_sp[i],
|
||||
+ sizeof(void *), "paca->mc_emergency_sp",
|
||||
+ FAULT_ON_ERROR);
|
||||
+ }
|
||||
+
|
||||
+ free(paca_ptr);
|
||||
+}
|
||||
+
|
||||
/*
|
||||
* Verify that the kernel has made the vmemmap list available,
|
||||
* and if so, stash the relevant data required to make vtop
|
||||
@@ -1755,6 +1826,11 @@ ppc64_eframe_search(struct bt_info *bt_in)
|
||||
addr = bt->stackbase +
|
||||
roundup(SIZE(thread_info), sizeof(ulong));
|
||||
} else if (!INSTACK(addr, bt)) {
|
||||
+ enum emergency_stack_type estype;
|
||||
+
|
||||
+ if ((estype = ppc64_in_emergency_stack(bt->tc->processor, addr, false)))
|
||||
+ ppc64_set_bt_emergency_stack(estype, bt);
|
||||
+
|
||||
/*
|
||||
* If the user specified SP is in HW interrupt stack
|
||||
* (only for tasks running on other CPUs and in 2.4
|
||||
@@ -1856,6 +1932,84 @@ ppc64_in_irqstack(ulong addr)
|
||||
return 0;
|
||||
}
|
||||
|
||||
+/*
|
||||
+ * Check if the CPU is running in any of its emergency stacks.
|
||||
+ * Returns
|
||||
+ * NONE_STACK : if input is invalid or addr is not within any emergency stack.
|
||||
+ * EMERGENCY_STACK : if the addr is within emergency stack.
|
||||
+ * NMI_EMERGENCY_STACK : if the addr is within NMI emergency stack.
|
||||
+ * MC_EMERGENCY_STACK : if the addr is within machine check emergency stack.
|
||||
+ */
|
||||
+static enum emergency_stack_type
|
||||
+ppc64_in_emergency_stack(int cpu, ulong addr, bool verbose)
|
||||
+{
|
||||
+ struct machine_specific *ms = machdep->machspec;
|
||||
+ ulong base, top;
|
||||
+
|
||||
+ if (cpu < 0 || cpu >= kt->cpus)
|
||||
+ return NONE_STACK;
|
||||
+
|
||||
+ if (ms->emergency_sp) {
|
||||
+ top = ms->emergency_sp[cpu];
|
||||
+ base = top - STACKSIZE();
|
||||
+ if (addr >= base && addr < top) {
|
||||
+ if (verbose)
|
||||
+ fprintf(fp, "---<Emergency Stack>---\n");
|
||||
+ return EMERGENCY_STACK;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (ms->nmi_emergency_sp) {
|
||||
+ top = ms->nmi_emergency_sp[cpu];
|
||||
+ base = top - STACKSIZE();
|
||||
+ if (addr >= base && addr < top) {
|
||||
+ if (verbose)
|
||||
+ fprintf(fp, "---<NMI Emergency Stack>---\n");
|
||||
+ return NMI_EMERGENCY_STACK;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (ms->mc_emergency_sp) {
|
||||
+ top = ms->mc_emergency_sp[cpu];
|
||||
+ base = top - STACKSIZE();
|
||||
+ if (addr >= base && addr < top) {
|
||||
+ if (verbose)
|
||||
+ fprintf(fp, "---<Machine Check Emergency Stack>---\n");
|
||||
+ return MC_EMERGENCY_STACK;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return NONE_STACK;
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+ppc64_set_bt_emergency_stack(enum emergency_stack_type type, struct bt_info *bt)
|
||||
+{
|
||||
+ struct machine_specific *ms = machdep->machspec;
|
||||
+ ulong top;
|
||||
+
|
||||
+ switch (type) {
|
||||
+ case EMERGENCY_STACK:
|
||||
+ top = ms->emergency_sp[bt->tc->processor];
|
||||
+ break;
|
||||
+ case NMI_EMERGENCY_STACK:
|
||||
+ top = ms->nmi_emergency_sp[bt->tc->processor];
|
||||
+ break;
|
||||
+ case MC_EMERGENCY_STACK:
|
||||
+ top = ms->mc_emergency_sp[bt->tc->processor];
|
||||
+ break;
|
||||
+ default:
|
||||
+ top = 0;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ if (top) {
|
||||
+ bt->stackbase = top - STACKSIZE();
|
||||
+ bt->stacktop = top;
|
||||
+ alter_stackbuf(bt);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
/*
|
||||
* Unroll a kernel stack.
|
||||
*/
|
||||
@@ -1936,10 +2090,13 @@ ppc64_back_trace_cmd(struct bt_info *bt)
|
||||
static void
|
||||
ppc64_back_trace(struct gnu_request *req, struct bt_info *bt)
|
||||
{
|
||||
- int frame = 0;
|
||||
- ulong lr = 0; /* hack...need to pass in initial lr reg */
|
||||
+ enum emergency_stack_type estype;
|
||||
ulong newpc = 0, newsp, marker;
|
||||
+ int c = bt->tc->processor;
|
||||
+ ulong nmi_sp = 0;
|
||||
int eframe_found;
|
||||
+ int frame = 0;
|
||||
+ ulong lr = 0; /* hack...need to pass in initial lr reg */
|
||||
|
||||
if (!INSTACK(req->sp, bt)) {
|
||||
ulong irqstack;
|
||||
@@ -1949,6 +2106,10 @@ ppc64_back_trace(struct gnu_request *req, struct bt_info *bt)
|
||||
bt->stackbase = irqstack;
|
||||
bt->stacktop = bt->stackbase + STACKSIZE();
|
||||
alter_stackbuf(bt);
|
||||
+ } else if ((estype = ppc64_in_emergency_stack(c, req->sp, true))) {
|
||||
+ if (estype == NMI_EMERGENCY_STACK)
|
||||
+ nmi_sp = req->sp;
|
||||
+ ppc64_set_bt_emergency_stack(estype, bt);
|
||||
} else if (ms->hwintrstack) {
|
||||
bt->stacktop = ms->hwintrstack[bt->tc->processor] +
|
||||
sizeof(ulong);
|
||||
@@ -1957,9 +2118,7 @@ ppc64_back_trace(struct gnu_request *req, struct bt_info *bt)
|
||||
bt->stackbuf = ms->hwstackbuf;
|
||||
alter_stackbuf(bt);
|
||||
} else {
|
||||
- if (CRASHDEBUG(1)) {
|
||||
- fprintf(fp, "cannot find the stack info.\n");
|
||||
- }
|
||||
+ fprintf(fp, "cannot find the stack info.\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -1989,13 +2148,20 @@ ppc64_back_trace(struct gnu_request *req, struct bt_info *bt)
|
||||
newsp =
|
||||
*(ulong *)&bt->stackbuf[newsp - bt->stackbase];
|
||||
if (!INSTACK(newsp, bt)) {
|
||||
- /*
|
||||
- * Switch HW interrupt stack to process's stack.
|
||||
- */
|
||||
- bt->stackbase = GET_STACKBASE(bt->task);
|
||||
- bt->stacktop = GET_STACKTOP(bt->task);
|
||||
- alter_stackbuf(bt);
|
||||
- }
|
||||
+ if ((estype = ppc64_in_emergency_stack(c, newsp, true))) {
|
||||
+ if (!nmi_sp && estype == NMI_EMERGENCY_STACK)
|
||||
+ nmi_sp = newsp;
|
||||
+ ppc64_set_bt_emergency_stack(estype, bt);
|
||||
+ } else {
|
||||
+ /*
|
||||
+ * Switch HW interrupt stack or emergency stack
|
||||
+ * to process's stack.
|
||||
+ */
|
||||
+ bt->stackbase = GET_STACKBASE(bt->task);
|
||||
+ bt->stacktop = GET_STACKTOP(bt->task);
|
||||
+ alter_stackbuf(bt);
|
||||
+ }
|
||||
+ }
|
||||
if (IS_KVADDR(newsp) && INSTACK(newsp, bt))
|
||||
newpc = *(ulong *)&bt->stackbuf[newsp + 16 -
|
||||
bt->stackbase];
|
||||
@@ -2039,6 +2205,16 @@ ppc64_back_trace(struct gnu_request *req, struct bt_info *bt)
|
||||
}
|
||||
}
|
||||
|
||||
+ /*
|
||||
+ * NMI stack may not be re-entrant. In so, an SP in the NMI stack
|
||||
+ * is likely to point back to an SP within the NMI stack, in case
|
||||
+ * of a nested NMI.
|
||||
+ */
|
||||
+ if (nmi_sp && nmi_sp == newsp) {
|
||||
+ fprintf(fp, "---<Nested NMI>---\n");
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
/*
|
||||
* Some Linux 3.7 kernel threads have been seen to have
|
||||
* their end-of-trace stack linkage pointer pointing
|
||||
@@ -2416,6 +2592,9 @@ ppc64_get_dumpfile_stack_frame(struct bt_info *bt_in, ulong *nip, ulong *ksp)
|
||||
pt_regs = (struct ppc64_pt_regs *)bt->machdep;
|
||||
ur_nip = pt_regs->nip;
|
||||
ur_ksp = pt_regs->gpr[1];
|
||||
+ /* Print the collected regs for panic task. */
|
||||
+ ppc64_print_regs(pt_regs);
|
||||
+ ppc64_print_nip_lr(pt_regs, 1);
|
||||
} else if ((pc->flags & KDUMP) ||
|
||||
((pc->flags & DISKDUMP) &&
|
||||
(*diskdump_flags & KDUMP_CMPRS_LOCAL))) {
|
||||
--
|
||||
2.37.1
|
||||
|
@ -1,67 +0,0 @@
|
||||
From dda5b2d02b8d8de1264f84b6267582aa7a1e5a57 Mon Sep 17 00:00:00 2001
|
||||
From: Kazuhito Hagio <k-hagio-ab@nec.com>
|
||||
Date: Tue, 31 May 2022 17:12:16 +0900
|
||||
Subject: [PATCH 09/16] gdb: print details of unnamed struct and union
|
||||
|
||||
Currently gdb's "ptype" command does not print the details of unnamed
|
||||
structure and union deeper than second level in a structure, it prints
|
||||
only "{...}" instead. And crash's "struct" and similar commands also
|
||||
inherit this behavior, so we cannot get the full information of them.
|
||||
|
||||
To print the details of them, change the show variable when it is an
|
||||
unnamed one like crash-7.x.
|
||||
|
||||
Without the patch:
|
||||
crash> struct -o page
|
||||
struct page {
|
||||
[0] unsigned long flags;
|
||||
union {
|
||||
struct {...};
|
||||
struct {...};
|
||||
...
|
||||
|
||||
With the patch:
|
||||
crash> struct -o page
|
||||
struct page {
|
||||
[0] unsigned long flags;
|
||||
union {
|
||||
struct {
|
||||
[8] struct list_head lru;
|
||||
[24] struct address_space *mapping;
|
||||
[32] unsigned long index;
|
||||
[40] unsigned long private;
|
||||
};
|
||||
struct {
|
||||
[8] dma_addr_t dma_addr;
|
||||
};
|
||||
...
|
||||
|
||||
Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
|
||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
|
||||
---
|
||||
gdb-10.2.patch | 12 ++++++++++++
|
||||
1 file changed, 12 insertions(+)
|
||||
|
||||
diff --git a/gdb-10.2.patch b/gdb-10.2.patch
|
||||
index b67db4e1ded9..577f5e45fc5a 100644
|
||||
--- a/gdb-10.2.patch
|
||||
+++ b/gdb-10.2.patch
|
||||
@@ -1638,3 +1638,15 @@ exit 0
|
||||
$(ECHO_CXXLD) $(CC_LD) $(INTERNAL_LDFLAGS) $(WIN32LDAPP) \
|
||||
-o $(shell /bin/cat mergeobj) $(LIBGDB_OBS) \
|
||||
$(TDEPLIBS) $(TUI_LIBRARY) $(CLIBS) $(LOADLIBES) $(shell /bin/cat mergelibs)
|
||||
+--- gdb-10.2/gdb/c-typeprint.c.orig
|
||||
++++ gdb-10.2/gdb/c-typeprint.c
|
||||
+@@ -1202,6 +1202,9 @@ c_type_print_base_struct_union (struct t
|
||||
+ = podata->end_bitpos
|
||||
+ - TYPE_LENGTH (type->field (i).type ()) * TARGET_CHAR_BIT;
|
||||
+ }
|
||||
++ else if (strlen(TYPE_FIELD_NAME (type, i)) == 0)
|
||||
++ /* crash: Print details for unnamed struct and union. */
|
||||
++ newshow = show;
|
||||
+
|
||||
+ c_print_type_1 (type->field (i).type (),
|
||||
+ TYPE_FIELD_NAME (type, i),
|
||||
--
|
||||
2.30.2
|
||||
|
@ -1,74 +0,0 @@
|
||||
From 4dc2f1c32d1c99586e67032c9cd62c5c4334049c Mon Sep 17 00:00:00 2001
|
||||
From: Hari Bathini <hbathini@linux.ibm.com>
|
||||
Date: Mon, 4 Jul 2022 10:55:45 +0530
|
||||
Subject: [PATCH 09/29] ppc64: print emergency stacks info with 'mach' command
|
||||
|
||||
Print top address of emergency stacks with 'mach' command.
|
||||
|
||||
Signed-off-by: Hari Bathini <hbathini@linux.ibm.com>
|
||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
|
||||
---
|
||||
ppc64.c | 40 ++++++++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 40 insertions(+)
|
||||
|
||||
diff --git a/ppc64.c b/ppc64.c
|
||||
index 03047a85955d..ad1d6e121e81 100644
|
||||
--- a/ppc64.c
|
||||
+++ b/ppc64.c
|
||||
@@ -3161,6 +3161,44 @@ opalmsg(void)
|
||||
fprintf(fp, "\n");
|
||||
}
|
||||
|
||||
+static void ppc64_print_emergency_stack_info(void)
|
||||
+{
|
||||
+ struct machine_specific *ms = machdep->machspec;
|
||||
+ char buf[32];
|
||||
+ int i;
|
||||
+
|
||||
+ fprintf(fp, " EMERGENCY STACK: ");
|
||||
+ if (ms->emergency_sp) {
|
||||
+ fprintf(fp, "\n");
|
||||
+ for (i = 0; i < kt->cpus; i++) {
|
||||
+ sprintf(buf, "CPU %d", i);
|
||||
+ fprintf(fp, "%19s: %lx\n", buf, ms->emergency_sp[i]);
|
||||
+ }
|
||||
+ } else
|
||||
+ fprintf(fp, "(unused)\n");
|
||||
+
|
||||
+ fprintf(fp, "NMI EMERGENCY STACK: ");
|
||||
+ if (ms->nmi_emergency_sp) {
|
||||
+ fprintf(fp, "\n");
|
||||
+ for (i = 0; i < kt->cpus; i++) {
|
||||
+ sprintf(buf, "CPU %d", i);
|
||||
+ fprintf(fp, "%19s: %lx\n", buf, ms->nmi_emergency_sp[i]);
|
||||
+ }
|
||||
+ } else
|
||||
+ fprintf(fp, "(unused)\n");
|
||||
+
|
||||
+ fprintf(fp, " MC EMERGENCY STACK: ");
|
||||
+ if (ms->mc_emergency_sp) {
|
||||
+ fprintf(fp, "\n");
|
||||
+ for (i = 0; i < kt->cpus; i++) {
|
||||
+ sprintf(buf, "CPU %d", i);
|
||||
+ fprintf(fp, "%19s: %lx\n", buf, ms->mc_emergency_sp[i]);
|
||||
+ }
|
||||
+ } else
|
||||
+ fprintf(fp, "(unused)\n");
|
||||
+ fprintf(fp, "\n");
|
||||
+}
|
||||
+
|
||||
/*
|
||||
* Machine dependent command.
|
||||
*/
|
||||
@@ -3241,6 +3279,8 @@ ppc64_display_machine_stats(void)
|
||||
fprintf(fp, "%19s: %lx\n", buf, tt->softirq_ctx[c]);
|
||||
}
|
||||
}
|
||||
+
|
||||
+ ppc64_print_emergency_stack_info();
|
||||
}
|
||||
|
||||
static const char *hook_files[] = {
|
||||
--
|
||||
2.37.1
|
||||
|
@ -1,392 +0,0 @@
|
||||
From 7095c8fd029e3a33117e3b67de73f504686ebfe2 Mon Sep 17 00:00:00 2001
|
||||
From: Lianbo Jiang <lijiang@redhat.com>
|
||||
Date: Thu, 2 Jun 2022 20:12:55 +0800
|
||||
Subject: [PATCH 10/16] Enhance "dev -d|-D" options to support blk-mq sbitmap
|
||||
|
||||
Since Linux 5.16-rc1, which kernel commit 9a14d6ce4135 ("block: remove
|
||||
debugfs blk_mq_ctx dispatched/merged/completed attributes") removed the
|
||||
members from struct blk_mq_ctx, crash has not displayed disk I/O statistics
|
||||
for multiqueue (blk-mq) devices.
|
||||
|
||||
Let's parse the sbitmap in blk-mq layer to support it.
|
||||
|
||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
|
||||
Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
|
||||
---
|
||||
defs.h | 11 +++
|
||||
dev.c | 244 +++++++++++++++++++++++++++++++++++++++++++++---------
|
||||
symbols.c | 22 +++++
|
||||
3 files changed, 238 insertions(+), 39 deletions(-)
|
||||
|
||||
diff --git a/defs.h b/defs.h
|
||||
index c8444b4e54eb..2681586a33dc 100644
|
||||
--- a/defs.h
|
||||
+++ b/defs.h
|
||||
@@ -2170,6 +2170,16 @@ struct offset_table { /* stash of commonly-used offsets */
|
||||
long sbq_wait_state_wait;
|
||||
long sbitmap_alloc_hint;
|
||||
long sbitmap_round_robin;
|
||||
+ long request_cmd_flags;
|
||||
+ long request_q;
|
||||
+ long request_state;
|
||||
+ long request_queue_queue_hw_ctx;
|
||||
+ long request_queue_nr_hw_queues;
|
||||
+ long blk_mq_hw_ctx_tags;
|
||||
+ long blk_mq_tags_bitmap_tags;
|
||||
+ long blk_mq_tags_breserved_tags;
|
||||
+ long blk_mq_tags_nr_reserved_tags;
|
||||
+ long blk_mq_tags_rqs;
|
||||
};
|
||||
|
||||
struct size_table { /* stash of commonly-used sizes */
|
||||
@@ -2339,6 +2349,7 @@ struct size_table { /* stash of commonly-used sizes */
|
||||
long sbitmap;
|
||||
long sbitmap_queue;
|
||||
long sbq_wait_state;
|
||||
+ long blk_mq_tags;
|
||||
};
|
||||
|
||||
struct array_table {
|
||||
diff --git a/dev.c b/dev.c
|
||||
index a493e51ac95c..4be4c96df8b0 100644
|
||||
--- a/dev.c
|
||||
+++ b/dev.c
|
||||
@@ -4238,19 +4238,176 @@ get_one_mctx_diskio(unsigned long mctx, struct diskio *io)
|
||||
io->write = (dispatch[1] - comp[1]);
|
||||
}
|
||||
|
||||
+typedef bool (busy_tag_iter_fn)(ulong rq, void *data);
|
||||
+
|
||||
+struct mq_inflight {
|
||||
+ ulong q;
|
||||
+ struct diskio *dio;
|
||||
+};
|
||||
+
|
||||
+struct bt_iter_data {
|
||||
+ ulong tags;
|
||||
+ uint reserved;
|
||||
+ uint nr_reserved_tags;
|
||||
+ busy_tag_iter_fn *fn;
|
||||
+ void *data;
|
||||
+};
|
||||
+
|
||||
+/*
|
||||
+ * See the include/linux/blk_types.h and include/linux/blk-mq.h
|
||||
+ */
|
||||
+#define MQ_RQ_IN_FLIGHT 1
|
||||
+#define REQ_OP_BITS 8
|
||||
+#define REQ_OP_MASK ((1 << REQ_OP_BITS) - 1)
|
||||
+
|
||||
+static uint op_is_write(uint op)
|
||||
+{
|
||||
+ return (op & REQ_OP_MASK) & 1;
|
||||
+}
|
||||
+
|
||||
+static bool mq_check_inflight(ulong rq, void *data)
|
||||
+{
|
||||
+ uint cmd_flags = 0, state = 0;
|
||||
+ ulong addr = 0, queue = 0;
|
||||
+ struct mq_inflight *mi = data;
|
||||
+
|
||||
+ if (!IS_KVADDR(rq))
|
||||
+ return TRUE;
|
||||
+
|
||||
+ addr = rq + OFFSET(request_q);
|
||||
+ if (!readmem(addr, KVADDR, &queue, sizeof(ulong), "request.q", RETURN_ON_ERROR))
|
||||
+ return FALSE;
|
||||
+
|
||||
+ addr = rq + OFFSET(request_cmd_flags);
|
||||
+ if (!readmem(addr, KVADDR, &cmd_flags, sizeof(uint), "request.cmd_flags", RETURN_ON_ERROR))
|
||||
+ return FALSE;
|
||||
+
|
||||
+ addr = rq + OFFSET(request_state);
|
||||
+ if (!readmem(addr, KVADDR, &state, sizeof(uint), "request.state", RETURN_ON_ERROR))
|
||||
+ return FALSE;
|
||||
+
|
||||
+ if (queue == mi->q && state == MQ_RQ_IN_FLIGHT) {
|
||||
+ if (op_is_write(cmd_flags))
|
||||
+ mi->dio->write++;
|
||||
+ else
|
||||
+ mi->dio->read++;
|
||||
+ }
|
||||
+
|
||||
+ return TRUE;
|
||||
+}
|
||||
+
|
||||
+static bool bt_iter(uint bitnr, void *data)
|
||||
+{
|
||||
+ ulong addr = 0, rqs_addr = 0, rq = 0;
|
||||
+ struct bt_iter_data *iter_data = data;
|
||||
+ ulong tag = iter_data->tags;
|
||||
+
|
||||
+ if (!iter_data->reserved)
|
||||
+ bitnr += iter_data->nr_reserved_tags;
|
||||
+
|
||||
+ /* rqs */
|
||||
+ addr = tag + OFFSET(blk_mq_tags_rqs);
|
||||
+ if (!readmem(addr, KVADDR, &rqs_addr, sizeof(void *), "blk_mq_tags.rqs", RETURN_ON_ERROR))
|
||||
+ return FALSE;
|
||||
+
|
||||
+ addr = rqs_addr + bitnr * sizeof(ulong); /* rqs[bitnr] */
|
||||
+ if (!readmem(addr, KVADDR, &rq, sizeof(ulong), "blk_mq_tags.rqs[]", RETURN_ON_ERROR))
|
||||
+ return FALSE;
|
||||
+
|
||||
+ return iter_data->fn(rq, iter_data->data);
|
||||
+}
|
||||
+
|
||||
+static void bt_for_each(ulong q, ulong tags, ulong sbq, uint reserved, uint nr_resvd_tags, struct diskio *dio)
|
||||
+{
|
||||
+ struct sbitmap_context sc = {0};
|
||||
+ struct mq_inflight mi = {
|
||||
+ .q = q,
|
||||
+ .dio = dio,
|
||||
+ };
|
||||
+ struct bt_iter_data iter_data = {
|
||||
+ .tags = tags,
|
||||
+ .reserved = reserved,
|
||||
+ .nr_reserved_tags = nr_resvd_tags,
|
||||
+ .fn = mq_check_inflight,
|
||||
+ .data = &mi,
|
||||
+ };
|
||||
+
|
||||
+ sbitmap_context_load(sbq + OFFSET(sbitmap_queue_sb), &sc);
|
||||
+ sbitmap_for_each_set(&sc, bt_iter, &iter_data);
|
||||
+}
|
||||
+
|
||||
+static void queue_for_each_hw_ctx(ulong q, ulong *hctx, uint cnt, struct diskio *dio)
|
||||
+{
|
||||
+ uint i;
|
||||
+
|
||||
+ for (i = 0; i < cnt; i++) {
|
||||
+ ulong addr = 0, tags = 0;
|
||||
+ uint nr_reserved_tags = 0;
|
||||
+
|
||||
+ /* Tags owned by the block driver */
|
||||
+ addr = hctx[i] + OFFSET(blk_mq_hw_ctx_tags);
|
||||
+ if (!readmem(addr, KVADDR, &tags, sizeof(ulong),
|
||||
+ "blk_mq_hw_ctx.tags", RETURN_ON_ERROR))
|
||||
+ break;
|
||||
+
|
||||
+ addr = tags + OFFSET(blk_mq_tags_nr_reserved_tags);
|
||||
+ if (!readmem(addr, KVADDR, &nr_reserved_tags, sizeof(uint),
|
||||
+ "blk_mq_tags_nr_reserved_tags", RETURN_ON_ERROR))
|
||||
+ break;
|
||||
+
|
||||
+ if (nr_reserved_tags) {
|
||||
+ addr = tags + OFFSET(blk_mq_tags_breserved_tags);
|
||||
+ bt_for_each(q, tags, addr, 1, nr_reserved_tags, dio);
|
||||
+ }
|
||||
+ addr = tags + OFFSET(blk_mq_tags_bitmap_tags);
|
||||
+ bt_for_each(q, tags, addr, 0, nr_reserved_tags, dio);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static void get_mq_diskio_from_hw_queues(ulong q, struct diskio *dio)
|
||||
+{
|
||||
+ uint cnt = 0;
|
||||
+ ulong addr = 0, hctx_addr = 0;
|
||||
+ ulong *hctx_array = NULL;
|
||||
+
|
||||
+ addr = q + OFFSET(request_queue_nr_hw_queues);
|
||||
+ readmem(addr, KVADDR, &cnt, sizeof(uint),
|
||||
+ "request_queue.nr_hw_queues", FAULT_ON_ERROR);
|
||||
+
|
||||
+ addr = q + OFFSET(request_queue_queue_hw_ctx);
|
||||
+ readmem(addr, KVADDR, &hctx_addr, sizeof(void *),
|
||||
+ "request_queue.queue_hw_ctx", FAULT_ON_ERROR);
|
||||
+
|
||||
+ hctx_array = (ulong *)GETBUF(sizeof(void *) * cnt);
|
||||
+ if (!hctx_array)
|
||||
+ error(FATAL, "fail to get memory for the hctx_array\n");
|
||||
+
|
||||
+ if (!readmem(hctx_addr, KVADDR, hctx_array, sizeof(void *) * cnt,
|
||||
+ "request_queue.queue_hw_ctx[]", RETURN_ON_ERROR)) {
|
||||
+ FREEBUF(hctx_array);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ queue_for_each_hw_ctx(q, hctx_array, cnt, dio);
|
||||
+
|
||||
+ FREEBUF(hctx_array);
|
||||
+}
|
||||
+
|
||||
static void
|
||||
get_mq_diskio(unsigned long q, unsigned long *mq_count)
|
||||
{
|
||||
int cpu;
|
||||
unsigned long queue_ctx;
|
||||
unsigned long mctx_addr;
|
||||
- struct diskio tmp;
|
||||
+ struct diskio tmp = {0};
|
||||
|
||||
if (INVALID_MEMBER(blk_mq_ctx_rq_dispatched) ||
|
||||
- INVALID_MEMBER(blk_mq_ctx_rq_completed))
|
||||
+ INVALID_MEMBER(blk_mq_ctx_rq_completed)) {
|
||||
+ get_mq_diskio_from_hw_queues(q, &tmp);
|
||||
+ mq_count[0] = tmp.read;
|
||||
+ mq_count[1] = tmp.write;
|
||||
return;
|
||||
-
|
||||
- memset(&tmp, 0x00, sizeof(struct diskio));
|
||||
+ }
|
||||
|
||||
readmem(q + OFFSET(request_queue_queue_ctx), KVADDR, &queue_ctx,
|
||||
sizeof(ulong), "request_queue.queue_ctx",
|
||||
@@ -4479,41 +4636,24 @@ display_one_diskio(struct iter *i, unsigned long gendisk, ulong flags)
|
||||
&& (io.read + io.write == 0))
|
||||
return;
|
||||
|
||||
- if (use_mq_interface(queue_addr) &&
|
||||
- (INVALID_MEMBER(blk_mq_ctx_rq_dispatched) ||
|
||||
- INVALID_MEMBER(blk_mq_ctx_rq_completed)))
|
||||
- fprintf(fp, "%s%s%s %s%s%s%s %s%s%s",
|
||||
- mkstring(buf0, 5, RJUST|INT_DEC, (char *)(unsigned long)major),
|
||||
- space(MINSPACE),
|
||||
- mkstring(buf1, VADDR_PRLEN, LJUST|LONG_HEX, (char *)gendisk),
|
||||
- space(MINSPACE),
|
||||
- mkstring(buf2, 10, LJUST, disk_name),
|
||||
- space(MINSPACE),
|
||||
- mkstring(buf3, VADDR_PRLEN <= 11 ? 11 : VADDR_PRLEN,
|
||||
- LJUST|LONG_HEX, (char *)queue_addr),
|
||||
- space(MINSPACE),
|
||||
- mkstring(buf4, 17, RJUST, "(not supported)"),
|
||||
- space(MINSPACE));
|
||||
-
|
||||
- else
|
||||
- fprintf(fp, "%s%s%s %s%s%s%s %s%5d%s%s%s%s%s",
|
||||
- mkstring(buf0, 5, RJUST|INT_DEC, (char *)(unsigned long)major),
|
||||
- space(MINSPACE),
|
||||
- mkstring(buf1, VADDR_PRLEN, LJUST|LONG_HEX, (char *)gendisk),
|
||||
- space(MINSPACE),
|
||||
- mkstring(buf2, 10, LJUST, disk_name),
|
||||
- space(MINSPACE),
|
||||
- mkstring(buf3, VADDR_PRLEN <= 11 ? 11 : VADDR_PRLEN,
|
||||
- LJUST|LONG_HEX, (char *)queue_addr),
|
||||
- space(MINSPACE),
|
||||
- io.read + io.write,
|
||||
- space(MINSPACE),
|
||||
- mkstring(buf4, 5, RJUST|INT_DEC,
|
||||
- (char *)(unsigned long)io.read),
|
||||
- space(MINSPACE),
|
||||
- mkstring(buf5, 5, RJUST|INT_DEC,
|
||||
- (char *)(unsigned long)io.write),
|
||||
- space(MINSPACE));
|
||||
+ fprintf(fp, "%s%s%s %s%s%s%s %s%5d%s%s%s%s%s",
|
||||
+ mkstring(buf0, 5, RJUST|INT_DEC, (char *)(unsigned long)major),
|
||||
+ space(MINSPACE),
|
||||
+ mkstring(buf1, VADDR_PRLEN, LJUST|LONG_HEX, (char *)gendisk),
|
||||
+ space(MINSPACE),
|
||||
+ mkstring(buf2, 10, LJUST, disk_name),
|
||||
+ space(MINSPACE),
|
||||
+ mkstring(buf3, VADDR_PRLEN <= 11 ? 11 : VADDR_PRLEN,
|
||||
+ LJUST|LONG_HEX, (char *)queue_addr),
|
||||
+ space(MINSPACE),
|
||||
+ io.read + io.write,
|
||||
+ space(MINSPACE),
|
||||
+ mkstring(buf4, 5, RJUST|INT_DEC,
|
||||
+ (char *)(unsigned long)io.read),
|
||||
+ space(MINSPACE),
|
||||
+ mkstring(buf5, 5, RJUST|INT_DEC,
|
||||
+ (char *)(unsigned long)io.write),
|
||||
+ space(MINSPACE));
|
||||
|
||||
if (VALID_MEMBER(request_queue_in_flight)) {
|
||||
if (!use_mq_interface(queue_addr)) {
|
||||
@@ -4597,6 +4737,9 @@ void diskio_init(void)
|
||||
MEMBER_OFFSET_INIT(kobject_entry, "kobject", "entry");
|
||||
MEMBER_OFFSET_INIT(kset_list, "kset", "list");
|
||||
MEMBER_OFFSET_INIT(request_list_count, "request_list", "count");
|
||||
+ MEMBER_OFFSET_INIT(request_cmd_flags, "request", "cmd_flags");
|
||||
+ MEMBER_OFFSET_INIT(request_q, "request", "q");
|
||||
+ MEMBER_OFFSET_INIT(request_state, "request", "state");
|
||||
MEMBER_OFFSET_INIT(request_queue_in_flight, "request_queue",
|
||||
"in_flight");
|
||||
if (MEMBER_EXISTS("request_queue", "rq"))
|
||||
@@ -4608,10 +4751,33 @@ void diskio_init(void)
|
||||
"mq_ops");
|
||||
ANON_MEMBER_OFFSET_INIT(request_queue_queue_ctx,
|
||||
"request_queue", "queue_ctx");
|
||||
+ MEMBER_OFFSET_INIT(request_queue_queue_hw_ctx,
|
||||
+ "request_queue", "queue_hw_ctx");
|
||||
+ MEMBER_OFFSET_INIT(request_queue_nr_hw_queues,
|
||||
+ "request_queue", "nr_hw_queues");
|
||||
MEMBER_OFFSET_INIT(blk_mq_ctx_rq_dispatched, "blk_mq_ctx",
|
||||
"rq_dispatched");
|
||||
MEMBER_OFFSET_INIT(blk_mq_ctx_rq_completed, "blk_mq_ctx",
|
||||
"rq_completed");
|
||||
+ MEMBER_OFFSET_INIT(blk_mq_hw_ctx_tags, "blk_mq_hw_ctx", "tags");
|
||||
+ MEMBER_OFFSET_INIT(blk_mq_tags_bitmap_tags, "blk_mq_tags",
|
||||
+ "bitmap_tags");
|
||||
+ MEMBER_OFFSET_INIT(blk_mq_tags_breserved_tags, "blk_mq_tags",
|
||||
+ "breserved_tags");
|
||||
+ MEMBER_OFFSET_INIT(blk_mq_tags_nr_reserved_tags, "blk_mq_tags",
|
||||
+ "nr_reserved_tags");
|
||||
+ MEMBER_OFFSET_INIT(blk_mq_tags_rqs, "blk_mq_tags", "rqs");
|
||||
+ STRUCT_SIZE_INIT(blk_mq_tags, "blk_mq_tags");
|
||||
+ STRUCT_SIZE_INIT(sbitmap, "sbitmap");
|
||||
+ STRUCT_SIZE_INIT(sbitmap_word, "sbitmap_word");
|
||||
+ MEMBER_OFFSET_INIT(sbitmap_word_word, "sbitmap_word", "word");
|
||||
+ MEMBER_OFFSET_INIT(sbitmap_word_cleared, "sbitmap_word", "cleared");
|
||||
+ MEMBER_OFFSET_INIT(sbitmap_depth, "sbitmap", "depth");
|
||||
+ MEMBER_OFFSET_INIT(sbitmap_shift, "sbitmap", "shift");
|
||||
+ MEMBER_OFFSET_INIT(sbitmap_map_nr, "sbitmap", "map_nr");
|
||||
+ MEMBER_OFFSET_INIT(sbitmap_map, "sbitmap", "map");
|
||||
+ MEMBER_OFFSET_INIT(sbitmap_queue_sb, "sbitmap_queue", "sb");
|
||||
+
|
||||
}
|
||||
MEMBER_OFFSET_INIT(subsys_private_klist_devices, "subsys_private",
|
||||
"klist_devices");
|
||||
diff --git a/symbols.c b/symbols.c
|
||||
index 5d12a021c769..c1f09556d710 100644
|
||||
--- a/symbols.c
|
||||
+++ b/symbols.c
|
||||
@@ -10385,6 +10385,12 @@ dump_offset_table(char *spec, ulong makestruct)
|
||||
OFFSET(kset_list));
|
||||
fprintf(fp, " request_list_count: %ld\n",
|
||||
OFFSET(request_list_count));
|
||||
+ fprintf(fp, " request_cmd_flags: %ld\n",
|
||||
+ OFFSET(request_cmd_flags));
|
||||
+ fprintf(fp, " request_q: %ld\n",
|
||||
+ OFFSET(request_q));
|
||||
+ fprintf(fp, " request_state: %ld\n",
|
||||
+ OFFSET(request_state));
|
||||
fprintf(fp, " request_queue_in_flight: %ld\n",
|
||||
OFFSET(request_queue_in_flight));
|
||||
fprintf(fp, " request_queue_rq: %ld\n",
|
||||
@@ -10393,10 +10399,25 @@ dump_offset_table(char *spec, ulong makestruct)
|
||||
OFFSET(request_queue_mq_ops));
|
||||
fprintf(fp, " request_queue_queue_ctx: %ld\n",
|
||||
OFFSET(request_queue_queue_ctx));
|
||||
+ fprintf(fp, " request_queue_queue_hw_ctx: %ld\n",
|
||||
+ OFFSET(request_queue_queue_hw_ctx));
|
||||
+ fprintf(fp, " request_queue_nr_hw_queues: %ld\n",
|
||||
+ OFFSET(request_queue_nr_hw_queues));
|
||||
fprintf(fp, " blk_mq_ctx_rq_dispatched: %ld\n",
|
||||
OFFSET(blk_mq_ctx_rq_dispatched));
|
||||
fprintf(fp, " blk_mq_ctx_rq_completed: %ld\n",
|
||||
OFFSET(blk_mq_ctx_rq_completed));
|
||||
+ fprintf(fp, " blk_mq_hw_ctx_tags: %ld\n",
|
||||
+ OFFSET(blk_mq_hw_ctx_tags));
|
||||
+ fprintf(fp, " blk_mq_tags_bitmap_tags: %ld\n",
|
||||
+ OFFSET(blk_mq_tags_bitmap_tags));
|
||||
+ fprintf(fp, " blk_mq_tags_breserved_tags: %ld\n",
|
||||
+ OFFSET(blk_mq_tags_breserved_tags));
|
||||
+ fprintf(fp, " blk_mq_tags_nr_reserved_tags: %ld\n",
|
||||
+ OFFSET(blk_mq_tags_nr_reserved_tags));
|
||||
+ fprintf(fp, " blk_mq_tags_rqs: %ld\n",
|
||||
+ OFFSET(blk_mq_tags_rqs));
|
||||
+
|
||||
fprintf(fp, " subsys_private_klist_devices: %ld\n",
|
||||
OFFSET(subsys_private_klist_devices));
|
||||
fprintf(fp, " subsystem_kset: %ld\n",
|
||||
@@ -11003,6 +11024,7 @@ dump_offset_table(char *spec, ulong makestruct)
|
||||
fprintf(fp, " sbitmap: %ld\n", SIZE(sbitmap));
|
||||
fprintf(fp, " sbitmap_queue: %ld\n", SIZE(sbitmap_queue));
|
||||
fprintf(fp, " sbq_wait_state: %ld\n", SIZE(sbq_wait_state));
|
||||
+ fprintf(fp, " blk_mq_tags: %ld\n", SIZE(blk_mq_tags));
|
||||
|
||||
fprintf(fp, "\n array_table:\n");
|
||||
/*
|
||||
--
|
||||
2.30.2
|
||||
|
@ -1,389 +0,0 @@
|
||||
From 93b880217de239268315be942c10dfce5649db8b Mon Sep 17 00:00:00 2001
|
||||
From: Hari Bathini <hbathini@linux.ibm.com>
|
||||
Date: Mon, 4 Jul 2022 10:55:46 +0530
|
||||
Subject: [PATCH 10/29] ppc64: use a variable for machdep->machspec
|
||||
|
||||
machdpep->machspec is referred to multiple times. The compiler would
|
||||
likely optimize this but nonetheless, use a variable to optimize in
|
||||
coding and also improve readability. No functional change.
|
||||
|
||||
Signed-off-by: Hari Bathini <hbathini@linux.ibm.com>
|
||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
|
||||
---
|
||||
ppc64.c | 224 ++++++++++++++++++++++++++++----------------------------
|
||||
1 file changed, 111 insertions(+), 113 deletions(-)
|
||||
|
||||
diff --git a/ppc64.c b/ppc64.c
|
||||
index ad1d6e121e81..4ea1f7c0c6f8 100644
|
||||
--- a/ppc64.c
|
||||
+++ b/ppc64.c
|
||||
@@ -307,6 +307,8 @@ struct machine_specific book3e_machine_specific = {
|
||||
void
|
||||
ppc64_init(int when)
|
||||
{
|
||||
+ struct machine_specific *ms;
|
||||
+
|
||||
#if defined(__x86_64__)
|
||||
if (ACTIVE())
|
||||
error(FATAL, "compiled for the PPC64 architecture\n");
|
||||
@@ -416,16 +418,16 @@ ppc64_init(int when)
|
||||
break;
|
||||
|
||||
case POST_GDB:
|
||||
- if (!(machdep->flags & BOOK3E)) {
|
||||
- struct machine_specific *m = machdep->machspec;
|
||||
+ ms = machdep->machspec;
|
||||
|
||||
+ if (!(machdep->flags & BOOK3E)) {
|
||||
/*
|
||||
* To determine if the kernel was running on OPAL based platform,
|
||||
* use struct opal, which is populated with relevant values.
|
||||
*/
|
||||
if (symbol_exists("opal")) {
|
||||
- get_symbol_data("opal", sizeof(struct ppc64_opal), &(m->opal));
|
||||
- if (m->opal.base == SKIBOOT_BASE)
|
||||
+ get_symbol_data("opal", sizeof(struct ppc64_opal), &(ms->opal));
|
||||
+ if (ms->opal.base == SKIBOOT_BASE)
|
||||
machdep->flags |= OPAL_FW;
|
||||
}
|
||||
|
||||
@@ -453,18 +455,18 @@ ppc64_init(int when)
|
||||
* _PAGE_WRITETHRU can be used to infer it.
|
||||
*/
|
||||
if (THIS_KERNEL_VERSION >= LINUX(3,14,0))
|
||||
- m->_page_coherent = 0x0UL;
|
||||
+ ms->_page_coherent = 0x0UL;
|
||||
|
||||
/*
|
||||
* In kernel v4.5, _PAGE_PTE bit is introduced to
|
||||
* distinguish PTEs from pointers.
|
||||
*/
|
||||
if (THIS_KERNEL_VERSION >= LINUX(4,5,0)) {
|
||||
- m->_page_pte = 0x1UL;
|
||||
- m->_page_present = 0x2UL;
|
||||
- m->_page_user = 0x4UL;
|
||||
- m->_page_rw = 0x8UL;
|
||||
- m->_page_guarded = 0x10UL;
|
||||
+ ms->_page_pte = 0x1UL;
|
||||
+ ms->_page_present = 0x2UL;
|
||||
+ ms->_page_user = 0x4UL;
|
||||
+ ms->_page_rw = 0x8UL;
|
||||
+ ms->_page_guarded = 0x10UL;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -474,8 +476,8 @@ ppc64_init(int when)
|
||||
* Also, page table entries store physical addresses.
|
||||
*/
|
||||
if (THIS_KERNEL_VERSION >= LINUX(4,6,0)) {
|
||||
- m->_page_pte = 0x1UL << 62;
|
||||
- m->_page_present = 0x1UL << 63;
|
||||
+ ms->_page_pte = 0x1UL << 62;
|
||||
+ ms->_page_present = 0x1UL << 63;
|
||||
machdep->flags |= PHYS_ENTRY_L4;
|
||||
}
|
||||
|
||||
@@ -504,118 +506,117 @@ ppc64_init(int when)
|
||||
machdep->ptrs_per_pgd = PTRS_PER_PGD;
|
||||
} else {
|
||||
/* 2.6.14 layout */
|
||||
- struct machine_specific *m = machdep->machspec;
|
||||
if (machdep->pagesize == 65536) {
|
||||
/* 64K pagesize */
|
||||
if (machdep->flags & RADIX_MMU) {
|
||||
- m->l1_index_size = PTE_INDEX_SIZE_RADIX_64K;
|
||||
- m->l2_index_size = PMD_INDEX_SIZE_RADIX_64K;
|
||||
- m->l3_index_size = PUD_INDEX_SIZE_RADIX_64K;
|
||||
- m->l4_index_size = PGD_INDEX_SIZE_RADIX_64K;
|
||||
+ ms->l1_index_size = PTE_INDEX_SIZE_RADIX_64K;
|
||||
+ ms->l2_index_size = PMD_INDEX_SIZE_RADIX_64K;
|
||||
+ ms->l3_index_size = PUD_INDEX_SIZE_RADIX_64K;
|
||||
+ ms->l4_index_size = PGD_INDEX_SIZE_RADIX_64K;
|
||||
|
||||
} else if (!(machdep->flags & BOOK3E) &&
|
||||
(THIS_KERNEL_VERSION >= LINUX(4,6,0))) {
|
||||
- m->l1_index_size = PTE_INDEX_SIZE_L4_64K_3_10;
|
||||
+ ms->l1_index_size = PTE_INDEX_SIZE_L4_64K_3_10;
|
||||
|
||||
if (THIS_KERNEL_VERSION >= LINUX(4,12,0)) {
|
||||
- m->l2_index_size = PMD_INDEX_SIZE_L4_64K_4_12;
|
||||
+ ms->l2_index_size = PMD_INDEX_SIZE_L4_64K_4_12;
|
||||
if (THIS_KERNEL_VERSION >= LINUX(4,17,0))
|
||||
- m->l3_index_size = PUD_INDEX_SIZE_L4_64K_4_17;
|
||||
+ ms->l3_index_size = PUD_INDEX_SIZE_L4_64K_4_17;
|
||||
else
|
||||
- m->l3_index_size = PUD_INDEX_SIZE_L4_64K_4_12;
|
||||
- m->l4_index_size = PGD_INDEX_SIZE_L4_64K_4_12;
|
||||
+ ms->l3_index_size = PUD_INDEX_SIZE_L4_64K_4_12;
|
||||
+ ms->l4_index_size = PGD_INDEX_SIZE_L4_64K_4_12;
|
||||
} else {
|
||||
- m->l2_index_size = PMD_INDEX_SIZE_L4_64K_4_6;
|
||||
- m->l3_index_size = PUD_INDEX_SIZE_L4_64K_4_6;
|
||||
- m->l4_index_size = PGD_INDEX_SIZE_L4_64K_3_10;
|
||||
+ ms->l2_index_size = PMD_INDEX_SIZE_L4_64K_4_6;
|
||||
+ ms->l3_index_size = PUD_INDEX_SIZE_L4_64K_4_6;
|
||||
+ ms->l4_index_size = PGD_INDEX_SIZE_L4_64K_3_10;
|
||||
}
|
||||
} else if (THIS_KERNEL_VERSION >= LINUX(3,10,0)) {
|
||||
- m->l1_index_size = PTE_INDEX_SIZE_L4_64K_3_10;
|
||||
- m->l2_index_size = PMD_INDEX_SIZE_L4_64K_3_10;
|
||||
- m->l3_index_size = PUD_INDEX_SIZE_L4_64K;
|
||||
- m->l4_index_size = PGD_INDEX_SIZE_L4_64K_3_10;
|
||||
+ ms->l1_index_size = PTE_INDEX_SIZE_L4_64K_3_10;
|
||||
+ ms->l2_index_size = PMD_INDEX_SIZE_L4_64K_3_10;
|
||||
+ ms->l3_index_size = PUD_INDEX_SIZE_L4_64K;
|
||||
+ ms->l4_index_size = PGD_INDEX_SIZE_L4_64K_3_10;
|
||||
|
||||
} else {
|
||||
- m->l1_index_size = PTE_INDEX_SIZE_L4_64K;
|
||||
- m->l2_index_size = PMD_INDEX_SIZE_L4_64K;
|
||||
- m->l3_index_size = PUD_INDEX_SIZE_L4_64K;
|
||||
- m->l4_index_size = PGD_INDEX_SIZE_L4_64K;
|
||||
+ ms->l1_index_size = PTE_INDEX_SIZE_L4_64K;
|
||||
+ ms->l2_index_size = PMD_INDEX_SIZE_L4_64K;
|
||||
+ ms->l3_index_size = PUD_INDEX_SIZE_L4_64K;
|
||||
+ ms->l4_index_size = PGD_INDEX_SIZE_L4_64K;
|
||||
}
|
||||
|
||||
if (!(machdep->flags & BOOK3E))
|
||||
- m->pte_rpn_shift = symbol_exists("demote_segment_4k") ?
|
||||
+ ms->pte_rpn_shift = symbol_exists("demote_segment_4k") ?
|
||||
PTE_RPN_SHIFT_L4_64K_V2 : PTE_RPN_SHIFT_L4_64K_V1;
|
||||
|
||||
if (!(machdep->flags & BOOK3E) &&
|
||||
(THIS_KERNEL_VERSION >= LINUX(4,6,0))) {
|
||||
- m->pgd_masked_bits = PGD_MASKED_BITS_64K_4_6;
|
||||
- m->pud_masked_bits = PUD_MASKED_BITS_64K_4_6;
|
||||
- m->pmd_masked_bits = PMD_MASKED_BITS_64K_4_6;
|
||||
+ ms->pgd_masked_bits = PGD_MASKED_BITS_64K_4_6;
|
||||
+ ms->pud_masked_bits = PUD_MASKED_BITS_64K_4_6;
|
||||
+ ms->pmd_masked_bits = PMD_MASKED_BITS_64K_4_6;
|
||||
} else {
|
||||
- m->pgd_masked_bits = PGD_MASKED_BITS_64K;
|
||||
- m->pud_masked_bits = PUD_MASKED_BITS_64K;
|
||||
+ ms->pgd_masked_bits = PGD_MASKED_BITS_64K;
|
||||
+ ms->pud_masked_bits = PUD_MASKED_BITS_64K;
|
||||
if ((machdep->flags & BOOK3E) &&
|
||||
(THIS_KERNEL_VERSION >= LINUX(4,5,0)))
|
||||
- m->pmd_masked_bits = PMD_MASKED_BITS_BOOK3E_64K_4_5;
|
||||
+ ms->pmd_masked_bits = PMD_MASKED_BITS_BOOK3E_64K_4_5;
|
||||
else if (THIS_KERNEL_VERSION >= LINUX(3,11,0))
|
||||
- m->pmd_masked_bits = PMD_MASKED_BITS_64K_3_11;
|
||||
+ ms->pmd_masked_bits = PMD_MASKED_BITS_64K_3_11;
|
||||
else
|
||||
- m->pmd_masked_bits = PMD_MASKED_BITS_64K;
|
||||
+ ms->pmd_masked_bits = PMD_MASKED_BITS_64K;
|
||||
}
|
||||
} else {
|
||||
/* 4K pagesize */
|
||||
if (machdep->flags & RADIX_MMU) {
|
||||
- m->l1_index_size = PTE_INDEX_SIZE_RADIX_4K;
|
||||
- m->l2_index_size = PMD_INDEX_SIZE_RADIX_4K;
|
||||
- m->l3_index_size = PUD_INDEX_SIZE_RADIX_4K;
|
||||
- m->l4_index_size = PGD_INDEX_SIZE_RADIX_4K;
|
||||
+ ms->l1_index_size = PTE_INDEX_SIZE_RADIX_4K;
|
||||
+ ms->l2_index_size = PMD_INDEX_SIZE_RADIX_4K;
|
||||
+ ms->l3_index_size = PUD_INDEX_SIZE_RADIX_4K;
|
||||
+ ms->l4_index_size = PGD_INDEX_SIZE_RADIX_4K;
|
||||
|
||||
} else {
|
||||
- m->l1_index_size = PTE_INDEX_SIZE_L4_4K;
|
||||
- m->l2_index_size = PMD_INDEX_SIZE_L4_4K;
|
||||
+ ms->l1_index_size = PTE_INDEX_SIZE_L4_4K;
|
||||
+ ms->l2_index_size = PMD_INDEX_SIZE_L4_4K;
|
||||
if (THIS_KERNEL_VERSION >= LINUX(3,7,0))
|
||||
- m->l3_index_size = PUD_INDEX_SIZE_L4_4K_3_7;
|
||||
+ ms->l3_index_size = PUD_INDEX_SIZE_L4_4K_3_7;
|
||||
else
|
||||
- m->l3_index_size = PUD_INDEX_SIZE_L4_4K;
|
||||
- m->l4_index_size = PGD_INDEX_SIZE_L4_4K;
|
||||
+ ms->l3_index_size = PUD_INDEX_SIZE_L4_4K;
|
||||
+ ms->l4_index_size = PGD_INDEX_SIZE_L4_4K;
|
||||
|
||||
if (machdep->flags & BOOK3E)
|
||||
- m->pte_rpn_shift = PTE_RPN_SHIFT_L4_BOOK3E_4K;
|
||||
+ ms->pte_rpn_shift = PTE_RPN_SHIFT_L4_BOOK3E_4K;
|
||||
else
|
||||
- m->pte_rpn_shift = THIS_KERNEL_VERSION >= LINUX(4,5,0) ?
|
||||
+ ms->pte_rpn_shift = THIS_KERNEL_VERSION >= LINUX(4,5,0) ?
|
||||
PTE_RPN_SHIFT_L4_4K_4_5 : PTE_RPN_SHIFT_L4_4K;
|
||||
}
|
||||
|
||||
- m->pgd_masked_bits = PGD_MASKED_BITS_4K;
|
||||
- m->pud_masked_bits = PUD_MASKED_BITS_4K;
|
||||
- m->pmd_masked_bits = PMD_MASKED_BITS_4K;
|
||||
+ ms->pgd_masked_bits = PGD_MASKED_BITS_4K;
|
||||
+ ms->pud_masked_bits = PUD_MASKED_BITS_4K;
|
||||
+ ms->pmd_masked_bits = PMD_MASKED_BITS_4K;
|
||||
}
|
||||
|
||||
- m->pte_rpn_mask = PTE_RPN_MASK_DEFAULT;
|
||||
+ ms->pte_rpn_mask = PTE_RPN_MASK_DEFAULT;
|
||||
if (!(machdep->flags & BOOK3E)) {
|
||||
if (THIS_KERNEL_VERSION >= LINUX(4,6,0)) {
|
||||
- m->pte_rpn_mask = PTE_RPN_MASK_L4_4_6;
|
||||
- m->pte_rpn_shift = PTE_RPN_SHIFT_L4_4_6;
|
||||
+ ms->pte_rpn_mask = PTE_RPN_MASK_L4_4_6;
|
||||
+ ms->pte_rpn_shift = PTE_RPN_SHIFT_L4_4_6;
|
||||
}
|
||||
if (THIS_KERNEL_VERSION >= LINUX(4,7,0)) {
|
||||
- m->pgd_masked_bits = PGD_MASKED_BITS_4_7;
|
||||
- m->pud_masked_bits = PUD_MASKED_BITS_4_7;
|
||||
- m->pmd_masked_bits = PMD_MASKED_BITS_4_7;
|
||||
+ ms->pgd_masked_bits = PGD_MASKED_BITS_4_7;
|
||||
+ ms->pud_masked_bits = PUD_MASKED_BITS_4_7;
|
||||
+ ms->pmd_masked_bits = PMD_MASKED_BITS_4_7;
|
||||
}
|
||||
}
|
||||
|
||||
/* Compute ptrs per each level */
|
||||
- m->l1_shift = machdep->pageshift;
|
||||
- m->ptrs_per_l1 = (1 << m->l1_index_size);
|
||||
- m->ptrs_per_l2 = (1 << m->l2_index_size);
|
||||
- m->ptrs_per_l3 = (1 << m->l3_index_size);
|
||||
- m->ptrs_per_l4 = (1 << m->l4_index_size);
|
||||
- machdep->ptrs_per_pgd = m->ptrs_per_l4;
|
||||
+ ms->l1_shift = machdep->pageshift;
|
||||
+ ms->ptrs_per_l1 = (1 << ms->l1_index_size);
|
||||
+ ms->ptrs_per_l2 = (1 << ms->l2_index_size);
|
||||
+ ms->ptrs_per_l3 = (1 << ms->l3_index_size);
|
||||
+ ms->ptrs_per_l4 = (1 << ms->l4_index_size);
|
||||
+ machdep->ptrs_per_pgd = ms->ptrs_per_l4;
|
||||
|
||||
/* Compute shifts */
|
||||
- m->l2_shift = m->l1_shift + m->l1_index_size;
|
||||
- m->l3_shift = m->l2_shift + m->l2_index_size;
|
||||
- m->l4_shift = m->l3_shift + m->l3_index_size;
|
||||
+ ms->l2_shift = ms->l1_shift + ms->l1_index_size;
|
||||
+ ms->l3_shift = ms->l2_shift + ms->l2_index_size;
|
||||
+ ms->l4_shift = ms->l3_shift + ms->l3_index_size;
|
||||
}
|
||||
|
||||
if (machdep->flags & VMEMMAP)
|
||||
@@ -681,19 +682,15 @@ ppc64_init(int when)
|
||||
*/
|
||||
offset = MEMBER_OFFSET("paca_struct", "xHrdIntStack");
|
||||
paca_sym = symbol_value("paca");
|
||||
- if (!(machdep->machspec->hwintrstack =
|
||||
- (ulong *)calloc(NR_CPUS, sizeof(ulong))))
|
||||
+ if (!(ms->hwintrstack = (ulong *)calloc(NR_CPUS, sizeof(ulong))))
|
||||
error(FATAL, "cannot malloc hwintrstack space.");
|
||||
for (cpu = 0; cpu < kt->cpus; cpu++) {
|
||||
- readmem(paca_sym + (paca_size * cpu) + offset,
|
||||
- KVADDR,
|
||||
- &machdep->machspec->hwintrstack[cpu],
|
||||
- sizeof(ulong), "PPC64 HW_intr_stack",
|
||||
- FAULT_ON_ERROR);
|
||||
+ readmem(paca_sym + (paca_size * cpu) + offset, KVADDR,
|
||||
+ &ms->hwintrstack[cpu], sizeof(ulong),
|
||||
+ "PPC64 HW_intr_stack", FAULT_ON_ERROR);
|
||||
}
|
||||
- machdep->machspec->hwstacksize = 8 * machdep->pagesize;
|
||||
- if ((machdep->machspec->hwstackbuf = (char *)
|
||||
- malloc(machdep->machspec->hwstacksize)) == NULL)
|
||||
+ ms->hwstacksize = 8 * machdep->pagesize;
|
||||
+ if ((ms->hwstackbuf = (char *)malloc(ms->hwstacksize)) == NULL)
|
||||
error(FATAL, "cannot malloc hwirqstack buffer space.");
|
||||
}
|
||||
|
||||
@@ -756,6 +753,7 @@ ppc64_get_stacktop(ulong task)
|
||||
void
|
||||
ppc64_dump_machdep_table(ulong arg)
|
||||
{
|
||||
+ struct machine_specific *ms = machdep->machspec;
|
||||
int i, c, others;
|
||||
|
||||
others = 0;
|
||||
@@ -844,57 +842,57 @@ ppc64_dump_machdep_table(ulong arg)
|
||||
i, machdep->cmdline_args[i] ?
|
||||
machdep->cmdline_args[i] : "(unused)");
|
||||
}
|
||||
- fprintf(fp, " machspec: %lx\n", (ulong)machdep->machspec);
|
||||
+ fprintf(fp, " machspec: %lx\n", (ulong)ms);
|
||||
fprintf(fp, " is_kvaddr: %s\n",
|
||||
- machdep->machspec->is_kvaddr == book3e_is_kvaddr ?
|
||||
+ ms->is_kvaddr == book3e_is_kvaddr ?
|
||||
"book3e_is_kvaddr()" : "generic_is_kvaddr()");
|
||||
fprintf(fp, " is_vmaddr: %s\n",
|
||||
- machdep->machspec->is_vmaddr == book3e_is_vmaddr ?
|
||||
+ ms->is_vmaddr == book3e_is_vmaddr ?
|
||||
"book3e_is_vmaddr()" : "ppc64_is_vmaddr()");
|
||||
- if (machdep->machspec->hwintrstack) {
|
||||
+ if (ms->hwintrstack) {
|
||||
fprintf(fp, " hwintrstack[%d]: ", NR_CPUS);
|
||||
for (c = 0; c < NR_CPUS; c++) {
|
||||
fprintf(fp, "%s%016lx ",
|
||||
((c % 4) == 0) ? "\n " : "",
|
||||
- machdep->machspec->hwintrstack[c]);
|
||||
+ ms->hwintrstack[c]);
|
||||
}
|
||||
} else
|
||||
fprintf(fp, " hwintrstack: (unused)");
|
||||
fprintf(fp, "\n");
|
||||
- fprintf(fp, " hwstackbuf: %lx\n", (ulong)machdep->machspec->hwstackbuf);
|
||||
- fprintf(fp, " hwstacksize: %d\n", machdep->machspec->hwstacksize);
|
||||
- fprintf(fp, " l4_index_size: %d\n", machdep->machspec->l4_index_size);
|
||||
- fprintf(fp, " l3_index_size: %d\n", machdep->machspec->l3_index_size);
|
||||
- fprintf(fp, " l2_index_size: %d\n", machdep->machspec->l2_index_size);
|
||||
- fprintf(fp, " l1_index_size: %d\n", machdep->machspec->l1_index_size);
|
||||
- fprintf(fp, " ptrs_per_l4: %d\n", machdep->machspec->ptrs_per_l4);
|
||||
- fprintf(fp, " ptrs_per_l3: %d\n", machdep->machspec->ptrs_per_l3);
|
||||
- fprintf(fp, " ptrs_per_l2: %d\n", machdep->machspec->ptrs_per_l2);
|
||||
- fprintf(fp, " ptrs_per_l1: %d\n", machdep->machspec->ptrs_per_l1);
|
||||
- fprintf(fp, " l4_shift: %d\n", machdep->machspec->l4_shift);
|
||||
- fprintf(fp, " l3_shift: %d\n", machdep->machspec->l3_shift);
|
||||
- fprintf(fp, " l2_shift: %d\n", machdep->machspec->l2_shift);
|
||||
- fprintf(fp, " l1_shift: %d\n", machdep->machspec->l1_shift);
|
||||
- fprintf(fp, " pte_rpn_mask: %lx\n", machdep->machspec->pte_rpn_mask);
|
||||
- fprintf(fp, " pte_rpn_shift: %d\n", machdep->machspec->pte_rpn_shift);
|
||||
- fprintf(fp, " pgd_masked_bits: %lx\n", machdep->machspec->pgd_masked_bits);
|
||||
- fprintf(fp, " pud_masked_bits: %lx\n", machdep->machspec->pud_masked_bits);
|
||||
- fprintf(fp, " pmd_masked_bits: %lx\n", machdep->machspec->pmd_masked_bits);
|
||||
+ fprintf(fp, " hwstackbuf: %lx\n", (ulong)ms->hwstackbuf);
|
||||
+ fprintf(fp, " hwstacksize: %d\n", ms->hwstacksize);
|
||||
+ fprintf(fp, " l4_index_size: %d\n", ms->l4_index_size);
|
||||
+ fprintf(fp, " l3_index_size: %d\n", ms->l3_index_size);
|
||||
+ fprintf(fp, " l2_index_size: %d\n", ms->l2_index_size);
|
||||
+ fprintf(fp, " l1_index_size: %d\n", ms->l1_index_size);
|
||||
+ fprintf(fp, " ptrs_per_l4: %d\n", ms->ptrs_per_l4);
|
||||
+ fprintf(fp, " ptrs_per_l3: %d\n", ms->ptrs_per_l3);
|
||||
+ fprintf(fp, " ptrs_per_l2: %d\n", ms->ptrs_per_l2);
|
||||
+ fprintf(fp, " ptrs_per_l1: %d\n", ms->ptrs_per_l1);
|
||||
+ fprintf(fp, " l4_shift: %d\n", ms->l4_shift);
|
||||
+ fprintf(fp, " l3_shift: %d\n", ms->l3_shift);
|
||||
+ fprintf(fp, " l2_shift: %d\n", ms->l2_shift);
|
||||
+ fprintf(fp, " l1_shift: %d\n", ms->l1_shift);
|
||||
+ fprintf(fp, " pte_rpn_mask: %lx\n", ms->pte_rpn_mask);
|
||||
+ fprintf(fp, " pte_rpn_shift: %d\n", ms->pte_rpn_shift);
|
||||
+ fprintf(fp, " pgd_masked_bits: %lx\n", ms->pgd_masked_bits);
|
||||
+ fprintf(fp, " pud_masked_bits: %lx\n", ms->pud_masked_bits);
|
||||
+ fprintf(fp, " pmd_masked_bits: %lx\n", ms->pmd_masked_bits);
|
||||
fprintf(fp, " vmemmap_base: ");
|
||||
- if (machdep->machspec->vmemmap_base)
|
||||
- fprintf(fp, "%lx\n", machdep->machspec->vmemmap_base);
|
||||
+ if (ms->vmemmap_base)
|
||||
+ fprintf(fp, "%lx\n", ms->vmemmap_base);
|
||||
else
|
||||
fprintf(fp, "(unused)\n");
|
||||
- if (machdep->machspec->vmemmap_cnt) {
|
||||
+ if (ms->vmemmap_cnt) {
|
||||
fprintf(fp, " vmemmap_cnt: %d\n",
|
||||
- machdep->machspec->vmemmap_cnt);
|
||||
+ ms->vmemmap_cnt);
|
||||
fprintf(fp, " vmemmap_psize: %d\n",
|
||||
- machdep->machspec->vmemmap_psize);
|
||||
- for (i = 0; i < machdep->machspec->vmemmap_cnt; i++) {
|
||||
+ ms->vmemmap_psize);
|
||||
+ for (i = 0; i < ms->vmemmap_cnt; i++) {
|
||||
fprintf(fp,
|
||||
" vmemmap_list[%d]: virt: %lx phys: %lx\n", i,
|
||||
- machdep->machspec->vmemmap_list[i].virt,
|
||||
- machdep->machspec->vmemmap_list[i].phys);
|
||||
+ ms->vmemmap_list[i].virt,
|
||||
+ ms->vmemmap_list[i].phys);
|
||||
}
|
||||
} else {
|
||||
fprintf(fp, " vmemmap_cnt: (unused)\n");
|
||||
--
|
||||
2.37.1
|
||||
|
@ -1,121 +0,0 @@
|
||||
From 68ce0b9a35d77d767872dd1a729c50e4695a30a8 Mon Sep 17 00:00:00 2001
|
||||
From: Lianbo Jiang <lijiang@redhat.com>
|
||||
Date: Thu, 2 Jun 2022 20:12:56 +0800
|
||||
Subject: [PATCH 11/16] Fix for "dev -d|-D" options to support blk-mq change on
|
||||
Linux v5.18-rc1
|
||||
|
||||
Kernel commit 4e5cc99e1e48 ("blk-mq: manage hctx map via xarray") removed
|
||||
the "queue_hw_ctx" member from struct request_queue at Linux v5.18-rc1,
|
||||
and replaced it with a struct xarray "hctx_table". Without the patch, the
|
||||
"dev -d|-D" options will print an error:
|
||||
|
||||
crash> dev -d
|
||||
MAJOR GENDISK NAME REQUEST_QUEUE TOTAL READ WRITE
|
||||
|
||||
dev: invalid structure member offset: request_queue_queue_hw_ctx
|
||||
|
||||
With the patch:
|
||||
crash> dev -d
|
||||
MAJOR GENDISK NAME REQUEST_QUEUE TOTAL READ WRITE
|
||||
8 ffff8e99d0a1ae00 sda ffff8e9c14c59980 10 6 4
|
||||
|
||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
|
||||
---
|
||||
defs.h | 1 +
|
||||
dev.c | 42 +++++++++++++++++++++++++++++++++---------
|
||||
symbols.c | 2 ++
|
||||
3 files changed, 36 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/defs.h b/defs.h
|
||||
index 2681586a33dc..7d3b73422f48 100644
|
||||
--- a/defs.h
|
||||
+++ b/defs.h
|
||||
@@ -2180,6 +2180,7 @@ struct offset_table { /* stash of commonly-used offsets */
|
||||
long blk_mq_tags_breserved_tags;
|
||||
long blk_mq_tags_nr_reserved_tags;
|
||||
long blk_mq_tags_rqs;
|
||||
+ long request_queue_hctx_table;
|
||||
};
|
||||
|
||||
struct size_table { /* stash of commonly-used sizes */
|
||||
diff --git a/dev.c b/dev.c
|
||||
index 4be4c96df8b0..0172c83ffaea 100644
|
||||
--- a/dev.c
|
||||
+++ b/dev.c
|
||||
@@ -4369,20 +4369,42 @@ static void get_mq_diskio_from_hw_queues(ulong q, struct diskio *dio)
|
||||
uint cnt = 0;
|
||||
ulong addr = 0, hctx_addr = 0;
|
||||
ulong *hctx_array = NULL;
|
||||
+ struct list_pair *lp = NULL;
|
||||
+
|
||||
+ if (VALID_MEMBER(request_queue_hctx_table)) {
|
||||
+ addr = q + OFFSET(request_queue_hctx_table);
|
||||
+ cnt = do_xarray(addr, XARRAY_COUNT, NULL);
|
||||
+ lp = (struct list_pair *)GETBUF(sizeof(struct list_pair) * (cnt + 1));
|
||||
+ if (!lp)
|
||||
+ error(FATAL, "fail to get memory for list_pair.\n");
|
||||
+ lp[0].index = cnt;
|
||||
+ cnt = do_xarray(addr, XARRAY_GATHER, lp);
|
||||
+ } else {
|
||||
+ addr = q + OFFSET(request_queue_nr_hw_queues);
|
||||
+ readmem(addr, KVADDR, &cnt, sizeof(uint),
|
||||
+ "request_queue.nr_hw_queues", FAULT_ON_ERROR);
|
||||
|
||||
- addr = q + OFFSET(request_queue_nr_hw_queues);
|
||||
- readmem(addr, KVADDR, &cnt, sizeof(uint),
|
||||
- "request_queue.nr_hw_queues", FAULT_ON_ERROR);
|
||||
-
|
||||
- addr = q + OFFSET(request_queue_queue_hw_ctx);
|
||||
- readmem(addr, KVADDR, &hctx_addr, sizeof(void *),
|
||||
- "request_queue.queue_hw_ctx", FAULT_ON_ERROR);
|
||||
+ addr = q + OFFSET(request_queue_queue_hw_ctx);
|
||||
+ readmem(addr, KVADDR, &hctx_addr, sizeof(void *),
|
||||
+ "request_queue.queue_hw_ctx", FAULT_ON_ERROR);
|
||||
+ }
|
||||
|
||||
hctx_array = (ulong *)GETBUF(sizeof(void *) * cnt);
|
||||
- if (!hctx_array)
|
||||
+ if (!hctx_array) {
|
||||
+ if (lp)
|
||||
+ FREEBUF(lp);
|
||||
error(FATAL, "fail to get memory for the hctx_array\n");
|
||||
+ }
|
||||
+
|
||||
+ if (lp && hctx_array) {
|
||||
+ uint i;
|
||||
+
|
||||
+ /* copy it from list_pair to hctx_array */
|
||||
+ for (i = 0; i < cnt; i++)
|
||||
+ hctx_array[i] = (ulong)lp[i].value;
|
||||
|
||||
- if (!readmem(hctx_addr, KVADDR, hctx_array, sizeof(void *) * cnt,
|
||||
+ FREEBUF(lp);
|
||||
+ } else if (!readmem(hctx_addr, KVADDR, hctx_array, sizeof(void *) * cnt,
|
||||
"request_queue.queue_hw_ctx[]", RETURN_ON_ERROR)) {
|
||||
FREEBUF(hctx_array);
|
||||
return;
|
||||
@@ -4755,6 +4777,8 @@ void diskio_init(void)
|
||||
"request_queue", "queue_hw_ctx");
|
||||
MEMBER_OFFSET_INIT(request_queue_nr_hw_queues,
|
||||
"request_queue", "nr_hw_queues");
|
||||
+ MEMBER_OFFSET_INIT(request_queue_hctx_table,
|
||||
+ "request_queue", "hctx_table");
|
||||
MEMBER_OFFSET_INIT(blk_mq_ctx_rq_dispatched, "blk_mq_ctx",
|
||||
"rq_dispatched");
|
||||
MEMBER_OFFSET_INIT(blk_mq_ctx_rq_completed, "blk_mq_ctx",
|
||||
diff --git a/symbols.c b/symbols.c
|
||||
index c1f09556d710..bee1faf92c83 100644
|
||||
--- a/symbols.c
|
||||
+++ b/symbols.c
|
||||
@@ -10403,6 +10403,8 @@ dump_offset_table(char *spec, ulong makestruct)
|
||||
OFFSET(request_queue_queue_hw_ctx));
|
||||
fprintf(fp, " request_queue_nr_hw_queues: %ld\n",
|
||||
OFFSET(request_queue_nr_hw_queues));
|
||||
+ fprintf(fp, " request_queue_hctx_table: %ld\n",
|
||||
+ OFFSET(request_queue_hctx_table));
|
||||
fprintf(fp, " blk_mq_ctx_rq_dispatched: %ld\n",
|
||||
OFFSET(blk_mq_ctx_rq_dispatched));
|
||||
fprintf(fp, " blk_mq_ctx_rq_completed: %ld\n",
|
||||
--
|
||||
2.30.2
|
||||
|
@ -1,39 +0,0 @@
|
||||
From 6722ea102264b54529afc19d347a3a7473670fdd Mon Sep 17 00:00:00 2001
|
||||
From: Qianli Zhao <qianli.zhao@horizon.ai>
|
||||
Date: Mon, 4 Jul 2022 16:40:01 +0800
|
||||
Subject: [PATCH 11/29] arm64: Fix for st->_stext_vmlinux not initialized when
|
||||
set VA_BITS_ACTUAL
|
||||
|
||||
Setting st->_stext_vmlinux to UNINITIALIZED to search for "_stext"
|
||||
from the vmlinux. In the scenario where kaslr is disabled and
|
||||
without vmcoreinfo, crash will get the wrong MODULES/VMALLOC ranges
|
||||
and cause a failure in parsing a raw RAM dumpfile.
|
||||
|
||||
Signed-off-by: Qianli Zhao <qianli.zhao@horizon.ai>
|
||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
|
||||
---
|
||||
arm64.c | 8 ++++++++
|
||||
1 file changed, 8 insertions(+)
|
||||
|
||||
diff --git a/arm64.c b/arm64.c
|
||||
index 0f615cf52bef..b6b7aa11f4fe 100644
|
||||
--- a/arm64.c
|
||||
+++ b/arm64.c
|
||||
@@ -149,6 +149,14 @@ arm64_init(int when)
|
||||
|
||||
ms = machdep->machspec;
|
||||
|
||||
+ /*
|
||||
+ * The st->_stext_vmlinux is needed in arm64_init(PRE_GDB) when a
|
||||
+ * dumpfile does not have vmcoreinfo and we use -m vabits_actual
|
||||
+ * option, e.g. a raw RAM dumpfile.
|
||||
+ */
|
||||
+ if (ms->VA_BITS_ACTUAL)
|
||||
+ st->_stext_vmlinux = UNINITIALIZED;
|
||||
+
|
||||
if (!ms->kimage_voffset && STREQ(pc->live_memsrc, "/dev/crash"))
|
||||
ioctl(pc->mfd, DEV_CRASH_ARCH_DATA, &ms->kimage_voffset);
|
||||
|
||||
--
|
||||
2.37.1
|
||||
|
@ -1,43 +0,0 @@
|
||||
From c672d7a4c290712b32c54329cbdc1e74d122e813 Mon Sep 17 00:00:00 2001
|
||||
From: Lianbo Jiang <lijiang@redhat.com>
|
||||
Date: Mon, 6 Jun 2022 19:09:16 +0800
|
||||
Subject: [PATCH 12/16] Doc: update man page for the "bpf" and "sbitmapq"
|
||||
commands
|
||||
|
||||
The information of the "bpf" and "sbitmapq" commands is missing in the man
|
||||
page of the crash utility. Let's add it to the man page.
|
||||
|
||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
|
||||
---
|
||||
crash.8 | 8 ++++++++
|
||||
1 file changed, 8 insertions(+)
|
||||
|
||||
diff --git a/crash.8 b/crash.8
|
||||
index 1f3657b11e4c..e553a0b4adb3 100644
|
||||
--- a/crash.8
|
||||
+++ b/crash.8
|
||||
@@ -584,6 +584,9 @@ creates a single-word alias for a command.
|
||||
.I ascii
|
||||
displays an ascii chart or translates a numeric value into its ascii components.
|
||||
.TP
|
||||
+.I bpf
|
||||
+provides information on currently-loaded eBPF programs and maps.
|
||||
+.TP
|
||||
.I bt
|
||||
displays a task's kernel-stack backtrace. If it is given the
|
||||
.I \-a
|
||||
@@ -706,6 +709,11 @@ number of seconds between each command execution.
|
||||
.I runq
|
||||
displays the tasks on the run queue.
|
||||
.TP
|
||||
+.I sbitmapq
|
||||
+dumps the contents of the sbitmap_queue structure and the used
|
||||
+bits in the bitmap. Also, it shows the dump of a structure array
|
||||
+associated with the sbitmap_queue.
|
||||
+.TP
|
||||
.I search
|
||||
searches a range of user or kernel memory space for given value.
|
||||
.TP
|
||||
--
|
||||
2.30.2
|
||||
|
@ -1,53 +0,0 @@
|
||||
From f374aca364b7e8809f122678aefed1010e3c94bd Mon Sep 17 00:00:00 2001
|
||||
From: Kazuhito Hagio <k-hagio-ab@nec.com>
|
||||
Date: Fri, 22 Jul 2022 13:44:50 +0900
|
||||
Subject: [PATCH 12/29] Fix gcc-11 compiler warnings on filesys.c
|
||||
|
||||
Without the patch, the following gcc-11 compiler warnings are emitted
|
||||
for filesys.c:
|
||||
|
||||
filesys.c: In function 'mount_point':
|
||||
filesys.c:718:17: warning: 'pclose' called on pointer returned from a mismatched allocation function [-Wmismatched-dealloc]
|
||||
718 | pclose(mp);
|
||||
| ^~~~~~~~~~
|
||||
filesys.c:709:27: note: returned from 'fopen'
|
||||
709 | if ((mp = fopen(mntfile, "r")) == NULL)
|
||||
| ^~~~~~~~~~~~~~~~~~~
|
||||
filesys.c:738:17: warning: 'pclose' called on pointer returned from a mismatched allocation function [-Wmismatched-dealloc]
|
||||
738 | pclose(mp);
|
||||
| ^~~~~~~~~~
|
||||
filesys.c:723:27: note: returned from 'fopen'
|
||||
723 | if ((mp = fopen(mntfile, "r")) == NULL)
|
||||
| ^~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
|
||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
|
||||
---
|
||||
filesys.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/filesys.c b/filesys.c
|
||||
index 43cbe826fc79..a863f04eb250 100644
|
||||
--- a/filesys.c
|
||||
+++ b/filesys.c
|
||||
@@ -715,7 +715,7 @@ mount_point(char *name)
|
||||
continue;
|
||||
found++;
|
||||
}
|
||||
- pclose(mp);
|
||||
+ fclose(mp);
|
||||
|
||||
if (!(mount_points = (char **)malloc(sizeof(char *) * found)))
|
||||
return FALSE;
|
||||
@@ -735,7 +735,7 @@ mount_point(char *name)
|
||||
mount_points_gathered++, i++;
|
||||
}
|
||||
}
|
||||
- pclose(mp);
|
||||
+ fclose(mp);
|
||||
|
||||
if (CRASHDEBUG(2))
|
||||
for (i = 0; i < mount_points_gathered; i++)
|
||||
--
|
||||
2.37.1
|
||||
|
@ -1,53 +0,0 @@
|
||||
From b9c0ed124e422b7e0b1526afa3a691ad0579607b Mon Sep 17 00:00:00 2001
|
||||
From: Kazuhito Hagio <k-hagio-ab@nec.com>
|
||||
Date: Fri, 22 Jul 2022 13:44:50 +0900
|
||||
Subject: [PATCH 13/29] Fix gcc-11 compiler warning on symbols.c
|
||||
|
||||
Without the patch, the following gcc-11 compiler warning is emitted for
|
||||
symbols.c:
|
||||
|
||||
symbols.c: In function 'cmd_p':
|
||||
symbols.c:7412:38: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
|
||||
7412 | *(cpuspec-1) = ':';
|
||||
| ~~~~~~~~~~~~~^~~~~
|
||||
|
||||
Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
|
||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
|
||||
---
|
||||
symbols.c | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/symbols.c b/symbols.c
|
||||
index bee1faf92c83..42c4eb400044 100644
|
||||
--- a/symbols.c
|
||||
+++ b/symbols.c
|
||||
@@ -7351,7 +7351,7 @@ cmd_p(void)
|
||||
unsigned radix;
|
||||
int do_load_module_filter;
|
||||
char buf1[BUFSIZE];
|
||||
- char *cpuspec;
|
||||
+ char *cpuspec, *p;
|
||||
|
||||
do_load_module_filter = radix = 0;
|
||||
|
||||
@@ -7386,7 +7386,7 @@ cmd_p(void)
|
||||
if (argerrs || !args[optind])
|
||||
cmd_usage(pc->curcmd, SYNOPSIS);
|
||||
|
||||
- cpuspec = strrchr(args[optind], ':');
|
||||
+ p = cpuspec = strrchr(args[optind], ':');
|
||||
if (cpuspec)
|
||||
*cpuspec++ = NULLCHAR;
|
||||
|
||||
@@ -7409,7 +7409,7 @@ cmd_p(void)
|
||||
sp->name);
|
||||
else
|
||||
/* maybe a valid C expression (e.g. ':') */
|
||||
- *(cpuspec-1) = ':';
|
||||
+ *p = ':';
|
||||
}
|
||||
|
||||
process_gdb_output(concat_args(buf1, 0, TRUE), radix,
|
||||
--
|
||||
2.37.1
|
||||
|
@ -1,48 +0,0 @@
|
||||
From 9ce31a14d1083cbb2beb4a8e6eb7b88234b79a99 Mon Sep 17 00:00:00 2001
|
||||
From: Kazuhito Hagio <k-hagio-ab@nec.com>
|
||||
Date: Fri, 10 Jun 2022 11:49:47 +0900
|
||||
Subject: [PATCH 13/16] sbitmapq: Fix for sbitmap_queue without ws_active
|
||||
member
|
||||
|
||||
The sbitmap_queue.ws_active member was added by kernel commit 5d2ee7122c73
|
||||
("sbitmap: optimize wakeup check") at Linux 5.0. Without the patch, on
|
||||
earlier kernels the "sbitmapq" command fails with the following error:
|
||||
|
||||
crash> sbitmapq ffff8f1a3611cf10
|
||||
|
||||
sbitmapq: invalid structure member offset: sbitmap_queue_ws_active
|
||||
FILE: sbitmap.c LINE: 393 FUNCTION: sbitmap_queue_context_load()
|
||||
|
||||
Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
|
||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
|
||||
---
|
||||
sbitmap.c | 6 ++++--
|
||||
1 file changed, 4 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/sbitmap.c b/sbitmap.c
|
||||
index e8ebd62fe01c..152c28e6875f 100644
|
||||
--- a/sbitmap.c
|
||||
+++ b/sbitmap.c
|
||||
@@ -325,7 +325,8 @@ static void sbitmap_queue_show(const struct sbitmap_queue_context *sqc,
|
||||
|
||||
fprintf(fp, "wake_batch = %u\n", sqc->wake_batch);
|
||||
fprintf(fp, "wake_index = %d\n", sqc->wake_index);
|
||||
- fprintf(fp, "ws_active = %d\n", sqc->ws_active);
|
||||
+ if (VALID_MEMBER(sbitmap_queue_ws_active)) /* 5.0 and later */
|
||||
+ fprintf(fp, "ws_active = %d\n", sqc->ws_active);
|
||||
|
||||
sbq_wait_state_size = SIZE(sbq_wait_state);
|
||||
wait_cnt_off = OFFSET(sbq_wait_state_wait_cnt);
|
||||
@@ -380,7 +381,8 @@ static void sbitmap_queue_context_load(ulong addr, struct sbitmap_queue_context
|
||||
sqc->wake_batch = UINT(sbitmap_queue_buf + OFFSET(sbitmap_queue_wake_batch));
|
||||
sqc->wake_index = INT(sbitmap_queue_buf + OFFSET(sbitmap_queue_wake_index));
|
||||
sqc->ws_addr = ULONG(sbitmap_queue_buf + OFFSET(sbitmap_queue_ws));
|
||||
- sqc->ws_active = INT(sbitmap_queue_buf + OFFSET(sbitmap_queue_ws_active));
|
||||
+ if (VALID_MEMBER(sbitmap_queue_ws_active))
|
||||
+ sqc->ws_active = INT(sbitmap_queue_buf + OFFSET(sbitmap_queue_ws_active));
|
||||
if (VALID_MEMBER(sbitmap_queue_round_robin))
|
||||
sqc->round_robin = BOOL(sbitmap_queue_buf + OFFSET(sbitmap_queue_round_robin));
|
||||
sqc->min_shallow_depth = UINT(sbitmap_queue_buf + OFFSET(sbitmap_queue_min_shallow_depth));
|
||||
--
|
||||
2.30.2
|
||||
|
@ -1,38 +0,0 @@
|
||||
From 7591e3c07cef4900f6b0ca797270cb7527fb4e29 Mon Sep 17 00:00:00 2001
|
||||
From: Kazuhito Hagio <k-hagio-ab@nec.com>
|
||||
Date: Fri, 22 Jul 2022 13:44:50 +0900
|
||||
Subject: [PATCH 14/29] Fix gcc-11 compiler warning on makedumpfile.c
|
||||
|
||||
Without the patch, the following gcc-11 compiler warning is emitted for
|
||||
makedumpfile.c:
|
||||
|
||||
In function 'flattened_format_get_osrelease',
|
||||
inlined from 'check_flattened_format' at makedumpfile.c:236:3:
|
||||
makedumpfile.c:392:9: warning: 'fclose' called on pointer returned from a mismatched allocation function [-Wmismatched-dealloc]
|
||||
392 | fclose(pipe);
|
||||
| ^~~~~~~~~~~~
|
||||
makedumpfile.c: In function 'check_flattened_format':
|
||||
makedumpfile.c:380:21: note: returned from 'popen'
|
||||
380 | if ((pipe = popen(buf, "r")) == NULL)
|
||||
| ^~~~~~~~~~~~~~~
|
||||
|
||||
Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
|
||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
|
||||
---
|
||||
makedumpfile.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/makedumpfile.c b/makedumpfile.c
|
||||
index ebf24f56da2c..26d12b638ecd 100644
|
||||
--- a/makedumpfile.c
|
||||
+++ b/makedumpfile.c
|
||||
@@ -389,5 +389,5 @@ flattened_format_get_osrelease(char *file)
|
||||
}
|
||||
}
|
||||
|
||||
- fclose(pipe);
|
||||
+ pclose(pipe);
|
||||
}
|
||||
--
|
||||
2.37.1
|
||||
|
@ -1,110 +0,0 @@
|
||||
From 0d3e86fee5eead93b521a0e20a0e099ede4ab72b Mon Sep 17 00:00:00 2001
|
||||
From: Kazuhito Hagio <k-hagio-ab@nec.com>
|
||||
Date: Fri, 10 Jun 2022 11:49:47 +0900
|
||||
Subject: [PATCH 14/16] sbitmapq: Fix for sbitmap_word without cleared member
|
||||
|
||||
The sbitmap_word.cleared member was added by kernel commit ea86ea2cdced
|
||||
("sbitmap: ammortize cost of clearing bits") at Linux 5.0. Without the
|
||||
patch, on earlier kernels the "sbitmapq" command fails with the
|
||||
following error:
|
||||
|
||||
crash> sbitmapq ffff8f1a3611cf10
|
||||
|
||||
sbitmapq: invalid structure member offset: sbitmap_word_cleared
|
||||
FILE: sbitmap.c LINE: 92 FUNCTION: __sbitmap_weight()
|
||||
|
||||
Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
|
||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
|
||||
---
|
||||
sbitmap.c | 26 ++++++++++++++++++--------
|
||||
1 file changed, 18 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/sbitmap.c b/sbitmap.c
|
||||
index 152c28e6875f..c9f7209f9e3e 100644
|
||||
--- a/sbitmap.c
|
||||
+++ b/sbitmap.c
|
||||
@@ -89,7 +89,6 @@ static unsigned int __sbitmap_weight(const struct sbitmap_context *sc, bool set)
|
||||
{
|
||||
const ulong sbitmap_word_size = SIZE(sbitmap_word);
|
||||
const ulong w_word_off = OFFSET(sbitmap_word_word);
|
||||
- const ulong w_cleared_off = OFFSET(sbitmap_word_cleared);
|
||||
|
||||
unsigned int weight = 0;
|
||||
ulong addr = sc->map_addr;
|
||||
@@ -111,7 +110,10 @@ static unsigned int __sbitmap_weight(const struct sbitmap_context *sc, bool set)
|
||||
word = ULONG(sbitmap_word_buf + w_word_off);
|
||||
weight += bitmap_weight(word, depth);
|
||||
} else {
|
||||
- cleared = ULONG(sbitmap_word_buf + w_cleared_off);
|
||||
+ if (VALID_MEMBER(sbitmap_word_cleared))
|
||||
+ cleared = ULONG(sbitmap_word_buf + OFFSET(sbitmap_word_cleared));
|
||||
+ else
|
||||
+ cleared = 0;
|
||||
weight += bitmap_weight(cleared, depth);
|
||||
}
|
||||
|
||||
@@ -130,7 +132,10 @@ static unsigned int sbitmap_weight(const struct sbitmap_context *sc)
|
||||
|
||||
static unsigned int sbitmap_cleared(const struct sbitmap_context *sc)
|
||||
{
|
||||
- return __sbitmap_weight(sc, false);
|
||||
+ if (VALID_MEMBER(sbitmap_word_cleared)) /* 5.0 and later */
|
||||
+ return __sbitmap_weight(sc, false);
|
||||
+
|
||||
+ return 0;
|
||||
}
|
||||
|
||||
static void sbitmap_emit_byte(unsigned int offset, uint8_t byte)
|
||||
@@ -149,7 +154,6 @@ static void sbitmap_bitmap_show(const struct sbitmap_context *sc)
|
||||
{
|
||||
const ulong sbitmap_word_size = SIZE(sbitmap_word);
|
||||
const ulong w_word_off = OFFSET(sbitmap_word_word);
|
||||
- const ulong w_cleared_off = OFFSET(sbitmap_word_cleared);
|
||||
|
||||
uint8_t byte = 0;
|
||||
unsigned int byte_bits = 0;
|
||||
@@ -169,7 +173,10 @@ static void sbitmap_bitmap_show(const struct sbitmap_context *sc)
|
||||
}
|
||||
|
||||
word = ULONG(sbitmap_word_buf + w_word_off);
|
||||
- cleared = ULONG(sbitmap_word_buf + w_cleared_off);
|
||||
+ if (VALID_MEMBER(sbitmap_word_cleared))
|
||||
+ cleared = ULONG(sbitmap_word_buf + OFFSET(sbitmap_word_cleared));
|
||||
+ else
|
||||
+ cleared = 0;
|
||||
word_bits = __map_depth(sc, i);
|
||||
|
||||
word &= ~cleared;
|
||||
@@ -219,7 +226,6 @@ static void __sbitmap_for_each_set(const struct sbitmap_context *sc,
|
||||
{
|
||||
const ulong sbitmap_word_size = SIZE(sbitmap_word);
|
||||
const ulong w_word_off = OFFSET(sbitmap_word_word);
|
||||
- const ulong w_cleared_off = OFFSET(sbitmap_word_cleared);
|
||||
|
||||
unsigned int index;
|
||||
unsigned int nr;
|
||||
@@ -245,7 +251,10 @@ static void __sbitmap_for_each_set(const struct sbitmap_context *sc,
|
||||
}
|
||||
|
||||
w_word = ULONG(sbitmap_word_buf + w_word_off);
|
||||
- w_cleared = ULONG(sbitmap_word_buf + w_cleared_off);
|
||||
+ if (VALID_MEMBER(sbitmap_word_cleared))
|
||||
+ w_cleared = ULONG(sbitmap_word_buf + OFFSET(sbitmap_word_cleared));
|
||||
+ else
|
||||
+ w_cleared = 0;
|
||||
|
||||
depth = min(__map_depth(sc, index) - nr, sc->depth - scanned);
|
||||
|
||||
@@ -297,7 +306,8 @@ static void sbitmap_queue_show(const struct sbitmap_queue_context *sqc,
|
||||
|
||||
fprintf(fp, "depth = %u\n", sc->depth);
|
||||
fprintf(fp, "busy = %u\n", sbitmap_weight(sc) - sbitmap_cleared(sc));
|
||||
- fprintf(fp, "cleared = %u\n", sbitmap_cleared(sc));
|
||||
+ if (VALID_MEMBER(sbitmap_word_cleared)) /* 5.0 and later */
|
||||
+ fprintf(fp, "cleared = %u\n", sbitmap_cleared(sc));
|
||||
fprintf(fp, "bits_per_word = %u\n", 1U << sc->shift);
|
||||
fprintf(fp, "map_nr = %u\n", sc->map_nr);
|
||||
|
||||
--
|
||||
2.30.2
|
||||
|
@ -1,61 +0,0 @@
|
||||
From f37df7df8a50519d80f04fb48499287892021575 Mon Sep 17 00:00:00 2001
|
||||
From: Kazuhito Hagio <k-hagio-ab@nec.com>
|
||||
Date: Fri, 22 Jul 2022 13:44:50 +0900
|
||||
Subject: [PATCH 15/29] Fix gcc-11 compiler warning on kvmdump.c
|
||||
|
||||
Without the patch, the following gcc-11 compiler warning is emitted for
|
||||
kvmdump.c:
|
||||
|
||||
In function 'write_mapfile_registers',
|
||||
inlined from 'write_mapfile_trailer' at kvmdump.c:947:3,
|
||||
inlined from 'kvmdump_init' at kvmdump.c:145:4:
|
||||
kvmdump.c:972:13: warning: 'write' reading 8 bytes from a region of size 4 [-Wstringop-overread]
|
||||
972 | if (write(kvm->mapfd, &kvm->cpu_devices, sizeof(uint64_t)) != sizeof(uint64_t))
|
||||
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
In file included from kvmdump.c:19:
|
||||
kvmdump.c: In function 'kvmdump_init':
|
||||
kvmdump.h:67:18: note: source object 'cpu_devices' of size 4
|
||||
67 | uint32_t cpu_devices;
|
||||
| ^~~~~~~~~~~
|
||||
In file included from defs.h:26,
|
||||
from kvmdump.c:18:
|
||||
/usr/include/unistd.h:378:16: note: in a call to function 'write' declared with attribute 'access (read_only, 2, 3)'
|
||||
378 | extern ssize_t write (int __fd, const void *__buf, size_t __n) __wur
|
||||
| ^~~~~
|
||||
|
||||
Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
|
||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
|
||||
---
|
||||
kvmdump.c | 2 +-
|
||||
kvmdump.h | 2 +-
|
||||
2 files changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/kvmdump.c b/kvmdump.c
|
||||
index 4db96bd844e9..e515bf0ce9a1 100644
|
||||
--- a/kvmdump.c
|
||||
+++ b/kvmdump.c
|
||||
@@ -297,7 +297,7 @@ kvmdump_memory_dump(FILE *ofp)
|
||||
(ulonglong)kvm->page_cache[i].paddr);
|
||||
}
|
||||
|
||||
- fprintf(ofp, " cpu_devices: %d\n", kvm->cpu_devices);
|
||||
+ fprintf(ofp, " cpu_devices: %ld\n", kvm->cpu_devices);
|
||||
fprintf(ofp, " iohole: %llx (%llx - %llx)\n",
|
||||
(ulonglong)kvm->iohole, 0x100000000ULL - kvm->iohole,
|
||||
0x100000000ULL);
|
||||
diff --git a/kvmdump.h b/kvmdump.h
|
||||
index 07e047bb171c..2e408aebef0b 100644
|
||||
--- a/kvmdump.h
|
||||
+++ b/kvmdump.h
|
||||
@@ -64,7 +64,7 @@ struct kvmdump_data {
|
||||
ulong compresses;
|
||||
uint64_t kvbase;
|
||||
ulong *debug;
|
||||
- uint32_t cpu_devices;
|
||||
+ uint64_t cpu_devices;
|
||||
struct register_set *registers;
|
||||
uint64_t iohole;
|
||||
};
|
||||
--
|
||||
2.37.1
|
||||
|
@ -1,49 +0,0 @@
|
||||
From 12fe6c7cdd768f87ce6e903a2bbfb0c0591585c5 Mon Sep 17 00:00:00 2001
|
||||
From: Kazuhito Hagio <k-hagio-ab@nec.com>
|
||||
Date: Fri, 10 Jun 2022 11:49:47 +0900
|
||||
Subject: [PATCH 15/16] sbitmapq: Fix for sbitmap_queue without
|
||||
min_shallow_depth member
|
||||
|
||||
The sbitmap_queue.min_shallow_depth member was added by kernel commit
|
||||
a327553965de ("sbitmap: fix missed wakeups caused by sbitmap_queue_get_shallow()")
|
||||
at Linux 4.18. Without the patch, on earlier kernels the "sbitmapq"
|
||||
command fails with the following error:
|
||||
|
||||
crash> sbitmapq ffff89bb7638ee50
|
||||
|
||||
sbitmapq: invalid structure member offset: sbitmap_queue_min_shallow_depth
|
||||
FILE: sbitmap.c LINE: 398 FUNCTION: sbitmap_queue_context_load()
|
||||
|
||||
Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
|
||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
|
||||
---
|
||||
sbitmap.c | 6 ++++--
|
||||
1 file changed, 4 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/sbitmap.c b/sbitmap.c
|
||||
index c9f7209f9e3e..bb2f19e6207b 100644
|
||||
--- a/sbitmap.c
|
||||
+++ b/sbitmap.c
|
||||
@@ -371,7 +371,8 @@ static void sbitmap_queue_show(const struct sbitmap_queue_context *sqc,
|
||||
else if (VALID_MEMBER(sbitmap_round_robin)) /* 5.13 and later */
|
||||
fprintf(fp, "round_robin = %d\n", sc->round_robin);
|
||||
|
||||
- fprintf(fp, "min_shallow_depth = %u\n", sqc->min_shallow_depth);
|
||||
+ if (VALID_MEMBER(sbitmap_queue_min_shallow_depth)) /* 4.18 and later */
|
||||
+ fprintf(fp, "min_shallow_depth = %u\n", sqc->min_shallow_depth);
|
||||
}
|
||||
|
||||
static void sbitmap_queue_context_load(ulong addr, struct sbitmap_queue_context *sqc)
|
||||
@@ -395,7 +396,8 @@ static void sbitmap_queue_context_load(ulong addr, struct sbitmap_queue_context
|
||||
sqc->ws_active = INT(sbitmap_queue_buf + OFFSET(sbitmap_queue_ws_active));
|
||||
if (VALID_MEMBER(sbitmap_queue_round_robin))
|
||||
sqc->round_robin = BOOL(sbitmap_queue_buf + OFFSET(sbitmap_queue_round_robin));
|
||||
- sqc->min_shallow_depth = UINT(sbitmap_queue_buf + OFFSET(sbitmap_queue_min_shallow_depth));
|
||||
+ if (VALID_MEMBER(sbitmap_queue_min_shallow_depth))
|
||||
+ sqc->min_shallow_depth = UINT(sbitmap_queue_buf + OFFSET(sbitmap_queue_min_shallow_depth));
|
||||
|
||||
FREEBUF(sbitmap_queue_buf);
|
||||
}
|
||||
--
|
||||
2.30.2
|
||||
|
@ -1,84 +0,0 @@
|
||||
From c07068266b41450ca6821ee0a1a3adf34206015f Mon Sep 17 00:00:00 2001
|
||||
From: Kazuhito Hagio <k-hagio-ab@nec.com>
|
||||
Date: Fri, 10 Jun 2022 15:21:53 +0900
|
||||
Subject: [PATCH 16/16] Make "dev -d|-D" options parse sbitmap on Linux 4.18
|
||||
and later
|
||||
|
||||
There have been a few reports that the "dev -d|-D" options displayed
|
||||
incorrect I/O stats due to racy blk_mq_ctx.rq_* counters. To fix it,
|
||||
make the options parse sbitmap to count I/O stats on Linux 4.18 and
|
||||
later kernels, which include RHEL8 ones.
|
||||
|
||||
To do this, adjust to the blk_mq_tags structure of Linux 5.10 through
|
||||
5.15 kernels, which contain kernel commit 222a5ae03cdd ("blk-mq: Use
|
||||
pointers for blk_mq_tags bitmap tags") and do not contain ae0f1a732f4a
|
||||
("blk-mq: Stop using pointers for blk_mq_tags bitmap tags").
|
||||
|
||||
Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
|
||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
|
||||
---
|
||||
dev.c | 25 +++++++++++++++++++++++--
|
||||
1 file changed, 23 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/dev.c b/dev.c
|
||||
index 0172c83ffaea..db97f8aebdc2 100644
|
||||
--- a/dev.c
|
||||
+++ b/dev.c
|
||||
@@ -4339,6 +4339,10 @@ static void bt_for_each(ulong q, ulong tags, ulong sbq, uint reserved, uint nr_r
|
||||
static void queue_for_each_hw_ctx(ulong q, ulong *hctx, uint cnt, struct diskio *dio)
|
||||
{
|
||||
uint i;
|
||||
+ int bitmap_tags_is_ptr = 0;
|
||||
+
|
||||
+ if (MEMBER_TYPE("blk_mq_tags", "bitmap_tags") == TYPE_CODE_PTR)
|
||||
+ bitmap_tags_is_ptr = 1;
|
||||
|
||||
for (i = 0; i < cnt; i++) {
|
||||
ulong addr = 0, tags = 0;
|
||||
@@ -4357,9 +4361,17 @@ static void queue_for_each_hw_ctx(ulong q, ulong *hctx, uint cnt, struct diskio
|
||||
|
||||
if (nr_reserved_tags) {
|
||||
addr = tags + OFFSET(blk_mq_tags_breserved_tags);
|
||||
+ if (bitmap_tags_is_ptr &&
|
||||
+ !readmem(addr, KVADDR, &addr, sizeof(ulong),
|
||||
+ "blk_mq_tags.bitmap_tags", RETURN_ON_ERROR))
|
||||
+ break;
|
||||
bt_for_each(q, tags, addr, 1, nr_reserved_tags, dio);
|
||||
}
|
||||
addr = tags + OFFSET(blk_mq_tags_bitmap_tags);
|
||||
+ if (bitmap_tags_is_ptr &&
|
||||
+ !readmem(addr, KVADDR, &addr, sizeof(ulong),
|
||||
+ "blk_mq_tags.bitmap_tags", RETURN_ON_ERROR))
|
||||
+ break;
|
||||
bt_for_each(q, tags, addr, 0, nr_reserved_tags, dio);
|
||||
}
|
||||
}
|
||||
@@ -4423,14 +4435,23 @@ get_mq_diskio(unsigned long q, unsigned long *mq_count)
|
||||
unsigned long mctx_addr;
|
||||
struct diskio tmp = {0};
|
||||
|
||||
- if (INVALID_MEMBER(blk_mq_ctx_rq_dispatched) ||
|
||||
- INVALID_MEMBER(blk_mq_ctx_rq_completed)) {
|
||||
+ /*
|
||||
+ * Currently this function does not support old blk-mq implementation
|
||||
+ * before 12f5b9314545 ("blk-mq: Remove generation seqeunce"), so
|
||||
+ * filter them out.
|
||||
+ */
|
||||
+ if (VALID_MEMBER(request_state)) {
|
||||
+ if (CRASHDEBUG(1))
|
||||
+ fprintf(fp, "mq: using sbitmap\n");
|
||||
get_mq_diskio_from_hw_queues(q, &tmp);
|
||||
mq_count[0] = tmp.read;
|
||||
mq_count[1] = tmp.write;
|
||||
return;
|
||||
}
|
||||
|
||||
+ if (CRASHDEBUG(1))
|
||||
+ fprintf(fp, "mq: using blk_mq_ctx.rq_{completed,dispatched} counters\n");
|
||||
+
|
||||
readmem(q + OFFSET(request_queue_queue_ctx), KVADDR, &queue_ctx,
|
||||
sizeof(ulong), "request_queue.queue_ctx",
|
||||
FAULT_ON_ERROR);
|
||||
--
|
||||
2.30.2
|
||||
|
@ -1,156 +0,0 @@
|
||||
From 763e221388219b07bd949a9ba48768856908ec6d Mon Sep 17 00:00:00 2001
|
||||
From: Lianbo Jiang <lijiang@redhat.com>
|
||||
Date: Thu, 28 Jul 2022 15:11:20 +0800
|
||||
Subject: [PATCH 16/29] x86_64: Fix for AMD SME issue
|
||||
|
||||
Kernel commit changes(see [1]/[2]) may cause the failure of crash-utility
|
||||
with the following error:
|
||||
|
||||
#./crash /home/vmlinux /home/vmcore
|
||||
...
|
||||
For help, type "help".
|
||||
Type "apropos word" to search for commands related to "word"...
|
||||
|
||||
crash: seek error: physical address: 8000760a14000 type: "p4d page"
|
||||
|
||||
Let's get the "NUMBER(sme_mask)" from vmcoreinfo, and try to remove
|
||||
the C-bit from the page table entries, the intention is to get the
|
||||
true physical address.
|
||||
|
||||
Related kernel commits:
|
||||
[1] aad983913d77 ("x86/mm/encrypt: Simplify sme_populate_pgd() and sme_populate_pgd_large()")
|
||||
[2] e7d445ab26db ("x86/sme: Use #define USE_EARLY_PGTABLE_L5 in mem_encrypt_identity.c")
|
||||
|
||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
|
||||
---
|
||||
defs.h | 1 +
|
||||
x86_64.c | 21 ++++++++++++++++++---
|
||||
2 files changed, 19 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/defs.h b/defs.h
|
||||
index 9b1b69a4f421..9d6d8916284b 100644
|
||||
--- a/defs.h
|
||||
+++ b/defs.h
|
||||
@@ -6198,6 +6198,7 @@ struct machine_specific {
|
||||
ulong cpu_entry_area_end;
|
||||
ulong page_offset_force;
|
||||
char **exception_functions;
|
||||
+ ulong sme_mask;
|
||||
};
|
||||
|
||||
#define KSYMS_START (0x1)
|
||||
diff --git a/x86_64.c b/x86_64.c
|
||||
index cfafbcc4dabe..dfada48d8b26 100644
|
||||
--- a/x86_64.c
|
||||
+++ b/x86_64.c
|
||||
@@ -208,6 +208,10 @@ x86_64_init(int when)
|
||||
machdep->machspec->kernel_image_size = dtol(string, QUIET, NULL);
|
||||
free(string);
|
||||
}
|
||||
+ if ((string = pc->read_vmcoreinfo("NUMBER(sme_mask)"))) {
|
||||
+ machdep->machspec->sme_mask = dtol(string, QUIET, NULL);
|
||||
+ free(string);
|
||||
+ }
|
||||
if (SADUMP_DUMPFILE() || QEMU_MEM_DUMP_NO_VMCOREINFO() ||
|
||||
VMSS_DUMPFILE())
|
||||
/* Need for calculation of kaslr_offset and phys_base */
|
||||
@@ -940,6 +944,7 @@ x86_64_dump_machdep_table(ulong arg)
|
||||
ms->kernel_image_size/MEGABYTES(1));
|
||||
else
|
||||
fprintf(fp, "(uninitialized)\n");
|
||||
+ fprintf(fp, " sme_mask: %lx\n", ms->sme_mask);
|
||||
fprintf(fp, " physical_mask_shift: %ld\n", ms->physical_mask_shift);
|
||||
fprintf(fp, " pgdir_shift: %ld\n", ms->pgdir_shift);
|
||||
fprintf(fp, " GART_start: %lx\n", ms->GART_start);
|
||||
@@ -1817,7 +1822,7 @@ x86_64_kpgd_offset(ulong kvaddr, int verbose, int IS_XEN)
|
||||
if (IS_XEN)
|
||||
fprintf(fp, "PAGE DIRECTORY: %lx [machine]\n", *pgd);
|
||||
else
|
||||
- fprintf(fp, "PAGE DIRECTORY: %lx\n", *pgd);
|
||||
+ fprintf(fp, "PAGE DIRECTORY: %lx\n", *pgd & ~machdep->machspec->sme_mask);
|
||||
}
|
||||
|
||||
return pgd;
|
||||
@@ -1854,7 +1859,8 @@ x86_64_upgd_offset_legacy(struct task_context *tc, ulong uvaddr, int verbose, in
|
||||
if (IS_XEN)
|
||||
fprintf(fp, " PGD: %lx => %lx [machine]\n", (ulong)pud, pud_pte);
|
||||
else
|
||||
- fprintf(fp, " PGD: %lx => %lx\n", (ulong)pud, pud_pte);
|
||||
+ fprintf(fp, " PGD: %lx => %lx\n",
|
||||
+ (ulong)pud, pud_pte & ~machdep->machspec->sme_mask);
|
||||
}
|
||||
|
||||
return pud_pte;
|
||||
@@ -1885,7 +1891,8 @@ x86_64_upgd_offset(struct task_context *tc, ulong uvaddr, int verbose, int IS_XE
|
||||
if (IS_XEN)
|
||||
fprintf(fp, " PGD: %lx => %lx [machine]\n", (ulong)pgd, pgd_pte);
|
||||
else
|
||||
- fprintf(fp, " PGD: %lx => %lx\n", (ulong)pgd, pgd_pte);
|
||||
+ fprintf(fp, " PGD: %lx => %lx\n",
|
||||
+ (ulong)pgd, pgd_pte & ~machdep->machspec->sme_mask);
|
||||
}
|
||||
|
||||
return pgd_pte;
|
||||
@@ -1903,9 +1910,11 @@ x86_64_p4d_offset(ulong pgd_pte, ulong vaddr, int verbose, int IS_XEN)
|
||||
ulong p4d_pte;
|
||||
|
||||
p4d_paddr = pgd_pte & PHYSICAL_PAGE_MASK;
|
||||
+ p4d_paddr &= ~machdep->machspec->sme_mask;
|
||||
FILL_P4D(p4d_paddr, PHYSADDR, PAGESIZE());
|
||||
p4d = ((ulong *)p4d_paddr) + p4d_index(vaddr);
|
||||
p4d_pte = ULONG(machdep->machspec->p4d + PAGEOFFSET(p4d));
|
||||
+ p4d_pte &= ~machdep->machspec->sme_mask;
|
||||
if (verbose) {
|
||||
if (IS_XEN)
|
||||
fprintf(fp, " P4D: %lx => %lx [machine]\n", (ulong)p4d, p4d_pte);
|
||||
@@ -1928,6 +1937,7 @@ x86_64_pud_offset(ulong pgd_pte, ulong vaddr, int verbose, int IS_XEN)
|
||||
ulong pud_pte;
|
||||
|
||||
pud_paddr = pgd_pte & PHYSICAL_PAGE_MASK;
|
||||
+ pud_paddr &= ~machdep->machspec->sme_mask;
|
||||
|
||||
if (IS_XEN) {
|
||||
pud_paddr = xen_m2p(pud_paddr);
|
||||
@@ -1938,6 +1948,7 @@ x86_64_pud_offset(ulong pgd_pte, ulong vaddr, int verbose, int IS_XEN)
|
||||
FILL_PUD(pud_paddr, PHYSADDR, PAGESIZE());
|
||||
pud = ((ulong *)pud_paddr) + pud_index(vaddr);
|
||||
pud_pte = ULONG(machdep->pud + PAGEOFFSET(pud));
|
||||
+ pud_pte &= ~machdep->machspec->sme_mask;
|
||||
if (verbose) {
|
||||
if (IS_XEN)
|
||||
fprintf(fp, " PUD: %lx => %lx [machine]\n", (ulong)pud, pud_pte);
|
||||
@@ -1960,6 +1971,7 @@ x86_64_pmd_offset(ulong pud_pte, ulong vaddr, int verbose, int IS_XEN)
|
||||
ulong pmd_pte;
|
||||
|
||||
pmd_paddr = pud_pte & PHYSICAL_PAGE_MASK;
|
||||
+ pmd_paddr &= ~machdep->machspec->sme_mask;
|
||||
|
||||
if (IS_XEN) {
|
||||
pmd_paddr = xen_m2p(pmd_paddr);
|
||||
@@ -1970,6 +1982,7 @@ x86_64_pmd_offset(ulong pud_pte, ulong vaddr, int verbose, int IS_XEN)
|
||||
FILL_PMD(pmd_paddr, PHYSADDR, PAGESIZE());
|
||||
pmd = ((ulong *)pmd_paddr) + pmd_index(vaddr);
|
||||
pmd_pte = ULONG(machdep->pmd + PAGEOFFSET(pmd));
|
||||
+ pmd_pte &= ~machdep->machspec->sme_mask;
|
||||
if (verbose) {
|
||||
if (IS_XEN)
|
||||
fprintf(fp, " PMD: %lx => %lx [machine]\n", (ulong)pmd, pmd_pte);
|
||||
@@ -1991,6 +2004,7 @@ x86_64_pte_offset(ulong pmd_pte, ulong vaddr, int verbose, int IS_XEN)
|
||||
ulong pte;
|
||||
|
||||
pte_paddr = pmd_pte & PHYSICAL_PAGE_MASK;
|
||||
+ pte_paddr &= ~machdep->machspec->sme_mask;
|
||||
|
||||
if (IS_XEN) {
|
||||
pte_paddr = xen_m2p(pte_paddr);
|
||||
@@ -2001,6 +2015,7 @@ x86_64_pte_offset(ulong pmd_pte, ulong vaddr, int verbose, int IS_XEN)
|
||||
FILL_PTBL(pte_paddr, PHYSADDR, PAGESIZE());
|
||||
ptep = ((ulong *)pte_paddr) + pte_index(vaddr);
|
||||
pte = ULONG(machdep->ptbl + PAGEOFFSET(ptep));
|
||||
+ pte &= ~machdep->machspec->sme_mask;
|
||||
if (verbose) {
|
||||
if (IS_XEN)
|
||||
fprintf(fp, " PTE: %lx => %lx [machine]\n", (ulong)ptep, pte);
|
||||
--
|
||||
2.37.1
|
||||
|
@ -1,34 +0,0 @@
|
||||
From c2743ad474529951ace2b8ec712bf373f3a07d4c Mon Sep 17 00:00:00 2001
|
||||
From: Kazuhito Hagio <k-hagio-ab@nec.com>
|
||||
Date: Mon, 22 Aug 2022 11:59:46 +0900
|
||||
Subject: [PATCH 17/29] Makefile: Fix unnecessary re-patching with
|
||||
coreutils-9.0
|
||||
|
||||
"sum" command in coreutils-9.0 (e.g. Fedora 36) started to output a file
|
||||
name. As a result, "make" always detects a change of gdb-10.2.patch
|
||||
wrongly and re-applies it unnecessarily.
|
||||
|
||||
Use standard input to fix it and "md5sum" to improve detection.
|
||||
|
||||
Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
|
||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
|
||||
---
|
||||
Makefile | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/Makefile b/Makefile
|
||||
index 162c2baa5164..79aef1769444 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -272,7 +272,7 @@ rebuild:
|
||||
@if [ ! -f ${GDB}/${GDB}.patch ]; then \
|
||||
touch ${GDB}/${GDB}.patch; fi
|
||||
@if [ -f ${GDB}.patch ] && [ -s ${GDB}.patch ] && \
|
||||
- [ "`sum ${GDB}.patch`" != "`sum ${GDB}/${GDB}.patch`" ]; then \
|
||||
+ [ "`md5sum < ${GDB}.patch`" != "`md5sum < ${GDB}/${GDB}.patch`" ]; then \
|
||||
(sh -x ${GDB}.patch ${TARGET}; patch -N -p0 -r- --fuzz=0 < ${GDB}.patch; cp ${GDB}.patch ${GDB}; cd ${GDB}; \
|
||||
$(MAKE) CRASH_TARGET=${TARGET}) \
|
||||
else (cd ${GDB}/gdb; $(MAKE) CRASH_TARGET=${TARGET}); fi
|
||||
--
|
||||
2.37.1
|
||||
|
@ -1,52 +0,0 @@
|
||||
From 4c85e982d25a259f81b5e8c230a67d40d4527ddf Mon Sep 17 00:00:00 2001
|
||||
From: Lianbo Jiang <lijiang@redhat.com>
|
||||
Date: Wed, 24 Aug 2022 10:19:20 +0800
|
||||
Subject: [PATCH 18/29] gdb: fix for assigning NULL to std::string
|
||||
|
||||
When trying to load a module with "mod -s" without its separated debug
|
||||
info file installed, the crash utility will abort as below:
|
||||
|
||||
crash> mod -s kpatch_test kpatch_test.ko
|
||||
...
|
||||
terminate called after throwing an instance of 'std::logic_error'
|
||||
what(): basic_string::_M_construct null not valid
|
||||
Aborted (core dumped)
|
||||
|
||||
Let's return the std::string() instead of std::string(NULL) when a
|
||||
string is null, because the check_specified_kernel_debug_file() may
|
||||
return NULL.
|
||||
|
||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
|
||||
---
|
||||
gdb-10.2.patch | 11 +++++++++++
|
||||
1 file changed, 11 insertions(+)
|
||||
|
||||
diff --git a/gdb-10.2.patch b/gdb-10.2.patch
|
||||
index 577f5e45fc5a..f0034ed626a0 100644
|
||||
--- a/gdb-10.2.patch
|
||||
+++ b/gdb-10.2.patch
|
||||
@@ -9,6 +9,7 @@
|
||||
# to all subsequent patch applications.
|
||||
|
||||
tar xvzmf gdb-10.2.tar.gz \
|
||||
+ gdb-10.2/gdb/symfile.c \
|
||||
gdb-10.2/gdb/Makefile.in
|
||||
|
||||
exit 0
|
||||
@@ -1650,3 +1651,13 @@ exit 0
|
||||
|
||||
c_print_type_1 (type->field (i).type (),
|
||||
TYPE_FIELD_NAME (type, i),
|
||||
+--- gdb-10.2/gdb/symfile.c.orig
|
||||
++++ gdb-10.2/gdb/symfile.c
|
||||
+@@ -1610,7 +1610,7 @@ find_separate_debug_file_by_debuglink (struct objfile *objfile)
|
||||
+ if (debugfile.empty ()) {
|
||||
+ char *name_copy;
|
||||
+ name_copy = check_specified_kernel_debug_file();
|
||||
+- return std::string (name_copy);
|
||||
++ return name_copy ? std::string (name_copy) : std::string ();
|
||||
+ }
|
||||
+ #endif
|
||||
--
|
||||
2.37.1
|
||||
|
@ -1,111 +0,0 @@
|
||||
From f02c8e87fccb1a92fbc025883bc69b6467a4e6c8 Mon Sep 17 00:00:00 2001
|
||||
From: Huang Shijie <shijie@os.amperecomputing.com>
|
||||
Date: Mon, 22 Aug 2022 09:29:32 +0000
|
||||
Subject: [PATCH 19/29] arm64: use TCR_EL1_T1SZ to get the correct info if
|
||||
vabits_actual is missing
|
||||
|
||||
After kernel commit 0d9b1ffefabe ("arm64: mm: make vabits_actual a build
|
||||
time constant if possible"), the vabits_actual is not compiled to kernel
|
||||
symbols when "VA_BITS > 48" is false.
|
||||
|
||||
So the crash will not find the vabits_actual symbol, and it will fail
|
||||
in the end like this:
|
||||
|
||||
# ./crash
|
||||
...
|
||||
WARNING: VA_BITS: calculated: 46 vmcoreinfo: 48
|
||||
crash: invalid kernel virtual address: ffff88177ffff000 type: "pud page"
|
||||
|
||||
This patch introduces the arm64_set_va_bits_by_tcr(), and if crash cannot
|
||||
find vabits_actual symbol, it will use the TCR_EL1_T1SZ register to get
|
||||
the correct VA_BITS_ACTUAL/VA_BITS/VA_START.
|
||||
|
||||
Tested this patch with:
|
||||
1.) the live mode with /proc/kcore
|
||||
2.) the kdump file with /proc/vmcore.
|
||||
|
||||
Signed-off-by: Huang Shijie <shijie@os.amperecomputing.com>
|
||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
|
||||
---
|
||||
arm64.c | 51 ++++++++++++++++++++++++++++++++++-----------------
|
||||
1 file changed, 34 insertions(+), 17 deletions(-)
|
||||
|
||||
diff --git a/arm64.c b/arm64.c
|
||||
index b6b7aa11f4fe..c3e26a371a61 100644
|
||||
--- a/arm64.c
|
||||
+++ b/arm64.c
|
||||
@@ -4586,6 +4586,36 @@ arm64_IS_VMALLOC_ADDR(ulong vaddr)
|
||||
(vaddr >= ms->modules_vaddr && vaddr <= ms->modules_end));
|
||||
}
|
||||
|
||||
+/* Return TRUE if we succeed, return FALSE on failure. */
|
||||
+static int
|
||||
+arm64_set_va_bits_by_tcr(void)
|
||||
+{
|
||||
+ ulong value;
|
||||
+ char *string;
|
||||
+
|
||||
+ if ((string = pc->read_vmcoreinfo("NUMBER(TCR_EL1_T1SZ)")) ||
|
||||
+ (string = pc->read_vmcoreinfo("NUMBER(tcr_el1_t1sz)"))) {
|
||||
+ /* See ARMv8 ARM for the description of
|
||||
+ * TCR_EL1.T1SZ and how it can be used
|
||||
+ * to calculate the vabits_actual
|
||||
+ * supported by underlying kernel.
|
||||
+ *
|
||||
+ * Basically:
|
||||
+ * vabits_actual = 64 - T1SZ;
|
||||
+ */
|
||||
+ value = 64 - strtoll(string, NULL, 0);
|
||||
+ if (CRASHDEBUG(1))
|
||||
+ fprintf(fp, "vmcoreinfo : vabits_actual: %ld\n", value);
|
||||
+ free(string);
|
||||
+ machdep->machspec->VA_BITS_ACTUAL = value;
|
||||
+ machdep->machspec->VA_BITS = value;
|
||||
+ machdep->machspec->VA_START = _VA_START(machdep->machspec->VA_BITS_ACTUAL);
|
||||
+ return TRUE;
|
||||
+ }
|
||||
+
|
||||
+ return FALSE;
|
||||
+}
|
||||
+
|
||||
static void
|
||||
arm64_calc_VA_BITS(void)
|
||||
{
|
||||
@@ -4616,23 +4646,8 @@ arm64_calc_VA_BITS(void)
|
||||
} else if (ACTIVE())
|
||||
error(FATAL, "cannot determine VA_BITS_ACTUAL: please use /proc/kcore\n");
|
||||
else {
|
||||
- if ((string = pc->read_vmcoreinfo("NUMBER(TCR_EL1_T1SZ)")) ||
|
||||
- (string = pc->read_vmcoreinfo("NUMBER(tcr_el1_t1sz)"))) {
|
||||
- /* See ARMv8 ARM for the description of
|
||||
- * TCR_EL1.T1SZ and how it can be used
|
||||
- * to calculate the vabits_actual
|
||||
- * supported by underlying kernel.
|
||||
- *
|
||||
- * Basically:
|
||||
- * vabits_actual = 64 - T1SZ;
|
||||
- */
|
||||
- value = 64 - strtoll(string, NULL, 0);
|
||||
- if (CRASHDEBUG(1))
|
||||
- fprintf(fp, "vmcoreinfo : vabits_actual: %ld\n", value);
|
||||
- free(string);
|
||||
- machdep->machspec->VA_BITS_ACTUAL = value;
|
||||
- machdep->machspec->VA_BITS = value;
|
||||
- machdep->machspec->VA_START = _VA_START(machdep->machspec->VA_BITS_ACTUAL);
|
||||
+ if (arm64_set_va_bits_by_tcr()) {
|
||||
+ /* nothing */
|
||||
} else if (machdep->machspec->VA_BITS_ACTUAL) {
|
||||
machdep->machspec->VA_BITS = machdep->machspec->VA_BITS_ACTUAL;
|
||||
machdep->machspec->VA_START = _VA_START(machdep->machspec->VA_BITS_ACTUAL);
|
||||
@@ -4654,6 +4669,8 @@ arm64_calc_VA_BITS(void)
|
||||
*/
|
||||
machdep->flags |= FLIPPED_VM;
|
||||
return;
|
||||
+ } else if (arm64_set_va_bits_by_tcr()) {
|
||||
+ return;
|
||||
}
|
||||
|
||||
if (!(sp = symbol_search("swapper_pg_dir")) &&
|
||||
--
|
||||
2.37.1
|
||||
|
@ -1,66 +0,0 @@
|
||||
From 9cbfea67eb4f094d47cd841b73ddbbdbe6b58696 Mon Sep 17 00:00:00 2001
|
||||
From: Tao Liu <ltao@redhat.com>
|
||||
Date: Thu, 25 Aug 2022 14:39:44 +0800
|
||||
Subject: [PATCH 20/29] Fix "task -R" by adding end identifier for union in
|
||||
task_struct
|
||||
|
||||
Previously, the start and end identifiers for union are " {\n" and
|
||||
" }, \n". However the end identifier is not always as expected.
|
||||
" },\n" can also be the end identifier with gdb-10.2. As a result,
|
||||
variable "randomized" is in incorrect state after union, and fails to
|
||||
identify the later struct members. For example, we can reproduce the
|
||||
issue as follows:
|
||||
|
||||
crash> task
|
||||
PID: 847 TASK: ffff94f8038f4000 CPU: 72 COMMAND: "khungtaskd"
|
||||
struct task_struct {
|
||||
thread_info = {
|
||||
flags = 2148024320,
|
||||
status = 0,
|
||||
preempt_lazy_count = 0
|
||||
},
|
||||
{
|
||||
<the union>
|
||||
},
|
||||
...
|
||||
wake_entry = {
|
||||
next = 0x0
|
||||
},
|
||||
...
|
||||
|
||||
Before patch:
|
||||
|
||||
crash> task -R wake_entry
|
||||
PID: 847 TASK: ffff94f8038f4000 CPU: 72 COMMAND: "khungtaskd"
|
||||
|
||||
After patch:
|
||||
|
||||
crash> task -R wake_entry
|
||||
PID: 847 TASK: ffff94f8038f4000 CPU: 72 COMMAND: "khungtaskd"
|
||||
wake_entry = {
|
||||
next = 0x0
|
||||
},
|
||||
|
||||
Signed-off-by: Tao Liu <ltao@redhat.com>
|
||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
|
||||
---
|
||||
task.c | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/task.c b/task.c
|
||||
index 071c787fbfa5..db2abc8106a2 100644
|
||||
--- a/task.c
|
||||
+++ b/task.c
|
||||
@@ -3436,7 +3436,8 @@ parse_task_thread(int argcnt, char *arglist[], struct task_context *tc) {
|
||||
while (fgets(buf, BUFSIZE, pc->tmpfile)) {
|
||||
if (STREQ(buf, " {\n"))
|
||||
randomized = TRUE;
|
||||
- else if (randomized && STREQ(buf, " }, \n"))
|
||||
+ else if (randomized &&
|
||||
+ (STREQ(buf, " }, \n") || STREQ(buf, " },\n")))
|
||||
randomized = FALSE;
|
||||
|
||||
if (strlen(lookfor2)) {
|
||||
--
|
||||
2.37.1
|
||||
|
@ -1,142 +0,0 @@
|
||||
From 2145b2bb79c59aa25c5155a8f9851554d1813fb9 Mon Sep 17 00:00:00 2001
|
||||
From: Tao Liu <ltao@redhat.com>
|
||||
Date: Wed, 31 Aug 2022 11:54:13 +0800
|
||||
Subject: [PATCH 21/29] Let gdb get kernel module symbols info from crash
|
||||
|
||||
Gdb will try to resolve an address to its corresponding symbol name such as
|
||||
when printing a structure. It works fine for kernel symbols, because gdb can
|
||||
find them through vmlinux. However as for kernel modules symbols, crash
|
||||
resolves them by dig into "struct module", which gdb don't know. As a result,
|
||||
gdb fails to translate a kernel module address to its symbol name without
|
||||
"mod -s|-S" options. For example we can reproduce the issue as follows.
|
||||
|
||||
crash> timer
|
||||
....
|
||||
4331308176 336 ffff94ea24240860 ffffffffc03762c0 <estimation_timer>
|
||||
....
|
||||
crash> sym 0xffffffffc03762c0
|
||||
ffffffffc03762c0 (t) estimation_timer [ip_vs]
|
||||
|
||||
Before patch:
|
||||
crash> timer_list ffff94ea24240860
|
||||
struct timer_list {
|
||||
....
|
||||
function = 0xffffffffc03762c0,
|
||||
....
|
||||
}
|
||||
|
||||
After patch:
|
||||
crash> timer_list ffff94ea24240860
|
||||
struct timer_list {
|
||||
....
|
||||
function = 0xffffffffc03762c0 <estimation_timer>,
|
||||
....
|
||||
}
|
||||
|
||||
In this patch, we add an interface for gdb, when gdb trying to build kernel
|
||||
module's address symbolic, the info can be get from crash.
|
||||
|
||||
Signed-off-by: Tao Liu <ltao@redhat.com>
|
||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
|
||||
---
|
||||
defs.h | 2 ++
|
||||
gdb-10.2.patch | 35 +++++++++++++++++++++++++++++++++++
|
||||
gdb_interface.c | 12 ++++++++++++
|
||||
3 files changed, 49 insertions(+)
|
||||
|
||||
diff --git a/defs.h b/defs.h
|
||||
index 9d6d8916284b..afdcf6c4ac20 100644
|
||||
--- a/defs.h
|
||||
+++ b/defs.h
|
||||
@@ -4874,6 +4874,7 @@ extern "C" int patch_kernel_symbol(struct gnu_request *);
|
||||
struct syment *symbol_search(char *);
|
||||
int gdb_line_number_callback(ulong, ulong, ulong);
|
||||
int gdb_print_callback(ulong);
|
||||
+char *gdb_lookup_module_symbol(ulong, ulong *);
|
||||
extern "C" int same_file(char *, char *);
|
||||
#endif
|
||||
|
||||
@@ -7284,6 +7285,7 @@ int gdb_pass_through(char *, FILE *, ulong);
|
||||
int gdb_readmem_callback(ulong, void *, int, int);
|
||||
int gdb_line_number_callback(ulong, ulong, ulong);
|
||||
int gdb_print_callback(ulong);
|
||||
+char *gdb_lookup_module_symbol(ulong, ulong *);
|
||||
void gdb_error_hook(void);
|
||||
void restore_gdb_sanity(void);
|
||||
int is_gdb_command(int, ulong);
|
||||
diff --git a/gdb-10.2.patch b/gdb-10.2.patch
|
||||
index f0034ed626a0..642cd6a78a1d 100644
|
||||
--- a/gdb-10.2.patch
|
||||
+++ b/gdb-10.2.patch
|
||||
@@ -9,6 +9,7 @@
|
||||
# to all subsequent patch applications.
|
||||
|
||||
tar xvzmf gdb-10.2.tar.gz \
|
||||
+ gdb-10.2/gdb/printcmd.c \
|
||||
gdb-10.2/gdb/symfile.c \
|
||||
gdb-10.2/gdb/Makefile.in
|
||||
|
||||
@@ -1661,3 +1662,37 @@ exit 0
|
||||
+ return name_copy ? std::string (name_copy) : std::string ();
|
||||
}
|
||||
#endif
|
||||
+
|
||||
+--- gdb-10.2/gdb/printcmd.c.orig
|
||||
++++ gdb-10.2/gdb/printcmd.c
|
||||
+@@ -576,6 +576,10 @@ print_address_symbolic (struct gdbarch *gdbarch, CORE_ADDR addr,
|
||||
+
|
||||
+ /* See valprint.h. */
|
||||
+
|
||||
++#ifdef CRASH_MERGE
|
||||
++extern "C" char *gdb_lookup_module_symbol(unsigned long, unsigned long *);
|
||||
++#endif
|
||||
++
|
||||
+ int
|
||||
+ build_address_symbolic (struct gdbarch *gdbarch,
|
||||
+ CORE_ADDR addr, /* IN */
|
||||
+@@ -682,7 +686,19 @@ build_address_symbolic (struct gdbarch *gdbarch,
|
||||
+ }
|
||||
+ }
|
||||
+ if (symbol == NULL && msymbol.minsym == NULL)
|
||||
++#ifdef CRASH_MERGE
|
||||
++ {
|
||||
++ char *name_ptr = gdb_lookup_module_symbol(addr, (unsigned long *)offset);
|
||||
++ if (name_ptr) {
|
||||
++ *name = name_ptr;
|
||||
++ return 0;
|
||||
++ } else {
|
||||
++ return 1;
|
||||
++ }
|
||||
++ }
|
||||
++#else
|
||||
+ return 1;
|
||||
++#endif
|
||||
+
|
||||
+ /* If the nearest symbol is too far away, don't print anything symbolic. */
|
||||
+
|
||||
diff --git a/gdb_interface.c b/gdb_interface.c
|
||||
index 3a7fcc9e3ade..b14319c66147 100644
|
||||
--- a/gdb_interface.c
|
||||
+++ b/gdb_interface.c
|
||||
@@ -935,6 +935,18 @@ gdb_print_callback(ulong addr)
|
||||
return IS_KVADDR(addr);
|
||||
}
|
||||
|
||||
+char *
|
||||
+gdb_lookup_module_symbol(ulong addr, ulong *offset)
|
||||
+{
|
||||
+ struct syment *sp;
|
||||
+
|
||||
+ if ((sp = value_search_module(addr, offset))) {
|
||||
+ return sp->name;
|
||||
+ } else {
|
||||
+ return NULL;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
/*
|
||||
* Used by gdb_interface() to catch gdb-related errors, if desired.
|
||||
*/
|
||||
--
|
||||
2.37.1
|
||||
|
@ -1,65 +0,0 @@
|
||||
From 3ed9ec5c8d09cffac9772abbf54214125ade9127 Mon Sep 17 00:00:00 2001
|
||||
From: Tao Liu <ltao@redhat.com>
|
||||
Date: Wed, 31 Aug 2022 11:54:15 +0800
|
||||
Subject: [PATCH 22/29] x86_64: Correct the identifier when locating the call
|
||||
instruction
|
||||
|
||||
The previous implementation to locate the call instruction is
|
||||
to strstr "call", then check whether the previous char is ' '
|
||||
or '\t'. The implementation is problematic. For example it
|
||||
cannot resolve the following disassembly string:
|
||||
|
||||
"0xffffffffc0995378 <nfs41_callback_svc+344>:\tcall 0xffffffff8ecfa4c0 <schedule>\n"
|
||||
|
||||
strstr will locate the "_call" and char check fails,
|
||||
as a result, extract_hex fails to get the calling address.
|
||||
|
||||
NOTE: the issue is more likely to be reproduced when patch[1] applied.
|
||||
Because without patch[1], the disassembly string will be as follows,
|
||||
so the issue is no longer reproducible.
|
||||
|
||||
"0xffffffffc0995378:\tcall 0xffffffff8ecfa4c0 <schedule>\n"
|
||||
|
||||
Before the patch:
|
||||
crash> bt 1472
|
||||
PID: 1472 TASK: ffff8c121fa72f70 CPU: 18 COMMAND: "nfsv4.1-svc"
|
||||
#0 [ffff8c16231a3db8] __schedule at ffffffff8ecf9ef3
|
||||
#1 [ffff8c16231a3e40] schedule at ffffffff8ecfa4e9
|
||||
|
||||
After the patch:
|
||||
crash> bt 1472
|
||||
PID: 1472 TASK: ffff8c121fa72f70 CPU: 18 COMMAND: "nfsv4.1-svc"
|
||||
#0 [ffff8c16231a3db8] __schedule at ffffffff8ecf9ef3
|
||||
#1 [ffff8c16231a3e40] schedule at ffffffff8ecfa4e9
|
||||
#2 [ffff8c16231a3e50] nfs41_callback_svc at ffffffffc099537d [nfsv4]
|
||||
#3 [ffff8c16231a3ec8] kthread at ffffffff8e6b966f
|
||||
#4 [ffff8c16231a3f50] ret_from_fork at ffffffff8ed07898
|
||||
|
||||
This patch fix the issue by strstr "\tcall" and " call", to
|
||||
locate the correct call instruction.
|
||||
|
||||
[1]: https://listman.redhat.com/archives/crash-utility/2022-August/010085.html
|
||||
|
||||
Signed-off-by: Tao Liu <ltao@redhat.com>
|
||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
|
||||
---
|
||||
x86_64.c | 3 +--
|
||||
1 file changed, 1 insertion(+), 2 deletions(-)
|
||||
|
||||
diff --git a/x86_64.c b/x86_64.c
|
||||
index dfada48d8b26..74bd1bbde41c 100644
|
||||
--- a/x86_64.c
|
||||
+++ b/x86_64.c
|
||||
@@ -4432,8 +4432,7 @@ x86_64_function_called_by(ulong rip)
|
||||
if (gdb_pass_through(buf, pc->tmpfile2, GNU_RETURN_ON_ERROR)) {
|
||||
rewind(pc->tmpfile2);
|
||||
while (fgets(buf, BUFSIZE, pc->tmpfile2)) {
|
||||
- if ((p1 = strstr(buf, "call")) &&
|
||||
- whitespace(*(p1-1))) {
|
||||
+ if ((p1 = strstr(buf, " call")) || (p1 = strstr(buf, "\tcall"))) {
|
||||
if (extract_hex(p1, &value, NULLCHAR, TRUE))
|
||||
break;
|
||||
}
|
||||
--
|
||||
2.37.1
|
||||
|
@ -1,40 +0,0 @@
|
||||
From 5b9d3e98cda9d99f3277aabec30d076e62cc5e71 Mon Sep 17 00:00:00 2001
|
||||
From: "Chunguang.Xu" <chunguang.xu@shopee.com>
|
||||
Date: Thu, 25 Aug 2022 12:07:20 +0800
|
||||
Subject: [PATCH 23/29] Add debian/ubuntu vmlinux location to default search
|
||||
dirs
|
||||
|
||||
Now crash cannot find debian/ubuntu kernel vmlinux, we need to
|
||||
explicitly specify the path to vmlinux. Try to add the debian
|
||||
vmlinux location to default search directories.
|
||||
|
||||
Signed-off-by: Chunguang Xu <chunguang.xu@shopee.com>
|
||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
|
||||
---
|
||||
filesys.c | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/filesys.c b/filesys.c
|
||||
index a863f04eb250..c2ea78de821d 100644
|
||||
--- a/filesys.c
|
||||
+++ b/filesys.c
|
||||
@@ -319,7 +319,7 @@ match_proc_version(void)
|
||||
|
||||
#define CREATE 1
|
||||
#define DESTROY 0
|
||||
-#define DEFAULT_SEARCHDIRS 5
|
||||
+#define DEFAULT_SEARCHDIRS 6
|
||||
#define EXTRA_SEARCHDIRS 5
|
||||
|
||||
static char **
|
||||
@@ -336,6 +336,7 @@ build_searchdirs(int create, int *preferred)
|
||||
"/boot/",
|
||||
"/boot/efi/redhat",
|
||||
"/boot/efi/EFI/redhat",
|
||||
+ "/usr/lib/debug/boot/",
|
||||
"/",
|
||||
NULL
|
||||
};
|
||||
--
|
||||
2.37.1
|
||||
|
@ -1,102 +0,0 @@
|
||||
From 51acac75cdb20caab30a85ebfec5906efe034477 Mon Sep 17 00:00:00 2001
|
||||
From: Kazuhito Hagio <k-hagio-ab@nec.com>
|
||||
Date: Thu, 1 Sep 2022 14:03:09 +0900
|
||||
Subject: [PATCH 24/29] Fix gcc-12 compiler warnings on lkcd_*.c
|
||||
|
||||
Without the patch, the following gcc-12 compiler warnings are emitted
|
||||
for lkcd_*.c:
|
||||
|
||||
lkcd_v1.c: In function 'dump_lkcd_environment_v1':
|
||||
lkcd_v1.c:252:20: warning: the comparison will always evaluate as 'true' for the address of 'dh_panic_string' will never be NULL [-Waddress]
|
||||
252 | dh && dh->dh_panic_string &&
|
||||
| ^~
|
||||
In file included from lkcd_v1.c:21:
|
||||
lkcd_vmdump_v1.h:108:30: note: 'dh_panic_string' declared here
|
||||
108 | char dh_panic_string[DUMP_PANIC_LEN];
|
||||
| ^~~~~~~~~~~~~~~
|
||||
...
|
||||
|
||||
Reported-by: Lianbo Jiang <lijiang@redhat.com>
|
||||
Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
|
||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
|
||||
---
|
||||
lkcd_v1.c | 3 +--
|
||||
lkcd_v2_v3.c | 3 +--
|
||||
lkcd_v5.c | 3 +--
|
||||
lkcd_v7.c | 3 +--
|
||||
lkcd_v8.c | 3 +--
|
||||
5 files changed, 5 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/lkcd_v1.c b/lkcd_v1.c
|
||||
index 5f891aeb1ce3..31bdc04c5fdd 100644
|
||||
--- a/lkcd_v1.c
|
||||
+++ b/lkcd_v1.c
|
||||
@@ -249,8 +249,7 @@ dump_header_only:
|
||||
lkcd_print(" dh_eip: %lx\n", dh->dh_eip);
|
||||
lkcd_print(" dh_num_pages: %d\n", dh->dh_num_pages);
|
||||
lkcd_print(" dh_panic_string: %s%s", dh->dh_panic_string,
|
||||
- dh && dh->dh_panic_string &&
|
||||
- strstr(dh->dh_panic_string, "\n") ? "" : "\n");
|
||||
+ dh && strstr(dh->dh_panic_string, "\n") ? "" : "\n");
|
||||
lkcd_print(" dh_time: %s\n",
|
||||
strip_linefeeds(ctime(&(dh->dh_time.tv_sec))));
|
||||
|
||||
diff --git a/lkcd_v2_v3.c b/lkcd_v2_v3.c
|
||||
index 8635a7b07c77..edcb6637a55e 100644
|
||||
--- a/lkcd_v2_v3.c
|
||||
+++ b/lkcd_v2_v3.c
|
||||
@@ -307,8 +307,7 @@ dump_header_only:
|
||||
lkcd_print(" dh_num_pages: ");
|
||||
lkcd_print(BITS32() ? "%ld\n" : "%d\n", dh->dh_num_pages);
|
||||
lkcd_print(" dh_panic_string: %s%s", dh->dh_panic_string,
|
||||
- dh && dh->dh_panic_string &&
|
||||
- strstr(dh->dh_panic_string, "\n") ? "" : "\n");
|
||||
+ dh && strstr(dh->dh_panic_string, "\n") ? "" : "\n");
|
||||
lkcd_print(" dh_time: %s\n",
|
||||
strip_linefeeds(ctime(&(dh->dh_time.tv_sec))));
|
||||
|
||||
diff --git a/lkcd_v5.c b/lkcd_v5.c
|
||||
index cb7634d094ec..e3bfa6f4b272 100644
|
||||
--- a/lkcd_v5.c
|
||||
+++ b/lkcd_v5.c
|
||||
@@ -270,8 +270,7 @@ dump_header_only:
|
||||
lkcd_print(" dh_num_pages: ");
|
||||
lkcd_print(BITS32() ? "%ld\n" : "%d\n", dh->dh_num_pages);
|
||||
lkcd_print(" dh_panic_string: %s%s", dh->dh_panic_string,
|
||||
- dh && dh->dh_panic_string &&
|
||||
- strstr(dh->dh_panic_string, "\n") ? "" : "\n");
|
||||
+ dh && strstr(dh->dh_panic_string, "\n") ? "" : "\n");
|
||||
lkcd_print(" dh_time: %s\n",
|
||||
strip_linefeeds(ctime(&(dh->dh_time.tv_sec))));
|
||||
|
||||
diff --git a/lkcd_v7.c b/lkcd_v7.c
|
||||
index 608e1481f01d..97d99008635a 100644
|
||||
--- a/lkcd_v7.c
|
||||
+++ b/lkcd_v7.c
|
||||
@@ -347,8 +347,7 @@ dump_header_only:
|
||||
lkcd_print(" dh_num_pages: ");
|
||||
lkcd_print(BITS32() ? "%ld\n" : "%d\n", dh->dh_num_pages);
|
||||
lkcd_print(" dh_panic_string: %s%s", dh->dh_panic_string,
|
||||
- dh && dh->dh_panic_string &&
|
||||
- strstr(dh->dh_panic_string, "\n") ? "" : "\n");
|
||||
+ dh && strstr(dh->dh_panic_string, "\n") ? "" : "\n");
|
||||
lkcd_print(" dh_time: %s\n",
|
||||
strip_linefeeds(ctime(&(dh->dh_time.tv_sec))));
|
||||
|
||||
diff --git a/lkcd_v8.c b/lkcd_v8.c
|
||||
index 3b355e056123..4167fa5e4292 100644
|
||||
--- a/lkcd_v8.c
|
||||
+++ b/lkcd_v8.c
|
||||
@@ -543,8 +543,7 @@ dump_header_only:
|
||||
lkcd_print(" dh_num_pages: ");
|
||||
lkcd_print(BITS32() ? "%ld\n" : "%d\n", dh->dh_num_pages);
|
||||
lkcd_print(" dh_panic_string: %s%s", dh->dh_panic_string,
|
||||
- dh && dh->dh_panic_string &&
|
||||
- strstr(dh->dh_panic_string, "\n") ? "" : "\n");
|
||||
+ dh && strstr(dh->dh_panic_string, "\n") ? "" : "\n");
|
||||
tv.tv_sec = dh->dh_time.tv_sec;
|
||||
lkcd_print(" dh_time: %s\n",
|
||||
strip_linefeeds(ctime(&(tv.tv_sec))));
|
||||
--
|
||||
2.37.1
|
||||
|
@ -1,86 +0,0 @@
|
||||
From bdbf5887d6259ea3108d4fa674f3794adad54d52 Mon Sep 17 00:00:00 2001
|
||||
From: Kazuhito Hagio <k-hagio-ab@nec.com>
|
||||
Date: Thu, 1 Sep 2022 13:42:28 +0900
|
||||
Subject: [PATCH 25/29] Fix gcc-11 compiler warnings on gdb-10.2/gdb/symtab.c
|
||||
|
||||
Without the patch, the following gcc-11 compiler warnings are emitted
|
||||
for gdb-10.2/gdb/symtab.c:
|
||||
|
||||
symtab.c: In function 'void gdb_get_datatype(gnu_request*)':
|
||||
symtab.c:7131:31: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
|
||||
7131 | register struct type *type;
|
||||
| ^~~~
|
||||
symtab.c:7132:31: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
|
||||
7132 | register struct type *typedef_type;
|
||||
| ^~~~~~~~~~~~
|
||||
...
|
||||
|
||||
Usually we don't fix compiler warnings for gdb, but these are emitted
|
||||
even by "make clean ; make warn", which doesn't recompile the whole
|
||||
gdb, so it would be better to fix.
|
||||
|
||||
Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
|
||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
|
||||
---
|
||||
gdb-10.2.patch | 41 +++++++++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 41 insertions(+)
|
||||
|
||||
diff --git a/gdb-10.2.patch b/gdb-10.2.patch
|
||||
index 642cd6a78a1d..91edfb338445 100644
|
||||
--- a/gdb-10.2.patch
|
||||
+++ b/gdb-10.2.patch
|
||||
@@ -9,6 +9,7 @@
|
||||
# to all subsequent patch applications.
|
||||
|
||||
tar xvzmf gdb-10.2.tar.gz \
|
||||
+ gdb-10.2/gdb/symtab.c \
|
||||
gdb-10.2/gdb/printcmd.c \
|
||||
gdb-10.2/gdb/symfile.c \
|
||||
gdb-10.2/gdb/Makefile.in
|
||||
@@ -1696,3 +1697,43 @@ exit 0
|
||||
|
||||
/* If the nearest symbol is too far away, don't print anything symbolic. */
|
||||
|
||||
+--- gdb-10.2/gdb/symtab.c.orig
|
||||
++++ gdb-10.2/gdb/symtab.c
|
||||
+@@ -7128,8 +7128,8 @@ gdb_get_line_number(struct gnu_request *
|
||||
+ static void
|
||||
+ gdb_get_datatype(struct gnu_request *req)
|
||||
+ {
|
||||
+- register struct type *type;
|
||||
+- register struct type *typedef_type;
|
||||
++ struct type *type;
|
||||
++ struct type *typedef_type;
|
||||
+ expression_up expr;
|
||||
+ struct symbol *sym;
|
||||
+ struct value *val;
|
||||
+@@ -7235,7 +7235,7 @@ gdb_get_datatype(struct gnu_request *req
|
||||
+ static void
|
||||
+ dump_enum(struct type *type, struct gnu_request *req)
|
||||
+ {
|
||||
+- register int i;
|
||||
++ int i;
|
||||
+ int len;
|
||||
+ long long lastval;
|
||||
+
|
||||
+@@ -7271,7 +7271,7 @@ dump_enum(struct type *type, struct gnu_
|
||||
+ static void
|
||||
+ eval_enum(struct type *type, struct gnu_request *req)
|
||||
+ {
|
||||
+- register int i;
|
||||
++ int i;
|
||||
+ int len;
|
||||
+ long long lastval;
|
||||
+
|
||||
+@@ -7298,7 +7298,7 @@ eval_enum(struct type *type, struct gnu_
|
||||
+ static void
|
||||
+ get_member_data(struct gnu_request *req, struct type *type, long offset, int is_first)
|
||||
+ {
|
||||
+- register short i;
|
||||
++ short i;
|
||||
+ struct field *nextfield;
|
||||
+ short nfields;
|
||||
+ struct type *typedef_type, *target_type;
|
||||
--
|
||||
2.37.1
|
||||
|
@ -1,42 +0,0 @@
|
||||
From 4ea3a806d11f000f2eb1ddc72c2b7a543e319f64 Mon Sep 17 00:00:00 2001
|
||||
From: Lianbo Jiang <lijiang@redhat.com>
|
||||
Date: Fri, 16 Sep 2022 14:00:01 +0800
|
||||
Subject: [PATCH 26/29] Fix for the invalid linux_banner pointer issue
|
||||
|
||||
Currently, crash may fail with the following error:
|
||||
|
||||
# ./crash -s vmlinux vmcore
|
||||
WARNING: invalid linux_banner pointer: 65762078756e694c
|
||||
crash: vmlinux and vmcore do not match!
|
||||
|
||||
The reason is that the type of the symbol in the data segment may be
|
||||
defined as 'D' or 'd'. The crash only handled the type 'D', but it
|
||||
didn't deal with the type 'd'. For example:
|
||||
|
||||
# nm vmlinux | grep linux_banner
|
||||
ffffffff827cfa80 d linux_banner
|
||||
|
||||
It has been observed that a vmlinux compiled by clang has this type.
|
||||
Let's add the type 'd' recognition to solve such issue.
|
||||
|
||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
|
||||
---
|
||||
kernel.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/kernel.c b/kernel.c
|
||||
index a521ef30cdb0..aa030e8097ea 100644
|
||||
--- a/kernel.c
|
||||
+++ b/kernel.c
|
||||
@@ -1060,7 +1060,7 @@ verify_version(void)
|
||||
if (!(sp = symbol_search("linux_banner")))
|
||||
error(FATAL, "linux_banner symbol does not exist?\n");
|
||||
else if ((sp->type == 'R') || (sp->type == 'r') ||
|
||||
- (THIS_KERNEL_VERSION >= LINUX(2,6,11) && sp->type == 'D') ||
|
||||
+ (THIS_KERNEL_VERSION >= LINUX(2,6,11) && (sp->type == 'D' || sp->type == 'd')) ||
|
||||
(machine_type("ARM") && sp->type == 'T') ||
|
||||
(machine_type("ARM64")))
|
||||
linux_banner = symbol_value("linux_banner");
|
||||
--
|
||||
2.37.1
|
||||
|
@ -1,57 +0,0 @@
|
||||
From ad1397a73594d65aaad9d0b9a94a1dd75d8c61dd Mon Sep 17 00:00:00 2001
|
||||
From: Tao Liu <ltao@redhat.com>
|
||||
Date: Mon, 19 Sep 2022 17:49:21 +0800
|
||||
Subject: [PATCH 27/29] Fix "kmem" failing to print task context when address
|
||||
is vmalloced stack
|
||||
|
||||
When kernel enabled CONFIG_VMAP_STACK, stack can be allocated to
|
||||
vmalloced area. Currently crash didn't handle the case, as a result,
|
||||
"kmem" will not print the task context as expected. This patch fix the
|
||||
bug by checking if the address is a vmalloced stack first.
|
||||
|
||||
Before:
|
||||
crash> kmem ffffb7efce9bbe28
|
||||
VMAP_AREA VM_STRUCT ADDRESS RANGE SIZE
|
||||
ffff94eb9102c640 ffff94eb9102b140 ffffb7efce9b8000 - ffffb7efce9bd000 20480
|
||||
|
||||
PAGE PHYSICAL MAPPING INDEX CNT FLAGS
|
||||
ffffdd28220dc000 1883700000 0 0 1 50000000000000
|
||||
|
||||
After:
|
||||
crash> kmem ffffb7efce9bbe28
|
||||
PID: 847
|
||||
COMMAND: "khungtaskd"
|
||||
TASK: ffff94f8038f4000 [THREAD_INFO: ffff94f8038f4000]
|
||||
CPU: 72
|
||||
STATE: TASK_RUNNING (PANIC)
|
||||
|
||||
VMAP_AREA VM_STRUCT ADDRESS RANGE SIZE
|
||||
ffff94eb9102c640 ffff94eb9102b140 ffffb7efce9b8000 - ffffb7efce9bd000 20480
|
||||
|
||||
PAGE PHYSICAL MAPPING INDEX CNT FLAGS
|
||||
ffffdd28220dc000 1883700000 0 0 1 50000000000000
|
||||
|
||||
Signed-off-by: Tao Liu <ltao@redhat.com>
|
||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
|
||||
---
|
||||
memory.c | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/memory.c b/memory.c
|
||||
index 7339f0cd0224..9ab578134fa1 100644
|
||||
--- a/memory.c
|
||||
+++ b/memory.c
|
||||
@@ -13477,6 +13477,10 @@ kmem_search(struct meminfo *mi)
|
||||
* Check for a valid mapped address.
|
||||
*/
|
||||
if ((mi->memtype == KVADDR) && IS_VMALLOC_ADDR(mi->spec_addr)) {
|
||||
+ if ((task = stkptr_to_task(vaddr)) && (tc = task_to_context(task))) {
|
||||
+ show_context(tc);
|
||||
+ fprintf(fp, "\n");
|
||||
+ }
|
||||
if (kvtop(NULL, mi->spec_addr, &paddr, 0)) {
|
||||
mi->flags = orig_flags | VMLIST_VERIFY;
|
||||
dump_vmlist(mi);
|
||||
--
|
||||
2.37.1
|
||||
|
@ -1,49 +0,0 @@
|
||||
From 60cb8650a0126abda661c44d198ebde514eca3e2 Mon Sep 17 00:00:00 2001
|
||||
From: Tao Liu <ltao@redhat.com>
|
||||
Date: Mon, 19 Sep 2022 17:49:22 +0800
|
||||
Subject: [PATCH 28/29] Fix page offset issue when converting physical to
|
||||
virtual address
|
||||
|
||||
When trying to convert a physical address to its virtual
|
||||
address in dump_vmap_area() and dump_vmlist(), the vi->retval
|
||||
is added by 2 values: the page aligned address "pcheck"
|
||||
and page offset address "PAGEOFFSET(paddr)".
|
||||
|
||||
However "paddr" is given by "pcheck", is also page aligned,
|
||||
so "PAGEOFFSET(paddr)" is always 0.
|
||||
|
||||
In this patch, we will use PAGEOFFSET(vi->spec_addr) to give the
|
||||
page offset, vi->spec_addr is the physical address we'd like
|
||||
to convert, which contains the correct page offset.
|
||||
|
||||
Signed-off-by: Tao Liu <ltao@redhat.com>
|
||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
|
||||
---
|
||||
memory.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/memory.c b/memory.c
|
||||
index 9ab578134fa1..1b6f9ba17e57 100644
|
||||
--- a/memory.c
|
||||
+++ b/memory.c
|
||||
@@ -8861,7 +8861,7 @@ dump_vmlist(struct meminfo *vi)
|
||||
(vi->spec_addr < (paddr+PAGESIZE()))) {
|
||||
if (vi->flags & GET_PHYS_TO_VMALLOC) {
|
||||
vi->retval = pcheck +
|
||||
- PAGEOFFSET(paddr);
|
||||
+ PAGEOFFSET(vi->spec_addr);
|
||||
return;
|
||||
} else
|
||||
fprintf(fp,
|
||||
@@ -9010,7 +9010,7 @@ dump_vmap_area(struct meminfo *vi)
|
||||
(vi->spec_addr < (paddr+PAGESIZE()))) {
|
||||
if (vi->flags & GET_PHYS_TO_VMALLOC) {
|
||||
vi->retval = pcheck +
|
||||
- PAGEOFFSET(paddr);
|
||||
+ PAGEOFFSET(vi->spec_addr);
|
||||
FREEBUF(ld->list_ptr);
|
||||
return;
|
||||
} else
|
||||
--
|
||||
2.37.1
|
||||
|
@ -1,76 +0,0 @@
|
||||
From 3b5e3e1583a1f596360c04e8a322e30cf88f27ab Mon Sep 17 00:00:00 2001
|
||||
From: Tao Liu <ltao@redhat.com>
|
||||
Date: Mon, 19 Sep 2022 17:49:23 +0800
|
||||
Subject: [PATCH 29/29] Let "kmem" print task context with physical address
|
||||
|
||||
Patch [1] enables "kmem" to print task context if the given virtual
|
||||
address is a vmalloced stack.
|
||||
|
||||
This patch lets "kmem" print task context also when the given address
|
||||
is a physical address.
|
||||
|
||||
Before:
|
||||
crash> kmem 1883700e28
|
||||
VMAP_AREA VM_STRUCT ADDRESS RANGE SIZE
|
||||
ffff94eb9102c640 ffff94eb9102b140 ffffb7efce9b8000 - ffffb7efce9bd000 20480
|
||||
|
||||
PAGE PHYSICAL MAPPING INDEX CNT FLAGS
|
||||
ffffdd28220dc000 1883700000 0 0 1 50000000000000
|
||||
|
||||
After:
|
||||
crash> kmem 1883700e28
|
||||
PID: 847
|
||||
COMMAND: "khungtaskd"
|
||||
TASK: ffff94f8038f4000 [THREAD_INFO: ffff94f8038f4000]
|
||||
CPU: 72
|
||||
STATE: TASK_RUNNING (PANIC)
|
||||
|
||||
VMAP_AREA VM_STRUCT ADDRESS RANGE SIZE
|
||||
ffff94eb9102c640 ffff94eb9102b140 ffffb7efce9b8000 - ffffb7efce9bd000 20480
|
||||
|
||||
PAGE PHYSICAL MAPPING INDEX CNT FLAGS
|
||||
ffffdd28220dc000 1883700000 0 0 1 50000000000000
|
||||
|
||||
[1]: https://listman.redhat.com/archives/crash-utility/2022-September/010115.html
|
||||
|
||||
[ kh: squashed the 4/4 patch into 3/4 ]
|
||||
|
||||
Signed-off-by: Tao Liu <ltao@redhat.com>
|
||||
Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
|
||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
|
||||
---
|
||||
memory.c | 8 ++++++--
|
||||
1 file changed, 6 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/memory.c b/memory.c
|
||||
index 1b6f9ba17e57..c80ef61bdcf7 100644
|
||||
--- a/memory.c
|
||||
+++ b/memory.c
|
||||
@@ -13506,6 +13506,10 @@ kmem_search(struct meminfo *mi)
|
||||
mi->flags &= ~GET_PHYS_TO_VMALLOC;
|
||||
|
||||
if (mi->retval) {
|
||||
+ if ((task = stkptr_to_task(mi->retval)) && (tc = task_to_context(task))) {
|
||||
+ show_context(tc);
|
||||
+ fprintf(fp, "\n");
|
||||
+ }
|
||||
if ((sp = value_search(mi->retval, &offset))) {
|
||||
show_symbol(sp, offset,
|
||||
SHOW_LINENUM | SHOW_RADIX());
|
||||
@@ -13562,11 +13566,11 @@ kmem_search(struct meminfo *mi)
|
||||
/*
|
||||
* Check whether it's a current task or stack address.
|
||||
*/
|
||||
- if ((mi->memtype == KVADDR) && (task = vaddr_in_task_struct(vaddr)) &&
|
||||
+ if ((mi->memtype & (KVADDR|PHYSADDR)) && (task = vaddr_in_task_struct(vaddr)) &&
|
||||
(tc = task_to_context(task))) {
|
||||
show_context(tc);
|
||||
fprintf(fp, "\n");
|
||||
- } else if ((mi->memtype == KVADDR) && (task = stkptr_to_task(vaddr)) &&
|
||||
+ } else if ((mi->memtype & (KVADDR|PHYSADDR)) && (task = stkptr_to_task(vaddr)) &&
|
||||
(tc = task_to_context(task))) {
|
||||
show_context(tc);
|
||||
fprintf(fp, "\n");
|
||||
--
|
||||
2.37.1
|
||||
|
@ -1,5 +1,5 @@
|
||||
--- crash-8.0.1/Makefile.orig
|
||||
+++ crash-8.0.1/Makefile
|
||||
--- crash-8.0.2/Makefile.orig
|
||||
+++ crash-8.0.2/Makefile
|
||||
@@ -204,7 +204,7 @@ GDB_FLAGS=
|
||||
# TARGET_CFLAGS will be configured automatically by configure
|
||||
TARGET_CFLAGS=
|
||||
@ -18,8 +18,8 @@
|
||||
@echo "../../${PROGRAM} ../../${PROGRAM}lib.a" > ${GDB}/gdb/mergeobj
|
||||
@rm -f ${PROGRAM}
|
||||
@if [ ! -f ${GDB}/config.status ]; then \
|
||||
--- crash-8.0.1/configure.c.orig
|
||||
+++ crash-8.0.1/configure.c
|
||||
--- crash-8.0.2/configure.c.orig
|
||||
+++ crash-8.0.2/configure.c
|
||||
@@ -810,7 +810,8 @@ build_configure(struct supported_gdb_version *sp)
|
||||
fprintf(fp2, "%s\n", sp->GDB);
|
||||
sprintf(target_data.gdb_version, "%s", &sp->GDB[4]);
|
105
crash.spec
105
crash.spec
@ -3,8 +3,8 @@
|
||||
#
|
||||
Summary: Kernel analysis utility for live systems, netdump, diskdump, kdump, LKCD or mcore dumpfiles
|
||||
Name: crash
|
||||
Version: 8.0.1
|
||||
Release: 4%{?dist}
|
||||
Version: 8.0.2
|
||||
Release: 1%{?dist}
|
||||
License: GPLv3
|
||||
Source0: https://github.com/crash-utility/crash/archive/crash-%{version}.tar.gz
|
||||
Source1: http://ftp.gnu.org/gnu/gdb/gdb-10.2.tar.gz
|
||||
@ -18,53 +18,8 @@ Requires: binutils
|
||||
Provides: bundled(libiberty)
|
||||
Provides: bundled(gdb) = 10.2
|
||||
Patch0: lzo_snappy_zstd.patch
|
||||
Patch1: crash-8.0.1_build.patch
|
||||
Patch2: 0001-ppc64-update-the-NR_CPUS-to-8192.patch
|
||||
Patch3: 0002-sbitmapq-remove-struct-and-member-validation-in-sbit.patch
|
||||
Patch4: 0003-sbitmapq-fix-invalid-offset-for-sbitmap_queue_alloc_.patch
|
||||
Patch5: 0004-sbitmapq-fix-invalid-offset-for-sbitmap_queue_round_.patch
|
||||
Patch6: 0005-sbitmapq-fix-invalid-offset-for-sbitmap_word_depth-o.patch
|
||||
Patch7: 0006-Makefile-add-missing-crash_target.o-to-be-cleaned.patch
|
||||
Patch8: 0007-bt-x86_64-filter-out-idle-task-stack.patch
|
||||
Patch9: 0008-bt-arm64-add-support-for-bt-n-idle.patch
|
||||
Patch10: 0009-gdb-print-details-of-unnamed-struct-and-union.patch
|
||||
Patch11: 0010-Enhance-dev-d-D-options-to-support-blk-mq-sbitmap.patch
|
||||
Patch12: 0011-Fix-for-dev-d-D-options-to-support-blk-mq-change-on-.patch
|
||||
Patch13: 0012-Doc-update-man-page-for-the-bpf-and-sbitmapq-command.patch
|
||||
Patch14: 0013-sbitmapq-Fix-for-sbitmap_queue-without-ws_active-mem.patch
|
||||
Patch15: 0014-sbitmapq-Fix-for-sbitmap_word-without-cleared-member.patch
|
||||
Patch16: 0015-sbitmapq-Fix-for-sbitmap_queue-without-min_shallow_d.patch
|
||||
Patch17: 0016-Make-dev-d-D-options-parse-sbitmap-on-Linux-4.18-and.patch
|
||||
Patch18: 0001-sbitmapq-Fix-for-kernels-without-struct-wait_queue_h.patch
|
||||
Patch19: 0002-sbitmapq-Limit-kernels-without-sbitmap-again.patch
|
||||
Patch20: 0003-Fix-for-dev-command-on-Linux-5.11-and-later.patch
|
||||
Patch21: 0004-Extend-field-length-of-task-attributes.patch
|
||||
Patch22: 0005-ppc64-fix-bt-for-S-case.patch
|
||||
Patch23: 0006-ppc64-dynamically-allocate-h-w-interrupt-stack.patch
|
||||
Patch24: 0007-ppc64-rename-ppc64_paca_init-to-ppc64_paca_percpu_of.patch
|
||||
Patch25: 0008-ppc64-handle-backtrace-when-CPU-is-in-an-emergency-s.patch
|
||||
Patch26: 0009-ppc64-print-emergency-stacks-info-with-mach-command.patch
|
||||
Patch27: 0010-ppc64-use-a-variable-for-machdep-machspec.patch
|
||||
Patch28: 0011-arm64-Fix-for-st-_stext_vmlinux-not-initialized-when.patch
|
||||
Patch29: 0012-Fix-gcc-11-compiler-warnings-on-filesys.c.patch
|
||||
Patch30: 0013-Fix-gcc-11-compiler-warning-on-symbols.c.patch
|
||||
Patch31: 0014-Fix-gcc-11-compiler-warning-on-makedumpfile.c.patch
|
||||
Patch32: 0015-Fix-gcc-11-compiler-warning-on-kvmdump.c.patch
|
||||
Patch33: 0016-x86_64-Fix-for-AMD-SME-issue.patch
|
||||
Patch34: 0017-Makefile-Fix-unnecessary-re-patching-with-coreutils-.patch
|
||||
Patch35: 0018-gdb-fix-for-assigning-NULL-to-std-string.patch
|
||||
Patch36: 0019-arm64-use-TCR_EL1_T1SZ-to-get-the-correct-info-if-va.patch
|
||||
Patch37: 0020-Fix-task-R-by-adding-end-identifier-for-union-in-tas.patch
|
||||
Patch38: 0021-Let-gdb-get-kernel-module-symbols-info-from-crash.patch
|
||||
Patch39: 0022-x86_64-Correct-the-identifier-when-locating-the-call.patch
|
||||
Patch40: 0023-Add-debian-ubuntu-vmlinux-location-to-default-search.patch
|
||||
Patch41: 0024-Fix-gcc-12-compiler-warnings-on-lkcd_-.c.patch
|
||||
Patch42: 0025-Fix-gcc-11-compiler-warnings-on-gdb-10.2-gdb-symtab..patch
|
||||
Patch43: 0026-Fix-for-the-invalid-linux_banner-pointer-issue.patch
|
||||
Patch44: 0027-Fix-kmem-failing-to-print-task-context-when-address-.patch
|
||||
Patch45: 0028-Fix-page-offset-issue-when-converting-physical-to-vi.patch
|
||||
Patch46: 0029-Let-kmem-print-task-context-with-physical-address.patch
|
||||
Patch47: crash-8.0.0-5-gdb-cdefs.patch
|
||||
Patch1: crash-8.0.2_build.patch
|
||||
Patch2: crash-8.0.0-5-gdb-cdefs.patch
|
||||
|
||||
%description
|
||||
The core analysis suite is a self-contained tool that can be used to
|
||||
@ -85,54 +40,9 @@ offered by Mission Critical Linux, or the LKCD kernel patch.
|
||||
%prep
|
||||
%setup -n %{name}-%{version} -q
|
||||
%patch0 -p1 -b lzo_snappy_zstd.patch
|
||||
%patch1 -p1 -b crash-8.0.1_build.patch
|
||||
%patch2 -p1
|
||||
%patch3 -p1
|
||||
%patch4 -p1
|
||||
%patch5 -p1
|
||||
%patch6 -p1
|
||||
%patch7 -p1
|
||||
%patch8 -p1
|
||||
%patch9 -p1
|
||||
%patch10 -p1
|
||||
%patch11 -p1
|
||||
%patch12 -p1
|
||||
%patch13 -p1
|
||||
%patch14 -p1
|
||||
%patch15 -p1
|
||||
%patch16 -p1
|
||||
%patch17 -p1
|
||||
%patch18 -p1
|
||||
%patch19 -p1
|
||||
%patch20 -p1
|
||||
%patch21 -p1
|
||||
%patch22 -p1
|
||||
%patch23 -p1
|
||||
%patch24 -p1
|
||||
%patch25 -p1
|
||||
%patch26 -p1
|
||||
%patch27 -p1
|
||||
%patch28 -p1
|
||||
%patch29 -p1
|
||||
%patch30 -p1
|
||||
%patch31 -p1
|
||||
%patch32 -p1
|
||||
%patch33 -p1
|
||||
%patch34 -p1
|
||||
%patch35 -p1
|
||||
%patch36 -p1
|
||||
%patch37 -p1
|
||||
%patch38 -p1
|
||||
%patch39 -p1
|
||||
%patch40 -p1
|
||||
%patch41 -p1
|
||||
%patch42 -p1
|
||||
%patch43 -p1
|
||||
%patch44 -p1
|
||||
%patch45 -p1
|
||||
%patch46 -p1
|
||||
%patch1 -p1 -b crash-8.0.2_build.patch
|
||||
%ifarch ppc64le
|
||||
%patch47 -p1 -b crash-8.0.0-5-gdb-cdefs.patch
|
||||
%patch2 -p1 -b crash-8.0.0-5-gdb-cdefs.patch
|
||||
%endif
|
||||
|
||||
|
||||
@ -160,6 +70,9 @@ cp -p defs.h %{buildroot}%{_includedir}/crash
|
||||
%{_includedir}/*
|
||||
|
||||
%changelog
|
||||
* Thu Nov 17 2022 Lianbo Jiang <lijiang@redhat.com> - 8.0.2-1
|
||||
- Rebase to upstream crash 8.0.2
|
||||
|
||||
* Thu Sep 22 2022 Lianbo Jiang <lijiang@redhat.com> - 8.0.1-4
|
||||
- Update to the latest upstream commit <3b5e3e1583a1>
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
--- crash-8.0.1/Makefile.orig
|
||||
+++ crash-8.0.1/Makefile
|
||||
--- crash-8.0.2/Makefile.orig
|
||||
+++ crash-8.0.2/Makefile
|
||||
@@ -256,7 +256,7 @@ all: make_configure
|
||||
gdb_merge: force
|
||||
@if [ ! -f ${GDB}/README ]; then \
|
||||
@ -9,8 +9,8 @@
|
||||
@echo "../../${PROGRAM} ../../${PROGRAM}lib.a" > ${GDB}/gdb/mergeobj
|
||||
@rm -f ${PROGRAM}
|
||||
@if [ ! -f ${GDB}/config.status ]; then \
|
||||
--- crash-8.0.1/diskdump.c.orig
|
||||
+++ crash-8.0.1/diskdump.c
|
||||
--- crash-8.0.2/diskdump.c.orig
|
||||
+++ crash-8.0.2/diskdump.c
|
||||
@@ -23,6 +23,9 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
2
sources
2
sources
@ -1,2 +1,2 @@
|
||||
SHA512 (crash-8.0.1.tar.gz) = ef9fe84dd5efa1b0570f71a8dd7af398a2ff35e9dc9fbcbeafd0f5ff503c7c4da93a33ffddfbac672fe12788dd3712808d6726ba9161ce282a7c76c3e2dc0793
|
||||
SHA512 (crash-8.0.2.tar.gz) = 9ff24d1206e9376e83690f76c817a48a68ff6adce677fad70335a73550a59c9af6e4753c1199f22eafa60c137156313244bbf98ed01bc2b066f41d324738ef6b
|
||||
SHA512 (gdb-10.2.tar.gz) = aa89caf47c1c84366020377d47e7c51ddbc48e5b7686f244e38797c8eb88411cf57fcdc37eb669961efb41ceeac4181747f429625fd1acce7712cb9a1fea9c41
|
||||
|
Loading…
Reference in New Issue
Block a user