lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20111206171751.GA15062@alboin.jf.intel.com>
Date:	Tue, 6 Dec 2011 09:17:51 -0800
From:	Andi Kleen <ak@...ux.intel.com>
To:	Wu Fengguang <fengguang.wu@...el.com>
Cc:	Andi Kleen <andi@...stfloor.org>,
	"greg@...ah.com" <greg@...ah.com>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"linux-fsdevel@...r.kernel.org" <linux-fsdevel@...r.kernel.org>
Subject: Re: [PATCH 2/3] DEBUGFS: Add per cpu counters

On Tue, Dec 06, 2011 at 07:44:38PM +0800, Wu Fengguang wrote:
> > +#include <linux/seq_file.h>
> > +#include <linux/percpu.h>
> > +#include <linux/kernel.h>
> > +
> > +/* OPEN: implement module support */
> 
> Yeah, I think the module support would benefit my case as well.
> 
> To support module users, init_counters() will be exported with the
> __start___debugfs/__stop___debugfs hard coding removed. Then I'll be
> call it from the readahead initilization code:

No, the module loader should take care of this: look for the magic
section, register it. This is already done for other magic
sections and not too difficult, i just didn't write the code
so far.

Then the DEFINE_* macros would work seamlessly in modules too.

Do you really need it for the readahead code? I thought that
was builtin.


> 
> DEFINE_PER_CPU(unsigned long[RA_PATTERN_MAX][RA_ACCOUNT_MAX], ra_counter);
> struct debugfs_counter ra_pcpu_counter[RA_PATTERN_MAX][RA_ACCOUNT_MAX];
> 
> // init ra_pcpu_counter in a loop
> for each pattern
>         init_counters(ra_pcpu_counter[pattern], ra_pcpu_counter[pattern+1]);

Ok so you need arrays.

The idea is to not call some init function, but just put it into section
and let the init code walk it.

Should probably have a macro that handles arrays nicely.

> > +static int show_debugfs_counter(struct seq_file *m, void *arg)
> > +{
> > +	int n;
> > +	n = dump_counters(m, __start___debugfs, __stop___debugfs, m->private);
> 
> That hard coded __start___debugfs/__stop___debugfs is OK for POC, and
> will need to be improved to work with multiple users in kernel.

For Modules it obviously has to walk a list. It's a straight forward extension.

I don't think it should allow everyone to register their own lists,
that doesn't make sense because they could as well create the debug 
files themselves.

-Andi
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