Re: [qubes-users] Re: Corebooted G505s Suspend/Resume Fails

2019-04-11 Thread Mike Banon
> Xen is difficult to debug without a classic onboard serial port for
> console output. Has to be some bug in that function.

Could Xen print messages to a screen? If yes, then it is possible to
find this function and insert the bunch of printf("1/2/3/etc") //
sleep(1) ( sleep is necessary to ensure that, before some action that
freezes the system, your just-printed message will be displayed on a
screen - without sleep, if it freezes too fast, may be not enough time
to display)

Although I have FT232H USB debug dongle, which could be used to get
the console output from USB 2.0 port (e.g. coreboot cbmem log) - I
don't know if it could be useful for Xen messages as well (and if any
extra configuration is required to make Xen output to this dongle),
and so many projects I don't have enough time to figure this out. So,
if you have some free time, you may try this printf / sleep approach
above.

Or, alternatively, please open a bug at Xen about this regression,
maybe they know an easy way of how to disable this check for AMD or at
least could provide some debugging ideas... It is in our best
interests that some solution for this problem gets upstreamed.

Best regards,
Mike Banon

-- 
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 post to this group, send email to qubes-users@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/qubes-users/CAK7947nLKz59r0qV-q0LFesufBUe3dm_KsJgkniguECBxGknVg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [qubes-users] Re: Corebooted G505s Suspend/Resume Fails

2019-04-11 Thread qubes123
For the patching, I modified the xen.spec(.in) file adding the patch to the 
already existing set of patches (eg. as Patch628).  This way the patch is 
applied even after make clean, when the xen sources are gunzipped again. 
I also compiled xen-4.12.0 with the patch, and there were no compilation 
errors.  I cannot test this yet on dev:Qubes 4.1, FC29 dom0, because I'm having 
trouble setting up a working fc29 dom0.

Interestingly, suspend-by-lid-closing works for the first time after a clean 
boot, but then better to use the menu.  Maybe some ACPI functions get broken 
after first suspend/resume. (but this is rather a CB and not Qubes topic...).

About debugging: yes, it would be great to have serial debugging on g505s 
(without an addon card), and I think it is not entirely impossible through the 
EC debug port (JP3), or EHCI...But this is rather a topic for CB and @Mike...

-- 
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 post to this group, send email to qubes-users@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/qubes-users/ffc013dc-b25e-4e5f-a739-f627f3b344d3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [qubes-users] Re: Corebooted G505s Suspend/Resume Fails

2019-04-11 Thread 'awokd' via qubes-users

Mike Banon:

Excellent discovery, awokd and qubes123!


qubes123 gets 100% of the credit, I merely confirmed it.


Please try to somehow upstream your solution to Xen.
Idea: find a way to detect a CPU type before executing this
"recheck_cpu_features(0)"
function, and if it is AMD CPU - maybe just skip this check :


Xen is difficult to debug without a classic onboard serial port for 
console output. Has to be some bug in that function.



-if ( !recheck_cpu_features(0) )
+/*if ( cpu_is_not_amd() && !recheck_cpu_features(0) )
   panic("Missing previously available feature(s).");
-
+*/


Perhaps this problem affects all the AMD and not just the coreboot'ed ones,
but maybe only a few people are using AMD laptop with xen so nobody noticed it


That crossed my mind as well.

--
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 post to this group, send email to qubes-users@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/qubes-users/8e630622-8281-f030-4552-e5ffc991f06e%40danwin1210.me.
For more options, visit https://groups.google.com/d/optout.


Re: [qubes-users] Re: Corebooted G505s Suspend/Resume Fails

2019-04-11 Thread Mike Banon
Excellent discovery, awokd and qubes123!
Please try to somehow upstream your solution to Xen.
Idea: find a way to detect a CPU type before executing this
"recheck_cpu_features(0)"
function, and if it is AMD CPU - maybe just skip this check :

> -if ( !recheck_cpu_features(0) )
> +/*if ( cpu_is_not_amd() && !recheck_cpu_features(0) )
>   panic("Missing previously available feature(s).");
> -
> +*/

Perhaps this problem affects all the AMD and not just the coreboot'ed ones,
but maybe only a few people are using AMD laptop with xen so nobody noticed it

Best regards,
Mike Banon

