All of lore.kernel.org
 help / color / mirror / Atom feed
From: Keir Fraser <keir.xen@gmail.com>
To: Jan Beulich <JBeulich@suse.com>, Olaf Hering <olaf@aepfle.de>
Cc: xen-devel@lists.xen.org
Subject: Re: [PATCH v2] xen: handle paged gfn in wrmsr_hypervisor_regs
Date: Fri, 03 May 2013 15:26:57 +0100	[thread overview]
Message-ID: <CDA987C1.23FA6%keir.xen@gmail.com> (raw)
In-Reply-To: <5183DEBE02000078000D31BB@nat28.tlf.novell.com>

On 03/05/2013 14:58, "Jan Beulich" <JBeulich@suse.com> wrote:

>>>> On 03.05.13 at 14:57, Olaf Hering <olaf@aepfle.de> wrote:
>> @@ -1682,14 +1682,25 @@ static int svm_msr_write_intercept(unsig
>>          if ( wrmsr_viridian_regs(msr, msr_content) )
>>              break;
>>  
>> -        wrmsr_hypervisor_regs(msr, msr_content);
>> +        ret = wrmsr_hypervisor_regs(msr, msr_content);
>> +        switch ( ret )
>> +        {
>> +            case -EAGAIN:
>> +                result = X86EMUL_RETRY;
>> +                break;
>> +            case 0:
>> +                result = X86EMUL_UNHANDLEABLE;
>> +                break;
>> +            default:
>> +                break;
> 
> As you had already noticed the hard way - case 0 and default of
> course need to be switched (0 -> okay, anything else ->
> unhandleable).

No!

Actually anything other than -EAGAIN should be handled here as 'okay'. In
fact the return codes from wrmsr_hypervisor_regs are going to be a bit of a
mess if we're not careful.

I suggest the following return codes:
 0: not handled
 1: handled
 -EINVAL: error during handling
 -EAGAIN: retry

The HVM callers should then handle as follows:
 -EAGAIN: rc = X86EMUL_RETRY
 -EINVAL: goto gp_fault
 0: try other msr handlers (if any)
 1: we're done, return X86EMUL_OKAY

Does that make sense?

 -- Keir

> Jan
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel

  parent reply	other threads:[~2013-05-03 14:26 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-02 16:24 [PATCH] xen: handle paged gfn in wrmsr_hypervisor_regs Olaf Hering
2013-05-03  7:12 ` Jan Beulich
2013-05-03 12:58   ` Olaf Hering
2013-05-03 13:40     ` Olaf Hering
2013-05-03 13:53       ` Jan Beulich
2013-05-03 12:57 ` [PATCH v2] " Olaf Hering
2013-05-03 13:58   ` Jan Beulich
2013-05-03 14:11     ` Olaf Hering
2013-05-03 14:24       ` Jan Beulich
2013-05-03 14:26     ` Keir Fraser [this message]
2013-05-03 14:31       ` Jan Beulich
2013-05-03 15:19         ` Olaf Hering
2013-05-03 15:55           ` Keir Fraser
2013-05-03 15:17 ` [PATCH v3] " Olaf Hering
2013-05-03 15:30   ` Jan Beulich
2013-05-03 15:48     ` Olaf Hering
2013-05-03 15:53       ` Jan Beulich
2013-05-03 15:58     ` Keir Fraser
2013-05-03 16:03       ` Jan Beulich
2013-05-03 16:06         ` Keir Fraser
2013-05-03 15:55   ` Keir Fraser
2013-05-03 15:43 ` [PATCH v4] " Olaf Hering
2013-05-03 16:29 ` [PATCH v5] " Olaf Hering
2013-05-08  9:27   ` Jan Beulich
2013-05-08 10:51     ` Olaf Hering
2013-05-08 11:41       ` Jan Beulich
2013-05-08 11:45         ` Olaf Hering

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=CDA987C1.23FA6%keir.xen@gmail.com \
    --to=keir.xen@gmail.com \
    --cc=JBeulich@suse.com \
    --cc=olaf@aepfle.de \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.