From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: xen-devel <xen-devel@lists.xenproject.org>, Keir Fraser <keir@xen.org>
Subject: Re: [PATCH 4/5] x86/HVM: properly deal with hvm_copy_*_guest_phys() errors
Date: Mon, 30 Sep 2013 14:07:38 +0100 [thread overview]
Message-ID: <5249779A.8020803@citrix.com> (raw)
In-Reply-To: <524991B202000078000F8083@nat28.tlf.novell.com>
[-- Attachment #1.1: Type: text/plain, Size: 3089 bytes --]
On 30/09/13 13:58, Jan Beulich wrote:
> In memory read/write handling the default case should tell the caller
> that the operation cannot be handled rather than the operation having
> succeeded, so that when new HVMCOPY_* states get added not handling
> them explicitly will not result in errors being ignored.
>
> In task switch emulation code stop handling some errors, but not
> others.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
>
> --- a/xen/arch/x86/hvm/emulate.c
> +++ b/xen/arch/x86/hvm/emulate.c
> @@ -504,10 +504,10 @@ static int __hvmemul_read(
>
> switch ( rc )
> {
> + case HVMCOPY_okay:
> + break;
> case HVMCOPY_bad_gva_to_gfn:
> return X86EMUL_EXCEPTION;
> - case HVMCOPY_unhandleable:
> - return X86EMUL_UNHANDLEABLE;
> case HVMCOPY_bad_gfn_to_mfn:
> if ( access_type == hvm_access_insn_fetch )
> return X86EMUL_UNHANDLEABLE;
> @@ -535,11 +535,10 @@ static int __hvmemul_read(
> }
> return rc;
> case HVMCOPY_gfn_paged_out:
> - return X86EMUL_RETRY;
> case HVMCOPY_gfn_shared:
> return X86EMUL_RETRY;
> default:
> - break;
> + return X86EMUL_UNHANDLEABLE;
> }
>
> return X86EMUL_OKAY;
> @@ -634,10 +633,10 @@ static int hvmemul_write(
>
> switch ( rc )
> {
> + case HVMCOPY_okay:
> + break;
> case HVMCOPY_bad_gva_to_gfn:
> return X86EMUL_EXCEPTION;
> - case HVMCOPY_unhandleable:
> - return X86EMUL_UNHANDLEABLE;
> case HVMCOPY_bad_gfn_to_mfn:
> rc = hvmemul_linear_to_phys(addr, &gpa, chunk, &reps, pfec,
> hvmemul_ctxt);
> @@ -663,11 +662,10 @@ static int hvmemul_write(
> }
> return rc;
> case HVMCOPY_gfn_paged_out:
> - return X86EMUL_RETRY;
> case HVMCOPY_gfn_shared:
> return X86EMUL_RETRY;
> default:
> - break;
> + return X86EMUL_UNHANDLEABLE;
> }
>
> return X86EMUL_OKAY;
> --- a/xen/arch/x86/hvm/hvm.c
> +++ b/xen/arch/x86/hvm/hvm.c
> @@ -2345,11 +2345,7 @@ void hvm_task_switch(
>
> rc = hvm_copy_to_guest_virt(
> prev_tr.base, &tss, sizeof(tss), PFEC_page_present);
> - if ( rc == HVMCOPY_bad_gva_to_gfn )
> - goto out;
> - if ( rc == HVMCOPY_gfn_paged_out )
> - goto out;
> - if ( rc == HVMCOPY_gfn_shared )
> + if ( rc != HVMCOPY_okay )
> goto out;
>
> rc = hvm_copy_from_guest_virt(
> @@ -2396,9 +2392,7 @@ void hvm_task_switch(
> tr.base, &tss, sizeof(tss), PFEC_page_present);
> if ( rc == HVMCOPY_bad_gva_to_gfn )
> exn_raised = 1;
> - if ( rc == HVMCOPY_gfn_paged_out )
> - goto out;
> - if ( rc == HVMCOPY_gfn_shared )
> + else if ( rc != HVMCOPY_okay )
> goto out;
>
> if ( (tss.trace & 1) && !exn_raised )
>
>
>
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel
[-- Attachment #1.2: Type: text/html, Size: 3862 bytes --]
[-- Attachment #2: Type: text/plain, Size: 126 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2013-09-30 13:09 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-30 12:51 [PATCH 0/5] x86/HVM: XSA-63 follow-ups Jan Beulich
2013-09-30 12:57 ` [PATCH 1/5] x86/HVM: properly handle backward string instruction emulation Jan Beulich
2013-10-08 16:36 ` Andrew Cooper
2013-09-30 12:57 ` [PATCH 2/5] x86/HVM: fix direct PCI port I/O emulation retry and error handling Jan Beulich
2013-10-08 18:13 ` Andrew Cooper
2013-09-30 12:58 ` [PATCH 3/5] x86/HVM: don't ignore hvm_copy_to_guest_phys() errors during I/O intercept Jan Beulich
2013-10-08 18:20 ` Andrew Cooper
2013-10-09 7:48 ` Jan Beulich
2013-09-30 12:58 ` [PATCH 4/5] x86/HVM: properly deal with hvm_copy_*_guest_phys() errors Jan Beulich
2013-09-30 13:07 ` Andrew Cooper [this message]
2013-09-30 12:59 ` [PATCH 5/5] x86/HVM: cache emulated instruction for retry processing Jan Beulich
2013-10-10 11:35 ` Andrew Cooper
2013-12-18 8:36 ` Zhang, Yang Z
2013-12-18 8:48 ` Jan Beulich
2013-12-18 9:40 ` Zhang, Yang Z
2013-12-18 10:53 ` Jan Beulich
2013-12-24 11:29 ` Zhang, Yang Z
2014-01-07 8:28 ` Jan Beulich
2014-01-07 8:54 ` Zhang, Yang Z
2014-01-07 9:43 ` Egger, Christoph
2014-01-08 5:50 ` Zhang, Yang Z
2014-01-09 12:19 ` Egger, Christoph
2014-01-16 4:42 ` Zhang, Yang Z
2014-01-16 8:23 ` Jan Beulich
2014-01-17 2:53 ` Zhang, Yang Z
2013-10-08 15:10 ` Ping: [PATCH 0/5] x86/HVM: XSA-63 follow-ups Jan Beulich
2013-10-14 7:29 ` Keir Fraser
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=5249779A.8020803@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=JBeulich@suse.com \
--cc=keir@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 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.