Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'virtio-next-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux

Pull virtio updates from Rusty Russell:
"No real surprises"

* tag 'virtio-next-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux:
MAINTAINERS: add tools/virtio/ under virtio
tools/virtio: move module license stub to module.h
virtio: include asm/barrier explicitly
virtio: VIRTIO_F_ANY_LAYOUT feature
lguest: fix example launcher compilation for broken glibc headers.
virtio-net: fix the race between channels setting and refill
tools/lguest: real barriers.
tools/lguest: fix missing rmb().
virtio_balloon: leak_balloon(): only tell host if we got pages deflated
virtio-pci: fix leaks of msix_affinity_masks
Fix comment typo "CONFIG_PAE"

+39 -20
+1
MAINTAINERS
··· 8890 8890 L: virtualization@lists.linux-foundation.org 8891 8891 S: Maintained 8892 8892 F: drivers/virtio/ 8893 + F: tools/virtio/ 8893 8894 F: drivers/net/virtio_net.c 8894 8895 F: drivers/block/virtio_blk.c 8895 8896 F: include/linux/virtio_*.h
+1 -4
drivers/net/virtio_net.c
··· 902 902 struct scatterlist sg; 903 903 struct virtio_net_ctrl_mq s; 904 904 struct net_device *dev = vi->dev; 905 - int i; 906 905 907 906 if (!vi->has_cvq || !virtio_has_feature(vi->vdev, VIRTIO_NET_F_MQ)) 908 907 return 0; ··· 915 916 queue_pairs); 916 917 return -EINVAL; 917 918 } else { 918 - for (i = vi->curr_queue_pairs; i < queue_pairs; i++) 919 - if (!try_fill_recv(&vi->rq[i], GFP_KERNEL)) 920 - schedule_delayed_work(&vi->refill, 0); 921 919 vi->curr_queue_pairs = queue_pairs; 920 + schedule_delayed_work(&vi->refill, 0); 922 921 } 923 922 924 923 return 0;
+2 -1
drivers/virtio/virtio_balloon.c
··· 192 192 * virtio_has_feature(vdev, VIRTIO_BALLOON_F_MUST_TELL_HOST); 193 193 * is true, we *have* to do it in this order 194 194 */ 195 - tell_host(vb, vb->deflate_vq); 195 + if (vb->num_pfns != 0) 196 + tell_host(vb, vb->deflate_vq); 196 197 mutex_unlock(&vb->balloon_lock); 197 198 release_pages_by_pfn(vb->pfns, vb->num_pfns); 198 199 }
+3 -2
drivers/virtio/virtio_pci.c
··· 289 289 290 290 pci_disable_msix(vp_dev->pci_dev); 291 291 vp_dev->msix_enabled = 0; 292 - vp_dev->msix_vectors = 0; 293 292 } 294 293 294 + vp_dev->msix_vectors = 0; 295 295 vp_dev->msix_used_vectors = 0; 296 296 kfree(vp_dev->msix_names); 297 297 vp_dev->msix_names = NULL; ··· 308 308 const char *name = dev_name(&vp_dev->vdev.dev); 309 309 unsigned i, v; 310 310 int err = -ENOMEM; 311 + 312 + vp_dev->msix_vectors = nvectors; 311 313 312 314 vp_dev->msix_entries = kmalloc(nvectors * sizeof *vp_dev->msix_entries, 313 315 GFP_KERNEL); ··· 338 336 err = -ENOSPC; 339 337 if (err) 340 338 goto error; 341 - vp_dev->msix_vectors = nvectors; 342 339 vp_dev->msix_enabled = 1; 343 340 344 341 /* Set the vector used for configuration */
+1
include/linux/virtio_ring.h
··· 1 1 #ifndef _LINUX_VIRTIO_RING_H 2 2 #define _LINUX_VIRTIO_RING_H 3 3 4 + #include <asm/barrier.h> 4 5 #include <linux/irqreturn.h> 5 6 #include <uapi/linux/virtio_ring.h> 6 7
+3
include/uapi/linux/virtio_config.h
··· 51 51 * suppressed them? */ 52 52 #define VIRTIO_F_NOTIFY_ON_EMPTY 24 53 53 54 + /* Can the device handle any descriptor layout? */ 55 + #define VIRTIO_F_ANY_LAYOUT 27 56 + 54 57 #endif /* _UAPI_LINUX_VIRTIO_CONFIG_H */
-1
tools/lguest/Makefile
··· 1 1 # This creates the demonstration utility "lguest" which runs a Linux guest. 2 - # Missing headers? Add "-I../../../include -I../../../arch/x86/include" 3 2 CFLAGS:=-m32 -Wall -Wmissing-declarations -Wmissing-prototypes -O3 -U_FORTIFY_SOURCE 4 3 5 4 all: lguest
+23 -9
tools/lguest/lguest.c
··· 42 42 #include <pwd.h> 43 43 #include <grp.h> 44 44 45 - #include <linux/virtio_config.h> 46 - #include <linux/virtio_net.h> 47 - #include <linux/virtio_blk.h> 48 - #include <linux/virtio_console.h> 49 - #include <linux/virtio_rng.h> 50 - #include <linux/virtio_ring.h> 51 - #include <asm/bootparam.h> 52 - #include "../../include/linux/lguest_launcher.h" 53 45 /*L:110 54 46 * We can ignore the 43 include files we need for this program, but I do want 55 47 * to draw attention to the use of kernel-style types. ··· 56 64 typedef uint16_t u16; 57 65 typedef uint8_t u8; 58 66 /*:*/ 67 + 68 + #include <linux/virtio_config.h> 69 + #include <linux/virtio_net.h> 70 + #include <linux/virtio_blk.h> 71 + #include <linux/virtio_console.h> 72 + #include <linux/virtio_rng.h> 73 + #include <linux/virtio_ring.h> 74 + #include <asm/bootparam.h> 75 + #include "../../include/linux/lguest_launcher.h" 59 76 60 77 #define BRIDGE_PFX "bridge:" 61 78 #ifndef SIOCBRADDIF ··· 178 177 * in precise order. 179 178 */ 180 179 #define wmb() __asm__ __volatile__("" : : : "memory") 181 - #define mb() __asm__ __volatile__("" : : : "memory") 180 + #define rmb() __asm__ __volatile__("lock; addl $0,0(%%esp)" : : : "memory") 181 + #define mb() __asm__ __volatile__("lock; addl $0,0(%%esp)" : : : "memory") 182 182 183 183 /* Wrapper for the last available index. Makes it easier to change. */ 184 184 #define lg_last_avail(vq) ((vq)->last_avail_idx) ··· 678 676 errx(1, "Guest moved used index from %u to %u", 679 677 last_avail, vq->vring.avail->idx); 680 678 679 + /* 680 + * Make sure we read the descriptor number *after* we read the ring 681 + * update; don't let the cpu or compiler change the order. 682 + */ 683 + rmb(); 684 + 681 685 /* 682 686 * Grab the next descriptor number they're advertising, and increment 683 687 * the index we've seen. ··· 701 693 max = vq->vring.num; 702 694 desc = vq->vring.desc; 703 695 i = head; 696 + 697 + /* 698 + * We have to read the descriptor after we read the descriptor number, 699 + * but there's a data dependency there so the CPU shouldn't reorder 700 + * that: no rmb() required. 701 + */ 704 702 705 703 /* 706 704 * If this is an indirect entry, then this buffer contains a descriptor
+5
tools/virtio/linux/module.h
··· 1 1 #include <linux/export.h> 2 + 3 + #define MODULE_LICENSE(__MODULE_LICENSE_value) \ 4 + static __attribute__((unused)) const char *__MODULE_LICENSE_name = \ 5 + __MODULE_LICENSE_value 6 +
-3
tools/virtio/linux/virtio.h
··· 45 45 void *priv; 46 46 }; 47 47 48 - #define MODULE_LICENSE(__MODULE_LICENSE_value) \ 49 - const char *__MODULE_LICENSE_name = __MODULE_LICENSE_value 50 - 51 48 /* Interfaces exported by virtio_ring. */ 52 49 int virtqueue_add_sgs(struct virtqueue *vq, 53 50 struct scatterlist *sgs[],