[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAAeHK+zQzyjN6c8swzzmtA726hP1Or6s=Cw-tB1y3N3zKJCqqA@mail.gmail.com>
Date: Mon, 12 Oct 2020 14:52:37 +0200
From: Andrey Konovalov <andreyknvl@...gle.com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: NazimeHandeHarputluogluhandeharput@...il.com,
Valentina Manea <valentina.manea.m@...il.com>,
Shuah Khan <shuah@...nel.org>,
LKML <linux-kernel@...r.kernel.org>,
USB list <linux-usb@...r.kernel.org>,
Dmitry Vyukov <dvyukov@...gle.com>,
Hande Harputluoglu <handeharput@...il.com>,
Nazime Hande Harputluoglu <handeharputlu@...gle.com>
Subject: Re: [PATCH] usbip, kcov: collect coverage from usbip client
On Sat, Oct 10, 2020 at 8:55 AM Greg Kroah-Hartman
<gregkh@...uxfoundation.org> wrote:
>
> On Fri, Oct 09, 2020 at 03:22:55PM +0000, NazimeHandeHarputluogluhandeharput@...il.com wrote:
> > From: Nazime Hande Harputluoglu <handeharputlu@...gle.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@...gle.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!
Powered by blists - more mailing lists