Re: [Qemu-devel] [PATCH][UPDATED] Crop VNC update requests to avoid segfaults

2007-04-08 Thread Thomas Tuttle
On April 08 at 21:04 EDT, Anthony Liguori hastily scribbled:
> Thomas Tuttle wrote:
> >+if (x_position > vs->ds->width)  x_position = vs->ds->width;
> >+if (y_position > vs->ds->height) y_position = vs->ds->height;
> >+if (x_position + w >= vs->ds->width)  w = vs->ds->width  - x_position;
> >+if (y_position + h >= vs->ds->height) h = vs->ds->height - y_position;
> >+if (w < 0) w = 0;
> >+if (h < 0) h = 0;
> 
> These last two lines aren't strictly needed since x_position cannot be > 
> than vs->ds->width due to the first check but otherwise the patch looks 
> good.

You're right.  I've attached a new version of the patch.

--Thomas Tuttle
Index: vnc.c
===
RCS file: /sources/qemu/qemu/vnc.c,v
retrieving revision 1.13
diff -u -r1.13 vnc.c
--- vnc.c   19 Mar 2007 15:17:08 -  1.13
+++ vnc.c   9 Apr 2007 01:24:19 -
@@ -852,6 +852,11 @@
   int x_position, int y_position,
   int w, int h)
 {
+if (x_position > vs->ds->width)  x_position = vs->ds->width;
+if (y_position > vs->ds->height) y_position = vs->ds->height;
+if (x_position + w >= vs->ds->width)  w = vs->ds->width  - x_position;
+if (y_position + h >= vs->ds->height) h = vs->ds->height - y_position;
+
 int i;
 vs->need_update = 1;
 if (!incremental) {


pgppl68AkLac9.pgp
Description: PGP signature


[Qemu-devel] [PATCH] Crop VNC update requests to avoid segfaults

2007-04-08 Thread Thomas Tuttle
I was booting a guest that lowered the screen resolution after I logged
in, so my VNC client was running at a larger resolution (1024x768) than
the actual Qemu framebuffer's resolution (800x600).  When the VNC client
requested an update, Qemu tried to set the dirty bits and memset the
data for an area of the screen that was non-existant, and it segfaulted.

I've written a patch that "crops" the coordinates (both x and y, even
though only y is actually used) of the update region to the actual size
of the display to avoid this problem.  It is attached.  I made it
against Qemu CVS.

Comments, suggestions, and constructive criticism is appreciated.

Thank you,

Thomas Tuttle
Index: vnc.c
===
RCS file: /sources/qemu/qemu/vnc.c,v
retrieving revision 1.13
diff -u -r1.13 vnc.c
--- vnc.c   19 Mar 2007 15:17:08 -  1.13
+++ vnc.c   9 Apr 2007 00:31:37 -
@@ -852,6 +852,13 @@
   int x_position, int y_position,
   int w, int h)
 {
+if (x_position > vs->ds->width)  x_position = vs->ds->width;
+if (y_position > vs->ds->height) y_position = vs->ds->height;
+if (x_position + w >= vs->ds->width)  w = vs->ds->width  - x_position;
+if (y_position + h >= vs->ds->height) h = vs->ds->height - y_position;
+if (w < 0) w = 0;
+if (h < 0) h = 0;
+
 int i;
 vs->need_update = 1;
 if (!incremental) {


pgpnBMb3MT2md.pgp
Description: PGP signature


Re: [Qemu-devel] Clock runs at double speed in guest

2007-04-02 Thread Thomas Tuttle
On March 31 at 18:17 EDT, C.W. Betts hastily scribbled:
> What OS are you using?

I am using Gentoo Linux with a 2.6.21-rc5 kernel and kvm-18 on the host,
and the Gentoo Linux 2006.1 AMD64 minimal installcd on the guest.

By the way, please don't top-quote.  You didn't need to include my whole
quoted message to ask such a short question. ;-)

Thanks,

Thomas Tuttle


pgpzeKLj4871I.pgp
Description: PGP signature


[Qemu-devel] Clock runs at double speed in guest

2007-03-29 Thread Thomas Tuttle
Hi.

I have a 64-bit dual-core (Core 2 Duo) laptop, and I'm trying to install
Gentoo AMD64 on a Qemu virtual machine.

The system clock runs at double speed.  If I run `date' in a tight loop,
I can see it ticking off two seconds for every one second of real time.
The hardware clock does not run at double speed; if I run `hwclock
--hctosys', the system clock jumps back to the right time.

I have tried:

1) Setting the host's RTC's max-user-freq to 1024
2) Setting the guest's RTC's max-user-freq to 1024, just for good measure
3) Running the host with the CPU frequency locked to the minimum (1 GHz)
4) Running the host with the CPU frequency locked to the maximum (2 GHz)

This problem does not occur if:

1) The guest is booted with the kernel parameter "nolapic"
2) The guest is a 32-bit kernel
3) I manually modify hw/mc146818rtc.c to send interrupts half as
   often.

I'd really like to get this fixed, because it's the only barrier to me
being able to use Qemu (and KVM) for arch testing Gentoo.

If there's any more information I can provide (if you need access to the
machine, it could be arranged), please don't hesitate to ask.

I am not subscribed to qemu-devel, so please CC me on replies.

Thanks,

Thomas Tuttle


pgpQTfNLg5dYu.pgp
Description: PGP signature