[PATCH] These are my first patches to the kernel

2010-06-12 Thread K.de Jong
>From 6b9ac8708d856a425a9aaa598acdea3d89485bde Mon Sep 17 00:00:00 2001
From: UndiFineD 
Date: Sat, 12 Jun 2010 00:24:28 +0200
Subject: [PATCH] These are my first patches to the kernel
Janitor patches to kvm
Linus2.6: virt/kvm/

Signed-off-by: UndiFineD 
---
 virt/kvm/assigned-dev.c   |6 +++---
 virt/kvm/coalesced_mmio.h |4 ++--
 virt/kvm/ioapic.c |   17 -
 virt/kvm/ioapic.h |   14 +++---
 virt/kvm/iodev.h  |2 +-
 virt/kvm/irq_comm.c   |4 ++--
 virt/kvm/kvm_main.c   |   28 +---
 7 files changed, 36 insertions(+), 39 deletions(-)

diff --git a/virt/kvm/assigned-dev.c b/virt/kvm/assigned-dev.c
index 4d10b1e..81b0e36 100644
--- a/virt/kvm/assigned-dev.c
+++ b/virt/kvm/assigned-dev.c
@@ -19,8 +19,8 @@
 #include 
 #include "irq.h"

-static struct kvm_assigned_dev_kernel *kvm_find_assigned_dev(struct
list_head *head,
- int assigned_dev_id)
+static struct kvm_assigned_dev_kernel *kvm_find_assigned_dev(
+struct list_head *head, int assigned_dev_id)
 {
struct list_head *ptr;
struct kvm_assigned_dev_kernel *match;
@@ -791,7 +791,7 @@ long kvm_vm_ioctl_assigned_device(struct kvm *kvm,
unsigned ioctl,
goto out_free_irq_routing;
r = kvm_set_irq_routing(kvm, entries, routing.nr,
routing.flags);
-   out_free_irq_routing:
+out_free_irq_routing:
vfree(entries);
break;
}
diff --git a/virt/kvm/coalesced_mmio.h b/virt/kvm/coalesced_mmio.h
index 8a5959e..d45c5bc 100644
--- a/virt/kvm/coalesced_mmio.h
+++ b/virt/kvm/coalesced_mmio.h
@@ -25,9 +25,9 @@ struct kvm_coalesced_mmio_dev {
 int kvm_coalesced_mmio_init(struct kvm *kvm);
 void kvm_coalesced_mmio_free(struct kvm *kvm);
 int kvm_vm_ioctl_register_coalesced_mmio(struct kvm *kvm,
-   struct kvm_coalesced_mmio_zone *zone);
+struct kvm_coalesced_mmio_zone *zone);
 int kvm_vm_ioctl_unregister_coalesced_mmio(struct kvm *kvm,
- struct kvm_coalesced_mmio_zone *zone);
+struct kvm_coalesced_mmio_zone *zone);

 #else

diff --git a/virt/kvm/ioapic.c b/virt/kvm/ioapic.c
index 3500dee..80f00fd 100644
--- a/virt/kvm/ioapic.c
+++ b/virt/kvm/ioapic.c
@@ -44,22 +44,21 @@
 #include "irq.h"

 #if 0
-#define ioapic_debug(fmt,arg...) printk(KERN_WARNING fmt,##arg)
+#define ioapic_debug(fmt, arg...) printk(KERN_WARNING fmt, ##arg)
 #else
 #define ioapic_debug(fmt, arg...)
 #endif
 static int ioapic_deliver(struct kvm_ioapic *vioapic, int irq);

 static unsigned long ioapic_read_indirect(struct kvm_ioapic *ioapic,
- unsigned long addr,
- unsigned long length)
+unsigned long addr, unsigned long length)
 {
unsigned long result = 0;

switch (ioapic->ioregsel) {
case IOAPIC_REG_VERSION:
result = IOAPIC_NUM_PINS - 1) & 0xff) << 16)
- | (IOAPIC_VERSION_ID & 0xff));
+   | (IOAPIC_VERSION_ID & 0xff));
break;

case IOAPIC_REG_APIC_ID:
@@ -110,7 +109,7 @@ static void update_handled_vectors(struct
kvm_ioapic *ioapic)
for (i = 0; i < IOAPIC_NUM_PINS; ++i)
__set_bit(ioapic->redirtbl[i].fields.vector, handled_vectors);
memcpy(ioapic->handled_vectors, handled_vectors,
-  sizeof(handled_vectors));
+   sizeof(handled_vectors));
smp_wmb();
 }

