[AUTOTEST] [PATCH 5/5] view ltp_results.html under kvm guests' results.html

2009-07-12 Thread sudhir kumar
This patch creates a link to the results html file generated by the test
under autotest. This is specific to the kvm part only. The assumption made is
that the file name is _results.html and it is located under
/results/ directory. This helps in quickly viewing the test results.

The attached tar file contains the full results directory. The results.html file
points to ltp_results.html which looks quite fancy.

Please have a look at the results and the patch and provide your comments.

Signed-off-by: Sudhir Kumar 

Index: autotest/client/tests/kvm/kvm_tests.py
===
--- autotest.orig/client/tests/kvm/kvm_tests.py
+++ autotest/client/tests/kvm/kvm_tests.py
@@ -391,6 +391,15 @@ def run_autotest(test, params, env):
 if not vm.scp_from_remote("autotest/results/default/*", guest_results_dir):
 logging.error("Could not copy results back from guest")

+# Some tests create html file as a result, link it to be viewed under
+# the results statistics. We assume this file is located under
+# test_name/results/ directory and named as test_name_results.html,
+# e.g. ltp_result.html, vmmstress_results.html
+html_file = test_name + "_results.html"
+html_path = os.path.join(guest_results_dir, test_name, "results",
html_file)
+if os.path.exists(html_path):
+os.symlink(html_path, os.path.join(test.debugdir, html_file))
+
 # Fail the test if necessary
 if status_fail:
 raise error.TestFail(message_fail)



-- 
Sudhir Kumar
--
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 4/5] update ltp wrapper in autotest

2009-07-12 Thread sudhir kumar
This patch updates the ltp wrapper in autotest to execute the latest ltp.
At present autotest contains ltp which is more than 1 year old. There have
been added lots of testcases in ltp within this period. So this patch updates
the wrapper to run the June2009 release of ltp.
http://prdownloads.sourceforge.net/ltp/ltp-full-20090630.tgz

I have added an option which generates a fancy html results file. Also the
run is left to be a default run as expected.

This patch also adds the facility to apply kvm_ltp.patch which can customize
the test execution under kvm guests.

For autotest users, please untar the results file I am sending, run
cd results/default; firefox results.html, click ltp_results.html
This is a symlink to the ltp_results.html which is generated by ltp.

Please provide your comments, concerns and issues.

Signed-off-by: Sudhir Kumar 

Index: autotest/client/tests/ltp/ltp.py
===
--- autotest.orig/client/tests/ltp/ltp.py
+++ autotest/client/tests/ltp/ltp.py
@@ -23,13 +23,17 @@ class ltp(test.test):
 self.job.require_gcc()


-# http://prdownloads.sourceforge.net/ltp/ltp-full-20080229.tgz
-def setup(self, tarball = 'ltp-full-20080229.tar.bz2'):
+# http://prdownloads.sourceforge.net/ltp/ltp-full-20090630.tgz
+def setup(self, tarball = 'ltp-full-20090630.tgz', guest=None):
 tarball = utils.unmap_url(self.bindir, tarball, self.tmpdir)
 utils.extract_tarball_to_dir(tarball, self.srcdir)
 os.chdir(self.srcdir)

-utils.system('patch -p1 < ../ltp.patch')
+try:
+utils.system('patch -p1 < ../ltp.patch')
+print "Patch ltp.patch applied successfully"
+except :
+print "Patch ltp.patch failed to apply"

 # comment the capability tests if we fail to load the capability module
 try:
@@ -37,6 +41,14 @@ class ltp(test.test):
 except error.CmdError, detail:
 utils.system('patch -p1 < ../ltp_capability.patch')

+# if we are running under kvm guests apply kvm_ltp.patch
+if guest == "kvm" :
+try:
+utils.system('patch -p1 < ../kvm_ltp.patch')
+print "Patch kvm_ltp.patch applied successfully"
+except :
+print "Patch kvm_ltp.patch failed to apply"
+
 utils.system('cp ../scan.c pan/')   # saves having lex installed
 utils.system('make -j %d' % utils.count_cpus())
 utils.system('yes n | make install')
@@ -52,8 +64,9 @@ class ltp(test.test):
 # In case the user wants to run another test script
 if script == 'runltp':
 logfile = os.path.join(self.resultsdir, 'ltp.log')
+htmlfile = os.path.join(self.resultsdir, 'ltp_results.html')
 failcmdfile = os.path.join(self.debugdir, 'failcmdfile')
-args2 = '-q -l %s -C %s -d %s' % (logfile, failcmdfile,
self.tmpdir)
+args2 = '-l %s -g %s -C %s -d %s' % (logfile, htmlfile,
failcmdfile, self.tmpdir)
 args = args + ' ' + args2

 cmd = os.path.join(self.srcdir, script) + ' ' + args


-- 
Sudhir Kumar
--
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 3/5] add ltp control file for kvm guests

2009-07-12 Thread sudhir kumar
This patch adds the control file under kvm/autotest_control.

Signed-off-by: Sudhir Kumar 

Index: autotest/client/tests/kvm/autotest_control/ltp.control
===
--- /dev/null
+++ autotest/client/tests/kvm/autotest_control/ltp.control
@@ -0,0 +1,13 @@
+NAME = "LTP"
+AUTHOR = "Sudhir Kumar "
+TIME = "MEDIUM"
+TEST_CATEGORY = "FUNCTIONAL"
+TEST_CLASS = "KERNEL"
+TEST_TYPE = "CLIENT"
+DOC = """
+Linux Test Project: A collection of various functional testsuites
+to test stability and reliability of Linux. For further details see
+http://ltp.sourceforge.net/
+"""
+
+job.run_test('ltp', guest="kvm")


-- 
Sudhir Kumar
--
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 2/5] add kvm_ltp.patch for kvm guests

2009-07-12 Thread sudhir kumar
Disable the testcases which are not required to be executed under kvm guests.
This patch is specific to runs under kvm guests and will not be applied for
bare metal runs. Therefore if one wants to include/exclude/whatever to the
testruns can simply update this patch and things are done!!

Signed-off-by: Sudhir Kumar 

Index: autotest/client/tests/ltp/kvm_ltp.patch
===
--- /dev/null
+++ autotest/client/tests/ltp/kvm_ltp.patch
@@ -0,0 +1,27 @@
+This patch disables the default execution of some testcases which are
+not required to be executed under kvm guests or are supposed to break
+or fail under kvm guests.
+
+Signed-off-by: Sudhir Kumar 
+
+Index: ltp-full-20090630/runltp
+===
+--- ltp-full-20090630.orig/runltp
 ltp-full-20090630/runltp
+@@ -534,7 +534,6 @@ main()
+  ${LTPROOT}/runtest/math\
+  ${LTPROOT}/runtest/nptl\
+  ${LTPROOT}/runtest/pty \
+- ${LTPROOT}/runtest/containers  \
+  ${LTPROOT}/runtest/fs_bind \
+  ${LTPROOT}/runtest/filecaps\
+  ${LTPROOT}/runtest/cap_bounds  \
+@@ -542,7 +541,6 @@ main()
+  ${LTPROOT}/runtest/connectors  \
+  ${LTPROOT}/runtest/admin_tools \
+  ${LTPROOT}/runtest/timers  \
+- ${LTPROOT}/runtest/power_management_tests  \
+  ${LTPROOT}/runtest/numa\
+  ${LTPROOT}/runtest/hugetlb \
+  ${LTPROOT}/runtest/commands\
+


-- 
Sudhir Kumar
--
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/5] update ltp.patch

2009-07-12 Thread sudhir kumar
This patch updates the ltp.patch in autotest to disable few testcases.
This patch disables the default execution of some testcases which are
either broken or are not required to be executed.

If someone wants to execute only a subset of the testcases then one can
update this patch to achieve the required flexibility.

Signed-off-by: Sudhir Kumar 

Index: autotest/client/tests/ltp/ltp.patch
===
--- autotest.orig/client/tests/ltp/ltp.patch
+++ autotest/client/tests/ltp/ltp.patch
@@ -1,38 +1,55 @@
-diff -urN ltp-full-20080229_vanilla/runtest/syscalls
ltp-full-20080229/runtest/syscalls
 ltp-full-20080229_vanilla/runtest/syscalls 2008-02-28
23:55:41.0 -0800
-+++ ltp-full-20080229/runtest/syscalls 2008-03-07 10:35:28.0 -0800
-@@ -981,7 +981,7 @@
+
+Index: ltp-full-20090630/runltp
+===
+--- ltp-full-20090630.orig/runltp
 ltp-full-20090630/runltp
+@@ -536,7 +536,6 @@ main()
+  ${LTPROOT}/runtest/pty \
+  ${LTPROOT}/runtest/containers  \
+  ${LTPROOT}/runtest/fs_bind \
+- ${LTPROOT}/runtest/controllers \
+  ${LTPROOT}/runtest/filecaps\
+  ${LTPROOT}/runtest/cap_bounds  \
+  ${LTPROOT}/runtest/fcntl-locktests \
+Index: ltp-full-20090630/runtest/syscalls
+===
+--- ltp-full-20090630.orig/runtest/syscalls
 ltp-full-20090630/runtest/syscalls
+@@ -1249,7 +1249,7 @@ vhangup01 vhangup01
  vhangup02 vhangup02
-
+
  #vmsplice test cases
 -vmsplice01 vmsplice01
 +#vmsplice01 vmsplice01
-
+
  wait02 wait02
-
-diff -urN ltp-full-20080229_vanilla/testcases/kernel/syscalls/paging/Makefile
ltp-full-20080229/testcases/kernel/syscalls/paging/Makefile
 ltp-full-20080229_vanilla/testcases/kernel/syscalls/paging/Makefile
   2008-02-28 23:55:46.0 -0800
-+++ ltp-full-20080229/testcases/kernel/syscalls/paging/Makefile
 2008-03-07 10:37:48.0 -0800
-@@ -25,7 +25,9 @@
+
+Index: ltp-full-20090630/testcases/kernel/syscalls/paging/Makefile
+===
+--- ltp-full-20090630.orig/testcases/kernel/syscalls/paging/Makefile
 ltp-full-20090630/testcases/kernel/syscalls/paging/Makefile
