search for: config_lock

Displaying 20 results from an estimated 185 matches for "config_lock".

2014 Oct 06
1
[PATCH 05/16] virtio: defer config changed notifications
...driver); > + > + if (!dev->config_enabled) > + dev->config_changed = true; > + else if (drv && drv->config_changed) > + drv->config_changed(dev); > +} > + > +void virtio_config_changed(struct virtio_device *dev) > +{ > + spin_lock_irq(&dev->config_lock); > + __virtio_config_changed(dev); > + spin_unlock_irq(&dev->config_lock); Hm, isn't this function called from the interrupt handler? > +} > +EXPORT_SYMBOL_GPL(virtio_config_changed); > + > +static void virtio_config_disable(struct virtio_device *dev) > +{ > +...
2014 Oct 06
1
[PATCH 05/16] virtio: defer config changed notifications
...driver); > + > + if (!dev->config_enabled) > + dev->config_changed = true; > + else if (drv && drv->config_changed) > + drv->config_changed(dev); > +} > + > +void virtio_config_changed(struct virtio_device *dev) > +{ > + spin_lock_irq(&dev->config_lock); > + __virtio_config_changed(dev); > + spin_unlock_irq(&dev->config_lock); Hm, isn't this function called from the interrupt handler? > +} > +EXPORT_SYMBOL_GPL(virtio_config_changed); > + > +static void virtio_config_disable(struct virtio_device *dev) > +{ > +...
2012 Apr 12
2
[net-next V7 PATCH] virtio-net: send gratuitous packets when needed
...ay ack more times than being notified. This is done through handling the whole config change interrupt in an non-reentrant workqueue. Signed-off-by: Jason Wang <jasowang at redhat.com> --- Changes from v6: - move the whole event processing to system_nrt_wq - introduce the config_enable and config_lock to synchronize with dev removing and pm - protect the ack with rtnl_lock Changes from v5: - notify the chain before acking the link annoucement - ack the link announcement notification through control vq Changes from v4: - typos - handle workqueue unconditionally - move VIRTIO_NET_S_ANNOUNCE to b...
2012 Apr 12
2
[net-next V7 PATCH] virtio-net: send gratuitous packets when needed
...ay ack more times than being notified. This is done through handling the whole config change interrupt in an non-reentrant workqueue. Signed-off-by: Jason Wang <jasowang at redhat.com> --- Changes from v6: - move the whole event processing to system_nrt_wq - introduce the config_enable and config_lock to synchronize with dev removing and pm - protect the ack with rtnl_lock Changes from v5: - notify the chain before acking the link annoucement - ack the link announcement notification through control vq Changes from v4: - typos - handle workqueue unconditionally - move VIRTIO_NET_S_ANNOUNCE to b...
2014 Oct 13
1
[PATCH v4 04/25] virtio: defer config changed notifications
...* virtio_device - representation of a device using virtio * @index: unique position on the virtio bus * @failed: saved value for CONFIG_S_FAILED bit (for restore) + * @config_enabled: configuration change reporting enabled + * @config_changed: configuration change reported while disabled + * @config_lock: protects configuration change reporting * @dev: underlying device. * @id: the device type identification (used to match it with a driver). * @config: the configuration ops for this device. @@ -90,6 +93,9 @@ bool virtqueue_is_broken(struct virtqueue *vq); struct virtio_device { int index;...
2014 Oct 13
1
[PATCH v4 04/25] virtio: defer config changed notifications
...* virtio_device - representation of a device using virtio * @index: unique position on the virtio bus * @failed: saved value for CONFIG_S_FAILED bit (for restore) + * @config_enabled: configuration change reporting enabled + * @config_changed: configuration change reported while disabled + * @config_lock: protects configuration change reporting * @dev: underlying device. * @id: the device type identification (used to match it with a driver). * @config: the configuration ops for this device. @@ -90,6 +93,9 @@ bool virtqueue_is_broken(struct virtqueue *vq); struct virtio_device { int index;...
2014 Oct 05
28
[PATCH 00/16] virtio: fix spec compliance issues
Rusty, I have a mind to send this patches for the next merge window. Any input on this? This fixes the following virtio spec compliance issues: 1. on restore, drivers use device before setting ACKNOWLEDGE and DRIVER bits 2. on probe, drivers aren't prepared to handle config interrupts arriving before probe returns 3. on probe, drivers use device before DRIVER_OK it set Note that 1 is a
2014 Oct 05
28
[PATCH 00/16] virtio: fix spec compliance issues
Rusty, I have a mind to send this patches for the next merge window. Any input on this? This fixes the following virtio spec compliance issues: 1. on restore, drivers use device before setting ACKNOWLEDGE and DRIVER bits 2. on probe, drivers aren't prepared to handle config interrupts arriving before probe returns 3. on probe, drivers use device before DRIVER_OK it set Note that 1 is a
2011 Dec 07
2
[PATCH RFC] virtio_blk: fix config handler race
...inux/mutex.h> #include <linux/virtio.h> #include <linux/virtio_blk.h> #include <linux/scatterlist.h> @@ -36,6 +37,12 @@ struct virtio_blk /* Process context for config space updates */ struct work_struct config_work; + /* Lock for config space updates */ + struct mutex config_lock; + + /* enable config space updates */ + bool config_enable; + /* What host tells us, plus 2 for header & tailer. */ unsigned int sg_elems; @@ -318,6 +325,10 @@ static void virtblk_config_changed_work(struct work_struct *work) char cap_str_2[10], cap_str_10[10]; u64 capacity, size;...
2011 Dec 07
2
[PATCH RFC] virtio_blk: fix config handler race
...inux/mutex.h> #include <linux/virtio.h> #include <linux/virtio_blk.h> #include <linux/scatterlist.h> @@ -36,6 +37,12 @@ struct virtio_blk /* Process context for config space updates */ struct work_struct config_work; + /* Lock for config space updates */ + struct mutex config_lock; + + /* enable config space updates */ + bool config_enable; + /* What host tells us, plus 2 for header & tailer. */ unsigned int sg_elems; @@ -318,6 +325,10 @@ static void virtblk_config_changed_work(struct work_struct *work) char cap_str_2[10], cap_str_10[10]; u64 capacity, size;...
2014 Oct 05
0
[PATCH 06/16] virtio_blk: drop config_enable
...le changed, 2 insertions(+), 17 deletions(-) diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c index 0a58140..c8cf6a1 100644 --- a/drivers/block/virtio_blk.c +++ b/drivers/block/virtio_blk.c @@ -44,9 +44,6 @@ struct virtio_blk /* Lock for config space updates */ struct mutex config_lock; - /* enable config space updates */ - bool config_enable; - /* What host tells us, plus 2 for header & tailer. */ unsigned int sg_elems; @@ -348,8 +345,6 @@ static void virtblk_config_changed_work(struct work_struct *work) u64 capacity, size; mutex_lock(&vblk->config_lock)...
2014 Oct 05
0
[PATCH 08/16] virtio_net: drop config_enable
...ader and packet data */ bool any_header_sg; - /* enable config space updates */ - bool config_enable; - /* Active statistics */ struct virtnet_stats __percpu *stats; @@ -1408,9 +1405,6 @@ static void virtnet_config_changed_work(struct work_struct *work) u16 v; mutex_lock(&vi->config_lock); - if (!vi->config_enable) - goto done; - if (virtio_cread_feature(vi->vdev, VIRTIO_NET_F_STATUS, struct virtio_net_config, status, &v) < 0) goto done; @@ -1758,7 +1752,6 @@ static int virtnet_probe(struct virtio_device *vdev) } mutex_init(&vi->config_lock); -...
2014 Oct 06
0
[PATCH v2 07/15] virtio_net: drop config_enable
...ader and packet data */ bool any_header_sg; - /* enable config space updates */ - bool config_enable; - /* Active statistics */ struct virtnet_stats __percpu *stats; @@ -1408,9 +1405,6 @@ static void virtnet_config_changed_work(struct work_struct *work) u16 v; mutex_lock(&vi->config_lock); - if (!vi->config_enable) - goto done; - if (virtio_cread_feature(vi->vdev, VIRTIO_NET_F_STATUS, struct virtio_net_config, status, &v) < 0) goto done; @@ -1758,7 +1752,6 @@ static int virtnet_probe(struct virtio_device *vdev) } mutex_init(&vi->config_lock); -...
2014 Oct 05
0
[PATCH 05/16] virtio: defer config changed notifications
...* virtio_device - representation of a device using virtio * @index: unique position on the virtio bus * @failed: saved value for CONFIG_S_FAILED bit (for restore) + * @config_enabled: configuration change reporting enabled + * @config_changed: configuration change reported while disabled + * @config_lock: protects configuration change reporting * @dev: underlying device. * @id: the device type identification (used to match it with a driver). * @config: the configuration ops for this device. @@ -90,6 +93,9 @@ bool virtqueue_is_broken(struct virtqueue *vq); struct virtio_device { int index;...
2014 Oct 06
0
[PATCH v2 04/15] virtio: defer config changed notifications
...* virtio_device - representation of a device using virtio * @index: unique position on the virtio bus * @failed: saved value for CONFIG_S_FAILED bit (for restore) + * @config_enabled: configuration change reporting enabled + * @config_changed: configuration change reported while disabled + * @config_lock: protects configuration change reporting * @dev: underlying device. * @id: the device type identification (used to match it with a driver). * @config: the configuration ops for this device. @@ -90,6 +93,9 @@ bool virtqueue_is_broken(struct virtqueue *vq); struct virtio_device { int index;...
2014 Oct 06
0
[PATCH v2 05/15] virtio_blk: drop config_enable
...e changed, 4 insertions(+), 19 deletions(-) diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c index 0a58140..91272f1a 100644 --- a/drivers/block/virtio_blk.c +++ b/drivers/block/virtio_blk.c @@ -44,9 +44,6 @@ struct virtio_blk /* Lock for config space updates */ struct mutex config_lock; - /* enable config space updates */ - bool config_enable; - /* What host tells us, plus 2 for header & tailer. */ unsigned int sg_elems; @@ -348,8 +345,6 @@ static void virtblk_config_changed_work(struct work_struct *work) u64 capacity, size; mutex_lock(&vblk->config_lock)...
2014 Oct 06
1
[PATCH 08/16] virtio_net: drop config_enable
...-1876,16 +1869,12 @@ static void virtnet_remove(struct virtio_device *vdev) > unregister_hotcpu_notifier(&vi->nb); > > /* Prevent config work handler from accessing the device. */ Same comment as for the equivalent comment in the virtio-blk code. > - mutex_lock(&vi->config_lock); > - vi->config_enable = false; > - mutex_unlock(&vi->config_lock); > + flush_work(&vi->config_work); > > unregister_netdev(vi->dev); > > remove_vq_common(vi); > > - flush_work(&vi->config_work); > - > free_percpu(vi->stats);...
2014 Oct 06
1
[PATCH 08/16] virtio_net: drop config_enable
...-1876,16 +1869,12 @@ static void virtnet_remove(struct virtio_device *vdev) > unregister_hotcpu_notifier(&vi->nb); > > /* Prevent config work handler from accessing the device. */ Same comment as for the equivalent comment in the virtio-blk code. > - mutex_lock(&vi->config_lock); > - vi->config_enable = false; > - mutex_unlock(&vi->config_lock); > + flush_work(&vi->config_work); > > unregister_netdev(vi->dev); > > remove_vq_common(vi); > > - flush_work(&vi->config_work); > - > free_percpu(vi->stats);...
2014 Oct 06
2
[PATCH 06/16] virtio_blk: drop config_enable
...rivers/block/virtio_blk.c > @@ -772,9 +766,7 @@ static void virtblk_remove(struct virtio_device *vdev) > int refc; > > /* Prevent config work handler from accessing the device. */ /* Common code ensures no further work will be queued. */ instead? > - mutex_lock(&vblk->config_lock); > - vblk->config_enable = false; > - mutex_unlock(&vblk->config_lock); > + flush_work(&vblk->config_work); > > del_gendisk(vblk->disk); > blk_cleanup_queue(vblk->disk->queue); > @@ -806,10 +796,6 @@ static int virtblk_freeze(struct virtio_devic...
2013 Oct 29
3
[PATCH net] virtio-net: correctly handle cpu hotplug notifier during resuming
commit 3ab098df35f8b98b6553edc2e40234af512ba877 (virtio-net: don't respond to cpu hotplug notifier if we're not ready) tries to bypass the cpu hotplug notifier by checking the config_enable and does nothing is it was false. So it need to try to hold the config_lock mutex which may happen in atomic environment which leads the following warnings: [ 622.944441] CPU0 attaching NULL sched-domain. [ 622.944446] CPU1 attaching NULL sched-domain. [ 622.944485] CPU0 attaching NULL sched-domain. [ 622.950795] BUG: sleeping function called from invalid context at k...