xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Roger Pau Monne <roger.pau@citrix.com>, <xen-devel@lists.xenproject.org>
Cc: Ian Jackson <iwj@xenproject.org>, Wei Liu <wl@xen.org>,
	Anthony PERARD <anthony.perard@citrix.com>,
	Jan Beulich <jbeulich@suse.com>,
	Jun Nakajima <jun.nakajima@intel.com>,
	Kevin Tian <kevin.tian@intel.com>,
	Boris Ostrovsky <boris.ostrovsky@oracle.com>
Subject: Re: [PATCH v2 for-4.15] x86/msr: introduce an option for HVM relaxed rdmsr behavior
Date: Fri, 5 Mar 2021 00:06:19 +0000	[thread overview]
Message-ID: <4cb7e1f3-0593-6d06-281a-e3bf06843221@citrix.com> (raw)
In-Reply-To: <20210304144755.35891-1-roger.pau@citrix.com>

On 04/03/2021 14:47, Roger Pau Monne wrote:
> Introduce an option to allow selecting a less strict behaviour for
> rdmsr accesses targeting a MSR not explicitly handled by Xen. Since
> commit 84e848fd7a162f669 accesses to MSRs not explicitly handled by
> Xen result in the injection of a #GP to the guest. This is a behavior
> change since previously a #GP was only injected if accessing the MSR
> on the real hardware will also trigger a #GP.
>
> This commit attempts to offer a fallback option similar to the
> previous behavior. Note however that the value of the underlying MSR
> is never leaked to the guest, as the newly introduced option only
> changes whether a #GP is injected or not.
>
> Long term the plan is to properly handle all the MSRs, so the option
> introduced here should be considered a temporary resort for OSes that
> don't work properly with the new MSR policy. Any OS that requires this
> option to be enabled should be reported to
> xen-devel@lists.xenproject.org.
>
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
> ---
> Changes since v1:
>  - Only apply the option to HVM guests.
>  - Only apply the special handling to MSR reads.
>  - Sanitize the newly introduced flags field.
>  - Print a warning message when the option is used.
> ---
> Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
> ---
> Boris, could you please test with Solaris to see if this fixes the
> issue?
>
> I wonder whether we need to to enable this option by default for
> guests being migrated from previous Xen versions? Maybe that's not
> required as the option is helpful mostly for early boot I would
> assume, afterwards an OS should already have the #GP handler setup
> when accessing MSRs.

We know when building a domain whether it is a migrate or not, but don't
recall any version information existing at an appropriate point in the
migration stream to do this easily.

We can buffer the stream forward and peek at the libxc domain header,
which does have the source hypervisor version, but that is going to be
very invasive to implement.

>
> From a release PoV the biggest risk would be breaking some of the
> existing MSR functionality. I think that's a necessary risk in order
> to offer such fallback option, or else we might discover after the
> release that guests that worked on Xen 4.14 don't work anymore in Xen
> 4.15.

Much as I'd prefer not to have this, I agree with the sentiment that we
should have an "emergency undo" which people can use, and carry it for
at least a short while.

However, to be useful for the purpose of unbreaking VMs, it must change
both the read and write behaviour, because both are potential
compatibility concerns (without reintroducing the information leak).

> ---
>  docs/man/xl.cfg.5.pod.in          | 17 +++++++++++++++++
>  tools/include/libxl.h             |  8 ++++++++
>  tools/libs/light/libxl_types.idl  |  2 ++
>  tools/libs/light/libxl_x86.c      |  4 ++++
>  tools/xl/xl_parse.c               |  7 +++++++
>  xen/arch/x86/domain.c             | 10 ++++++++++
>  xen/arch/x86/hvm/svm/svm.c        |  6 ++++++
>  xen/arch/x86/hvm/vmx/vmx.c        |  7 +++++++
>  xen/include/asm-x86/hvm/domain.h  |  3 +++
>  xen/include/public/arch-x86/xen.h |  8 ++++++++

This needs changes to the Ocaml bindings as well.  I guess I'll add that
to the todo list.

~Andrew



  parent reply	other threads:[~2021-03-05  0:07 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-04 14:47 [PATCH v2 for-4.15] x86/msr: introduce an option for HVM relaxed rdmsr behavior Roger Pau Monne
2021-03-04 14:59 ` Ian Jackson
2021-03-04 15:13   ` Roger Pau Monné
2021-03-04 15:20     ` Ian Jackson
2021-03-04 16:55       ` Roger Pau Monné
2021-03-04 17:13         ` Ian Jackson
2021-03-04 17:43           ` Roger Pau Monné
2021-03-04 18:21             ` Ian Jackson
2021-03-05 10:26             ` Jan Beulich
2021-03-04 23:09 ` Boris Ostrovsky
2021-03-04 23:28   ` Andrew Cooper
2021-03-05  8:26     ` Roger Pau Monné
2021-03-05  0:06 ` Andrew Cooper [this message]
2021-03-05  9:15   ` Roger Pau Monné
2021-03-05 10:35     ` Jan Beulich
2021-03-05 10:56 ` Jan Beulich
2021-03-05 11:06   ` Jan Beulich
2021-03-08 14:30   ` Roger Pau Monné

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=4cb7e1f3-0593-6d06-281a-e3bf06843221@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=anthony.perard@citrix.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=iwj@xenproject.org \
    --cc=jbeulich@suse.com \
    --cc=jun.nakajima@intel.com \
    --cc=kevin.tian@intel.com \
    --cc=roger.pau@citrix.com \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.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).