Re: [PATCH 2/4] KVM: Add accessor for reading cr4 (or some bits of cr4)

2009-12-08 Thread Avi Kivity

On 12/08/2009 09:57 AM, Sheng Yang wrote:

vcpu-arch.cr0 = cr0;

-   vmx_set_cr4(vcpu, vcpu-arch.cr4);
+   vmx_set_cr4(vcpu, kvm_read_cr4(vcpu));
}
 

Another place accessed cr4 directly, in ept_update_paging_mode_cr4()

   


That one is called from vmx_set_cr4(); at that time CR4_READ_SHADOW is 
not up-to-date and vmx_decache_cr4_guest_bits() will actually corrupt 
vcpu-arch.cr4 (except it won't be called, since cr4.pae is never guest 
owned).


But you are right, I should have placed a comment.  I'll add a patch 
that inlines ept_update_paging_mode_cr4 into its caller so it can access 
the cr4 parameter directly instead of vcpu-arch.cr4.


--
error compiling committee.c: too many arguments to function

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] virtio spec: add virtio-blk max sectors feature

2009-12-08 Thread Avishay Traeger1
Rusty Russell ru...@rustcorp.com.au wrote on 12/08/2009 07:48:00 AM:
 Avishay; this would be the total sectors in an I/O, as separate from
SIZE_MAX
 (maximum size of any single scatterlist entry) and SEG_MAX (maximum
number of
 scatterlist entries)?

Correct.  In the guest virtblk driver, it changes the call to
blk_queue_max_sectors().

 Seems like a reasonable idea; esp if you need it.

I do.

 Thanks!
 Rusty.

Sure.  Avi - do you want me to resubmit the kvm and qemu patches?

Thanks,
Avishay

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] virtio spec: add virtio-blk max sectors feature

2009-12-08 Thread Avi Kivity

On 12/08/2009 11:44 AM, Avishay Traeger1 wrote:



Thanks!
Rusty.
 

Sure.  Avi - do you want me to resubmit the kvm and qemu patches?
   


You mean the virtio and qemu patches.  That's up to their maintainers 
(Rusty and Anthony).


--
error compiling committee.c: too many arguments to function

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[AUTOTEST PATCH 1/2 - V3] Add a server-side test - kvm_migration

2009-12-08 Thread Yolkfull Chow
This patch will add a server-side test namely kvm_migration. Currently,
it will use existing KVM client test framework and add a new file
kvm_migration.py to help judge executing routine: source machine or dest
machine.

