login
Login
/
Register
Search
Search this site:
Forums
News
Blogs
Features
Site
Home
»
Mailing list archives
»
linux-kernel
»
2008
»
October
»
26
Re: [PATCH] v3 rudimentary tracing for Classic RCU
view
thread
Previous message: [
thread
] [
date
] [
author
]
Next message: [
thread
] [
date
] [
author
]
[view in full thread]
From: Paul E. McKenney
Subject:
Re: [PATCH] v3 rudimentary tracing for Classic RCU
Date: Sunday, October 26, 2008 - 2:59 pm
On Thu, Oct 23, 2008 at 07:12:09PM +0800, Lai Jiangshan wrote:
quoted text
> > trivial ported it to seq_file. > seq_file are very good for the output buffer.
Thank you for putting this together!!! Looks good at first glance -- I will test it out. Thanx, Paul
quoted text
> Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com> > --- > diff --git a/kernel/rcuclassic_trace.c b/kernel/rcuclassic_trace.c > index d19780b..f19217c > --- a/kernel/rcuclassic_trace.c > +++ b/kernel/rcuclassic_trace.c > @@ -23,157 +23,167 @@ > * Documentation/RCU > * > */ > -#include <linux/types.h> > -#include <linux/kernel.h> > -#include <linux/init.h> > -#include <linux/spinlock.h> > -#include <linux/smp.h> > #include <linux/rcupdate.h> > -#include <linux/interrupt.h> > -#include <linux/sched.h> > -#include <asm/atomic.h> > -#include <linux/bitops.h> > #include <linux/module.h> > -#include <linux/completion.h> > -#include <linux/moduleparam.h> > -#include <linux/percpu.h> > -#include <linux/notifier.h> > -#include <linux/cpu.h> > -#include <linux/mutex.h> > #include <linux/debugfs.h> > +#include <linux/seq_file.h> > > -static DEFINE_MUTEX(rcuclassic_trace_mutex); > -static char *rcuclassic_trace_buf; > -#define RCUCLASSIC_TRACE_BUF_SIZE (128 * num_possible_cpus() + 100) > +static struct rcu_data *get_rcu_data_bh(int cpu) > +{ > + return &per_cpu(rcu_bh_data, cpu); > +} > > -static int print_one_rcu_data(struct rcu_data *rdp, char *buf, char *ebuf) > +static struct rcu_data *get_rcu_data(int cpu) > { > - int cnt = 0; > + return &per_cpu(rcu_data, cpu); > +} > > +static int show_rcu_data(struct seq_file *m, void *v) > +{ > + struct rcu_data *rdp = v; > if (!rdp->beenonline) > return 0; > - cnt += snprintf(&buf[cnt], ebuf - &buf[cnt], > - "%3d%cqb=%ld b=%ld pq=%d qsp=%d ql=%ld bl=%ld\n", > - rdp->cpu, cpu_is_offline(rdp->cpu) ? '!' : ' ', > - rdp->quiescbatch, rdp->batch, rdp->passed_quiesc, > - rdp->qs_pending, rdp->qlen, rdp->blimit); > - return cnt; > + > + seq_printf(m, "processor\t: %d", rdp->cpu); > + if (cpu_is_offline(rdp->cpu)) > + seq_puts(m, "!\n"); > + else > + seq_puts(m, "\n"); > + seq_printf(m, "quiescbatch\t: %ld\n", rdp->quiescbatch); > + seq_printf(m, "batch\t: %ld\n", rdp->batch); > + seq_printf(m, "passed_quiesc\t: %d\n", rdp->passed_quiesc); > + seq_printf(m, "qs_pending\t: %d\n", rdp->qs_pending); > + seq_printf(m, "qlen\t: %ld\n", rdp->qlen); > + seq_printf(m, "blimit\t: %ld\n", rdp->blimit); > + seq_puts(m, "\n\n"); > + return 0; > } > > -#define PRINT_RCU_DATA(name, buf, ebuf) \ > - do { \ > - int _p_r_d_i; \ > - \ > - for_each_possible_cpu(_p_r_d_i) \ > - (buf) += print_one_rcu_data(&per_cpu(name, _p_r_d_i), \ > - buf, ebuf); \ > - } while (0) > - > -static ssize_t rcudata_read(struct file *filp, char __user *buffer, > - size_t count, loff_t *ppos) > +static void *c_start(struct seq_file *m, loff_t *pos) > { > - ssize_t bcount; > - char *buf = rcuclassic_trace_buf; > - char *ebuf = &rcuclassic_trace_buf[RCUCLASSIC_TRACE_BUF_SIZE]; > - > - mutex_lock(&rcuclassic_trace_mutex); > - buf += snprintf(buf, ebuf - buf, "rcu:\n"); > - PRINT_RCU_DATA(rcu_data, buf, ebuf); > - buf += snprintf(buf, ebuf - buf, "rcu_bh:\n"); > - PRINT_RCU_DATA(rcu_bh_data, buf, ebuf); > - bcount = simple_read_from_buffer(buffer, count, ppos, > - rcuclassic_trace_buf, strlen(rcuclassic_trace_buf)); > - mutex_unlock(&rcuclassic_trace_mutex); > - return bcount; > + typedef struct rcu_data *(*get_data_func)(int); > + > + if (*pos == 0) /* just in case, cpu 0 is not the first */ > + *pos = first_cpu(cpu_possible_map); > + else > + *pos = next_cpu_nr(*pos - 1, cpu_possible_map); > + if ((*pos) < nr_cpu_ids) > + return ((get_data_func)m->private)(*pos); > + return NULL; > } > > -static int print_one_rcu_ctrlblk(struct rcu_ctrlblk *rcp, char *buf, char *ebuf) > +static void *c_next(struct seq_file *m, void *v, loff_t *pos) > { > - int cnt = 0; > - > - cnt += snprintf(&buf[cnt], ebuf - &buf[cnt], "cur=%ld completed=%ld " > - "pending=%ld s=%d\n\t", > - rcp->cur, rcp->completed, > - rcp->pending, rcp->signaled); > - cnt += cpulist_scnprintf(&buf[cnt], ebuf - &buf[cnt], rcp->cpumask); > - cnt += snprintf(&buf[cnt], ebuf - &buf[cnt], "\n"); > - return cnt; > + (*pos)++; > + return c_start(m, pos); > } > > -static ssize_t rcucb_read(struct file *filp, char __user *buffer, > - size_t count, loff_t *ppos) > +static void c_stop(struct seq_file *m, void *v) > { > - ssize_t bcount; > - char *buf = rcuclassic_trace_buf; > - char *ebuf = &rcuclassic_trace_buf[RCUCLASSIC_TRACE_BUF_SIZE]; > - > - mutex_lock(&rcuclassic_trace_mutex); > - buf += snprintf(buf, ebuf - buf, "rcu: "); > - buf += print_one_rcu_ctrlblk(&rcu_ctrlblk, buf, ebuf); > - buf += snprintf(buf, ebuf - buf, "rcu_bh: "); > - buf += print_one_rcu_ctrlblk(&rcu_bh_ctrlblk, buf, ebuf); > - buf += snprintf(buf, ebuf - buf, "online: "); > - buf += cpulist_scnprintf(buf, ebuf - buf, cpu_online_map); > - buf += snprintf(buf, ebuf - buf, "\n"); > - bcount = simple_read_from_buffer(buffer, count, ppos, > - rcuclassic_trace_buf, strlen(rcuclassic_trace_buf)); > - mutex_unlock(&rcuclassic_trace_mutex); > - return bcount; > } > > -static struct file_operations rcudata_fops = { > - .owner = THIS_MODULE, > - .read = rcudata_read, > +const struct seq_operations rcu_data_seq_op = { > + .start = c_start, > + .next = c_next, > + .stop = c_stop, > + .show = show_rcu_data, > }; > > +static int rcu_data_open(struct inode *inode, struct file *file) > +{ > + int ret = seq_open(file, &rcu_data_seq_op); > + if (ret) > + return ret; > + ((struct seq_file *)file->private_data)->private = inode->i_private; > + return 0; > +} > + > +static const struct file_operations rcu_data_fops = { > + .owner = THIS_MODULE, > + .open = rcu_data_open, > + .read = seq_read, > + .llseek = seq_lseek, > + .release = seq_release, > +}; > + > +static void print_one_rcu_ctrlblk(struct seq_file *m, struct rcu_ctrlblk *rcp) > +{ > + seq_printf(m, "cur=%ld completed=%ld pending=%ld s=%d\n\t", > + rcp->cur, rcp->completed, rcp->pending, rcp->signaled); > + seq_cpumask(m, &rcp->cpumask); > + seq_puts(m, "\n"); > +} > + > +static int show_rcucb(struct seq_file *m, void *unused) > +{ > + seq_puts(m, "rcu: "); > + print_one_rcu_ctrlblk(m, &rcu_ctrlblk); > + seq_puts(m, "rcu_bh: "); > + print_one_rcu_ctrlblk(m, &rcu_bh_ctrlblk); > + seq_puts(m, "online: "); > + seq_cpumask(m, &cpu_online_map); > + seq_puts(m, "\n"); > + return 0; > +} > + > +static int rcucb_open(struct inode *inode, struct file *file) > +{ > + return single_open(file, show_rcucb, NULL); > +} > + > static struct file_operations rcucb_fops = { > - .owner = THIS_MODULE, > - .read = rcucb_read, > + .owner = THIS_MODULE, > + .open = rcucb_open, > + .read = seq_read, > + .llseek = seq_lseek, > + .release = single_release, > }; > > -static struct dentry *rcudir, *datadir, *cbdir; > -static int rcuclassic_debugfs_init(void) > +static struct dentry *rcudir, *rcu_bh_data_file, *rcu_data_file, *rcucb_file; > + > +static int __init rcuclassic_trace_init(void) > { > rcudir = debugfs_create_dir("rcu", NULL); > if (!rcudir) > goto out; > - datadir = debugfs_create_file("rcudata", 0444, rcudir, > - NULL, &rcudata_fops); > - if (!datadir) > - goto free_out; > - cbdir = debugfs_create_file("rcucb", 0444, rcudir, NULL, &rcucb_fops); > - if (!cbdir) > - goto free_out; > + > + rcu_bh_data_file = debugfs_create_file("rcu_bh_data", 0444, rcudir, > + get_rcu_data_bh, &rcu_data_fops); > + if (!rcu_bh_data_file) > + goto out_rcudir; > + > + rcu_data_file = debugfs_create_file("rcu_data", 0444, rcudir, > + get_rcu_data, &rcu_data_fops); > + if (!rcu_data_file) > + goto out_rcudata_bh_file; > + > + rcucb_file = debugfs_create_file("rcucb", 0444, rcudir, > + NULL, &rcucb_fops); > + if (!rcucb_file) > + goto out_rcudata_file; > return 0; > -free_out: > - if (datadir) > - debugfs_remove(datadir); > + > +out_rcudata_file: > + debugfs_remove(rcu_data_file); > +out_rcudata_bh_file: > + debugfs_remove(rcu_bh_data_file); > +out_rcudir: > debugfs_remove(rcudir); > out: > return 1; > } > > -static int __init rcuclassic_trace_init(void) > -{ > - int ret; > - > - rcuclassic_trace_buf = kmalloc(RCUCLASSIC_TRACE_BUF_SIZE, GFP_KERNEL); > - if (!rcuclassic_trace_buf) > - return 1; > - ret = rcuclassic_debugfs_init(); > - if (ret) > - kfree(rcuclassic_trace_buf); > - return ret; > -} > - > static void __exit rcuclassic_trace_cleanup(void) > { > - debugfs_remove(datadir); > - debugfs_remove(cbdir); > + debugfs_remove(rcucb_file); > + debugfs_remove(rcu_data_file); > + debugfs_remove(rcu_bh_data_file); > debugfs_remove(rcudir); > - kfree(rcuclassic_trace_buf); > } > > - > module_init(rcuclassic_trace_init); > module_exit(rcuclassic_trace_cleanup); > + > +MODULE_AUTHOR("Paul E. McKenney"); > +MODULE_DESCRIPTION("Read-Copy Update tracing for classic implementation"); > +MODULE_LICENSE("GPL"); >
--
unsubscribe notice
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to
majordomo@vger.kernel.org
More majordomo info at
http://vger.kernel.org/majordomo-info.html
Please read the FAQ at
http://www.tux.org/lkml/
Previous message: [
thread
] [
date
] [
author
]
Next message: [
thread
] [
date
] [
author
]
Messages in current thread:
scheduler hang on cpu re-hotplug with 2.6.27rc8
, Andi Kleen
, (Mon Oct 6, 7:12 am)
Re: RCU hang on cpu re-hotplug with 2.6.27rc8
, Andi Kleen
, (Mon Oct 6, 4:28 pm)
Re: RCU hang on cpu re-hotplug with 2.6.27rc8
, Paul E. McKenney
, (Mon Oct 6, 8:08 pm)
Re: RCU hang on cpu re-hotplug with 2.6.27rc8
, Andi Kleen
, (Tue Oct 7, 12:15 am)
Re: RCU hang on cpu re-hotplug with 2.6.27rc8
, Paul E. McKenney
, (Tue Oct 7, 8:26 am)
Re: RCU hang on cpu re-hotplug with 2.6.27rc8
, Andi Kleen
, (Tue Oct 7, 8:49 am)
Re: RCU hang on cpu re-hotplug with 2.6.27rc8
, Paul E. McKenney
, (Tue Oct 7, 9:34 am)
Re: RCU hang on cpu re-hotplug with 2.6.27rc8
, Andi Kleen
, (Tue Oct 7, 2:09 pm)
Re: RCU hang on cpu re-hotplug with 2.6.27rc8
, Paul E. McKenney
, (Tue Oct 7, 2:22 pm)
[PATCH] rudimentary tracing for Classic RCU
, Paul E. McKenney
, (Wed Oct 8, 6:08 pm)
Re: RCU hang on cpu re-hotplug with 2.6.27rc8
, Paul E. McKenney
, (Wed Oct 8, 6:33 pm)
Re: RCU hang on cpu re-hotplug with 2.6.27rc8
, Andi Kleen
, (Wed Oct 8, 9:56 pm)
Re: [PATCH] rudimentary tracing for Classic RCU
, Lai Jiangshan
, (Wed Oct 8, 11:20 pm)
Re: [PATCH] rudimentary tracing for Classic RCU
, Andi Kleen
, (Wed Oct 8, 11:55 pm)
Re: [PATCH] rudimentary tracing for Classic RCU
, Lai Jiangshan
, (Thu Oct 9, 12:05 am)
Re: [PATCH] rudimentary tracing for Classic RCU
, KOSAKI Motohiro
, (Thu Oct 9, 12:14 am)
Re: RCU hang on cpu re-hotplug with 2.6.27rc8
, Thomas Gleixner
, (Thu Oct 9, 12:24 am)
Re: [PATCH] rudimentary tracing for Classic RCU
, Lai Jiangshan
, (Thu Oct 9, 12:26 am)
Re: [PATCH] rudimentary tracing for Classic RCU
, Andi Kleen
, (Thu Oct 9, 1:06 am)
Re: RCU hang on cpu re-hotplug with 2.6.27rc8
, Andi Kleen
, (Thu Oct 9, 1:22 am)
Re: [PATCH] rudimentary tracing for Classic RCU
, Frédéric Weisbecker
, (Thu Oct 9, 3:23 am)
Re: [PATCH] rudimentary tracing for Classic RCU
, Andi Kleen
, (Thu Oct 9, 3:53 am)
Re: [PATCH] rudimentary tracing for Classic RCU
, Frédéric Weisbecker
, (Thu Oct 9, 4:44 am)
Re: RCU hang on cpu re-hotplug with 2.6.27rc8
, Paul E. McKenney
, (Thu Oct 9, 4:44 am)
Re: [PATCH] rudimentary tracing for Classic RCU
, Paul E. McKenney
, (Thu Oct 9, 4:50 am)
Re: [PATCH] rudimentary tracing for Classic RCU
, Paul E. McKenney
, (Thu Oct 9, 4:50 am)
Re: [PATCH] rudimentary tracing for Classic RCU
, Paul E. McKenney
, (Thu Oct 9, 4:54 am)
Re: [PATCH] rudimentary tracing for Classic RCU
, Frédéric Weisbecker
, (Thu Oct 9, 6:01 am)
[PATCH] v2 rudimentary tracing for Classic RCU
, Paul E. McKenney
, (Thu Oct 9, 8:44 pm)
Re: [PATCH] rudimentary tracing for Classic RCU
, Paul E. McKenney
, (Fri Oct 10, 4:48 am)
[PATCH] v3 rudimentary tracing for Classic RCU
, Paul E. McKenney
, (Mon Oct 13, 4:09 pm)
Re: [PATCH] v3 rudimentary tracing for Classic RCU
, Lai Jiangshan
, (Mon Oct 13, 8:53 pm)
Re: [PATCH] v3 rudimentary tracing for Classic RCU
, Paul E. McKenney
, (Tue Oct 14, 7:35 am)
Re: [PATCH] v3 rudimentary tracing for Classic RCU
, Lai Jiangshan
, (Thu Oct 23, 4:12 am)
Re: [PATCH] v3 rudimentary tracing for Classic RCU
, Paul E. McKenney
, (Sun Oct 26, 2:59 pm)
Re: [PATCH] v3 rudimentary tracing for Classic RCU
, Paul E. McKenney
, (Mon Oct 27, 2:50 pm)
Re: [PATCH] v3 rudimentary tracing for Classic RCU
, Paul E. McKenney
, (Mon Oct 27, 4:57 pm)
Re: [PATCH] v3 rudimentary tracing for Classic RCU
, Paul E. McKenney
, (Tue Oct 28, 6:16 pm)
Re: [PATCH] v3 rudimentary tracing for Classic RCU
, Lai Jiangshan
, (Tue Oct 28, 6:31 pm)
Re: [PATCH] v3 rudimentary tracing for Classic RCU
, Paul E. McKenney
, (Thu Oct 30, 8:52 am)
Navigation
Mailing list archives
Recent posts
Popular discussions
linux-kernel
:
Mel Gorman
Re: [PATCH 1/4] vmstat: remove zone->lock from walk_zones_in_node
Guenter Roeck
Re: [lm-sensors] Location for thermal drivers
David Woodhouse
Re: RFC: Moving firmware blobs out of the kernel.
Siddha, Suresh B
Re: [PATCH 2.6.21 review I] [11/25] x86: default to physical mode on hotplug CPU k...
Peter Zijlstra
Re: [patch 4/6] mm: merge populate and nopage into fault (fixes nonlinear)
git-commits-head
:
Linux Kernel Mailing List
[MIPS] Fix potential latency problem due to non-atomic cpu_wait.
Linux Kernel Mailing List
USB: rename USB_SPEED_VARIABLE to USB_SPEED_WIRELESS
Linux Kernel Mailing List
lib/vsprintf.c: fix bug omitting minus sign of numbers (module_param)
Linux Kernel Mailing List
[Bluetooth] Initiate authentication during connection establishment
Linux Kernel Mailing List
[POWERPC] 4xx: Add ppc40x_defconfig
linux-netdev
:
MERCEDES
Your mail id has won 950,000.00 in the MERCEDES Benz Online Promo.for claims send:
David Miller
Re: [PATCH] xen/netfront: do not mark packets of length < MSS as GSO
David Miller
Re: skb_segment() questions
Shan Wei
[RFC PATCH net-next 2/5]IPv6:netfilter: Send an ICMPv6 "Fragment Reassembly Timeou...
Stanislaw Gruszka
[PATCH 1/4] bnx2x: use smp_mb() to keep ordering of read write operations
git
:
Nicolas Sebrecht
git-svn died of signal 11 (was "3 failures on test t9100 (svn)")
Junio C Hamano
Re: [PATCH 2/2] Add url.<base>.pushInsteadOf: URL rewriting for push only
Martin Langhoff
Re: [PATCH] GIT commit statistics.
Alexandre Julliard
[PATCH] gitweb: Put back shortlog instead of graphiclog in the project list.
Josh Triplett
[PATCH 2/2] Add url.<base>.pushInsteadOf: URL rewriting for push only
openbsd-misc
:
Taisto Qvist XX
Re: AMD GEODE LX-800 just works with kernel from install42.iso and kernelpanics wi...
Nico Meijer
Re: gOS Develop Kit with VIA pc-1 Processor Platform VIA C7-D
Andreas Bihlmaier
Re: jetway board sensors (Fintek F71805F)
admin
Drive a 2009 car from R799p/m
Antti Harri
Re: how to create a sha256 hash
Colocation donated by:
Syndicate