linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH tip/core/rcu 4/9] drivers/scsi: Replace rcu_swap_protected() with rcu_replace()
       [not found] <20191003014153.GA13156@paulmck-ThinkPad-P72>
@ 2019-10-03  1:43 ` paulmck
  2019-10-04  2:09   ` Martin K. Petersen
  0 siblings, 1 reply; 4+ messages in thread
From: paulmck @ 2019-10-03  1:43 UTC (permalink / raw)
  To: rcu
  Cc: linux-kernel, mingo, jiangshanlai, dipankar, akpm,
	mathieu.desnoyers, josh, tglx, peterz, rostedt, dhowells,
	edumazet, fweisbec, oleg, joel, Paul E. McKenney,
	James E.J. Bottomley, Martin K. Petersen, linux-scsi

From: "Paul E. McKenney" <paulmck@kernel.org>

This commit replaces the use of rcu_swap_protected() with the more
intuitively appealing rcu_replace() as a step towards removing
rcu_swap_protected().

Link: https://lore.kernel.org/lkml/CAHk-=wiAsJLw1egFEE=Z7-GGtM6wcvtyytXZA1+BHqta4gg6Hw@mail.gmail.com/
Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Cc: "James E.J. Bottomley" <jejb@linux.ibm.com>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: <linux-scsi@vger.kernel.org>
Cc: <linux-kernel@vger.kernel.org>
---
 drivers/scsi/scsi.c       | 4 ++--
 drivers/scsi/scsi_sysfs.c | 8 ++++----
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
index 1f5b5c8..6a38d4a 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -434,8 +434,8 @@ static void scsi_update_vpd_page(struct scsi_device *sdev, u8 page,
 		return;
 
 	mutex_lock(&sdev->inquiry_mutex);
-	rcu_swap_protected(*sdev_vpd_buf, vpd_buf,
-			   lockdep_is_held(&sdev->inquiry_mutex));
+	vpd_buf = rcu_replace(*sdev_vpd_buf, vpd_buf,
+			      lockdep_is_held(&sdev->inquiry_mutex));
 	mutex_unlock(&sdev->inquiry_mutex);
 
 	if (vpd_buf)
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index 64c96c7..8d17779 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -466,10 +466,10 @@ static void scsi_device_dev_release_usercontext(struct work_struct *work)
 	sdev->request_queue = NULL;
 
 	mutex_lock(&sdev->inquiry_mutex);
-	rcu_swap_protected(sdev->vpd_pg80, vpd_pg80,
-			   lockdep_is_held(&sdev->inquiry_mutex));
-	rcu_swap_protected(sdev->vpd_pg83, vpd_pg83,
-			   lockdep_is_held(&sdev->inquiry_mutex));
+	vpd_pg80 = rcu_replace(sdev->vpd_pg80, vpd_pg80,
+			       lockdep_is_held(&sdev->inquiry_mutex));
+	vpd_pg83 = rcu_replace(sdev->vpd_pg83, vpd_pg83,
+			       lockdep_is_held(&sdev->inquiry_mutex));
 	mutex_unlock(&sdev->inquiry_mutex);
 
 	if (vpd_pg83)
-- 
2.9.5


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH tip/core/rcu 4/9] drivers/scsi: Replace rcu_swap_protected() with rcu_replace()
  2019-10-03  1:43 ` [PATCH tip/core/rcu 4/9] drivers/scsi: Replace rcu_swap_protected() with rcu_replace() paulmck
@ 2019-10-04  2:09   ` Martin K. Petersen
  2019-10-05 16:06     ` Paul E. McKenney
  0 siblings, 1 reply; 4+ messages in thread
From: Martin K. Petersen @ 2019-10-04  2:09 UTC (permalink / raw)
  To: paulmck
  Cc: rcu, linux-kernel, mingo, jiangshanlai, dipankar, akpm,
	mathieu.desnoyers, josh, tglx, peterz, rostedt, dhowells,
	edumazet, fweisbec, oleg, joel, James E.J. Bottomley,
	Martin K. Petersen, linux-scsi


Paul,

No objections from me.

> +	vpd_pg80 = rcu_replace(sdev->vpd_pg80, vpd_pg80,
> +			       lockdep_is_held(&sdev->inquiry_mutex));
> +	vpd_pg83 = rcu_replace(sdev->vpd_pg83, vpd_pg83,
> +			       lockdep_is_held(&sdev->inquiry_mutex));

Just a heads-up that we have added a couple of additional VPD pages so
my 5.5 tree will need additional calls to be updated to rcu_replace().

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH tip/core/rcu 4/9] drivers/scsi: Replace rcu_swap_protected() with rcu_replace()
  2019-10-04  2:09   ` Martin K. Petersen
@ 2019-10-05 16:06     ` Paul E. McKenney
  2019-10-10  2:36       ` Martin K. Petersen
  0 siblings, 1 reply; 4+ messages in thread
From: Paul E. McKenney @ 2019-10-05 16:06 UTC (permalink / raw)
  To: Martin K. Petersen
  Cc: rcu, linux-kernel, mingo, jiangshanlai, dipankar, akpm,
	mathieu.desnoyers, josh, tglx, peterz, rostedt, dhowells,
	edumazet, fweisbec, oleg, joel, James E.J. Bottomley, linux-scsi

On Thu, Oct 03, 2019 at 10:09:31PM -0400, Martin K. Petersen wrote:
> 
> Paul,
> 
> No objections from me.

Thank you, Martin!  I have applied your Acked-by, but please let me
know if that over-interprets your "No objections" above.

> > +	vpd_pg80 = rcu_replace(sdev->vpd_pg80, vpd_pg80,
> > +			       lockdep_is_held(&sdev->inquiry_mutex));
> > +	vpd_pg83 = rcu_replace(sdev->vpd_pg83, vpd_pg83,
> > +			       lockdep_is_held(&sdev->inquiry_mutex));
> 
> Just a heads-up that we have added a couple of additional VPD pages so
> my 5.5 tree will need additional calls to be updated to rcu_replace().

I do not intend to actually remove rcu_swap_protected() until 5.6 for
exactly this sort of thing.  My plan is to take another pass through
the tree after 5.5 comes out, and these will be caught at that time.

Does that work for you?

							Thanx, Paul

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH tip/core/rcu 4/9] drivers/scsi: Replace rcu_swap_protected() with rcu_replace()
  2019-10-05 16:06     ` Paul E. McKenney
@ 2019-10-10  2:36       ` Martin K. Petersen
  0 siblings, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2019-10-10  2:36 UTC (permalink / raw)
  To: Paul E. McKenney
  Cc: Martin K. Petersen, rcu, linux-kernel, mingo, jiangshanlai,
	dipankar, akpm, mathieu.desnoyers, josh, tglx, peterz, rostedt,
	dhowells, edumazet, fweisbec, oleg, joel, James E.J. Bottomley,
	linux-scsi


Paul,

> I do not intend to actually remove rcu_swap_protected() until 5.6 for
> exactly this sort of thing.  My plan is to take another pass through
> the tree after 5.5 comes out, and these will be caught at that time.
>
> Does that work for you?

Yep, that's great. Thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-10-10  2:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20191003014153.GA13156@paulmck-ThinkPad-P72>
2019-10-03  1:43 ` [PATCH tip/core/rcu 4/9] drivers/scsi: Replace rcu_swap_protected() with rcu_replace() paulmck
2019-10-04  2:09   ` Martin K. Petersen
2019-10-05 16:06     ` Paul E. McKenney
2019-10-10  2:36       ` Martin K. Petersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).