search for: kvzalloc

Displaying 20 results from an estimated 42 matches for "kvzalloc".

Did you mean: kvmalloc
2018 Apr 18
5
[PATCH] net: don't use kvzalloc for DMA memory
On Wed, 18 Apr 2018, Eric Dumazet wrote: > > > On 04/18/2018 07:34 AM, Mikulas Patocka wrote: > > The patch 74d332c13b21 changes alloc_netdev_mqs to use vzalloc if kzalloc > > fails (later patches change it to kvzalloc). > > > > The problem with this is that if the vzalloc function is actually used, > > virtio_net doesn't work (because it expects that the extra memory should > > be accessible with DMA-API and memory allocated with vzalloc isn't). > > > > This patch...
2018 Apr 18
5
[PATCH] net: don't use kvzalloc for DMA memory
On Wed, 18 Apr 2018, Eric Dumazet wrote: > > > On 04/18/2018 07:34 AM, Mikulas Patocka wrote: > > The patch 74d332c13b21 changes alloc_netdev_mqs to use vzalloc if kzalloc > > fails (later patches change it to kvzalloc). > > > > The problem with this is that if the vzalloc function is actually used, > > virtio_net doesn't work (because it expects that the extra memory should > > be accessible with DMA-API and memory allocated with vzalloc isn't). > > > > This patch...
2018 Apr 18
0
[PATCH] net: don't use kvzalloc for DMA memory
...AM, Mikulas Patocka wrote: > > > On Wed, 18 Apr 2018, Eric Dumazet wrote: > >> >> >> On 04/18/2018 07:34 AM, Mikulas Patocka wrote: >>> The patch 74d332c13b21 changes alloc_netdev_mqs to use vzalloc if kzalloc >>> fails (later patches change it to kvzalloc). >>> >>> The problem with this is that if the vzalloc function is actually used, >>> virtio_net doesn't work (because it expects that the extra memory should >>> be accessible with DMA-API and memory allocated with vzalloc isn't). >>> >>...
2018 Apr 18
0
[PATCH] net: don't use kvzalloc for DMA memory
From: Mikulas Patocka <mpatocka at redhat.com> Date: Wed, 18 Apr 2018 12:44:25 -0400 (EDT) > The structure net_device is followed by arbitrary driver-specific data > (accessible with the function netdev_priv). And for virtio-net, these > driver-specific data must be in DMA memory. And we are saying that this assumption is wrong and needs to be corrected.
2018 Apr 18
2
[PATCH] net: don't use kvzalloc for DMA memory
From: Eric Dumazet <eric.dumazet at gmail.com> Date: Wed, 18 Apr 2018 09:51:25 -0700 > I suggest that virtio_net clearly identifies which part needs a specific allocation > and does its itself, instead of abusing the netdev_priv storage. > > Ie use a pointer to a block of memory, allocated by virtio_net, for virtio_net. +1
2018 Apr 18
7
[PATCH] net: don't use kvzalloc for DMA memory
...function netdev_priv). And for virtio-net, these > > driver-specific data must be in DMA memory. > > And we are saying that this assumption is wrong and needs to be > corrected. So, try to find all the networking drivers that to DMA to the private area. The problem here is that kvzalloc usually returns DMA-able area, but it may return non-DMA area rarely, if the memory is too fragmented. So, we are in a situation, where some networking drivers will randomly fail. Go and find them. Mikulas
2018 Jul 19
0
[PATCH 3/3] [RFC V3] KVM: X86: Adding skeleton for Memory ROE
...faab5..0f7141e4d550 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -794,6 +794,17 @@ static int kvm_create_dirty_bitmap(struct kvm_memory_slot *memslot) return 0; } +static int kvm_init_mroe_bitmap(struct kvm_memory_slot *slot) +{ +#ifdef CONFIG_KVM_MROE + slot->mroe_bitmap = kvzalloc(BITS_TO_LONGS(slot->npages) * + sizeof(unsigned long), GFP_KERNEL); + if (!slot->mroe_bitmap) + return -ENOMEM; +#endif + return 0; +} + /* * Insert memslot and re-sort memslots based on their GFN, * so binary search could be used to lookup GFN. @@ -1011,6 +1022,8 @@ int __kvm_set_memor...
2017 Sep 13
0
[PATCH 10/10] fs:btrfs: return -ENOMEM on allocation failure.
...2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/btrfs/check-integrity.c b/fs/btrfs/check-integrity.c index 7d5a9b5..efa4c23 100644 --- a/fs/btrfs/check-integrity.c +++ b/fs/btrfs/check-integrity.c @@ -2913,7 +2913,7 @@ int btrfsic_mount(struct btrfs_fs_info *fs_info, state = kvzalloc(sizeof(*state), GFP_KERNEL); if (!state) { pr_info("btrfs check-integrity: allocation failed!\n"); - return -1; + return -ENOMEM; } if (!btrfsic_is_initialized) { -- 2.7.4
2018 Apr 19
0
[PATCH] kvmalloc: always use vmalloc if CONFIG_DEBUG_VM
...hese > > > driver-specific data must be in DMA memory. > > > > And we are saying that this assumption is wrong and needs to be > > corrected. > > So, try to find all the networking drivers that to DMA to the private > area. > > The problem here is that kvzalloc usually returns DMA-able area, but it > may return non-DMA area rarely, if the memory is too fragmented. So, we > are in a situation, where some networking drivers will randomly fail. Go > and find them. > > Mikulas Her I submit a patch that makes kvmalloc always use vmalloc if...
2018 Jul 20
0
[PATCH RFC V4 3/3] KVM: X86: Adding skeleton for Memory ROE
...faab5..0f7141e4d550 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -794,6 +794,17 @@ static int kvm_create_dirty_bitmap(struct kvm_memory_slot *memslot) return 0; } +static int kvm_init_mroe_bitmap(struct kvm_memory_slot *slot) +{ +#ifdef CONFIG_KVM_MROE + slot->mroe_bitmap = kvzalloc(BITS_TO_LONGS(slot->npages) * + sizeof(unsigned long), GFP_KERNEL); + if (!slot->mroe_bitmap) + return -ENOMEM; +#endif + return 0; +} + /* * Insert memslot and re-sort memslots based on their GFN, * so binary search could be used to lookup GFN. @@ -1011,6 +1022,8 @@ int __kvm_set_memor...
2020 Feb 05
0
[PATCH] vhost: introduce vDPA based backend
...g; > > + unsigned long size = offsetof(struct vhost_vdpa_config, buf); > > + u8 *buf; > > + > > + if (copy_from_user(&config, c, size)) > > + return -EFAULT; > > + if (vhost_vdpa_config_validate(v, &config)) > > + return -EINVAL; > > + buf = kvzalloc(config.len, GFP_KERNEL); > > + if (!buf) > > + return -ENOMEM; > > + > > + ops->get_config(vdpa, config.off, buf, config.len); > > + > > + if (copy_to_user(c->buf, buf, config.len)) { > > + kvfree(buf); > > + return -EFAULT; > > + } &gt...
2017 Sep 13
17
[PATCH 01/10] arch:powerpc: return -ENOMEM on failed allocation
Signed-off-by: Allen Pais <allen.lkml at gmail.com> --- arch/powerpc/platforms/cell/spider-pci.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/platforms/cell/spider-pci.c b/arch/powerpc/platforms/cell/spider-pci.c index d1e61e2..82aa3f7 100644 --- a/arch/powerpc/platforms/cell/spider-pci.c +++ b/arch/powerpc/platforms/cell/spider-pci.c @@ -106,7 +106,7
2019 Oct 29
2
[PATCH v3] vhost: introduce mdev based hardware backend
...dev_device_ops *ops = mdev_get_vhost_ops(mdev); + struct vhost_mdev_config config; + unsigned long size = offsetof(struct vhost_mdev_config, buf); + u8 *buf; + + if (copy_from_user(&config, c, size)) + return -EFAULT; + if (vhost_mdev_config_validate(m, &config)) + return -EINVAL; + buf = kvzalloc(config.len, GFP_KERNEL); + if (!buf) + return -ENOMEM; + + ops->get_config(mdev, config.off, buf, config.len); + + if (copy_to_user(c->buf, buf, config.len)) { + kvfree(buf); + return -EFAULT; + } + + kvfree(buf); + return 0; +} + +static long vhost_mdev_set_config(struct vhost_mdev *m, +...
2019 Oct 29
2
[PATCH v3] vhost: introduce mdev based hardware backend
...dev_device_ops *ops = mdev_get_vhost_ops(mdev); + struct vhost_mdev_config config; + unsigned long size = offsetof(struct vhost_mdev_config, buf); + u8 *buf; + + if (copy_from_user(&config, c, size)) + return -EFAULT; + if (vhost_mdev_config_validate(m, &config)) + return -EINVAL; + buf = kvzalloc(config.len, GFP_KERNEL); + if (!buf) + return -ENOMEM; + + ops->get_config(mdev, config.off, buf, config.len); + + if (copy_to_user(c->buf, buf, config.len)) { + kvfree(buf); + return -EFAULT; + } + + kvfree(buf); + return 0; +} + +static long vhost_mdev_set_config(struct vhost_mdev *m, +...
2019 Nov 05
4
[PATCH v5] vhost: introduce mdev based hardware backend
...tio_device_ops *ops = mdev_get_vhost_ops(mdev); + struct vhost_mdev_config config; + unsigned long size = offsetof(struct vhost_mdev_config, buf); + u8 *buf; + + if (copy_from_user(&config, c, size)) + return -EFAULT; + if (vhost_mdev_config_validate(m, &config)) + return -EINVAL; + buf = kvzalloc(config.len, GFP_KERNEL); + if (!buf) + return -ENOMEM; + + ops->get_config(mdev, config.off, buf, config.len); + + if (copy_to_user(c->buf, buf, config.len)) { + kvfree(buf); + return -EFAULT; + } + + kvfree(buf); + return 0; +} + +static long vhost_mdev_set_config(struct vhost_mdev *m, +...
2019 Nov 05
4
[PATCH v5] vhost: introduce mdev based hardware backend
...tio_device_ops *ops = mdev_get_vhost_ops(mdev); + struct vhost_mdev_config config; + unsigned long size = offsetof(struct vhost_mdev_config, buf); + u8 *buf; + + if (copy_from_user(&config, c, size)) + return -EFAULT; + if (vhost_mdev_config_validate(m, &config)) + return -EINVAL; + buf = kvzalloc(config.len, GFP_KERNEL); + if (!buf) + return -ENOMEM; + + ops->get_config(mdev, config.off, buf, config.len); + + if (copy_to_user(c->buf, buf, config.len)) { + kvfree(buf); + return -EFAULT; + } + + kvfree(buf); + return 0; +} + +static long vhost_mdev_set_config(struct vhost_mdev *m, +...
2018 Apr 19
1
[PATCH] kvmalloc: always use vmalloc if CONFIG_DEBUG_VM
...a must be in DMA memory. > > > > > > And we are saying that this assumption is wrong and needs to be > > > corrected. > > > > So, try to find all the networking drivers that to DMA to the private > > area. > > > > The problem here is that kvzalloc usually returns DMA-able area, but it > > may return non-DMA area rarely, if the memory is too fragmented. So, we > > are in a situation, where some networking drivers will randomly fail. Go > > and find them. > > > > Mikulas > > Her I submit a patch that ma...
2019 Nov 07
2
[PATCH v6] vhost: introduce mdev based hardware backend
...tio_device_ops *ops = mdev_get_vhost_ops(mdev); + struct vhost_mdev_config config; + unsigned long size = offsetof(struct vhost_mdev_config, buf); + u8 *buf; + + if (copy_from_user(&config, c, size)) + return -EFAULT; + if (vhost_mdev_config_validate(m, &config)) + return -EINVAL; + buf = kvzalloc(config.len, GFP_KERNEL); + if (!buf) + return -ENOMEM; + + ops->get_config(mdev, config.off, buf, config.len); + + if (copy_to_user(c->buf, buf, config.len)) { + kvfree(buf); + return -EFAULT; + } + + kvfree(buf); + return 0; +} + +static long vhost_mdev_set_config(struct vhost_mdev *m, +...
2019 Nov 06
2
[PATCH v5] vhost: introduce mdev based hardware backend
...g; > > + unsigned long size = offsetof(struct vhost_mdev_config, buf); > > + u8 *buf; > > + > > + if (copy_from_user(&config, c, size)) > > + return -EFAULT; > > + if (vhost_mdev_config_validate(m, &config)) > > + return -EINVAL; > > + buf = kvzalloc(config.len, GFP_KERNEL); > > + if (!buf) > > + return -ENOMEM; > > + > > + ops->get_config(mdev, config.off, buf, config.len); > > + > > + if (copy_to_user(c->buf, buf, config.len)) { > > + kvfree(buf); > > + return -EFAULT; > > + } &gt...
2019 Nov 06
2
[PATCH v5] vhost: introduce mdev based hardware backend
...g; > > + unsigned long size = offsetof(struct vhost_mdev_config, buf); > > + u8 *buf; > > + > > + if (copy_from_user(&config, c, size)) > > + return -EFAULT; > > + if (vhost_mdev_config_validate(m, &config)) > > + return -EINVAL; > > + buf = kvzalloc(config.len, GFP_KERNEL); > > + if (!buf) > > + return -ENOMEM; > > + > > + ops->get_config(mdev, config.off, buf, config.len); > > + > > + if (copy_to_user(c->buf, buf, config.len)) { > > + kvfree(buf); > > + return -EFAULT; > > + } &gt...