+@@ -25,7 +25,9 @@ TARGETS = $(patsubst %.c,%,$(SRCS))
  all: $(TARGETS)

  install:
 +ifneq ($(TARGETS),)
-   @set -e; for i in $(TARGETS); do ln -f $$i ../../../bin/$$i ; done
+@set -e; for i in $(TARGETS); do ln -f $$i ../../../bin/$$i ; done
 +endif

  clean:
-   rm -f $(TARGETS)
-diff -urN ltp-full-20080229_vanilla/testcases/network/nfsv4/acl/Makefile
ltp-full-20080229/testcases/network/nfsv4/acl/Makefile
 ltp-full-20080229_vanilla/testcases/network/nfsv4/acl/Makefile
 2008-02-28 23:55:52.0 -0800
-+++ ltp-full-20080229/testcases/network/nfsv4/acl/Makefile
2008-03-07 10:38:23.0 -0800
-@@ -19,7 +19,9 @@
-   $(CC) $(CFLAGS) $(LDFLAGS) -o acl1 acl1.c $(LIBS)
+rm -f $(TARGETS)
+Index: ltp-full-20090630/testcases/network/nfsv4/acl/Makefile
+===
+--- ltp-full-20090630.orig/testcases/network/nfsv4/acl/Makefile
 ltp-full-20090630/testcases/network/nfsv4/acl/Makefile
+@@ -19,7 +19,9 @@ acl1: acl1.c
+$(CC) $(CFLAGS) $(LDFLAGS) -o acl1 acl1.c $(LIBS)

  install: $(ACLTESTS)
 +ifneq ($(ACLTESTS),)
-   @set -e; for i in $(ACLTESTS); do ln -f $$i ../../../bin ; done
+@set -e; for i in $(ACLTESTS); do ln -f $$i ../../../bin ; done
 +endif

  clean:
-   rm -f $(ACLTESTS)
+rm -f $(ACLTESTS)
+


-- 
Sudhir Kumar
--
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 0/5] Add latest LTP test in autotest (v2)

2009-07-12 Thread sudhir kumar
Hi,
Here is the version 2 of the patches to include latest ltp in autotest
and enable execution under kvm guests. I have incorporated all the
comments and approach. Please give a quick review and let me know if
something better is to be done.

Thanks
-- 
Sudhir Kumar
--
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: [Autotest] [AUTOTEST] [PATCH 1/2] Add latest LTP test in autotest

2009-07-12 Thread sudhir kumar
On Tue, Jul 7, 2009 at 12:07 AM, Martin Bligh wrote:
>>> Issues: LTP has a history of some of the testcases getting broken.
>
> Right, that's always the concern with doing this.
>
>>> Anyways
>>> that has nothing to worry about with respect to autotest. One of the known 
>>> issue
>>> is broken memory controller issue with latest kernels(cgroups and memory
>>> resource controller enabled kernels). The workaround for them I use is to
>>> disable or delete those tests from ltp source and tar it again with the same
>>> name. Though people might use different workarounds for it.
>
> OK, Can we encapsulate this into the wrapper though, rather than making
> people do it manually? in the existing ltp.patch or something?
>

I have rebased the patches and updated the existing ltp.patch. I will
be sending them soon.
Also for runningn ltp under kvm I have generated a patch kvm_ltp.patch
whose purpose is same as of ltp.patch but only for kvm guests. i will
be sending the results of execution on the guest as well as on bare
metal. Thanks everyone for your comments!!


-- 
Sudhir Kumar
--
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: [autotest] [PATCH 1/6] add ebizzy in autotest

2009-07-12 Thread Lucas Meneghel Rodrigues
On Sun, Jul 12, 2009 at 7:08 AM, sudhir kumar wrote:
> On Sat, Jul 11, 2009 at 6:05 AM, Martin Bligh wrote:
>> On Fri, Jul 10, 2009 at 4:29 AM, sudhir kumar wrote:
>>> So is there any plan for adding this patch set in the patch queue? I
>>> would love to incorporate all the comments if any.
>>
>> Yup, just was behind on patches.
>>
>> I added it now - the mailer you are using seems to chew patches fairly
>> thoroughly though ... if it's gmail, it does that ... might want to just
>> attach as text ?
> Thanks!
> Ah! I have been using gmail only in the text mode. I was unable to
> subscribe to the list using my imap id(and i use mutt client for that)
> though.
> Is this problem of gmail known to all? Any workaround ?

Yes, gmail wraps stuff automagically, I don't know any workarounds for
that. The best workaround I'd suggest is git-format-patch and
git-send-email :)
--
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: R/W HG memory mappings with kvm?

2009-07-12 Thread Stephen Donnelly
On Sat, Jul 11, 2009 at 5:03 AM, Cam Macdonell wrote:
> Oops, I realize now that I passed the driver patch both times.  Here is the
> old patch.
>
> http://patchwork.kernel.org/patch/22363/
>
> What are you compiling against?  the git tree or a particular version? The
> above patch won't compile against the latest git tree due to changes to how
> BARs are setup in Qemu.  I can send you a patch for the latest tree if you
> need it.

Thanks Cam, I will take a look at this code.

At the moment I have cloned the tree so am intending to work at the
tip. If you have a patch for the latest tree that would be great.

Regards,
Stephen.
--
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: [ANNOUNCE] kvm-88 release

2009-07-12 Thread John Rousseau

On 07/12/2009 11:13 AM, Avi Kivity wrote:

On 07/12/2009 06:06 PM, John Rousseau wrote:

# /usr/local/bin/qemu-system-x86_64 -hda /home/jrr/vista-x86_64.img
-m 1536M -net nic,vlan=0,macaddr=52:54:00:12:32:00 -net
tap,vlan=0,ifname=tap1 -vga std -full-screen -smp 2 -usb -usbdevice
tablet


Can you try without -full-screen? Without -vga std?


Losing -vga std allowed the guest to boot.


Note -usbdevice tablet is only eating your cpu.


Cool. Removed.


Try ./configure --disable-strip.



(gdb) set args -hda /home/jrr/vista-x86_64.img -m 1536M -net 
nic,vlan=0,macaddr=52:54:00:12:32:00 -net tap,vlan=0,ifname=tap1 -vga std

...

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x77cf5910 (LWP 2792)]
0x0035a7c81b3b in memset () from /lib64/libc.so.6
(gdb) where
#0  0x0035a7c81b3b in memset () from /lib64/libc.so.6
#1  0x004324a1 in vbe_ioport_write_data (opaque=0x13da5e8, addr=,
val=) at /home/jrr/build/kvm/kvm-88/hw/vga.c:629
#2  0x0052873b in kvm_outw (data=, addr=,
opaque=) at /home/jrr/build/kvm/kvm-88/qemu-kvm.c:155
#3  handle_io (data=, addr=, 
opaque=)
at /home/jrr/build/kvm/kvm-88/qemu-kvm.c:877
#4  kvm_run (data=, addr=, opaque=)
at /home/jrr/build/kvm/kvm-88/qemu-kvm.c:1103
#5  0x00528873 in kvm_cpu_exec (env=0x0) at 
/home/jrr/build/kvm/kvm-88/qemu-kvm.c:1825
#6  0x00528a16 in kvm_main_loop_cpu (env=) at 
/home/jrr/build/kvm/kvm-88/qemu-kvm.c:2007
#7  ap_main_loop (env=) at 
/home/jrr/build/kvm/kvm-88/qemu-kvm.c:2044
#8  0x0035a880686a in start_thread () from /lib64/libpthread.so.0
#9  0x0035a7cde25d in clone () from /lib64/libc.so.6
#10 0x in ?? ()


Thanks
-John
--
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: [ANNOUNCE] kvm-88 release (CAN NOT install modules on debian/amd64/2.6.30)

2009-07-12 Thread Avi Kivity

On 07/12/2009 07:01 PM, John Wong wrote:


when i insmod ./kvm.ko, i see the error message like this:
sudo insmod ./kvm.ko
insmod: error inserting './kvm.ko': -1 Unknown symbol in module
and i can not load the modules on my debian/amd64 kernel-2.6.30

qemu-system-x86_64(kvm-88.tar.gz) is work on  my debian with 
kvm-kmod-2.6.30.1-rc2.tar.gz



It may help to compile your 2.6.30 kernel without CONFIG_TRACEPOINTS.

--
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


Re: [ANNOUNCE] kvm-88 release (CAN NOT install modules on debian/amd64/2.6.30)

2009-07-12 Thread John Wong