On Thu, Apr 11, 2019 at 2:47 AM awokd  wrote:
>
> awokd wrote on 4/10/19 8:50 PM:
>
> > Got my build environment going, but I think I am missing a step. I edit
> > /home/user/qubes-builder/chroot-dom0-fc25/home/user/rpmbuild/BUILD/xen-4.8.5/xen/arch/x86/acpi/power.c
> > with the above patch. Then I run "make vmm-xen". Then I see it has
> > overwritten my change and the code is no longer commented out. What am I
> > doing wrong?
>
> Never mind, forgot I had noted this down a while back:
>
> cd /home/user/qubes-builder
> sudo chroot chroot-dom0-fc25
> su user
> cd ~
> make -C rpmbuild/BUILD/xen-4.8.5/xen
>
> Then copy from the chroot's
> home/user/rpmbuild/BUILD/xen-4.8.5/xen/xen.{gz,efi} .
>
> For some reason closing & opening the lid doesn't do anything any more.
> Don't understand what that section of code would have to do with it.
> However, if I choose Suspend from the menu, and then hit a key it
> successfully resumes! Thank you, that is very interesting. It would be
> good to figure out what's broken and upstream the fix...
>
>

-- 
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 post to this group, send email to qubes-users@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/qubes-users/CAK7947n3X6BCwQKrMGm968F4DG7Lnqdr8cXG8ue43BVXG3RC0Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [qubes-users] Re: Corebooted G505s Suspend/Resume Fails

2019-04-10 Thread 'awokd' via qubes-users

awokd wrote on 4/10/19 8:50 PM:

Got my build environment going, but I think I am missing a step. I edit 
/home/user/qubes-builder/chroot-dom0-fc25/home/user/rpmbuild/BUILD/xen-4.8.5/xen/arch/x86/acpi/power.c 
with the above patch. Then I run "make vmm-xen". Then I see it has 
overwritten my change and the code is no longer commented out. What am I 
doing wrong?


Never mind, forgot I had noted this down a while back:

cd /home/user/qubes-builder
sudo chroot chroot-dom0-fc25
su user
cd ~
make -C rpmbuild/BUILD/xen-4.8.5/xen

Then copy from the chroot's 
home/user/rpmbuild/BUILD/xen-4.8.5/xen/xen.{gz,efi} .


For some reason closing & opening the lid doesn't do anything any more. 
Don't understand what that section of code would have to do with it. 
However, if I choose Suspend from the menu, and then hit a key it 
successfully resumes! Thank you, that is very interesting. It would be 
good to figure out what's broken and upstream the fix...



--
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 post to this group, send email to qubes-users@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/qubes-users/5dc2dfe8-5562-5406-68fb-cfc2e47ac111%40danwin1210.me.
For more options, visit https://groups.google.com/d/optout.


Re: [qubes-users] Re: Corebooted G505s Suspend/Resume Fails

2019-04-10 Thread 'awokd' via qubes-users

awokd wrote on 4/8/19 6:43 PM:

qubes123 wrote on 4/8/19 6:08 PM:
...distribution kernels (fedora, debian) with xen 4.11.1 still have 
issues with suspend & g505s...


Understood, thank you! That will save a lot of testing time. I'm still 
getting my build environment stood up, but will update once I can 
confirm the workaround.




Got my build environment going, but I think I am missing a step. I edit 
/home/user/qubes-builder/chroot-dom0-fc25/home/user/rpmbuild/BUILD/xen-4.8.5/xen/arch/x86/acpi/power.c 
with the above patch. Then I run "make vmm-xen". Then I see it has 
overwritten my change and the code is no longer commented out. What am I 
doing wrong?


--
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 post to this group, send email to qubes-users@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/qubes-users/80d2bc71-9975-d177-8630-2e895cc15971%40danwin1210.me.
For more options, visit https://groups.google.com/d/optout.


Re: [qubes-users] Re: Corebooted G505s Suspend/Resume Fails

2019-04-08 Thread 'awokd' via qubes-users

qubes123 wrote on 4/8/19 6:08 PM:

...distribution kernels (fedora, debian) with xen 4.11.1 still have issues with 
suspend & g505s...

Understood, thank you! That will save a lot of testing time. I'm still 
getting my build environment stood up, but will update once I can 
confirm the workaround.


--
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 post to this group, send email to qubes-users@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/qubes-users/6931e039-5d57-5e00-1fed-17101c4b392b%40danwin1210.me.
For more options, visit https://groups.google.com/d/optout.


Re: [qubes-users] Re: Corebooted G505s Suspend/Resume Fails

2019-04-08 Thread qubes123
...distribution kernels (fedora, debian) with xen 4.11.1 still have issues with 
suspend & g505s...

-- 
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 post to this group, send email to qubes-users@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/qubes-users/18d33afc-315f-4865-9b70-afdcb9b5e311%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [qubes-users] Re: Corebooted G505s Suspend/Resume Fails

2019-04-07 Thread qubes123
I'm not aware of that.  I think for CB'd fam15h we need a xen patch, that will 
not check the CPU features after resume, as microcode update never happens...

