[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v6] tests/avocado: add test to exercize processor address spa
|
From: |
Ani Sinha |
|
Subject: |
Re: [PATCH v6] tests/avocado: add test to exercize processor address space memory bound checks |
|
Date: |
Thu, 9 Nov 2023 14:12:43 +0530 |
> On 09-Nov-2023, at 1:49 PM, Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
>
> On 9/11/23 05:56, Ani Sinha wrote:
>> QEMU has validations to make sure that a VM is not started with more memory
>> (static and hotpluggable memory) than what the guest processor can address
>> directly with its addressing bits. This change adds a test to make sure QEMU
>> fails to start with a specific error message when an attempt is made to
>> start a VM with more memory than what the processor can directly address.
>> The test also checks for passing cases when the address space of the
>> processor
>> is capable of addressing all memory. Boundary cases are tested.
>> CC: imammedo@redhat.com
>> CC: David Hildenbrand <david@redhat.com>
>> Acked-by: David Hildenbrand <david@redhat.com>
>> Acked-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>> Signed-off-by: Ani Sinha <anisinha@redhat.com>
>> ---
>> tests/avocado/mem-addr-space-check.py | 367 ++++++++++++++++++++++++++
>> 1 file changed, 367 insertions(+)
>> create mode 100644 tests/avocado/mem-addr-space-check.py
>> Changelog:
>> v6: added phil's suggestions - added comment to explain why a sleep delay
>> is needed. Reduced delay to 1 sec. Added a one place definition for
>> the sleep duration so we can tweak it if needed later. Added phil's
>> tag. rebased.
>> v5:
>> - made the negative test cases (ones that do not result in QEMU crash)
>> more robust by checking the non-existence of the "phys-bits too low"
>> log.
>> - added a new test case for AMD HT window where QEMU starts fine.
>> - rebased.
>> - cosmetic typo/comment adjustments.
>> Tests all pass:
>> $ ./pyvenv/bin/avocado run tests/avocado/mem-addr-space-check.py --tap -
>> 1..15
>> ok 1
>> tests/avocado/mem-addr-space-check.py:MemAddrCheck.test_phybits_low_pse36
>> ok 2 tests/avocado/mem-addr-space-check.py:MemAddrCheck.test_phybits_low_pae
>> ok 3
>> tests/avocado/mem-addr-space-check.py:MemAddrCheck.test_phybits_ok_pentium_pse36
>> ok 4
>> tests/avocado/mem-addr-space-check.py:MemAddrCheck.test_phybits_ok_pentium_pae
>> ok 5
>> tests/avocado/mem-addr-space-check.py:MemAddrCheck.test_phybits_ok_pentium2
>> ok 6
>> tests/avocado/mem-addr-space-check.py:MemAddrCheck.test_phybits_low_nonpse36
>> ok 7
>> tests/avocado/mem-addr-space-check.py:MemAddrCheck.test_phybits_low_tcg_q35_70_amd
>> ok 8
>> tests/avocado/mem-addr-space-check.py:MemAddrCheck.test_phybits_low_tcg_q35_71_amd
>> ok 9
>> tests/avocado/mem-addr-space-check.py:MemAddrCheck.test_phybits_ok_tcg_q35_70_amd
>> ok 10
>> tests/avocado/mem-addr-space-check.py:MemAddrCheck.test_phybits_ok_tcg_q35_71_amd
>> ok 11
>> tests/avocado/mem-addr-space-check.py:MemAddrCheck.test_phybits_ok_tcg_q35_71_intel
>> ok 12
>> tests/avocado/mem-addr-space-check.py:MemAddrCheck.test_phybits_low_tcg_q35_71_amd_41bits
>> ok 13
>> tests/avocado/mem-addr-space-check.py:MemAddrCheck.test_phybits_ok_tcg_q35_71_amd_41bits
>> ok 14
>> tests/avocado/mem-addr-space-check.py:MemAddrCheck.test_phybits_low_tcg_q35_intel_cxl
>> ok 15
>> tests/avocado/mem-addr-space-check.py:MemAddrCheck.test_phybits_ok_tcg_q35_intel_cxl
>> v4: incorporated changes related to suggestions from David.
>> v3: added pae tests as well.
>> v2: added 64-bit tests. Added cxl tests.
>> diff --git a/tests/avocado/mem-addr-space-check.py
>> b/tests/avocado/mem-addr-space-check.py
>> new file mode 100644
>> index 0000000000..fae7d48598
>> --- /dev/null
>> +++ b/tests/avocado/mem-addr-space-check.py
>> @@ -0,0 +1,367 @@
>> +# Check for crash when using memory beyond the available guest processor
>> +# address space.
>> +#
>> +# Copyright (c) 2023 Red Hat, Inc.
>> +#
>> +# Author:
>> +# Ani Sinha <anisinha@redhat.com>
>> +#
>
> [*]
>
>> +# This program is free software; you can redistribute it and/or modify
>> +# it under the terms of the GNU General Public License as published by
>> +# the Free Software Foundation; either version 2 of the License, or
>> +# (at your option) any later version.
>> +#
>> +# This program is distributed in the hope that it will be useful,
>> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
>> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
>> +# GNU General Public License for more details.
>> +#
>> +# You should have received a copy of the GNU General Public License
>> +# along with this program. If not, see <http://www.gnu.org/licenses/>.
>> +
>> +from avocado_qemu import QemuSystemTest
>> +import signal
>> +import time
>> +
>> +class MemAddrCheck(QemuSystemTest):
>> + # after launch, in order to generate the logs from QEMU we need to
>> + # wait for some time. Launching and then immediately shutting down
>> + # the VM generates empty logs. A delay of 1 second is added for
>> + # this reason.
>> + DELAY_Q35_BOOT_SEQUENCE = 1
>
> Perfect, thank you!
>
> Do you mind if I add in [*]:
>
> # SPDX-License-Identifier: GPL-2.0-or-later
>
> ? Optionally removing the boilerplate license comment if you offer to.
Sure, no worries.
>
> Then I can queue this patch.
>
> Thanks,
>
> Phil.