From: Andrey Konovalov <andreyknvl@google.com>
To: Dmitry Vyukov <dvyukov@google.com>
Cc: USB list <linux-usb@vger.kernel.org>,
KVM list <kvm@vger.kernel.org>,
virtualization@lists.linux-foundation.org,
netdev <netdev@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
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>,
Alexander Potapenko <glider@google.com>,
Marco Elver <elver@google.com>
Subject: Re: [PATCH v2 1/3] kcov: remote coverage support
Date: Thu, 24 Oct 2019 16:07:05 +0200 [thread overview]
Message-ID: <CAAeHK+xnRSZp5fxikyDzMB18bsDMmCvmrZexrjr_JV3Wgw80Ww@mail.gmail.com> (raw)
In-Reply-To: <CACT4Y+a6t08RmtSYfF=3TuASx9ReCEe0Qp0AP=GbCtNyL2j+TA@mail.gmail.com>
On Thu, Oct 24, 2019 at 9:27 AM Dmitry Vyukov <dvyukov@google.com> wrote:
>
> On Wed, Oct 23, 2019 at 5:24 PM Andrey Konovalov <andreyknvl@google.com> wrote:
> >
> > This patch adds background thread coverage collection ability to kcov.
> ...
> > +static struct kcov_remote *kcov_remote_add(struct kcov *kcov, u64 handle)
> > +{
> > + struct kcov_remote *remote;
> > +
> > + if (kcov_remote_find(handle))
> > + return ERR_PTR(-EEXIST);
> > + remote = kmalloc(sizeof(*remote), GFP_ATOMIC);
> > + if (!remote)
> > + return ERR_PTR(-ENOMEM);
> > + remote->handle = handle;
> > + remote->kcov = kcov;
> > + hash_add(kcov_remote_map, &remote->hnode, handle);
>
> I think it will make sense to check that there is no existing kcov
> with the same handle registered. Such condition will be extremely hard
> to debug based on episodically missing coverage.
Will do in v3.
>
> ...
> > void kcov_task_exit(struct task_struct *t)
> > {
> > struct kcov *kcov;
> > @@ -256,15 +401,23 @@ void kcov_task_exit(struct task_struct *t)
> > kcov = t->kcov;
> > if (kcov == NULL)
> > return;
> > +
> > spin_lock(&kcov->lock);
> > + kcov_debug("t = %px, kcov->t = %px\n", t, kcov->t);
> > + /*
> > + * If !kcov->remote, this checks that t->kcov->t == t.
> > + * If kcov->remote == true then the exiting task is either:
> > + * 1. a remote task between kcov_remote_start() and kcov_remote_stop(),
> > + * in this case t != kcov->t and we'll print a warning; or
>
> Why? Is kcov->t == NULL for remote kcov's? May be worth mentioning in
> the comment b/c it's a very condensed form to check lots of different
> things at once.
For remote kcov instances kcov->t points to the thread that created
the kcov device (I'll update the comment in struct kcov). When a task
is between kcov_remote_start() and kcov_remote_stop(), it's t->kcov
point to the remote kcov. So t is current for this task, and
t->kcov->t is the task that created the kcov instance. I'll expand the
comment to explain this better.
> Otherwise the series look good to me:
>
> Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
Great, thanks!
>
> But Andrew's comments stand. It's possible I understand all of this
> only because I already know how it works and why it works this way.
next prev parent reply other threads:[~2019-10-24 14:07 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-23 15:24 [PATCH v2 0/3] kcov: collect coverage from usb and vhost Andrey Konovalov
2019-10-23 15:24 ` [PATCH v2 1/3] kcov: remote coverage support Andrey Konovalov
2019-10-23 22:22 ` Andrew Morton
2019-10-24 13:48 ` Andrey Konovalov
2019-10-28 17:23 ` Andrey Konovalov
2019-10-24 7:26 ` Dmitry Vyukov
2019-10-24 14:07 ` Andrey Konovalov [this message]
2019-10-28 14:52 ` Andrey Konovalov
2019-10-23 15:24 ` [PATCH v2 2/3] usb, kcov: collect coverage from hub_event Andrey Konovalov
2019-10-23 15:24 ` [PATCH v2 3/3] vhost, kcov: collect coverage from vhost_worker Andrey Konovalov
2019-10-25 20:26 ` kbuild test robot
2019-10-23 22:04 ` [PATCH v2 0/3] kcov: collect coverage from usb and vhost Andrew Morton
2019-10-24 12:47 ` Andrey Konovalov
2019-10-24 23:59 ` Andrew Morton
2019-10-25 14:55 ` 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=CAAeHK+xnRSZp5fxikyDzMB18bsDMmCvmrZexrjr_JV3Wgw80Ww@mail.gmail.com \
--to=andreyknvl@google.com \
--cc=akpm@linux-foundation.org \
--cc=anders.roxell@linaro.org \
--cc=arnd@arndb.de \
--cc=dvyukov@google.com \
--cc=dwindsor@gmail.com \
--cc=elena.reshetova@intel.com \
--cc=elver@google.com \
--cc=glider@google.com \
--cc=gregkh@linuxfoundation.org \
--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).