when i make install, i see some warning message like this:
WARNING: "__tracepoint_kvm_mmu_paging_element" 
[/ramdisk/kvm-88/kvm/kernel/x86/kvm.ko] undefined!
WARNING: "__tracepoint_kvm_mmu_sync_page" 
[/ramdisk/kvm-88/kvm/kernel/x86/kvm.ko] undefined!
WARNING: "__tracepoint_kvm_mmio" [/ramdisk/kvm-88/kvm/kernel/x86/kvm.ko] 
undefined!
WARNING: "__tracepoint_kvm_mmu_set_accessed_bit" 
[/ramdisk/kvm-88/kvm/kernel/x86/kvm.ko] undefined!
WARNING: "__tracepoint_kvm_exit" [/ramdisk/kvm-88/kvm/kernel/x86/kvm.ko] 
undefined!
WARNING: "__tracepoint_kvm_pio" [/ramdisk/kvm-88/kvm/kernel/x86/kvm.ko] 
undefined!
WARNING: "__tracepoint_kvm_mmu_zap_page" 
[/ramdisk/kvm-88/kvm/kernel/x86/kvm.ko] undefined!
WARNING: "__tracepoint_kvm_pic_set_irq" 
[/ramdisk/kvm-88/kvm/kernel/x86/kvm.ko] undefined!
WARNING: "__tracepoint_kvm_cpuid" 
[/ramdisk/kvm-88/kvm/kernel/x86/kvm.ko] undefined!
WARNING: "__tracepoint_kvm_mmu_unsync_page" 
[/ramdisk/kvm-88/kvm/kernel/x86/kvm.ko] undefined!
WARNING: "__tracepoint_kvm_msr" [/ramdisk/kvm-88/kvm/kernel/x86/kvm.ko] 
undefined!
WARNING: "__tracepoint_kvm_set_irq" 
[/ramdisk/kvm-88/kvm/kernel/x86/kvm.ko] undefined!
WARNING: "__tracepoint_kvm_apic_accept_irq" 
[/ramdisk/kvm-88/kvm/kernel/x86/kvm.ko] undefined!
WARNING: "__tracepoint_kvm_inj_virq" 
[/ramdisk/kvm-88/kvm/kernel/x86/kvm.ko] undefined!
WARNING: "__tracepoint_kvm_hypercall" 
[/ramdisk/kvm-88/kvm/kernel/x86/kvm.ko] undefined!
WARNING: "__tracepoint_kvm_page_fault" 
[/ramdisk/kvm-88/kvm/kernel/x86/kvm.ko] undefined!
WARNING: "__tracepoint_kvm_entry" 
[/ramdisk/kvm-88/kvm/kernel/x86/kvm.ko] undefined!
WARNING: "__tracepoint_kvm_apic" [/ramdisk/kvm-88/kvm/kernel/x86/kvm.ko] 
undefined!
WARNING: "__tracepoint_kvm_ioapic_set_irq" 
[/ramdisk/kvm-88/kvm/kernel/x86/kvm.ko] undefined!
WARNING: "__tracepoint_kvm_apic_ipi" 
[/ramdisk/kvm-88/kvm/kernel/x86/kvm.ko] undefined!
WARNING: "__tracepoint_kvm_cr" [/ramdisk/kvm-88/kvm/kernel/x86/kvm.ko] 
undefined!
WARNING: "__tracepoint_kvm_ack_irq" 
[/ramdisk/kvm-88/kvm/kernel/x86/kvm.ko] undefined!
WARNING: "__tracepoint_kvm_mmu_walker_error" 
[/ramdisk/kvm-88/kvm/kernel/x86/kvm.ko] undefined!
WARNING: "__tracepoint_kvm_mmu_get_page" 
[/ramdisk/kvm-88/kvm/kernel/x86/kvm.ko] undefined!
WARNING: "__tracepoint_kvm_mmu_set_dirty_bit" 
[/ramdisk/kvm-88/kvm/kernel/x86/kvm.ko] undefined!
WARNING: "__tracepoint_kvm_mmu_pagetable_walk" 
[/ramdisk/kvm-88/kvm/kernel/x86/kvm.ko] undefined!
WARNING: "__tracepoint_kvm_msi_set_irq" 
[/ramdisk/kvm-88/kvm/kernel/x86/kvm.ko] undefined!


when i depmod -a after install, i see some warning message like this:
/sbin/depmod -a
WARNING: Module /lib/modules/2.6.30-1-amd64/extra/kvm-intel.ko ignored, 
due to loop
WARNING: Module /lib/modules/2.6.30-1-amd64/extra/kvm-amd.ko ignored, 
due to loop
WARNING: Loop detected: /lib/modules/2.6.30-1-amd64/extra/kvm.ko which 
needs kvm.ko again!
WARNING: Module /lib/modules/2.6.30-1-amd64/extra/kvm.ko ignored, due to 
loop


when i insmod ./kvm.ko, i see the error message like this:
sudo insmod ./kvm.ko
insmod: error inserting './kvm.ko': -1 Unknown symbol in module
and i can not load the modules on my debian/amd64 kernel-2.6.30

qemu-system-x86_64(kvm-88.tar.gz) is work on  my debian with 
kvm-kmod-2.6.30.1-rc2.tar.gz


Please help, thank you.


--
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: [ANNOUNCE] kvm-88 release

2009-07-12 Thread John Rousseau

On 07/12/2009 09:31 AM, Avi Kivity wrote:

kvm-87 wasn't so hot due to networking not working with rtl8139 and
e1000.  So kvm-88 fixes that and brings a bunch of new features
(resizable sdl windows, multiboot, x2apic, and more). Enjoy.


Does anyone have this working with FC11?

I installed FC11 on a new laptop, replacing my old FC9-running laptop 
last week and I have been unable to run my Vista guest since:



# /usr/local/bin/qemu-system-x86_64 -hda /home/jrr/vista-x86_64.img -m 1536M 
-net nic,vlan=0,macaddr=52:54:00:12:32:00 -net tap,vlan=0,ifname=tap1 -vga std 
-full-screen -smp 2 -usb -usbdevice tablet
Executing /etc/qemu-ifup
Bringing up tap1 for bridged mode...
Adding tap1 to br0...
Bad ram offset 60909fff
Aborted


I've been running this guest since ~kvm-75 on FC9. Dropping the smp, usb 
and full-screen options doesn't help. The crash is after the cylon 
Windows startup bar but before the login screen.


Host is FC11 x86_64, 2.6.29.4-167.fc11.x86_64. Intel P8700. 4GB memory.
Guest is Vista Ultimate 64.

An added bonus is that the crash leaves Xorg in 640x480 resolution. I've 
also seen just a seg fault instead of the "Bad ram" error.


gdb reports the following if this is at all helpful:


Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x77cf5910 (LWP 3577)]
0x0035a7c81b3b in memset () from /lib64/libc.so.6
(gdb) where
#0  0x0035a7c81b3b in memset () from /lib64/libc.so.6
#1  0x004324a1 in pthread_attr_setdetachstate ()
#2  0x0052873b in pthread_attr_setdetachstate ()
#3  0x00528873 in pthread_attr_setdetachstate ()
#4  0x00528a16 in pthread_attr_setdetachstate ()
#5  0x0035a880686a in start_thread () from /lib64/libpthread.so.0
#6  0x0035a7cde25d in clone () from /lib64/libc.so.6
#7  0x in ?? ()
(gdb) info threads
  3 Thread 0x7683a910 (LWP 3578)  0x0035a880e778 in pread64 () from 
/lib64/libpthread.so.0
* 2 Thread 0x77cf5910 (LWP 3577)  0x0035a7c81b3b in memset () from 
/lib64/libc.so.6
  1 Thread 0x77d4a6f0 (LWP 3564)  0x0035a880d934 in __lll_lock_wait () 
from /lib64/libpthread.so.0


Thanks
-John
--
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: [ANNOUNCE] kvm-88 release

2009-07-12 Thread Avi Kivity

On 07/12/2009 06:06 PM, John Rousseau wrote:

On 07/12/2009 09:31 AM, Avi Kivity wrote:

kvm-87 wasn't so hot due to networking not working with rtl8139 and
e1000.  So kvm-88 fixes that and brings a bunch of new features
(resizable sdl windows, multiboot, x2apic, and more). Enjoy.


Does anyone have this working with FC11?



I run F11.

I installed FC11 on a new laptop, replacing my old FC9-running laptop 
last week and I have been unable to run my Vista guest since:


# /usr/local/bin/qemu-system-x86_64 -hda /home/jrr/vista-x86_64.img 
-m 1536M -net nic,vlan=0,macaddr=52:54:00:12:32:00 -net 
tap,vlan=0,ifname=tap1 -vga std -full-screen -smp 2 -usb -usbdevice 
tablet


Can you try without -full-screen?  Without -vga std?

Note -usbdevice tablet is only eating your cpu.


gdb reports the following if this is at all helpful:


Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x77cf5910 (LWP 3577)]
0x0035a7c81b3b in memset () from /lib64/libc.so.6
(gdb) where
#0  0x0035a7c81b3b in memset () from /lib64/libc.so.6
#1  0x004324a1 in pthread_attr_setdetachstate ()
#2  0x0052873b in pthread_attr_setdetachstate ()
#3  0x00528873 in pthread_attr_setdetachstate ()
#4  0x00528a16 in pthread_attr_setdetachstate ()
#5  0x0035a880686a in start_thread () from /lib64/libpthread.so.0
#6  0x0035a7cde25d in clone () from /lib64/libc.so.6
#7  0x in ?? ()
(gdb) info threads
  3 Thread 0x7683a910 (LWP 3578)  0x0035a880e778 in pread64 
() from /lib64/libpthread.so.0
* 2 Thread 0x77cf5910 (LWP 3577)  0x0035a7c81b3b in memset () 
from /lib64/libc.so.6
  1 Thread 0x77d4a6f0 (LWP 3564)  0x0035a880d934 in 
__lll_lock_wait () from /lib64/libpthread.so.0




Try ./configure --disable-strip.

--
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


[PATCH] remove unused structs from s390

2009-07-12 Thread Gleb Natapov
They are not used by common code without defines which s390 does not
have.

Signed-off-by: Gleb Natapov 
diff --git a/arch/s390/include/asm/kvm.h b/arch/s390/include/asm/kvm.h
index 0b2f829..3dfcaeb 100644
--- a/arch/s390/include/asm/kvm.h
+++ b/arch/s390/include/asm/kvm.h
@@ -15,15 +15,6 @@
  */
 #include 
 
