Skip to content

Observed issues in amd/iommu_v2pgmode_test.py test #1

@AMD-Muthukumar-S

Description

@AMD-Muthukumar-S

Describe the bug

  • We are aware that this test currently checks for Level 5 paging, even though our system only supports up to Level 4 paging.
  • Please add support for Level 4 paging in this test.

Environment

  • Platform: Bare Metal (BM) host with Nutanix AHV
[root@NTNX-TITANITE-34B6-A ~]# cat /etc/os-release
NAME="Nutanix AHV"
VERSION="10.3 (enif)"
VERSION_ID="10.3"
VERSION_CODENAME="enif"
ID="ahv"
ID_LIKE="rhel fedora"
PRETTY_NAME="AHV 10.3 (enif)"
ANSI_COLOR="0;35"
HOME_URL=https://www.nutanix.com/
SUPPORT_URL=https://portal.nutanix.com/
VENDOR_NAME="Nutanix"
NUTANIX_AHV_BUILD_ID="422"
NUTANIX_AHV_GIT_HASH="a70725a92"
[root@NTNX-TITANITE-34B6-A ~]# uname -r
6.6.52-10.3s5c15r5.el8.x86_64
[root@NTNX-TITANITE-34B6-A ~]#

Steps to reproduce

  • Please check the dmesg log.

My system supports 4 Level page table:

[root@NTNX-TITANITE-34B6-A ~]# dmesg | grep -i "V2 page table enabled"
[    2.308726] AMD-Vi: V2 page table enabled (Paging mode : 4 level)
[root@NTNX-TITANITE-34B6-A ~]#
[root@NTNX-TITANITE-34B6-A ~]# grep "address sizes" /proc/cpuinfo
address sizes   : 46 bits physical, 57 bits virtual
address sizes   : 46 bits physical, 57 bits virtual
address sizes   : 46 bits physical, 57 bits virtual

Expected behavior
self.bits_to_pgmode = {'57': '5', '48': '4', '39': '3', '30': '2', '21': '1'}

Debug print lines added in the test:

def test(self):
        '''
        Test if host page table mode matches with iommu v2 page table mode
        '''
        if check_dmesg('V2 page table enabled'):
            if (cpu.cpu_has_flags(["la57"]) and self.check_kernelconf_5lvl()):
                if check_v2pgtbl_mode("5"):  Dynamic function call  cpu.get_va_bits()
                    self.log.info("Host page table mode (5lvl) match with IOMMU V2 Page mode")
                else:
                    self.fail("Host page table mode (5lvl) does not match with IOMMU V2 Paging mode")
            else:
                self.log.info(f"VA={cpu.get_va_bits()}")  ==> Time stamp= 06:29:12,258
                self.log.info(f"Value1: {self.bits_to_pgmode[cpu.get_va_bits()]}") ==> Time stamp= 06:29:12,260
                self.log.info(f"Value2: {check_v2pgtbl_mode(self.bits_to_pgmode[cpu.get_va_bits()])}") ==> Time stamp= 06:29:12,325

                if check_v2pgtbl_mode(self.bits_to_pgmode[cpu.get_va_bits()]):
                    self.log.info("Host page table mode match with IOMMU V2 Page mode")
                else:
                    self.fail("Host page table mode does does not match with IOMMU V2 Paging mode")
        else:
            self.cancel("IOMMU is in v1 page table")

From Debug log: /root/elves/results/job-2025-07-30T06.29-2bc066f/test-results/1-_root_elves_tests_avocado-misc-tests_io_iommu_amd_iommu_v2pgmode_test.py_IommuPageTable.test/debug.log

[stdlog] 2025-07-30 06:29:12,258 avocado.test iommu_v2pgmode_t L0122 INFO | VA=57
[stdlog] 2025-07-30 06:29:12,260 avocado.test iommu_v2pgmode_t L0123 INFO | Value1: 5
[stdlog] 2025-07-30 06:29:12,261 avocado.utils.process process          L0662 INFO | Running 'dmesg | grep -i "V2 page table enabled (Paging mode : 5 level)"'
[stdlog] 2025-07-30 06:29:12,261 avocado.utils.process process          L0711 INFO | Command dmesg | grep -i "V2 page table enabled (Paging mode : 5 level)" running on a thread
[stdlog] 2025-07-30 06:29:12,276 avocado.utils.process process          L0719 INFO | Command 'dmesg | grep -i "V2 page table enabled (Paging mode : 5 level)"' finished with 1 after 0.014709414s
[stdlog] 2025-07-30 06:29:12,276 avocado.utils.process process          L0662 INFO | Running 'journalctl -k -b | grep -i "V2 page table enabled (Paging mode : 5 level)"'
[stdlog] 2025-07-30 06:29:12,277 avocado.utils.process process          L0711 INFO | Command journalctl -k -b | grep -i "V2 page table enabled (Paging mode : 5 level)" running on a thread
[stdlog] 2025-07-30 06:29:12,325 avocado.utils.process process          L0719 INFO | Command 'journalctl -k -b | grep -i "V2 page table enabled (Paging mode : 5 level)"' finished with 1 after 0.048514932s
[stdlog] 2025-07-30 06:29:12,325 avocado.test iommu_v2pgmode_t L0124 INFO | Value2: False

