From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: xen-devel <xen-devel@lists.xenproject.org>,
Matthew Daley <mattd@bugfuzz.com>,
Eddie Dong <eddie.dong@intel.com>,
Jun Nakajima <jun.nakajima@intel.com>
Subject: Re: [PATCH] nested VMX: fix I/O port exit emulation
Date: Tue, 3 Dec 2013 13:55:28 +0000 [thread overview]
Message-ID: <529DE2D0.8090305@citrix.com> (raw)
In-Reply-To: <529DEE4E0200007800109691@nat28.tlf.novell.com>
[-- Attachment #1.1: Type: text/plain, Size: 2193 bytes --]
On 03/12/13 13:44, Jan Beulich wrote:
> For multi-byte operations all affected ports' bits in the bitmap need
> to be checked, not just the first port's one.
>
> Reported-by: Matthew Daley <mattd@bugfuzz.com>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
>
> --- a/xen/arch/x86/hvm/vmx/vvmx.c
> +++ b/xen/arch/x86/hvm/vmx/vvmx.c
> @@ -2134,7 +2134,6 @@ int nvmx_n2_vmexit_handler(struct cpu_us
> struct nestedvcpu *nvcpu = &vcpu_nestedhvm(v);
> struct nestedvmx *nvmx = &vcpu_2_nvmx(v);
> u32 ctrl;
> - u8 *bitmap;
>
> nvcpu->nv_vmexit_pending = 0;
> nvmx->intr.intr_info = 0;
> @@ -2220,15 +2219,22 @@ int nvmx_n2_vmexit_handler(struct cpu_us
> if ( ctrl & CPU_BASED_ACTIVATE_IO_BITMAP )
> {
> unsigned long qual;
> - u16 port;
> + u16 port, size;
>
> __vmread(EXIT_QUALIFICATION, &qual);
> - port = qual >> 16;
> - bitmap = nvmx->iobitmap[port >> 15];
> - if ( bitmap[(port & 0x7fff) >> 3] & (1 << (port & 0x7)) )
> - nvcpu->nv_vmexit_pending = 1;
> + for ( port = qual >> 16, size = (qual & 7) + 1; ; )
> + {
> + const u8 *bitmap = nvmx->iobitmap[port >> 15];
> +
> + if ( bitmap[(port & 0x7fff) >> 3] & (1 << (port & 7)) )
> + nvcpu->nv_vmexit_pending = 1;
> + if ( !--size )
> + break;
> + if ( !++port )
> + nvcpu->nv_vmexit_pending = 1;
> + } while ( !nvcpu->nv_vmexit_pending );
You have a rather odd looking "for () { } while ()" loop, which appears
to be a while loop with no body and a constant loop condition. Is this
intended?
~Andrew
> if ( !nvcpu->nv_vmexit_pending )
> - gdprintk(XENLOG_WARNING, "L0 PIO %x.\n", port);
> + printk(XENLOG_G_WARNING "L0 PIO %04x\n", port);
> }
> else if ( ctrl & CPU_BASED_UNCOND_IO_EXITING )
> nvcpu->nv_vmexit_pending = 1;
>
>
>
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel
[-- Attachment #1.2: Type: text/html, Size: 3174 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-12-03 13:55 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-03 13:44 [PATCH] nested VMX: fix I/O port exit emulation Jan Beulich
2013-12-03 13:55 ` Andrew Cooper [this message]
2013-12-03 14:02 ` Jan Beulich
2013-12-03 14:06 ` [PATCH v2] " Jan Beulich
2013-12-03 14:30 ` Andrew Cooper
2013-12-03 15:55 ` Jan Beulich
2013-12-03 15:58 ` Andrew Cooper
2013-12-04 1:51 ` Zhang, Yang Z
2013-12-04 2:08 ` Andrew Cooper
2013-12-04 2:16 ` Zhang, Yang Z
2013-12-04 7:52 ` Jan Beulich
2013-12-04 8:07 ` Zhang, Yang Z
2013-12-04 8:51 ` Jan Beulich
2013-12-05 1:38 ` Zhang, Yang Z
2013-12-04 8:34 ` Dong, Eddie
2013-12-04 9:51 ` Egger, Christoph
2013-12-04 10:05 ` 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=529DE2D0.8090305@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=JBeulich@suse.com \
--cc=eddie.dong@intel.com \
--cc=jun.nakajima@intel.com \
--cc=mattd@bugfuzz.com \
--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).