lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <32bfdec1ad4e11cfecd840e1b83d95ba2bab1abc.camel@redhat.com>
Date:   Wed, 16 Sep 2020 08:52:07 -0400
From:   Qian Cai <cai@...hat.com>
To:     peterz@...radead.org, Boqun Feng <boqun.feng@...il.com>,
        Stephen Rothwell <sfr@...b.auug.org.au>
Cc:     "Ahmed S. Darwish" <a.darwish@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>, Will Deacon <will@...nel.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        "Sebastian A. Siewior" <bigeasy@...utronix.de>,
        "Paul E. McKenney" <paulmck@...nel.org>,
        Steven Rostedt <rostedt@...dmis.org>,
        LKML <linux-kernel@...r.kernel.org>, linux-next@...r.kernel.org,
        Waiman Long <longman@...hat.com>
Subject: Re: [PATCH v2 0/5] seqlock: Introduce PREEMPT_RT support

On Tue, 2020-09-15 at 16:30 +0200, peterz@...radead.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)
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