whpx: i386: documentation and demoting some warnings
v3 cover whpx: i386: documentation and demoting some warnings
Demoting some warnings that appeared too often to traces and adding some documentation.
Mohamed Mediouni (3):
docs: add WHPX section with initial info target/i386: emulate: make unmapped GPA warnings a trace
whpx: i386: trace unsupported MSR accesses
MAINTAINERS | 1 + docs/system/index.rst | 1 + docs/system/whpx.rst | 144 +++++++++++++++++++++++++++++++ meson.build | 2 + target/i386/emulate/trace-events | 2 + target/i386/emulate/trace.h | 2 + target/i386/emulate/x86_mmu.c | 5 +- target/i386/whpx/trace-events | 1 + target/i386/whpx/trace.h | 2 + target/i386/whpx/whpx-all.c | 5 +- 10 files changed, 161 insertions(+), 4 deletions(-) create mode 100644 docs/system/whpx.rst create mode 100644 target/i386/emulate/trace-events create mode 100644 target/i386/emulate/trace.h create mode 100644 target/i386/whpx/trace-events create mode 100644 target/i386/whpx/trace.h
Signature · 1 line
2.50.1 (Apple Git-155)
PATCH v3 1/3 docs: add WHPX section with initial info
--- MAINTAINERS | 1 + docs/system/index.rst | 1 + docs/system/whpx.rst | 144 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 146 insertions(+) create mode 100644 docs/system/whpx.rst
MAINTAINERS +1 -0
@@ -582,6 +582,7 @@ F: include/system/whpx.h F: include/system/whpx-accel-ops.h F: include/system/whpx-common.h F: include/system/whpx-internal.h +F: docs/system/whpx.rst MSHV M: Magnus Kulke <[email protected]>
docs/system/index.rst +1 -0
@@ -40,6 +40,7 @@ or Hypervisor.Framework. confidential-guest-support igvm nitro + whpx vm-templating sriov qemu-colo
docs/system/whpx.rst new file +144 -0
144 lines not on this page · raw message
Signature · 1 line
2.50.1 (Apple Git-155)
PATCH v3 2/3 target/i386: emulate: make unmapped GPA warnings a trace
In reply to Mohamed MediouniSome guest OSes trigger them way too often.
--- meson.build | 1 + target/i386/emulate/trace-events | 2 ++ target/i386/emulate/trace.h | 2 ++ target/i386/emulate/x86_mmu.c | 5 +++-- 4 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 target/i386/emulate/trace-events create mode 100644 target/i386/emulate/trace.h
meson.build +1 -0
@@ -3691,6 +3691,7 @@ if have_system or have_user 'target/arm/hvf', 'target/hppa', 'target/i386', + 'target/i386/emulate', 'target/i386/kvm', 'target/loongarch', 'target/mips/tcg',
target/i386/emulate/trace-events new file +2 -0
@@ -0,0 +1,2 @@ +x86_unhandled_memory_read(uint64_t gpa, int bytes) "read from unmapped mmio region gpa=0x%" PRIx64 " size=%i" +x86_unhandled_memory_write(uint64_t gpa, int bytes) "write to unmapped mmio region gpa=0x%" PRIx64 " size=%i"
target/i386/emulate/trace.h new file +2 -0
@@ -0,0 +1,2 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +#include "trace/trace-target_i386_emulate.h"
target/i386/emulate/x86_mmu.c +3 -2
@@ -25,6 +25,7 @@#include "emulate/x86.h" #include "emulate/x86_emu.h" #include "emulate/x86_mmu.h" +#include "trace.h" #define pte_present (pte) (pte & PT_PRESENT)#define pte_write_access (pte) (pte & PT_WRITE)
@@ -287,7 +288,7 @@ static MMUTranslateResult x86_write_mem_ex(CPUState *cpu, void *data, target_ulo MEMTXATTRS_UNSPECIFIED, data, copy);if (mem_tx_res ==MEMTX_DECODE_ERROR ) { -warn_report ("write to unmapped mmio region gpa=0x%" PRIx64" size=%i" , gpa, bytes); +trace_x86_unhandled_memory_write (gpa, bytes);return MMU_TRANSLATE_GPA_UNMAPPED ; }else if (mem_tx_res ==MEMTX_ACCESS_ERROR ) {return MMU_TRANSLATE_GPA_NO_WRITE_ACCESS ;
@@ -339,7 +340,7 @@ static MMUTranslateResult x86_read_mem_ex(CPUState *cpu, void *data, target_ulon data, copy);if (mem_tx_res ==MEMTX_DECODE_ERROR ) { -warn_report ("read from unmapped mmio region gpa=0x%" PRIx64" size=%i" , gpa, bytes); +trace_x86_unhandled_memory_read (gpa, bytes);return MMU_TRANSLATE_GPA_UNMAPPED ; }else if (mem_tx_res ==MEMTX_ACCESS_ERROR ) {return MMU_TRANSLATE_GPA_NO_READ_ACCESS ;
Signature · 1 line
2.50.1 (Apple Git-155)
Re: [PATCH v3 2/3] target/i386: emulate: make unmapped GPA warnings a trace
Quoted 12 lines · Mohamed Mediouni
Some guest OSes trigger them way too often.
Signed-off-by Mohamed Mediouni <[email protected]>--- meson.build | 1 + target/i386/emulate/trace-events | 2 ++ target/i386/emulate/trace.h | 2 ++ target/i386/emulate/x86_mmu.c | 5 +++-- 4 files changed, 8 insertions(+), 2 deletions(-)create mode 100644 target/i386/emulate/trace-events create mode 100644
target/i386/emulate/trace.h
To justify the change, it could help if you could add a better commit description explaining:
- which OSes are concerned (older windows?)
- analysis why they do such a thing (at least see some QEMU backtraces when this happen).
From what I see, this code is triggered either from hvf, or when running an ins instruction, so you could explain which scenario you're covering.
Finally, this change is quite unrelated to whpx, which can be a bit confusing giving the initial intent of your series.
In case it might help you, git update-refs [1] is a great solution for working with stacked branches/series, without the pain of having to deal with multiple branches.
[1] https://dev.to/onepoint/git-update-refs-in-a-nutshell-574c
Regards,
Pierrick
Re: [PATCH v3 2/3] target/i386: emulate: make unmapped GPA warnings a trace
Quoted 16 lines · Pierrick Bouvier
Quoted 10 lines · Mohamed Mediouni
Some guest OSes trigger them way too often.
Signed-off-by Mohamed Mediouni <[email protected]>--- meson.build | 1 + target/i386/emulate/trace-events | 2 ++ target/i386/emulate/trace.h | 2 ++ target/i386/emulate/x86_mmu.c | 5 +++-- 4 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 target/i386/emulate/trace-events create mode 100644 target/i386/emulate/trace.h
Quoted 3 lines
To justify the change, it could help if you could add a better commit description explaining:
- which OSes are concerned (older windows?)
- analysis why they do such a thing (at least see some QEMU backtraces when this happen).
Hello,
Neither Windows or Linux are concerned by this one, but the ReactOS install ISO - among some other more rare OSes - trigger it.
Intriguingly, the ReactOS live ISO doesn’t trigger it.
Quoted 2 lines
From what I see, this code is triggered either from hvf, or when running an ins instruction, so you could explain which scenario you're covering.
WHPX has been moved to target/i386/emulate for 11.0, it’s no longer using winhvemulation.
And that means that it’s a load bearing path through which load/stores on every MMIO access by an emulated instruction goes through. And even reading part of the instruction itself if Hyper-V doesn’t give a complete one.
Thanks,
-Mohamed
Re: [PATCH v3 2/3] target/i386: emulate: make unmapped GPA warnings a trace
Quoted 19 lines · Mohamed Mediouni
Quoted 16 lines · Pierrick Bouvier
Quoted 10 lines · Mohamed Mediouni
Some guest OSes trigger them way too often.
Signed-off-by Mohamed Mediouni <[email protected]>--- meson.build | 1 + target/i386/emulate/trace-events | 2 ++ target/i386/emulate/trace.h | 2 ++ target/i386/emulate/x86_mmu.c | 5 +++-- 4 files changed, 8 insertions(+), 2 deletions(-)create mode 100644 target/i386/emulate/trace-events create mode 100644
target/i386/emulate/trace.hQuoted 3 lines
To justify the change, it could help if you could add a better commit description explaining:
- which OSes are concerned (older windows?)
- analysis why they do such a thing (at least see some QEMU backtraces when this happen).
Quoted 7 lines
Hello,
Neither Windows or Linux are concerned by this one, but the ReactOS install ISO - among some other more rare OSes - trigger it.
Intriguingly, the ReactOS live ISO doesn’t trigger it.
Might be a good idea to report that to them, as it seems like something wrong is going on, which was the point of having this (loud) warning in the first place.
Quoted 11 lines
Quoted 2 lines
From what I see, this code is triggered either from hvf, or when running an ins instruction, so you could explain which scenario you're covering.
WHPX has been moved to target/i386/emulate for 11.0, it’s no longer using winhvemulation.
And that means that it’s a load bearing path through which load/stores on every MMIO access by an emulated instruction goes through. And even reading part of the instruction itself if Hyper-V doesn’t give a complete one.
I see.
In this case, maybe a better compromise than using custom trace events would be to make it visible when using -d guest_errors. The problem is that custom trace events are hidden for users, and except if you know it exists, it's impossible to guess it's there.
On the opposite, -d guest_errors can be discovered by someone curious with qemu-system-x86_64 -d help, and it's the same flag for all architectures.
Quoted 3 lines
Thanks,
-Mohamed
Regards,
Pierrick
PATCH v3 3/3 whpx: i386: trace unsupported MSR accesses
In reply to Mohamed MediouniNot actionable information for users, so stop
having it displayed unconditionally.
--- meson.build | 1 + target/i386/whpx/trace-events | 1 + target/i386/whpx/trace.h | 2 ++ target/i386/whpx/whpx-all.c | 5 +++-- 4 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 target/i386/whpx/trace-events create mode 100644 target/i386/whpx/trace.h
meson.build +1 -0
@@ -3693,6 +3693,7 @@ if have_system or have_user 'target/i386', 'target/i386/emulate', 'target/i386/kvm', + 'target/i386/whpx', 'target/loongarch', 'target/mips/tcg', 'target/ppc',
target/i386/whpx/trace-events new file +1 -0
@@ -0,0 +1 @@ +whpx_unsupported_msr_access(uint32_t msr, int is_write) "WHPX: Unsupported MSR access (0x%x), IsWrite=%i"
target/i386/whpx/trace.h new file +2 -0
@@ -0,0 +1,2 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +#include "trace/trace-target_i386_whpx.h"
target/i386/whpx/whpx-all.c +3 -2
@@ -41,6 +41,7 @@#include "emulate/x86_emu.h" #include "emulate/x86_flags.h" #include "emulate/x86_mmu.h" +#include "trace.h" #include <winhvplatform.h>
@@ -1921,8 +1922,8 @@ int whpx_vcpu_run(CPUState *cpu) 1 : 3;if (!is_known_msr) { -warn_report ("WHPX: Unsupported MSR access (0x%x), IsWrite=%i" , - vcpu->exit_ctx.MsrAccess.MsrNumber, vcpu->exit_ctx.MsrAccess.AccessInfo.IsWrite); +trace_whpx_unsupported_msr_access (vcpu->exit_ctx.MsrAccess.MsrNumber, + vcpu->exit_ctx.MsrAccess.AccessInfo.IsWrite); } hr = whp_dispatch.WHvSetVirtualProcessorRegisters(
Signature · 1 line
2.50.1 (Apple Git-155)
Re: [PATCH v3 3/3] whpx: i386: trace unsupported MSR accesses
Quoted 4 lines · Mohamed Mediouni
Not actionable information for users, so stop
having it displayed unconditionally.Signed-off-by Mohamed Mediouni <[email protected]>
Quoted 9 lines
--- meson.build | 1 + target/i386/whpx/trace-events | 1 + target/i386/whpx/trace.h | 2 ++ target/i386/whpx/whpx-all.c | 5 +++-- 4 files changed, 7 insertions(+), 2 deletions(-)create mode 100644 target/i386/whpx/trace-events create mode 100644
target/i386/whpx/trace.h