-/* for KVM_GET_IRQCHIP and KVM_SET_IRQCHIP */
-struct kvm_pic_state {
-   /* no PIC for s390 */
-};
-
-struct kvm_ioapic_state {
-   /* no IOAPIC for s390 */
-};
-
 /* for KVM_GET_REGS and KVM_SET_REGS */
 struct kvm_regs {
/* general purpose regs for s390 */
--
Gleb.
--
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


[ANNOUNCE] kvm-88 release

2009-07-12 Thread Avi Kivity
kvm-87 wasn't so hot due to networking not working with rtl8139 and 
e1000.  So kvm-88 fixes that and brings a bunch of new features 
(resizable sdl windows, multiboot, x2apic, and more).  Enjoy.


Changes from kvm-87:
- merge upstream qemu.git
  - virtio indirect ring entries
- improves block performance for newer Linux guests
  - -net tap,sndbuf=... option for improving udp performance
  - msi-x support
  - sdl window resize
  - more flexible -net user configuration
  - -cpu host to pass through all host cpu features
  - multiboot support for -kernel
- fix KVM_GET_SUPPORTED_CPUID feature usage (Andre Przywara)
- fix register contents after SIPI (Gleb Natapov)
- re-enable device assignment (Markus Armbruster)
- fix ia64 build (Markus Armbruster)
- fix migration for virtio-net version > 7 (Michael S. Tsirkin)
- merge more code with upstream (Glauber Costa)
- fix vnet_hdr checks (Mark McLoughlin)
  - fixes broken tap networking with rtl8139 and e1000
- move extboot to standard optionrom location (Jan Kiszka)
- emulate 32-bit syscall/sysenter instructions on 64-bit guests
  (Andre Przywara)
  - allows cross-vendor live migration with 32-bit userspace on 64-bit 
kernel

- fix s390 memslot initialization for userspace_addr != 0
  (Christian Borntraeger)
- allow s390 stfle instruction to be executed by guest (Christian 
Borntraeger)

- prepare memory slot data structures for multiple large page sizes
  (Joerg Roedel)
- correct missing locking in PIT/IRQCHIP/SET_BSP_CPU ioctl paths
  (Marcelo Tosatti)
- do not allow invalid mtrr/pat settings (Marcelo Tosatti)
- ignore some more AMD system configuration msrs (Andre Przywara)
- introduce module parameter for ignoring unknown msrs (Andre Przywara)
- fix ftrace build when kvm is built into the kernel
- convert powerpc marker probes to tracepoints (Marcelo Tosatti)
- drop old kvmtrace code (Marcelo Tosatti)
- document kvm_io_device locking (Michael S. Tsirkin)
- switch coalesced mmio, PIT creation, io bus to slots_lock
  (Michael S. Tsirkin)
- fix locking imbalance (Jiri Slaby)
- irq tracing
- mmio tracing
- irqfd deassign (Gregory Haskins)
- x2apic support (Gleb Natapov)
- avoid redelivery of edge triggered interrupt before next edge (Gleb 
Natapov)

  - fixes keyboard issues running Windows XP x64 smp installer
- avoid pit division by zero (Marcelo Tosatti)
- fix KVM_GET_MSR_INDEX_LIST user memory corruption (Jan Kiszka)
- drop old cr3 checks in favor of new checks (Jan Kiszka)
- mmu tracing
- basic API documentation
- ignore msi requests if level = 0 (Michael S. Tsirkin)
- ioapic/pic/msi tracing (Gleb Natapov)
- don't kick vcpu if not in guest mode (Gleb Natapov)


Notes:
If you use the modules bundled with kvm-88, you can use any version
of Linux from 2.6.16 upwards.  You may also use kvm-88 userspace with
the kvm modules provided by Linux 2.6.25 or above.  Some features may
only be available in newer releases.


http://www.linux-kvm.org

--
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


Re: [PATCH] always report x2apic as supported feature

2009-07-12 Thread Avi Kivity

On 07/12/2009 04:10 PM, Gleb Natapov wrote:

We emulate x2apic in software, so host support is not required.

   


Applied, thanks.

--
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


[PATCH] always report x2apic as supported feature

2009-07-12 Thread Gleb Natapov
We emulate x2apic in software, so host support is not required.

Signed-off-by: Gleb Natapov 
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 00844eb..c256da7 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -1497,6 +1497,9 @@ static void do_cpuid_ent(struct kvm_cpuid_entry2 *entry, 
u32 function,
case 1:
entry->edx &= kvm_supported_word0_x86_features;
entry->ecx &= kvm_supported_word4_x86_features;
+   /* we support x2apic emulation even if host does not support
+  it since we emulate x2apic in software */
+   entry->ecx |= F(X2APIC);
break;
/* function 2 entries are STATEFUL. That is, repeated cpuid commands
 * may return different values. This forces us to get_cpu() before
--
Gleb.
--
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] enable x2APIC without interrupt remapping under KVM

2009-07-12 Thread Gleb Natapov
KVM would like to provide x2APIC interface to a guest without emulating
interrupt remapping device. The reason KVM prefers guest to use x2APIC
is that x2APIC interface is better virtualizable and provides better
performance than mmio xAPIC interface:

- msr exits are faster than mmio (no page table walk, emulation)
- no need to read back ICR to look at the busy bit
- one 64 bit ICR write instead of two 32 bit writes
- shared code with the Hyper-V paravirt interface

Included patch changes x2APIC enabling logic to enable it even if IR
initialization failed, but kernel runs under KVM and no apic id is
greater than 255 (if there is one spec requires BIOS to move to x2apic
mode before starting an OS).

Signed-off-by: Gleb Natapov 
Acked-by: Suresh Siddha 
---

This is based on x86 tree commit 5b9eea3e7 with checkpatch complains
fixed.

diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
index 0a1c283..6e67916 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -49,6 +49,7 @@
 #include 
 #include 
 #include 
+#include 
 
 unsigned int num_processors;
 
@@ -1361,52 +1362,74 @@ void enable_x2apic(void)
 }
 #endif /* CONFIG_X86_X2APIC */
 
-void __init enable_IR_x2apic(void)
+int __init enable_IR(void)
 {
 #ifdef CONFIG_INTR_REMAP
int ret;
-   unsigned long flags;
-   struct IO_APIC_route_entry **ioapic_entries = NULL;
 
ret = dmar_table_init();
if (ret) {
pr_debug("dmar_table_init() failed with %d:\n", ret);
-   goto ir_failed;
+   return 0;
}
 
if (!intr_remapping_supported()) {
pr_debug("intr-remapping not supported\n");
-   goto ir_failed;
+   return 0;
}
 
-
if (!x2apic_preenabled && skip_ioapic_setup) {
pr_info("Skipped enabling intr-remap because of skipping "
"io-apic setup\n");
-   return;
+   return 0;
}
 
+   if (enable_intr_remapping(x2apic_supported()))
+   return 0;
+
+   pr_info("Enabled Interrupt-remapping\n");
+
+   return 1;
+
+#endif
+   return 0;
+}
+
+void __init enable_IR_x2apic(void)
+{
+   unsigned long flags;
+   struct IO_APIC_route_entry **ioapic_entries = NULL;
+   int ret, x2apic_enabled = 0;
+
ioapic_entries = alloc_ioapic_entries();
if (!ioapic_entries) {
-   pr_info("Allocate ioapic_entries failed: %d\n", ret);
-   goto end;
+   pr_info("Allocate ioapic_entries failed\n");
+   goto out;
}
 
ret = save_IO_APIC_setup(ioapic_entries);
if (ret) {
pr_info("Saving IO-APIC state failed: %d\n", ret);
-   goto end;
+   goto out;
}
 
local_irq_save(flags);
-   mask_IO_APIC_setup(ioapic_entries);
mask_8259A();
+   mask_IO_APIC_setup(ioapic_entries);
 
-   ret = enable_intr_remapping(x2apic_supported());
-   if (ret)
-   goto end_restore;
+   ret = enable_IR();
+   if (!ret) {
+   /* IR is required if x2apic is enabled by BIOS even
+* when running in kvm since this indicates present
+* of APIC ID > 255 */
+   if (max_physical_apicid > 255 || !kvm_para_available())
+   goto nox2apic;
+   /* without IR all CPUs can be addressed by IOAPIC/MSI
+* only in physical mode */
+   x2apic_phys = 1;
+   }
 
-   pr_info("Enabled Interrupt-remapping\n");
+   x2apic_enabled = 1;
 
if (x2apic_supported() && !x2apic_mode) {
x2apic_mode = 1;
@@ -1414,41 +1437,30 @@ void __init enable_IR_x2apic(void)
pr_info("Enabled x2apic\n");
}
 
-end_restore:
-   if (ret)
-   /*
-* IR enabling failed
-*/
+nox2apic:
+   if (!ret) /* IR enabling failed */
restore_IO_APIC_setup(ioapic_entries);
-
unmask_8259A();
local_irq_restore(flags);
 
-end:
+out:
if (ioapic_entries)
free_ioapic_entries(ioapic_entries);
 
-   if (!ret)
+   if (x2apic_enabled)
return;
 
-ir_failed:
-   if (x2apic_preenabled)
+   if (x2apic_preenabled) {
+#ifdef CONFIG_INTR_REMAP
panic("x2apic enabled by bios. But IR enabling failed");
-   else if (cpu_has_x2apic)
-   pr_info("Not enabling x2apic,Intr-remapping\n");
 #else
-   if (!cpu_has_x2apic)
-   return;
-
-   if (x2apic_preenabled)
panic("x2apic enabled prior OS handover,"
- " enable CONFIG_X86_X2APIC, CONFIG_INTR_REMAP");
+   " enable CONFIG_X86_X2APIC, CONFIG_INTR_REMAP");
 #endif
-
-   return;
+   } else if (cpu_has_x2apic)
+   pr_info("Not enabling x2apic,Intr-remapping

[PATCH 0/4] moving irq routing and notifiers to RCU locking

2009-07-12 Thread Gleb Natapov
Make PIT to unregister IRQ ack notifier. Move irq ack notifier list in
teh same place where mask notifier list is.

Gleb Natapov (4):
  Move irq routing data structure to rcu locking
  Unregister ack notifier callback on PIT freeing.
  Move irq ack notifier list to arch independent code.
  Convert irq notifiers lists to RCU locking.

 arch/ia64/include/asm/kvm_host.h |1 -
 arch/x86/include/asm/kvm_host.h  |1 -
 arch/x86/kvm/i8254.c |2 +
 include/linux/kvm_host.h |3 +-
 virt/kvm/irq_comm.c  |   73 ++
 virt/kvm/kvm_main.c  |2 +-
 6 files changed, 40 insertions(+), 42 deletions(-)

--
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 2/4] Unregister ack notifier callback on PIT freeing.

2009-07-12 Thread Gleb Natapov

Signed-off-by: Gleb Natapov 
---
 arch/x86/kvm/i8254.c |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/arch/x86/kvm/i8254.c b/arch/x86/kvm/i8254.c
index 8c3ac30..05e00a8 100644
--- a/arch/x86/kvm/i8254.c
+++ b/arch/x86/kvm/i8254.c
@@ -642,6 +642,8 @@ void kvm_free_pit(struct kvm *kvm)
if (kvm->arch.vpit) {
kvm_unregister_irq_mask_notifier(kvm, 0,
   &kvm->arch.vpit->mask_notifier);
+   kvm_unregister_irq_ack_notifier(kvm,
+   &kvm->arch.vpit->pit_state.irq_ack_notifier);
mutex_lock(&kvm->arch.vpit->pit_state.lock);
timer = &kvm->arch.vpit->pit_state.pit_timer.timer;
hrtimer_cancel(timer);
-- 
1.6.2.1

--
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 4/4] Convert irq notifiers lists to RCU locking.

2009-07-12 Thread Gleb Natapov
Use RCU locking for mask/ack notifiers lists.

Signed-off-by: Gleb Natapov 
---
 virt/kvm/irq_comm.c |   20 +++-
 1 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/virt/kvm/irq_comm.c b/virt/kvm/irq_comm.c
index 5dde1ef..ba3a115 100644
--- a/virt/kvm/irq_comm.c
+++ b/virt/kvm/irq_comm.c
@@ -179,18 +179,18 @@ void kvm_notify_acked_irq(struct kvm *kvm, unsigned 
irqchip, unsigned pin)
break;
}
}
-   rcu_read_unlock();
 
