Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp4102868pxk; Tue, 8 Sep 2020 10:45:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyOWVzOfGiaN9AiKycmR9UtRNEsjJCBuCr1+PSnMNQguQiQURWWZ8kxevc8Wgsdm1QVwN20 X-Received: by 2002:a50:cf8a:: with SMTP id h10mr78753edk.43.1599587105473; Tue, 08 Sep 2020 10:45:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599587105; cv=none; d=google.com; s=arc-20160816; b=jxiCUxNDLVTSHrl6HnO299gxAYgDklCHswpBkgNdiIX5I8BOSivsgTzKAaRQe8GFX2 MKNT/12gOi67OI+QyXI5ZQqIzbD4+J7oY0jBltlMvAjgXPBrAvjbT7iJrAn4MZw4uSbz a5N+q9Gt7UMmH7DiGG2BAK8ABo1bMkvEcegrm3x5CW2R8+QjnDde+h4GPTIZNBStrnWm AntwqQ1JISxUiFOpVvdSqEF100dX6A43bHR7sCITiy4OO9ZnbJL630X7OguJXTeMSHh8 qfHhiIqLOPiwwmJKTnwTBllga17jeL1HU12mLUfU4L9De92t0c0Kfze/oaZNCmYgDqx6 XvKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from :dkim-signature:dkim-signature:date; bh=6fAFubHHqBfV7rm22ZeRY7ZslhBGVZwuDRVSmUBXy2E=; b=gbPvAd4wXI9MD5ROGvqSL3gNV9pVDOeNrulu6ZCoQDxtL2Sh+I+CptPJJLtnYcfBsA QDgBmYlSjVYhCzr/Wa9PiEoS6Mj4CZf9w2VJi45PXVWxNvtYz5giEkT4gNprIYNv16CZ 3H2EcOIT9g01VRzQYO64pzpuIK2VdOD9dgAei60Hl6dlJWQEYTAvpzQB52i+qdhb4re/ 8LqG+MQS7i/S+MOtLeUHUtxHsFcUJjffU30+cHH69L4b3WuCTkqwJNEe+SYCqIQkHps6 6GybKCy2hiUk9BflAoBHsfyuHlUSn90MWEppR2w9/1qyGMjH663CaR8O4fq4GHyDt3oc wOFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=qBMMBzJJ; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=sSmH5JrC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id nq4si7388464ejb.569.2020.09.08.10.44.42; Tue, 08 Sep 2020 10:45:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=qBMMBzJJ; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=sSmH5JrC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731665AbgIHRoF (ORCPT + 99 others); Tue, 8 Sep 2020 13:44:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56710 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731659AbgIHQOE (ORCPT ); Tue, 8 Sep 2020 12:14:04 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6168FC061375 for ; Tue, 8 Sep 2020 05:48:25 -0700 (PDT) Date: Tue, 8 Sep 2020 14:48:50 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1599569303; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=6fAFubHHqBfV7rm22ZeRY7ZslhBGVZwuDRVSmUBXy2E=; b=qBMMBzJJPqmVdjdvsckWg2x6CAY94WEen2gUNszKp9zlye67Jgrpr1YZdp7OwIso24T715 IW8nCStN1L/QIqNTOewYPJxQFaTg+fab5NhXs8QR1HZCgI0GOohuXwZYSwT4ajwMJOhUbG F5u++3oekU8ixEpXV39zAlOqZRbNjpqVEwimcni11H/wahju6v+3F8OyhAf8xI7oa3fbAJ kpqcWtwZC/CY4ouNoMMrbxDQeFee5oT4jKpCwxySZ7YjHIovtNG5+d9gz6D8aEiHf06qV2 ZA+lcRTjS6A6LdSBOde4NjqASAjAfvUFYz7qT9VcLJCnLCWzWBEx8Rpj7UyhkQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1599569303; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=6fAFubHHqBfV7rm22ZeRY7ZslhBGVZwuDRVSmUBXy2E=; b=sSmH5JrCzDTThVEx11l5gdKGySWNkg5t9mCiPqK+191e/J9iOpiD4nLQ5j+7/frijEZX5u CBvcG75OkebzF3CQ== From: "Ahmed S. Darwish" To: peterz@infradead.org Cc: Ingo Molnar , Will Deacon , Thomas Gleixner , "Sebastian A. Siewior" , "Paul E. McKenney" , Steven Rostedt , LKML Subject: Re: [PATCH v2 4/5] seqlock: seqcount_LOCKNAME_t: Introduce PREEMPT_RT support Message-ID: <20200908124850.GA487635@lx-t490> References: <20200904153231.11994-1-a.darwish@linutronix.de> <20200904153231.11994-5-a.darwish@linutronix.de> <20200908114520.GS1362448@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200908114520.GS1362448@hirez.programming.kicks-ass.net> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 08, 2020 at 01:45:20PM +0200, peterz@infradead.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.