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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAM9d7ciEEVHFxM-Jffet5xsmY1skF+jqPAuPHGy4T=Lr9TEXZA@mail.gmail.com>
Date:	Fri, 26 Dec 2014 10:55:54 +0900
From:	Namhyung Kim <namhyung@...nel.org>
To:	Jiri Olsa <jolsa@...hat.com>
Cc:	Arnaldo Carvalho de Melo <acme@...nel.org>,
	Ingo Molnar <mingo@...nel.org>,
	Peter Zijlstra <a.p.zijlstra@...llo.nl>,
	LKML <linux-kernel@...r.kernel.org>,
	David Ahern <dsahern@...il.com>,
	Stephane Eranian <eranian@...gle.com>,
	Adrian Hunter <adrian.hunter@...el.com>,
	Andi Kleen <andi@...stfloor.org>,
	Frederic Weisbecker <fweisbec@...il.com>
Subject: Re: [PATCH 05/37] perf tools: Create separate mmap for dummy tracking event

On Fri, Dec 26, 2014 at 7:09 AM, Jiri Olsa <jolsa@...hat.com> wrote:
> On Wed, Dec 24, 2014 at 04:15:01PM +0900, Namhyung Kim wrote:
>
> SNIP
>
>>
>>  union perf_event *perf_evlist__mmap_read(struct perf_evlist *evlist, int idx);
>> -
>>  void perf_evlist__mmap_consume(struct perf_evlist *evlist, int idx);
>> +struct perf_mmap *perf_evlist__mmap_desc(struct perf_evlist *evlist, int idx);
>>
>>  int perf_evlist__open(struct perf_evlist *evlist);
>>  void perf_evlist__close(struct perf_evlist *evlist);
>> @@ -211,6 +214,12 @@ bool perf_evlist__can_select_event(struct perf_evlist *evlist, const char *str);
>>  void perf_evlist__to_front(struct perf_evlist *evlist,
>>                          struct perf_evsel *move_evsel);
>>
>> +/* convert from/to negative idx for track mmaps */
>> +static inline int track_mmap_idx(int idx)
>> +{
>> +     return -idx - 1;
>> +}
>
> hum, whats the logic with negative numbers in here?
> you still access track_mmap array with this index no?

For each index (per-cpu or per-task depends on user input), it now has
two mmaps - one for normal (sampling) mmap and another for track
(metadata) mmap.  So I wanted to distinguish them by using positive
and negative number.  But simply changing the sign did not work due to
0 index.  And the subtracting by 1 works nicely for both direction.

0 => -1 => 0
1 => -2 => 1
2 => -3 => 2
3 => -4 => 3

So when it sees a negative index, it'll convert it using
track_mmap_idx() to get a matching (track) mmap.

Thanks,
Namhyung
--
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