Linux-USB Archive on lore.kernel.org
 help / color / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: NazimeHandeHarputluogluhandeharput@gmail.com
Cc: Valentina Manea <valentina.manea.m@gmail.com>,
	Shuah Khan <shuah@kernel.org>,
	linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org,
	Dmitry Vyukov <dvyukov@google.com>,
	Andrey Konovalov <andreyknvl@google.com>,
	Hande Harputluoglu <handeharput@gmail.com>,
	Nazime Hande Harputluoglu <handeharputlu@google.com>
Subject: Re: [PATCH] usbip, kcov: collect coverage from usbip client
Date: Sat, 10 Oct 2020 08:55:27 +0200
Message-ID: <20201010065527.GA130900@kroah.com> (raw)
In-Reply-To: <dfb5eee2b1bdff14508100ee7c427596de384cd3.1602237653.git.handeharputlu@google.com>

On Fri, Oct 09, 2020 at 03:22:55PM +0000, NazimeHandeHarputluogluhandeharput@gmail.com wrote:
> From: Nazime Hande Harputluoglu <handeharputlu@google.com>
> 
> Add kcov_remote_start()/kcov_remote_stop() annotations to the
> vhci_rx_loop() function, which is responsible for parsing USB/IP packets
> in USB/IP client.
> 
> Since vhci_rx_loop() threads are spawned per usbip device instance, the
> common kcov handle is used for kcov_remote_start()/stop() annotations
> (see Documentation/dev-tools/kcov.rst for details). As the result kcov
> can now be used to collect coverage from vhci_rx_loop() threads.
> 
> Signed-off-by: Nazime Hande Harputluoglu <handeharputlu@google.com>
> ---
>  drivers/usb/usbip/usbip_common.h | 2 ++
>  drivers/usb/usbip/vhci_rx.c      | 6 ++++--
>  drivers/usb/usbip/vhci_sysfs.c   | 2 ++
>  3 files changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/usbip/usbip_common.h b/drivers/usb/usbip/usbip_common.h
> index 8be857a4fa13..cbbf2aa8ac73 100644
> --- a/drivers/usb/usbip/usbip_common.h
> +++ b/drivers/usb/usbip/usbip_common.h
> @@ -277,6 +277,8 @@ struct usbip_device {
>  		void (*reset)(struct usbip_device *);
>  		void (*unusable)(struct usbip_device *);
>  	} eh_ops;
> +
> +        u64 kcov_handle;
>  };
>  
>  #define kthread_get_run(threadfn, data, namefmt, ...)			   \
> diff --git a/drivers/usb/usbip/vhci_rx.c b/drivers/usb/usbip/vhci_rx.c
> index 266024cbb64f..b2eb3e8c04b9 100644
> --- a/drivers/usb/usbip/vhci_rx.c
> +++ b/drivers/usb/usbip/vhci_rx.c
> @@ -260,8 +260,10 @@ int vhci_rx_loop(void *data)
>  	while (!kthread_should_stop()) {
>  		if (usbip_event_happened(ud))
>  			break;
> -
> -		vhci_rx_pdu(ud);
> +                
> +                kcov_remote_start_common(ud->kcov_handle);
> +                vhci_rx_pdu(ud);
> +                kcov_remote_stop();
>  	}
>  
>  	return 0;
> diff --git a/drivers/usb/usbip/vhci_sysfs.c b/drivers/usb/usbip/vhci_sysfs.c
> index be37aec250c2..4dfe3809ebbb 100644
> --- a/drivers/usb/usbip/vhci_sysfs.c
> +++ b/drivers/usb/usbip/vhci_sysfs.c
> @@ -9,6 +9,7 @@
>  #include <linux/net.h>
>  #include <linux/platform_device.h>
>  #include <linux/slab.h>
> +#include <linux/kcov.h>
>  
>  /* Hardening for Spectre-v1 */
>  #include <linux/nospec.h>
> @@ -383,6 +384,7 @@ static ssize_t attach_store(struct device *dev, struct device_attribute *attr,
>  	vdev->ud.sockfd     = sockfd;
>  	vdev->ud.tcp_socket = socket;
>  	vdev->ud.status     = VDEV_ST_NOTASSIGNED;
> +        vdev->ud.kcov_handle = kcov_common_handle();
>  
>  	spin_unlock(&vdev->ud.lock);
>  	spin_unlock_irqrestore(&vhci->lock, flags);
> -- 
> 2.28.0.1011.ga647a8990f-goog
> 

Please run checkpatch.pl on your patches before sending them out, so you
don't get grumpy maintainers telling you to run checkpatch.pl on your
patch...

thanks,

greg k-h

       reply index

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <dfb5eee2b1bdff14508100ee7c427596de384cd3.1602237653.git.handeharputlu@google.com>
2020-10-10  6:55 ` Greg Kroah-Hartman [this message]
2020-10-12 12:52   ` Andrey Konovalov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201010065527.GA130900@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=NazimeHandeHarputluogluhandeharput@gmail.com \
    --cc=andreyknvl@google.com \
    --cc=dvyukov@google.com \
    --cc=handeharput@gmail.com \
    --cc=handeharputlu@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=shuah@kernel.org \
    --cc=valentina.manea.m@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-USB Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-usb/0 linux-usb/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-usb linux-usb/ https://lore.kernel.org/linux-usb \
		linux-usb@vger.kernel.org
	public-inbox-index linux-usb

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-usb


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git