-   hlist_for_each_entry(kian, n, &kvm->irq_ack_notifier_list, link)
+   hlist_for_each_entry_rcu(kian, n, &kvm->irq_ack_notifier_list, link)
if (kian->gsi == gsi)
kian->irq_acked(kian);
+   rcu_read_unlock();
 }
 
 void kvm_register_irq_ack_notifier(struct kvm *kvm,
   struct kvm_irq_ack_notifier *kian)
 {
mutex_lock(&kvm->irq_lock);
-   hlist_add_head(&kian->link, &kvm->irq_ack_notifier_list);
+   hlist_add_head_rcu(&kian->link, &kvm->irq_ack_notifier_list);
mutex_unlock(&kvm->irq_lock);
 }
 
@@ -198,8 +198,9 @@ void kvm_unregister_irq_ack_notifier(struct kvm *kvm,
struct kvm_irq_ack_notifier *kian)
 {
mutex_lock(&kvm->irq_lock);
-   hlist_del_init(&kian->link);
+   hlist_del_init_rcu(&kian->link);
mutex_unlock(&kvm->irq_lock);
+   synchronize_rcu();
 }
 
 int kvm_request_irq_source_id(struct kvm *kvm)
@@ -246,7 +247,7 @@ void kvm_register_irq_mask_notifier(struct kvm *kvm, int 
irq,
 {
mutex_lock(&kvm->irq_lock);
kimn->irq = irq;
-   hlist_add_head(&kimn->link, &kvm->mask_notifier_list);
+   hlist_add_head_rcu(&kimn->link, &kvm->mask_notifier_list);
mutex_unlock(&kvm->irq_lock);
 }
 
@@ -254,8 +255,9 @@ void kvm_unregister_irq_mask_notifier(struct kvm *kvm, int 
irq,
  struct kvm_irq_mask_notifier *kimn)
 {
mutex_lock(&kvm->irq_lock);
-   hlist_del(&kimn->link);
+   hlist_del_rcu(&kimn->link);
mutex_unlock(&kvm->irq_lock);
+   synchronize_rcu();
 }
 
 void kvm_fire_mask_notifiers(struct kvm *kvm, int irq, bool mask)
@@ -263,11 +265,11 @@ void kvm_fire_mask_notifiers(struct kvm *kvm, int irq, 
bool mask)
struct kvm_irq_mask_notifier *kimn;
struct hlist_node *n;
 
-   WARN_ON(!mutex_is_locked(&kvm->irq_lock));
-
-   hlist_for_each_entry(kimn, n, &kvm->mask_notifier_list, link)
+   rcu_read_lock();
+   hlist_for_each_entry_rcu(kimn, n, &kvm->mask_notifier_list, link)
if (kimn->irq == irq)
kimn->func(kimn, mask);
+   rcu_read_unlock();
 }
 
 void kvm_free_irq_routing(struct kvm *kvm)
-- 
1.6.2.1

--
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/4] Move irq routing data structure to rcu locking

2009-07-12 Thread Gleb Natapov

Signed-off-by: Gleb Natapov 
---
 include/linux/kvm_host.h |2 +-
 virt/kvm/irq_comm.c  |   55 +-
 virt/kvm/kvm_main.c  |1 -
 3 files changed, 26 insertions(+), 32 deletions(-)

diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index f54a0d3..6756b3e 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -161,7 +161,7 @@ struct kvm {
 
struct mutex irq_lock;
 #ifdef CONFIG_HAVE_KVM_IRQCHIP
-   struct list_head irq_routing; /* of kvm_kernel_irq_routing_entry */
+   struct kvm_kernel_irq_routing_entry *irq_routing;
struct hlist_head mask_notifier_list;
 #endif
 
diff --git a/virt/kvm/irq_comm.c b/virt/kvm/irq_comm.c
index 7af18b8..b2fa3f6 100644
--- a/virt/kvm/irq_comm.c
+++ b/virt/kvm/irq_comm.c
@@ -148,7 +148,8 @@ int kvm_set_irq(struct kvm *kvm, int irq_source_id, int 
irq, int level)
 * IOAPIC.  So set the bit in both. The guest will ignore
 * writes to the unused one.
 */
-   list_for_each_entry(e, &kvm->irq_routing, link)
+   rcu_read_lock();
+   for (e = rcu_dereference(kvm->irq_routing); e && e->set; e++) {
if (e->gsi == irq) {
int r = e->set(e, kvm, sig_level);
if (r < 0)
@@ -156,6 +157,8 @@ int kvm_set_irq(struct kvm *kvm, int irq_source_id, int 
irq, int level)
 
ret = r + ((ret < 0) ? 0 : ret);
}
+   }
+   rcu_read_unlock();
return ret;
 }
 
@@ -168,12 +171,15 @@ void kvm_notify_acked_irq(struct kvm *kvm, unsigned 
irqchip, unsigned pin)
 
trace_kvm_ack_irq(irqchip, pin);
 
-   list_for_each_entry(e, &kvm->irq_routing, link)
+   rcu_read_lock();
+   for (e = rcu_dereference(kvm->irq_routing); e && e->set; e++) {
if (e->irqchip.irqchip == irqchip &&
e->irqchip.pin == pin) {
gsi = e->gsi;
break;
}
+   }
+   rcu_read_unlock();
 
hlist_for_each_entry(kian, n, &kvm->arch.irq_ack_notifier_list, link)
if (kian->gsi == gsi)
@@ -264,19 +270,11 @@ void kvm_fire_mask_notifiers(struct kvm *kvm, int irq, 
bool mask)
kimn->func(kimn, mask);
 }
 
