search for: is_vmalloc_addr

Displaying 20 results from an estimated 34 matches for "is_vmalloc_addr".

2013 Sep 17
3
[PATCH] vhost/scsi: use vmalloc for order-10 allocation
...host/scsi.c b/drivers/vhost/scsi.c index 4b79a1f..2c30bb0 100644 --- a/drivers/vhost/scsi.c +++ b/drivers/vhost/scsi.c @@ -1373,21 +1373,30 @@ static int vhost_scsi_set_features(struct vhost_scsi *vs, u64 features) return 0; } +static void vhost_scsi_free(struct vhost_scsi *vs) +{ + if (is_vmalloc_addr(vs)) + vfree(vs); + else + kfree(vs); +} + static int vhost_scsi_open(struct inode *inode, struct file *f) { struct vhost_scsi *vs; struct vhost_virtqueue **vqs; - int r, i; + int r = -ENOMEM, i; - vs = kzalloc(sizeof(*vs), GFP_KERNEL); - if (!vs) - ret...
2013 Sep 17
3
[PATCH] vhost/scsi: use vmalloc for order-10 allocation
...host/scsi.c b/drivers/vhost/scsi.c index 4b79a1f..2c30bb0 100644 --- a/drivers/vhost/scsi.c +++ b/drivers/vhost/scsi.c @@ -1373,21 +1373,30 @@ static int vhost_scsi_set_features(struct vhost_scsi *vs, u64 features) return 0; } +static void vhost_scsi_free(struct vhost_scsi *vs) +{ + if (is_vmalloc_addr(vs)) + vfree(vs); + else + kfree(vs); +} + static int vhost_scsi_open(struct inode *inode, struct file *f) { struct vhost_scsi *vs; struct vhost_virtqueue **vqs; - int r, i; + int r = -ENOMEM, i; - vs = kzalloc(sizeof(*vs), GFP_KERNEL); - if (!vs) - ret...
2018 Apr 20
2
[PATCH] kvmalloc: always use vmalloc if CONFIG_DEBUG_VM
...his is becoming more and more common with vmapped stacks (and some of our workarounds are hideous -- allocate 4 bytes with kmalloc because we can't DMA onto the stack any more?). We already have a few places which do handle sgs of vmalloced addresses, such as the nx crypto driver: if (is_vmalloc_addr(start_addr)) sg_addr = page_to_phys(vmalloc_to_page(start_addr)) + offset_in_page(sg_addr); else sg_addr = __pa(sg_addr); and videobuf: pg = vmalloc_to_page(virt); if (NULL == pg)...
2018 Apr 20
2
[PATCH] kvmalloc: always use vmalloc if CONFIG_DEBUG_VM
...his is becoming more and more common with vmapped stacks (and some of our workarounds are hideous -- allocate 4 bytes with kmalloc because we can't DMA onto the stack any more?). We already have a few places which do handle sgs of vmalloced addresses, such as the nx crypto driver: if (is_vmalloc_addr(start_addr)) sg_addr = page_to_phys(vmalloc_to_page(start_addr)) + offset_in_page(sg_addr); else sg_addr = __pa(sg_addr); and videobuf: pg = vmalloc_to_page(virt); if (NULL == pg)...
2019 Sep 05
2
[PATCH v2] drm/virtio: Use vmalloc for command buffer allocations.
...virtio_gpu_vbuffer *vbuf, struct virtio_gpu_ctrl_hdr *hdr, struct virtio_gpu_fence *fence) { struct virtqueue *vq = vgdev->ctrlq.vq; + struct scatterlist *vout = NULL, sg; + struct sg_table *sgt = NULL; int rc; + int outcnt = 0; + + if (vbuf->data_size) { + if (is_vmalloc_addr(vbuf->data_buf)) { + sgt = vmalloc_to_sgt(vbuf->data_buf, vbuf->data_size, + &outcnt); + if (!sgt) + return -ENOMEM; + vout = sgt->sgl; + } else { + sg_init_one(&sg, vbuf->data_buf, vbuf->data_size); + vout = &sg; + outcnt = 1; + } + } agai...
2019 Sep 05
2
[PATCH v2] drm/virtio: Use vmalloc for command buffer allocations.
...virtio_gpu_vbuffer *vbuf, struct virtio_gpu_ctrl_hdr *hdr, struct virtio_gpu_fence *fence) { struct virtqueue *vq = vgdev->ctrlq.vq; + struct scatterlist *vout = NULL, sg; + struct sg_table *sgt = NULL; int rc; + int outcnt = 0; + + if (vbuf->data_size) { + if (is_vmalloc_addr(vbuf->data_buf)) { + sgt = vmalloc_to_sgt(vbuf->data_buf, vbuf->data_size, + &outcnt); + if (!sgt) + return -ENOMEM; + vout = sgt->sgl; + } else { + sg_init_one(&sg, vbuf->data_buf, vbuf->data_size); + vout = &sg; + outcnt = 1; + } + } agai...
2016 Aug 02
1
[PATCH -next] VSOCK: Use kvfree()
...c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/vhost/vsock.c b/drivers/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()
...c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/vhost/vsock.c b/drivers/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)
2013 Sep 04
1
[PATCH] drivers/vhost/scsi.c: avoid a 10-order allocation
...t; net core saw a similar problem, it was fixed in patch > net: allow large number of tx queues > > So let's do it in a similar way: try to allocate with > GFP_KERNEL | __GFP_NOWARN | __GFP_REPEAT > and if that fails, do vmalloc. > > To free, we can do > if (is_vmalloc_addr()) > vfree(); > else > kfree(); > > Hi Dan, were you going to make this change? Or prefer me to do it? -- MST
2013 Sep 04
1
[PATCH] drivers/vhost/scsi.c: avoid a 10-order allocation
...t; net core saw a similar problem, it was fixed in patch > net: allow large number of tx queues > > So let's do it in a similar way: try to allocate with > GFP_KERNEL | __GFP_NOWARN | __GFP_REPEAT > and if that fails, do vmalloc. > > To free, we can do > if (is_vmalloc_addr()) > vfree(); > else > kfree(); > > Hi Dan, were you going to make this change? Or prefer me to do it? -- MST
2014 Jun 12
2
[PATCH] vhost-scsi: don't open-code kvfree
...rivers/vhost/scsi.c b/drivers/vhost/scsi.c index 83b834b..b08863e 100644 --- a/drivers/vhost/scsi.c +++ b/drivers/vhost/scsi.c @@ -1396,14 +1396,6 @@ static int vhost_scsi_set_features(struct vhost_scsi *vs, u64 features) return 0; } -static void vhost_scsi_free(struct vhost_scsi *vs) -{ - if (is_vmalloc_addr(vs)) - vfree(vs); - else - kfree(vs); -} - static int vhost_scsi_open(struct inode *inode, struct file *f) { struct vhost_scsi *vs; @@ -1443,7 +1435,7 @@ static int vhost_scsi_open(struct inode *inode, struct file *f) return 0; err_vqs: - vhost_scsi_free(vs); + kvfree(vs); err_vs: ret...
2014 Jun 12
2
[PATCH] vhost-scsi: don't open-code kvfree
...rivers/vhost/scsi.c b/drivers/vhost/scsi.c index 83b834b..b08863e 100644 --- a/drivers/vhost/scsi.c +++ b/drivers/vhost/scsi.c @@ -1396,14 +1396,6 @@ static int vhost_scsi_set_features(struct vhost_scsi *vs, u64 features) return 0; } -static void vhost_scsi_free(struct vhost_scsi *vs) -{ - if (is_vmalloc_addr(vs)) - vfree(vs); - else - kfree(vs); -} - static int vhost_scsi_open(struct inode *inode, struct file *f) { struct vhost_scsi *vs; @@ -1443,7 +1435,7 @@ static int vhost_scsi_open(struct inode *inode, struct file *f) return 0; err_vqs: - vhost_scsi_free(vs); + kvfree(vs); err_vs: ret...
2019 Sep 02
1
[PATCH] drm/virtio: Use vmalloc for command buffer allocations.
...t; Hi Gerd, > > On Fri, Aug 30, 2019 at 4:16 AM Gerd Hoffmann <kraxel at redhat.com> wrote: > > > > Hi, > > > > > > > - kfree(vbuf->data_buf); > > > > > + kvfree(vbuf->data_buf); > > > > > > > > if (is_vmalloc_addr(vbuf->data_buf)) ... > > > > > > > > needed here I gues? > > > > > > > > > > kvfree() handles vmalloc/kmalloc/kvmalloc internally by doing that check. > > > > Ok. > > > > > - videobuf_vmalloc_to_sg in drivers/media/...
2013 Sep 02
2
[PATCH] drm/nouveau: fix command submission to use vmalloc for big allocations
...rs/gpu/drm/nouveau/nouveau_gem.c index 177b86d5..779d702 100644 --- a/drivers/gpu/drm/nouveau/nouveau_gem.c +++ b/drivers/gpu/drm/nouveau/nouveau_gem.c @@ -584,18 +584,34 @@ nouveau_gem_pushbuf_validate(struct nouveau_channel *chan, return 0; } +static inline void +u_free(void *addr) +{ + if (!is_vmalloc_addr(addr)) + kfree(addr); + else + vfree(addr); +} + static inline void * u_memcpya(uint64_t user, unsigned nmemb, unsigned size) { void *mem; void __user *userptr = (void __force __user *)(uintptr_t)user; - mem = kmalloc(nmemb * size, GFP_KERNEL); + if (nmemb > 256 * 1024 / size) + retu...
2014 Jun 11
2
[PULL] vhost: infrastructure changes for 3.16
Hi Linus, Please pull the following. Please note this needs to be merged before merging target-pending PULL which Nicholas will be sending out shortly. Thanks! The following changes since commit 1860e379875dfe7271c649058aeddffe5afd9d0d: Linux 3.15 (2014-06-08 11:19:54 -0700) are available in the git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost.git tags/for_linus
2014 Jun 11
2
[PULL] vhost: infrastructure changes for 3.16
Hi Linus, Please pull the following. Please note this needs to be merged before merging target-pending PULL which Nicholas will be sending out shortly. Thanks! The following changes since commit 1860e379875dfe7271c649058aeddffe5afd9d0d: Linux 3.15 (2014-06-08 11:19:54 -0700) are available in the git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost.git tags/for_linus
2018 Apr 20
0
[PATCH] kvmalloc: always use vmalloc if CONFIG_DEBUG_VM
...more common with vmapped stacks (and some of our > workarounds are hideous -- allocate 4 bytes with kmalloc because we can't > DMA onto the stack any more?). We already have a few places which do > handle sgs of vmalloced addresses, such as the nx crypto driver: > > if (is_vmalloc_addr(start_addr)) > sg_addr = page_to_phys(vmalloc_to_page(start_addr)) > + offset_in_page(sg_addr); > else > sg_addr = __pa(sg_addr); > > and videobuf: > > pg = vmalloc_to_page(virt); >...
2019 Sep 06
0
[PATCH v2] drm/virtio: Use vmalloc for command buffer allocations.
...io_gpu_ctrl_hdr *hdr, > struct virtio_gpu_fence *fence) > { > struct virtqueue *vq = vgdev->ctrlq.vq; > + struct scatterlist *vout = NULL, sg; > + struct sg_table *sgt = NULL; > int rc; > + int outcnt = 0; > + > + if (vbuf->data_size) { > + if (is_vmalloc_addr(vbuf->data_buf)) { > + sgt = vmalloc_to_sgt(vbuf->data_buf, vbuf->data_size, > + &outcnt); > + if (!sgt) > + return -ENOMEM; > + vout = sgt->sgl; > + } else { > + sg_init_one(&sg, vbuf->data_buf, vbuf->data_size); > + vout = &...
2020 Jun 16
0
[PATCH v4 0/3] mm, treewide: Rename kzfree() to kfree_sensitive()
...ions. To eliminate these mispairings at a runtime cost of four comparisons, should the kfree/vfree/kvfree/kfree_const functions be consolidated into a single kfree? Something like the below: void kfree(const void *addr) { if (is_kernel_rodata((unsigned long)addr)) return; if (is_vmalloc_addr(addr)) _vfree(addr); else _kfree(addr); } #define kvfree kfree #define vfree kfree #define kfree_const kfree
2013 Jul 25
0
How to get the PFN of a vmalloc'ed address in a domU ?
...} if (op.status) { DPRINTK("error: grant table mapping failed\n"); goto err_unmap; } x->buffer_handles[i] = op.handle; grefp = (int *)(x->buffer_addr + i * PAGE_SIZE); } The mapping is successful. I then try to get a reference to these pages : if(is_vmalloc_addr((void *)(x->buffer_addr+recv_offset*PAGE_SIZE))) printk(KERN_INFO "Is vmalloc addr\n"); // As this text is displayed, I verified it''s a vmalloc''ed page if(virt_addr_valid((void *)(x->buffer_addr+recv_offset*PAGE_SIZE))) printk(KERN_INFO "Is virt addr\n...