search for: define_ida

Displaying 20 results from an estimated 106 matches for "define_ida".

2015 Sep 17
0
DEFINE_IDA causing memory leaks? (was Re: [PATCH 1/2] virtio: fix memory leak of virtio ida cache layers)
Hello, James. On Thu, Sep 17, 2015 at 10:58:29AM -0700, James Bottomley wrote: > The argument is that we shouldn't have to explicitly destroy a > statically initialized object, so > > DEFINE_IDA(someida); > > Should just work without having to explicitly do > > ida_destory(someida); > > somewhere in the exit code. It's about usage patterns. Michael's > argument is that if we can't follow the no destructor pattern for > DEFINE_IDA() then we shouldn...
2015 Sep 17
0
DEFINE_IDA causing memory leaks? (was Re: [PATCH 1/2] virtio: fix memory leak of virtio ida cache layers)
.... > > Will the same apply to e.g. sd_index_ida in drivers/scsi/sd.c > > or iscsi_sess_ida in drivers/scsi/scsi_transport_iscsi.c? > > > > If no, why not? > > > > One doesn't generally expect to have to free global variables. > > Maybe we should forbid DEFINE_IDA in modules? > > > > James, could you comment on this please? > > ida is Tejun's baby (cc'd). However, it does look like without > ida_destroy() you will leave a cached ida->bitmap dangling because we're > trying to be a bit clever in ida_remove() so we cach...
2015 Sep 17
0
DEFINE_IDA causing memory leaks? (was Re: [PATCH 1/2] virtio: fix memory leak of virtio ida cache layers)
Hello, On Thu, Sep 17, 2015 at 07:15:44AM -0700, James Bottomley wrote: > I don't understand why you'd want to forbid DEFINE_IDA ... all it does I guess to require the use of explicit init / creation so that it's clear the data structure needs to be destroyed? > is pre-initialise a usually static ida structure. The initialised > structure will have a NULL bitmap cache that's allocated in the first > ida_p...
2015 Sep 17
0
DEFINE_IDA causing memory leaks? (was Re: [PATCH 1/2] virtio: fix memory leak of virtio ida cache layers)
...t ti.com> > > Interesting. > Will the same apply to e.g. sd_index_ida in drivers/scsi/sd.c > or iscsi_sess_ida in drivers/scsi/scsi_transport_iscsi.c? > > If no, why not? > > One doesn't generally expect to have to free global variables. > Maybe we should forbid DEFINE_IDA in modules? > > James, could you comment on this please? > Well, looking at the code 'ida_destroy' only need to be called if you want/need to do a general cleanup. It shouldn't be required if you do correct reference counting on your objects, and call idr_remove() on each of...
2015 Sep 17
2
DEFINE_IDA causing memory leaks? (was Re: [PATCH 1/2] virtio: fix memory leak of virtio ida cache layers)
...; > Signed-off-by: Suman Anna <s-anna at ti.com> Interesting. Will the same apply to e.g. sd_index_ida in drivers/scsi/sd.c or iscsi_sess_ida in drivers/scsi/scsi_transport_iscsi.c? If no, why not? One doesn't generally expect to have to free global variables. Maybe we should forbid DEFINE_IDA in modules? James, could you comment on this please? > --- > drivers/virtio/virtio.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c > index b1877d73fa56..7062bb0975a5 100644 > --- a/drivers/virtio/virtio.c > +++...
2015 Sep 17
2
DEFINE_IDA causing memory leaks? (was Re: [PATCH 1/2] virtio: fix memory leak of virtio ida cache layers)
...; > Signed-off-by: Suman Anna <s-anna at ti.com> Interesting. Will the same apply to e.g. sd_index_ida in drivers/scsi/sd.c or iscsi_sess_ida in drivers/scsi/scsi_transport_iscsi.c? If no, why not? One doesn't generally expect to have to free global variables. Maybe we should forbid DEFINE_IDA in modules? James, could you comment on this please? > --- > drivers/virtio/virtio.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c > index b1877d73fa56..7062bb0975a5 100644 > --- a/drivers/virtio/virtio.c > +++...
2015 Sep 17
0
DEFINE_IDA causing memory leaks? (was Re: [PATCH 1/2] virtio: fix memory leak of virtio ida cache layers)
Hello, On Thu, Sep 17, 2015 at 09:48:37AM -0700, James Bottomley wrote: > Well, there's an easy fix for that. We could have ida_remove() actually > free the bitmap and not cache it if it's the last layer. That way ida > would naturally empty and we wouldn't need a destructor. Tejun, would > that work? Yeah, that definitely is one way to go about it. It kinda muddles
2015 Sep 17
7
[PATCH 0/2] Fix memory leaks in virtio & remoteproc cores
Hi, The following patches fix couple of memory leaks in the virtio and remoteproc cores when using these as modules, and going through a cycle of insmod and rmmod with at least a device registered with the corresponding cores in between. I ran into this on our downstream product kernels on both 3.14 and 4.1 based kernels, and should apply to the latest kernel as well. Patches can be picked up
2015 Sep 17
7
[PATCH 0/2] Fix memory leaks in virtio & remoteproc cores
Hi, The following patches fix couple of memory leaks in the virtio and remoteproc cores when using these as modules, and going through a cycle of insmod and rmmod with at least a device registered with the corresponding cores in between. I ran into this on our downstream product kernels on both 3.14 and 4.1 based kernels, and should apply to the latest kernel as well. Patches can be picked up
2011 Jun 01
6
[PATCH 1/1] [virt] virtio-blk: Use ida to allocate disk index
.../block/virtio_blk.c @@ -8,10 +8,14 @@ #include <linux/scatterlist.h> #include <linux/string_helpers.h> #include <scsi/scsi_cmnd.h> +#include <linux/idr.h> #define PART_BITS 4 -static int major, index; +static int major; +static DEFINE_SPINLOCK(vd_index_lock); +static DEFINE_IDA(vd_index_ida); + struct workqueue_struct *virtblk_wq; struct virtio_blk @@ -23,6 +27,7 @@ struct virtio_blk /* The disk structure for the kernel. */ struct gendisk *disk; + u32 index; /* Request tracking. */ struct list_head reqs; @@ -343,12 +348,26 @@ static int __devinit virtblk_p...
2011 Jun 01
6
[PATCH 1/1] [virt] virtio-blk: Use ida to allocate disk index
.../block/virtio_blk.c @@ -8,10 +8,14 @@ #include <linux/scatterlist.h> #include <linux/string_helpers.h> #include <scsi/scsi_cmnd.h> +#include <linux/idr.h> #define PART_BITS 4 -static int major, index; +static int major; +static DEFINE_SPINLOCK(vd_index_lock); +static DEFINE_IDA(vd_index_ida); + struct workqueue_struct *virtblk_wq; struct virtio_blk @@ -23,6 +27,7 @@ struct virtio_blk /* The disk structure for the kernel. */ struct gendisk *disk; + u32 index; /* Request tracking. */ struct list_head reqs; @@ -343,12 +348,26 @@ static int __devinit virtblk_p...
2012 May 03
1
[PATCH 2/2] virtio: Use ida to allocate virtio index
...-- a/drivers/virtio/virtio.c +++ b/drivers/virtio/virtio.c @@ -2,9 +2,10 @@ #include <linux/spinlock.h> #include <linux/virtio_config.h> #include <linux/module.h> +#include <linux/idr.h> /* Unique numbering for virtio devices. */ -static unsigned int dev_index; +static DEFINE_IDA(virtio_index_ida); static ssize_t device_show(struct device *_d, struct device_attribute *attr, char *buf) @@ -193,7 +194,11 @@ int register_virtio_device(struct virtio_device *dev) dev->dev.bus = &virtio_bus; /* Assign a unique device index and hence name. */ - dev->index...
2012 May 03
1
[PATCH 2/2] virtio: Use ida to allocate virtio index
...-- a/drivers/virtio/virtio.c +++ b/drivers/virtio/virtio.c @@ -2,9 +2,10 @@ #include <linux/spinlock.h> #include <linux/virtio_config.h> #include <linux/module.h> +#include <linux/idr.h> /* Unique numbering for virtio devices. */ -static unsigned int dev_index; +static DEFINE_IDA(virtio_index_ida); static ssize_t device_show(struct device *_d, struct device_attribute *attr, char *buf) @@ -193,7 +194,11 @@ int register_virtio_device(struct virtio_device *dev) dev->dev.bus = &virtio_bus; /* Assign a unique device index and hence name. */ - dev->index...
2020 Jul 20
1
[PATCH] vhost: vdpa: remove per device feature whitelist
...ULL << VIRTIO_NET_F_HOST_UFO) | - (1ULL << VIRTIO_NET_F_MRG_RXBUF) | - (1ULL << VIRTIO_NET_F_STATUS) | - (1ULL << VIRTIO_NET_F_SPEED_DUPLEX), -}; - /* Currently, only network backend w/o multiqueue is supported. */ #define VHOST_VDPA_VQ_MAX 2 @@ -79,10 +50,6 @@ static DEFINE_IDA(vhost_vdpa_ida); static dev_t vhost_vdpa_major; -static const u64 vhost_vdpa_features[] = { - [VIRTIO_ID_NET] = VHOST_VDPA_NET_FEATURES, -}; - static void handle_vq_kick(struct vhost_work *work) { struct vhost_virtqueue *vq = container_of(work, struct vhost_virtqueue, @@ -255,7 +222,6 @@ s...
2020 Apr 26
1
[PATCH 1/2] vdpa: Support config interrupt in vhost_vdpa
...#include <linux/virtio_net.h> > +#include <linux/kernel.h> > > #include "vhost.h" > > @@ -70,6 +71,7 @@ struct vhost_vdpa { > int nvqs; > int virtio_id; > int minor; > + struct eventfd_ctx *config_ctx; > }; > > static DEFINE_IDA(vhost_vdpa_ida); > @@ -101,6 +103,17 @@ static irqreturn_t vhost_vdpa_virtqueue_cb(void *private) > return IRQ_HANDLED; > } > > +static irqreturn_t vhost_vdpa_config_cb(void *private) > +{ > + struct vhost_vdpa *v = private; > + struct eventfd_ctx *config_ctx = v-&gt...
2020 Jun 28
2
[PATCH RFC 4/5] vhost-vdpa: support IOTLB batching hints
...<< VHOST_BACKEND_F_IOTLB_BATCH), > }; > > /* Currently, only network backend w/o multiqueue is supported. */ > @@ -77,6 +79,7 @@ struct vhost_vdpa { > int virtio_id; > int minor; > struct eventfd_ctx *config_ctx; > + int in_batch; > }; > > static DEFINE_IDA(vhost_vdpa_ida); > @@ -125,6 +128,7 @@ static void vhost_vdpa_reset(struct vhost_vdpa *v) > const struct vdpa_config_ops *ops = vdpa->config; > > ops->set_status(vdpa, 0); > + v->in_batch = 0; > } > > static long vhost_vdpa_get_device_id(struct vhost_vdpa...
2020 Jun 28
2
[PATCH RFC 4/5] vhost-vdpa: support IOTLB batching hints
...<< VHOST_BACKEND_F_IOTLB_BATCH), > }; > > /* Currently, only network backend w/o multiqueue is supported. */ > @@ -77,6 +79,7 @@ struct vhost_vdpa { > int virtio_id; > int minor; > struct eventfd_ctx *config_ctx; > + int in_batch; > }; > > static DEFINE_IDA(vhost_vdpa_ida); > @@ -125,6 +128,7 @@ static void vhost_vdpa_reset(struct vhost_vdpa *v) > const struct vdpa_config_ops *ops = vdpa->config; > > ops->set_status(vdpa, 0); > + v->in_batch = 0; > } > > static long vhost_vdpa_get_device_id(struct vhost_vdpa...
2020 Apr 26
3
[PATCH V2 1/2] vdpa: Support config interrupt in vhost_vdpa
...#include <linux/virtio_net.h> > +#include <linux/kernel.h> > > #include "vhost.h" > > @@ -70,6 +71,7 @@ struct vhost_vdpa { > int nvqs; > int virtio_id; > int minor; > + struct eventfd_ctx *config_ctx; > }; > > static DEFINE_IDA(vhost_vdpa_ida); > @@ -101,6 +103,17 @@ static irqreturn_t vhost_vdpa_virtqueue_cb(void *private) > return IRQ_HANDLED; > } > > +static irqreturn_t vhost_vdpa_config_cb(void *private) > +{ > + struct vhost_vdpa *v = private; > + struct eventfd_ctx *config_ctx = v-&gt...
2020 Apr 26
3
[PATCH V2 1/2] vdpa: Support config interrupt in vhost_vdpa
...#include <linux/virtio_net.h> > +#include <linux/kernel.h> > > #include "vhost.h" > > @@ -70,6 +71,7 @@ struct vhost_vdpa { > int nvqs; > int virtio_id; > int minor; > + struct eventfd_ctx *config_ctx; > }; > > static DEFINE_IDA(vhost_vdpa_ida); > @@ -101,6 +103,17 @@ static irqreturn_t vhost_vdpa_virtqueue_cb(void *private) > return IRQ_HANDLED; > } > > +static irqreturn_t vhost_vdpa_config_cb(void *private) > +{ > + struct vhost_vdpa *v = private; > + struct eventfd_ctx *config_ctx = v-&gt...
2013 Nov 21
5
[PATCH v2 RFC 0/3] virtio: add new notify() callback to virtio_driver
Hi, here is an updated patch-set with changes as suggested by Michael Tsirkin. When an active virtio block device is hot-unplugged from a KVM guest, running affected guest user applications are not aware of any errors that occur due to the lost device. This patch-set adds code to avoid further request queueing when a lost block device is detected, resulting in appropriate error info. On System z