Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp595545ybt; Wed, 8 Jul 2020 07:16:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzE+gOYuS51/zmvvViTizBlDx+Scatd7cGzDP94goYj0gSEbkZWrJcTSgbHMimZ5zBRAbLy X-Received: by 2002:aa7:c609:: with SMTP id h9mr68989688edq.43.1594217796618; Wed, 08 Jul 2020 07:16:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594217796; cv=none; d=google.com; s=arc-20160816; b=eh2nT8JqMZhNckDf91S5/LjhT4og6BOHyINrNyJg9uztr4pXvfvGHnurWEA5poXrql M+RSTw0g6mS9HjBrJXvr+t3lVBDh5Mh8FudQ4f5P7kIC5zyDpXNdgihv+7x/eVs/Sdke /b8/OUcXwfxSAm74yJdmSxk6wDxvzLrnGu87+JQ5rtEykxCWvt6CvdoIh6FzmrqQcWSx HsiFHdvcufEo083/9rW6ssA1TqefI4CfI5b21pEbeKfuRaWU0+5Xzbk8ilLYFmry82Oo V1zVDM2dIUIanCNLcX0jVbfnRIAEkbdxa+2yIU01kOXe53M90P9vBREnnl49udiB5ozb uMyQ== 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:date :dkim-signature; bh=UgGkoSC3pvn7sODQI7rlQ09UUbHzMllpNaF4kJrXNEk=; b=tiTogaIMpz+UoxOVWnoSYwLe1IMUZIQKbb2yOvTP1yOC0SpD/+qpPUh+7XavgGFH/f ePqe60l3o3TAwH02VoFhhBwQbA59AQJobpDYC7W7krdgD2692cEOBL/G1sS6WV9/sToY 6snpVJGWa7ueo5wCrToa1+DAVsI0/CvQdBLlSd+7a8SQ9x9BoavEV0dHspLWfO/eRczr zdohPRpym1vYN2IvcD2A/V+LQkaOkj0RJdXtyActgCZeavSzW4WhhPOCMVRWiZ857hAE 48KGSVVqi7Sdvu+/0YqGDeycPkTuC5hi4WL9Sjm1kRtslKPdVtfuzJbbw44TbNLlCILl D45A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=YZ7FU1F8; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v18si43457edy.249.2020.07.08.07.16.13; Wed, 08 Jul 2020 07:16:36 -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=fail header.i=@infradead.org header.s=merlin.20170209 header.b=YZ7FU1F8; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729541AbgGHONm (ORCPT + 99 others); Wed, 8 Jul 2020 10:13:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728932AbgGHONm (ORCPT ); Wed, 8 Jul 2020 10:13:42 -0400 Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F107C061A0B for ; Wed, 8 Jul 2020 07:13:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=UgGkoSC3pvn7sODQI7rlQ09UUbHzMllpNaF4kJrXNEk=; b=YZ7FU1F8/X5YcRvnIiceJdDKdS sdePgY9euAhhfMh1BF6a8+N2pQkEQJu8FcP0g8j5ZLzjK20LH2tOa0r48V5PmvFer6R+CSp3hxBIH T+NKWw6ldYE7xRuanbrlQBWWdqOWCViQ3TV1G7h5UR6koc9CNe5tYseDkHJeCoPY76qwVWrBSaSHk cvu5c4+RjO7z33tFkR2VKcMRID4ixYr2sKqljXKuJVyulwJqnkpn4y0lGKYOa0oRYNaMk1WKKPlKr 15dHIf9Yt7+p40+KN4jnRAEdIsIhAylmWdEJA4YmxMLRnX+v6DwoKacGy5GMyKP4uPP+2bruCGUnG loOFmGgg==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jtApK-0006G4-CT; Wed, 08 Jul 2020 14:13:34 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 63C12300739; Wed, 8 Jul 2020 16:13:32 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 2022A214ECDC2; Wed, 8 Jul 2020 16:13:32 +0200 (CEST) Date: Wed, 8 Jul 2020 16:13:32 +0200 From: Peter Zijlstra To: "Ahmed S. Darwish" Cc: Ingo Molnar , Will Deacon , Thomas Gleixner , "Paul E. McKenney" , "Sebastian A. Siewior" , Steven Rostedt , LKML Subject: Re: [PATCH v3 06/20] seqlock: Extend seqcount API with associated locks Message-ID: <20200708141332.GQ117543@hirez.programming.kicks-ass.net> References: <20200630054452.3675847-1-a.darwish@linutronix.de> <20200630054452.3675847-7-a.darwish@linutronix.de> <20200706212148.GE5523@worktop.programming.kicks-ass.net> <20200707084024.GA4097637@debian-buster-darwi.lab.linutronix.de> <20200707130410.GO4800@hirez.programming.kicks-ass.net> <20200707143726.GO117543@hirez.programming.kicks-ass.net> <20200708103314.GB4151780@debian-buster-darwi.lab.linutronix.de> <20200708122938.GQ4800@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200708122938.GQ4800@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 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)