search for: vhost_vsock_dev_open

Displaying 20 results from an estimated 50 matches for "vhost_vsock_dev_open".

2017 Jan 04
2
GFP_REPEAT usage in vhost_net_open resp. vhost_vsock_dev_open
Hi Michael, I am currently cleaning up opencoded kmalloc with vmalloc fallback users [1] and my current kvmalloc_node helper doesn't support GFP_REPEAT because there are no users which would need it. At least that's what I thought until I've encountered vhost_vsock_dev_open resp. vhost_vsock_dev_open which are trying to use GFP_REPEAT for kmalloc. 23cc5a991c7a ("vhost-net: extend device allocation to vmalloc") explains the motivation as follows: " As vmalloc() adds overhead on a critical network path, add __GFP_REPEAT to kzalloc() flags to do this fallb...
2017 Jan 04
2
GFP_REPEAT usage in vhost_net_open resp. vhost_vsock_dev_open
Hi Michael, I am currently cleaning up opencoded kmalloc with vmalloc fallback users [1] and my current kvmalloc_node helper doesn't support GFP_REPEAT because there are no users which would need it. At least that's what I thought until I've encountered vhost_vsock_dev_open resp. vhost_vsock_dev_open which are trying to use GFP_REPEAT for kmalloc. 23cc5a991c7a ("vhost-net: extend device allocation to vmalloc") explains the motivation as follows: " As vmalloc() adds overhead on a critical network path, add __GFP_REPEAT to kzalloc() flags to do this fallb...
2017 Jan 04
0
GFP_REPEAT usage in vhost_net_open resp. vhost_vsock_dev_open
...o wrote: > Hi Michael, > I am currently cleaning up opencoded kmalloc with vmalloc fallback users > [1] and my current kvmalloc_node helper doesn't support GFP_REPEAT > because there are no users which would need it. At least that's what I > thought until I've encountered vhost_vsock_dev_open resp. > vhost_vsock_dev_open which are trying to use GFP_REPEAT for kmalloc. > 23cc5a991c7a ("vhost-net: extend device allocation to vmalloc") explains > the motivation as follows: > " > As vmalloc() adds overhead on a critical network path, add __GFP_REPEAT > to kz...
2016 Aug 02
1
[PATCH -next] VSOCK: Use kvfree()
...rivers/vhost/vsock.c index 028ca16..0ddf3a2 100644 --- a/drivers/vhost/vsock.c +++ b/drivers/vhost/vsock.c @@ -434,10 +434,7 @@ err: static void vhost_vsock_free(struct vhost_vsock *vsock) { - if (is_vmalloc_addr(vsock)) - vfree(vsock); - else - kfree(vsock); + kvfree(vsock); } static int vhost_vsock_dev_open(struct inode *inode, struct file *file)
2016 Aug 02
1
[PATCH -next] VSOCK: Use kvfree()
...rivers/vhost/vsock.c index 028ca16..0ddf3a2 100644 --- a/drivers/vhost/vsock.c +++ b/drivers/vhost/vsock.c @@ -434,10 +434,7 @@ err: static void vhost_vsock_free(struct vhost_vsock *vsock) { - if (is_vmalloc_addr(vsock)) - vfree(vsock); - else - kfree(vsock); + kvfree(vsock); } static int vhost_vsock_dev_open(struct inode *inode, struct file *file)
2020 Nov 03
0
[PATCH 04/17] vhost: prep vhost_dev_init users to handle failures
...21-20201101 (attached as .config) compiler: gcc-9 (Debian 9.3.0-15) 9.3.0 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp at intel.com> Reported-by: Dan Carpenter <dan.carpenter at oracle.com> smatch warnings: drivers/vhost/vsock.c:648 vhost_vsock_dev_open() error: uninitialized symbol 'ret'. vim +/ret +648 drivers/vhost/vsock.c 433fc58e6bf2c8b Asias He 2016-07-28 605 static int vhost_vsock_dev_open(struct inode *inode, struct file *file) 433fc58e6bf2c8b Asias He 2016-07-28 606 { 433fc58e6bf2c8b Asias He 2016-07-28...
2013 Jun 27
2
[RFC 4/5] VSOCK: Introduce vhost-vsock.ko
...rk) > +{ > + struct vhost_virtqueue *vq = container_of(work, struct vhost_virtqueue, > + poll.work); > + struct vhost_vsock *vsock = container_of(vq->dev, struct vhost_vsock, > + dev); > + > + vhost_transport_do_send_pkt(vsock, vq); > +} > + > +static int vhost_vsock_dev_open(struct inode *inode, struct file *file) > +{ > + struct vhost_virtqueue **vqs; > + struct vhost_vsock *vsock; > + int ret; > + > + vsock = kzalloc(sizeof(*vsock), GFP_KERNEL); > + if (!vsock) > + return -ENOMEM; > + > + pr_debug("%s:vsock=%p\n", __func__, vs...
2013 Jun 27
2
[RFC 4/5] VSOCK: Introduce vhost-vsock.ko
...rk) > +{ > + struct vhost_virtqueue *vq = container_of(work, struct vhost_virtqueue, > + poll.work); > + struct vhost_vsock *vsock = container_of(vq->dev, struct vhost_vsock, > + dev); > + > + vhost_transport_do_send_pkt(vsock, vq); > +} > + > +static int vhost_vsock_dev_open(struct inode *inode, struct file *file) > +{ > + struct vhost_virtqueue **vqs; > + struct vhost_vsock *vsock; > + int ret; > + > + vsock = kzalloc(sizeof(*vsock), GFP_KERNEL); > + if (!vsock) > + return -ENOMEM; > + > + pr_debug("%s:vsock=%p\n", __func__, vs...
2013 Jun 27
0
[RFC 4/5] VSOCK: Introduce vhost-vsock.ko
...d vhost_vsock_handle_rx_kick(struct vhost_work *work) +{ + struct vhost_virtqueue *vq = container_of(work, struct vhost_virtqueue, + poll.work); + struct vhost_vsock *vsock = container_of(vq->dev, struct vhost_vsock, + dev); + + vhost_transport_do_send_pkt(vsock, vq); +} + +static int vhost_vsock_dev_open(struct inode *inode, struct file *file) +{ + struct vhost_virtqueue **vqs; + struct vhost_vsock *vsock; + int ret; + + vsock = kzalloc(sizeof(*vsock), GFP_KERNEL); + if (!vsock) + return -ENOMEM; + + pr_debug("%s:vsock=%p\n", __func__, vsock); + + vqs = kmalloc(VSOCK_VQ_MAX * sizeof(*vqs...
2017 Nov 09
0
[PATCH] vhost/vsock: fix uninitialized vhost_vsock->guest_cid
...tefan Hajnoczi <stefanha at redhat.com> --- drivers/vhost/vsock.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/vhost/vsock.c b/drivers/vhost/vsock.c index c9de9c41aa97..5a5e981bd8e4 100644 --- a/drivers/vhost/vsock.c +++ b/drivers/vhost/vsock.c @@ -518,6 +518,8 @@ static int vhost_vsock_dev_open(struct inode *inode, struct file *file) goto out; } + vsock->guest_cid = 0; /* no CID assigned yet */ + atomic_set(&vsock->queued_replies, 0); vqs[VSOCK_VQ_TX] = &vsock->vqs[VSOCK_VQ_TX]; -- 2.13.6
2017 Nov 09
0
[PATCH] vhost/vsock: fix uninitialized vhost_vsock->guest_cid
...tefan Hajnoczi <stefanha at redhat.com> --- drivers/vhost/vsock.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/vhost/vsock.c b/drivers/vhost/vsock.c index c9de9c41aa97..5a5e981bd8e4 100644 --- a/drivers/vhost/vsock.c +++ b/drivers/vhost/vsock.c @@ -518,6 +518,8 @@ static int vhost_vsock_dev_open(struct inode *inode, struct file *file) goto out; } + vsock->guest_cid = 0; /* no CID assigned yet */ + atomic_set(&vsock->queued_replies, 0); vqs[VSOCK_VQ_TX] = &vsock->vqs[VSOCK_VQ_TX]; -- 2.13.6
2015 Dec 09
0
[PATCH v3 3/4] VSOCK: Introduce vhost-vsock.ko
...d vhost_vsock_handle_rx_kick(struct vhost_work *work) +{ + struct vhost_virtqueue *vq = container_of(work, struct vhost_virtqueue, + poll.work); + struct vhost_vsock *vsock = container_of(vq->dev, struct vhost_vsock, + dev); + + vhost_transport_do_send_pkt(vsock, vq); +} + +static int vhost_vsock_dev_open(struct inode *inode, struct file *file) +{ + struct vhost_virtqueue **vqs; + struct vhost_vsock *vsock; + int ret; + + vsock = kzalloc(sizeof(*vsock), GFP_KERNEL); + if (!vsock) + return -ENOMEM; + + pr_debug("%s:vsock=%p\n", __func__, vsock); + + vqs = kmalloc(VSOCK_VQ_MAX * sizeof(*vqs...
2018 Jul 31
1
KASAN: use-after-free Read in vhost_transport_send_pkt
...ine] > kasan_kmalloc+0xc4/0xe0 mm/kasan/kasan.c:553 > __do_kmalloc_node mm/slab.c:3682 [inline] > __kmalloc_node+0x47/0x70 mm/slab.c:3689 > kmalloc_node include/linux/slab.h:555 [inline] > kvmalloc_node+0xb9/0xf0 mm/util.c:423 > kvmalloc include/linux/mm.h:573 [inline] > vhost_vsock_dev_open+0xa2/0x5a0 drivers/vhost/vsock.c:511 > misc_open+0x3ca/0x560 drivers/char/misc.c:141 > chrdev_open+0x25a/0x770 fs/char_dev.c:417 > do_dentry_open+0x818/0xe40 fs/open.c:794 > vfs_open+0x139/0x230 fs/open.c:908 > do_last fs/namei.c:3399 [inline] > path_openat+0x174a/0x4e10 fs/...
2018 Dec 12
0
[PATCH v2 4/5] VSOCK: increase send pkt len in mergeable mode to improve performance
..._RX_BUF_SIZE; + struct vhost_vsock *vsock; + + vsock = vhost_vsock_get(guest_cid); + if (!vsock) + return len; + + if (vsock->mergeable) + len = VIRTIO_VSOCK_MAX_PKT_BUF_SIZE; + + return len; +} + static int vhost_transport_cancel_pkt(struct vsock_sock *vsk) { @@ -602,6 +618,8 @@ static int vhost_vsock_dev_open(struct inode *inode, struct file *file) atomic_set(&vsock->queued_replies, 0); + vsock->mergeable = false; + vqs[VSOCK_VQ_TX] = &vsock->vqs[VSOCK_VQ_TX]; vqs[VSOCK_VQ_RX] = &vsock->vqs[VSOCK_VQ_RX]; vsock->vqs[VSOCK_VQ_TX].handle_kick = vhost_vsock_handle_tx_kic...
2020 May 29
0
[PATCH 1/6] vhost: allow device that does not depend on vhost worker
...ruct vhost_dev *dev, struct vhost_iotlb_msg *msg)); long vhost_dev_set_owner(struct vhost_dev *dev); diff --git a/drivers/vhost/vsock.c b/drivers/vhost/vsock.c index e36aaf9ba7bd..2eb85c42bac4 100644 --- a/drivers/vhost/vsock.c +++ b/drivers/vhost/vsock.c @@ -621,7 +621,7 @@ static int vhost_vsock_dev_open(struct inode *inode, struct file *file) vhost_dev_init(&vsock->dev, vqs, ARRAY_SIZE(vsock->vqs), UIO_MAXIOV, VHOST_VSOCK_PKT_WEIGHT, - VHOST_VSOCK_WEIGHT, NULL); + VHOST_VSOCK_WEIGHT, true, NULL); file->private_data = vsock; spin_lock_init(&vsock...
2019 May 17
0
[PATCH V2 1/4] vhost: introduce vhost_exceeds_weight()
...HOST_VSOCK_WEIGHT 0x80000 +/* Max number of packets transferred before requeueing the job. + * Using this limit prevents one virtqueue from starving others with + * small pkts. + */ +#define VHOST_VSOCK_PKT_WEIGHT 256 enum { VHOST_VSOCK_FEATURES = VHOST_FEATURES, @@ -531,7 +539,9 @@ static int vhost_vsock_dev_open(struct inode *inode, struct file *file) vsock->vqs[VSOCK_VQ_TX].handle_kick = vhost_vsock_handle_tx_kick; vsock->vqs[VSOCK_VQ_RX].handle_kick = vhost_vsock_handle_rx_kick; - vhost_dev_init(&vsock->dev, vqs, ARRAY_SIZE(vsock->vqs), UIO_MAXIOV); + vhost_dev_init(&vsock->d...
2015 Dec 11
1
[PATCH v3 3/4] VSOCK: Introduce vhost-vsock.ko
...rk) > +{ > + struct vhost_virtqueue *vq = container_of(work, struct vhost_virtqueue, > + poll.work); > + struct vhost_vsock *vsock = container_of(vq->dev, struct vhost_vsock, > + dev); > + > + vhost_transport_do_send_pkt(vsock, vq); > +} > + > +static int vhost_vsock_dev_open(struct inode *inode, struct file *file) > +{ > + struct vhost_virtqueue **vqs; > + struct vhost_vsock *vsock; > + int ret; > + > + vsock = kzalloc(sizeof(*vsock), GFP_KERNEL); > + if (!vsock) > + return -ENOMEM; > + > + pr_debug("%s:vsock=%p\n", __func__, vs...
2015 Dec 11
1
[PATCH v3 3/4] VSOCK: Introduce vhost-vsock.ko
...rk) > +{ > + struct vhost_virtqueue *vq = container_of(work, struct vhost_virtqueue, > + poll.work); > + struct vhost_vsock *vsock = container_of(vq->dev, struct vhost_vsock, > + dev); > + > + vhost_transport_do_send_pkt(vsock, vq); > +} > + > +static int vhost_vsock_dev_open(struct inode *inode, struct file *file) > +{ > + struct vhost_virtqueue **vqs; > + struct vhost_vsock *vsock; > + int ret; > + > + vsock = kzalloc(sizeof(*vsock), GFP_KERNEL); > + if (!vsock) > + return -ENOMEM; > + > + pr_debug("%s:vsock=%p\n", __func__, vs...
2019 Nov 28
5
[RFC PATCH 0/3] vsock: support network namespace
Hi, now that we have multi-transport upstream, I started to take a look to support network namespace (netns) in vsock. As we partially discussed in the multi-transport proposal [1], it could be nice to support network namespace in vsock to reach the following goals: - isolate host applications from guest applications using the same ports with CID_ANY - assign the same CID of VMs running in
2019 Nov 28
5
[RFC PATCH 0/3] vsock: support network namespace
Hi, now that we have multi-transport upstream, I started to take a look to support network namespace (netns) in vsock. As we partially discussed in the multi-transport proposal [1], it could be nice to support network namespace in vsock to reach the following goals: - isolate host applications from guest applications using the same ports with CID_ANY - assign the same CID of VMs running in