All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH (for 4.6)] x86/hvm: Unconditionally buffer writes to VRAM
@ 2015-07-16  9:24 Paul Durrant
  2015-07-16  9:34 ` Andrew Cooper
  0 siblings, 1 reply; 5+ messages in thread
From: Paul Durrant @ 2015-07-16  9:24 UTC (permalink / raw)
  To: xen-devel; +Cc: Andrew Cooper, Paul Durrant, Keir Fraser, Jan Beulich

When c/s 3bbaaec09 "unify stdvga mmio intercept with standard mmio
intercept" was added, a small semantic change was made. Prior to
this patch the hypervisor unconditionally sent all guest writes
to the VGA aperture as buffered ioreqs, whereas after the patch it
only does this when the VGA model is in 'stdvga' mode (sequencer
register #7 == 0).

When installing Windows 7 (64-bit) using the default QEMU VGA model
(== cirrus), Windows leaves 'stdvga' mode early in boot and hence
all further writes to the VGA aperture are done using synchronous
ioreqs which slows down boot by several orders of magnitude (thanks
to the elaborate splash screen that Windows presents). This can be
viewed as a regression and so this patch re-instates previous
buffering behaviour.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Tested-by: Wei Liu <wei.liu2@citrix.com>
Cc: Keir Fraser <keir@xen.org>
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/hvm/stdvga.c |    7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/xen/arch/x86/hvm/stdvga.c b/xen/arch/x86/hvm/stdvga.c
index 6d22b22..f50bff7 100644
--- a/xen/arch/x86/hvm/stdvga.c
+++ b/xen/arch/x86/hvm/stdvga.c
@@ -441,7 +441,7 @@ static int stdvga_mem_write(const struct hvm_io_handler *handler,
     };
     struct hvm_ioreq_server *srv;
 
-    if ( !s->cache )
+    if ( !s->cache || !s->stdvga )
         goto done;
 
     /* Intercept mmio write */
@@ -503,9 +503,6 @@ static bool_t stdvga_mem_accept(const struct hvm_io_handler *handler,
 
     spin_lock(&s->lock);
 
-    if ( !s->stdvga )
-        goto reject;
-
     if ( p->dir == IOREQ_WRITE && p->count > 1 )
     {
         /*
@@ -526,7 +523,7 @@ static bool_t stdvga_mem_accept(const struct hvm_io_handler *handler,
 
         goto reject;
     }
-    else if ( p->dir == IOREQ_READ && !s->cache )
+    else if ( p->dir == IOREQ_READ && (!s->cache || !s->stdvga) )
         goto reject;
 
     /* s->lock intentionally held */
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH (for 4.6)] x86/hvm: Unconditionally buffer writes to VRAM
  2015-07-16  9:24 [PATCH (for 4.6)] x86/hvm: Unconditionally buffer writes to VRAM Paul Durrant
@ 2015-07-16  9:34 ` Andrew Cooper
  2015-07-16 10:12   ` Ian Campbell
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Cooper @ 2015-07-16  9:34 UTC (permalink / raw)
  To: Paul Durrant, xen-devel; +Cc: Keir Fraser, Jan Beulich

On 16/07/15 10:24, Paul Durrant wrote:
> When c/s 3bbaaec09 "unify stdvga mmio intercept with standard mmio
> intercept" was added, a small semantic change was made. Prior to
> this patch the hypervisor unconditionally sent all guest writes
> to the VGA aperture as buffered ioreqs, whereas after the patch it
> only does this when the VGA model is in 'stdvga' mode (sequencer
> register #7 == 0).
>
> When installing Windows 7 (64-bit) using the default QEMU VGA model
> (== cirrus), Windows leaves 'stdvga' mode early in boot and hence
> all further writes to the VGA aperture are done using synchronous
> ioreqs which slows down boot by several orders of magnitude (thanks
> to the elaborate splash screen that Windows presents). This can be
> viewed as a regression and so this patch re-instates previous
> buffering behaviour.
>
> Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
> Tested-by: Wei Liu <wei.liu2@citrix.com>
> Cc: Keir Fraser <keir@xen.org>
> Cc: Jan Beulich <jbeulich@suse.com>
> Cc: Andrew Cooper <andrew.cooper3@citrix.com>

This is unfortunate, but should be returned to its previous behaviour.

Reviewed-by: Andrew Cooper <andrew.cooper@citrix.com>

> ---
>  xen/arch/x86/hvm/stdvga.c |    7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/xen/arch/x86/hvm/stdvga.c b/xen/arch/x86/hvm/stdvga.c
> index 6d22b22..f50bff7 100644
> --- a/xen/arch/x86/hvm/stdvga.c
> +++ b/xen/arch/x86/hvm/stdvga.c
> @@ -441,7 +441,7 @@ static int stdvga_mem_write(const struct hvm_io_handler *handler,
>      };
>      struct hvm_ioreq_server *srv;
>  
> -    if ( !s->cache )
> +    if ( !s->cache || !s->stdvga )
>          goto done;
>  
>      /* Intercept mmio write */
> @@ -503,9 +503,6 @@ static bool_t stdvga_mem_accept(const struct hvm_io_handler *handler,
>  
>      spin_lock(&s->lock);
>  
> -    if ( !s->stdvga )
> -        goto reject;
> -
>      if ( p->dir == IOREQ_WRITE && p->count > 1 )
>      {
>          /*
> @@ -526,7 +523,7 @@ static bool_t stdvga_mem_accept(const struct hvm_io_handler *handler,
>  
>          goto reject;
>      }
> -    else if ( p->dir == IOREQ_READ && !s->cache )
> +    else if ( p->dir == IOREQ_READ && (!s->cache || !s->stdvga) )
>          goto reject;
>  
>      /* s->lock intentionally held */

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH (for 4.6)] x86/hvm: Unconditionally buffer writes to VRAM
  2015-07-16  9:34 ` Andrew Cooper
