stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/4] drm/msm: Fix improper uses of smp_mb__{before,after}_atomic()
       [not found] <1558373038-5611-1-git-send-email-andrea.parri@amarulasolutions.com>
@ 2019-05-20 17:23 ` Andrea Parri
  2019-05-20 21:07   ` Jordan Crouse
  2019-05-20 17:23 ` [PATCH 2/4] bio: fix improper use of smp_mb__before_atomic() Andrea Parri
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 6+ messages in thread
From: Andrea Parri @ 2019-05-20 17:23 UTC (permalink / raw)
  To: linux-kernel
  Cc: Andrea Parri, stable, Rob Clark, Sean Paul, David Airlie,
	Daniel Vetter, Jordan Crouse, linux-arm-msm, dri-devel,
	freedreno, Paul E. McKenney, Peter Zijlstra

These barriers only apply to the read-modify-write operations; in
particular, they do not apply to the atomic_set() primitive.

Replace the barriers with smp_mb()s.

Fixes: b1fc2839d2f92 ("drm/msm: Implement preemption for A5XX targets")
Cc: stable@vger.kernel.org
Reported-by: "Paul E. McKenney" <paulmck@linux.ibm.com>
Reported-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Andrea Parri <andrea.parri@amarulasolutions.com>
Cc: Rob Clark <robdclark@gmail.com>
Cc: Sean Paul <sean@poorly.run>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Jordan Crouse <jcrouse@codeaurora.org>
Cc: linux-arm-msm@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
Cc: freedreno@lists.freedesktop.org
Cc: "Paul E. McKenney" <paulmck@linux.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
---
 drivers/gpu/drm/msm/adreno/a5xx_preempt.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/msm/adreno/a5xx_preempt.c b/drivers/gpu/drm/msm/adreno/a5xx_preempt.c
index 3d62310a535fb..ee0820ee0c664 100644
--- a/drivers/gpu/drm/msm/adreno/a5xx_preempt.c
+++ b/drivers/gpu/drm/msm/adreno/a5xx_preempt.c
@@ -39,10 +39,10 @@ static inline void set_preempt_state(struct a5xx_gpu *gpu,
 	 * preemption or in the interrupt handler so barriers are needed
 	 * before...
 	 */
-	smp_mb__before_atomic();
+	smp_mb();
 	atomic_set(&gpu->preempt_state, new);
 	/* ... and after*/
-	smp_mb__after_atomic();
+	smp_mb();
 }
 
 /* Write the most recent wptr for the given ring into the hardware */
-- 
2.7.4


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

* [PATCH 2/4] bio: fix improper use of smp_mb__before_atomic()
       [not found] <1558373038-5611-1-git-send-email-andrea.parri@amarulasolutions.com>
  2019-05-20 17:23 ` [PATCH 1/4] drm/msm: Fix improper uses of smp_mb__{before,after}_atomic() Andrea Parri