-static void __kvm_free_irq_routing(struct list_head *irq_routing)
-{
-   struct kvm_kernel_irq_routing_entry *e, *n;
-
-   list_for_each_entry_safe(e, n, irq_routing, link)
-   kfree(e);
-}
-
 void kvm_free_irq_routing(struct kvm *kvm)
 {
-   mutex_lock(&kvm->irq_lock);
-   __kvm_free_irq_routing(&kvm->irq_routing);
-   mutex_unlock(&kvm->irq_lock);
+   /* Called only during vm destruction. Nobody can use the pointer
+  at this stage */
+   kfree(kvm->irq_routing);
 }
 
 static int setup_routing_entry(struct kvm_kernel_irq_routing_entry *e,
@@ -326,43 +324,40 @@ int kvm_set_irq_routing(struct kvm *kvm,
unsigned nr,
unsigned flags)
 {
-   struct list_head irq_list = LIST_HEAD_INIT(irq_list);
-   struct list_head tmp = LIST_HEAD_INIT(tmp);
-   struct kvm_kernel_irq_routing_entry *e = NULL;
+   struct kvm_kernel_irq_routing_entry *new, *old;
unsigned i;
int r;
 
+   /* last element is left zeroed and indicates the end of the array */
+   new = kzalloc(sizeof(*new) * (nr + 1), GFP_KERNEL);
+
+   if (!new)
+   return -ENOMEM;
+
for (i = 0; i < nr; ++i) {
r = -EINVAL;
if (ue->gsi >= KVM_MAX_IRQ_ROUTES)
goto out;
if (ue->flags)
goto out;
-   r = -ENOMEM;
-   e = kzalloc(sizeof(*e), GFP_KERNEL);
-   if (!e)
-   goto out;
-   r = setup_routing_entry(e, ue);
+   r = setup_routing_entry(new + i, ue);
if (r)
goto out;
++ue;
-   list_add(&e->link, &irq_list);
-   e = NULL;
}
 
mutex_lock(&kvm->irq_lock);
-   list_splice(&kvm->irq_routing, &tmp);
-   INIT_LIST_HEAD(&kvm->irq_routing);
-   list_splice(&irq_list, &kvm->irq_routing);
-   INIT_LIST_HEAD(&irq_list);
-   list_splice(&tmp, &irq_list);
+   old = kvm->irq_routing;
+   rcu_assign_pointer(kvm->irq_routing, new);
mutex_unlock(&kvm->irq_lock);
 
+   synchronize_rcu();
+
r = 0;
+   new = old;
 
 out:
-   kfree(e);
-   __kvm_free_irq_routing(&irq_list);
+   kfree(new);
return r;
 }
 
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index cf20dc1..24013b4 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -945,7 +945,6 @@ static struct kvm *kvm_create_vm(void)
if (IS_ERR(kvm))
goto out;
 #ifdef CONFIG_HAVE_KVM_IRQCHIP
-   INIT_LIST_HEAD(&kvm->irq_routin

[PATCH 3/4] Move irq ack notifier list to arch independent code.

2009-07-12 Thread Gleb Natapov
Mask irq notifier list is already there.

Signed-off-by: Gleb Natapov 
---
 arch/ia64/include/asm/kvm_host.h |1 -
 arch/x86/include/asm/kvm_host.h  |1 -
 include/linux/kvm_host.h |1 +
 virt/kvm/irq_comm.c  |4 ++--
 virt/kvm/kvm_main.c  |1 +
 5 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/ia64/include/asm/kvm_host.h b/arch/ia64/include/asm/kvm_host.h
index d9b6325..a362e67 100644
--- a/arch/ia64/include/asm/kvm_host.h
+++ b/arch/ia64/include/asm/kvm_host.h
@@ -475,7 +475,6 @@ struct kvm_arch {
struct list_head assigned_dev_head;
struct iommu_domain *iommu_domain;
int iommu_flags;
-   struct hlist_head irq_ack_notifier_list;
 
unsigned long irq_sources_bitmap;
unsigned long irq_states[KVM_IOAPIC_NUM_PINS];
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
index 08732d7..eb723a7 100644
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
@@ -401,7 +401,6 @@ struct kvm_arch{
struct kvm_pic *vpic;
struct kvm_ioapic *vioapic;
struct kvm_pit *vpit;
-   struct hlist_head irq_ack_notifier_list;
int vapics_in_nmi_mode;
 
unsigned int tss_addr;
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index 6756b3e..f795f25 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -163,6 +163,7 @@ struct kvm {
 #ifdef CONFIG_HAVE_KVM_IRQCHIP
struct kvm_kernel_irq_routing_entry *irq_routing;
struct hlist_head mask_notifier_list;
+   struct hlist_head irq_ack_notifier_list;
 #endif
 
 #ifdef KVM_ARCH_WANT_MMU_NOTIFIER
diff --git a/virt/kvm/irq_comm.c b/virt/kvm/irq_comm.c
index b2fa3f6..5dde1ef 100644
--- a/virt/kvm/irq_comm.c
+++ b/virt/kvm/irq_comm.c
@@ -181,7 +181,7 @@ void kvm_notify_acked_irq(struct kvm *kvm, unsigned 
irqchip, unsigned pin)
}
rcu_read_unlock();
 
-   hlist_for_each_entry(kian, n, &kvm->arch.irq_ack_notifier_list, link)
+   hlist_for_each_entry(kian, n, &kvm->irq_ack_notifier_list, link)
if (kian->gsi == gsi)
kian->irq_acked(kian);
 }
@@ -190,7 +190,7 @@ void kvm_register_irq_ack_notifier(struct kvm *kvm,
   struct kvm_irq_ack_notifier *kian)
 {
mutex_lock(&kvm->irq_lock);
-   hlist_add_head(&kian->link, &kvm->arch.irq_ack_notifier_list);
+   hlist_add_head(&kian->link, &kvm->irq_ack_notifier_list);
mutex_unlock(&kvm->irq_lock);
 }
 
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 24013b4..53d9b70 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -946,6 +946,7 @@ static struct kvm *kvm_create_vm(void)
goto out;
 #ifdef CONFIG_HAVE_KVM_IRQCHIP
INIT_HLIST_HEAD(&kvm->mask_notifier_list);
+   INIT_HLIST_HEAD(&kvm->irq_ack_notifier_list);
 #endif
 
 #ifdef KVM_COALESCED_MMIO_PAGE_OFFSET
-- 
1.6.2.1

--
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] Move irq routing data structure to rcu locking

2009-07-12 Thread Avi Kivity

On 07/12/2009 01:07 PM, Gleb Natapov wrote:

On Sun, Jul 12, 2009 at 12:50:05PM +0300, Avi Kivity wrote:
   

On 07/09/2009 04:13 PM, Gleb Natapov wrote:
 

Change it from list to array to make RCU handling simpler.

Signed-off-by: Gleb Natapov
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index f54a0d3..12d8d2b 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -161,7 +161,8 @@ struct kvm {

struct mutex irq_lock;
   #ifdef CONFIG_HAVE_KVM_IRQCHIP
-   struct list_head irq_routing; /* of kvm_kernel_irq_routing_entry */
+   struct kvm_kernel_irq_routing_entry *irq_routing;
+   spinlock_t irq_routing_lock;
struct hlist_head mask_notifier_list;
   #endif

   

Why the new lock?

 

Currently routing table is protected by irq_lock mutex, but irq_lock is
overused. It protects too much of unrelated things and it is not clear what
its real purpose in life. I want to rid of it completely.
   


Separate discussion/patch.

--
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] Reduce interface between kvm general and kvm arch.

2009-07-12 Thread Avi Kivity

On 07/12/2009 02:02 PM, Gleb Natapov wrote:


s390 has:


int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu)
{
 /* kvm common code refers to this, but never calls it */
 BUG();
 return 0;
}

So this needs to be updated.  Please coordinate with the s390 folks.

 

s390 never calls kvm_vcpu_block(). They implement their own blocking.

   


Right; applied.

--
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] IRQ was moved to its own lock.

2009-07-12 Thread Avi Kivity

On 07/09/2009 03:33 PM, Gleb Natapov wrote:

Signed-off-by: Gleb Natapov
   


Applied, thanks.  Please copy kvm-ia64 on ia64 patches.

--
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] kvm_cpu_get_interrupt() is implemented only by x86.

2009-07-12 Thread Avi Kivity

On 07/09/2009 03:33 PM, Gleb Natapov wrote:

Move it from global .h file to arch/x86
   


Applied, thanks.

--
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] Reduce interface between kvm general and kvm arch.

2009-07-12 Thread Gleb Natapov
On Sun, Jul 12, 2009 at 02:03:17PM +0300, Avi Kivity wrote:
> On 07/09/2009 03:33 PM, Gleb Natapov wrote:
>>
>> diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
>> index 05b6bc7..cf20dc1 100644
>> --- a/virt/kvm/kvm_main.c
>> +++ b/virt/kvm/kvm_main.c
>> @@ -1666,9 +1666,7 @@ void kvm_vcpu_block(struct kvm_vcpu *vcpu)
>>  for (;;) {
>>  prepare_to_wait(&vcpu->wq,&wait, TASK_INTERRUPTIBLE);
>>
>> -if ((kvm_arch_interrupt_allowed(vcpu)&&
>> -kvm_cpu_has_interrupt(vcpu)) ||
>> -kvm_arch_vcpu_runnable(vcpu)) {
>> +if (kvm_arch_vcpu_runnable(vcpu)) {
>>  set_bit(KVM_REQ_UNHALT,&vcpu->requests);
>>  break;
>>  }
>>
>
> s390 has:
>
>
> int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu)
> {
> /* kvm common code refers to this, but never calls it */
> BUG();
> return 0;
> }
>
> So this needs to be updated.  Please coordinate with the s390 folks.
>
s390 never calls kvm_vcpu_block(). They implement their own blocking.

--
Gleb.
--
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] Reduce interface between kvm general and kvm arch.

2009-07-12 Thread Avi Kivity

On 07/09/2009 03:33 PM, Gleb Natapov wrote:


diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 05b6bc7..cf20dc1 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -1666,9 +1666,7 @@ void kvm_vcpu_block(struct kvm_vcpu *vcpu)
for (;;) {
prepare_to_wait(&vcpu->wq,&wait, TASK_INTERRUPTIBLE);

-   if ((kvm_arch_interrupt_allowed(vcpu)&&
-   kvm_cpu_has_interrupt(vcpu)) ||
-   kvm_arch_vcpu_runnable(vcpu)) {
+   if (kvm_arch_vcpu_runnable(vcpu)) {
set_bit(KVM_REQ_UNHALT,&vcpu->requests);
break;
}
   


s390 has:


int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu)
{
/* kvm common code refers to this, but never calls it */
BUG();
return 0;
}

So this needs to be updated.  Please coordinate with the s390 folks.

--
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] Move exception handling to the same place as other events.

2009-07-12 Thread Avi Kivity

On 07/09/2009 03:33 PM, Gleb Natapov wrote:

Signed-off-by: Gleb Natapov
   


Applied, thanks.

--
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: [autotest] [PATCH 1/6] add ebizzy in autotest

2009-07-12 Thread sudhir kumar
On Sat, Jul 11, 2009 at 6:05 AM, Martin Bligh wrote:
> On Fri, Jul 10, 2009 at 4:29 AM, sudhir kumar wrote:
>> So is there any plan for adding this patch set in the patch queue? I
>> would love to incorporate all the comments if any.
>
> Yup, just was behind on patches.
>
> I added it now - the mailer you are using seems to chew patches fairly
> thoroughly though ... if it's gmail, it does that ... might want to just
> attach as text ?
Thanks!
Ah! I have been using gmail only in the text mode. I was unable to
subscribe to the list using my imap id(and i use mutt client for that)
though.
Is this problem of gmail known to all? Any workaround ?

>
>> On Wed, Jul 8, 2009 at 1:47 PM, sudhir kumar wrote:
>>> This patch adds the wrapper for ebizzy into autotest. here is the link
>>> to get a copy of the test tarball.
>>> http://sourceforge.net/project/platformdownload.php?group_id=202378&sel_platform=3809
>>>
>>> Please review the patch and provide your comments.
>>>
>>>
>>> Signed-off-by: Sudhir Kumar 
>>>
>>> Index: autotest/client/tests/ebizzy/control
>>> ===
>>> --- /dev/null
>>> +++ autotest/client/tests/ebizzy/control
>>> @@ -0,0 +1,11 @@
>>> +NAME = "ebizzy"
>>> +AUTHOR = "Sudhir Kumar "
>>> +TIME = "MEDIUM, VARIABLE"
>>> +TEST_CATEGORY = "FUNCTIONAL"
>>> +TEST_CLASS = "SYSTEM STRESS"
>>> +TEST_TYPE = "CLIENT"
>>> +DOC = """
>>> +http://sourceforge.net/project/platformdownload.php?group_id=202378&sel_platform=3809
>>> +"""
>>> +
>>> +job.run_test('ebizzy', args = '-vv')
>>> Index: autotest/client/tests/ebizzy/ebizzy.py
>>> ===
>>> --- /dev/null
>>> +++ autotest/client/tests/ebizzy/ebizzy.py
>>> @@ -0,0 +1,32 @@
>>> +import os
>>> +from autotest_lib.client.bin import utils, test
>>> +from autotest_lib.client.common_lib import error
>>> +
>>> +class ebizzy(test.test):
>>> +    version = 3
>>> +
>>> +    def initialize(self):
>>> +        self.job.require_gcc()
>>> +
>>> +
>>> +    # 
>>> http://sourceforge.net/project/downloading.php?group_id=202378&filename=ebizzy-0.3.tar.gz
>>> +    def setup(self, tarball = 'ebizzy-0.3.tar.gz'):
>>> +        tarball = utils.unmap_url(self.bindir, tarball, self.tmpdir)
>>> +        utils.extract_tarball_to_dir(tarball, self.srcdir)
>>> +        os.chdir(self.srcdir)
>>> +
>>> +        utils.system('[ -x configure ] && ./configure')
>>> +        utils.system('make')
>>> +
>>> +
>>> +    # Note: default we use always mmap()
>>> +    def run_once(self, args = '', num_chunks = 1000, chunk_size =
>>> 512000, seconds = 100, num_threads = 100):
>>> +
>>> +        #TODO: Write small functions which will choose many of the above
>>> +        # variables dynamicaly looking at guest's total resources
>>> +        logfile = os.path.join(self.resultsdir, 'ebizzy.log')
>>> +        args2 = '-m -n %s -P -R -s %s -S %s -t %s' % (num_chunks,
>>> chunk_size, seconds, num_threads)
>>> +        args = args + ' ' + args2
>>> +
>>> +        cmd = os.path.join(self.srcdir, 'ebizzy') + ' ' + args
>>> +        utils.system(cmd)
>>>
>>>
>>> --
>>> Sudhir Kumar
>>>
>>
>>
>>
>> --
>> Sudhir Kumar
>>
>