@ 2015-07-16 10:12   ` Ian Campbell
  2015-07-16 10:20     ` Paul Durrant
  0 siblings, 1 reply; 5+ messages in thread
From: Ian Campbell @ 2015-07-16 10:12 UTC (permalink / raw)
  To: Andrew Cooper; +Cc: xen-devel, Paul Durrant, Keir Fraser, Jan Beulich

On Thu, 2015-07-16 at 10:34 +0100, Andrew Cooper wrote:
> On 16/07/15 10:24, Paul Durrant wrote:
> > When c/s 3bbaaec09 "unify stdvga mmio intercept with standard mmio
> > intercept" was added, a small semantic change was made. Prior to
> > this patch the hypervisor unconditionally sent all guest writes
> > to the VGA aperture as buffered ioreqs, whereas after the patch it
> > only does this when the VGA model is in 'stdvga' mode (sequencer
> > register #7 == 0).
> >
> > When installing Windows 7 (64-bit) using the default QEMU VGA model
> > (== cirrus), Windows leaves 'stdvga' mode early in boot and hence
> > all further writes to the VGA aperture are done using synchronous
> > ioreqs which slows down boot by several orders of magnitude (thanks
> > to the elaborate splash screen that Windows presents). This can be
> > viewed as a regression and so this patch re-instates previous
> > buffering behaviour.
> >
> > Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
> > Tested-by: Wei Liu <wei.liu2@citrix.com>
> > Cc: Keir Fraser <keir@xen.org>
> > Cc: Jan Beulich <jbeulich@suse.com>
> > Cc: Andrew Cooper <andrew.cooper3@citrix.com>
> 
> This is unfortunate,

OOI why is it unfortunate? IOW why wouldn't we want buffer all accesses
to the VRAM (leaving aside that perhaps the original authors only
intended to do it for StdVGA).

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH (for 4.6)] x86/hvm: Unconditionally buffer writes to VRAM
  2015-07-16 10:12   ` Ian Campbell
@ 2015-07-16 10:20     ` Paul Durrant
  2015-07-16 10:52       ` Ian Campbell
  0 siblings, 1 reply; 5+ messages in thread
From: Paul Durrant @ 2015-07-16 10:20 UTC (permalink / raw)
  To: Ian Campbell, Andrew Cooper
  Cc: xen-devel@lists.xenproject.org, Keir (Xen.org), Jan Beulich

> -----Original Message-----
> From: Ian Campbell [mailto:ian.campbell@citrix.com]
> Sent: 16 July 2015 11:13
> To: Andrew Cooper
> Cc: Paul Durrant; xen-devel@lists.xenproject.org; Keir (Xen.org); Jan Beulich
> Subject: Re: [Xen-devel] [PATCH (for 4.6)] x86/hvm: Unconditionally buffer
> writes to VRAM
> 
> On Thu, 2015-07-16 at 10:34 +0100, Andrew Cooper wrote:
> > On 16/07/15 10:24, Paul Durrant wrote:
> > > When c/s 3bbaaec09 "unify stdvga mmio intercept with standard mmio
> > > intercept" was added, a small semantic change was made. Prior to
> > > this patch the hypervisor unconditionally sent all guest writes
> > > to the VGA aperture as buffered ioreqs, whereas after the patch it
> > > only does this when the VGA model is in 'stdvga' mode (sequencer
> > > register #7 == 0).
> > >
> > > When installing Windows 7 (64-bit) using the default QEMU VGA model
> > > (== cirrus), Windows leaves 'stdvga' mode early in boot and hence
> > > all further writes to the VGA aperture are done using synchronous
> > > ioreqs which slows down boot by several orders of magnitude (thanks
> > > to the elaborate splash screen that Windows presents). This can be
> > > viewed as a regression and so this patch re-instates previous
> > > buffering behaviour.
> > >
> > > Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
> > > Tested-by: Wei Liu <wei.liu2@citrix.com>
> > > Cc: Keir Fraser <keir@xen.org>
> > > Cc: Jan Beulich <jbeulich@suse.com>
> > > Cc: Andrew Cooper <andrew.cooper3@citrix.com>
> >
> > This is unfortunate,
> 
> OOI why is it unfortunate? IOW why wouldn't we want buffer all accesses
> to the VRAM (leaving aside that perhaps the original authors only
> intended to do it for StdVGA).

Well, VRAM (mapped through a PCI BAR) can't be buffered in general. For instance, the Cirrus model in QEMU re-maps its I/O ports into the first 256 bytes. I think we are ok to always buffer writes to the VGA aperture though as I can't find any obvious side effects (in QEMU's common code).

  Paul

> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH (for 4.6)] x86/hvm: Unconditionally buffer writes to VRAM
  2015-07-16 10:20     ` Paul Durrant
