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: <20200708141332.GQ117543@hirez.programming.kicks-ass.net>
Date:   Wed, 8 Jul 2020 16:13:32 +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 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)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