Skip to contentSkip to conversation

vhost/scsi: drop unnecessary smp_mb__after_atomic()

PATCH In review Stefan Hajnoczi 3 participants 5 messages Apr 16, 2019 – Apr 18, 2019

Subsystems (4)
lore
Share & tools
lore

Stefan Hajnoczi

author reviewer
#0 lore raw

PATCH 1/1 vhost/scsi: drop unnecessary smp_mb__after_atomic()

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();
Fixes 101998f6fcd680 ("tcm_vhost: Post-merge review changes requested by MST")
---
 drivers/vhost/scsi.c | 1 -
 1 file changed, 1 deletion(-)
drivers/vhost/scsi.c +0 -1
index 618fb6461017..c090d177bd75 100644
@@ -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);
Signature · 1 line
2.20.1
#1 lore raw
Quoted 23 lines · Stefan Hajnoczi

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();
Fixes 101998f6fcd680 ("tcm_vhost: Post-merge review changes requested by MST")
---
  drivers/vhost/scsi.c | 1 -
  1 file changed, 1 deletion(-)
drivers/vhost/scsi.c +0 -0
index 618fb6461017..c090d177bd75 100644

drivers/vhost/scsi.c vhost_scsi_set_endpoint(struct vhost_scsi *vs, · line 1448

Quoted 7 lines
drivers/vhost/scsi.c +0 -1
@@ -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

_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

#2 lore raw
In reply to Stefan Hajnoczi
Quoted 23 lines · Stefan Hajnoczi

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();
Fixes 101998f6fcd680 ("tcm_vhost: Post-merge review changes requested by MST")
---
  drivers/vhost/scsi.c | 1 -
  1 file changed, 1 deletion(-)
drivers/vhost/scsi.c +0 -0
index 618fb6461017..c090d177bd75 100644

drivers/vhost/scsi.c vhost_scsi_set_endpoint(struct vhost_scsi *vs, · line 1448

Quoted 7 lines
drivers/vhost/scsi.c +0 -1
@@ -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

#3 lore raw
Quoted 19 lines · Jason Wang
Quoted 18 lines · Stefan Hajnoczi

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();
Fixes 101998f6fcd680 ("tcm_vhost: Post-merge review changes requested by MST")
---
  drivers/vhost/scsi.c | 1 -
  1 file changed, 1 deletion(-)
Quoted 15 lines

drivers/vhost/scsi.c vhost_scsi_set_endpoint(struct vhost_scsi *vs, · line 1448

Quoted 12 lines
drivers/vhost/scsi.c +0 -1
index 618fb6461017..c090d177bd75 100644
@@ -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
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

#4 lore raw
In reply to Jason Wang
Quoted 19 lines · Jason Wang
Quoted 18 lines · Stefan Hajnoczi

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();
Fixes 101998f6fcd680 ("tcm_vhost: Post-merge review changes requested by MST")
---
  drivers/vhost/scsi.c | 1 -
  1 file changed, 1 deletion(-)
Quoted 15 lines

drivers/vhost/scsi.c vhost_scsi_set_endpoint(struct vhost_scsi *vs, · line 1448

Quoted 12 lines
drivers/vhost/scsi.c +0 -1
index 618fb6461017..c090d177bd75 100644
@@ -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