From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Andrey Konovalov <andreyknvl@google.com>
Cc: linux-usb@vger.kernel.org, kvm@vger.kernel.org,
virtualization@lists.linux-foundation.org,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Dmitry Vyukov <dvyukov@google.com>,
Alan Stern <stern@rowland.harvard.edu>,
"Michael S . Tsirkin" <mst@redhat.com>,
Jason Wang <jasowang@redhat.com>,
Andrew Morton <akpm@linux-foundation.org>,
Arnd Bergmann <arnd@arndb.de>,
Steven Rostedt <rostedt@goodmis.org>,
David Windsor <dwindsor@gmail.com>,
Elena Reshetova <elena.reshetova@intel.com>,
Anders Roxell <anders.roxell@linaro.org>
Subject: Re: [PATCH RFC 3/3] vhost, kcov: collect coverage from vhost_worker
Date: Thu, 17 Oct 2019 11:18:00 -0700 [thread overview]
Message-ID: <20191017181800.GB1094415@kroah.com> (raw)
In-Reply-To: <af26317c0efd412dd660e81d548a173942f8a0ad.1571333592.git.andreyknvl@google.com>
On Thu, Oct 17, 2019 at 07:44:15PM +0200, Andrey Konovalov wrote:
> This patch adds kcov_remote_start/kcov_remote_stop annotations to the
> vhost_worker function, which is responsible for processing vhost works.
> Since vhost_worker is spawned when a vhost device instance is created,
> the common kcov handle is used for kcov_remote_start/stop annotations.
>
> Signed-off-by: Andrey Konovalov <andreyknvl@google.com>
> ---
> drivers/vhost/vhost.c | 15 +++++++++++++++
> drivers/vhost/vhost.h | 3 +++
> 2 files changed, 18 insertions(+)
>
> diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
> index 36ca2cf419bf..71a349f6b352 100644
> --- a/drivers/vhost/vhost.c
> +++ b/drivers/vhost/vhost.c
> @@ -357,7 +357,13 @@ static int vhost_worker(void *data)
> llist_for_each_entry_safe(work, work_next, node, node) {
> clear_bit(VHOST_WORK_QUEUED, &work->flags);
> __set_current_state(TASK_RUNNING);
> +#ifdef CONFIG_KCOV
> + kcov_remote_start(dev->kcov_handle);
> +#endif
Shouldn't you hide these #ifdefs in a .h file? This is not a "normal"
kernel coding style at all.
> work->fn(work);
> +#ifdef CONFIG_KCOV
> + kcov_remote_stop();
> +#endif
> if (need_resched())
> schedule();
> }
> @@ -546,6 +552,9 @@ long vhost_dev_set_owner(struct vhost_dev *dev)
>
> /* No owner, become one */
> dev->mm = get_task_mm(current);
> +#ifdef CONFIG_KCOV
> + dev->kcov_handle = current->kcov_handle;
> +#endif
> worker = kthread_create(vhost_worker, dev, "vhost-%d", current->pid);
> if (IS_ERR(worker)) {
> err = PTR_ERR(worker);
> @@ -571,6 +580,9 @@ long vhost_dev_set_owner(struct vhost_dev *dev)
> if (dev->mm)
> mmput(dev->mm);
> dev->mm = NULL;
> +#ifdef CONFIG_KCOV
> + dev->kcov_handle = 0;
> +#endif
> err_mm:
> return err;
> }
> @@ -682,6 +694,9 @@ void vhost_dev_cleanup(struct vhost_dev *dev)
> if (dev->worker) {
> kthread_stop(dev->worker);
> dev->worker = NULL;
> +#ifdef CONFIG_KCOV
> + dev->kcov_handle = 0;
> +#endif
> }
> if (dev->mm)
> mmput(dev->mm);
> diff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h
> index e9ed2722b633..010ca1ebcbd5 100644
> --- a/drivers/vhost/vhost.h
> +++ b/drivers/vhost/vhost.h
> @@ -173,6 +173,9 @@ struct vhost_dev {
> int iov_limit;
> int weight;
> int byte_weight;
> +#ifdef CONFIG_KCOV
> + u64 kcov_handle;
> +#endif
Why is this a #ifdef at all here?
thanks,
greg k-h
next prev parent reply other threads:[~2019-10-17 18:18 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-17 17:44 [PATCH RFC 0/3] kcov: collect coverage from usb and vhost Andrey Konovalov
2019-10-17 17:44 ` [PATCH RFC 1/3] kcov: remote coverage support Andrey Konovalov
2019-10-21 13:53 ` Dmitry Vyukov
2019-10-22 16:44 ` Andrey Konovalov
2019-10-17 17:44 ` [PATCH RFC 2/3] usb, kcov: collect coverage from hub_event Andrey Konovalov
2019-10-17 18:19 ` Greg Kroah-Hartman
2019-10-17 19:06 ` Andrey Konovalov
2019-10-17 20:29 ` Greg Kroah-Hartman
2019-10-17 17:44 ` [PATCH RFC 3/3] vhost, kcov: collect coverage from vhost_worker Andrey Konovalov
2019-10-17 18:18 ` Greg Kroah-Hartman [this message]
2019-10-17 19:00 ` Andrey Konovalov
2019-10-17 20:28 ` Greg Kroah-Hartman
2019-10-17 20:29 ` 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=20191017181800.GB1094415@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=akpm@linux-foundation.org \
--cc=anders.roxell@linaro.org \
--cc=andreyknvl@google.com \
--cc=arnd@arndb.de \
--cc=dvyukov@google.com \
--cc=dwindsor@gmail.com \
--cc=elena.reshetova@intel.com \
--cc=jasowang@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mst@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=stern@rowland.harvard.edu \
--cc=virtualization@lists.linux-foundation.org \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).