* Re: [PATCH] usbip, kcov: collect coverage from usbip client [not found] <dfb5eee2b1bdff14508100ee7c427596de384cd3.1602237653.git.handeharputlu@google.com> @ 2020-10-10 6:55 ` Greg Kroah-Hartman 2020-10-12 12:52 ` Andrey Konovalov 0 siblings, 1 reply; 2+ messages in thread From: Greg Kroah-Hartman @ 2020-10-10 6:55 UTC (permalink / raw) To: NazimeHandeHarputluogluhandeharput Cc: Valentina Manea, Shuah Khan, linux-kernel, linux-usb, Dmitry Vyukov, Andrey Konovalov, Hande Harputluoglu, Nazime Hande Harputluoglu 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 ^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] usbip, kcov: collect coverage from usbip client 2020-10-10 6:55 ` [PATCH] usbip, kcov: collect coverage from usbip client Greg Kroah-Hartman @ 2020-10-12 12:52 ` Andrey Konovalov 0 siblings, 0 replies; 2+ messages in thread From: Andrey Konovalov @ 2020-10-12 12:52 UTC (permalink / raw) To: Greg Kroah-Hartman Cc: NazimeHandeHarputluogluhandeharput, Valentina Manea, Shuah Khan, LKML, USB list, Dmitry Vyukov, Hande Harputluoglu, Nazime Hande Harputluoglu On Sat, Oct 10, 2020 at 8:55 AM Greg Kroah-Hartman <gregkh@linuxfoundation.org> wrote: > > 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... Hi Greg, Sorry, I'll fix it up and send v2. Thanks! ^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, back to index Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <dfb5eee2b1bdff14508100ee7c427596de384cd3.1602237653.git.handeharputlu@google.com> 2020-10-10 6:55 ` [PATCH] usbip, kcov: collect coverage from usbip client Greg Kroah-Hartman 2020-10-12 12:52 ` Andrey Konovalov
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