qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2] Tap: fix vcpu long time io blocking on tap
@ 2014-07-18  9:33 Wangkai (Kevin,C)
  2014-07-28 15:52 ` Stefan Hajnoczi
  0 siblings, 1 reply; 4+ messages in thread
From: Wangkai (Kevin,C) @ 2014-07-18  9:33 UTC (permalink / raw)
  To: qemu-devel@nongnu.org; +Cc: Lee yang, aliguori@amazon.com, Stefan Hajnoczi

fix vcpu long time io blocking on tap, when too many packets was delivered 
to the guest os via tap interface.

--
Signed-off-by: Wangkai <wangkai86@huawei.com>

diff --git a/net/tap.c b/net/tap.c
index a40f7f0..1da6d89 100644
--- a/net/tap.c
+++ b/net/tap.c
@@ -189,6 +189,7 @@ static void tap_send(void *opaque)
 {
     TAPState *s = opaque;
     int size;
+    int packets = 0;
 
     while (qemu_can_send_packet(&s->nc)) {
         uint8_t *buf = s->buf;
@@ -210,6 +211,19 @@ static void tap_send(void *opaque)
         } else if (size < 0) {
             break;
         }
+
+        /*
+         * When receive packets on tap, QEMU io was locked, if too many
+         * packets was delivered to the guest os via tap interface,
+         * tap_send() would keep looping, if then the VM required a io
+         * operation, would be blocked for a long time.
+         * Here we set the number to limit one tap interface receive time,
+         * keep io events fair and lock time little.
+         */
+        packets++;
+        if (packets >= 50) {
+            break;
+        }
     }
 }

--
2.0.0

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

* Re: [Qemu-devel] [PATCH v2] Tap: fix vcpu long time io blocking on tap
  2014-07-18  9:33 [Qemu-devel] [PATCH v2] Tap: fix vcpu long time io blocking on tap Wangkai (Kevin,C)
@ 2014-07-28 15:52 ` Stefan Hajnoczi
  2014-07-29 12:02   ` Wangkai (Kevin,C)
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Hajnoczi @ 2014-07-28 15:52 UTC (permalink / raw)
  To: Wangkai (Kevin,C)
  Cc: Lee yang, Stefan Hajnoczi, qemu-devel@nongnu.org,
	aliguori@amazon.com

[-- Attachment #1: Type: text/plain, Size: 797 bytes --]

On Fri, Jul 18, 2014 at 09:33:42AM +0000, Wangkai (Kevin,C) wrote:
> fix vcpu long time io blocking on tap, when too many packets was delivered 
> to the guest os via tap interface.
> 
> --
> Signed-off-by: Wangkai <wangkai86@huawei.com>

Thanks, applied to my net-next tree:
https://github.com/stefanha/qemu/commits/net-next

The patch did not apply cleanly so I had to do it manually:

  Applying: Tap: fix vcpu long time io blocking on tap
  fatal: corrupt patch at line 32
  Repository lacks necessary blobs to fall back on 3-way merge.
  Cannot fall back to three-way merge.
  Patch failed at 0001 Tap: fix vcpu long time io blocking on tap

Please use git-send-email(1).

I also adjusted the commit message and doc comments to fit QEMU style
and for grammar.

Stefan

[-- Attachment #2: Type: application/pgp-signature, Size: 473 bytes --]

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

* Re: [Qemu-devel] [PATCH v2] Tap: fix vcpu long time io blocking on tap
  2014-07-28 15:52 ` Stefan Hajnoczi
@ 2014-07-29 12:02   ` Wangkai (Kevin,C)
  2014-07-29 12:43     ` Stefan Hajnoczi
  0 siblings, 1 reply; 4+ messages in thread
From: Wangkai (Kevin,C) @ 2014-07-29 12:02 UTC (permalink / raw)
  To: Stefan Hajnoczi
  Cc: Lee yang, Stefan Hajnoczi, qemu-devel@nongnu.org,
	aliguori@amazon.com



