diff mbox series

vhost/scsi: drop unnecessary smp_mb__after_atomic()

Message ID 20190416104748.26942-1-stefanha@redhat.com (mailing list archive)
State New, archived
Headers show
Series vhost/scsi: drop unnecessary smp_mb__after_atomic() | expand

Commit Message

Stefan Hajnoczi April 16, 2019, 10:47 a.m. UTC
The vhost_scsi.ko code used several atomic variables at one point.
Later they were dropped or converted to regular ints protected by a
mutex.

The commit that made these changes left an unused smp_mb__after_atomic()
in vhost_scsi_set_endpoint().  It was previously used after incrementing
vhost_scsi->vhost_ref_cnt but this field has been dropped:

  -     atomic_inc(&vs->vhost_ref_cnt);
        smp_mb__after_atomic_inc();

Reported-by: Andrea Parri <andrea.parri@amarulasolutions.com>
Fixes: 101998f6fcd680 ("tcm_vhost: Post-merge review changes requested by MST")
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 drivers/vhost/scsi.c | 1 -
 1 file changed, 1 deletion(-)

Comments

Jason Wang April 17, 2019, 5:57 a.m. UTC | #1
On 2019/4/16 下午6:47, Stefan Hajnoczi wrote:
> The vhost_scsi.ko code used several atomic variables at one point.
> Later they were dropped or converted to regular ints protected by a
> mutex.
>
> The commit that made these changes left an unused smp_mb__after_atomic()
> in vhost_scsi_set_endpoint().  It was previously used after incrementing
> vhost_scsi->vhost_ref_cnt but this field has been dropped:
>
>    -     atomic_inc(&vs->vhost_ref_cnt);
>          smp_mb__after_atomic_inc();
>
> Reported-by: Andrea Parri <andrea.parri@amarulasolutions.com>
> Fixes: 101998f6fcd680 ("tcm_vhost: Post-merge review changes requested by MST")
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> ---
>   drivers/vhost/scsi.c | 1 -
>   1 file changed, 1 deletion(-)
>
> diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c
> index 618fb6461017..c090d177bd75 100644
> --- a/drivers/vhost/scsi.c
> +++ b/drivers/vhost/scsi.c
> @@ -1443,7 +1443,6 @@ vhost_scsi_set_endpoint(struct vhost_scsi *vs,
>   			tpg->tv_tpg_vhost_count++;
>   			tpg->vhost_scsi = vs;
>   			vs_tpg[tpg->tport_tpgt] = tpg;
> -			smp_mb__after_atomic();
>   			match = true;
>   		}
>   		mutex_unlock(&tpg->tv_tpg_mutex);


Looks like Paolo has sent an identical patch before this one.

Thanks
Stefan Hajnoczi April 18, 2019, 8:56 a.m. UTC | #2
On Wed, Apr 17, 2019 at 6:57 AM Jason Wang <jasowang@redhat.com> wrote:
> On 2019/4/16 下午6:47, Stefan Hajnoczi wrote:
> > The vhost_scsi.ko code used several atomic variables at one point.
> > Later they were dropped or converted to regular ints protected by a
> > mutex.
> >
> > The commit that made these changes left an unused smp_mb__after_atomic()
> > in vhost_scsi_set_endpoint().  It was previously used after incrementing
> > vhost_scsi->vhost_ref_cnt but this field has been dropped:
> >
> >    -     atomic_inc(&vs->vhost_ref_cnt);
> >          smp_mb__after_atomic_inc();
> >
> > Reported-by: Andrea Parri <andrea.parri@amarulasolutions.com>
> > Fixes: 101998f6fcd680 ("tcm_vhost: Post-merge review changes requested by MST")
> > Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> > ---
> >   drivers/vhost/scsi.c | 1 -
> >   1 file changed, 1 deletion(-)
> >
> > diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c
> > index 618fb6461017..c090d177bd75 100644
> > --- a/drivers/vhost/scsi.c
> > +++ b/drivers/vhost/scsi.c
> > @@ -1443,7 +1443,6 @@ vhost_scsi_set_endpoint(struct vhost_scsi *vs,
> >                       tpg->tv_tpg_vhost_count++;
> >                       tpg->vhost_scsi = vs;
> >                       vs_tpg[tpg->tport_tpgt] = tpg;
> > -                     smp_mb__after_atomic();
> >                       match = true;
> >               }
> >               mutex_unlock(&tpg->tv_tpg_mutex);
>
>
> Looks like Paolo has sent an identical patch before this one.

Yes, Paolo's patch is fine.

Stefan
diff mbox series

Patch

diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c
index 618fb6461017..c090d177bd75 100644
--- a/drivers/vhost/scsi.c
+++ b/drivers/vhost/scsi.c
@@ -1443,7 +1443,6 @@  vhost_scsi_set_endpoint(struct vhost_scsi *vs,
 			tpg->tv_tpg_vhost_count++;
 			tpg->vhost_scsi = vs;
 			vs_tpg[tpg->tport_tpgt] = tpg;
-			smp_mb__after_atomic();
 			match = true;
 		}
 		mutex_unlock(&tpg->tv_tpg_mutex);