From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: AP <apxeng@gmail.com>, stefan.bader@canonical.com
Cc: Jeremy Fitzhardinge <jeremy@goop.org>,
weidong.han@intel.com, Tim.Deegan@citrix.com,
Jan Beulich <JBeulich@suse.com>,
xen-devel <xen-devel@lists.xen.org>
Subject: Re: xsave=0 workaround needed on 3.2 kernels with Xen 4.1 or Xen-unstable.
Date: Mon, 7 May 2012 20:08:13 -0400 [thread overview]
Message-ID: <20120508000813.GA29587@phenom.dumpdata.com> (raw)
In-Reply-To: <CAGU+auuX6a4w71L4wVn3TpXZzZCmAhgKju91vNtGFcx+V_Ko5w@mail.gmail.com>
> > No, this is specifically the wrong thing. From what we know so far
> > (i.e. the outcome of the above printing you added) the problem in
> > in the Dom0 kernel (in it never setting CR4.OSXSAVE prior to
> > attempting XSETBV). What your patch efectively does is take away
> > control from the guest kernels to control the (virtual) CR4 flag...
> >
> > > That allowed the system to boot successfully though I did see the
> > > following message:
> > > (XEN) domain.c:698:d0 Attempt to change CR4 flags 00042660 -> 00002660
> >
> > ... which is what this message is telling you.
> >
> > > Not sure if the above patch is right fix but I hope it was at least
> > > helpful in pointing at where the problem might be.
> > >
> > > BTW, I see the same invalid op issue with Xen 4.1.2 if I boot with
> > > xsave=1.
> >
> > Sure, as it's a kernel problem. It's the kernel that needs logging added,
> > to find out why the CR4 write supposedly happening immediately
> > prior to the XSETBV (set_in_cr4(X86_CR4_OSXSAVE)) doesn't actually
> > happen, or doesn't set the flag. Perhaps something fishy going on
>
> xen_write_cr4 explicitly turns off X86_CR4_OSXSAVE.
Where did you see that code? Looking at the Linus's tree this is what I see
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=blob;f=arch/x86/xen/enlighten.c;h=a8f8844b8d32690b8a189bc37d12cd3f286a81cd;hb=HEAD
So who added that code? I am not seeing it in v3.0 either?
>
> static void xen_write_cr4(unsigned long cr4)
> {
> cr4 &= ~X86_CR4_PGE;
> cr4 &= ~X86_CR4_PSE;
> cr4 &= ~X86_CR4_OSXSAVE;
>
> native_write_cr4(cr4);
> }
>
> I added some prints to the Ubuntu kernel (3.0.0-17) to confirm. Here
> is what I see:
>
> <snip>
> (XEN) traps.c:874:d0 vcpu[0] cpuid XSAVE supported
> [ 6.834419] xstate_enable: Setting X86_CR4_OSXSAVE
> [ 6.838041] set_in_cr4: cr4: 0x42660
> [ 6.841743] xen_write_cr4: cr4: 0x2660
> (XEN) domain.c:704:d0 vcpu[0] hv_cr4: 0x2660 hv_cr4_mask:
> 0xfffffffffffbfff3 returning cr4: 0x2660
> (XEN) traps.c:2409:d0 vcpu[0] pv cr4: 0x2660 write CR4: 0x426f0
> [ 6.860546] xstate_enable: Exec xsetbv
> (XEN) traps.c:2254:d0 XSETBV: lock: 0 rep_prefix: 0 opsize_prefix: 0 cr4: 0x2660
> [ 6.870509] invalid opcode: 0000 [#1] SMP
> <snip>
>
> Removing the explicit turning off of X86_CR4_OSXSAVE allowed the system to boot.
>
> (XEN) traps.c:874:d0 vcpu[0] cpuid XSAVE supported
> [ 7.554262] Setting X86_CR4_OSXSAVE
> [ 7.557869] set_in_cr4: cr4: 0x42660
> [ 7.561551] xen_write_cr4: cr4: 0x42660
> (XEN) domain.c:704:d0 vcpu[0] hv_cr4: 0x2660 hv_cr4_mask:
> 0xfffffffffffbfff3 returning cr4: 0x42660
> (XEN) traps.c:2409:d0 vcpu[0] pv cr4: 0x42660 write CR4: 0x426f0
> [ 7.580522] Exec xsetbv
> (XEN) traps.c:874:d0 vcpu[0] cpuid XSAVE supported
> (XEN) traps.c:874:d0 vcpu[0] cpuid XSAVE supported
> (XEN) traps.c:874:d0 vcpu[0] cpuid XSAVE supported
> [ 7.597071] xsave/xrstor: enabled xstate_bv 0x7, cntxt size 0x340
>
> Thanks,
> AP
next prev parent reply other threads:[~2012-05-08 0:08 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-30 19:37 xsave=0 workaround needed on 3.2 kernels with Xen 4.1 or Xen-unstable Konrad Rzeszutek Wilk
2012-05-02 9:00 ` Jan Beulich
2012-05-02 18:42 ` AP
2012-05-03 9:15 ` Jan Beulich
2012-05-03 18:09 ` AP
2012-05-04 19:30 ` AP
2012-05-07 7:15 ` Jan Beulich
2012-05-07 16:07 ` Konrad Rzeszutek Wilk
2012-05-07 22:55 ` Jeremy Fitzhardinge
2012-05-07 23:57 ` AP
2012-05-08 0:08 ` Konrad Rzeszutek Wilk [this message]
2012-05-08 0:41 ` AP
2012-05-08 16:39 ` Konrad Rzeszutek Wilk
2012-05-08 17:02 ` Matt Wilson
2012-05-09 0:35 ` Konrad Rzeszutek Wilk
2012-05-09 13:11 ` Konrad Rzeszutek Wilk
2012-05-09 13:30 ` Ian Campbell
2012-05-09 13:34 ` Jan Beulich
2012-05-09 17:38 ` Konrad Rzeszutek Wilk
2012-05-10 19:39 ` Jeff Law
2012-05-10 20:57 ` Konrad Rzeszutek Wilk
2012-05-11 0:58 ` Konrad Rzeszutek Wilk
2012-05-11 2:27 ` Jeff Law
2012-05-11 8:23 ` Jan Beulich
2012-05-10 20:15 ` Jeff Law
2012-05-08 6:25 ` Jan Beulich
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120508000813.GA29587@phenom.dumpdata.com \
--to=konrad.wilk@oracle.com \
--cc=JBeulich@suse.com \
--cc=Tim.Deegan@citrix.com \
--cc=apxeng@gmail.com \
--cc=jeremy@goop.org \
--cc=stefan.bader@canonical.com \
--cc=weidong.han@intel.com \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).