Skip to content

Commit 73e451d

Browse files
svens-s390osandov
authored andcommitted
tests: enable MM tests on s390x
s390x now has full mm support, so enable the tests for it. Signed-off-by: Sven Schnelle <[email protected]>
1 parent 3483a69 commit 73e451d

File tree

3 files changed

+21
-15
lines changed

3 files changed

+21
-15
lines changed

drgn/helpers/linux/mm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
-----------------
77
88
The ``drgn.helpers.linux.mm`` module provides helpers for working with the
9-
Linux memory management (MM) subsystem. Only AArch64, s390x and x86-64 are
9+
Linux memory management (MM) subsystem. Only AArch64, s390x, and x86-64 are
1010
currently supported.
1111
"""
1212

libdrgn/arch_s390x.c

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ linux_kernel_pgtable_iterator_init_s390x(struct drgn_program *prog,
297297
struct pgtable_iterator_s390x *it =
298298
container_of(_it, struct pgtable_iterator_s390x, it);
299299
for (int i = 0; i < 5; i++)
300-
it->pagetable[i].addr = UINT64_C(-1);
300+
it->pagetable[i].addr = UINT64_MAX;
301301
it->levels = 3;
302302
}
303303

@@ -399,12 +399,13 @@ linux_kernel_pgtable_iterator_next_s390x(struct drgn_program *prog,
399399
uint64_t entry;
400400

401401
/*
402-
* Note: we need the ASCE bits to determine the levels of paging in use, but we
403-
* only get the pgd address from drgn. Therefore do the same what the linux kernel
404-
* does: read the first level entry, and deduct the number of levels from the TT bits.
402+
* Note: we need the ASCE bits to determine the levels of paging in use,
403+
* but we only get the pgd address from drgn. Therefore do the same what
404+
* the linux kernel does: read the first level entry, and deduct the
405+
* number of levels from the TT bits.
405406
*/
406-
407-
struct drgn_error *err = drgn_program_read_u64(prog, table, true, &entry);
407+
struct drgn_error *err = drgn_program_read_u64(prog, table, true,
408+
&entry);
408409
if (err)
409410
return err;
410411

@@ -425,10 +426,11 @@ linux_kernel_pgtable_iterator_next_s390x(struct drgn_program *prog,
425426
it->pagetable[level].length != length ||
426427
it->pagetable[level].offset != offset) {
427428
/*
428-
* It's only marginally more expensive to read 4096 bytes than 8
429-
* bytes, so we always read the full table.
429+
* It's only marginally more expensive to read 4096
430+
* bytes than 8 bytes, so we always read the full table.
430431
*/
431-
err = drgn_program_read_memory(prog, it->pagetable[level].entries,
432+
err = drgn_program_read_memory(prog,
433+
it->pagetable[level].entries,
432434
table, length * 8, true);
433435
if (err)
434436
return err;
@@ -475,10 +477,14 @@ const struct drgn_architecture_info arch_info_s390x = {
475477
.linux_kernel_get_initial_registers =
476478
linux_kernel_get_initial_registers_s390x,
477479
.apply_elf_reloc = apply_elf_reloc_s390,
478-
.linux_kernel_pgtable_iterator_create = linux_kernel_pgtable_iterator_create_s390x,
479-
.linux_kernel_pgtable_iterator_destroy = linux_kernel_pgtable_iterator_destroy_s390x,
480-
.linux_kernel_pgtable_iterator_init = linux_kernel_pgtable_iterator_init_s390x,
481-
.linux_kernel_pgtable_iterator_next = linux_kernel_pgtable_iterator_next_s390x,
480+
.linux_kernel_pgtable_iterator_create =
481+
linux_kernel_pgtable_iterator_create_s390x,
482+
.linux_kernel_pgtable_iterator_destroy =
483+
linux_kernel_pgtable_iterator_destroy_s390x,
484+
.linux_kernel_pgtable_iterator_init =
485+
linux_kernel_pgtable_iterator_init_s390x,
486+
.linux_kernel_pgtable_iterator_next =
487+
linux_kernel_pgtable_iterator_next_s390x,
482488
};
483489

484490
const struct drgn_architecture_info arch_info_s390 = {

tests/linux_kernel/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def setUpClass(cls):
9191
"DRGN_TEST_KMOD" in os.environ, "test requires drgn_test Linux kernel module"
9292
)
9393

94-
HAVE_FULL_MM_SUPPORT = NORMALIZED_MACHINE_NAME in ("aarch64", "x86_64")
94+
HAVE_FULL_MM_SUPPORT = NORMALIZED_MACHINE_NAME in ("aarch64", "s390x", "x86_64")
9595

9696
skip_unless_have_full_mm_support = unittest.skipUnless(
9797
HAVE_FULL_MM_SUPPORT,

0 commit comments

Comments
 (0)