@ 2019-05-20 17:23 ` Andrea Parri
  2019-05-20 17:23 ` [PATCH 3/4] sbitmap: " Andrea Parri
  2019-05-20 17:23 ` [PATCH 4/4] ceph: " Andrea Parri
  3 siblings, 0 replies; 6+ messages in thread
From: Andrea Parri @ 2019-05-20 17:23 UTC (permalink / raw)
  To: linux-kernel
  Cc: Andrea Parri, stable, Jens Axboe, Ming Lei, linux-block,
	Paul E. McKenney, Peter Zijlstra

This barrier only applies to the read-modify-write operations; in
particular, it does not apply to the atomic_set() primitive.

Replace the barrier with an smp_mb().

Fixes: dac56212e8127 ("bio: skip atomic inc/dec of ->bi_cnt for most use cases")
Cc: stable@vger.kernel.org
Reported-by: "Paul E. McKenney" <paulmck@linux.ibm.com>
Reported-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Andrea Parri <andrea.parri@amarulasolutions.com>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Ming Lei <ming.lei@redhat.com>
Cc: linux-block@vger.kernel.org
Cc: "Paul E. McKenney" <paulmck@linux.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
---
 include/linux/bio.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/bio.h b/include/linux/bio.h
index ea73df36529ad..0f23b56826403 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -210,7 +210,7 @@ static inline void bio_cnt_set(struct bio *bio, unsigned int count)
 {
 	if (count != 1) {
 		bio->bi_flags |= (1 << BIO_REFFED);
-		smp_mb__before_atomic();
+		smp_mb();
 	}
 	atomic_set(&bio->__bi_cnt, count);
 }
-- 
2.7.4


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

* [PATCH 3/4] sbitmap: fix improper use of smp_mb__before_atomic()
       [not found] <1558373038-5611-1-git-send-email-andrea.parri@amarulasolutions.com>
  2019-05-20 17:23 ` [PATCH 1/4] drm/msm: Fix improper uses of smp_mb__{before,after}_atomic() Andrea Parri
  2019-05-20 17:23 ` [PATCH 2/4] bio: fix improper use of smp_mb__before_atomic() Andrea Parri
@ 2019-05-20 17:23 ` Andrea Parri
  2019-05-20 17:23 ` [PATCH 4/4] ceph: " Andrea Parri
  3 siblings, 0 replies; 6+ messages in thread
From: Andrea Parri @ 2019-05-20 17:23 UTC (permalink / raw)
  To: linux-kernel
  Cc: Andrea Parri, stable, Jens Axboe, Omar Sandoval, Ming Lei,
	linux-block, Paul E. McKenney, Peter Zijlstra

This barrier only applies to the read-modify-write operations; in
particular, it does not apply to the atomic_set() primitive.

Replace the barrier with an smp_mb().

Fixes: 6c0ca7ae292ad ("sbitmap: fix wakeup hang after sbq resize")
Cc: stable@vger.kernel.org
Reported-by: "Paul E. McKenney" <paulmck@linux.ibm.com>
Reported-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Andrea Parri <andrea.parri@amarulasolutions.com>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Omar Sandoval <osandov@fb.com>
Cc: Ming Lei <ming.lei@redhat.com>
Cc: linux-block@vger.kernel.org
Cc: "Paul E. McKenney" <paulmck@linux.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
---
 lib/sbitmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/sbitmap.c b/lib/sbitmap.c
index 155fe38756ecf..4a7fc4915dfc6 100644
--- a/lib/sbitmap.c
+++ b/lib/sbitmap.c
@@ -435,7 +435,7 @@ static void sbitmap_queue_update_wake_batch(struct sbitmap_queue *sbq,
 		 * to ensure that the batch size is updated before the wait
 		 * counts.
 		 */
-		smp_mb__before_atomic();
+		smp_mb();
 		for (i = 0; i < SBQ_WAIT_QUEUES; i++)
 			atomic_set(&sbq->ws[i].wait_cnt, 1);
 	}
-- 
2.7.4


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

* [PATCH 4/4] ceph: fix improper use of smp_mb__before_atomic()
       [not found] <1558373038-5611-1-git-send-email-andrea.parri@amarulasolutions.com>
                   ` (2 preceding siblings ...)
  2019-05-20 17:23 ` [PATCH 3/4] sbitmap: " Andrea Parri
@ 2019-05-20 17:23 ` Andrea Parri
  2019-05-21  2:18   ` Yan, Zheng
  3 siblings, 1 reply; 6+ messages in thread
From: Andrea Parri @ 2019-05-20 17:23 UTC (permalink / raw)
  To: linux-kernel
  Cc: Andrea Parri, stable, Yan, Zheng, Sage Weil, Ilya Dryomov,
	ceph-devel, Paul E. McKenney, Peter Zijlstra

This barrier only applies to the read-modify-write operations; in
particular, it does not apply to the atomic64_set() primitive.

Replace the barrier with an smp_mb().

Fixes: fdd4e15838e59 ("ceph: rework dcache readdir")
Cc: stable@vger.kernel.org
Reported-by: "Paul E. McKenney" <paulmck@linux.ibm.com>
Reported-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Andrea Parri <andrea.parri@amarulasolutions.com>
Cc: "Yan, Zheng" <zyan@redhat.com>
Cc: Sage Weil <sage@redhat.com>
Cc: Ilya Dryomov <idryomov@gmail.com>
Cc: ceph-devel@vger.kernel.org
Cc: "Paul E. McKenney" <paulmck@linux.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
---
 fs/ceph/super.h | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/fs/ceph/super.h b/fs/ceph/super.h
index 6edab9a750f8a..e02f4ff0be3f1 100644
--- a/fs/ceph/super.h
+++ b/fs/ceph/super.h
@@ -541,7 +541,12 @@ static inline void __ceph_dir_set_complete(struct ceph_inode_info *ci,
 					   long long release_count,
 					   long long ordered_count)
 {
-	smp_mb__before_atomic();
+	/*
+	 * Makes sure operations that setup readdir cache (update page
+	 * cache and i_size) are strongly ordered w.r.t. the following
+	 * atomic64_set() operations.
+	 */
+	smp_mb();
 	atomic64_set(&ci->i_complete_seq[0], release_count);
 	atomic64_set(&ci->i_complete_seq[1], ordered_count);
 }
-- 
2.7.4


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

* Re: [PATCH 1/4] drm/msm: Fix improper uses of smp_mb__{before,after}_atomic()
  2019-05-20 17:23 ` [PATCH 1/4] drm/msm: Fix improper uses of smp_mb__{before,after}_atomic() Andrea Parri
