qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: Ani Sinha <anisinha@redhat.com>, Cleber Rosa <crosa@redhat.com>,
	Wainer dos Santos Moschetta <wainersm@redhat.com>,
	Beraldo Leal <bleal@redhat.com>
Cc: imammedo@redhat.com, David Hildenbrand <david@redhat.com>,
	qemu-devel@nongnu.org
Subject: Re: [PATCH v6] tests/avocado: add test to exercize processor address space memory bound checks
Date: Thu, 9 Nov 2023 09:19:38 +0100	[thread overview]
Message-ID: <ec2e70ef-1604-4c34-ab36-5449e613ecd1@linaro.org> (raw)
In-Reply-To: <20231109045601.33349-1-anisinha@redhat.com>

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.

Then I can queue this patch.

Thanks,

Phil.


  reply	other threads:[~2023-11-09  8:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-09  4:56 [PATCH v6] tests/avocado: add test to exercize processor address space memory bound checks Ani Sinha
2023-11-09  8:19 ` Philippe Mathieu-Daudé [this message]
2023-11-09  8:42   ` Ani Sinha

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ec2e70ef-1604-4c34-ab36-5449e613ecd1@linaro.org \
    --to=philmd@linaro.org \
    --cc=anisinha@redhat.com \
    --cc=bleal@redhat.com \
    --cc=crosa@redhat.com \
    --cc=david@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=wainersm@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).