Re: [PATCH 1/2] RISCV64: fix wrong information of, PUD, PMD and PTE - SA48(4K page)
by Lianbo Jiang
Hi, Austin
Thank you for the patch.
For the time being, I have no the RISCV64 environment for testing, just
did the build, and the changes are good to me. So: Ack for the [PATCH
1/2] and [PATCH 2/2].
Lianbo
On 1/15/26 4:27 PM, devel-request(a)lists.crash-utility.osci.io wrote:
> Date: Tue, 13 Jan 2026 10:54:01 +0900
> From: Austin Kim<austindh.kim(a)gmail.com>
> Subject: [Crash-utility] [PATCH 1/2] RISCV64: fix wrong information of
> PUD, PMD and PTE - SA48(4K page)
> To:devel@lists.crash-utility.osci.io
> Cc:austindh.kim@gmail.com
> Message-ID: <aWWluWUXmh9JuGQx@adminpc-PowerEdge-R7525>
> Content-Type: text/plain; charset=us-ascii
>
> As for SA48(4K page) in RISC-V based vmcore, 'vtop address' command
> produces the misleading information, including PUD, PMD, PTE.
>
> This commit is based on the following previous commit:
>
> commit 536a0d78f1fa ("RISCV64: fix wrong information of PMD and PTE - SA39(4K page)")
>
> Signed-off-by: Austin Kim<austindh.kim(a)gmail.com>
> ---
> riscv64.c | 37 ++++++++++++++++++-------------------
> 1 file changed, 18 insertions(+), 19 deletions(-)
>
> diff --git a/riscv64.c b/riscv64.c
> index 6b89f0b..4400d5c 100644
> --- a/riscv64.c
> +++ b/riscv64.c
> @@ -1210,10 +1210,9 @@ static int
> riscv64_vtop_4level_4k(ulong *pgd, ulong vaddr, physaddr_t *paddr, int verbose)
> {
> ulong *pgd_ptr, pgd_val;
> - ulong pud_val;
> - ulong pmd_val;
> - ulong pte_val, pte_pfn;
> - ulong pt_phys;
> + ulong pud_base, pud_addr, pud_val;
> + ulong pmd_base, pmd_addr, pmd_val;
> + ulong pte_base, pte_addr, pte_val, pte_pfn;
>
> if (verbose)
> fprintf(fp, "PAGE DIRECTORY: %lx\n", (ulong)pgd);
> @@ -1227,36 +1226,36 @@ riscv64_vtop_4level_4k(ulong *pgd, ulong vaddr, physaddr_t *paddr, int verbose)
> if (!pgd_val)
> goto no_page;
> pgd_val &= PTE_PFN_PROT_MASK;
> - pt_phys = (pgd_val >> _PAGE_PFN_SHIFT) << PAGESHIFT();
> + pud_base = (pgd_val >> _PAGE_PFN_SHIFT) << PAGESHIFT();
>
> /* PUD */
> - FILL_PUD(PAGEBASE(pt_phys), PHYSADDR, PAGESIZE());
> - pud_val = ULONG(machdep->pud + PAGEOFFSET(sizeof(pud_t) *
> - pud_index_l4_4k(vaddr)));
> + FILL_PUD(PAGEBASE(pud_base), PHYSADDR, PAGESIZE());
> + pud_addr = pud_base + sizeof(pud_t) * pud_index_l4_4k(vaddr);
> + pud_val = ULONG(machdep->pud + PAGEOFFSET(pud_addr));
> if (verbose)
> - fprintf(fp, " PUD: %016lx => %016lx\n", pt_phys, pud_val);
> + fprintf(fp, " PUD: %016lx => %016lx\n", pud_addr, pud_val);
> if (!pud_val)
> goto no_page;
> pud_val &= PTE_PFN_PROT_MASK;
> - pt_phys = (pud_val >> _PAGE_PFN_SHIFT) << PAGESHIFT();
> + pmd_base = (pud_val >> _PAGE_PFN_SHIFT) << PAGESHIFT();
>
> /* PMD */
> - FILL_PMD(PAGEBASE(pt_phys), PHYSADDR, PAGESIZE());
> - pmd_val = ULONG(machdep->pmd + PAGEOFFSET(sizeof(pmd_t) *
> - pmd_index_l4_4k(vaddr)));
> + FILL_PMD(PAGEBASE(pmd_base), PHYSADDR, PAGESIZE());
> + pmd_addr = pmd_base + sizeof(pmd_t) + pmd_index_l4_4k(vaddr);
> + pmd_val = ULONG(machdep->pmd + PAGEOFFSET(pmd_addr));
> if (verbose)
> - fprintf(fp, " PMD: %016lx => %016lx\n", pt_phys, pmd_val);
> + fprintf(fp, " PMD: %016lx => %016lx\n", pmd_addr, pmd_val);
> if (!pmd_val)
> goto no_page;
> pmd_val &= PTE_PFN_PROT_MASK;
> - pt_phys = (pmd_val >> _PAGE_PFN_SHIFT) << PAGESHIFT();
> + pte_base = (pmd_val >> _PAGE_PFN_SHIFT) << PAGESHIFT();
>
> /* PTE */
> - FILL_PTBL(PAGEBASE(pt_phys), PHYSADDR, PAGESIZE());
> - pte_val = ULONG(machdep->ptbl + PAGEOFFSET(sizeof(pte_t) *
> - pte_index_l4_4k(vaddr)));
> + FILL_PTBL(PAGEBASE(pte_base), PHYSADDR, PAGESIZE());
> + pte_addr = pte_base + sizeof(pte_t) * pte_index_l4_4k(vaddr);
> + pte_val = ULONG(machdep->ptbl + PAGEOFFSET(pte_addr));
> if (verbose)
> - fprintf(fp, " PTE: %lx => %lx\n", pt_phys, pte_val);
> + fprintf(fp, " PTE: %lx => %lx\n", pte_addr, pte_val);
> if (!pte_val)
> goto no_page;
> pte_val &= PTE_PFN_PROT_MASK;
> -- 2.34.1
9 hours, 1 minute
[PATCH] Fix for "mod -S" causes symbols to be incorrect
by Lianbo Jiang
Currently, the "mod -S" command may cause that the "bt/sym" commands
incorrectly translate the kernel module virtual address to symbol names,
if a kernel module contains a per-cpu section, this was reported on
PPC64 kernel.
Without the patch:
crash> mod -S ../usr/lib/debug/lib/modules/5.14.0-xxx.ppc64le
...
crash> bt
PID: 35705 TASK: c0000000b0365680 CPU: 16 COMMAND: "lsof"
...
[NIP : __key.7+32443920]
[LR : __key.7+32446288]
#4 [c0000000394df9c0] __key.7 at c00800001ce82040 [overlay] (unreliable)
#5 [c0000000394dfa00] walk_component at c0000000005c914c
...
crash> sym c00800001ce82040
c00800001ce82040 (b) __key.7+32443920 [bnx2i] /usr/src/debug/kernel-5.14.0-xxx/linux-5.14.0-xxx.ppc64le/fs/overlayfs/super.c: 122
With the patch:
crash> mod -S ../usr/lib/debug/lib/modules/5.14.0-xxx.ppc64le
...
crash> bt
PID: 35705 TASK: c0000000b0365680 CPU: 16 COMMAND: "lsof"
...
[NIP : ovl_revalidate_real+40]
[LR : ovl_dentry_revalidate_common+136]
#4 [c0000000394df9c0] ovl_revalidate_real at c00800001ce82040 [overlay]
#5 [c0000000394dfa00] walk_component at c0000000005c914c
...
crash> sym c00800001ce82040
c00800001ce82040 (t) ovl_revalidate_real+40 [overlay] /usr/src/debug/kernel-5.14.0-xxx/linux-5.14.0-xxx.ppc64le/fs/overlayfs/super.c: 122
Signed-off-by: Lianbo Jiang <lijiang(a)redhat.com>
---
symbols.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/symbols.c b/symbols.c
index c446beb43a76..e6865cabef74 100644
--- a/symbols.c
+++ b/symbols.c
@@ -5679,7 +5679,7 @@ value_search_module_6_4(ulong value, ulong *offset)
splast = NULL;
for ( ; sp <= sp_end; sp++) {
- if (machine_type("ARM64") &&
+ if ((machine_type("ARM64") || machine_type("PPC64")) &&
IN_MODULE_PERCPU(sp->value, lm) &&
!IN_MODULE_PERCPU(value, lm))
continue;
@@ -5769,10 +5769,10 @@ retry:
*/
splast = NULL;
for ( ; sp <= sp_end; sp++) {
- if (machine_type("ARM64") &&
+ if ((machine_type("ARM64") || machine_type("PPC64")) &&
IN_MODULE_PERCPU(sp->value, lm) &&
- !IN_MODULE_PERCPU(value, lm))
- continue;
+ !IN_MODULE_PERCPU(value, lm))
+ continue;
if (value == sp->value) {
if (MODULE_END(sp) || MODULE_INIT_END(sp))
--
2.51.1
19 hours, 6 minutes
[PATCH] maple_tree: add support for maple_tree.c output to respect the global radix and per-command -x/d flags
by stalexan@redhat.com
The commands that generate maple tree output do not currently respect the
global radix setting, nor do they respect the -x output flag. This
patch aims to fix this inconsistency, so that the output commands
respect both the global radix setting as well as the per-command -x/d
flags.
Signed-off-by: Sterling Alexander <stalexan(a)redhat.com>
---
maple_tree.c | 93 ++++++++++++++++++++++++++++++++++------------------
1 file changed, 61 insertions(+), 32 deletions(-)
diff --git a/maple_tree.c b/maple_tree.c
index 8c804d0..3b11ddd 100644
--- a/maple_tree.c
+++ b/maple_tree.c
@@ -67,12 +67,15 @@ struct req_entry *fill_member_offsets(char *);
void dump_struct_members_fast(struct req_entry *, int, ulong);
void dump_struct_members_for_tree(struct tree_data *, int, ulong);
-static void mt_dump_range(ulong min, ulong max, uint depth)
+static void mt_dump_range(ulong min, ulong max, uint depth, int radix)
{
- if (min == max)
- fprintf(fp, "%.*s%lu: ", depth * 2, spaces, min);
- else
- fprintf(fp, "%.*s%lu-%lu: ", depth * 2, spaces, min, max);
+ if (min == max) {
+ fprintf(fp, (radix == 16) ? "%.*s%lx: " : "%.*s%lu: ",
+ depth * 2, spaces, min);
+ } else {
+ fprintf(fp, (radix == 16) ? "%.*s%lx-%lx: " : "%.*s%lu-%lu: ",
+ depth * 2, spaces, min, max);
+ }
}
static inline bool mt_is_reserved(ulong entry)
@@ -92,13 +95,28 @@ static uint mt_height(char *mt_buf)
>> MT_FLAGS_HEIGHT_OFFSET;
}
-static void dump_mt_range64(char *mr64_buf)
+/*
+ * Determine the output radix for maple tree display.
+ * Priority: 1) -x/-d flags, 2) global pc->output_radix
+ */
+static inline int mt_output_radix(struct tree_data *td)
+{
+ if (td) {
+ if (td->flags & TREE_STRUCT_RADIX_10)
+ return 10;
+ else if (td->flags & TREE_STRUCT_RADIX_16)
+ return 16;
+ }
+ return pc->output_radix;
+}
+
+static void dump_mt_range64(char *mr64_buf, int radix)
{
int i;
fprintf(fp, " contents: ");
for (i = 0; i < mt_slots[maple_range_64] - 1; i++)
- fprintf(fp, "%p %lu ",
+ fprintf(fp, (radix == 16) ? "%p %lx " : "%p %lu ",
VOID_PTR(mr64_buf + OFFSET(maple_range_64_slot)
+ sizeof(void *) * i),
ULONG(mr64_buf + OFFSET(maple_range_64_pivot)
@@ -107,14 +125,15 @@ static void dump_mt_range64(char *mr64_buf)
+ sizeof(void *) * i));
}
-static void dump_mt_arange64(char *ma64_buf)
+static void dump_mt_arange64(char *ma64_buf, int radix)
{
int i;
fprintf(fp, " contents: ");
for (i = 0; i < mt_slots[maple_arange_64]; i++)
- fprintf(fp, "%lu ", ULONG(ma64_buf + OFFSET(maple_arange_64_gap)
- + sizeof(ulong) * i));
+ fprintf(fp, (radix == 16) ? "%lx " : "%lu ",
+ ULONG(ma64_buf + OFFSET(maple_arange_64_gap)
+ + sizeof(ulong) * i));
fprintf(fp, "| %02X %02X| ",
UCHAR(ma64_buf + OFFSET(maple_arange_64_meta) +
@@ -123,7 +142,7 @@ static void dump_mt_arange64(char *ma64_buf)
OFFSET(maple_metadata_gap)));
for (i = 0; i < mt_slots[maple_arange_64] - 1; i++)
- fprintf(fp, "%p %lu ",
+ fprintf(fp, (radix == 16) ? "%p %lx " : "%p %lu ",
VOID_PTR(ma64_buf + OFFSET(maple_arange_64_slot) +
sizeof(void *) * i),
ULONG(ma64_buf + OFFSET(maple_arange_64_pivot) +
@@ -132,25 +151,27 @@ static void dump_mt_arange64(char *ma64_buf)
sizeof(void *) * i));
}
-static void dump_mt_entry(ulong entry, ulong min, ulong max, uint depth)
+static void dump_mt_entry(ulong entry, ulong min, ulong max, uint depth, int radix)
{
- mt_dump_range(min, max, depth);
+ mt_dump_range(min, max, depth, radix);
- if (xa_is_value(entry))
- fprintf(fp, "value %ld (0x%lx) [0x%lx]\n", xa_to_value(entry),
+ if (xa_is_value(entry)) {
+ fprintf(fp, (radix == 16) ? "value 0x%lx [0x%lx]\n" : "value %ld [0x%lx]\n",
xa_to_value(entry), entry);
- else if (xa_is_zero(entry))
- fprintf(fp, "zero (%ld)\n", xa_to_internal(entry));
- else if (mt_is_reserved(entry))
+ } else if (xa_is_zero(entry)) {
+ fprintf(fp, (radix == 16) ? "zero (0x%lx)\n" : "zero (%ld)\n",
+ xa_to_internal(entry));
+ } else if (mt_is_reserved(entry)) {
fprintf(fp, "UNKNOWN ENTRY (0x%lx)\n", entry);
- else
- fprintf(fp, "0x%lx\n", entry);
+ } else {
+ fprintf(fp, (radix == 16) ? "0x%lx\n" : "%lu\n", entry);
+ }
}
static void dump_mt_node(ulong maple_node, char *node_data, uint type,
- ulong min, ulong max, uint depth)
+ ulong min, ulong max, uint depth, int radix)
{
- mt_dump_range(min, max, depth);
+ mt_dump_range(min, max, depth, radix);
fprintf(fp, "node 0x%lx depth %d type %d parent %p",
maple_node, depth, type,
@@ -169,6 +190,7 @@ static void do_mt_range64(ulong entry, ulong min, ulong max,
int i;
int len = strlen(path);
struct tree_data *td = ops->is_td ? (struct tree_data *)ops->private : NULL;
+ int radix = mt_output_radix(td);
char *mr64_buf;
if (SIZE(maple_node) > MAPLE_BUFSIZE)
@@ -180,7 +202,7 @@ static void do_mt_range64(ulong entry, ulong min, ulong max,
mr64_buf = node_buf + OFFSET(maple_node_mr64);
if (td && td->flags & TREE_STRUCT_VERBOSE) {
- dump_mt_range64(mr64_buf);
+ dump_mt_range64(mr64_buf, radix);
}
for (i = 0; i < mt_slots[maple_range_64]; i++) {
@@ -230,6 +252,7 @@ static void do_mt_arange64(ulong entry, ulong min, ulong max,
int i;
int len = strlen(path);
struct tree_data *td = ops->is_td ? (struct tree_data *)ops->private : NULL;
+ int radix = mt_output_radix(td);
char *ma64_buf;
if (SIZE(maple_node) > MAPLE_BUFSIZE)
@@ -241,7 +264,7 @@ static void do_mt_arange64(ulong entry, ulong min, ulong max,
ma64_buf = node_buf + OFFSET(maple_node_ma64);
if (td && td->flags & TREE_STRUCT_VERBOSE) {
- dump_mt_arange64(ma64_buf);
+ dump_mt_arange64(ma64_buf, radix);
}
for (i = 0; i < mt_slots[maple_arange_64]; i++) {
@@ -286,6 +309,7 @@ static void do_mt_entry(ulong entry, ulong min, ulong max, uint depth,
int print_radix = 0, i;
static struct req_entry **e = NULL;
struct tree_data *td = ops->is_td ? (struct tree_data *)ops->private : NULL;
+ int output_radix = mt_output_radix(td);
if (ops->entry && entry)
ops->entry(entry, entry, path, max, ops->private);
@@ -306,12 +330,15 @@ static void do_mt_entry(ulong entry, ulong min, ulong max, uint depth,
td->count++;
if (td->flags & TREE_STRUCT_VERBOSE) {
- dump_mt_entry(entry, min, max, depth);
- } else if (td->flags & VERBOSE && entry)
- fprintf(fp, "%lx\n", entry);
- if (td->flags & TREE_POSITION_DISPLAY && entry)
- fprintf(fp, " index: %ld position: %s/%u\n",
+ dump_mt_entry(entry, min, max, depth, output_radix);
+ } else if (td->flags & VERBOSE && entry) {
+ fprintf(fp, (output_radix == 16) ? "%lx\n" : "%lu\n", entry);
+ }
+ if (td->flags & TREE_POSITION_DISPLAY && entry) {
+ fprintf(fp, (output_radix == 16) ? " index: %lx position: %s/%u\n" :
+ " index: %ld position: %s/%u\n",
++(*global_index), path, index);
+ }
if (td->structname && entry) {
if (td->flags & TREE_STRUCT_RADIX_10)
@@ -319,7 +346,7 @@ static void do_mt_entry(ulong entry, ulong min, ulong max, uint depth,
else if (td->flags & TREE_STRUCT_RADIX_16)
print_radix = 16;
else
- print_radix = 0;
+ print_radix = output_radix;
for (i = 0; i < td->structname_args; i++) {
switch (count_chars(td->structname[i], '.')) {
@@ -348,6 +375,7 @@ static void do_mt_node(ulong entry, ulong min, ulong max,
uint i;
char node_buf[MAPLE_BUFSIZE];
struct tree_data *td = ops->is_td ? (struct tree_data *)ops->private : NULL;
+ int radix = mt_output_radix(td);
if (SIZE(maple_node) > MAPLE_BUFSIZE)
error(FATAL, "MAPLE_BUFSIZE should be larger than maple_node struct");
@@ -356,7 +384,7 @@ static void do_mt_node(ulong entry, ulong min, ulong max,
"mt_dump_node read maple_node", FAULT_ON_ERROR);
if (td && td->flags & TREE_STRUCT_VERBOSE) {
- dump_mt_node(maple_node, node_buf, type, min, max, depth);
+ dump_mt_node(maple_node, node_buf, type, min, max, depth, radix);
}
switch (type) {
@@ -457,7 +485,8 @@ static void do_maple_tree_dump(ulong node, ulong slot, const char *path,
ulong index, void *private)
{
struct do_maple_tree_info *info = private;
- fprintf(fp, "[%lu] %lx\n", index, slot);
+ fprintf(fp, (pc->output_radix == 16) ? "[%lx] %lx\n" : "[%lu] %lx\n",
+ index, slot);
info->count++;
}
--
2.52.0
1 day, 3 hours
[PATCH 2/2] RISCV64: fix wrong information of P4D, PUD, PMD and PTE - SA57(4K page)
by Austin Kim
As for SA57(4K page) in RISC-V based vmcore, 'vtop address' command
produces the misleading information, including P4D, PUD, PMD, PTE.
This commit is based on the following previous commit:
commit 536a0d78f1fa ("RISCV64: fix wrong information of PMD and PTE - SA39(4K page)")
Signed-off-by: Austin Kim <austindh.kim(a)gmail.com>
---
riscv64.c | 49 ++++++++++++++++++++++++-------------------------
1 file changed, 24 insertions(+), 25 deletions(-)
diff --git a/riscv64.c b/riscv64.c
index 4400d5c..eceae70 100644
--- a/riscv64.c
+++ b/riscv64.c
@@ -1287,11 +1287,10 @@ static int
riscv64_vtop_5level_4k(ulong *pgd, ulong vaddr, physaddr_t *paddr, int verbose)
{
ulong *pgd_ptr, pgd_val;
- ulong p4d_val;
- ulong pud_val;
- ulong pmd_val;
- ulong pte_val, pte_pfn;
- ulong pt_phys;
+ ulong p4d_base, p4d_addr, p4d_val;
+ ulong pud_base, pud_addr, pud_val;
+ ulong pmd_base, pmd_addr, pmd_val;
+ ulong pte_base, pte_addr, pte_val, pte_pfn;
if (verbose)
fprintf(fp, "PAGE DIRECTORY: %lx\n", (ulong)pgd);
@@ -1305,47 +1304,47 @@ riscv64_vtop_5level_4k(ulong *pgd, ulong vaddr, physaddr_t *paddr, int verbose)
if (!pgd_val)
goto no_page;
pgd_val &= PTE_PFN_PROT_MASK;
- pt_phys = (pgd_val >> _PAGE_PFN_SHIFT) << PAGESHIFT();
+ p4d_base = (pgd_val >> _PAGE_PFN_SHIFT) << PAGESHIFT();
/* P4D */
- FILL_P4D(PAGEBASE(pt_phys), PHYSADDR, PAGESIZE());
- p4d_val = ULONG(machdep->machspec->p4d + PAGEOFFSET(sizeof(p4d_t) *
- p4d_index_l5_4k(vaddr)));
+ FILL_P4D(PAGEBASE(p4d_base), PHYSADDR, PAGESIZE());
+ p4d_addr = p4d_base + sizeof(p4d_t) * p4d_index_l5_4k(vaddr);
+ p4d_val = ULONG(machdep->machspec->p4d + PAGEOFFSET(p4d_addr));
if (verbose)
- fprintf(fp, " P4D: %016lx => %016lx\n", pt_phys, p4d_val);
+ fprintf(fp, " P4D: %016lx => %016lx\n", p4d_addr, p4d_val);
if (!p4d_val)
goto no_page;
p4d_val &= PTE_PFN_PROT_MASK;
- pt_phys = (p4d_val >> _PAGE_PFN_SHIFT) << PAGESHIFT();
+ pud_base = (p4d_val >> _PAGE_PFN_SHIFT) << PAGESHIFT();
/* PUD */
- FILL_PUD(PAGEBASE(pt_phys), PHYSADDR, PAGESIZE());
- pud_val = ULONG(machdep->pud + PAGEOFFSET(sizeof(pud_t) *
- pud_index_l5_4k(vaddr)));
+ FILL_PUD(PAGEBASE(pud_base), PHYSADDR, PAGESIZE());
+ pud_addr = pud_base + sizeof(pud_t) * pud_index_l5_4k(vaddr);
+ pud_val = ULONG(machdep->pud + PAGEOFFSET(pud_addr));
if (verbose)
- fprintf(fp, " PUD: %016lx => %016lx\n", pt_phys, pud_val);
+ fprintf(fp, " PUD: %016lx => %016lx\n", pud_addr, pud_val);
if (!pud_val)
goto no_page;
pud_val &= PTE_PFN_PROT_MASK;
- pt_phys = (pud_val >> _PAGE_PFN_SHIFT) << PAGESHIFT();
+ pmd_base = (pud_val >> _PAGE_PFN_SHIFT) << PAGESHIFT();
/* PMD */
- FILL_PMD(PAGEBASE(pt_phys), PHYSADDR, PAGESIZE());
- pmd_val = ULONG(machdep->pmd + PAGEOFFSET(sizeof(pmd_t) *
- pmd_index_l4_4k(vaddr)));
+ FILL_PMD(PAGEBASE(pmd_base), PHYSADDR, PAGESIZE());
+ pmd_addr = pmd_base + sizeof(pmd_t) * pmd_index_l5_4k(vaddr);
+ pmd_val = ULONG(machdep->pmd + PAGEOFFSET(pmd_addr));
if (verbose)
- fprintf(fp, " PMD: %016lx => %016lx\n", pt_phys, pmd_val);
+ fprintf(fp, " PMD: %016lx => %016lx\n", pmd_addr, pmd_val);
if (!pmd_val)
goto no_page;
pmd_val &= PTE_PFN_PROT_MASK;
- pt_phys = (pmd_val >> _PAGE_PFN_SHIFT) << PAGESHIFT();
+ pte_base = (pmd_val >> _PAGE_PFN_SHIFT) << PAGESHIFT();
/* PTE */
- FILL_PTBL(PAGEBASE(pt_phys), PHYSADDR, PAGESIZE());
- pte_val = ULONG(machdep->ptbl + PAGEOFFSET(sizeof(pte_t) *
- pte_index_l4_4k(vaddr)));
+ FILL_PTBL(PAGEBASE(pte_base), PHYSADDR, PAGESIZE());
+ pte_addr = pte_base + sizeof(pte_t) * pte_index_l5_4k(vaddr);
+ pte_val = ULONG(machdep->ptbl + PAGEOFFSET(pte_addr));
if (verbose)
- fprintf(fp, " PTE: %lx => %lx\n", pt_phys, pte_val);
+ fprintf(fp, " PTE: %lx => %lx\n", pte_base, pte_val);
if (!pte_val)
goto no_page;
pte_val &= PTE_PFN_PROT_MASK;
--
2.34.1
1 week, 2 days
[PATCH 1/2] RISCV64: fix wrong information of PUD, PMD and PTE - SA48(4K page)
by Austin Kim
As for SA48(4K page) in RISC-V based vmcore, 'vtop address' command
produces the misleading information, including PUD, PMD, PTE.
This commit is based on the following previous commit:
commit 536a0d78f1fa ("RISCV64: fix wrong information of PMD and PTE - SA39(4K page)")
Signed-off-by: Austin Kim <austindh.kim(a)gmail.com>
---
riscv64.c | 37 ++++++++++++++++++-------------------
1 file changed, 18 insertions(+), 19 deletions(-)
diff --git a/riscv64.c b/riscv64.c
index 6b89f0b..4400d5c 100644
--- a/riscv64.c
+++ b/riscv64.c
@@ -1210,10 +1210,9 @@ static int
riscv64_vtop_4level_4k(ulong *pgd, ulong vaddr, physaddr_t *paddr, int verbose)
{
ulong *pgd_ptr, pgd_val;
- ulong pud_val;
- ulong pmd_val;
- ulong pte_val, pte_pfn;
- ulong pt_phys;
+ ulong pud_base, pud_addr, pud_val;
+ ulong pmd_base, pmd_addr, pmd_val;
+ ulong pte_base, pte_addr, pte_val, pte_pfn;
if (verbose)
fprintf(fp, "PAGE DIRECTORY: %lx\n", (ulong)pgd);
@@ -1227,36 +1226,36 @@ riscv64_vtop_4level_4k(ulong *pgd, ulong vaddr, physaddr_t *paddr, int verbose)
if (!pgd_val)
goto no_page;
pgd_val &= PTE_PFN_PROT_MASK;
- pt_phys = (pgd_val >> _PAGE_PFN_SHIFT) << PAGESHIFT();
+ pud_base = (pgd_val >> _PAGE_PFN_SHIFT) << PAGESHIFT();
/* PUD */
- FILL_PUD(PAGEBASE(pt_phys), PHYSADDR, PAGESIZE());
- pud_val = ULONG(machdep->pud + PAGEOFFSET(sizeof(pud_t) *
- pud_index_l4_4k(vaddr)));
+ FILL_PUD(PAGEBASE(pud_base), PHYSADDR, PAGESIZE());
+ pud_addr = pud_base + sizeof(pud_t) * pud_index_l4_4k(vaddr);
+ pud_val = ULONG(machdep->pud + PAGEOFFSET(pud_addr));
if (verbose)
- fprintf(fp, " PUD: %016lx => %016lx\n", pt_phys, pud_val);
+ fprintf(fp, " PUD: %016lx => %016lx\n", pud_addr, pud_val);
if (!pud_val)
goto no_page;
pud_val &= PTE_PFN_PROT_MASK;
- pt_phys = (pud_val >> _PAGE_PFN_SHIFT) << PAGESHIFT();
+ pmd_base = (pud_val >> _PAGE_PFN_SHIFT) << PAGESHIFT();
/* PMD */
- FILL_PMD(PAGEBASE(pt_phys), PHYSADDR, PAGESIZE());
- pmd_val = ULONG(machdep->pmd + PAGEOFFSET(sizeof(pmd_t) *
- pmd_index_l4_4k(vaddr)));
+ FILL_PMD(PAGEBASE(pmd_base), PHYSADDR, PAGESIZE());
+ pmd_addr = pmd_base + sizeof(pmd_t) + pmd_index_l4_4k(vaddr);
+ pmd_val = ULONG(machdep->pmd + PAGEOFFSET(pmd_addr));
if (verbose)
- fprintf(fp, " PMD: %016lx => %016lx\n", pt_phys, pmd_val);
+ fprintf(fp, " PMD: %016lx => %016lx\n", pmd_addr, pmd_val);
if (!pmd_val)
goto no_page;
pmd_val &= PTE_PFN_PROT_MASK;
- pt_phys = (pmd_val >> _PAGE_PFN_SHIFT) << PAGESHIFT();
+ pte_base = (pmd_val >> _PAGE_PFN_SHIFT) << PAGESHIFT();
/* PTE */
- FILL_PTBL(PAGEBASE(pt_phys), PHYSADDR, PAGESIZE());
- pte_val = ULONG(machdep->ptbl + PAGEOFFSET(sizeof(pte_t) *
- pte_index_l4_4k(vaddr)));
+ FILL_PTBL(PAGEBASE(pte_base), PHYSADDR, PAGESIZE());
+ pte_addr = pte_base + sizeof(pte_t) * pte_index_l4_4k(vaddr);
+ pte_val = ULONG(machdep->ptbl + PAGEOFFSET(pte_addr));
if (verbose)
- fprintf(fp, " PTE: %lx => %lx\n", pt_phys, pte_val);
+ fprintf(fp, " PTE: %lx => %lx\n", pte_addr, pte_val);
if (!pte_val)
goto no_page;
pte_val &= PTE_PFN_PROT_MASK;
--
2.34.1
1 week, 2 days
High-Quality Ethernet Cable Cat5e for Home and Office Use
by judithroyal7@gmail.com
A High-Quality <a href="https://tscables.com/collections/bulk-cat5e-cable">Ethernet Cable Cat5e</a> for Home and Office Use is essential for building a stable and efficient wired network. Designed for consistent data transfer, a cat5e 6 ethernet patch cable helps reduce interference while supporting smooth internet performance for everyday tasks. It’s ideal for connecting computers, routers, switches, and other network devices in both residential and professional environments. TS Cables, a trusted networking company in the USA, provides reliable Ethernet solutions built with durability and performance in mind. With strong construction and dependable signal quality, this Cat5e cable ensures seamless connectivity for work, streaming, and daily online activities.
2 weeks, 1 day
High-Quality Ethernet Cable Cat5e for Home and Office Use
by judithroyal7@gmail.com
A High-Quality <a href="https://tscables.com/collections/bulk-cat5e-cable">Ethernet Cable Cat5e</a> for Home and Office Use is essential for building a stable and efficient wired network. Designed for consistent data transfer, a cat5e 6 ethernet patch cable helps reduce interference while supporting smooth internet performance for everyday tasks. It’s ideal for connecting computers, routers, switches, and other network devices in both residential and professional environments. TS Cables, a trusted networking company in the USA, provides reliable Ethernet solutions built with durability and performance in mind. With strong construction and dependable signal quality, this Cat5e cable ensures seamless connectivity for work, streaming, and daily online activities.
2 weeks, 1 day
Cricket ID Book & Madras Book ID – Complete Online Guide
by digitalmadrasbook@gmail.com
Cricket is something that humans in India grow up with. It begins from youth street matches and remains till overdue-night discussions throughout large tournaments. When a chief series or league is on, the whole lot else slows down a chunk. Many lovers these days don’t simply watch cricket, they prefer to live linked with it on line as nicely. Because of this, terms like Cricket ID Book and Madras Book ID are being used increasingly.
If you are listening to these words often and need to apprehend them surely, this guide will help. The recognition here is to give an explanation for things in a simple and honest manner, without technical language. We may also speak about Madrasbook, which many users already agree with.
Visit This Site: https://madrasbook.in/
2 weeks, 1 day