Improvement based on Version #2:
 * Log into migrated guest from source client machine because the previous
   session got before migration should be still responsive.
 * Compare the output of `migration_test_command' before and after migration.
 * Add checking status of migrated guest via monitor command 'info status'.
 * As suggested by Sudhir, rename 'rem_port' to 'mig_port'. I also rename
   'rem_host' to be 'dest_host'.

Signed-off-by: Yolkfull Chow yz...@redhat.com
---
 client/tests/kvm/kvm_migration.py  |  170 
 client/tests/kvm/kvm_test_utils.py |   27 +++---
 client/tests/kvm/kvm_tests.cfg.sample  |2 +
 client/tests/kvm_migration |1 +
 server/tests/kvm/migration_control.srv |  139 ++
 5 files changed, 327 insertions(+), 12 deletions(-)
 create mode 100644 client/tests/kvm/kvm_migration.py
 create mode 12 client/tests/kvm_migration
 create mode 100644 server/tests/kvm/migration_control.srv

diff --git a/client/tests/kvm/kvm_migration.py 
b/client/tests/kvm/kvm_migration.py
new file mode 100644
index 000..7845e6b
--- /dev/null
+++ b/client/tests/kvm/kvm_migration.py
@@ -0,0 +1,170 @@
+import sys, os, time, logging, commands, socket
+from autotest_lib.client.bin import test
+from autotest_lib.client.common_lib import error
+import kvm_utils, kvm_preprocessing, common, kvm_vm, kvm_test_utils
+
+
+class kvm_migration(test.test):
+
+KVM migration test.
+
+@copyright: Red Hat 2008-2009
+@see: http://www.linux-kvm.org/page/KVM-Autotest/Client_Install
+(Online doc - Getting started with KVM testing)
+
+Migration execution progress:
+
+source host dest host
+--
+log into guest
+--
+start socket server
+
+ wait 30 secs -- wait login_timeout+30 secs---
+
+accept connection connect to socket server,send mig_port
+--
+start migration
+
+ wait 30 secs -- wait mig_timeout+30 secs-
+
+try to log into migrated guest   check VM's status via monitor cmd
+--
+
+
+version = 1
+def initialize(self):
+pass
+
+
+def run_once(self, params):
+
+Setup remote machine and then execute migration.
+
+# Check whether remote machine is ready
+dsthost = params.get(dsthost)
+srchost = params.get(srchost)
+image_path = os.path.join(self.bindir, images)
+
+rootdir = params.get(rootdir)
+iso = os.path.join(rootdir, 'iso')
+images = os.path.join(rootdir, 'images')
+qemu = os.path.join(rootdir, 'qemu')
+qemu_img = os.path.join(rootdir, 'qemu-img')
+
+def link_if_not_exist(ldir, target, link_name):
+t = target
+l = os.path.join(ldir, link_name)
+if not os.path.exists(l):
+os.symlink(t,l)
+link_if_not_exist(self.bindir, '../../', 'autotest')
+link_if_not_exist(self.bindir, iso, 'isos')
+link_if_not_exist(self.bindir, images, 'images')
+link_if_not_exist(self.bindir, qemu, 'qemu')
+link_if_not_exist(self.bindir, qemu_img, 'qemu-img')
+
+# Report the parameters we've received and write them as keyvals
+logging.debug(Test parameters:)
+keys = params.keys()
+keys.sort()
+for key in keys:
+logging.debug(%s = %s, key, params[key])
+self.write_test_keyval({key: params[key]})
+
+# Open the environment file
+env_filename = os.path.join(self.bindir, params.get(env, env))
+env = kvm_utils.load_env(env_filename, {})
+logging.debug(Contents of environment: %s % str(env))
+
+# Preprocess
+kvm_preprocessing.preprocess(self, params, env)
+kvm_utils.dump_env(env, env_filename)
+
+try:
+try:
+# Get the living VM
+vm = kvm_test_utils.get_living_vm(env, params.get(main_vm))
+migration_test_command = params.get(migration_test_command)
+login_timeout = int(params.get(login_timeout))
+mig_timeout = int(params.get(mig_timeout))
+source_addr = (srchost, 50006)
+all = [srchost, dsthost]
+
+# Check whether migration is supported
+s, o = vm.send_monitor_cmd(help info)
+if not info migrate in o:
+raise 

[AUTOTEST PATCH 2/2] KVM test: subtest migration: Add rem_host and rem_port for migrate()

2009-12-08 Thread Yolkfull Chow
Since kvm_test_utils.migrate() adds two arguments to adopt
server-side migration. This client side test also needs update.

Signed-off-by: Yolkfull Chow yz...@redhat.com
---
 client/tests/kvm/tests/migration.py |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/client/tests/kvm/tests/migration.py 
b/client/tests/kvm/tests/migration.py
index b8f171c..3c983bc 100644
--- a/client/tests/kvm/tests/migration.py
+++ b/client/tests/kvm/tests/migration.py
@@ -43,7 +43,8 @@ def run_migration(test, params, env):
 session2.close()
 
 # Migrate the VM
-dest_vm = kvm_test_utils.migrate(vm, env)
+dest_vm = kvm_test_utils.migrate(vm, localhost,
+ dest_vm.migration_port, env)
 
 # Log into the guest again
 logging.info(Logging into guest after migration...)
-- 
1.6.5.2

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: KVM: MMU: remove prefault from invlpg handler

2009-12-08 Thread Avi Kivity

On 12/07/2009 10:51 PM, Marcelo Tosatti wrote:


The BAD_POOL_HEADER BSOD happens at address 0xF8A000DDD000 (complaining it contains 
00, Arg4).
Walking the pagetables takes to 0x18996 as the pte page:

(qemu) xp 0x18996ee8  (vaddr 0xF8A000DDD000)
18996ee8: 0x153c9963

(qemu) xp 0x18996ef0  (vaddr 0xF8A000DDE000)
18996ef0: 0x1528a963


  qemu-system-x86-13667 [007] 425860.260987: kvm_mmu_pte_write: sp-gfn 18996 
(offset=ef0) gfn 15f11 invlpg=1
  qemu-system-x86-13670 [004] 425860.264977: kvm_mmu_pte_write: sp-gfn 18996 
(offset=ef0) gfn 15253 invlpg=1
  qemu-system-x86-13670 [004] 425860.265039: kvm_mmu_pte_write: sp-gfn 18996 
(offset=ef0) gfn 15f15 invlpg=1
  qemu-system-x86-13670 [004] 425860.266591: kvm_mmu_pte_write: sp-gfn 18996 
(offset=ef0) gfn 146f3 invlpg=1
  qemu-system-x86-13670 [004] 425860.268128: kvm_mmu_pte_write: sp-gfn 18996 
(offset=ee8) gfn 14688 invlpg=1
  qemu-system-x86-13670 [004] 425860.268592: kvm_mmu_pte_write: sp-gfn 18996 
(offset=ef0) gfn 159c7 invlpg=1
  qemu-system-x86-13669 [003] 425861.267453: kvm_mmu_zap_page: sp gfn 18996 1/4 
q0 w-x pge nxe root 0 unsync

The page is not shadowed again after this.

gfn 0x159c7 above contains a valid end of pool block header:

  00 00 00 00 00 00 00 00  10 10 00 00 00 00 00 00  ||
0010  00 01 01 03 46 72 61 67  1c 00 33 d2 48 8d 44 24  |Frag..3.H.D$|
0020  01 01 fe 00 46 72 65 65  48 8d 44 04 30 48 f7 f1  |FreeH.D.0H..|

But not the one which is in the pagetable at the time of BSOD:

(qemu) xp /20x 0x1528a000
1528a000: 0x 0x 0x 0x
1528a010: 0x 0x 0x 0x
1528a020: 0x 0x 0x 0x
1528a030: 0x 0x 0x 0x
1528a040: 0x 0x 0x 0x

So my theory was, Windows wrote gfn 0x1528a to offset 0xef0, but skipped
the invlpg, so a write to address 0xF8A000DDE000 ended up in the wrong
gfn (the one prefaulted by the invlpg handler).
   


An alternative is that something fishy happpened to the pte mapping the 
page table.  But that's far fetched.


So I'll commit the patch.  I'm sorry to lose that optimization, I'll try 
later to track down what happened by reinstating the prefault but with 
the page marked not present, so we can see if a later fault fails to 
match the prefetch.


--
error compiling committee.c: too many arguments to function

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 12/12] Kick appropriate CPUs when signalling interrupts.

2009-12-08 Thread Chris Lalancette
On 12/02/2009 04:44 PM, Gleb Natapov wrote:
 On Tue, Dec 01, 2009 at 03:36:41PM +0100, Chris Lalancette wrote:
 Make sure that we kick the appropriate vcpu when delivering
 an interrupt.  This makes sure that we wake any idle cpus
 to cause a vcpu_run and an interrupt injection to occur.

 Signed-off-by: Chris Lalancette clala...@redhat.com
 ---
  virt/kvm/irq_comm.c |5 -
  1 files changed, 4 insertions(+), 1 deletions(-)

 diff --git a/virt/kvm/irq_comm.c b/virt/kvm/irq_comm.c
 index 9b07734..96df854 100644
 --- a/virt/kvm/irq_comm.c
 +++ b/virt/kvm/irq_comm.c
 @@ -98,6 +98,7 @@ int kvm_irq_delivery_to_apic(struct kvm *kvm, struct 
 kvm_lapic *src,
  if (r  0)
  r = 0;
  r += kvm_apic_set_irq(vcpu, irq);
 +kvm_vcpu_kick(vcpu);
  } else {
  if (!lowest)
  lowest = vcpu;
 @@ -106,8 +107,10 @@ int kvm_irq_delivery_to_apic(struct kvm *kvm, struct 
 kvm_lapic *src,
  }
  }
  
 -if (lowest)
 +if (lowest) {
  r = kvm_apic_set_irq(lowest, irq);
 +kvm_vcpu_kick(lowest);
 +}
  
  return r;
  }
 kvm_vcpu_kick() is done inside kvm_apic_set_irq(), so why is this
 needed?

Yeah, you are absolutely right.  I mis-read it before.  I'll remove this bit.

-- 
Chris Lalancette
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 0/1] Defer skb allocation for both mergeable buffers and big packets in virtio_net

2009-12-08 Thread Michael S. Tsirkin
On Mon, Nov 23, 2009 at 11:23:18AM +1030, Rusty Russell wrote:
 On Fri, 20 Nov 2009 04:39:19 pm Shirley Ma wrote:
  Guest virtio_net receives packets from its pre-allocated vring 
  buffers, then it delivers these packets to upper layer protocols
  as skb buffs. So it's not necessary to pre-allocate skb for each
  mergable buffer, then frees it when it's useless. 
  
  This patch has deferred skb allocation when receiving packets for
  both big packets and mergeable buffers. It reduces skb pre-allocations 
  and skb_frees.
  
  Based on Mickael  Avi's suggestion. A destroy function has been created
  to push virtio free buffs to vring for unused pages, and used page private
  to maintain page list.
  
  I didn't touch small packet skb allocation to avoid extra copies for small
  packets.
  
  This patch has tested and measured against 2.6.32-rc5 git. It is built again
   2.6.32-rc7 kernel. Tests have been done for small packets, big packets and
  mergeable buffers.
  
  The single netperf TCP_STREAM performance improved for host to guest. 
  It also reduces UDP packets drop rate.
  
  The netperf laptop results were:
  
  mtu=1500
  netperf -H xxx -l 120
  
  w/o patch   w/i patch (two runs)
  guest to host:  3336.84Mb/s   3730.14Mb/s ~ 3582.88Mb/s
  
  host to guest:  3165.10Mb/s   3370.39Mb/s ~ 3407.96Mb/s
 
 Nice!
 
 Is this using mergeable_rx_bufs?  Or just big_packets?
 
 I'd like to drop big packet support from our driver, but I don't know
 how many kvm hosts will not offer mergable rx bufs yet.


One issue with mergeable buffers is that they can work well with zero
copy RX, but only if hardware merges RX buffers in the same way virtio
does.

However, I suspect that most hardware can not do this, and simply
scatters data to a buffer you give it and then reports completion.
For such simple hardware, RX can work without extra data copies when guest
uses big packets (just scatter data into guest buffers), but when guest
tries to use mergeable buffers, host will have to merge them and post a
single big packet to hardware.  Thus host will be able to only post
about 16 buffers to hardware, and performance will suffer.


-- 
MST
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Test failures during git daily testing

2009-12-08 Thread Avi Kivity

On 12/07/2009 07:54 PM, Lucas Meneghel Rodrigues wrote:

Hi Folks:

Today pretty much all install tests for kvm and qemu upstream git
failed. the vm screen says something along the lines:

Starting SeaBIOS [version-string]
No bootable device.

Screenshot attached. The command line the test used:

/usr/local/autotest/tests/kvm/qemu -name 'vm1' -monitor 
unix:/tmp/monitor-20091207-120625-tyjI,server,nowait -drive 
file=/usr/local/autotest/tests/kvm/images/fc11-32.qcow2,if=ide -net nic,vlan=0 
-net user,vlan=0 -m 512 -smp 1 -cdrom 
/usr/local/autotest/tests/kvm/isos/linux/Fedora-11-i386-DVD.iso -fda 
/usr/local/autotest/tests/kvm/images/floppy.img -tftp 
/usr/local/autotest/tests/kvm/images/tftpboot  -boot d -bootp /pxelinux.0 -boot 
n -redir tcp:5000::22 -vnc :0

There's a concern that the command that was used might no longer be valid. If 
that's the case, please advise.
   


You have both -boot n and -boot d.  Not sure if this is legal, maybe you 
need -boot nd.


--
error compiling committee.c: too many arguments to function

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2] KVM: x86: Extend KVM_SET_VCPU_EVENTS with selective updates

2009-12-08 Thread Marcelo Tosatti
On Sun, Dec 06, 2009 at 06:24:15PM +0100, Jan Kiszka wrote:
 User space may not want to overwrite asynchronously changing VCPU event
 states on write-back. So allow to skip nmi.pending and sipi_vector by
 setting corresponding bits in the flags field of kvm_vcpu_events.
 
 Signed-off-by: Jan Kiszka jan.kis...@siemens.com

Can't you handle this in userspace entirely, only updating vcpu_events
state when appropriate? 

Shouldnt the vcpu be stopped in the first place, when its state is
updated?

 ---
 
 Changes in v2:
  - invert selection logic
 
  Documentation/kvm/api.txt  |   10 +-
  arch/x86/include/asm/kvm.h |4 
  arch/x86/kvm/x86.c |9 ++---
  3 files changed, 19 insertions(+), 4 deletions(-)
 
 diff --git a/Documentation/kvm/api.txt b/Documentation/kvm/api.txt
 index e1a1141..b22592d 100644
 --- a/Documentation/kvm/api.txt
 +++ b/Documentation/kvm/api.txt
 @@ -685,7 +685,7 @@ struct kvm_vcpu_events {
   __u8 pad;
   } nmi;
   __u32 sipi_vector;
 - __u32 flags;   /* must be zero */
 + __u32 flags;
  };
  
  4.30 KVM_SET_VCPU_EVENTS
 @@ -701,6 +701,14 @@ vcpu.
  
  See KVM_GET_VCPU_EVENTS for the data structure.
  
 +Fields that may be modified asynchronously by running VCPUs can be excluded
 +from the update. These fields are nmi.pending and sipi_vector. Keep the
 +corresponding bits in the flags field cleared to suppress overwriting the
 +current in-kernel state. The bits are:
 +
 +KVM_VCPUEVENT_SET_NMI_PENDING - transfer nmi.pending to the kernel
 +KVM_VCPUEVENT_SET_SIPI_VECTOR - transfer sipi_vector
 +
  
  5. The kvm_run structure
  
 diff --git a/arch/x86/include/asm/kvm.h b/arch/x86/include/asm/kvm.h
 index 950df43..d1a67ae 100644
 --- a/arch/x86/include/asm/kvm.h
 +++ b/arch/x86/include/asm/kvm.h
 @@ -254,6 +254,10 @@ struct kvm_reinject_control {
   __u8 reserved[31];
  };
  
 +/* When set in flags, include corresponding fields on KVM_SET_VCPU_EVENTS */
 +#define KVM_VCPUEVENT_SET_NMI_PENDING0x0001
 +#define KVM_VCPUEVENT_SET_SIPI_VECTOR0x0002
 +
  /* for KVM_GET/SET_VCPU_EVENTS */
  struct kvm_vcpu_events {
   struct {
 diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
 index dd15d7a..e3c35ff 100644
 --- a/arch/x86/kvm/x86.c
 +++ b/arch/x86/kvm/x86.c
 @@ -1953,7 +1953,8 @@ static void kvm_vcpu_ioctl_x86_get_vcpu_events(struct 
 kvm_vcpu *vcpu,
  static int kvm_vcpu_ioctl_x86_set_vcpu_events(struct kvm_vcpu *vcpu,
 struct kvm_vcpu_events *events)
  {
 - if (events-flags)
 + if (events-flags 
 + ~(KVM_VCPUEVENT_SET_NMI_PENDING | KVM_VCPUEVENT_SET_SIPI_VECTOR))
   return -EINVAL;
  
   vcpu_load(vcpu);
 @@ -1970,10 +1971,12 @@ static int kvm_vcpu_ioctl_x86_set_vcpu_events(struct 
 kvm_vcpu *vcpu,
   kvm_pic_clear_isr_ack(vcpu-kvm);
  
   vcpu-arch.nmi_injected = events-nmi.injected;
 - vcpu-arch.nmi_pending = events-nmi.pending;
 + if (events-flags  KVM_VCPUEVENT_SET_NMI_PENDING)
 + vcpu-arch.nmi_pending = events-nmi.pending;
   kvm_x86_ops-set_nmi_mask(vcpu, events-nmi.masked);
  
 - vcpu-arch.sipi_vector = events-sipi_vector;
 + if (events-flags  KVM_VCPUEVENT_SET_SIPI_VECTOR)
 + vcpu-arch.sipi_vector = events-sipi_vector;
  
   vcpu_put(vcpu);
  
 


--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2] KVM: x86: Extend KVM_SET_VCPU_EVENTS with selective updates

2009-12-08 Thread Avi Kivity

On 12/08/2009 04:02 PM, Marcelo Tosatti wrote:

On Sun, Dec 06, 2009 at 06:24:15PM +0100, Jan Kiszka wrote:
   

User space may not want to overwrite asynchronously changing VCPU event
states on write-back. So allow to skip nmi.pending and sipi_vector by
setting corresponding bits in the flags field of kvm_vcpu_events.

Signed-off-by: Jan Kiszkajan.kis...@siemens.com
 

Can't you handle this in userspace entirely, only updating vcpu_events
state when appropriate?
   


For what we do now I think you're right, it can be handled in userspace.

But in general, there's currently no way to update vcpu_events without 
overwriting nmi and sipi_vector, which can also be written concurrently 
by other vcpus.  So there's a hole in the interface.



Shouldnt the vcpu be stopped in the first place, when its state is
updated?
   


It is stopped, but other vcpus are not.

--
error compiling committee.c: too many arguments to function

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/4] KVM: Add accessor for reading cr4 (or some bits of cr4)

2009-12-08 Thread Sheng Yang
On Tue, Dec 08, 2009 at 11:36:59AM +0200, Avi Kivity wrote:
 On 12/08/2009 09:57 AM, Sheng Yang wrote:
 vcpu-arch.cr0 = cr0;
 -   vmx_set_cr4(vcpu, vcpu-arch.cr4);
 +   vmx_set_cr4(vcpu, kvm_read_cr4(vcpu));
 }
 Another place accessed cr4 directly, in ept_update_paging_mode_cr4()
 
 
 That one is called from vmx_set_cr4(); at that time CR4_READ_SHADOW
 is not up-to-date and vmx_decache_cr4_guest_bits() will actually
 corrupt vcpu-arch.cr4 (except it won't be called, since cr4.pae is
 never guest owned).

Yes, you are right...
 
 But you are right, I should have placed a comment.  I'll add a patch
 that inlines ept_update_paging_mode_cr4 into its caller so it can
 access the cr4 parameter directly instead of vcpu-arch.cr4.

Just notice another thing, seems the cr4_guest_owned_bits' initial value is
wrong. It should be ~KVM_GUEST_CR4_MASK rather than KVM_GUEST_CR4_MASK in this
patch IIUC.

-- 
regards
Yang, Sheng
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/4] KVM: Add accessor for reading cr4 (or some bits of cr4)

2009-12-08 Thread Avi Kivity

On 12/08/2009 04:40 PM, Sheng Yang wrote:



But you are right, I should have placed a comment.  I'll add a patch
that inlines ept_update_paging_mode_cr4 into its caller so it can
access the cr4 parameter directly instead of vcpu-arch.cr4.
 

Just notice another thing, seems the cr4_guest_owned_bits' initial value is
wrong. It should be ~KVM_GUEST_CR4_MASK rather than KVM_GUEST_CR4_MASK in this
patch IIUC.
   


Yes.  Will fix.

--
error compiling committee.c: too many arguments to function

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [Qemu-devel] Re: Endless loop in qcow2_alloc_cluster_offset

2009-12-08 Thread Kevin Wolf
Am 07.12.2009 16:00, schrieb Kevin Wolf:
 Am 07.12.2009 15:16, schrieb Jan Kiszka:
 Likely not. What I did was nothing special, and I did not noticed such a
 crash in the last months.

 And now it happened again (qemu-kvm head, during kernel installation
 from network onto local qcow2-disk). Any clever idea how to proceed with
 this?
 
 I still haven't seen this and I still have no theory on what could be
 happening here. I'm just trying to write down what I think must happen
 to get into this situation. Maybe you can point at something I'm missing
 or maybe it helps you to have a sudden inspiration.
 
 The crash happens because we have a loop in the s-cluster_allocs list.
 A loop can only be created by inserting an object twice. The only insert
 to this list happens in qcow2_alloc_cluster_offset (though an earlier
 call than that of the stack trace).
 
 There is only one relevant caller of this function, qcow_aio_write_cb.
 Part of it is a call to run_dependent_requests which removes the request
 from s-cluster_allocs. So after the QLIST_REMOVE in
 run_dependent_requests the request can't be contained in the list, but
 at the call of qcow2_alloc_cluster_offset it must be contained again. It
 must be added somewhere in between these two calls.
 
 In qcow_aio_write_cb there isn't much happening between these calls. The
 only thing that could somehow become dangerous is the
 qcow_aio_write_cb(req, 0); for queued requests in run_dependent_requests.

Hm, you're using only one disk, and it's an IDE disk, right? Then the
queue of dependent requests should be empty anyway, so no dangerous
calls here. Maybe your theory of a memory corruption is the better one.

Kevin
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] Make S390x work in qemu-kvm

2009-12-08 Thread Alexander Graf
We now have S390x KVM support in qemu upstream.

Unfortunately it doesn't work in qemu-kvm, because that has its own main
loop and slightly different calling conventions for the KVM helpers.

So let's hack in some small compat ifdefs that make qemu-kvm work on S390x!

Signed-off-by: Alexander Graf ag...@suse.de
---
 configure  |4 ++
 hw/msix.c  |4 ++
 hw/msix.h  |   33 +
 hw/s390-virtio.c   |6 +++
 kvm-tpr-opt.c  |3 +
 kvm/include/linux/kvm.h|   10 +++-
 kvm/include/s390/asm/kvm.h |   44 ++
 qemu-kvm-helper.c  |2 +
 qemu-kvm.c |   32 -
 qemu-kvm.h |8 ---
 target-s390x/kvm.c |  108 
 target-s390x/libkvm.h  |   26 +++
 12 files changed, 256 insertions(+), 24 deletions(-)
 create mode 100644 kvm/include/s390/asm/kvm.h
 create mode 100644 target-s390x/libkvm.h

diff --git a/configure b/configure
index e804a92..b6381ae 100755
--- a/configure
+++ b/configure
@@ -188,6 +188,7 @@ case $cpu in
   ;;
   s390x)
 cpu=s390x
+target_list=s390x-softmmu
   ;;
   sparc|sun4[cdmuv])
 cpu=sparc
@@ -1430,6 +1431,9 @@ EOF
   ppc)
 kvm_arch=powerpc
 ;;
+  s390x)
+kvm_arch=s390
+;;
   *)
 kvm_arch=$cpu
 ;;
diff --git a/hw/msix.c b/hw/msix.c
index 6d598ee..b2c2857 100644
--- a/hw/msix.c
+++ b/hw/msix.c
@@ -11,6 +11,8 @@
  * the COPYING file in the top-level directory.
  */
 
+#ifndef __s390x__
+
 #include hw.h
 #include msix.h
 #include pci.h
@@ -559,3 +561,5 @@ void msix_unuse_all_vectors(PCIDevice *dev)
 return;
 msix_free_irq_entries(dev);
 }
+
+#endif
diff --git a/hw/msix.h b/hw/msix.h
index a9f7993..643b3a1 100644
--- a/hw/msix.h
+++ b/hw/msix.h
@@ -4,6 +4,37 @@
 #include qemu-common.h
 #include pci.h
 
+#ifdef __s390x__
+
+static int msix_init(PCIDevice *pdev, unsigned short nentries,
+  unsigned bar_nr, unsigned bar_size) { return 0; }
+
+static void msix_write_config(PCIDevice *pci_dev, uint32_t address,
+   uint32_t val, int len) { }
+
+static void msix_mmio_map(PCIDevice *pci_dev, int region_num,
+   pcibus_t addr, pcibus_t size, int type) { }
+
+static int msix_uninit(PCIDevice *d) { return 0; }
+
+static void msix_save(PCIDevice *dev, QEMUFile *f) { }
+static void msix_load(PCIDevice *dev, QEMUFile *f) { }
+
+static int msix_enabled(PCIDevice *dev) { return 0; }
+static int msix_present(PCIDevice *dev) { return 0; }
+
+static uint32_t msix_bar_size(PCIDevice *dev) { return 0; }
+
+static int msix_vector_use(PCIDevice *dev, unsigned vector) { return 0; }
+static void msix_vector_unuse(PCIDevice *dev, unsigned vector) { }
+static void msix_unuse_all_vectors(PCIDevice *dev) { }
+
+static void msix_notify(PCIDevice *dev, unsigned vector) { }
+
+static void msix_reset(PCIDevice *dev) { }
+
+#else
+
 int msix_init(PCIDevice *pdev, unsigned short nentries,
   unsigned bar_nr, unsigned bar_size);
 
@@ -34,3 +65,5 @@ void msix_reset(PCIDevice *dev);
 extern int msix_supported;
 
 #endif
+
+#endif
diff --git a/hw/s390-virtio.c b/hw/s390-virtio.c
index cc21ee6..ea74955 100644
--- a/hw/s390-virtio.c
+++ b/hw/s390-virtio.c
@@ -179,7 +179,9 @@ static void s390_init(ram_addr_t ram_size,
 exit(1);
 }
 
+#ifdef KVM_UPSTREAM
 cpu_synchronize_state(env);
+#endif
 env-psw.addr = KERN_IMAGE_START;
 env-psw.mask = 0x00018000UL;
 }
@@ -236,6 +238,10 @@ static void s390_init(ram_addr_t ram_size,
 qdev_prop_set_drive(dev, drive, dinfo);
 qdev_init_nofail(dev);
 }
+
+#ifndef KVM_UPSTREAM
+kvm_arch_load_regs(env);
+#endif
 }
 
 static QEMUMachine s390_machine = {
diff --git a/kvm-tpr-opt.c b/kvm-tpr-opt.c
index 2565d79..e8c4185 100644
--- a/kvm-tpr-opt.c
+++ b/kvm-tpr-opt.c
@@ -6,6 +6,8 @@
  * Licensed under the terms of the GNU GPL version 2 or higher.
  */
 
+#ifndef __s390x__
+
 #include config.h
 #include config-host.h
 
@@ -401,3 +403,4 @@ void kvm_tpr_opt_setup(void)
 register_ioport_write(0x7e, 2, 2, vtpr_ioport_write16, NULL);
 }
 
+#endif
diff --git a/kvm/include/linux/kvm.h b/kvm/include/linux/kvm.h
index db10887..2d241da 100644
--- a/kvm/include/linux/kvm.h
+++ b/kvm/include/linux/kvm.h
@@ -181,6 +181,11 @@ struct kvm_run {
__u64 cr8;
__u64 apic_base;
 
+#ifdef __KVM_S390
+   /* the processor status word for s390 */
+   __u64 psw_mask; /* psw upper half */
+   __u64 psw_addr; /* psw lower half */
+#endif
union {
/* KVM_EXIT_UNKNOWN */
struct {
@@ -232,8 +237,6 @@ struct kvm_run {
/* KVM_EXIT_S390_SIEIC */
struct {
__u8 icptcode;
-   __u64 mask; /* psw upper half */
-   __u64 addr; /* psw lower half */

Re: Test failures during git daily testing

2009-12-08 Thread Jan Kiszka
Avi Kivity wrote:
 On 12/07/2009 07:54 PM, Lucas Meneghel Rodrigues wrote:
 Hi Folks:

 Today pretty much all install tests for kvm and qemu upstream git
 failed. the vm screen says something along the lines:

 Starting SeaBIOS [version-string]
 No bootable device.

 Screenshot attached. The command line the test used:

 /usr/local/autotest/tests/kvm/qemu -name 'vm1' -monitor
 unix:/tmp/monitor-20091207-120625-tyjI,server,nowait -drive
 file=/usr/local/autotest/tests/kvm/images/fc11-32.qcow2,if=ide -net
 nic,vlan=0 -net user,vlan=0 -m 512 -smp 1 -cdrom
 /usr/local/autotest/tests/kvm/isos/linux/Fedora-11-i386-DVD.iso -fda
 /usr/local/autotest/tests/kvm/images/floppy.img -tftp
 /usr/local/autotest/tests/kvm/images/tftpboot  -boot d -bootp
 /pxelinux.0 -boot n -redir tcp:5000::22 -vnc :0

 There's a concern that the command that was used might no longer be
 valid. If that's the case, please advise.

 
 You have both -boot n and -boot d.  Not sure if this is legal, maybe you
 need -boot nd.

(-boot n actually overwrites -boot d.)

Isn't PXE booting temporarily disabled in qemu-kvm? So there is no
device remaining and the tests fail.

Jan

-- 
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] MAINTAINERS: Remove file pattern from KERNEL VIRTUAL MACHINE (KVM) FOR AMD-V

2009-12-08 Thread Joe Perches
Commit 6c8166a77c98f473eb91e96a61c3cf78ac617278 folded
this file away.

Signed-off-by: Joe Perches j...@perches.com

diff --git a/MAINTAINERS b/MAINTAINERS
index ea781c1..fda3eec 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -3109,7 +3109,6 @@ L:kvm@vger.kernel.org
 W: http://kvm.qumranet.com
 S: Supported
 F: arch/x86/include/asm/svm.h
-F: arch/x86/kvm/kvm_svm.h
 F: arch/x86/kvm/svm.c
 
 KERNEL VIRTUAL MACHINE (KVM) FOR POWERPC


--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/2] KVM test: autotest subtest - avoid dependencies on symlinks

2009-12-08 Thread Lucas Meneghel Rodrigues
Currently the autotest subtest relies on symbolic
links placed in the kvm test. During the control
file cleanup discussions, we decided we don't want
to rely on symlinks too heavily, then make the
autotest subtest a bit more robust, avoiding such
dependencies.

Note: If the control file cleanup is accepted, the
autotest test won't work without this patch.

Signed-off-by: Lucas Meneghel Rodrigues l...@redhat.com
---
 client/tests/kvm/tests/autotest.py |   75 +++-
 1 files changed, 48 insertions(+), 27 deletions(-)

diff --git a/client/tests/kvm/tests/autotest.py 
b/client/tests/kvm/tests/autotest.py
index 798217d..f19a2ec 100644
--- a/client/tests/kvm/tests/autotest.py
+++ b/client/tests/kvm/tests/autotest.py
@@ -1,5 +1,6 @@
 import os, logging
 from autotest_lib.client.common_lib import error
+from autotest_lib.client.bin import utils
 import kvm_subprocess, kvm_utils, kvm_test_utils, scan_results
 
 
@@ -21,14 +22,26 @@ def run_autotest(test, params, env):
 @param remote_path: Remote path
 
 copy = False
+basename = os.path.basename(local_path)
 output = session.get_command_output(ls -l %s % remote_path)
-if (such file in output or
-int(output.split()[4]) != os.path.getsize(local_path)):
-basename = os.path.basename(local_path)
-logging.info(Copying %s to guest (file is missing or has a 
- different size)... % basename)
+local_size = os.path.getsize(local_path)
+if such file in output:
+logging.info(Copying %s to guest (remote file is missing) %
+ basename)
+copy = True
+else:
+remote_size = int(output.split()[4])
+if remote_size != local_size:
+logging.info(Copying %s to guest due to size mismatch
+ (remote size %s, local size %s) % (basename,
+  remote_size,
+  local_size))
+copy = True
+
+if copy:
 if not vm.copy_files_to(local_path, remote_path):
-raise error.TestFail(Could not copy %s to guest % basename)
+raise error.TestFail(Could not copy %s to guest % local_path)
+
 
 def extract(vm, remote_path, dest_dir=.):
 
@@ -40,10 +53,11 @@ def run_autotest(test, params, env):
 
 basename = os.path.basename(remote_path)
 logging.info(Extracting %s... % basename)
-status = session.get_command_status(tar xfj %s -C %s %
-(remote_path, dest_dir))
+(status, output) = session.get_command_status_output(
+  tar xjvf %s -C %s % (remote_path, 
dest_dir))
 if status != 0:
-raise error.TestFail(Could not extract %s % basename)
+raise error.TestFail(Could not extract %s, command output: %s %
+ (basename, output))
 
 vm = kvm_test_utils.get_living_vm(env, params.get(main_vm))
 session = kvm_test_utils.wait_for_login(vm)
@@ -52,54 +66,60 @@ def run_autotest(test, params, env):
 test_name = params.get(test_name)
 test_timeout = int(params.get(test_timeout, 300))
 test_control_file = params.get(test_control_file, control)
+
 tarred_autotest_path = /tmp/autotest.tar.bz2
 tarred_test_path = /tmp/%s.tar.bz2 % test_name
 
+# To avoid problems, let's make the test use the current AUTODIR
+# (autotest client path) location
+autotest_path = os.environ['AUTODIR']
+tests_path = os.path.join(autotest_path, 'tests')
+test_path = os.path.join(tests_path, test_name)
+
 # tar the contents of bindir/autotest
-cmd = cd %s; tar cvjf %s autotest/*
-cmd +=  --exclude=autotest/tests
-cmd +=  --exclude=autotest/results
-cmd +=  --exclude=autotest/tmp
-cmd +=  --exclude=autotest/control
+cmd = tar cvjf %s %s/* % (tarred_autotest_path, autotest_path)
+cmd +=  --exclude=%s/tests % autotest_path
+cmd +=  --exclude=%s/results % autotest_path
+cmd +=  --exclude=%s/tmp % autotest_path
+cmd +=  --exclude=%s/control % autotest_path
 cmd +=  --exclude=*.pyc
 cmd +=  --exclude=*.svn
 cmd +=  --exclude=*.git
-kvm_subprocess.run_fg(cmd % (test.bindir, tarred_autotest_path), 
timeout=30)
+utils.run(cmd)
 
 # tar the contents of bindir/autotest/tests/test_name
-cmd = cd %s; tar cvjf %s %s/*
+cmd = tar cvjf %s %s/* % (tarred_test_path, test_path)
 cmd +=  --exclude=*.pyc
 cmd +=  --exclude=*.svn
 cmd +=  --exclude=*.git
-kvm_subprocess.run_fg(cmd %
-  (os.path.join(test.bindir, autotest, tests),
-   tarred_test_path, test_name), timeout=30)
+utils.run(cmd)
 
 # Copy autotest.tar.bz2
-

[PATCH 2/2] KVM test: Fixing empty stress control file

2009-12-08 Thread Lucas Meneghel Rodrigues
For some reason, when the stress test was addeed to
the KVM tests, the control file for it came without
the actual statement to execute the stress test. Let's
fix that.

Signed-off-by: Lucas Meneghel Rodrigues l...@redhat.com
---
 client/tests/kvm/autotest_control/stress.control |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/client/tests/kvm/autotest_control/stress.control 
b/client/tests/kvm/autotest_control/stress.control
index 40e797e..b722013 100644
--- a/client/tests/kvm/autotest_control/stress.control
+++ b/client/tests/kvm/autotest_control/stress.control
@@ -11,3 +11,4 @@ under a specified load. Instances in which this is useful 
include those in which
 a system administrator wishes to perform tuning activities, a kernel or libc
 programmer wishes to evaluate denial of service possibilities, etc.
 '''
+job.run_test('stress')
-- 
1.6.5.2

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] KVM test: Change the default file name used by kvm_config.py

2009-12-08 Thread Lucas Meneghel Rodrigues
In order to reflect the new schema of config files.

Signed-off-by: Lucas Meneghel Rodrigues l...@redhat.com
---
 client/tests/kvm/kvm_config.py |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/client/tests/kvm/kvm_config.py b/client/tests/kvm/kvm_config.py
index 649f2c3..798ef56 100755
--- a/client/tests/kvm/kvm_config.py
+++ b/client/tests/kvm/kvm_config.py
@@ -513,7 +513,7 @@ if __name__ == __main__:
 debug = options.debug
 
 if not filename:
-filename = os.path.join(os.path.dirname(sys.argv[0]), kvm_tests.cfg)
+filename = os.path.join(os.path.dirname(sys.argv[0]), tests.cfg)
 
 # Here we configure the stand alone program to use the autotest
 # logging system.
-- 
1.6.5.2

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] KVM test: build subtest (koji): turn lists into strings and vice versa

2009-12-08 Thread Lucas Meneghel Rodrigues
Since the KVM config system deliver strings for the user,
let's make a bit of eval trickery to make the old syntax
for the koji method work.

Signed-off-by: Lucas Meneghel Rodrigues l...@redhat.com
---
 client/tests/kvm/tests/build.py |   17 ++---
 1 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/client/tests/kvm/tests/build.py b/client/tests/kvm/tests/build.py
index d22d59b..789373b 100644
--- a/client/tests/kvm/tests/build.py
+++ b/client/tests/kvm/tests/build.py
@@ -158,9 +158,11 @@ class KojiInstaller:
 
 default_koji_cmd = '/usr/bin/koji'
 default_src_pkg = 'qemu'
-default_pkg_list = ['qemu-kvm', 'qemu-kvm-tools']
-default_qemu_bin_paths = ['/usr/bin/qemu-kvm', '/usr/bin/qemu-img']
-default_extra_modules = None
+# Since the config file will provide strings, to save some
+# comparisons, we're converting the values below to strings.
+default_pkg_list = str(['qemu-kvm', 'qemu-kvm-tools'])
+default_qemu_bin_paths = str(['/usr/bin/qemu-kvm', 
'/usr/bin/qemu-img'])
+default_extra_modules = str(None)
 
 self.koji_cmd = params.get(koji_cmd, default_koji_cmd)
 
@@ -170,9 +172,9 @@ class KojiInstaller:
 os_dep.command(self.koji_cmd)
 
 self.src_pkg = params.get(src_pkg, default_src_pkg)
-self.pkg_list = params.get(pkg_list, default_pkg_list)
-self.qemu_bin_paths = params.get(qemu_bin_paths,
- default_qemu_bin_paths)
+self.pkg_list = eval(params.get(pkg_list, default_pkg_list))
+self.qemu_bin_paths = eval(params.get(qemu_bin_paths,
+ default_qemu_bin_paths))
 self.tag = params.get(koji_tag, None)
 self.build = params.get(koji_build, None)
 if self.tag and self.build:
@@ -192,7 +194,8 @@ class KojiInstaller:
 self.load_modules = True
 elif load_modules == 'no':
 self.load_modules = False
-self.extra_modules = params.get(extra_modules, default_extra_modules)
+self.extra_modules = eval(params.get(extra_modules,
+ default_extra_modules))
 
 self.srcdir = test.srcdir
 self.test_bindir = test.bindir
-- 
1.6.5.2

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


KVM autotest patch queue report 12-09-2009

2009-12-08 Thread Lucas Meneghel Rodrigues
Patch: Major control file cleanup
URL: http://patchwork.test.kernel.org/patch/1600/
Comments: Stage 1 of the planned work done
Status: Need review (patchset made by the maintainer, need review by
other people)

Patch: KSM ovecommit test v.2
URL: http://patchwork.test.kernel.org/patch/1529/
Comments: Dor made initial comments on the patchset, I still need to
review it myself
Status: Pending review

Patch: Add PCI device assignment support
URL: http://patchwork.test.kernel.org/patch/1554/
Comments: Implemented comments from the original author, need review and
testing
Status: Pending review and testing

Patch: Add a server-side test: kvm_migration
URL: http://patchwork.test.kernel.org/patch/1602/
Comments: Implements the much awaited KVM remote migration as a server
side test.
Status: Pending review

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] qemu-kvm: fix ia64 build breakage

2009-12-08 Thread Alexander Graf


Am 09.12.2009 um 05:37 schrieb Zhang, Xiantao  
xiantao.zh...@intel.com:


I don't think how much effort needs to make it work again.  So maybe  
need to evaluate it first, and give you the answer later.  By the  
way,  are you using it now ?


No, but sles11 ships with it and I want to make sure we're regression  
free :).


Alex
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Test failures during git daily testing

2009-12-08 Thread Avi Kivity

On 12/08/2009 11:34 PM, Lucas Meneghel Rodrigues wrote:



(-boot n actually overwrites -boot d.)

Isn't PXE booting temporarily disabled in qemu-kvm? So there is no
device remaining and the tests fail.
 

Avi, can you confirm that? If that's the case, I will have to switch
over step file based installs for upstream.

   


Yes, I forgot to revert b496fe34317ead after seabios got fixed.  I'll 
fix that soon.



--
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html