December 30, 2019 6:44 PM, "qubes123" <dm1.libe...@gmail.com> wrote:

> Answering to your earlier question, my CPU capability information bits change 
> like this after
> suspend:
> 
> (XEN) Entering ACPI S3 state.
> (XEN) AMD-Vi: Applying erratum 746 workaround for IOMMU at 0000:00:00.2
> (XEN) Finishing wakeup from ACPI S3 state.
> (XEN) CPU0: cap[ 1] is 3e98320b (expected b698320b)
> (XEN) Missing previously available feature(s).
> (XEN) Enabling non-boot CPUs ...
> 
> Without the patch this result in xen panic.
> 
>> I decided to give this a try, but I don't really know how to use the build 
>> system. I did `make
>> vmm-xen`, modified the file
>> chroot-dom0-fc29/home/user/rpmbuild/BUILD/xen-4.12.1/xen/arch/x86/acpi/power.c,
>>  but it appears
>> after running `make vmm-xen` again my changes have been reverted. After it 
>> finishes the line is no
>> longer commented out. Do I have to commit the change, or generate a patch 
>> file, or something like
>> that?
> 
> After you configure the qubes builder (easiest done with ./setup) and 
> download all the sources
> (including the qubes-vmm-xen extra sources), you have to put the patch file 
> in the
> qubes-src/vmm-xen directory.
> 
> Then, include this patch in xen.spec.in file (somewhere below the last patch 
> line eg. as Patch
> 1202: xxx --> filename is relative to the vmm-xen directory).
> Then, change the release (rel file) number to avoid mixing the "official" and 
> your custom versions.
> Then run: make wmm-xen, and the new rpms will be available in the pkgs folder.
> You can check the logs meanwhile xen compiles if your patch was applied 
> sucessfuly or not.
> Then, install all the rpms (7), that are currently installed in dom0 (eg. the 
> devel and the debug
> files etc. are not needed.
> 
> PS: my patch looks like this (it will show the CPUID capability bits changing 
> in the hypervisor
> log)
> 
> diff -ruN a/xen/arch/x86/acpi/power.c b/xen/arch/x86/acpi/power.c
> --- a/xen/arch/x86/acpi/power.c 2019-12-15 18:26:11.183000000 +0100
> +++ b/xen/arch/x86/acpi/power.c 2019-12-15 18:23:15.439000000 +0100
> @@ -257,7 +257,7 @@
> microcode_resume_cpu(0);
> 
> if ( !recheck_cpu_features(0) )
> - panic("Missing previously available feature(s).");
> + printk(XENLOG_ERR "Missing previously available feature(s).\n");
> 
> /* Re-enabled default NMI/#MC use of MSR_SPEC_CTRL. */
> ci->spec_ctrl_flags |= (default_spec_ctrl_flags & SCF_ist_wrmsr);

Thanks for the patch and the instructions. The qubes-builder documentation is 
outdated and sorely
lacking (it doesn't even mention ./setup!). I applied the patch for marek's 4.1 
repo but I couldn't
get to produce an fc31 package. It kept building for fc29 which I don't 
currently have installed.
Then I built it for fc25 4.0 stable, but the patch wouldn't apply cleanly so I 
just modified the
existing patch-x86-check-feature-flags-after-resume.patch to print an error 
instead of panic, and
changed the message slightly.

patch-x86-check-feature-flags-after-resume.patch
diff --git a/xen/arch/x86/acpi/power.c b/xen/arch/x86/acpi/power.c
index 3d26d4be31..e8fb3f6f31 100644
--- a/xen/arch/x86/acpi/power.c
+++ b/xen/arch/x86/acpi/power.c
@@ -255,6 +255,9 @@ static int enter_state(u32 state)

microcode_resume_cpu(0);

+ if ( !recheck_cpu_features(0) )
+ printk(XENLOG_ERR "Missing previously available feature(s). Ignoring.\n");
+
/* Re-enabled default NMI/#MC use of MSR_SPEC_CTRL. */
ci->spec_ctrl_flags |= (default_spec_ctrl_flags & SCF_ist_wrmsr);
spec_ctrl_exit_idle(ci);

Installed the seven packages already present in dom0. In case anyone is 
wondering those are:
xen-libs-4.8.5-14custom.fc25.x86_64.rpm
xen-4.8.5-14custom.fc25.x86_64.rpm
xen-hypervisor-4.8.5-14custom.fc25.x86_64.rpm
xen-runtime-4.8.5-14custom.fc25.x86_64.rpm
python3-xen-4.8.5-14custom.fc25.x86_64.rpm
xen-licenses-4.8.5-14custom.fc25.x86_64.rpm
xen-hvm-4.8.5-14custom.fc25.x86_64.rpm

Note that 4.8.5-14 -> 4.8.5-14custom shows up as a downgrade.

Ran `strings -a /boot/efi/EFI/qubes/xen.efi | grep Ignoring` to check for my 
unique message, just to be sure.

Rebooted. Checked xl info. Looks good. (Yes, it actually truncated the last 
character of the
version, apparently. Odd.)
xen_major : 4
xen_minor : 8
xen_extra : .5-14custom.fc2
xen_version : 4.8.5-14custom.fc2
cc_compile_date : Wed Jan 1 01:11:51 UTC 2020

Hit suspend from the XFCE menu. Waited 30 seconds or so. Crossed my fingers and 
resumed.

And... SUCCESS!

xl dmesg
(XEN) Preparing system for ACPI S3 state.
(XEN) Disabling non-boot CPUs ...
(XEN) Entering ACPI S3 state.
(XEN) Finishing wakeup from ACPI S3 state.
(XEN) CPU0: cap[ 1] is 7ed8320b (expected f6d8320b)
(XEN) Missing previously available feature(s). Ignoring.
(XEN) Enabling non-boot CPUs ...

Thank you for your help! It appears your machine is not a special case. Exact 
same result for both of us. Bit 27 flips on and bit 31 flips off (xor of 
0x88000000). No idea what those mean, though. 

However, I still have a long road ahead of me. I did several suspend/resume 
cycles, and each time I had a different combination of problems, including the 
mouse sticking, the keyboard not working, and finally input/output errors and 
segmentation faults in the terminal. But the Xen problem has been identified 
nonetheless. I'll try kernel-latest and see if that changes anything.

Thanks again.

BTW, have you reported this to upstream or do you have any plans to?

-- 
You received this message because you are subscribed to the Google Groups 
"qubes-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to qubes-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/qubes-users/982be9eb7054475e621da6e638917ed5%40disroot.org.

Reply via email to