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] [day] [month] [year] [list]
Message-ID: <3CC5A7C5-C417-46D4-8B09-4BD1A2CE3A96@fb.com>
Date:   Tue, 5 Mar 2019 20:37:17 +0000
From:   Song Liu <songliubraving@...com>
To:     Jiri Olsa <jolsa@...hat.com>
CC:     Networking <netdev@...r.kernel.org>,
        linux-kernel <linux-kernel@...r.kernel.org>,
        Alexei Starovoitov <ast@...nel.org>,
        "Daniel Borkmann" <daniel@...earbox.net>,
        Kernel Team <Kernel-team@...com>,
        "Peter Zijlstra" <peterz@...radead.org>,
        Arnaldo Carvalho de Melo <acme@...hat.com>,
        "jolsa@...nel.org" <jolsa@...nel.org>,
        "namhyung@...nel.org" <namhyung@...nel.org>
Subject: Re: [PATCH v4 perf,bpf 14/15] perf: introduce side band thread



> On Mar 5, 2019, at 3:03 AM, Jiri Olsa <jolsa@...hat.com> wrote:
> 
> On Mon, Mar 04, 2019 at 09:40:07PM +0000, Song Liu wrote:
>> 
>> 
>>> On Feb 27, 2019, at 5:21 AM, Jiri Olsa <jolsa@...hat.com> wrote:
>>> 
>>> On Mon, Feb 25, 2019 at 04:20:18PM -0800, Song Liu wrote:
>>> 
>>> SNIP
>>> 
>>>> diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
>>>> index 8c902276d4b4..61b87c8111e6 100644
>>>> --- a/tools/perf/util/evlist.c
>>>> +++ b/tools/perf/util/evlist.c
>>>> @@ -19,6 +19,7 @@
>>>> #include "debug.h"
>>>> #include "units.h"
>>>> #include "asm/bug.h"
>>>> +#include "bpf-event.h"
>>>> #include <signal.h>
>>>> #include <unistd.h>
>>>> 
>>>> @@ -1841,3 +1842,102 @@ struct perf_evsel *perf_evlist__reset_weak_group(struct perf_evlist *evsel_list,
>>>> 	}
>>>> 	return leader;
>>>> }
>>>> +
>>>> +static struct perf_evlist *sb_evlist;
>>>> +pthread_t poll_thread;
>>> 
>>> so some of the things are static and some like poll_args
>>> you alloced on the stack.. I dont like this interface,
>>> could we come up with something generic? perhaps
>>> encapsulated in perf_evlist, like:
>>> 
>>> struct perf_evlist {
>>> 	...
>>> 	struct {
>>> 		pthread_t	th;
>>> 		int		state;
>>> 	} thread;
>>> };
>>> 
>>> typedef int (perf_evlist__thread_cb_t)(perf_evlist, union perf_event *event,....)
>>> 
>>> perf_evlist__start_thread(perf_evlist, perf_evlist__thread_cb_t cb);
>>> perf_evlist__stop_thread(perf_evlist);
>>> 
>>> 
>>> jirka
>> 
>> More questions on this proposal: 
>> 
>> IIUC, this approach creates one perf_evlist and one thread for each side band
>> event (only bpf for now, more afterwards). Each of these perf_evlists will 
>> create its own ring buffer. 
>> 
>> On the other hand, current patch allows different events to share the thread, 
>> the perf_evlist, and the ring buffer. 
> 
> you can have those events in single evlist no?
> 
>> 
>> If my understanding is correct, current patch would be more efficient down the 
>> road? Did I miss some downsides of current patch?
> 
> I'd just like something configurable and with single handle
> not scattered around the code, so it's easy to add new callback 
> 
> jirka

To make adding callbacks easy, we need to register callback per perf_evsel, so 
multiple side band events could share the perf_evlist. It will be something like:

typedef int (perf_evsel__sb_cb_t)(union perf_event *event, void *data);

struct perf_evsel {
	...
	struct {
		perf_evsel__sb_cb_t *cb;
		void *data;
	} side_band;
};

perf_evlist__add_sb_event(struct perf_evlist *evlist, 
			  struct perf_event_attr *attr, 
			  perf_evsel__sb_cb_t cb, 
			  void *data);
perf_evlist__start_sb_evlist(struct perf_evlist *evlist);
perf_evlist__stop_sb_evlist(struct perf_evlist *evlist);


Does this look like a good approach?

Thanks,
Song

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