Message ID | 1412525038-15871-10-git-send-email-mst@redhat.com |
---|---|
State | Not Applicable, archived |
Delegated to: | David Miller |
Headers | show |
Hello. On 10/5/2014 8:07 PM, Michael S. Tsirkin wrote: > config_mutex served two purposes: prevent multiple concurrent config > change handlers, and synchronize access to config_enable flag. > Since commit dbf2576e37da0fcc7aacbfbb9fd5d3de7888a3c1 > workqueue: make all workqueues non-reentrant > all workqueues are non-reentrant, and config_enable > is now gone. > Get rid of the unnecessary lock. > Signed-off-by: Michael S. Tsirkin <mst@redhat.com> > --- > drivers/net/virtio_net.c | 7 +------ > 1 file changed, 1 insertion(+), 6 deletions(-) > diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c > index fa17afa..d80fef4 100644 > --- a/drivers/net/virtio_net.c > +++ b/drivers/net/virtio_net.c [...] > @@ -1430,7 +1426,7 @@ static void virtnet_config_changed_work(struct work_struct *work) > netif_tx_stop_all_queues(vi->dev); > } > done: > - mutex_unlock(&vi->config_lock); > + return; There's no need for this *return*. > } > > static void virtnet_config_changed(struct virtio_device *vdev) WBR, Sergei -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Sun, 5 Oct 2014 19:07:16 +0300 "Michael S. Tsirkin" <mst@redhat.com> wrote: > config_mutex served two purposes: prevent multiple concurrent config > change handlers, and synchronize access to config_enable flag. > > Since commit dbf2576e37da0fcc7aacbfbb9fd5d3de7888a3c1 > workqueue: make all workqueues non-reentrant > all workqueues are non-reentrant, and config_enable > is now gone. > > Get rid of the unnecessary lock. > > Signed-off-by: Michael S. Tsirkin <mst@redhat.com> > --- > drivers/net/virtio_net.c | 7 +------ > 1 file changed, 1 insertion(+), 6 deletions(-) > > diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c > index fa17afa..d80fef4 100644 > --- a/drivers/net/virtio_net.c > +++ b/drivers/net/virtio_net.c > @@ -1430,7 +1426,7 @@ static void virtnet_config_changed_work(struct work_struct *work) > netif_tx_stop_all_queues(vi->dev); > } > done: > - mutex_unlock(&vi->config_lock); > + return; > } > > static void virtnet_config_changed(struct virtio_device *vdev) I'd probably return directly in the remaining 'goto done;' cases, but still Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com> -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Mon, Oct 06, 2014 at 03:46:15PM +0400, Sergei Shtylyov wrote: > Hello. > > On 10/5/2014 8:07 PM, Michael S. Tsirkin wrote: > > >config_mutex served two purposes: prevent multiple concurrent config > >change handlers, and synchronize access to config_enable flag. > > >Since commit dbf2576e37da0fcc7aacbfbb9fd5d3de7888a3c1 > > workqueue: make all workqueues non-reentrant > >all workqueues are non-reentrant, and config_enable > >is now gone. > > >Get rid of the unnecessary lock. > > >Signed-off-by: Michael S. Tsirkin <mst@redhat.com> > >--- > > drivers/net/virtio_net.c | 7 +------ > > 1 file changed, 1 insertion(+), 6 deletions(-) > > >diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c > >index fa17afa..d80fef4 100644 > >--- a/drivers/net/virtio_net.c > >+++ b/drivers/net/virtio_net.c > [...] > >@@ -1430,7 +1426,7 @@ static void virtnet_config_changed_work(struct work_struct *work) > > netif_tx_stop_all_queues(vi->dev); > > } > > done: > >- mutex_unlock(&vi->config_lock); > >+ return; > > There's no need for this *return*. > I know - it's removed by the follow-up patch. It's formatted like this to make diff smaller and make review easier. > > } > > > > static void virtnet_config_changed(struct virtio_device *vdev) > > WBR, Sergei -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Mon, Oct 06, 2014 at 01:56:10PM +0200, Cornelia Huck wrote: > On Sun, 5 Oct 2014 19:07:16 +0300 > "Michael S. Tsirkin" <mst@redhat.com> wrote: > > > config_mutex served two purposes: prevent multiple concurrent config > > change handlers, and synchronize access to config_enable flag. > > > > Since commit dbf2576e37da0fcc7aacbfbb9fd5d3de7888a3c1 > > workqueue: make all workqueues non-reentrant > > all workqueues are non-reentrant, and config_enable > > is now gone. > > > > Get rid of the unnecessary lock. > > > > Signed-off-by: Michael S. Tsirkin <mst@redhat.com> > > --- > > drivers/net/virtio_net.c | 7 +------ > > 1 file changed, 1 insertion(+), 6 deletions(-) > > > > diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c > > index fa17afa..d80fef4 100644 > > --- a/drivers/net/virtio_net.c > > +++ b/drivers/net/virtio_net.c > > > @@ -1430,7 +1426,7 @@ static void virtnet_config_changed_work(struct work_struct *work) > > netif_tx_stop_all_queues(vi->dev); > > } > > done: > > - mutex_unlock(&vi->config_lock); > > + return; > > } > > > > static void virtnet_config_changed(struct virtio_device *vdev) > > I'd probably return directly in the remaining 'goto done;' cases, but still > > Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com> Yes: this is exactly what [PATCH 11/16] virtio_net: minor cleanup does
On 10/6/2014 3:56 PM, Michael S. Tsirkin wrote: >>> config_mutex served two purposes: prevent multiple concurrent config >>> change handlers, and synchronize access to config_enable flag. >>> Since commit dbf2576e37da0fcc7aacbfbb9fd5d3de7888a3c1 >>> workqueue: make all workqueues non-reentrant >>> all workqueues are non-reentrant, and config_enable >>> is now gone. >>> Get rid of the unnecessary lock. >>> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> >>> --- >>> drivers/net/virtio_net.c | 7 +------ >>> 1 file changed, 1 insertion(+), 6 deletions(-) >>> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c >>> index fa17afa..d80fef4 100644 >>> --- a/drivers/net/virtio_net.c >>> +++ b/drivers/net/virtio_net.c >> [...] >>> @@ -1430,7 +1426,7 @@ static void virtnet_config_changed_work(struct work_struct *work) >>> netif_tx_stop_all_queues(vi->dev); >>> } >>> done: >>> - mutex_unlock(&vi->config_lock); >>> + return; >> There's no need for this *return*. > I know - it's removed by the follow-up patch. Yeah, I saw. > It's formatted like this to make diff smaller > and make review easier. Don't understand how adding this line makes diff smaller though... You first need to add it and then to delete it, where's the save? WBR, Sergei -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Mon, Oct 06, 2014 at 04:07:32PM +0400, Sergei Shtylyov wrote: > On 10/6/2014 3:56 PM, Michael S. Tsirkin wrote: > > >>>config_mutex served two purposes: prevent multiple concurrent config > >>>change handlers, and synchronize access to config_enable flag. > > >>>Since commit dbf2576e37da0fcc7aacbfbb9fd5d3de7888a3c1 > >>> workqueue: make all workqueues non-reentrant > >>>all workqueues are non-reentrant, and config_enable > >>>is now gone. > > >>>Get rid of the unnecessary lock. > > >>>Signed-off-by: Michael S. Tsirkin <mst@redhat.com> > >>>--- > >>> drivers/net/virtio_net.c | 7 +------ > >>> 1 file changed, 1 insertion(+), 6 deletions(-) > > >>>diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c > >>>index fa17afa..d80fef4 100644 > >>>--- a/drivers/net/virtio_net.c > >>>+++ b/drivers/net/virtio_net.c > >>[...] > >>>@@ -1430,7 +1426,7 @@ static void virtnet_config_changed_work(struct work_struct *work) > >>> netif_tx_stop_all_queues(vi->dev); > >>> } > >>> done: > >>>- mutex_unlock(&vi->config_lock); > >>>+ return; > > >> There's no need for this *return*. > > >I know - it's removed by the follow-up patch. > > Yeah, I saw. > > >It's formatted like this to make diff smaller > >and make review easier. > > Don't understand how adding this line makes diff smaller though... > You first need to add it and then to delete it, where's the save? > > WBR, Sergei If I don't add it, gcc generates a compiler warning: it does not like labels at the end of functions. So I don't want to just drop the return function: I must drop the label too. -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 10/6/2014 4:22 PM, Michael S. Tsirkin wrote: >>>>> config_mutex served two purposes: prevent multiple concurrent config >>>>> change handlers, and synchronize access to config_enable flag. >>>>> Since commit dbf2576e37da0fcc7aacbfbb9fd5d3de7888a3c1 >>>>> workqueue: make all workqueues non-reentrant >>>>> all workqueues are non-reentrant, and config_enable >>>>> is now gone. >>>>> Get rid of the unnecessary lock. >>>>> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> >>>>> --- >>>>> drivers/net/virtio_net.c | 7 +------ >>>>> 1 file changed, 1 insertion(+), 6 deletions(-) >>>>> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c >>>>> index fa17afa..d80fef4 100644 >>>>> --- a/drivers/net/virtio_net.c >>>>> +++ b/drivers/net/virtio_net.c >>>> [...] >>>>> @@ -1430,7 +1426,7 @@ static void virtnet_config_changed_work(struct work_struct *work) >>>>> netif_tx_stop_all_queues(vi->dev); >>>>> } >>>>> done: >>>>> - mutex_unlock(&vi->config_lock); >>>>> + return; >>>> There's no need for this *return*. >>> I know - it's removed by the follow-up patch. >> Yeah, I saw. >>> It's formatted like this to make diff smaller >>> and make review easier. >> Don't understand how adding this line makes diff smaller though... >> You first need to add it and then to delete it, where's the save? >> WBR, Sergei > If I don't add it, gcc generates a compiler warning: it does not like > labels at the end of functions. Ahh... nevermind then. WBR, Sergei -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index fa17afa..d80fef4 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c @@ -132,9 +132,6 @@ struct virtnet_info { /* Work struct for config space updates */ struct work_struct config_work; - /* Lock for config space updates */ - struct mutex config_lock; - /* Does the affinity hint is set for virtqueues? */ bool affinity_hint_set; @@ -1404,7 +1401,6 @@ static void virtnet_config_changed_work(struct work_struct *work) container_of(work, struct virtnet_info, config_work); u16 v; - mutex_lock(&vi->config_lock); if (virtio_cread_feature(vi->vdev, VIRTIO_NET_F_STATUS, struct virtio_net_config, status, &v) < 0) goto done; @@ -1430,7 +1426,7 @@ static void virtnet_config_changed_work(struct work_struct *work) netif_tx_stop_all_queues(vi->dev); } done: - mutex_unlock(&vi->config_lock); + return; } static void virtnet_config_changed(struct virtio_device *vdev) @@ -1751,7 +1747,6 @@ static int virtnet_probe(struct virtio_device *vdev) u64_stats_init(&virtnet_stats->rx_syncp); } - mutex_init(&vi->config_lock); INIT_WORK(&vi->config_work, virtnet_config_changed_work); /* If we can receive ANY GSO packets, we must allocate large ones. */
config_mutex served two purposes: prevent multiple concurrent config change handlers, and synchronize access to config_enable flag. Since commit dbf2576e37da0fcc7aacbfbb9fd5d3de7888a3c1 workqueue: make all workqueues non-reentrant all workqueues are non-reentrant, and config_enable is now gone. Get rid of the unnecessary lock. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> --- drivers/net/virtio_net.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)