> -----Original Message-----
> From: Stefan Hajnoczi [mailto:stefanha@gmail.com]
> Sent: Monday, July 28, 2014 11:53 PM
> To: Wangkai (Kevin,C)
> Cc: qemu-devel@nongnu.org; Lee yang; aliguori@amazon.com; Stefan
> Hajnoczi
> Subject: Re: [Qemu-devel] [PATCH v2] Tap: fix vcpu long time io
> blocking on tap
> 
> On Fri, Jul 18, 2014 at 09:33:42AM +0000, Wangkai (Kevin,C) wrote:
> > fix vcpu long time io blocking on tap, when too many packets was
> > delivered to the guest os via tap interface.
> >
> > --
> > Signed-off-by: Wangkai <wangkai86@huawei.com>
> 
> Thanks, applied to my net-next tree:
> https://github.com/stefanha/qemu/commits/net-next
> 
> The patch did not apply cleanly so I had to do it manually:
> 
>   Applying: Tap: fix vcpu long time io blocking on tap
>   fatal: corrupt patch at line 32
>   Repository lacks necessary blobs to fall back on 3-way merge.
>   Cannot fall back to three-way merge.
>   Patch failed at 0001 Tap: fix vcpu long time io blocking on tap
> 
> Please use git-send-email(1).
> 
> I also adjusted the commit message and doc comments to fit QEMU style
> and for grammar.
> 
> Stefan
[Wangkai (Kevin,C)] 


Hi Stefan,
I will send a patch v3 use git send-email to you.

Wangkai

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

* Re: [Qemu-devel] [PATCH v2] Tap: fix vcpu long time io blocking on tap
  2014-07-29 12:02   ` Wangkai (Kevin,C)
@ 2014-07-29 12:43     ` Stefan Hajnoczi
  0 siblings, 0 replies; 4+ messages in thread
From: Stefan Hajnoczi @ 2014-07-29 12:43 UTC (permalink / raw)
  To: Wangkai (Kevin,C)
  Cc: Lee yang, Stefan Hajnoczi, qemu-devel@nongnu.org,
	aliguori@amazon.com

On Tue, Jul 29, 2014 at 1:02 PM, Wangkai (Kevin,C) <wangkai86@huawei.com> wrote:
>
>
>> -----Original Message-----
>> From: Stefan Hajnoczi [mailto:stefanha@gmail.com]
>> Sent: Monday, July 28, 2014 11:53 PM
>> To: Wangkai (Kevin,C)
>> Cc: qemu-devel@nongnu.org; Lee yang; aliguori@amazon.com; Stefan
>> Hajnoczi
>> Subject: Re: [Qemu-devel] [PATCH v2] Tap: fix vcpu long time io
>> blocking on tap
>>
>> On Fri, Jul 18, 2014 at 09:33:42AM +0000, Wangkai (Kevin,C) wrote:
>> > fix vcpu long time io blocking on tap, when too many packets was
>> > delivered to the guest os via tap interface.
>> >
>> > --
>> > Signed-off-by: Wangkai <wangkai86@huawei.com>
>>
>> Thanks, applied to my net-next tree:
>> https://github.com/stefanha/qemu/commits/net-next
>>
>> The patch did not apply cleanly so I had to do it manually:
>>
>>   Applying: Tap: fix vcpu long time io blocking on tap
>>   fatal: corrupt patch at line 32
>>   Repository lacks necessary blobs to fall back on 3-way merge.
>>   Cannot fall back to three-way merge.
>>   Patch failed at 0001 Tap: fix vcpu long time io blocking on tap
>>
>> Please use git-send-email(1).
>>
>> I also adjusted the commit message and doc comments to fit QEMU style
>> and for grammar.
>>
>> Stefan
> [Wangkai (Kevin,C)]
>
>
> Hi Stefan,
> I will send a patch v3 use git send-email to you.

There is no need, I have already applied v2.

Thanks,
Stefan

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

end of thread, other threads:[~2014-07-29 12:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-18  9:33 [Qemu-devel] [PATCH v2] Tap: fix vcpu long time io blocking on tap Wangkai (Kevin,C)
2014-07-28 15:52 ` Stefan Hajnoczi
2014-07-29 12:02   ` Wangkai (Kevin,C)
2014-07-29 12:43     ` Stefan Hajnoczi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).