diff mbox series

USB: serial: relax unthrottle memory barrier

Message ID 20200130100658.683-1-johan@kernel.org (mailing list archive)
State Mainlined
Commit 32553441569482e36e65371edb84494bcec53c03
Headers show
Series USB: serial: relax unthrottle memory barrier | expand

Commit Message

Johan Hovold Jan. 30, 2020, 10:06 a.m. UTC
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(-)

Comments

Greg KH Jan. 30, 2020, 10:23 a.m. UTC | #1
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>
Davidlohr Bueso Jan. 30, 2020, 3:33 p.m. UTC | #2
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>
Johan Hovold Feb. 10, 2020, 9:38 a.m. UTC | #3
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
diff mbox series

Patch

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);
 }