linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] USB: serial: relax unthrottle memory barrier
@ 2020-01-30 10:06 Johan Hovold
  2020-01-30 10:23 ` Greg KH
  2020-01-30 15:33 ` Davidlohr Bueso
  0 siblings, 2 replies; 4+ messages in thread
From: Johan Hovold @ 2020-01-30 10:06 UTC (permalink / raw)
  To: Johan Hovold; +Cc: linux-usb, linux-kernel, Davidlohr Bueso

Commit a8d78d9f3856 ("USB: serial: clean up throttle handling")
converted the throttle handling to use atomic bitops. This means that we
can relax the smp_mb() in unthrottle() to smp_mb__after_atomic(), which
for example is a no-op on architectures like x86 that provide fully
ordered atomics.

Signed-off-by: Johan Hovold <johan@kernel.org>
---
 drivers/usb/serial/generic.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c
index 1be8bea372a2..546a1c2ce2f2 100644
--- a/drivers/usb/serial/generic.c
+++ b/drivers/usb/serial/generic.c
@@ -417,7 +417,7 @@ void usb_serial_generic_read_bulk_callback(struct urb *urb)
 	/*
 	 * Make sure URB is marked as free before checking the throttled flag
 	 * to avoid racing with unthrottle() on another CPU. Matches the
-	 * smp_mb() in unthrottle().
+	 * smp_mb__after_atomic() in unthrottle().
 	 */
 	smp_mb__after_atomic();
 
@@ -489,7 +489,7 @@ void usb_serial_generic_unthrottle(struct tty_struct *tty)
 	 * Matches the smp_mb__after_atomic() in
 	 * usb_serial_generic_read_bulk_callback().
 	 */
-	smp_mb();
+	smp_mb__after_atomic();
 
 	usb_serial_generic_submit_read_urbs(port, GFP_KERNEL);
 }
-- 
2.24.1


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

* Re: [PATCH] USB: serial: relax unthrottle memory barrier
  2020-01-30 10:06 [PATCH] USB: serial: relax unthrottle memory barrier Johan Hovold
@ 2020-01-30 10:23 ` Greg KH
  2020-01-30 15:33 ` Davidlohr Bueso
  1 sibling, 0 replies; 4+ messages in thread
From: Greg KH @ 2020-01-30 10:23 UTC (permalink / raw)
  To: Johan Hovold; +Cc: linux-usb, linux-kernel, Davidlohr Bueso

On Thu, Jan 30, 2020 at 11:06:58AM +0100, Johan Hovold wrote:
> Commit a8d78d9f3856 ("USB: serial: clean up throttle handling")
> converted the throttle handling to use atomic bitops. This means that we
> can relax the smp_mb() in unthrottle() to smp_mb__after_atomic(), which
> for example is a no-op on architectures like x86 that provide fully
> ordered atomics.
> 
> Signed-off-by: Johan Hovold <johan@kernel.org>

Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

* Re: [PATCH] USB: serial: relax unthrottle memory barrier
  2020-01-30 10:06 [PATCH] USB: serial: relax unthrottle memory barrier Johan Hovold
  2020-01-30 10:23 ` Greg KH
@ 2020-01-30 15:33 ` Davidlohr Bueso
  2020-02-10  9:38   ` Johan Hovold
  1 sibling, 1 reply; 4+ messages in thread
From: Davidlohr Bueso @ 2020-01-30 15:33 UTC (permalink / raw)
  To: Johan Hovold; +Cc: linux-usb, linux-kernel

On Thu, 30 Jan 2020, Johan Hovold wrote:

>Commit a8d78d9f3856 ("USB: serial: clean up throttle handling")
>converted the throttle handling to use atomic bitops. This means that we
>can relax the smp_mb() in unthrottle() to smp_mb__after_atomic(), which
>for example is a no-op on architectures like x86 that provide fully
>ordered atomics.
>
>Signed-off-by: Johan Hovold <johan@kernel.org>

Reviewed-by: Davidlohr Bueso <dbueso@suse.de>

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

* Re: [PATCH] USB: serial: relax unthrottle memory barrier
  2020-01-30 15:33 ` Davidlohr Bueso
@ 2020-02-10  9:38   ` Johan Hovold
  0 siblings, 0 replies; 4+ messages in thread
From: Johan Hovold @ 2020-02-10  9:38 UTC (permalink / raw)
  To: Davidlohr Bueso; +Cc: Johan Hovold, linux-usb, linux-kernel

On Thu, Jan 30, 2020 at 07:33:28AM -0800, Davidlohr Bueso wrote:
> On Thu, 30 Jan 2020, Johan Hovold wrote:
> 
> >Commit a8d78d9f3856 ("USB: serial: clean up throttle handling")
> >converted the throttle handling to use atomic bitops. This means that we
> >can relax the smp_mb() in unthrottle() to smp_mb__after_atomic(), which
> >for example is a no-op on architectures like x86 that provide fully
> >ordered atomics.
> >
> >Signed-off-by: Johan Hovold <johan@kernel.org>
> 
> Reviewed-by: Davidlohr Bueso <dbueso@suse.de>

Thanks for the review. Now applied.

Johan

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

end of thread, other threads:[~2020-02-10  9:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-30 10:06 [PATCH] USB: serial: relax unthrottle memory barrier Johan Hovold
2020-01-30 10:23 ` Greg KH
2020-01-30 15:33 ` Davidlohr Bueso
2020-02-10  9:38   ` Johan Hovold

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