-- 
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 post to this group, send email to qubes-users@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/qubes-users/c1923032-bc1c-4a0a-84fa-381dffe44d92%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [qubes-users] Re: Corebooted G505s Suspend/Resume Fails

2019-04-06 Thread qubes123
2019. április 6., szombat 12:34:31 UTC időpontban awokd a következőt írta:
> dm1.libe...@gmail.com wrote on 4/6/19 7:14 AM:
> 
> > This issue is due to a xen patch ("Fix resume, when using microcode 
> > upgrade"), that has been included when releases changed from xen-4.8.3-4 to 
> > xen-4.8.3-5. This patch checks the availability of previous CPU features 
> > (..Spectre) during resume, and results in a xen panic on G505s - IMHO due 
> > to the static nature how the most recent (0x600111f) AMD microcodes need to 
> > be compiled in Corebooted systems.
> > It is no use to revert the whole patch, because it'll break the other xen 
> > patches introduced since. But you can:
> > 
> > diff -ur a/xen/arch/x86/acpi/power.c b/xen/arch/x86/acpi/power.c
> > --- a/xen/arch/x86/acpi/power.c 2019-03-31
> > +++ b/xen/arch/x86/acpi/power.c 2019-03-31
> > @@ -256,9 +256,9 @@
> >   
> >   microcode_resume_cpu(0);
> >   
> > -if ( !recheck_cpu_features(0) )
> > +/*if ( !recheck_cpu_features(0) )
> >   panic("Missing previously available feature(s).");
> > -
> > +*/
> >   /* 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);
> > 
> > have this workaround, which solves the issue until someone provides a 
> > working solution on CB'd systems with AMD Fam15h. (..and also assesses the 
> > possible security impacts...)
> > Of course you'll need to recompile git:qubes-vmm-xen, but that is 
> > straightforward.
> > There could be some strange kernel messages in dom0 after resume, and you 
> > might have issues in sys-net devices waking up, but this mostly works fine 
> > (with kernel 4.14.103 --> kernels 4.19-xx still have issues with the radeon 
> > module)
> > 
> 
> Thank you, I will definitely try it out and report back here! Any idea 
> if someone has submitted upstream to Xen? Seems like it would be an 
> issue with any Corebooted AMD AGESA system since they all handle 
> microcode the same way.

I haven't seen this, and also could be wrong about the root cause...

What I found is that kernels without Xen are not affected (resume OK), however 
stock kernels with xen (Fedora, Ubuntu...) even up-to the latest stable 
Xen-4.11.x have this issue.

-- 
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 post to this group, send email to qubes-users@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/qubes-users/5cef8a3f-42ec-48fc-9e89-fade0e3ed250%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [qubes-users] Re: Corebooted G505s Suspend/Resume Fails

2019-04-06 Thread 'awokd' via qubes-users

dm1.libe...@gmail.com wrote on 4/6/19 7:14 AM:


This issue is due to a xen patch ("Fix resume, when using microcode upgrade"), 
that has been included when releases changed from xen-4.8.3-4 to xen-4.8.3-5. This patch 
checks the availability of previous CPU features (..Spectre) during resume, and results 
in a xen panic on G505s - IMHO due to the static nature how the most recent (0x600111f) 
AMD microcodes need to be compiled in Corebooted systems.
It is no use to revert the whole patch, because it'll break the other xen 
patches introduced since. But you can:

diff -ur a/xen/arch/x86/acpi/power.c b/xen/arch/x86/acpi/power.c
--- a/xen/arch/x86/acpi/power.c 2019-03-31
+++ b/xen/arch/x86/acpi/power.c 2019-03-31
@@ -256,9 +256,9 @@
  
  microcode_resume_cpu(0);
  
-if ( !recheck_cpu_features(0) )

+/*if ( !recheck_cpu_features(0) )
  panic("Missing previously available feature(s).");
-
+*/
  /* 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);

have this workaround, which solves the issue until someone provides a working 
solution on CB'd systems with AMD Fam15h. (..and also assesses the possible 
security impacts...)
Of course you'll need to recompile git:qubes-vmm-xen, but that is 
straightforward.
There could be some strange kernel messages in dom0 after resume, and you might 
have issues in sys-net devices waking up, but this mostly works fine (with kernel 
4.14.103 --> kernels 4.19-xx still have issues with the radeon module)



Thank you, I will definitely try it out and report back here! Any idea 
if someone has submitted upstream to Xen? Seems like it would be an 
issue with any Corebooted AMD AGESA system since they all handle 
microcode the same way.


--
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 post to this group, send email to qubes-users@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/qubes-users/0bfec338-6079-ea07-18e9-9dcc40edf70a%40danwin1210.me.
For more options, visit https://groups.google.com/d/optout.