From patchwork Thu Jan 2 23:11:13 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 22873 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ie0-f197.google.com (mail-ie0-f197.google.com [209.85.223.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C39A4218DC for ; Thu, 2 Jan 2014 23:11:21 +0000 (UTC) Received: by mail-ie0-f197.google.com with SMTP id e14sf72616850iej.8 for ; Thu, 02 Jan 2014 15:11:20 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe:content-type :content-transfer-encoding; bh=VKyJ5CdMl+y2w+zQk1X2b1h2ZeVesw1qA7+Afi4alRU=; b=mCZp2uxn0bKV8ixlnxxWzBOMsno56d/kZjvhi9Ieh7ET2OEgEs5hVzg9i8bZtSDWzV YLGca46E/mPz2dtM68Y0sFEN19AqSxd8gLooGNjcJa2Ftu91hmqfaDTF4l+yGATn5Ggg R/y/ITXx5nAost4jzJ18amLfw5zpEl5bjqRgEAJn1FteoxlD6EVgC2Hys2w+5HIFwGML rInxdz5+ahQviV5nddRr8mGtIU5wWIMCO+pysysZKlbciF0+n25SKWqMEysuHzy6SSLJ IfDeebWvWBIVfObApfeZHmlCnWb41s+/4G0IMXlqP4lLxGi+gp8khjQtLxc45+yN9w4K jIrA== X-Gm-Message-State: ALoCoQl+5z6o3ddqpJBa4dkn96qb+2UUn7GclDwhvG356Fj4OgsEVlM0pwBbu/+2VsUvxO+UfADM X-Received: by 10.182.108.136 with SMTP id hk8mr34133093obb.11.1388704280738; Thu, 02 Jan 2014 15:11:20 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.116.108 with SMTP id jv12ls4557589qeb.18.gmail; Thu, 02 Jan 2014 15:11:20 -0800 (PST) X-Received: by 10.220.95.139 with SMTP id d11mr196696vcn.21.1388704280445; Thu, 02 Jan 2014 15:11:20 -0800 (PST) Received: from mail-vb0-f44.google.com (mail-vb0-f44.google.com [209.85.212.44]) by mx.google.com with ESMTPS id tj7si23768562vdc.20.2014.01.02.15.11.20 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 02 Jan 2014 15:11:20 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.44 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.44; Received: by mail-vb0-f44.google.com with SMTP id x8so7378579vbf.17 for ; Thu, 02 Jan 2014 15:11:20 -0800 (PST) X-Received: by 10.221.50.9 with SMTP id vc9mr41279995vcb.9.1388704280201; Thu, 02 Jan 2014 15:11:20 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.59.13.131 with SMTP id ey3csp797289ved; Thu, 2 Jan 2014 15:11:19 -0800 (PST) X-Received: by 10.68.163.193 with SMTP id yk1mr47463349pbb.138.1388704279068; Thu, 02 Jan 2014 15:11:19 -0800 (PST) Received: from mail-pb0-f53.google.com (mail-pb0-f53.google.com [209.85.160.53]) by mx.google.com with ESMTPS id im7si43879772pbd.131.2014.01.02.15.11.18 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 02 Jan 2014 15:11:19 -0800 (PST) Received-SPF: neutral (google.com: 209.85.160.53 is neither permitted nor denied by best guess record for domain of john.stultz@linaro.org) client-ip=209.85.160.53; Received: by mail-pb0-f53.google.com with SMTP id ma3so14925781pbc.40 for ; Thu, 02 Jan 2014 15:11:18 -0800 (PST) X-Received: by 10.68.228.169 with SMTP id sj9mr13067007pbc.23.1388704278496; Thu, 02 Jan 2014 15:11:18 -0800 (PST) Received: from localhost.localdomain (c-67-170-153-23.hsd1.or.comcast.net. [67.170.153.23]) by mx.google.com with ESMTPSA id g6sm136823533pat.2.2014.01.02.15.11.17 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 02 Jan 2014 15:11:17 -0800 (PST) From: John Stultz To: LKML Cc: John Stultz , =?UTF-8?q?Krzysztof=20Ha=C5=82asa?= , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Willy Tarreau , Ingo Molnar , Peter Zijlstra , Stephen Boyd , Linus Torvalds , linux-arm-kernel@lists.infradead.org Subject: [PATCH 1/2] seqlock: Use raw_ prefix instead of _no_lockdep Date: Thu, 2 Jan 2014 15:11:13 -0800 Message-Id: <1388704274-5278-1-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <52C5E675.80701@linaro.org> References: <52C5E675.80701@linaro.org> MIME-Version: 1.0 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: john.stultz@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.44 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Linus disliked the _no_lockdep() naming, so instead use the more-consistent raw_* prefix to the non-lockdep enabled seqcount methods. This also adds raw_ methods for the write operations as well, which will be utilized in a following patch. Cc: Krzysztof Hałasa Cc: Uwe Kleine-König Cc: Willy Tarreau Cc: Ingo Molnar , Cc: Peter Zijlstra Cc: Stephen Boyd Cc: Linus Torvalds Cc: linux-arm-kernel@lists.infradead.org Signed-off-by: John Stultz --- arch/x86/vdso/vclock_gettime.c | 8 ++++---- include/linux/seqlock.h | 27 +++++++++++++++++++-------- 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/arch/x86/vdso/vclock_gettime.c b/arch/x86/vdso/vclock_gettime.c index 2ada505..eb5d7a5 100644 --- a/arch/x86/vdso/vclock_gettime.c +++ b/arch/x86/vdso/vclock_gettime.c @@ -178,7 +178,7 @@ notrace static int __always_inline do_realtime(struct timespec *ts) ts->tv_nsec = 0; do { - seq = read_seqcount_begin_no_lockdep(>od->seq); + seq = raw_read_seqcount_begin(>od->seq); mode = gtod->clock.vclock_mode; ts->tv_sec = gtod->wall_time_sec; ns = gtod->wall_time_snsec; @@ -198,7 +198,7 @@ notrace static int do_monotonic(struct timespec *ts) ts->tv_nsec = 0; do { - seq = read_seqcount_begin_no_lockdep(>od->seq); + seq = raw_read_seqcount_begin(>od->seq); mode = gtod->clock.vclock_mode; ts->tv_sec = gtod->monotonic_time_sec; ns = gtod->monotonic_time_snsec; @@ -214,7 +214,7 @@ notrace static int do_realtime_coarse(struct timespec *ts) { unsigned long seq; do { - seq = read_seqcount_begin_no_lockdep(>od->seq); + seq = raw_read_seqcount_begin(>od->seq); ts->tv_sec = gtod->wall_time_coarse.tv_sec; ts->tv_nsec = gtod->wall_time_coarse.tv_nsec; } while (unlikely(read_seqcount_retry(>od->seq, seq))); @@ -225,7 +225,7 @@ notrace static int do_monotonic_coarse(struct timespec *ts) { unsigned long seq; do { - seq = read_seqcount_begin_no_lockdep(>od->seq); + seq = raw_read_seqcount_begin(>od->seq); ts->tv_sec = gtod->monotonic_time_coarse.tv_sec; ts->tv_nsec = gtod->monotonic_time_coarse.tv_nsec; } while (unlikely(read_seqcount_retry(>od->seq, seq))); diff --git a/include/linux/seqlock.h b/include/linux/seqlock.h index cf87a24..535f158 100644 --- a/include/linux/seqlock.h +++ b/include/linux/seqlock.h @@ -117,15 +117,15 @@ repeat: } /** - * read_seqcount_begin_no_lockdep - start seq-read critical section w/o lockdep + * raw_read_seqcount_begin - start seq-read critical section w/o lockdep * @s: pointer to seqcount_t * Returns: count to be passed to read_seqcount_retry * - * read_seqcount_begin_no_lockdep opens a read critical section of the given + * raw_read_seqcount_begin opens a read critical section of the given * seqcount, but without any lockdep checking. Validity of the critical * section is tested by checking read_seqcount_retry function. */ -static inline unsigned read_seqcount_begin_no_lockdep(const seqcount_t *s) +static inline unsigned raw_read_seqcount_begin(const seqcount_t *s) { unsigned ret = __read_seqcount_begin(s); smp_rmb(); @@ -144,7 +144,7 @@ static inline unsigned read_seqcount_begin_no_lockdep(const seqcount_t *s) static inline unsigned read_seqcount_begin(const seqcount_t *s) { seqcount_lockdep_reader_access(s); - return read_seqcount_begin_no_lockdep(s); + return raw_read_seqcount_begin(s); } /** @@ -206,14 +206,26 @@ static inline int read_seqcount_retry(const seqcount_t *s, unsigned start) } + +static inline void raw_write_seqcount_begin(seqcount_t *s) +{ + s->sequence++; + smp_wmb(); +} + +static inline void raw_write_seqcount_end(seqcount_t *s) +{ + smp_wmb(); + s->sequence++; +} + /* * Sequence counter only version assumes that callers are using their * own mutexing. */ static inline void write_seqcount_begin_nested(seqcount_t *s, int subclass) { - s->sequence++; - smp_wmb(); + raw_write_seqcount_begin(s); seqcount_acquire(&s->dep_map, subclass, 0, _RET_IP_); } @@ -225,8 +237,7 @@ static inline void write_seqcount_begin(seqcount_t *s) static inline void write_seqcount_end(seqcount_t *s) { seqcount_release(&s->dep_map, 1, _RET_IP_); - smp_wmb(); - s->sequence++; + raw_write_seqcount_end(s); } /**