@@ -221,7 +220,7 @@ int kvm_ioapic_set_irq(struct kvm_ioapic *ioapic,
int irq, int level)
 }

 static void __kvm_ioapic_update_eoi(struct kvm_ioapic *ioapic, int vector,
-int trigger_mode)
+int trigger_mode)
 {
int i;

@@ -277,7 +276,7 @@ static inline int ioapic_in_range(struct
kvm_ioapic *ioapic, gpa_t addr)
 }

 static int ioapic_mmio_read(struct kvm_io_device *this, gpa_t addr, int len,
-   void *val)
+void *val)
 {
struct kvm_ioapic *ioapic = to_ioapic(this);
u32 result;
@@ -320,7 +319,7 @@ static int ioapic_mmio_read(struct kvm_io_device
*this, gpa_t addr, int len,
 }

 static int ioapic_mmio_write(struct kvm_io_device *this, gpa_t addr, int len,
-const void *val)
+const void *val)
 {
struct kvm_ioapic *ioapic = to_ioapic(this);
u32 data;
@@ -328,7 +327,7 @@ static int ioapic_mmio_write(struct kvm_io_device
*this, gpa_t addr, int len,
return -EOPNOTSUPP;

ioapic_debug("ioapic_mmio_write addr=%p len=%d val=%p\n",
-(void*)addr, len, val);
+(void *)addr, len, val);
ASSERT(!(addr & 0xf));  /* check alignment */

if (len == 4 || len == 8)
diff --git a/virt/kvm/ioapic.h b/virt/kvm/ioapic.h
index 0b190c3..9036de4 100644
--- a/virt/kvm/ioapi

RE: [RFC PATCH v7 01/19] Add a new structure for skb buffer from external.

2010-06-12 Thread Xin, Xiaohui
>-Original Message-
>From: Herbert Xu [mailto:herb...@gondor.apana.org.au]
>Sent: Friday, June 11, 2010 1:21 PM
>To: Xin, Xiaohui
>Cc: Stephen Hemminger; net...@vger.kernel.org; kvm@vger.kernel.org;
>linux-ker...@vger.kernel.org; m...@redhat.com; mi...@elte.hu; 
>da...@davemloft.net;
>jd...@linux.intel.com
>Subject: Re: [RFC PATCH v7 01/19] Add a new structure for skb buffer from 
>external.
>
>On Wed, Jun 09, 2010 at 05:54:02PM +0800, Xin, Xiaohui wrote:
>>
>> I'm not sure if I understand your way correctly:
>> 1) Does the way only deal with driver with SG feature? Since packet
>> is non-linear...
>
>No the hardware doesn't have to support SG.  You just need to
>place the entire packet contents in a page instead of skb->head.
>
>> 2) Is skb->data still pointing to guest user buffers?
>> If yes, how to avoid the modifications to net core change to skb?
>
>skb->data would not point to guest user buffers.  In the common
>case the packet is not modified on its way to the guest so this
>is not an issue.
>
>In the rare case where it is modified, you only have to copy the
>bits which are modified and the cost of that is inconsequential
>since you have to write to that memory anyway.
>
>> 3) In our way only parts of drivers need be modified to support zero-copy.
>> and here, need we modify all the drivers?
>
>If you're asking the portion of each driver supporting zero-copy
>that needs to be modified, then AFAICS this doesn't change that
>very much at all.
>
>> I think to make skb->head empty at first will cause more effort to pass the 
>> check with
>> skb header. Have I missed something here? I really make the skb->head NULL
>> just before kfree(skb) in skb_release_data(), it's done by callback we have 
>> made for skb.
>
>No I'm not suggesting you set it to NULL.  It should have some
>memory allocated, but skb_headlen(skb) should be zero.
>
>Please have a look at how the napi_gro_frags interface works (e.g.,
>in drivers/net/cxgb3/sge.c).  This is exactly the model that I am
>suggesting.
>
>Cheers,
>--
>Visit Openswan at http://www.openswan.org/
>Email: Herbert Xu ~{PmV>HI~} 
>Home Page: http://gondor.apana.org.au/~herbert/
>PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

Herbert,
I explained what I think the thought in your mind here, please clarify if 
something missed.

1) Modify driver from netdev_alloc_skb() to alloc user pages if dev is 
zero-copyed.
  If the driver support PS mode, then modify alloc_page() too.
