All of lore.kernel.org
 help / color / mirror / Atom feed
From: Robert Foley <robert.foley@linaro.org>
To: "Alex Bennée" <alex.bennee@linaro.org>
Cc: Peter Puhov <peter.puhov@linaro.org>,
	"Emilio G. Cota" <cota@braap.org>,
	QEMU Developers <qemu-devel@nongnu.org>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Richard Henderson <rth@twiddle.net>
Subject: Re: [PATCH v2 06/13] tcg: call qemu_spin_destroy for tb->jmp_lock
Date: Mon, 8 Jun 2020 17:10:15 -0400	[thread overview]
Message-ID: <CAEyhzFtWjAC7ecO8jhEzutGtx6S-DV0trZez4phfHc+x=ToOjg@mail.gmail.com> (raw)
In-Reply-To: <87zh9d62ib.fsf@linaro.org>

On Mon, 8 Jun 2020 at 10:44, Alex Bennée <alex.bennee@linaro.org> wrote:
<snip>
> > +static void tcg_region_tree_reset_all(tb_destroy_func tb_destroy)
> >  {
> >      size_t i;
> >
> > @@ -510,6 +519,10 @@ static void tcg_region_tree_reset_all(void)
> >      for (i = 0; i < region.n; i++) {
> >          struct tcg_region_tree *rt = region_trees + i * tree_size;
> >
> > +        if (tb_destroy != NULL) {
> > +            g_tree_foreach(rt->tree, tcg_region_tree_traverse, tb_destroy);
> > +        }
> > +
>
> Isn't tb_destroy always set? We could assert that is the case rather
> than make the cleaning up conditional.

I agree, tb_destroy seems to always be set, so the assert would be reasonable.

>
> >          /* Increment the refcount first so that destroy acts as a reset */
> >          g_tree_ref(rt->tree);
> >          g_tree_destroy(rt->tree);
> > @@ -586,7 +599,7 @@ static inline bool tcg_region_initial_alloc__locked(TCGContext *s)
> >  }
> >
> >  /* Call from a safe-work context */
> > -void tcg_region_reset_all(void)
> > +void tcg_region_reset_all(tb_destroy_func tb_destroy)
> >  {
> >      unsigned int n_ctxs = atomic_read(&n_tcg_ctxs);
> >      unsigned int i;
> > @@ -603,7 +616,7 @@ void tcg_region_reset_all(void)
> >      }
> >      qemu_mutex_unlock(&region.lock);
> >
> > -    tcg_region_tree_reset_all();
> > +    tcg_region_tree_reset_all(tb_destroy);
>
> Could you name the variables of type tb_destroy_func differently as
> although the variable is only ever tb_destroy the function it gets
> confusing real quick when trying to grep for stuff. Maybe tbd_fn?
>
> That said given the single usage why a function pointer? Would we be
> just as well served by an exposed public function call from the
> appropriate places?

Good point.  Unless we see an imminent need to pass different values,
then it seems
reasonable to just use the public function call and remove the need for
the function pointer.

Thanks & Regards,
-Rob


>
> Richard do you have a view here?
>
> --
> Alex Bennée


  reply	other threads:[~2020-06-08 21:11 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-05 17:34 [PATCH v2 00/13] Add Thread Sanitizer support to QEMU Robert Foley
2020-06-05 17:34 ` [PATCH v2 01/13] configure: add --enable-tsan flag + fiber annotations for coroutine-ucontext Robert Foley
2020-06-08 13:39   ` Alex Bennée
2020-06-08 20:09     ` Robert Foley
2020-06-05 17:34 ` [PATCH v2 02/13] cpu: convert queued work to a QSIMPLEQ Robert Foley
2020-06-05 17:34 ` [PATCH v2 03/13] thread: add qemu_spin_destroy Robert Foley
2020-06-05 17:34 ` [PATCH v2 04/13] cputlb: destroy CPUTLB with tlb_destroy Robert Foley
2020-06-05 17:34 ` [PATCH v2 05/13] qht: call qemu_spin_destroy for head buckets Robert Foley
2020-06-05 17:34 ` [PATCH v2 06/13] tcg: call qemu_spin_destroy for tb->jmp_lock Robert Foley
2020-06-08 14:44   ` Alex Bennée
2020-06-08 21:10     ` Robert Foley [this message]
2020-06-05 17:34 ` [PATCH v2 07/13] translate-all: call qemu_spin_destroy for PageDesc Robert Foley
2020-06-08 15:04   ` Alex Bennée
2020-06-05 17:34 ` [PATCH v2 08/13] thread: add tsan annotations to QemuSpin Robert Foley
2020-06-05 17:34 ` [PATCH v2 09/13] tests/docker: Added docker build support for TSan Robert Foley
2020-06-08 13:56   ` Alex Bennée
2020-06-05 17:34 ` [PATCH v2 10/13] include/qemu: Added tsan.h for annotations Robert Foley
2020-06-08 15:10   ` Alex Bennée
2020-06-05 17:34 ` [PATCH v2 11/13] util: Added tsan annotate for thread name Robert Foley
2020-06-05 17:34 ` [PATCH v2 12/13] docs: Added details on TSan to testing.rst Robert Foley
2020-06-08 15:13   ` Alex Bennée
2020-06-05 17:34 ` [PATCH v2 13/13] tests: Disable select tests under TSan, which hit TSan issue Robert Foley
2020-06-08  3:51   ` Emilio G. Cota
2020-06-08 15:41   ` Alex Bennée
2020-06-05 21:44 ` [PATCH v2 00/13] Add Thread Sanitizer support to QEMU no-reply
2020-06-08 15:42 ` Alex Bennée

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='CAEyhzFtWjAC7ecO8jhEzutGtx6S-DV0trZez4phfHc+x=ToOjg@mail.gmail.com' \
    --to=robert.foley@linaro.org \
    --cc=alex.bennee@linaro.org \
    --cc=cota@braap.org \
    --cc=pbonzini@redhat.com \
    --cc=peter.puhov@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.