@ 2019-05-20 21:07   ` Jordan Crouse
  0 siblings, 0 replies; 6+ messages in thread
From: Jordan Crouse @ 2019-05-20 21:07 UTC (permalink / raw)
  To: Andrea Parri
  Cc: linux-kernel, stable, Rob Clark, Sean Paul, David Airlie,
	Daniel Vetter, linux-arm-msm, dri-devel, freedreno,
	Paul E. McKenney, Peter Zijlstra

On Mon, May 20, 2019 at 07:23:55PM +0200, Andrea Parri wrote:
> These barriers only apply to the read-modify-write operations; in
> particular, they do not apply to the atomic_set() primitive.
> 
> Replace the barriers with smp_mb()s.
> 
> Fixes: b1fc2839d2f92 ("drm/msm: Implement preemption for A5XX targets")
> Cc: stable@vger.kernel.org
> Reported-by: "Paul E. McKenney" <paulmck@linux.ibm.com>
> Reported-by: Peter Zijlstra <peterz@infradead.org>
> Signed-off-by: Andrea Parri <andrea.parri@amarulasolutions.com>
> Cc: Rob Clark <robdclark@gmail.com>
> Cc: Sean Paul <sean@poorly.run>
> Cc: David Airlie <airlied@linux.ie>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: Jordan Crouse <jcrouse@codeaurora.org>
> Cc: linux-arm-msm@vger.kernel.org
> Cc: dri-devel@lists.freedesktop.org
> Cc: freedreno@lists.freedesktop.org
> Cc: "Paul E. McKenney" <paulmck@linux.ibm.com>
> Cc: Peter Zijlstra <peterz@infradead.org>

I'll go ahead and ack this - I'm not super clued in on atomic barriers, but this
seems to be in the spirit of what we are trying to do to protect the atomic
value. Rob can disagree, of course.

Acked-by: Jordan Crouse <jcrouse@codeaurora.org>

> ---
>  drivers/gpu/drm/msm/adreno/a5xx_preempt.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/msm/adreno/a5xx_preempt.c b/drivers/gpu/drm/msm/adreno/a5xx_preempt.c
> index 3d62310a535fb..ee0820ee0c664 100644
> --- a/drivers/gpu/drm/msm/adreno/a5xx_preempt.c
> +++ b/drivers/gpu/drm/msm/adreno/a5xx_preempt.c
> @@ -39,10 +39,10 @@ static inline void set_preempt_state(struct a5xx_gpu *gpu,
>  	 * preemption or in the interrupt handler so barriers are needed
>  	 * before...
>  	 */
> -	smp_mb__before_atomic();
> +	smp_mb();
>  	atomic_set(&gpu->preempt_state, new);
>  	/* ... and after*/
> -	smp_mb__after_atomic();
> +	smp_mb();
>  }
>  
>  /* Write the most recent wptr for the given ring into the hardware */
> -- 
> 2.7.4
> 

-- 
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

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

* Re: [PATCH 4/4] ceph: fix improper use of smp_mb__before_atomic()
  2019-05-20 17:23 ` [PATCH 4/4] ceph: " Andrea Parri
