* [PATCH] Fix lttng-modules build failure on some versions of kernel
@ 2020-03-14 11:04 yanfei.xu
2020-03-14 11:20 ` Adrian Bunk
2020-03-14 11:32 ` ✗ patchtest: failure for " Patchwork
0 siblings, 2 replies; 3+ messages in thread
From: yanfei.xu @ 2020-03-14 11:04 UTC (permalink / raw)
To: openembedded-core
From: Yanfei Xu <yanfei.xu@windriver.com>
Fix lttng-modules build failure on some versions of the kernel that
between 4.19.103 and 4.20.0
between 5.4.19 and 5.5.0
between 5.5.3 and 5.6.0
greater than or equal to 5.6.0
---------Error messages-------------
build_default_image_feature_list8/intel-x86-64-standard-glibc-std-OE/build/tmp-glibc/work/intel_x86_64-wrs-linux/lttng-modules/2.11.1+gitAUTOINC+6ad0e68b43-r0/git/probes/lttng-probe-kvm-x86-mmu.c:39:
| /buildarea1/WRL1019_Regression/qemu_build/build_dir_nxt/intel-x86-64/03032007-build_default_image_feature_list8/intel-x86-64-standard-glibc-std-OE/build/tmp-glibc/work/intel_x86_64-wrs-linux/lttng-modules/2.11.1+gitAUTOINC+6ad0e68b43-r0/git/probes/../probes/lttng-tracepoint-event-impl.h:130:6: error: conflicting types for 'trace_fast_page_fault'
| 130 | void trace_##_name(_proto);
| | ^~~~~~
| /buildarea1/WRL1019_Regression/qemu_build/build_dir_nxt/intel-x86-64/03032007-build_default_image_feature_list8/intel-x86-64-standard-glibc-std-OE/build/tmp-glibc/work/intel_x86_64-wrs-linux/lttng-modules/2.11.1+gitAUTOINC+6ad0e68b43-r0/git/probes/../probes/lttng-tracepoint-event-impl.h:42:2: note: in expansion of macro 'LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP'
------------------------------------
Signed-off-by: Yanfei Xu <yanfei.xu@windriver.com>
---
...-Use-gpa_t-for-cr2-gpa-to-fix-TDP-support.patch | 97 ++++++++++++++++++++++
meta/recipes-kernel/lttng/lttng-modules_2.11.1.bb | 1 +
2 files changed, 98 insertions(+)
create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0001-fix-KVM-x86-Use-gpa_t-for-cr2-gpa-to-fix-TDP-support.patch
diff --git a/meta/recipes-kernel/lttng/lttng-modules/0001-fix-KVM-x86-Use-gpa_t-for-cr2-gpa-to-fix-TDP-support.patch b/meta/recipes-kernel/lttng/lttng-modules/0001-fix-KVM-x86-Use-gpa_t-for-cr2-gpa-to-fix-TDP-support.patch
new file mode 100644
index 0000000..1fd3609
--- /dev/null
+++ b/meta/recipes-kernel/lttng/lttng-modules/0001-fix-KVM-x86-Use-gpa_t-for-cr2-gpa-to-fix-TDP-support.patch
@@ -0,0 +1,97 @@
+From 175c0c3c2ee8aae7a1185f591988f02e0e3be103 Mon Sep 17 00:00:00 2001
+From: Michael Jeanson <mjeanson@efficios.com>
+Date: Tue, 11 Feb 2020 14:41:29 -0500
+Subject: [PATCH] fix: KVM: x86: Use gpa_t for cr2/gpa to fix TDP support on
+ 32-bit (v5.6)
+
+See upstream commit :
+
+ commit 736c291c9f36b07f8889c61764c28edce20e715d
+ Author: Sean Christopherson <sean.j.christopherson@intel.com>
+ Date: Fri Dec 6 15:57:14 2019 -0800
+
+ KVM: x86: Use gpa_t for cr2/gpa to fix TDP support on 32-bit KVM
+
+ Convert a plethora of parameters and variables in the MMU and page fault
+ flows from type gva_t to gpa_t to properly handle TDP on 32-bit KVM.
+
+ Thanks to PSE and PAE paging, 32-bit kernels can access 64-bit physical
+ addresses. When TDP is enabled, the fault address is a guest physical
+ address and thus can be a 64-bit value, even when both KVM and its guest
+ are using 32-bit virtual addressing, e.g. VMX's VMCS.GUEST_PHYSICAL is a
+ 64-bit field, not a natural width field.
+
+ Using a gva_t for the fault address means KVM will incorrectly drop the
+ upper 32-bits of the GPA. Ditto for gva_to_gpa() when it is used to
+ translate L2 GPAs to L1 GPAs.
+
+ Opportunistically rename variables and parameters to better reflect the
+ dual address modes, e.g. use "cr2_or_gpa" for fault addresses and plain
+ "addr" instead of "vaddr" when the address may be either a GVA or an L2
+ GPA. Similarly, use "gpa" in the nonpaging_page_fault() flows to avoid
+ a confusing "gpa_t gva" declaration; this also sets the stage for a
+ future patch to combing nonpaging_page_fault() and tdp_page_fault() with
+ minimal churn.
+
+ Sprinkle in a few comments to document flows where an address is known
+ to be a GVA and thus can be safely truncated to a 32-bit value. Add
+ WARNs in kvm_handle_page_fault() and FNAME(gva_to_gpa_nested)() to help
+ document such cases and detect bugs.
+
+Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
+Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+
+Upstream-Status: Backport [https://github.com/lttng/lttng-modules/commit/175c0c3c2ee8aae7a1185f591988f02e0e3be103]
+Signed-off-by: Yanfei Xu <yanfei.xu@windriver.com>
+
+---
+ .../lttng-module/arch/x86/kvm/mmutrace.h | 26 +++++++++++++++++++
+ 1 file changed, 26 insertions(+)
+
+diff --git a/instrumentation/events/lttng-module/arch/x86/kvm/mmutrace.h b/instrumentation/events/lttng-module/arch/x86/kvm/mmutrace.h
+index e25a774..dd0c679 100644
+--- a/instrumentation/events/lttng-module/arch/x86/kvm/mmutrace.h
++++ b/instrumentation/events/lttng-module/arch/x86/kvm/mmutrace.h
+@@ -214,6 +214,30 @@ LTTNG_TRACEPOINT_EVENT_MAP(
+ )
+ )
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0) || \
++ LTTNG_KERNEL_RANGE(4,19,103, 4,20,0) || \
++ LTTNG_KERNEL_RANGE(5,4,19, 5,5,0) || \
++ LTTNG_KERNEL_RANGE(5,5,3, 5,6,0))
++LTTNG_TRACEPOINT_EVENT_MAP(
++ fast_page_fault,
++
++ kvm_mmu_fast_page_fault,
++
++ TP_PROTO(struct kvm_vcpu *vcpu, gpa_t cr2_or_gpa, u32 error_code,
++ u64 *sptep, u64 old_spte, bool retry),
++ TP_ARGS(vcpu, cr2_or_gpa, error_code, sptep, old_spte, retry),
++
++ TP_FIELDS(
++ ctf_integer(int, vcpu_id, vcpu->vcpu_id)
++ ctf_integer(gpa_t, cr2_or_gpa, cr2_or_gpa)
++ ctf_integer(u32, error_code, error_code)
++ ctf_integer_hex(u64 *, sptep, sptep)
++ ctf_integer(u64, old_spte, old_spte)
++ ctf_integer(u64, new_spte, *sptep)
++ ctf_integer(bool, retry, retry)
++ )
++)
++#else
+ LTTNG_TRACEPOINT_EVENT_MAP(
+ fast_page_fault,
+
+@@ -233,6 +257,8 @@ LTTNG_TRACEPOINT_EVENT_MAP(
+ ctf_integer(bool, retry, retry)
+ )
+ )
++#endif
++
+ #endif /* LTTNG_TRACE_KVM_MMU_H */
+
+ #undef TRACE_INCLUDE_PATH
+--
+2.18.1
+
diff --git a/meta/recipes-kernel/lttng/lttng-modules_2.11.1.bb b/meta/recipes-kernel/lttng/lttng-modules_2.11.1.bb
index c833ff7..db0888a 100644
--- a/meta/recipes-kernel/lttng/lttng-modules_2.11.1.bb
+++ b/meta/recipes-kernel/lttng/lttng-modules_2.11.1.bb
@@ -11,6 +11,7 @@ COMPATIBLE_HOST = '(x86_64|i.86|powerpc|aarch64|mips|nios2|arm|riscv).*-linux'
SRC_URI = "https://lttng.org/files/${BPN}/${BPN}-${PV}.tar.bz2 \
file://Makefile-Do-not-fail-if-CONFIG_TRACEPOINTS-is-not-en.patch \
file://BUILD_RUNTIME_BUG_ON-vs-gcc7.patch \
+ file://0001-fix-KVM-x86-Use-gpa_t-for-cr2-gpa-to-fix-TDP-support.patch \
"
SRC_URI[md5sum] = "0d964723c8765b39835e5e6efc60a604"
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] Fix lttng-modules build failure on some versions of kernel
2020-03-14 11:04 [PATCH] Fix lttng-modules build failure on some versions of kernel yanfei.xu
@ 2020-03-14 11:20 ` Adrian Bunk
2020-03-14 11:32 ` ✗ patchtest: failure for " Patchwork
1 sibling, 0 replies; 3+ messages in thread
From: Adrian Bunk @ 2020-03-14 11:20 UTC (permalink / raw)
To: yanfei.xu; +Cc: openembedded-core
On Sat, Mar 14, 2020 at 07:04:03PM +0800, yanfei.xu@windriver.com wrote:
>...
> ...-Use-gpa_t-for-cr2-gpa-to-fix-TDP-support.patch | 97 ++++++++++++++++++++++
> meta/recipes-kernel/lttng/lttng-modules_2.11.1.bb | 1 +
> 2 files changed, 98 insertions(+)
>...
> +Upstream-Status: Backport [https://github.com/lttng/lttng-modules/commit/175c0c3c2ee8aae7a1185f591988f02e0e3be103]
>...
Could you submit an update to 2.11.2 instead?
This is a bugfix-only update that also fixes a dozen other issues.
Thanks
Adrian
^ permalink raw reply [flat|nested] 3+ messages in thread
* ✗ patchtest: failure for Fix lttng-modules build failure on some versions of kernel
2020-03-14 11:04 [PATCH] Fix lttng-modules build failure on some versions of kernel yanfei.xu
2020-03-14 11:20 ` Adrian Bunk
@ 2020-03-14 11:32 ` Patchwork
1 sibling, 0 replies; 3+ messages in thread
From: Patchwork @ 2020-03-14 11:32 UTC (permalink / raw)
To: yanfei.xu; +Cc: openembedded-core
== Series Details ==
Series: Fix lttng-modules build failure on some versions of kernel
Revision: 1
URL : https://patchwork.openembedded.org/series/23236/
State : failure
== Summary ==
Thank you for submitting this patch series to OpenEmbedded Core. This is
an automated response. Several tests have been executed on the proposed
series by patchtest resulting in the following failures:
* Patch Fix lttng-modules build failure on some versions of kernel
Issue Shortlog does not follow expected format [test_shortlog_format]
Suggested fix Commit shortlog (first line of commit message) should follow the format "<target>: <summary>"
If you believe any of these test results are incorrect, please reply to the
mailing list (openembedded-core@lists.openembedded.org) raising your concerns.
Otherwise we would appreciate you correcting the issues and submitting a new
version of the patchset if applicable. Please ensure you add/increment the
version number when sending the new version (i.e. [PATCH] -> [PATCH v2] ->
[PATCH v3] -> ...).
---
Guidelines: https://www.openembedded.org/wiki/Commit_Patch_Message_Guidelines
Test framework: http://git.yoctoproject.org/cgit/cgit.cgi/patchtest
Test suite: http://git.yoctoproject.org/cgit/cgit.cgi/patchtest-oe
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-03-14 11:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-03-14 11:04 [PATCH] Fix lttng-modules build failure on some versions of kernel yanfei.xu
2020-03-14 11:20 ` Adrian Bunk
2020-03-14 11:32 ` ✗ patchtest: failure for " Patchwork
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox