Re: [patch 00/13] Syslets, "Threadlets", generic AIO support, v3

Eric Dumazet
2007-03-01T13:13:00Z

[-- Attachment #1: Type: text/plain, Size: 456 bytes --]

On Thursday 01 March 2007 12:47, Evgeniy Polyakov wrote:
>
> Could you provide at least remote way to find it?
>

Sure :)

> I only found the same problem at
> http://lkml.org/lkml/2006/10/27/3
>
> but without any hits to solve the problem.
>
> I will try CVS oprofile, if it works I will provide details of course.
>

# cat CVS/Root
CVS/Root::pserver:anonymous@oprofile.cvs.sourceforge.net:/cvsroot/oprofile

# cvs diff >/tmp/oprofile.diff

Hope it helps

[-- Attachment #2: oprofile.diff --]
[-- Type: text/x-diff, Size: 1663 bytes --]

Index: libop/op_alloc_counter.c
===================================================================
RCS file: /cvsroot/oprofile/oprofile/libop/op_alloc_counter.c,v
retrieving revision 1.8
diff -r1.8 op_alloc_counter.c
14a15,16
> #include <ctype.h>
> #include <dirent.h>
133c135
< return 0;
---
> continue;
145a148,183
> /* determine which directories are counter directories
> */
> static int perfcounterdir(const struct dirent * entry)
> {
> return (isdigit(entry->d_name[0]));
> }
>
>
> /**
> * @param mask pointer where to place bit mask of unavailable counters
> *
> * return >= 0 number of counters that are available
> * < 0 could not determine number of counters
> *
> */
> static int op_get_counter_mask(u32 * mask)
> {
> struct dirent **counterlist;
> int count, i;
> /* assume nothing is available */
> u32 available=0;
>
> count = scandir("/dev/oprofile", &counterlist, perfcounterdir,
> alphasort);
> if (count < 0)
> /* unable to determine bit mask */
> return -1;
> /* convert to bit map (0 where counter exists) */
> for (i=0; i<count; ++i) {
> available |= 1 << atoi(counterlist[i]->d_name);
> free(counterlist[i]);
> }
> *mask=~available;
> free(counterlist);
> return count;
> }
152a191
> u32 unavailable_counters = 0;
154c193,195
< nr_counters = op_get_nr_counters(cpu_type);
---
> nr_counters = op_get_counter_mask(&unavailable_counters);
> if (nr_counters < 0)
> nr_counters = op_get_nr_counters(cpu_type);
162c203,204
< if (!allocate_counter(ctr_arc, nr_events, 0, 0, counter_map)) {
---
> if (!allocate_counter(ctr_arc, nr_events, 0, unavailable_counters,
> counter_map)) {