* [PATCH v2] Bluetooth: 6lowpan: use DEV_STAT_INC() to avoid races
@ 2024-05-27 6:52 yunshui
2024-05-27 7:03 ` Paul Menzel
2024-05-27 7:34 ` [v2] " bluez.test.bot
0 siblings, 2 replies; 3+ messages in thread
From: yunshui @ 2024-05-27 6:52 UTC (permalink / raw)
To: linux-kernel, linux-bluetooth; +Cc: marcel, johan.hedberg, luiz.dentz, yunshui
syzbot/KCSAN reported that races happen when multiple cpus
updating dev->stats.tx_error concurrently.
Adopt SMP safe DEV_STATS_INC() to update dev->stats fields.
Signed-off-by: yunshui <jiangyunshui@kylinos.cn>
---
net/bluetooth/6lowpan.c | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/net/bluetooth/6lowpan.c b/net/bluetooth/6lowpan.c
index 50cfec8ccac4..b8906f55e2b2 100644
--- a/net/bluetooth/6lowpan.c
+++ b/net/bluetooth/6lowpan.c
@@ -295,8 +295,8 @@ static int recv_pkt(struct sk_buff *skb, struct net_device *dev,
goto drop;
}
- dev->stats.rx_bytes += skb->len;
- dev->stats.rx_packets++;
+ DEV_STATS_ADD(dev, rx_bytes, skb->len);
+ DEV_STATS_INC(dev, rx_packets);
consume_skb(local_skb);
consume_skb(skb);
@@ -323,8 +323,8 @@ static int recv_pkt(struct sk_buff *skb, struct net_device *dev,
goto drop;
}
- dev->stats.rx_bytes += skb->len;
- dev->stats.rx_packets++;
+ DEV_STATS_ADD(dev, rx_bytes, skb->len);
+ DEV_STATS_INC(dev, rx_packets);
consume_skb(local_skb);
consume_skb(skb);
@@ -336,7 +336,8 @@ static int recv_pkt(struct sk_buff *skb, struct net_device *dev,
return NET_RX_SUCCESS;
drop:
- dev->stats.rx_dropped++;
+
+ DEV_STATS_INC(dev, rx_dropped);
return NET_RX_DROP;
}
@@ -445,13 +446,13 @@ static int send_pkt(struct l2cap_chan *chan, struct sk_buff *skb,
err = l2cap_chan_send(chan, &msg, skb->len);
if (err > 0) {
- netdev->stats.tx_bytes += err;
- netdev->stats.tx_packets++;
+ DEV_STATS_ADD(netdev, tx_bytes, err);
+ DEV_STATS_INC(netdev, tx_packets);
return 0;
}
if (err < 0)
- netdev->stats.tx_errors++;
+ DEV_STATS_INC(netdev, tx_errors);
return err;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] Bluetooth: 6lowpan: use DEV_STAT_INC() to avoid races
2024-05-27 6:52 [PATCH v2] Bluetooth: 6lowpan: use DEV_STAT_INC() to avoid races yunshui
@ 2024-05-27 7:03 ` Paul Menzel
2024-05-27 7:34 ` [v2] " bluez.test.bot
1 sibling, 0 replies; 3+ messages in thread
From: Paul Menzel @ 2024-05-27 7:03 UTC (permalink / raw)
To: jiangyunshui
Cc: linux-kernel, linux-bluetooth, marcel, johan.hedberg, luiz.dentz
Dear yunshui,
Thank you for your patch. One formal request:
Am 27.05.24 um 08:52 schrieb yunshui:
> syzbot/KCSAN reported that races happen when multiple cpus
> updating dev->stats.tx_error concurrently.
>
> Adopt SMP safe DEV_STATS_INC() to update dev->stats fields.
>
> Signed-off-by: yunshui <jiangyunshui@kylinos.cn>
Could you please use your full name? Maybe:
$ git config --global user.name "Jiang Yunshui"
$ git commit --amend --author="Jiang Yunshui <jiangyunshui@kylinos.cn>"
[…]
Kind regards,
Paul
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [v2] Bluetooth: 6lowpan: use DEV_STAT_INC() to avoid races
2024-05-27 6:52 [PATCH v2] Bluetooth: 6lowpan: use DEV_STAT_INC() to avoid races yunshui
2024-05-27 7:03 ` Paul Menzel
@ 2024-05-27 7:34 ` bluez.test.bot
1 sibling, 0 replies; 3+ messages in thread
From: bluez.test.bot @ 2024-05-27 7:34 UTC (permalink / raw)
To: linux-bluetooth, jiangyunshui
[-- Attachment #1: Type: text/plain, Size: 2578 bytes --]
This is automated email and please do not reply to this email!
Dear submitter,
Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=856029
---Test result---
Test Summary:
CheckPatch PASS 1.48 seconds
GitLint PASS 0.28 seconds
SubjectPrefix PASS 0.09 seconds
BuildKernel PASS 30.17 seconds
CheckAllWarning PASS 33.30 seconds
CheckSparse PASS 38.45 seconds
CheckSmatch FAIL 38.05 seconds
BuildKernel32 PASS 28.90 seconds
TestRunnerSetup PASS 523.54 seconds
TestRunner_l2cap-tester PASS 20.42 seconds
TestRunner_iso-tester FAIL 32.55 seconds
TestRunner_bnep-tester PASS 4.88 seconds
TestRunner_mgmt-tester PASS 114.01 seconds
TestRunner_rfcomm-tester PASS 8.52 seconds
TestRunner_sco-tester PASS 15.01 seconds
TestRunner_ioctl-tester PASS 7.88 seconds
TestRunner_mesh-tester PASS 6.11 seconds
TestRunner_smp-tester PASS 6.94 seconds
TestRunner_userchan-tester PASS 5.07 seconds
IncrementalBuild PASS 27.55 seconds
Details
##############################
Test: CheckSmatch - FAIL
Desc: Run smatch tool with source
Output:
Segmentation fault (core dumped)
make[4]: *** [scripts/Makefile.build:244: net/bluetooth/hci_core.o] Error 139
make[4]: *** Deleting file 'net/bluetooth/hci_core.o'
make[3]: *** [scripts/Makefile.build:485: net/bluetooth] Error 2
make[2]: *** [scripts/Makefile.build:485: net] Error 2
make[2]: *** Waiting for unfinished jobs....
Segmentation fault (core dumped)
make[4]: *** [scripts/Makefile.build:244: drivers/bluetooth/bcm203x.o] Error 139
make[4]: *** Deleting file 'drivers/bluetooth/bcm203x.o'
make[4]: *** Waiting for unfinished jobs....
make[3]: *** [scripts/Makefile.build:485: drivers/bluetooth] Error 2
make[2]: *** [scripts/Makefile.build:485: drivers] Error 2
make[1]: *** [/github/workspace/src/src/Makefile:1919: .] Error 2
make: *** [Makefile:240: __sub-make] Error 2
##############################
Test: TestRunner_iso-tester - FAIL
Desc: Run iso-tester with test-runner
Output:
Total: 122, Passed: 117 (95.9%), Failed: 1, Not Run: 4
Failed Test Cases
ISO Connect Suspend - Success Failed 4.178 seconds
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-05-27 7:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-27 6:52 [PATCH v2] Bluetooth: 6lowpan: use DEV_STAT_INC() to avoid races yunshui
2024-05-27 7:03 ` Paul Menzel
2024-05-27 7:34 ` [v2] " bluez.test.bot
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).