From patchwork Tue Oct 30 17:05:01 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paul E. McKenney" X-Patchwork-Id: 12611 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id A37D023F56 for ; Tue, 30 Oct 2012 17:32:05 +0000 (UTC) Received: from mail-ia0-f180.google.com (mail-ia0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id 4B9B6A18F2D for ; Tue, 30 Oct 2012 17:32:05 +0000 (UTC) Received: by mail-ia0-f180.google.com with SMTP id f6so350395iag.11 for ; Tue, 30 Oct 2012 10:32:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:in-reply-to:references :x-content-scanned:x-cbid:x-gm-message-state; bh=osBK62Bx35E67HIASk1jKxPhp35w+Q09dAqN9YbVpro=; b=bi9rBw6Ornov3it1heG8S0KKpXkXxQWpzybO964r2SyBTUkMcIgtvI57aFDroq1Bg5 qFa1do0sS6Lvt7Aoi7n7yl4QCaSWUWv9Hg2uSCqPrSWROw6MammF4pR9xRlkIZzYsdbz cFXkBIcQJAv9B3D2lkOFnXi24XOeMC3o7u3lrPIJnDavPIElsEVC1O0krLQsHuL26GIg VoSE3cAxymvU+rFBxm84J5PGXzLv6TZkjGJmeIUFGRT5w0C+UA+OqW+esq/fP7FG7dEV Lz6WzQNeCLgBMYl8JGZhr3SSkYhjW0JyLTLq0HXXw1o4Hyixszmse2dO5j8fHRmlWKhe eY3A== Received: by 10.50.140.97 with SMTP id rf1mr2168994igb.70.1351618325065; Tue, 30 Oct 2012 10:32:05 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.67.148 with SMTP id n20csp457632igt; Tue, 30 Oct 2012 10:32:04 -0700 (PDT) Received: by 10.42.37.17 with SMTP id w17mr29010231icd.32.1351618324807; Tue, 30 Oct 2012 10:32:04 -0700 (PDT) Received: from e36.co.us.ibm.com (e36.co.us.ibm.com. [32.97.110.154]) by mx.google.com with ESMTPS id md6si10025050igc.3.2012.10.30.10.32.04 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 30 Oct 2012 10:32:04 -0700 (PDT) Received-SPF: pass (google.com: domain of paulmck@linux.vnet.ibm.com designates 32.97.110.154 as permitted sender) client-ip=32.97.110.154; Authentication-Results: mx.google.com; spf=pass (google.com: domain of paulmck@linux.vnet.ibm.com designates 32.97.110.154 as permitted sender) smtp.mail=paulmck@linux.vnet.ibm.com Received: from /spool/local by e36.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 30 Oct 2012 11:32:02 -0600 Received: from d03dlp01.boulder.ibm.com (9.17.202.177) by e36.co.us.ibm.com (192.168.1.136) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 30 Oct 2012 11:31:45 -0600 Received: from d03relay04.boulder.ibm.com (d03relay04.boulder.ibm.com [9.17.195.106]) by d03dlp01.boulder.ibm.com (Postfix) with ESMTP id 81EEF1FF004B for ; Tue, 30 Oct 2012 11:31:43 -0600 (MDT) Received: from d03av01.boulder.ibm.com (d03av01.boulder.ibm.com [9.17.195.167]) by d03relay04.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q9UHVicr166974 for ; Tue, 30 Oct 2012 11:31:44 -0600 Received: from d03av01.boulder.ibm.com (loopback [127.0.0.1]) by d03av01.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q9UHVgaJ028745 for ; Tue, 30 Oct 2012 11:31:43 -0600 Received: from paulmck-ThinkPad-W500 (sig-9-49-139-14.mts.ibm.com [9.49.139.14]) by d03av01.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q9UHVbPV027811; Tue, 30 Oct 2012 11:31:38 -0600 Received: by paulmck-ThinkPad-W500 (Postfix, from userid 1000) id 7D289E4D59; Tue, 30 Oct 2012 10:05:14 -0700 (PDT) From: "Paul E. McKenney" To: linux-kernel@vger.kernel.org Cc: mingo@elte.hu, laijs@cn.fujitsu.com, dipankar@in.ibm.com, akpm@linux-foundation.org, mathieu.desnoyers@polymtl.ca, josh@joshtriplett.org, niv@us.ibm.com, tglx@linutronix.de, peterz@infradead.org, rostedt@goodmis.org, Valdis.Kletnieks@vt.edu, dhowells@redhat.com, edumazet@google.com, darren@dvhart.com, fweisbec@gmail.com, sbw@mit.edu, patches@linaro.org, Michael Wang , "Paul E. McKenney" Subject: [PATCH tip/core/rcu 02/14] rcu: Fundamental facility for 'CPU units sequence reading' Date: Tue, 30 Oct 2012 10:05:01 -0700 Message-Id: <1351616713-26930-2-git-send-email-paulmck@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.8 In-Reply-To: <1351616713-26930-1-git-send-email-paulmck@linux.vnet.ibm.com> References: <20121030170454.GA25712@linux.vnet.ibm.com> <1351616713-26930-1-git-send-email-paulmck@linux.vnet.ibm.com> X-Content-Scanned: Fidelis XPS MAILER x-cbid: 12103017-7606-0000-0000-000004EEB086 X-Gm-Message-State: ALoCoQl/AQ+0dfNo3aGVnFGeWKIdgOHwiVzmbuOqa9534/FgYgIYGIENNadCg7RuWRnS1LiQBASz From: Michael Wang This patch add the fundamental facility used by the following patches, so we can implement the 'CPU units sequence reading' later. This helps us avoid losing data when there are too many CPUs and too small of a buffer, since this new approach allows userspace to read out the data one CPU at a time. Thus, if the buffer is not large enough, userspace will get whatever CPUs fit, and can then issue another read for the remainder of the data. Signed-off-by: Michael Wang Signed-off-by: Paul E. McKenney --- kernel/rcutree_trace.c | 30 ++++++++++++++++++++++++++++++ 1 files changed, 30 insertions(+), 0 deletions(-) diff --git a/kernel/rcutree_trace.c b/kernel/rcutree_trace.c index 62223a2..0dfe9b5 100644 --- a/kernel/rcutree_trace.c +++ b/kernel/rcutree_trace.c @@ -46,6 +46,36 @@ #define RCU_TREE_NONCORE #include "rcutree.h" +static int r_open(struct inode *inode, struct file *file, + const struct seq_operations *op) +{ + int ret = seq_open(file, op); + if (!ret) { + struct seq_file *m = (struct seq_file *)file->private_data; + m->private = inode->i_private; + } + return ret; +} + +static void *r_start(struct seq_file *m, loff_t *pos) +{ + struct rcu_state *rsp = (struct rcu_state *)m->private; + *pos = cpumask_next(*pos - 1, cpu_possible_mask); + if ((*pos) < nr_cpu_ids) + return per_cpu_ptr(rsp->rda, *pos); + return NULL; +} + +static void *r_next(struct seq_file *m, void *v, loff_t *pos) +{ + (*pos)++; + return r_start(m, pos); +} + +static void r_stop(struct seq_file *m, void *v) +{ +} + static int show_rcubarrier(struct seq_file *m, void *unused) { struct rcu_state *rsp;