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]
Date:   Wed, 8 Jul 2020 16:25:26 +0200
From:   Peter Zijlstra <peterz@...radead.org>
To:     "Ahmed S. Darwish" <a.darwish@...utronix.de>
Cc:     Ingo Molnar <mingo@...hat.com>, Will Deacon <will@...nel.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        "Paul E. McKenney" <paulmck@...nel.org>,
        "Sebastian A. Siewior" <bigeasy@...utronix.de>,
        Steven Rostedt <rostedt@...dmis.org>,
        LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v3 06/20] seqlock: Extend seqcount API with associated
 locks

On Wed, Jul 08, 2020 at 04:13:32PM +0200, Peter Zijlstra wrote:
> On Wed, Jul 08, 2020 at 02:29:38PM +0200, Peter Zijlstra wrote:
> 
> > #define SEQCOUNT_LOCKTYPE(name, locktype, preempt, lockmember)		\
> > typedef struct seqcount_##name {					\
> > 	seqcount_t	seqcount;					\
> > 	__SEQCOUNT_LOCKDEP(locktype *lock);				\
> > } seqcount_##name##_t;							\
> > 									\
> > static __always_inline void						\
> > seqcount_##name##_init(seqcount_##name##_t *s, locktype *l)		\
> > {									\
> > 	seqcount_init(&s->seqcount);					\
> > 	__SEQCOUNT_LOCKDEP(s->lock = l);				\
> > }									\
> > 									\
> > static __always_inline __seqprop_ptr_t					\
> > __seqprop_##name##_ptr(seqcount_##name##_t *s)				\
> > {									\
> > 	return &s->seqcount;						\
> > }									\
> > 									\
> > static __always_inline __seqprop_preempt_t				\
> > __seqprop_##name##_preempt(seqcount_##name##_t *s)			\
> > {									\
> > 	return preempt;							\
> > }									\
> > 									\
> > static __always_inline __seqprop_assert_t				\
> > __seqprop_##name##_assert(seqcount_##name##_t *s)			\
> > {									\
> > 	__SEQCOUNT_LOCKDEP(lockdep_assert_held(s->lockmember));		\
> > }
> 
> For PREEMPT_RT's magic thing, you can add:
> 
> static __always_inline void						\
> __seqprop_##name##_lock(seqcount_##name##_t *s)				\
> {									\
> 	if (!__SEQ_RT || !preempt)					\
> 		return;							\
> 									\
> 	lockbase##_lock(&s->lock);					\
> 	lockbase##_unlock(&s->lock);					\
> }
> 
> and:
> 
> #define __rt_lock_unlock_associated_sleeping_lock(s) __seqprop(s, lock)

Or possible have it like:

	if (!__SEQ_RT || !preempt)
		return smp_cond_load_relaxed(&s->seqcount->sequence, !(VAL & 1));

	lockbase##_lock(&s->lock);
	lockbase##_unlock(&s->lock);

	return READ_ONCE(s->seqcount->sequence);

and then replace most of __read_seqcount_begin() with it.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