Skip to contentSkip to conversation

usb, cdc-acm: optimize barrier usage for Rmw atomic bitops

PATCH In review Davidlohr Bueso 2 participants 3 messages Jan 29, 2020 – Mar 23, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 7/8 usb, cdc-acm: optimize barrier usage for Rmw atomic bitops

We can avoid the unnecessary barrier on non LL/SC architectures, such as x86. Instead, use the smp_mb__after_atomic() call.

---
 drivers/usb/class/cdc-acm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/class/cdc-acm.c +1 -1
index 62f4fb9b362f..0bc4b558f387 100644
@@ -842,7 +842,7 @@ static void acm_tty_unthrottle(struct tty_struct *tty)
 	clear_bit(ACM_THROTTLED, &acm->flags);
 
 	/* Matches the smp_mb__after_atomic() in acm_read_bulk_callback(). */
-	smp_mb();
+	smp_mb__after_atomic();
 
 	acm_submit_read_urbs(acm, GFP_KERNEL);
 }
Signature · 1 line
2.16.4
Reviewed-by on v1 7/8
#1 lore raw
Quoted 4 lines · Davidlohr Bueso

We can avoid the unnecessary barrier on non LL/SC architectures, such as x86. Instead, use the smp_mb__after_atomic() call.

Quoted 9 lines
---
 drivers/usb/class/cdc-acm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/class/cdc-acm.c +0 -0
index 62f4fb9b362f..0bc4b558f387 100644

drivers/usb/class/cdc-acm.c static void acm_tty_unthrottle(struct tty_struct *tty) · line 848

Quoted 8 lines
drivers/usb/class/cdc-acm.c +1 -1
@@ -842,7 +842,7 @@ static void acm_tty_unthrottle(struct tty_struct *tty)
 	clear_bit(ACM_THROTTLED, &acm->flags);
 
 	/* Matches the smp_mb__after_atomic() in acm_read_bulk_callback(). */
-	smp_mb();
+	smp_mb__after_atomic();
 
 	acm_submit_read_urbs(acm, GFP_KERNEL);
 }

We have another barrier in USB serial which can also be relaxed this way. I'll post a patch shortly.

Johan

#2 lore raw
In reply to Davidlohr Bueso

ping? Can these please be picked up?

Quoted 24 lines · Davidlohr Bueso

We can avoid the unnecessary barrier on non LL/SC architectures, such as x86. Instead, use the smp_mb__after_atomic() call.

---
drivers/usb/class/cdc-acm.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/class/cdc-acm.c +1 -1
index 62f4fb9b362f..0bc4b558f387 100644
@@ -842,7 +842,7 @@ static void acm_tty_unthrottle(struct tty_struct *tty)
 	clear_bit(ACM_THROTTLED, &acm->flags);
 
 	/* Matches the smp_mb__after_atomic() in acm_read_bulk_callback(). */
-	smp_mb();
+	smp_mb__after_atomic();
 
 	acm_submit_read_urbs(acm, GFP_KERNEL);
 }
Signature · 1 line
2.16.4