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: <20200908124850.GA487635@lx-t490>
Date:   Tue, 8 Sep 2020 14:48:50 +0200
From:   "Ahmed S. Darwish" <a.darwish@...utronix.de>
To:     peterz@...radead.org
Cc:     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>
Subject: Re: [PATCH v2 4/5] seqlock: seqcount_LOCKNAME_t: Introduce
 PREEMPT_RT support

On Tue, Sep 08, 2020 at 01:45:20PM +0200, peterz@...radead.org wrote:
> On Fri, Sep 04, 2020 at 05:32:30PM +0200, Ahmed S. Darwish wrote:
> > @@ -406,13 +443,20 @@ static inline int read_seqcount_t_retry(const seqcount_t *s, unsigned start)
> >  	return __read_seqcount_t_retry(s, start);
> >  }
> >
> > +/*
> > + * Enforce non-preemptibility for all seqcount_LOCKNAME_t writers. Don't
> > + * do it for PREEMPT_RT, for the reasons outlined at __SEQ_LOCK().
> > + */
> > +#define __seq_enforce_writer_non_preemptibility(s)			\
> > +	(!IS_ENABLED(CONFIG_PREEMPT_RT) && __seqcount_lock_preemptible(s))
> > +
> >  /**
> >   * raw_write_seqcount_begin() - start a seqcount_t write section w/o lockdep
> >   * @s: Pointer to seqcount_t or any of the seqcount_LOCKNAME_t variants
> >   */
> >  #define raw_write_seqcount_begin(s)					\
> >  do {									\
> > -	if (__seqcount_lock_preemptible(s))				\
> > +	if (__seq_enforce_writer_non_preemptibility(s))			\
> >  		preempt_disable();					\
> >  									\
> >  	raw_write_seqcount_t_begin(__seqcount_ptr(s));			\
> > @@ -433,7 +477,7 @@ static inline void raw_write_seqcount_t_begin(seqcount_t *s)
> >  do {									\
> >  	raw_write_seqcount_t_end(__seqcount_ptr(s));			\
> >  									\
> > -	if (__seqcount_lock_preemptible(s))				\
> > +	if (__seq_enforce_writer_non_preemptibility(s))			\
> >  		preempt_enable();					\
> >  } while (0)
> >
> > @@ -456,7 +500,7 @@ static inline void raw_write_seqcount_t_end(seqcount_t *s)
> >  do {									\
> >  	__seqcount_assert_lock_held(s);					\
> >  									\
> > -	if (__seqcount_lock_preemptible(s))				\
> > +	if (__seq_enforce_writer_non_preemptibility(s))			\
> >  		preempt_disable();					\
> >  									\
> >  	write_seqcount_t_begin_nested(__seqcount_ptr(s), subclass);	\
> > @@ -483,7 +527,7 @@ static inline void write_seqcount_t_begin_nested(seqcount_t *s, int subclass)
> >  do {									\
> >  	__seqcount_assert_lock_held(s);					\
> >  									\
> > -	if (__seqcount_lock_preemptible(s))				\
> > +	if (__seq_enforce_writer_non_preemptibility(s))			\
> >  		preempt_disable();					\
> >  									\
> >  	write_seqcount_t_begin(__seqcount_ptr(s));			\
> > @@ -504,7 +548,7 @@ static inline void write_seqcount_t_begin(seqcount_t *s)
> >  do {									\
> >  	write_seqcount_t_end(__seqcount_ptr(s));			\
> >  									\
> > -	if (__seqcount_lock_preemptible(s))				\
> > +	if (__seq_enforce_writer_non_preemptibility(s))			\
> >  		preempt_enable();					\
> >  } while (0)
>
> I've replaced the above with the below, afaict there were no users of
> __seqcount_lock_preemptible() left.
>
> --- a/include/linux/seqlock.h
> +++ b/include/linux/seqlock.h
> @@ -228,7 +228,11 @@ __seqprop_##lockname##_sequence(const se
>  static __always_inline bool						\
>  __seqprop_##lockname##_preemptible(const seqcount_##lockname##_t *s)	\
>  {									\
> -	return preemptible;						\
> +	if (!IS_ENABLED(CONFIG_PREEMPT_RT))				\
> +		return preemptible;					\
> +									\
> +	/* PREEMPT_RT relies on the above LOCK+UNLOCK */		\
> +	return false;							\
>  }									\
>  									\

Sounds good.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