netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: Collect kcov coverage from hci_rx_work
@ 2022-05-17  9:45 Tamas Koczka
  2022-05-31  9:07 ` Tamás Koczka
  2022-06-02 15:29 ` Marcel Holtmann
  0 siblings, 2 replies; 3+ messages in thread
From: Tamas Koczka @ 2022-05-17  9:45 UTC (permalink / raw)
  To: Marcel Holtmann
  Cc: theflow, Tamas Koczka, Johan Hedberg, Luiz Augusto von Dentz,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	linux-bluetooth, netdev, linux-kernel

Annotate hci_rx_work() with kcov_remote_start() and kcov_remote_stop()
calls, so remote KCOV coverage is collected while processing the rx_q
queue which is the main incoming Bluetooth packet queue.

Coverage is associated with the thread which created the packet skb.

Signed-off-by: Tamas Koczka <poprdi@google.com>
---
 net/bluetooth/hci_core.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 45c2dd2e1590..703722031b8d 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -29,6 +29,7 @@
 #include <linux/rfkill.h>
 #include <linux/debugfs.h>
 #include <linux/crypto.h>
+#include <linux/kcov.h>
 #include <linux/property.h>
 #include <linux/suspend.h>
 #include <linux/wait.h>
@@ -3780,7 +3781,9 @@ static void hci_rx_work(struct work_struct *work)
 
 	BT_DBG("%s", hdev->name);
 
-	while ((skb = skb_dequeue(&hdev->rx_q))) {
+	for (; (skb = skb_dequeue(&hdev->rx_q)); kcov_remote_stop()) {
+		kcov_remote_start_common(skb_get_kcov_handle(skb));
+
 		/* Send copy to monitor */
 		hci_send_to_monitor(hdev, skb);
 
-- 
2.36.0.550.gb090851708-goog


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

* Re: [PATCH] Bluetooth: Collect kcov coverage from hci_rx_work
  2022-05-17  9:45 [PATCH] Bluetooth: Collect kcov coverage from hci_rx_work Tamas Koczka
@ 2022-05-31  9:07 ` Tamás Koczka
  2022-06-02 15:29 ` Marcel Holtmann
  1 sibling, 0 replies; 3+ messages in thread
From: Tamás Koczka @ 2022-05-31  9:07 UTC (permalink / raw)
  To: Marcel Holtmann
  Cc: Andy Nguyen, Johan Hedberg, Luiz Augusto von Dentz,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	linux-bluetooth, netdev, linux-kernel, Aleksandr Nogikh,
	Dmitry Vyukov

Hello Everyone,

Thank you for reviewing the patch - I hope everything is going well.

Please feel free to ask me if you need any more information regarding it!

Thank you,
Tamas

On Tue, May 17, 2022 at 11:45 AM Tamas Koczka <poprdi@google.com> wrote:
>
> Annotate hci_rx_work() with kcov_remote_start() and kcov_remote_stop()
> calls, so remote KCOV coverage is collected while processing the rx_q
> queue which is the main incoming Bluetooth packet queue.
>
> Coverage is associated with the thread which created the packet skb.
>
> Signed-off-by: Tamas Koczka <poprdi@google.com>
> ---
>  net/bluetooth/hci_core.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
> index 45c2dd2e1590..703722031b8d 100644
> --- a/net/bluetooth/hci_core.c
> +++ b/net/bluetooth/hci_core.c
> @@ -29,6 +29,7 @@
>  #include <linux/rfkill.h>
>  #include <linux/debugfs.h>
>  #include <linux/crypto.h>
> +#include <linux/kcov.h>
>  #include <linux/property.h>
>  #include <linux/suspend.h>
>  #include <linux/wait.h>
> @@ -3780,7 +3781,9 @@ static void hci_rx_work(struct work_struct *work)
>
>         BT_DBG("%s", hdev->name);
>
> -       while ((skb = skb_dequeue(&hdev->rx_q))) {
> +       for (; (skb = skb_dequeue(&hdev->rx_q)); kcov_remote_stop()) {
> +               kcov_remote_start_common(skb_get_kcov_handle(skb));
> +
>                 /* Send copy to monitor */
>                 hci_send_to_monitor(hdev, skb);
>
> --
> 2.36.0.550.gb090851708-goog
>

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

* Re: [PATCH] Bluetooth: Collect kcov coverage from hci_rx_work
  2022-05-17  9:45 [PATCH] Bluetooth: Collect kcov coverage from hci_rx_work Tamas Koczka
  2022-05-31  9:07 ` Tamás Koczka
@ 2022-06-02 15:29 ` Marcel Holtmann
  1 sibling, 0 replies; 3+ messages in thread
From: Marcel Holtmann @ 2022-06-02 15:29 UTC (permalink / raw)
  To: Tamas Koczka
  Cc: theflow, Johan Hedberg, Luiz Augusto von Dentz, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, linux-bluetooth,
	netdev, linux-kernel

Hi Tamas,

> Annotate hci_rx_work() with kcov_remote_start() and kcov_remote_stop()
> calls, so remote KCOV coverage is collected while processing the rx_q
> queue which is the main incoming Bluetooth packet queue.
> 
> Coverage is associated with the thread which created the packet skb.
> 
> Signed-off-by: Tamas Koczka <poprdi@google.com>
> ---
> net/bluetooth/hci_core.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
> index 45c2dd2e1590..703722031b8d 100644
> --- a/net/bluetooth/hci_core.c
> +++ b/net/bluetooth/hci_core.c
> @@ -29,6 +29,7 @@
> #include <linux/rfkill.h>
> #include <linux/debugfs.h>
> #include <linux/crypto.h>
> +#include <linux/kcov.h>
> #include <linux/property.h>
> #include <linux/suspend.h>
> #include <linux/wait.h>
> @@ -3780,7 +3781,9 @@ static void hci_rx_work(struct work_struct *work)
> 
> 	BT_DBG("%s", hdev->name);
> 
> -	while ((skb = skb_dequeue(&hdev->rx_q))) {
> +	for (; (skb = skb_dequeue(&hdev->rx_q)); kcov_remote_stop()) {
> +		kcov_remote_start_common(skb_get_kcov_handle(skb));
> +
> 		/* Send copy to monitor */
> 		hci_send_to_monitor(hdev, skb);

patch looks good, but do you mind adding a comment above on why this is done. I asked, because next time around I look at this code I have forgotten all about it. Thanks.

Regards

Marcel


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

end of thread, other threads:[~2022-06-02 15:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-17  9:45 [PATCH] Bluetooth: Collect kcov coverage from hci_rx_work Tamas Koczka
2022-05-31  9:07 ` Tamás Koczka
2022-06-02 15:29 ` Marcel Holtmann

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