All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zhao Liu <zhao1.liu@intel.com>
To: Kirill Martynov <stdcalllevi@yandex-team.ru>
Cc: qemu-devel@nongnu.org, Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [PATCH] x86/cpu: Handle SMM mode in x86_cpu_dump_state for softmmu
Date: Wed, 2 Jul 2025 11:17:42 +0800	[thread overview]
Message-ID: <aGSk1tiqq7F0+CTr@intel.com> (raw)
In-Reply-To: <20250523154431.506993-1-stdcalllevi@yandex-team.ru>

On Fri, May 23, 2025 at 03:44:31PM +0000, Kirill Martynov wrote:
> Date: Fri, 23 May 2025 15:44:31 +0000
> From: Kirill Martynov <stdcalllevi@yandex-team.ru>
> Subject: [PATCH] x86/cpu: Handle SMM mode in x86_cpu_dump_state for softmmu
> X-Mailer: git-send-email 2.43.0
> 
> Certain error conditions can trigger x86_cpu_dump_state() to output CPU state
> debug information e.g. KVM emulation failure due to misbehaving guest.
> However, if the CPU is in System Management Mode (SMM) when the assertion
> in cpu_asidx_from_attrs failure happens because:
> 
> 1. In SMM mode (smm=1), the CPU must use multiple address spaces
>    with a dedicated SMM address space
> 2. On machine types with softmmu, address spaces are hardcoded to 1
>    (no multiple address spaces available)
> 
> The assertion occurs in cpu_asidx_from_attrs() when trying to
> access memory in SMM mode with insufficient address spaces.
> 
> Fix this by:
> 1. If number of address spaces is 1 always use index 0
> 2. In other cases use attr.secure for identified proper index
> 
> This prevents the assertion while still providing useful debug
> output during VM shutdown errors.
> 
> Stack trace of the original issue:
> #0  ... in raise () from /lib/x86_64-linux-gnu/libc.so.6
> #1  ... in abort () from /lib/x86_64-linux-gnu/libc.so.6
> #2  ... in ?? () from /lib/x86_64-linux-gnu/libc.so.6
> #3  ... in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
> #4  ... in cpu_asidx_from_attrs (cpu=cpu@entry=0x5578ca2eb340, attrs=...)
>    at ../hw/core/cpu-sysemu.c:76
> #5  ... in cpu_memory_rw_debug (cpu=cpu@entry=0x5578ca2eb340,
>    addr=addr@entry=2147258348, ptr=ptr@entry=0x7f5341ca373c, len=len@entry=1,
>     is_write=is_write@entry=false) at ../softmmu/physmem.c:3529
> #6  ... in x86_cpu_dump_state (cs=0x5578ca2eb340,
>    f=0x7f53434065c0 <_IO_2_1_stderr_>, flags=<optimized out>)
>    at ../target/i386/cpu-dump.c:560
> #7  ... in kvm_cpu_exec (cpu=cpu@entry=0x5578ca2eb340)
>    at ../accel/kvm/kvm-all.c:3000
> #8  ... in kvm_vcpu_thread_fn (arg=arg@entry=0x5578ca2eb340)
>    at ../accel/kvm/kvm-accel-ops.c:51
> #9  ... in qemu_thread_start (args=<optimized out>)
>    at ../util/qemu-thread-posix.c:505
> #10 ... in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
> #11 ... in clone () from /lib/x86_64-linux-gnu/libc.so.6
> 
> Signed-off-by: Kirill Martynov <stdcalllevi@yandex-team.ru>
> ---
>  target/i386/cpu.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Sorry for delay. This fix looks good to me,

Reviewed-by: Zhao Liu <zhao1.liu@intel.com>



  parent reply	other threads:[~2025-07-02  2:57 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-23 15:44 [PATCH] x86/cpu: Handle SMM mode in x86_cpu_dump_state for softmmu Kirill Martynov
2025-06-17  6:50 ` Kirill Martynov
2025-07-02  3:17 ` Zhao Liu [this message]
2025-07-02 14:16 ` Xiaoyao Li
2025-07-02 15:10   ` Xiaoyao Li
2025-07-02 16:24     ` Xiaoyao Li
2025-07-03  9:25       ` Kirill Martynov
2025-07-03 12:53         ` Xiaoyao Li
2025-07-04  8:20           ` Zhao Liu
2025-07-04 13:50             ` Xiaoyao Li
2025-07-28 14:44               ` Kirill Martynov
2025-07-28 16:19                 ` Zhao Liu
2025-07-29  6:01                   ` Xiaoyao Li
2025-07-29  8:36                     ` Kirill Martynov

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=aGSk1tiqq7F0+CTr@intel.com \
    --to=zhao1.liu@intel.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stdcalllevi@yandex-team.ru \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.