2) Add napi_gro_frags() in driver to receive the user pages instead of driver's 
receiving 
function.
3) napi_gro_frags() will allocate small skb and pull the header data from 
the first page to skb->data.

Is above the way what you have suggested?
I have thought something in detail about the way.

1) The first page will have an offset after the header is copied into allocated 
kernel skb. 
The offset should be recalculated when the user page data is transferred to 
guest. This 
may modify some of the gro code.

2) napi_gro_frags() may remove a page when it's data is totally be pulled, but 
we cannot 
put a user page as normally. This may modify the gro code too.

3) When the user buffer returned to guest, some of them need to be appended a 
vnet header.
That means for some pages, the vnet header room should be reserved when 
allocated.
But we cannot know which one will be used as the first page when allocated. If 
we reserved vnet header for each page, since the set_skb_frag() in guest driver 
only use the offset 0 for second pages, then page data will be wrong.

4) Since the user buffer pages should be released, so we still need a dtor 
callback to do that, and then I still need a place to hold it. How do you think 
about to put it in skb_shinfo?

Currently I can only think of this.
How do you think about then?

Thanks
Xiaohui 



--
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] fix kvm-kmod FPU save API

2010-06-12 Thread Jan Kiszka
Zachary Amsden wrote:
> Ensure the save struct gets 16-byte alignment.
> 

Thanks, applied.

Jan



signature.asc
Description: OpenPGP digital signature


[ kvm-Bugs-1876714 ] core dump

2010-06-12 Thread SourceForge.net
Bugs item #1876714, was opened at 2008-01-21 20:59
Message generated for change (Comment added) made by jessorensen
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=893831&aid=1876714&group_id=180599

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: amd
Group: None
>Status: Closed
Resolution: None
Priority: 5
Private: No
Submitted By: n7zzt (n7zzt)
Assigned to: Nobody/Anonymous (nobody)
Summary: core dump

Initial Comment:
The following error code was generated while attempting to start a previously 
installed qemu image under kvm: 
***
proudh...@t95:~/qemu-kvm$ kvm -no-acpi -m 512 -boot c win2k.img
unhandled vm exit:  0x0
rax  rbx 00060184 rcx 00ff rdx 
001f
rsi fffe0080 rdi fffe0080 rsp 0004ffe0 rbp 
0004fff0
r8   r9   r10  r11 

r12  r13  r14  r15 

rip 804689b1 rflags 0256
cs 0008 (/ p 1 dpl 0 db 1 s 1 type b l 0 g 0 avl 0)
ds 0023 (/ p 1 dpl 3 db 1 s 1 type 3 l 0 g 1 avl 0)
es 0023 (/ p 1 dpl 3 db 1 s 1 type 3 l 0 g 1 avl 0)
ss 0010 (/ p 1 dpl 0 db 1 s 1 type 3 l 0 g 1 avl 0)
fs 0030 (ffdff000/1fff p 1 dpl 0 db 1 s 1 type 3 l 0 g 1 avl 0)
gs  (/ p 1 dpl 0 db 0 s 1 type 3 l 0 g 0 avl 0)
tr 0028 (806e1000/20ab p 1 dpl 0 db 0 s 0 type 9 l 0 g 0 avl 0)
ldt  (/ p 0 dpl 0 db 0 s 0 type 0 l 0 g 0 avl 0)
gdt 80036000/3ff
idt 80036400/7ff
cr0 8001 cr2 fffe0080 cr3 3 cr4 0 cr8 0 efer 0
Aborted (core dumped)
proudh...@t95:~/qemu-kvm$
**
unfortunately, I do not know where the actual core dump file was written (if at 
all). I hope the above helps.


--

>Comment By: Jes Sorensen (jessorensen)
Date: 2010-06-12 09:36

Message:
Hi Eric,

Thanks for getting back on this.

Given that you no longer have the image available to test with and a lot
of issues like this have been fixed, I am going to close this bug.

If you or someone else hits the problem again with recent QEMU+KVM, we'd
love to hear about it.

Thanks,
Jes


--

Comment By: n7zzt (n7zzt)
Date: 2010-06-11 19:14

Message:
Jess,
um, I have long since dumped linux in favor of OS X. I had completely
forgotten about this posting and any data related to it has long since been
bit bucketed.

thanks for looking into it though.

- Eric


--

Comment By: Jes Sorensen (jessorensen)
Date: 2010-06-11 17:34

Message:
Hi,

Any chance you can verify whether this is still a probem?

I am trying to catch up on some of the older bugs to see what is still
outstanding.

