qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Emilio Cota <cota@braap.org>
To: "Alex Bennée" <alex.bennee@linaro.org>
Cc: qemu-devel@nongnu.org, "Paolo Bonzini" <pbonzini@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"Richard Henderson" <richard.henderson@linaro.org>
Subject: Re: [PATCH v2 4/5] util/qht: use striped locks under TSAN
Date: Tue, 10 Jan 2023 21:41:29 -0500	[thread overview]
Message-ID: <Y74h2RC+8J63Nzqj@cota-l14> (raw)
In-Reply-To: <87cz7mm7fu.fsf@linaro.org>

On Tue, Jan 10, 2023 at 20:58:01 +0000, Alex Bennée wrote:
> Emilio Cota <cota@braap.org> writes:
(snip)
> > +static inline void qht_do_if_first_in_stripe(const struct qht_map *map,
> > +                                             struct qht_bucket *b,
> > +                                             void (*func)(QemuSpin *spin))
> > +{
> > +#ifdef CONFIG_TSAN
> > +    unsigned long bucket_idx = b - map->buckets;
> > +    bool is_first_in_stripe = (bucket_idx >> QHT_TSAN_BUCKET_LOCKS_BITS) == 0;
> > +    if (is_first_in_stripe) {
> > +        unsigned long lock_idx = bucket_idx & (QHT_TSAN_BUCKET_LOCKS - 1);
> > +        func(&map->tsan_bucket_locks[lock_idx]);
> 
> Hmm I ran into an issue with:
> 
>      ../util/qht.c:286:10: error: incompatible pointer types passing 'const struct qht_tsan_lock *' to parameter of type 'QemuSpin *' (aka 'struct QemuSpin *') [-Werror,-Wincompatible-pointer-types]

Gaah, sorry. I didn't notice this because of unrelated noise due
to having to configure with --disable-werror. Fixed now by removing
a bunch of const's and also using .lock.

> > +static inline void qht_bucket_lock_destroy(const struct qht_map *map,
> > +                                           struct qht_bucket *b)
> > +{
> > +    qht_do_if_first_in_stripe(map, b, qemu_spin_destroy);
> > +}
> 
> Who is meant to be calling this?

Should have been removed in v2; fixed now.

I've uploaded the v3 series to https://github.com/cota/qemu/tree/tsan-v3

Please let me know if you want me to also mail it to the list.
Thanks,

		Emilio


  reply	other threads:[~2023-01-11  2:43 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-09 22:49 [PATCH v2 0/5] tsan fixes Emilio Cota
2023-01-09 22:49 ` [PATCH v2 1/5] cpu: free cpu->tb_jmp_cache with RCU Emilio Cota
2023-01-09 22:49 ` [PATCH v2 2/5] util/qht: add missing atomic_set(hashes[i]) Emilio Cota
2023-01-10  9:08   ` Alex Bennée
2023-01-09 22:49 ` [PATCH v2 3/5] thread: de-const qemu_spin_destroy Emilio Cota
2023-01-10  9:09   ` Alex Bennée
2023-01-09 22:49 ` [PATCH v2 4/5] util/qht: use striped locks under TSAN Emilio Cota
2023-01-10 20:58   ` Alex Bennée
2023-01-11  2:41     ` Emilio Cota [this message]
2023-01-11 13:03       ` Alex Bennée
2023-01-09 22:49 ` [PATCH v2 5/5] plugins: make qemu_plugin_user_exit's locking order consistent with fork_start's Emilio Cota
2023-01-10  7:31   ` Philippe Mathieu-Daudé
2023-01-10 12:55 ` [PATCH v2 0/5] tsan fixes Alex Bennée
2023-01-10 15:50   ` Richard Henderson

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=Y74h2RC+8J63Nzqj@cota-l14 \
    --to=cota@braap.org \
    --cc=alex.bennee@linaro.org \
    --cc=pbonzini@redhat.com \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.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).