From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexei Starovoitov Subject: Re: [PATCH bpf-next 1/3] perf/core: introduce perf_event_mmap_bpf_prog Date: Thu, 20 Sep 2018 00:53:02 +0000 Message-ID: <847ab103-da9f-64e7-67fa-1a29deeb6d28@fb.com> References: <20180919223935.999270-1-ast@kernel.org> <20180919223935.999270-2-ast@kernel.org> <4DBB524C-09B1-46BD-A56E-1E372E87F2E8@fb.com> Mime-Version: 1.0 Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable Cc: "David S . Miller" , "daniel@iogearbox.net" , "peterz@infradead.org" , "acme@kernel.org" , "netdev@vger.kernel.org" , Kernel Team To: Song Liu , Alexei Starovoitov Return-path: Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:48360 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727632AbeITGeU (ORCPT ); Thu, 20 Sep 2018 02:34:20 -0400 In-Reply-To: <4DBB524C-09B1-46BD-A56E-1E372E87F2E8@fb.com> Content-Language: en-US Content-ID: Sender: netdev-owner@vger.kernel.org List-ID: On 9/19/18 4:30 PM, Song Liu wrote: > > >> On Sep 19, 2018, at 3:39 PM, Alexei Starovoitov wrote: >> >> introduce perf_event_mmap_bpf_prog() helper to emit RECORD_MMAP events >> into perf ring buffer. >> It's used by bpf load/unload logic to notify user space of addresses >> and names of JITed bpf programs. >> >> Note that event->mmap.pid =3D=3D -1 is an existing indicator of kernel e= vent. >> In addition use event->mmap.tid =3D=3D BPF_FS_MAGIC to indicate bpf rela= ted >> RECORD_MMAP event. >> >> Alternatively it's possible to introduce new 'enum perf_event_type' comm= and >> specificially for bpf prog load/unload, but existing RECORD_MMAP >> is very close, so the choice made by this patch is to extend it. >> >> Signed-off-by: Alexei Starovoitov > > Acked-by: Song Liu > > I guess we should also use this for kernel modules load/unload? yes. that's possible. There is similar issue with modules today that get unloaded before 'perf report'. Synthetic record_mmap for modules that perf emits into perf.data has filename=3D=3Dmodule_name. It solves typical use case though. We can extend record_mmap further and let kernel emit them for module load/unload. Some new magic for 'tid' would be necessary.