Thanks,
Jes


--

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=893831&aid=1876714&group_id=180599
--
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-Bugs-1768187 ] Cannot boot windows 2000 guest

2010-06-12 Thread SourceForge.net
Bugs item #1768187, was opened at 2007-08-06 09:42
Message generated for change (Comment added) made by jessorensen
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=893831&aid=1768187&group_id=180599

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
>Status: Closed
>Resolution: Fixed
Priority: 5
Private: No
Submitted By: yunfeng (yunfeng)
Assigned to: Avi Kivity (avik)
Summary: Cannot boot windows 2000 guest 

Initial Comment:
The speed of booting windows guest is very slow.
On a harwich/paxiville with 16Lps, from starting boot to network started the 
time-comsuming is more than 4 minutes.
And "top" on host shows the cpu usage of qemu is always >100% while booting 
windows guest.

Date of start boot
Mon Aug  6 15:24:00 CST 2007
Date of network started.
Mon Aug  6 15:28:19 CST 2007a

top - 15:28:01 up  1:59,  8 users,  load average: 1.89, 1.25, 0.94
Tasks: 153 total,   2 running, 151 sleeping,   0 stopped,   0 zombie
Cpu(s):  5.9%us, 35.0%sy,  0.0%ni, 59.0%id,  0.0%wa,  0.0%hi,  0.1%si,  0.0%st
Mem:   8301780k total,  4058824k used,  4242956k free,69152k buffers
Swap:0k total,0k used,0k free,  3508288k cached

PID USER  PR  NI  VIRT  RES  SHR S %CPU %MEMTIME+  COMMAND
24141 root  18   0  316m  38m  33m R  158  0.5   6:45.40 qemu   
17262 root  15   0 38272  12m 8160 S   14  0.1   0:04.72 gnome-terminal 
 4500 root  15   0 22740  16m 5340 S1  0.2   0:52.00 Xvnc   


--

>Comment By: Jes Sorensen (jessorensen)
Date: 2010-06-12 09:34

Message:
Hi

Thanks for getting back on this. Given that the PAE problem is a different
problem, I am going to close this bug.

Thanks,
Jes


--

Comment By: Xudong Hao (haoxudong)
Date: 2010-06-12 07:28

Message:
This issue did not happen on recent KVM.
However, there is another Window boot issue:
32PAE Windows guest is slow to boot with acpi on shadow
https://sourceforge.net/tracker/?func=detail&aid=2976863&group_id=180599&atid=893831

--

Comment By: Jes Sorensen (jessorensen)
Date: 2010-06-11 11:28

Message:
Hi,

Does this still happen with recent KVM?

What arguments did you pass to qemu-kvm ?

Thanks,
Jes


--

Comment By: Technologov (technologov)
Date: 2007-11-13 11:24

Message:
Logged In: YES 
user_id=1839746
Originator: NO

Please try to setup a new Win 2000 guest with -no-acpi.

--

Comment By: yunfeng (yunfeng)
Date: 2007-09-30 18:00

Message:
Logged In: YES 
user_id=1283543
Originator: YES

The guest could be booted up successfuly if use "-no-kvm".
What platform are you using?


--

Comment By: Avi Kivity (avik)
Date: 2007-09-22 15:17

Message:
Logged In: YES 
user_id=539971
Originator: NO

Is it possible that the image is corrupted?

I just booted another image, again in a minute or so.

--

Comment By: yunfeng (yunfeng)
Date: 2007-09-21 14:07

Message:
Logged In: YES 
user_id=1283543
Originator: YES

It still exists on our test machine.
booting noacpi win2k is very slow.
SMP win2k can boot fast, but turn black before geting to login gui.

our test machine is a harwich/paxville with 16lp .


--

Comment By: Avi Kivity (avik)
Date: 2007-09-20 21:22

Message:
Logged In: YES 
user_id=539971
Originator: NO

Is this still happening? our automated tester shows Windows 2000 booting
in about a minute.

--

Comment By: yunfeng (yunfeng)
Date: 2007-09-12 11:42

Message:
Logged In: YES 
user_id=1283543
Originator: YES

Windows 2000 will hang on the starting process for hours.

--

Comment By: yunfeng (yunfeng)
Date: 2007-08-27 23:38

Message:
Logged In: YES 
user_id=1283543
Originator: YES

Retested against latest kvm commit. The speed is very too even with these
bios from http://people.qumranet.com:/avi/bios-images/


--

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=893831&aid=1768187&group_id=180599
--
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