@ 2019-05-21  2:18   ` Yan, Zheng
  0 siblings, 0 replies; 6+ messages in thread
From: Yan, Zheng @ 2019-05-21  2:18 UTC (permalink / raw)
  To: Andrea Parri, linux-kernel
  Cc: stable, Sage Weil, Ilya Dryomov, ceph-devel, Paul E. McKenney,
	Peter Zijlstra

On 5/21/19 1:23 AM, Andrea Parri wrote:
> This barrier only applies to the read-modify-write operations; in
> particular, it does not apply to the atomic64_set() primitive.
> 
> Replace the barrier with an smp_mb().
> 
> Fixes: fdd4e15838e59 ("ceph: rework dcache readdir")
> Cc: stable@vger.kernel.org
> Reported-by: "Paul E. McKenney" <paulmck@linux.ibm.com>
> Reported-by: Peter Zijlstra <peterz@infradead.org>
> Signed-off-by: Andrea Parri <andrea.parri@amarulasolutions.com>
> Cc: "Yan, Zheng" <zyan@redhat.com>
> Cc: Sage Weil <sage@redhat.com>
> Cc: Ilya Dryomov <idryomov@gmail.com>
> Cc: ceph-devel@vger.kernel.org
> Cc: "Paul E. McKenney" <paulmck@linux.ibm.com>
> Cc: Peter Zijlstra <peterz@infradead.org>
> ---
>   fs/ceph/super.h | 7 ++++++-
>   1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/ceph/super.h b/fs/ceph/super.h
> index 6edab9a750f8a..e02f4ff0be3f1 100644
> --- a/fs/ceph/super.h
> +++ b/fs/ceph/super.h
> @@ -541,7 +541,12 @@ static inline void __ceph_dir_set_complete(struct ceph_inode_info *ci,
>   					   long long release_count,
>   					   long long ordered_count)
>   {
> -	smp_mb__before_atomic();
> +	/*
> +	 * Makes sure operations that setup readdir cache (update page
> +	 * cache and i_size) are strongly ordered w.r.t. the following
> +	 * atomic64_set() operations.
> +	 */
> +	smp_mb();
>   	atomic64_set(&ci->i_complete_seq[0], release_count);
>   	atomic64_set(&ci->i_complete_seq[1], ordered_count);
>   }
> 

Applied, thanks


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

end of thread, other threads:[~2019-05-21  2:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1558373038-5611-1-git-send-email-andrea.parri@amarulasolutions.com>
2019-05-20 17:23 ` [PATCH 1/4] drm/msm: Fix improper uses of smp_mb__{before,after}_atomic() Andrea Parri
2019-05-20 21:07   ` Jordan Crouse
2019-05-20 17:23 ` [PATCH 2/4] bio: fix improper use of smp_mb__before_atomic() Andrea Parri
2019-05-20 17:23 ` [PATCH 3/4] sbitmap: " Andrea Parri
2019-05-20 17:23 ` [PATCH 4/4] ceph: " Andrea Parri
2019-05-21  2:18   ` Yan, Zheng

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).