@ 2015-07-16 10:52       ` Ian Campbell
  0 siblings, 0 replies; 5+ messages in thread
From: Ian Campbell @ 2015-07-16 10:52 UTC (permalink / raw)
  To: Paul Durrant
  Cc: Andrew Cooper, Keir (Xen.org), Jan Beulich,
	xen-devel@lists.xenproject.org

On Thu, 2015-07-16 at 11:20 +0100, Paul Durrant wrote:
> > -----Original Message-----
> > From: Ian Campbell [mailto:ian.campbell@citrix.com]
> > Sent: 16 July 2015 11:13
> > To: Andrew Cooper
> > Cc: Paul Durrant; xen-devel@lists.xenproject.org; Keir (Xen.org); Jan Beulich
> > Subject: Re: [Xen-devel] [PATCH (for 4.6)] x86/hvm: Unconditionally buffer
> > writes to VRAM
> > 
> > On Thu, 2015-07-16 at 10:34 +0100, Andrew Cooper wrote:
> > > On 16/07/15 10:24, Paul Durrant wrote:
> > > > When c/s 3bbaaec09 "unify stdvga mmio intercept with standard mmio
> > > > intercept" was added, a small semantic change was made. Prior to
> > > > this patch the hypervisor unconditionally sent all guest writes
> > > > to the VGA aperture as buffered ioreqs, whereas after the patch it
> > > > only does this when the VGA model is in 'stdvga' mode (sequencer
> > > > register #7 == 0).
> > > >
> > > > When installing Windows 7 (64-bit) using the default QEMU VGA model
> > > > (== cirrus), Windows leaves 'stdvga' mode early in boot and hence
> > > > all further writes to the VGA aperture are done using synchronous
> > > > ioreqs which slows down boot by several orders of magnitude (thanks
> > > > to the elaborate splash screen that Windows presents). This can be
> > > > viewed as a regression and so this patch re-instates previous
> > > > buffering behaviour.
> > > >
> > > > Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
> > > > Tested-by: Wei Liu <wei.liu2@citrix.com>
> > > > Cc: Keir Fraser <keir@xen.org>
> > > > Cc: Jan Beulich <jbeulich@suse.com>
> > > > Cc: Andrew Cooper <andrew.cooper3@citrix.com>
> > >
> > > This is unfortunate,
> > 
> > OOI why is it unfortunate? IOW why wouldn't we want buffer all accesses
> > to the VRAM (leaving aside that perhaps the original authors only
> > intended to do it for StdVGA).
> 
> Well, VRAM (mapped through a PCI BAR) can't be buffered in general.
> For instance, the Cirrus model in QEMU re-maps its I/O ports into the
> first 256 bytes. I think we are ok to always buffer writes to the VGA
> aperture though as I can't find any obvious side effects (in QEMU's
> common code).

Ah, so the aperture can contain things other than the framebuffer, makes
sense!

> 
>   Paul
> 
> > 
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-07-16 10:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-16  9:24 [PATCH (for 4.6)] x86/hvm: Unconditionally buffer writes to VRAM Paul Durrant
2015-07-16  9:34 ` Andrew Cooper
2015-07-16 10:12   ` Ian Campbell
2015-07-16 10:20     ` Paul Durrant
2015-07-16 10:52       ` Ian Campbell

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.