-- 
Sudhir Kumar
--
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] Move irq routing data structure to rcu locking

2009-07-12 Thread Gleb Natapov
On Sun, Jul 12, 2009 at 12:50:05PM +0300, Avi Kivity wrote:
> On 07/09/2009 04:13 PM, Gleb Natapov wrote:
>> Change it from list to array to make RCU handling simpler.
>>
>> Signed-off-by: Gleb Natapov
>> diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
>> index f54a0d3..12d8d2b 100644
>> --- a/include/linux/kvm_host.h
>> +++ b/include/linux/kvm_host.h
>> @@ -161,7 +161,8 @@ struct kvm {
>>
>>  struct mutex irq_lock;
>>   #ifdef CONFIG_HAVE_KVM_IRQCHIP
>> -struct list_head irq_routing; /* of kvm_kernel_irq_routing_entry */
>> +struct kvm_kernel_irq_routing_entry *irq_routing;
>> +spinlock_t irq_routing_lock;
>>  struct hlist_head mask_notifier_list;
>>   #endif
>>
>
> Why the new lock?
>
Currently routing table is protected by irq_lock mutex, but irq_lock is
overused. It protects too much of unrelated things and it is not clear what
its real purpose in life. I want to rid of it completely.

--
Gleb.
--
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] Move irq routing data structure to rcu locking

2009-07-12 Thread Avi Kivity

On 07/09/2009 04:13 PM, Gleb Natapov wrote:

Change it from list to array to make RCU handling simpler.

Signed-off-by: Gleb Natapov
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index f54a0d3..12d8d2b 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -161,7 +161,8 @@ struct kvm {

struct mutex irq_lock;
  #ifdef CONFIG_HAVE_KVM_IRQCHIP
-   struct list_head irq_routing; /* of kvm_kernel_irq_routing_entry */
+   struct kvm_kernel_irq_routing_entry *irq_routing;
+   spinlock_t irq_routing_lock;
struct hlist_head mask_notifier_list;
  #endif
   


Why the new lock?

--
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] kvm/mmu: fix MMU_DEBUG compile breakage

2009-07-12 Thread Avi Kivity

On 07/09/2009 05:36 PM, Joerg Roedel wrote:

Signed-off-by: Joerg Roedel
   


Applied, thanks.

--
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 9/9] reuse upstream breakpoint code

2009-07-12 Thread Gleb Natapov
On Fri, Jul 10, 2009 at 04:18:00PM -0400, Glauber Costa wrote:
> Drop KVM_UPSTREAM around functions we intend to reuse.
> This allow us to share code in kvm-all.c, that is equal in qemu-kvm.c
> 
Can we push on_vcpu() to upstream? Then we will be able to reuse
kvm_update_guest_debug() from upstream too.

> Signed-off-by: Glauber Costa 
> CC: Jan Kiszka 
> ---
>  kvm-all.c  |5 ++-
>  kvm.h  |1 +
>  qemu-kvm.c |  140 
> +---
>  3 files changed, 6 insertions(+), 140 deletions(-)
> 
> diff --git a/kvm-all.c b/kvm-all.c
> index e42b1f6..67908a7 100644
> --- a/kvm-all.c
> +++ b/kvm-all.c
> @@ -873,6 +873,8 @@ void kvm_setup_guest_memory(void *start, size_t size)
>  }
>  }
>  
> +#endif /* KVM_UPSTREAM */
> +
>  #ifdef KVM_CAP_SET_GUEST_DEBUG
>  struct kvm_sw_breakpoint *kvm_find_sw_breakpoint(CPUState *env,
>   target_ulong pc)
> @@ -891,6 +893,7 @@ int kvm_sw_breakpoints_active(CPUState *env)
>  return !TAILQ_EMPTY(&env->kvm_state->kvm_sw_breakpoints);
>  }
>  
> +#ifdef KVM_UPSTREAM
>  int kvm_update_guest_debug(CPUState *env, unsigned long reinject_trap)
>  {
>  struct kvm_guest_debug dbg;
> @@ -904,6 +907,7 @@ int kvm_update_guest_debug(CPUState *env, unsigned long 
> reinject_trap)
>  
>  return kvm_vcpu_ioctl(env, KVM_SET_GUEST_DEBUG, &dbg);
>  }
> +#endif
>  
>  int kvm_insert_breakpoint(CPUState *current_env, target_ulong addr,
>target_ulong len, int type)
> @@ -1028,6 +1032,5 @@ void kvm_remove_all_breakpoints(CPUState *current_env)
>  {
>  }
>  #endif /* !KVM_CAP_SET_GUEST_DEBUG */
> -#endif
>  
>  #include "qemu-kvm.c"
> diff --git a/kvm.h b/kvm.h
> index e9a43e2..0191752 100644
> --- a/kvm.h
> +++ b/kvm.h
> @@ -16,6 +16,7 @@
>  
>  #include "config.h"
>  #include "sys-queue.h"
> +#include "qemu-kvm.h"
>  
>  #ifdef KVM_UPSTREAM
>  
> diff --git a/qemu-kvm.c b/qemu-kvm.c
> index 490024e..8778e6d 100644
> --- a/qemu-kvm.c
> +++ b/qemu-kvm.c
> @@ -2424,18 +2424,6 @@ int kvm_qemu_init_env(CPUState *cenv)
>  
>  #ifdef KVM_CAP_SET_GUEST_DEBUG
>  
> -struct kvm_sw_breakpoint *kvm_find_sw_breakpoint(CPUState *env,
> - target_ulong pc)
> -{
> -struct kvm_sw_breakpoint *bp;
> -
> -TAILQ_FOREACH(bp, &env->kvm_state->kvm_sw_breakpoints, entry) {
> - if (bp->pc == pc)
> - return bp;
> -}
> -return NULL;
> -}
> -
>  struct kvm_set_guest_debug_data {
>  struct kvm_guest_debug dbg;
>  int err;
> @@ -2464,133 +2452,7 @@ int kvm_update_guest_debug(CPUState *env, unsigned 
> long reinject_trap)
>  return data.err;
>  }
>  
> -int kvm_sw_breakpoints_active(CPUState *env)
> -{
> -return !TAILQ_EMPTY(&env->kvm_state->kvm_sw_breakpoints);
> -}
> -
> -int kvm_insert_breakpoint(CPUState *current_env, target_ulong addr,
> -  target_ulong len, int type)
> -{
> -struct kvm_sw_breakpoint *bp;
> -CPUState *env;
> -int err;
> -
> -if (type == GDB_BREAKPOINT_SW) {
> - bp = kvm_find_sw_breakpoint(current_env, addr);
> - if (bp) {
> - bp->use_count++;
> - return 0;
> - }
> -
> - bp = qemu_malloc(sizeof(struct kvm_sw_breakpoint));
> - if (!bp)
> - return -ENOMEM;
> -
> - bp->pc = addr;
> - bp->use_count = 1;
> - err = kvm_arch_insert_sw_breakpoint(current_env, bp);
> - if (err) {
> - free(bp);
> - return err;
> - }
> -
> -TAILQ_INSERT_HEAD(¤t_env->kvm_state->kvm_sw_breakpoints,
> -  bp, entry);
> -} else {
> - err = kvm_arch_insert_hw_breakpoint(addr, len, type);
> - if (err)
> - return err;
> -}
> -
> -for (env = first_cpu; env != NULL; env = env->next_cpu) {
> - err = kvm_update_guest_debug(env, 0);
> - if (err)
> - return err;
> -}
> -return 0;
> -}
> -
> -int kvm_remove_breakpoint(CPUState *current_env, target_ulong addr,
> -  target_ulong len, int type)
> -{
> -struct kvm_sw_breakpoint *bp;
> -CPUState *env;
> -int err;
> -
> -if (type == GDB_BREAKPOINT_SW) {
> - bp = kvm_find_sw_breakpoint(current_env, addr);
> - if (!bp)
> - return -ENOENT;
> -
> - if (bp->use_count > 1) {
> - bp->use_count--;
> - return 0;
> - }
> -
> - err = kvm_arch_remove_sw_breakpoint(current_env, bp);
> - if (err)
> - return err;
> -
> - TAILQ_REMOVE(¤t_env->kvm_state->kvm_sw_breakpoints, bp, entry);
> - qemu_free(bp);
> -} else {
> - err = kvm_arch_remove_hw_breakpoint(addr, len, type);
> - if (err)
> - return err;
> -}
> -
> -for (env = first_cpu; env != NULL; env = env->next_cpu) {
> - err = kvm_update_guest_debug(env, 0);
> - if (err)
> - return err;
> -}
> -return 0;
> -}
> -
> -void kvm_remove_all_breakpoints(CPUState *current_env)
> -{
> -struct kvm_sw

Re: Tap initialization

2009-07-12 Thread Avi Kivity

On 07/08/2009 08:17 AM, Stephane Bakhos wrote:
 I've been having some problem with recent releases when it comes to 
tap
 initialization. It seems that the script is ran after the tap is 
opened. I
 think this is a bit weird and useless as I want the script to setup 
the

 tap by itself.

 In net.c, the initialization (I assume) happen in
 static int net_tap_init

 setup_script is called after tap_open with the fd from tap_open as a
 parameter.

 However in setup_script, the fd is basically not used.

 Would there be any reason not to remove the fd parameter to 
setup_script,

 and then call setup_script before tap_open ?

 I've tried it with kvm-86 and it seems to work


You can get the same effect by setting up tap before launching qemu, 
and using qemu -net tap,ifname=...,script=no.


I thought that the point of the scripts was to have qemu create/delete 
taps as needed.


No, the scripts just configure the taps.



Most examples on the internet are based on that.

Another improvement would be to run the down script after qemu stops 
using the taps so that they can be deleted.


How do I create a patch and submit it?


See http://www.linux-kvm.org/page/Code and the numerous git tutorials.

--
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 0/9] Move closer to upstream