Investigation:
https://github.com/AMDESE/avocado-misc-tests/blob/AMD_elves/io/iommu/amd/iommu_v2pgmode_test.py#L122

Root Cause:

Code Snippet:

def get_va_bits():
    """
    Check for VA address bit size in /proc/cpuinfo

    :return: VA address bit size
    :rtype: str
    """
    cpu_info = genio.read_file("/proc/cpuinfo")
    for line in cpu_info.splitlines():
        if "address sizes" in line:
            return line.split()[-3].strip()    is "57"
    return ""            
  • cat proc/cpuinfo Returns:
address sizes   : 46 bits physical, 57 bits virtual

Code Snippet:

def check_v2pgtbl_mode(mode):
    '''
    Check if v2 page table is enabled in "mode" level of paging
    '''
    return check_dmesg(f'V2 page table enabled (Paging mode : {mode} level)')

Causing point:
In Above Function:

  • check_dmesg(f'V2 page table enabled (Paging mode : {mode} level)')
  • Here expected value should be "4" (Physical address size) based on actual IOMMU log, but we are incorrectly comparing it with “5” (derived from Virtual address size)

Current behavior
In the test:

  • check_v2pgtbl_mode(self.bits_to_pgmode[cpu.get_va_bits()])  returned False
  • The final test result is FAIL: Host page table mode does does not match with IOMMU V2 Paging mode (0.21 s)

System information

  • Platform: Bare Metal (BM)

  • OS: Nutanix AOS/AHV

  • Kernel: 6.6.52

  • Elves tag/branch/version: elves_05_2025 branch]

  • Hardware platform: AMD EPYC 9575F 64-Core Processor - Titanite

Additional information

  • Debug log:
    Dmesg output:
[root@NTNX-TITANITE-34B6-A ~]# dmesg | grep -i "V2 page table enabled"
[    2.308726] AMD-Vi: V2 page table enabled (Paging mode : 4 level)

Console Log:

[root@NTNX-TITANITE-34B6-A elves]# python3 ./avocado-setup.py --nrunner --run-tests avocado-misc-tests/io/iommu/amd/iommu_v2pgmode_test.py  --no-download
06:29:09 INFO    : Env Config: /root/elves/config/wrapper/env.conf
06:29:09 INFO    : No Run Config: /root/elves/config/wrapper/no_run_tests.conf
06:29:10 INFO    : Check for environment
06:29:10 INFO    : Creating temporary mux dir
06:29:10 INFO    :
06:29:10 INFO    : Running Host Tests Suite dynamic_test_suite_dynamic_test_suite
06:29:10 INFO    : Running: /usr/local/bin/avocado run   /root/elves/tests/avocado-misc-tests/io/iommu/amd/iommu_v2pgmode_test.py --force-job-id 2bc066fb7f6caa6c8ab719388c84cf9aaa4d7515                  --job-results-dir /root/elves/results
JOB ID     : 2bc066fb7f6caa6c8ab719388c84cf9aaa4d7515
JOB LOG    : /root/elves/results/job-2025-07-30T06.29-2bc066f/job.log
(1/1) /root/elves/tests/avocado-misc-tests/io/iommu/amd/iommu_v2pgmode_test.py:IommuPageTable.test: STARTED
(1/1) /root/elves/tests/avocado-misc-tests/io/iommu/amd/iommu_v2pgmode_test.py:IommuPageTable.test: FAIL: Host page table mode does does not match with IOMMU V2 Paging mode (0.21 s)
RESULTS    : PASS 0 | ERROR 0 | FAIL 1 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0
JOB HTML   : /root/elves/results/job-2025-07-30T06.29-2bc066f/results.html
JOB TIME   : 192.52 s

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions