diff --git a/almost-d739260c57576c636759afb312340fa3827312f6.patch b/almost-d739260c57576c636759afb312340fa3827312f6.patch new file mode 100644 index 0000000000000000000000000000000000000000..af0fa3e4239431e5efb7aeb97c646a0fa45e67f7 --- /dev/null +++ b/almost-d739260c57576c636759afb312340fa3827312f6.patch @@ -0,0 +1,74 @@ +From d739260c57576c636759afb312340fa3827312f6 Mon Sep 17 00:00:00 2001 +From: Adrian Reber +Date: Mon, 24 Apr 2023 09:28:19 +0200 +Subject: [PATCH] compel: support XSAVE on newer Intel CPUs + +Newer Intel CPUs (Sapphire Rapids) have a much larger xsave area than +before. Looking at older CPUs I see 2440 bytes. + + # cpuid -1 -l 0xd -s 0 + ... + bytes required by XSAVE/XRSTOR area = 0x00000988 (2440) + +On newer CPUs (Sapphire Rapids) it grows to 11008 bytes. + + # cpuid -1 -l 0xd -s 0 + ... + bytes required by XSAVE/XRSTOR area = 0x00002b00 (11008) + +This increase the xsave area from one page to four pages. + +Without this patch the fpu03 test fails, with this patch it works again. + +Signed-off-by: Adrian Reber +--- + .../arch/x86/src/lib/include/uapi/asm/fpu.h | 28 +++++++++++++++++-- + 1 file changed, 26 insertions(+), 2 deletions(-) + +diff --git a/compel/arch/x86/src/lib/include/uapi/asm/fpu.h b/compel/arch/x86/src/lib/include/uapi/asm/fpu.h +index bd3b0cbd5c..8c83dd9ae4 100644 +--- a/compel/arch/x86/src/lib/include/uapi/asm/fpu.h ++++ b/compel/arch/x86/src/lib/include/uapi/asm/fpu.h +@@ -21,7 +21,28 @@ + #define XSTATE_YMM 0x4 + + #define FXSAVE_SIZE 512 +-#define XSAVE_SIZE 4096 ++/* ++ * This used to be 4096 (one page). There is a comment below concerning ++ * this size: ++ * "One page should be enough for the whole xsave state ;-)" ++ * Which is kind of funny as it is no longer enough ;-) ++ * ++ * Older CPUs: ++ * # cpuid -1 -l 0xd -s 0 ++ * ... ++ * bytes required by XSAVE/XRSTOR area = 0x00000988 (2440) ++ * ++ * Newer CPUs (Sapphire Rapids): ++ * # cpuid -1 -l 0xd -s 0 ++ * ... ++ * bytes required by XSAVE/XRSTOR area = 0x00002b00 (11008) ++ * ++ * So one page is no longer enough... But: ++ * ++ * Four pages should be enough for the whole xsave state ;-) ++ */ ++ ++#define XSAVE_SIZE 4*4096 + + #define XSAVE_HDR_SIZE 64 + #define XSAVE_HDR_OFFSET FXSAVE_SIZE +@@ -233,8 +254,11 @@ struct pkru_state { + * + * + * One page should be enough for the whole xsave state. ++ * ++ * Of course it was not ;-) Now using four pages... ++ * + */ +-#define EXTENDED_STATE_AREA_SIZE (4096 - sizeof(struct i387_fxsave_struct) - sizeof(struct xsave_hdr_struct)) ++#define EXTENDED_STATE_AREA_SIZE (XSAVE_SIZE - sizeof(struct i387_fxsave_struct) - sizeof(struct xsave_hdr_struct)) + + /* + * cpu requires it to be 64 byte aligned diff --git a/criu.spec b/criu.spec index 7ab176f66193c49913276ed0a0f1085bc558482c..d682762a2ff7b16f797fd86fa466dd6f6062de1f 100644 --- a/criu.spec +++ b/criu.spec @@ -8,7 +8,7 @@ Name: criu Version: 3.15 -Release: 3.%{anolis_release}%{?dist} +Release: 4.%{anolis_release}%{?dist} Provides: crtools = %{version}-%{release} Obsoletes: crtools <= 1.0-2 Summary: Tool for Checkpoint/Restore in User-space @@ -16,10 +16,11 @@ License: GPLv2 URL: http://criu.org/ Source0: http://download.openvz.org/criu/criu-%{version}.tar.bz2 Source1: criu-tmpfiles.conf +# Fix to work on CPUs with larger XSAVE area (Sapphire Rapids) +# backported to CRIU 3.15 +Patch0: almost-d739260c57576c636759afb312340fa3827312f6.patch -# patches: Patch901: port-to-LoongArch64.patch - BuildRequires: gcc BuildRequires: systemd BuildRequires: libnet-devel @@ -77,6 +78,7 @@ their content in human-readable form. %prep %setup -q +%patch -P 0 -p1 %patch901 -p1 @@ -123,9 +125,13 @@ rm -rf $RPM_BUILD_ROOT%{_libexecdir}/%{name} %doc %{_mandir}/man1/crit.1* %changelog -* Thu Jul 14 2022 merore - 3.15-3.0.1 +* Fri Sep 01 2023 merore - 3.15-4.0.1 - add loongarch64 support +* Fri Jun 09 2023 Adrian Reber - 3.15.4 +- added patch to support CRIU on Sapphire Rapids +- Resolves: #2203296 + * Fri Aug 06 2021 Jindrich Novy - 3.15-3 - add Requires: criu-libs = %%{version}-%%{release} in criu-devel - add gating tests