2009-07-12 Thread Avi Kivity

On 07/10/2009 11:17 PM, Glauber Costa wrote:

Hi,

This is another step at getting us closer to qemu upstream. I'm getting rid
of USE_KVM, replacing it with the combination of KVM_UPSTREAM and CONFIG_KVM

The goal is to slowly reduce that isolation. To demonstrate what I aim
for, the last patches of the series shares code for breakpoint handling.
next in my radar are ioctl functions and cpuid trimming.

Have fun

Changes from v1:
* Include qemu-kvm.c and qemu-kvm-x86.c instead of folding it, as by gleb
   suggestion.
* duplicate structures that we need, to avoid messing with upstream, per
   avi suggestion
* drop KVM_UPSTREAM instead of moving code, per Jan suggestion
* kvm_qemu_init() ->  kvm_init(smp_cpus), to get closer to upstream, per
   glommer evil twin suggestion
   


Doesn't apply, again due to the code movement patch.  Just use #includes 
again and leave me instructions for the actual folding.


--
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: [FIX REQUEST] Need better management for include/linux/*.h

2009-07-12 Thread Andi Kleen
Jaswinder Singh Rajput  writes:

> Hello all,
>
> As include/linux/*.h file count is going to reach 1000.
>
> We need to do some better techniques to reduce the number of files and
> add some hierarchy levels like sub directories where possible.

Why? 100 or 1000 really doesn't make much difference; in both
cases you cannot easily browse and have to use tab completion.
And I doubt your reorganization would go below 100.

I would just leave it as it is.

-Andi
-- 
a...@linux.intel.com -- Speaking for myself only.
--
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] remove leftover:

2009-07-12 Thread Avi Kivity

On 07/08/2009 03:34 PM, Glauber Costa wrote:

get rid of kvm_callbacks structure definition

   


Applied, thanks.

--
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: [KVM PATCH v10 0/2] ioeventfd (formerly iosignalfd)

2009-07-12 Thread Avi Kivity

On 07/08/2009 12:08 AM, Gregory Haskins wrote:

(Applies to kvm.git/master:3abaf217)

This is v10 of the series.  For more details, please see the header to
patch 2/2.

This series has been tested against the kvm-eventfd unit test, and
appears to be functioning properly.  You can download this test here:

ftp://ftp.novell.com/dev/ghaskins/kvm-eventfd.tar.bz2

(Note: unit test has been updated to accomodate new feature-set)

Please consider for inclusion to kvm.git

   


Applied, thanks.

--
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: [KVM PATCH v10 2/2] KVM: add ioeventfd support

2009-07-12 Thread Avi Kivity

On 07/09/2009 06:00 PM, Gregory Haskins wrote:



+   bool wildcard = args->flags&  KVM_IOEVENTFD_FLAG_DATAMATCH ?
+   true : false;

 

Doh!  Inverted logic.  "wildcard" should be "false" if DATAMATCH is
defined in the flags.

Avi, please reverse true/false here before accepting (assuming a v11
respin isn't needed).  Of course, if you would prefer me to just submit
a new patch, that is fine too.

   


I changed it to !(...).  I find the predicate ? true : false idiom 
confusing.


--
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: slow guest performance with build load, looking for ideas

2009-07-12 Thread Avi Kivity

On 07/09/2009 09:01 PM, Erik Jacobson wrote:



Please drop -usbdevice tablet and set the host I/O scheduler to
deadline.  Add cache=none to the -drive options.
 


yes, these changes make a difference.


Before starting qemu-kvm, I did this to change the IO scheduler:
BEFORE:
# for f in /sys/block/sd*/queue/scheduler; do cat $f; done
noop anticipatory deadline [cfq]
noop anticipatory deadline [cfq]

SET:
# for f in /sys/block/sd*/queue/scheduler; do echo "deadline">  $f; done

CONFIRM:
# for f in /sys/block/sd*/queue/scheduler; do cat $f; done
noop anticipatory [deadline] cfq
noop anticipatory [deadline] cfq


qemu command line.  Note that usbtablet is off and cache=none is used in
drive options:

/usr/bin/qemu-kvm -M pc -m 4096 -smp 8 -name f11-test -uuid 
b7b4b7e4-9c07-22aa-0c95-d5c8a24176c5 -monitor pty -pidfile 
/var/run/libvirt/qemu//f11-test.pid -drive 
file=/var/lib/libvirt/images/f11-test.img,if=virtio,index=0,boot=on,cache=none 
-drive file=/dev/sdb,if=virtio,index=1,cache=none -drive 
file=/var/lib/libvirt/images/test.img,if=virtio,index=2,cache=none -net 
nic,macaddr=54:52:00:46:48:0e,model=virtio -net user -serial pty -parallel none 
-usb -vnc cct201:1 -soundhw es1370 -redir tcp:::22


# rotation enabled this way in the guest, once the guest was started:
for f in /sys/block/vd*/queue/rotational; do echo 1>  $f; done

Test runs after make clean...
time (make -j12&&   make -j12 modules)

real10m25.585s
user26m36.450s
sys 8m14.776s

2nd trial (make clean followed by the same test again.
real9m21.626s
user26m42.144s
sys 8m14.532s

   


That's a scaling of 3.7, still pretty far from the host and even farther 
than my results.


Is the numa factor of this machine larger than usual?

--
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] Planning for the 0.11.0 release

2009-07-12 Thread Avi Kivity

On 07/10/2009 08:06 PM, Anthony Liguori wrote:
BTW, this is one of the challenges of doing pulls.  I did the pull and 
then deleted every qemu-io patch in my queue since I assumed that 
everything that should go in was part of hch's pull request.  In 
general, that's the only sane way to do pulls so if someone requests a 
pull in the future, please make sure that you've gone through and 
pulled any patch from the list first.


Pulls and stale queues are incompatible.  So long as everything is in 
patches, it doesn't matter since duplicate patches won't apply.  However 
a branch can't be based on a queue (since that's liable to change any 
time), and the branch can't commit and patches in the queue (since the 
queue might be committed any time).  If you want to pull, you'll need to 
shorten your queues (that will improve many other people's quality of 
life, btw).



--
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] add KVM module parameters documentation

2009-07-12 Thread Avi Kivity

On 07/10/2009 03:20 PM, Andre Przywara wrote:

Signed-off-by: Andre Przywara
   


Applied, thanks.

--
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: question about arch/s390/kvm/interrupt.c

2009-07-12 Thread Avi Kivity

(copying some s390 people)

On 07/10/2009 02:47 PM, Julia Lawall wrote:

In a recent version of linux-next, the function kvm_s390_handle_wait
contains the following code:

 add_wait_queue(&vcpu->arch.local_int.wq,&wait);
 while (list_empty(&vcpu->arch.local_int.list)&&
 list_empty(&vcpu->arch.local_int.float_int->list)&&
 (!vcpu->arch.local_int.timer_due)&&
 !signal_pending(current)) {
 set_current_state(TASK_INTERRUPTIBLE);
 spin_unlock_bh(&vcpu->arch.local_int.lock);
 spin_unlock(&vcpu->arch.local_int.float_int->lock);
 vcpu_put(vcpu);
 schedule();
 vcpu_load(vcpu);
 spin_lock(&vcpu->arch.local_int.float_int->lock);
 spin_lock_bh(&vcpu->arch.local_int.lock);
 }
 __unset_cpu_idle(vcpu);
 __set_current_state(TASK_RUNNING);
 remove_wait_queue(&vcpu->wq,&wait);

It seems a bit odd that the first argument to add_wait queue is
&vcpu->arch.local_int.wq but the first argument to remove_wait_queue is
&vcpu->wq.  I don't see any obvious evidence that they are the same thing,
but perhaps I am missing something.  Should either call be changed?

julia
   



--
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: [FIX REQUEST] Need better management for include/linux/*.h

2009-07-12 Thread Avi Kivity

On 07/11/2009 12:18 PM, Jaswinder Singh Rajput wrote:

Hello all,

As include/linux/*.h file count is going to reach 1000.

We need to do some better techniques to reduce the number of files and
add some hierarchy levels like sub directories where possible.

Like atmel is not exporting to user-space we can easily do :

include/linux/atmel-mci.h ->  include/linux/atmel/mci.h
include/linux/atmel_pdc.h ->  include/linux/atmel/pdc.h
include/linux/atmel-pwm-bl.h  ->  include/linux/atmel/pwm-bl.h
include/linux/atmel_pwm.h ->  include/linux/atmel/pwm.h
include/linux/atmel_serial.h  ->  include/linux/atmel/serial.h
include/linux/atmel-ssc.h ->  include/linux/atmel/ssc.h
include/linux/atmel_tc.h  ->  include/linux/atmel/tc.h

Also these files are not exporting :

include/linux/kvm_host.h  ->  include/linux/kvm/host.h
include/linux/kvm_para.h  ->  include/linux/kvm/para.h
include/linux/kvm_types.h ->  include/linux/kvm/types.h

   


IMO a much better move is to place non-ABI files (and the #ifdef KERNEL 
parts of ABI files) outside include/linux.



--
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