From: Jason Wang <jasowang@redhat.com> To: gaowanlong@cn.fujitsu.com Cc: krkumar2@in.ibm.com, aliguori@us.ibm.com, kvm@vger.kernel.org, mst@redhat.com, mprivozn@redhat.com, rusty@rustcorp.com.au, qemu-devel@nongnu.org, stefanha@redhat.com, jwhan@filewood.snu.ac.kr, shiyer@redhat.com Subject: Re: [PATCH 10/12] virtio-net: multiqueue support Date: Wed, 09 Jan 2013 17:30:07 +0800 [thread overview] Message-ID: <50ED389F.7050202@redhat.com> (raw) In-Reply-To: <50ED2918.2080400@cn.fujitsu.com> On 01/09/2013 04:23 PM, Wanlong Gao wrote: > On 01/08/2013 06:14 PM, Jason Wang wrote: >> On 01/08/2013 06:00 PM, Wanlong Gao wrote: >>> On 01/08/2013 05:51 PM, Jason Wang wrote: >>>> On 01/08/2013 05:49 PM, Wanlong Gao wrote: >>>>> On 01/08/2013 05:29 PM, Jason Wang wrote: >>>>>> On 01/08/2013 05:07 PM, Wanlong Gao wrote: >>>>>>> On 12/28/2012 06:32 PM, Jason Wang wrote: >>>>>>>> + } else if (nc->peer->info->type != NET_CLIENT_OPTIONS_KIND_TAP) { >>>>>>>> + ret = -1; >>>>>>>> + } else { >>>>>>>> + ret = tap_detach(nc->peer); >>>>>>>> + } >>>>>>>> + >>>>>>>> + return ret; >>>>>>>> +} >>>>>>>> + >>>>>>>> +static void virtio_net_set_queues(VirtIONet *n) >>>>>>>> +{ >>>>>>>> + int i; >>>>>>>> + >>>>>>>> + for (i = 0; i < n->max_queues; i++) { >>>>>>>> + if (i < n->curr_queues) { >>>>>>>> + assert(!peer_attach(n, i)); >>>>>>>> + } else { >>>>>>>> + assert(!peer_detach(n, i)); >>>>>>> I got a assert here, >>>>>>> qemu-system-x86_64: /work/git/qemu/hw/virtio-net.c:330: virtio_net_set_queues: Assertion `!peer_detach(n, i)' failed. >>>>>>> >>>>>>> Any thoughts? >>>>>>> >>>>>>> Thanks, >>>>>>> Wanlong Gao >>>>>> Thanks for the testing, which steps or cases did you met this assertion, >>>>>> migration, reboot or just changing the number of virtqueues? >>>>> I use the 3.8-rc2 to test it again, I saw this tag has the multi-tap support. >>>>> >>>>> I just can't start the QEMU use -netdev tap,id=hostnet0,queues=2,fd=%d,fd=%d -device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:ce:7b:29,bus=pci.0,addr=0x3 >>>>> >>>>> I pre-opened two tap fds, did I missing something? >>>> Nothing missed :) It should work. >>>> >>>> Could you please try not use fd=X and let qemu to create the file >>>> descriptors by itself? Btw, how did you create the two tap fds? >>> Can it create descriptors itself? I get >>> qemu-system-x86_64: -netdev tap,id=hostnet0,queues=2: Device 'tap' could not be initialized >> You need prepare an ifup script which default at /etc/qemu-ifup (like >> following). Or you may try to add a script=no after: >> >> #!/bin/sh >> >> switch=kvmbr0 >> >> /sbin/ifconfig $1 0.0.0.0 up >> /usr/sbin/brctl addif $switch $1 >> /usr/sbin/brctl stp $switch off >> >> This will let qemu create a tap fd itself and make it to be connected to >> a port of the bridge caled kvmbr0. > But how to support multi-queue in this way? Qemu will create the necessary multiqueue tap by itself, see patch 0/12. > I got guest kernel panic when using this way and set queues=4. Does it happens w/o or w/ a fd parameter? What's the qemu command line? Did you meet it during boot time? Thanks > > Thanks, > Wanlong Gao > >>> I create the tap fd like this, and dup create the second fd, third fd, right? >> The second and third fd should be created with TUNSETIFF with the same >> tap_name also. Btw, you need to specify a IFF_MULTI_QUEUE flag to tell >> the kernel you want to create a multiqueue tap device, otherwise the >> second and third calling of TUNSETIFF will fail. >> >> Thanks >>> int tap_fd = open("/dev/net/tun", O_RDWR); >>> int vhost_fd = open("/dev/vhost-net", O_RDWR); >>> char *tap_name = "tap"; >>> char cmd[2048]; >>> char brctl[256]; >>> char netup[256]; >>> struct ifreq ifr; >>> if (tap_fd < 0) { >>> printf("open tun device failed\n"); >>> return -1; >>> } >>> if (vhost_fd < 0) { >>> printf("open vhost-net device failed\n"); >>> return -1; >>> } >>> memset(&ifr, 0, sizeof(ifr)); >>> memcpy(ifr.ifr_name, tap_name, sizeof(tap_name)); >>> ifr.ifr_flags = IFF_TAP | IFF_NO_PI; >>> >>> /* >>> * setup tap net device >>> */ >>> if (ioctl(tap_fd, TUNSETIFF, &ifr) < 0) { >>> printf("setup tap net device failed\n"); >>> return -1; >>> } >>> >>> sprintf(brctl, "brctl addif virbr0 %s", tap_name); >>> sprintf(netup, "ifconfig %s up", tap_name); >>> system(brctl); >>> system(netup); >>> >>> Thanks, >>> Wanlong Gao >>> >>> >>>> Thanks >>>>> Thanks, >>>>> Wanlong Gao >>>>> >>>>>>>> + } >>>>>>>> + } >>>>>>>> +} >>>>>>>> + >>>>>>>> +static void virtio_net_set_multiqueue(VirtIONet *n, int multiqueue, int ctrl); >>>>>>>> + >>>>>>> -- >>>>>>> To unsubscribe from this list: send the line "unsubscribe kvm" in >>>>>>> the body of a message to majordomo@vger.kernel.org >>>>>>> More majordomo info at http://vger.kernel.org/majordomo-info.html >> > -- > To unsubscribe from this list: send the line "unsubscribe kvm" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html
WARNING: multiple messages have this Message-ID (diff)
From: Jason Wang <jasowang@redhat.com> To: gaowanlong@cn.fujitsu.com Cc: krkumar2@in.ibm.com, aliguori@us.ibm.com, kvm@vger.kernel.org, mst@redhat.com, mprivozn@redhat.com, rusty@rustcorp.com.au, qemu-devel@nongnu.org, stefanha@redhat.com, jwhan@filewood.snu.ac.kr, shiyer@redhat.com Subject: Re: [Qemu-devel] [PATCH 10/12] virtio-net: multiqueue support Date: Wed, 09 Jan 2013 17:30:07 +0800 [thread overview] Message-ID: <50ED389F.7050202@redhat.com> (raw) In-Reply-To: <50ED2918.2080400@cn.fujitsu.com> On 01/09/2013 04:23 PM, Wanlong Gao wrote: > On 01/08/2013 06:14 PM, Jason Wang wrote: >> On 01/08/2013 06:00 PM, Wanlong Gao wrote: >>> On 01/08/2013 05:51 PM, Jason Wang wrote: >>>> On 01/08/2013 05:49 PM, Wanlong Gao wrote: >>>>> On 01/08/2013 05:29 PM, Jason Wang wrote: >>>>>> On 01/08/2013 05:07 PM, Wanlong Gao wrote: >>>>>>> On 12/28/2012 06:32 PM, Jason Wang wrote: >>>>>>>> + } else if (nc->peer->info->type != NET_CLIENT_OPTIONS_KIND_TAP) { >>>>>>>> + ret = -1; >>>>>>>> + } else { >>>>>>>> + ret = tap_detach(nc->peer); >>>>>>>> + } >>>>>>>> + >>>>>>>> + return ret; >>>>>>>> +} >>>>>>>> + >>>>>>>> +static void virtio_net_set_queues(VirtIONet *n) >>>>>>>> +{ >>>>>>>> + int i; >>>>>>>> + >>>>>>>> + for (i = 0; i < n->max_queues; i++) { >>>>>>>> + if (i < n->curr_queues) { >>>>>>>> + assert(!peer_attach(n, i)); >>>>>>>> + } else { >>>>>>>> + assert(!peer_detach(n, i)); >>>>>>> I got a assert here, >>>>>>> qemu-system-x86_64: /work/git/qemu/hw/virtio-net.c:330: virtio_net_set_queues: Assertion `!peer_detach(n, i)' failed. >>>>>>> >>>>>>> Any thoughts? >>>>>>> >>>>>>> Thanks, >>>>>>> Wanlong Gao >>>>>> Thanks for the testing, which steps or cases did you met this assertion, >>>>>> migration, reboot or just changing the number of virtqueues? >>>>> I use the 3.8-rc2 to test it again, I saw this tag has the multi-tap support. >>>>> >>>>> I just can't start the QEMU use -netdev tap,id=hostnet0,queues=2,fd=%d,fd=%d -device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:ce:7b:29,bus=pci.0,addr=0x3 >>>>> >>>>> I pre-opened two tap fds, did I missing something? >>>> Nothing missed :) It should work. >>>> >>>> Could you please try not use fd=X and let qemu to create the file >>>> descriptors by itself? Btw, how did you create the two tap fds? >>> Can it create descriptors itself? I get >>> qemu-system-x86_64: -netdev tap,id=hostnet0,queues=2: Device 'tap' could not be initialized >> You need prepare an ifup script which default at /etc/qemu-ifup (like >> following). Or you may try to add a script=no after: >> >> #!/bin/sh >> >> switch=kvmbr0 >> >> /sbin/ifconfig $1 0.0.0.0 up >> /usr/sbin/brctl addif $switch $1 >> /usr/sbin/brctl stp $switch off >> >> This will let qemu create a tap fd itself and make it to be connected to >> a port of the bridge caled kvmbr0. > But how to support multi-queue in this way? Qemu will create the necessary multiqueue tap by itself, see patch 0/12. > I got guest kernel panic when using this way and set queues=4. Does it happens w/o or w/ a fd parameter? What's the qemu command line? Did you meet it during boot time? Thanks > > Thanks, > Wanlong Gao > >>> I create the tap fd like this, and dup create the second fd, third fd, right? >> The second and third fd should be created with TUNSETIFF with the same >> tap_name also. Btw, you need to specify a IFF_MULTI_QUEUE flag to tell >> the kernel you want to create a multiqueue tap device, otherwise the >> second and third calling of TUNSETIFF will fail. >> >> Thanks >>> int tap_fd = open("/dev/net/tun", O_RDWR); >>> int vhost_fd = open("/dev/vhost-net", O_RDWR); >>> char *tap_name = "tap"; >>> char cmd[2048]; >>> char brctl[256]; >>> char netup[256]; >>> struct ifreq ifr; >>> if (tap_fd < 0) { >>> printf("open tun device failed\n"); >>> return -1; >>> } >>> if (vhost_fd < 0) { >>> printf("open vhost-net device failed\n"); >>> return -1; >>> } >>> memset(&ifr, 0, sizeof(ifr)); >>> memcpy(ifr.ifr_name, tap_name, sizeof(tap_name)); >>> ifr.ifr_flags = IFF_TAP | IFF_NO_PI; >>> >>> /* >>> * setup tap net device >>> */ >>> if (ioctl(tap_fd, TUNSETIFF, &ifr) < 0) { >>> printf("setup tap net device failed\n"); >>> return -1; >>> } >>> >>> sprintf(brctl, "brctl addif virbr0 %s", tap_name); >>> sprintf(netup, "ifconfig %s up", tap_name); >>> system(brctl); >>> system(netup); >>> >>> Thanks, >>> Wanlong Gao >>> >>> >>>> Thanks >>>>> Thanks, >>>>> Wanlong Gao >>>>> >>>>>>>> + } >>>>>>>> + } >>>>>>>> +} >>>>>>>> + >>>>>>>> +static void virtio_net_set_multiqueue(VirtIONet *n, int multiqueue, int ctrl); >>>>>>>> + >>>>>>> -- >>>>>>> To unsubscribe from this list: send the line "unsubscribe kvm" in >>>>>>> the body of a message to majordomo@vger.kernel.org >>>>>>> More majordomo info at http://vger.kernel.org/majordomo-info.html >> > -- > To unsubscribe from this list: send the line "unsubscribe kvm" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2013-01-09 9:30 UTC|newest] Thread overview: 108+ messages / expand[flat|nested] mbox.gz Atom feed top 2012-12-28 10:31 [PATCH 00/12] Multiqueue virtio-net Jason Wang 2012-12-28 10:31 ` [Qemu-devel] " Jason Wang 2012-12-28 10:31 ` [PATCH 01/12] tap: multiqueue support Jason Wang 2012-12-28 10:31 ` [Qemu-devel] " Jason Wang 2013-01-09 9:56 ` Stefan Hajnoczi 2013-01-09 9:56 ` [Qemu-devel] " Stefan Hajnoczi 2013-01-09 15:25 ` Jason Wang 2013-01-09 15:25 ` [Qemu-devel] " Jason Wang 2013-01-10 8:32 ` Stefan Hajnoczi 2013-01-10 8:32 ` [Qemu-devel] " Stefan Hajnoczi 2013-01-10 10:28 ` Stefan Hajnoczi 2013-01-10 10:28 ` [Qemu-devel] " Stefan Hajnoczi 2013-01-10 13:52 ` Jason Wang 2013-01-10 13:52 ` [Qemu-devel] " Jason Wang 2012-12-28 10:31 ` [PATCH 02/12] net: introduce qemu_get_queue() Jason Wang 2012-12-28 10:31 ` [Qemu-devel] " Jason Wang 2012-12-28 10:31 ` [PATCH 03/12] net: introduce qemu_get_nic() Jason Wang 2012-12-28 10:31 ` [Qemu-devel] " Jason Wang 2012-12-28 10:31 ` [PATCH 04/12] net: intorduce qemu_del_nic() Jason Wang 2012-12-28 10:31 ` [Qemu-devel] " Jason Wang 2012-12-28 10:31 ` [PATCH 05/12] net: multiqueue support Jason Wang 2012-12-28 10:31 ` [Qemu-devel] " Jason Wang 2012-12-28 18:06 ` Blue Swirl 2012-12-28 18:06 ` [Qemu-devel] " Blue Swirl 2012-12-28 10:31 ` [PATCH 06/12] vhost: " Jason Wang 2012-12-28 10:31 ` [Qemu-devel] " Jason Wang 2012-12-28 10:31 ` [PATCH 07/12] virtio: introduce virtio_queue_del() Jason Wang 2012-12-28 10:31 ` [Qemu-devel] " Jason Wang 2013-01-08 7:14 ` Michael S. Tsirkin 2013-01-08 7:14 ` [Qemu-devel] " Michael S. Tsirkin 2013-01-08 9:28 ` Jason Wang 2013-01-08 9:28 ` [Qemu-devel] " Jason Wang 2012-12-28 10:32 ` [PATCH 08/12] virtio: add a queue_index to VirtQueue Jason Wang 2012-12-28 10:32 ` [Qemu-devel] " Jason Wang 2012-12-28 10:32 ` [PATCH 09/12] virtio-net: separate virtqueue from VirtIONet Jason Wang 2012-12-28 10:32 ` [Qemu-devel] " Jason Wang 2012-12-28 10:32 ` [PATCH 10/12] virtio-net: multiqueue support Jason Wang 2012-12-28 10:32 ` [Qemu-devel] " Jason Wang 2012-12-28 17:52 ` Blue Swirl 2012-12-28 17:52 ` [Qemu-devel] " Blue Swirl 2013-01-04 5:12 ` Jason Wang 2013-01-04 5:12 ` [Qemu-devel] " Jason Wang 2013-01-04 20:41 ` Blue Swirl 2013-01-04 20:41 ` [Qemu-devel] " Blue Swirl 2013-01-08 9:07 ` Wanlong Gao 2013-01-08 9:07 ` Wanlong Gao 2013-01-08 9:29 ` Jason Wang 2013-01-08 9:29 ` [Qemu-devel] " Jason Wang 2013-01-08 9:32 ` Wanlong Gao 2013-01-08 9:32 ` Wanlong Gao 2013-01-08 9:49 ` Wanlong Gao 2013-01-08 9:49 ` Wanlong Gao 2013-01-08 9:51 ` Jason Wang 2013-01-08 9:51 ` [Qemu-devel] " Jason Wang 2013-01-08 10:00 ` Wanlong Gao 2013-01-08 10:14 ` Jason Wang 2013-01-08 10:14 ` [Qemu-devel] " Jason Wang 2013-01-08 11:24 ` Wanlong Gao 2013-01-09 3:11 ` Jason Wang 2013-01-09 8:23 ` Wanlong Gao 2013-01-09 9:30 ` Jason Wang [this message] 2013-01-09 9:30 ` Jason Wang 2013-01-09 10:01 ` Wanlong Gao 2013-01-09 10:01 ` Wanlong Gao 2013-01-09 15:26 ` Jason Wang 2013-01-10 6:43 ` Jason Wang 2013-01-10 6:49 ` Wanlong Gao 2013-01-10 6:49 ` Wanlong Gao 2013-01-10 7:16 ` Jason Wang 2013-01-10 7:16 ` [Qemu-devel] " Jason Wang 2013-01-10 9:06 ` Wanlong Gao 2013-01-10 9:06 ` [Qemu-devel] " Wanlong Gao 2013-01-10 9:40 ` Jason Wang 2012-12-28 10:32 ` [PATCH 11/12] virtio-net: migration support for multiqueue Jason Wang 2012-12-28 10:32 ` [Qemu-devel] " Jason Wang 2013-01-08 7:10 ` Michael S. Tsirkin 2013-01-08 7:10 ` [Qemu-devel] " Michael S. Tsirkin 2013-01-08 9:27 ` Jason Wang 2013-01-08 9:27 ` [Qemu-devel] " Jason Wang 2012-12-28 10:32 ` [PATCH 12/12] virtio-net: compat multiqueue support Jason Wang 2012-12-28 10:32 ` [Qemu-devel] " Jason Wang 2013-01-09 14:29 ` [Qemu-devel] [PATCH 00/12] Multiqueue virtio-net Stefan Hajnoczi 2013-01-09 14:29 ` Stefan Hajnoczi 2013-01-09 15:32 ` Michael S. Tsirkin 2013-01-09 15:32 ` Michael S. Tsirkin 2013-01-09 15:33 ` Jason Wang 2013-01-09 15:33 ` [Qemu-devel] " Jason Wang 2013-01-10 8:44 ` Stefan Hajnoczi 2013-01-10 8:44 ` [Qemu-devel] " Stefan Hajnoczi 2013-01-10 9:34 ` Jason Wang 2013-01-10 9:34 ` Jason Wang 2013-01-10 11:49 ` Stefan Hajnoczi 2013-01-10 11:49 ` Stefan Hajnoczi 2013-01-10 14:15 ` Jason Wang 2013-01-10 14:15 ` [Qemu-devel] " Jason Wang 2013-01-14 19:44 ` Anthony Liguori 2013-01-14 19:44 ` [Qemu-devel] " Anthony Liguori 2013-01-15 10:12 ` Jason Wang 2013-01-15 10:12 ` [Qemu-devel] " Jason Wang 2013-01-16 15:09 ` Anthony Liguori 2013-01-16 15:09 ` [Qemu-devel] " Anthony Liguori 2013-01-16 15:19 ` Michael S. Tsirkin 2013-01-16 15:19 ` [Qemu-devel] " Michael S. Tsirkin 2013-01-16 16:14 ` Anthony Liguori 2013-01-16 16:14 ` [Qemu-devel] " Anthony Liguori 2013-01-16 16:48 ` Michael S. Tsirkin 2013-01-16 16:48 ` [Qemu-devel] " Michael S. Tsirkin 2013-01-17 10:31 ` Michael S. Tsirkin
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=50ED389F.7050202@redhat.com \ --to=jasowang@redhat.com \ --cc=aliguori@us.ibm.com \ --cc=gaowanlong@cn.fujitsu.com \ --cc=jwhan@filewood.snu.ac.kr \ --cc=krkumar2@in.ibm.com \ --cc=kvm@vger.kernel.org \ --cc=mprivozn@redhat.com \ --cc=mst@redhat.com \ --cc=qemu-devel@nongnu.org \ --cc=rusty@rustcorp.com.au \ --cc=shiyer@redhat.com \ --cc=stefanha@redhat.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.