[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200227080805.GA34774@krava>
Date: Thu, 27 Feb 2020 09:08:05 +0100
From: Jiri Olsa <jolsa@...hat.com>
To: Martin KaFai Lau <kafai@...com>
Cc: Jiri Olsa <jolsa@...nel.org>, Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>, netdev@...r.kernel.org,
bpf@...r.kernel.org, Andrii Nakryiko <andriin@...com>,
Yonghong Song <yhs@...com>, Song Liu <songliubraving@...com>,
Jakub Kicinski <kuba@...nel.org>,
David Miller <davem@...hat.com>,
Björn Töpel <bjorn.topel@...el.com>,
John Fastabend <john.fastabend@...il.com>,
Jesper Dangaard Brouer <hawk@...nel.org>,
Arnaldo Carvalho de Melo <acme@...hat.com>
Subject: Re: [PATCH 12/18] bpf: Add trampolines to kallsyms
On Wed, Feb 26, 2020 at 10:26:40PM -0800, Martin KaFai Lau wrote:
SNIP
> > + ksym->start = (unsigned long) data;
> > + ksym->end = ksym->start + BPF_IMAGE_SIZE;
> > + bpf_ksym_add(ksym);
> > + perf_event_ksymbol(PERF_RECORD_KSYMBOL_TYPE_BPF, ksym->start,
> > + BPF_IMAGE_SIZE, false, ksym->name);
> > +}
> > +
> > +void bpf_image_ksym_del(struct bpf_ksym *ksym)
> > +{
> > + bpf_ksym_del(ksym);
> > + perf_event_ksymbol(PERF_RECORD_KSYMBOL_TYPE_BPF, ksym->start,
> > + BPF_IMAGE_SIZE, true, ksym->name);
> > +}
> > +
> > struct bpf_trampoline *bpf_trampoline_lookup(u64 key)
> > {
> > struct bpf_trampoline *tr;
> > @@ -131,6 +148,7 @@ struct bpf_trampoline *bpf_trampoline_lookup(u64 key)
> > for (i = 0; i < BPF_TRAMP_MAX; i++)
> > INIT_HLIST_HEAD(&tr->progs_hlist[i]);
> > tr->image = image;
> > + INIT_LIST_HEAD_RCU(&tr->ksym.lnode);
> > out:
> > mutex_unlock(&trampoline_mutex);
> > return tr;
> > @@ -267,6 +285,14 @@ static enum bpf_tramp_prog_type bpf_attach_type_to_tramp(enum bpf_attach_type t)
> > }
> > }
> >
> > +static void bpf_trampoline_ksym_add(struct bpf_trampoline *tr)
> > +{
> > + struct bpf_ksym *ksym = &tr->ksym;
> > +
> > + snprintf(ksym->name, KSYM_NAME_LEN, "bpf_trampoline_%llu", tr->key);
> Do you have plan to support struct_ops which is also using
> trampoline (in bpf_struct_ops_map_update_elem())?
> Any idea on the name? bpf_struct_ops_<map_id>?
right, I was wondering we should also do that,
I'll check on it
jirka
Powered by blists - more mailing lists