From: Qian Cai <cai@redhat.com>
To: peterz@infradead.org, Boqun Feng <boqun.feng@gmail.com>,
Stephen Rothwell <sfr@canb.auug.org.au>
Cc: "Ahmed S. Darwish" <a.darwish@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Will Deacon <will@kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
"Sebastian A. Siewior" <bigeasy@linutronix.de>,
"Paul E. McKenney" <paulmck@kernel.org>,
Steven Rostedt <rostedt@goodmis.org>,
LKML <linux-kernel@vger.kernel.org>,
linux-next@vger.kernel.org, Waiman Long <longman@redhat.com>
Subject: Re: [PATCH v2 0/5] seqlock: Introduce PREEMPT_RT support
Date: Wed, 16 Sep 2020 08:52:07 -0400 [thread overview]
Message-ID: <32bfdec1ad4e11cfecd840e1b83d95ba2bab1abc.camel@redhat.com> (raw)
In-Reply-To: <20200915143028.GB2674@hirez.programming.kicks-ass.net>
On Tue, 2020-09-15 at 16:30 +0200, peterz@infradead.org wrote:
> On Tue, Sep 15, 2020 at 08:48:17PM +0800, Boqun Feng wrote:
> > I think this happened because seqcount_##lockname##_init() is defined at
> > function rather than macro, so when the seqcount_init() gets expand in
>
> Bah! I hate all this :/
>
> I suspect the below, while more verbose than I'd like is the best
> option.
Stephen, can you add this patch for now until Peter beats you to it?
>
> ---
> include/linux/seqlock.h | 22 ++++++++++++++--------
> 1 file changed, 14 insertions(+), 8 deletions(-)
>
> diff --git a/include/linux/seqlock.h b/include/linux/seqlock.h
> index f73c7eb68f27..76e44e6c0100 100644
> --- a/include/linux/seqlock.h
> +++ b/include/linux/seqlock.h
> @@ -173,6 +173,19 @@ static inline void seqcount_lockdep_reader_access(const
> seqcount_t *s)
> * @lock: Pointer to the associated lock
> */
>
> +#define seqcount_LOCKNAME_init(s, _lock, lockname) \
> + do { \
> + seqcount_##lockname##_t *____s = (s); \
> + seqcount_init(&____s->seqcount); \
> + __SEQ_LOCK(____s->lock = (_lock)); \
> + } while (0)
> +
> +#define seqcount_raw_spinlock_init(s, lock) seqcount_LOCKNAME_init(s, lock,
> raw_spinlock)
> +#define seqcount_spinlock_init(s, lock) seqcount_LOCKNAME_init(s
> , lock, spinlock)
> +#define seqcount_rwlock_init(s, lock) seqcount_LOCKNAME_init(s
> , lock, rwlock);
> +#define seqcount_mutex_init(s, lock) seqcount_LOCKNAME_init(s, lock,
> mutex);
> +#define seqcount_ww_mutex_init(s, lock) seqcount_LOCKNAME_init(s
> , lock, ww_mutex);
> +
> /*
> * SEQCOUNT_LOCKNAME() - Instantiate seqcount_LOCKNAME_t and helpers
> * seqprop_LOCKNAME_*() - Property accessors for seqcount_LOCKNAME_t
> @@ -190,13 +203,6 @@ typedef struct seqcount_##lockname {
> \
> __SEQ_LOCK(locktype *lock); \
> } seqcount_##lockname##_t; \
> \
> -static __always_inline void \
> -seqcount_##lockname##_init(seqcount_##lockname##_t *s, locktype *lock)
> \
> -{ \
> - seqcount_init(&s->seqcount); \
> - __SEQ_LOCK(s->lock = lock); \
> -} \
> - \
> static __always_inline seqcount_t * \
> __seqprop_##lockname##_ptr(seqcount_##lockname##_t *s)
> \
> { \
> @@ -284,8 +290,8 @@ SEQCOUNT_LOCKNAME(ww_mutex, struct ww_mutex,
> true, &s->lock->base, ww_mu
> __SEQ_LOCK(.lock = (assoc_lock)) \
> }
>
> -#define SEQCNT_SPINLOCK_ZERO(name, lock) SEQCOUNT_LOCKNAME_ZERO(name,
> lock)
> #define SEQCNT_RAW_SPINLOCK_ZERO(name, lock) SEQCOUNT_LOCKNAME_ZERO(name,
> lock)
> +#define SEQCNT_SPINLOCK_ZERO(name, lock) SEQCOUNT_LOCKNAME_ZERO(name,
> lock)
> #define SEQCNT_RWLOCK_ZERO(name, lock) SEQCOUNT_LOCKNAME_ZERO(n
> ame, lock)
> #define SEQCNT_MUTEX_ZERO(name, lock) SEQCOUNT_LOCKNAME_ZERO(n
> ame, lock)
> #define SEQCNT_WW_MUTEX_ZERO(name, lock) SEQCOUNT_LOCKNAME_ZERO(name,
> lock)
>
next prev parent reply other threads:[~2020-09-16 20:30 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-04 15:32 [PATCH v2 0/5] seqlock: Introduce PREEMPT_RT support Ahmed S. Darwish
2020-09-04 15:32 ` [PATCH v2 1/5] seqlock: seqcount_LOCKNAME_t: Standardize naming convention Ahmed S. Darwish
2020-09-10 15:08 ` [tip: locking/core] " tip-bot2 for Ahmed S. Darwish
2020-09-04 15:32 ` [PATCH v2 2/5] seqlock: Use unique prefix for seqcount_t property accessors Ahmed S. Darwish
2020-09-08 11:41 ` peterz
2020-09-10 15:08 ` [tip: locking/core] " tip-bot2 for Ahmed S. Darwish
2020-09-04 15:32 ` [PATCH v2 3/5] seqlock: seqcount_t: Implement all read APIs as statement expressions Ahmed S. Darwish
2020-09-10 15:08 ` [tip: locking/core] " tip-bot2 for Ahmed S. Darwish
2020-09-04 15:32 ` [PATCH v2 4/5] seqlock: seqcount_LOCKNAME_t: Introduce PREEMPT_RT support Ahmed S. Darwish
2020-09-08 11:45 ` peterz
2020-09-08 12:48 ` Ahmed S. Darwish
2020-09-04 15:32 ` [PATCH v2 5/5] seqlock: PREEMPT_RT: Do not starve seqlock_t writers Ahmed S. Darwish
2020-09-10 15:08 ` [tip: locking/core] " tip-bot2 for Ahmed S. Darwish
2020-09-15 0:20 ` [PATCH v2 0/5] seqlock: Introduce PREEMPT_RT support Qian Cai
2020-09-15 12:48 ` Boqun Feng
2020-09-15 13:10 ` Boqun Feng
2020-09-15 14:30 ` peterz
2020-09-16 12:52 ` Qian Cai [this message]
2020-09-16 12:54 ` peterz
2020-09-16 13:00 ` Qian Cai
2020-09-16 13:02 ` peterz
2020-09-17 2:31 ` Stephen Rothwell
2020-09-18 8:42 ` [tip: locking/core] seqlock: Unbreak lockdep tip-bot2 for peterz@infradead.org
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=32bfdec1ad4e11cfecd840e1b83d95ba2bab1abc.camel@redhat.com \
--to=cai@redhat.com \
--cc=a.darwish@linutronix.de \
--cc=bigeasy@linutronix.de \
--cc=boqun.feng@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-next@vger.kernel.org \
--cc=longman@redhat.com \
--cc=mingo@redhat.com \
--cc=paulmck@kernel.org \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=sfr@canb.auug.org.au \
--cc=tglx@linutronix.de \
--cc=will@kernel.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).