We add ksymbol map into machine->kmaps, so it needs to be
created as 'struct kmap', which is dependent on its dso
having kernel type.
Reported-by: Ravi Bangoria <[email protected]>
Tested-by: Ravi Bangoria <[email protected]>
Signed-off-by: Jiri Olsa <[email protected]>
---
tools/perf/util/machine.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
index e3e5490f6de5..0a43dc83d7b2 100644
--- a/tools/perf/util/machine.c
+++ b/tools/perf/util/machine.c
@@ -727,8 +727,14 @@ static int machine__process_ksymbol_register(struct machine *machine,
struct map *map = maps__find(&machine->kmaps, event->ksymbol.addr);
if (!map) {
- map = dso__new_map(event->ksymbol.name);
- if (!map)
+ struct dso *dso = dso__new(event->ksymbol.name);
+
+ if (dso) {
+ dso->kernel = DSO_TYPE_KERNEL;
+ map = map__new2(0, dso);
+ }
+
+ if (!dso || !map)
return -ENOMEM;
map->start = event->ksymbol.addr;
--
2.24.1
Em Mon, Feb 10, 2020 at 03:32:16PM +0100, Jiri Olsa escreveu:
> We add ksymbol map into machine->kmaps, so it needs to be
> created as 'struct kmap', which is dependent on its dso
> having kernel type.
>
> Reported-by: Ravi Bangoria <[email protected]>
> Tested-by: Ravi Bangoria <[email protected]>
> Signed-off-by: Jiri Olsa <[email protected]>
> ---
> tools/perf/util/machine.c | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
> index e3e5490f6de5..0a43dc83d7b2 100644
> --- a/tools/perf/util/machine.c
> +++ b/tools/perf/util/machine.c
> @@ -727,8 +727,14 @@ static int machine__process_ksymbol_register(struct machine *machine,
> struct map *map = maps__find(&machine->kmaps, event->ksymbol.addr);
>
> if (!map) {
> - map = dso__new_map(event->ksymbol.name);
> - if (!map)
> + struct dso *dso = dso__new(event->ksymbol.name);
> +
> + if (dso) {
> + dso->kernel = DSO_TYPE_KERNEL;
> + map = map__new2(0, dso);
> + }
> +
> + if (!dso || !map)
We leak dso if map creation fails?
- Arnaldo
> return -ENOMEM;
>
> map->start = event->ksymbol.addr;
> --
> 2.24.1
>
--
- Arnaldo
On Mon, Feb 10, 2020 at 12:17:59PM -0300, Arnaldo Carvalho de Melo wrote:
> Em Mon, Feb 10, 2020 at 03:32:16PM +0100, Jiri Olsa escreveu:
> > We add ksymbol map into machine->kmaps, so it needs to be
> > created as 'struct kmap', which is dependent on its dso
> > having kernel type.
> >
> > Reported-by: Ravi Bangoria <[email protected]>
> > Tested-by: Ravi Bangoria <[email protected]>
> > Signed-off-by: Jiri Olsa <[email protected]>
> > ---
> > tools/perf/util/machine.c | 10 ++++++++--
> > 1 file changed, 8 insertions(+), 2 deletions(-)
> >
> > diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
> > index e3e5490f6de5..0a43dc83d7b2 100644
> > --- a/tools/perf/util/machine.c
> > +++ b/tools/perf/util/machine.c
> > @@ -727,8 +727,14 @@ static int machine__process_ksymbol_register(struct machine *machine,
> > struct map *map = maps__find(&machine->kmaps, event->ksymbol.addr);
> >
> > if (!map) {
> > - map = dso__new_map(event->ksymbol.name);
> > - if (!map)
> > + struct dso *dso = dso__new(event->ksymbol.name);
> > +
> > + if (dso) {
> > + dso->kernel = DSO_TYPE_KERNEL;
> > + map = map__new2(0, dso);
> > + }
> > +
> > + if (!dso || !map)
>
> We leak dso if map creation fails?
yep :-\ will post v2
thanks,
jirka
>
>
> - Arnaldo
>
> > return -ENOMEM;
> >
> > map->start = event->ksymbol.addr;
> > --
> > 2.24.1
> >
>
> --
>
> - Arnaldo
>
Em Mon, Feb 10, 2020 at 04:25:37PM +0100, Jiri Olsa escreveu:
> On Mon, Feb 10, 2020 at 12:17:59PM -0300, Arnaldo Carvalho de Melo wrote:
> > Em Mon, Feb 10, 2020 at 03:32:16PM +0100, Jiri Olsa escreveu:
> > > We add ksymbol map into machine->kmaps, so it needs to be
> > > created as 'struct kmap', which is dependent on its dso
> > > having kernel type.
> > >
> > > Reported-by: Ravi Bangoria <[email protected]>
> > > Tested-by: Ravi Bangoria <[email protected]>
> > > Signed-off-by: Jiri Olsa <[email protected]>
> > > ---
> > > tools/perf/util/machine.c | 10 ++++++++--
> > > 1 file changed, 8 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
> > > index e3e5490f6de5..0a43dc83d7b2 100644
> > > --- a/tools/perf/util/machine.c
> > > +++ b/tools/perf/util/machine.c
> > > @@ -727,8 +727,14 @@ static int machine__process_ksymbol_register(struct machine *machine,
> > > struct map *map = maps__find(&machine->kmaps, event->ksymbol.addr);
> > >
> > > if (!map) {
> > > - map = dso__new_map(event->ksymbol.name);
> > > - if (!map)
> > > + struct dso *dso = dso__new(event->ksymbol.name);
> > > +
> > > + if (dso) {
> > > + dso->kernel = DSO_TYPE_KERNEL;
> > > + map = map__new2(0, dso);
> > > + }
> > > +
> > > + if (!dso || !map)
> >
> > We leak dso if map creation fails?
>
> yep :-\ will post v2
Please collect Kim's Tested-by then,
- Arnaldo
> thanks,
> jirka
>
> >
> >
> > - Arnaldo
> >
> > > return -ENOMEM;
> > >
> > > map->start = event->ksymbol.addr;
> > > --
> > > 2.24.1
> > >
> >
> > --
> >
> > - Arnaldo
> >
>
--
- Arnaldo
On Mon, Feb 10, 2020 at 04:25:37PM +0100, Jiri Olsa wrote:
> On Mon, Feb 10, 2020 at 12:17:59PM -0300, Arnaldo Carvalho de Melo wrote:
> > Em Mon, Feb 10, 2020 at 03:32:16PM +0100, Jiri Olsa escreveu:
> > > We add ksymbol map into machine->kmaps, so it needs to be
> > > created as 'struct kmap', which is dependent on its dso
> > > having kernel type.
> > >
> > > Reported-by: Ravi Bangoria <[email protected]>
> > > Tested-by: Ravi Bangoria <[email protected]>
> > > Signed-off-by: Jiri Olsa <[email protected]>
> > > ---
> > > tools/perf/util/machine.c | 10 ++++++++--
> > > 1 file changed, 8 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
> > > index e3e5490f6de5..0a43dc83d7b2 100644
> > > --- a/tools/perf/util/machine.c
> > > +++ b/tools/perf/util/machine.c
> > > @@ -727,8 +727,14 @@ static int machine__process_ksymbol_register(struct machine *machine,
> > > struct map *map = maps__find(&machine->kmaps, event->ksymbol.addr);
> > >
> > > if (!map) {
> > > - map = dso__new_map(event->ksymbol.name);
> > > - if (!map)
> > > + struct dso *dso = dso__new(event->ksymbol.name);
> > > +
> > > + if (dso) {
> > > + dso->kernel = DSO_TYPE_KERNEL;
> > > + map = map__new2(0, dso);
> > > + }
> > > +
> > > + if (!dso || !map)
> >
> > We leak dso if map creation fails?
>
> yep :-\ will post v2
v2 attached, it's also all in my perf/top branch
thanks,
jirka
---
We add ksymbol map into machine->kmaps, so it needs to be
created as 'struct kmap', which is dependent on its dso
having kernel type.
Reported-by: Ravi Bangoria <[email protected]>
Tested-by: Ravi Bangoria <[email protected]>
Signed-off-by: Jiri Olsa <[email protected]>
---
tools/perf/util/machine.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
index e3e5490f6de5..0ad026561c7f 100644
--- a/tools/perf/util/machine.c
+++ b/tools/perf/util/machine.c
@@ -727,9 +727,17 @@ static int machine__process_ksymbol_register(struct machine *machine,
struct map *map = maps__find(&machine->kmaps, event->ksymbol.addr);
if (!map) {
- map = dso__new_map(event->ksymbol.name);
- if (!map)
+ struct dso *dso = dso__new(event->ksymbol.name);
+
+ if (dso) {
+ dso->kernel = DSO_TYPE_KERNEL;
+ map = map__new2(0, dso);
+ }
+
+ if (!dso || !map) {
+ dso__put(dso);
return -ENOMEM;
+ }
map->start = event->ksymbol.addr;
map->end = map->start + event->ksymbol.len;
--
2.24.1
On Mon, Feb 10, 2020 at 04:58:01PM -0300, Arnaldo Carvalho de Melo wrote:
> Em Mon, Feb 10, 2020 at 04:25:37PM +0100, Jiri Olsa escreveu:
> > On Mon, Feb 10, 2020 at 12:17:59PM -0300, Arnaldo Carvalho de Melo wrote:
> > > Em Mon, Feb 10, 2020 at 03:32:16PM +0100, Jiri Olsa escreveu:
> > > > We add ksymbol map into machine->kmaps, so it needs to be
> > > > created as 'struct kmap', which is dependent on its dso
> > > > having kernel type.
> > > >
> > > > Reported-by: Ravi Bangoria <[email protected]>
> > > > Tested-by: Ravi Bangoria <[email protected]>
> > > > Signed-off-by: Jiri Olsa <[email protected]>
> > > > ---
> > > > tools/perf/util/machine.c | 10 ++++++++--
> > > > 1 file changed, 8 insertions(+), 2 deletions(-)
> > > >
> > > > diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
> > > > index e3e5490f6de5..0a43dc83d7b2 100644
> > > > --- a/tools/perf/util/machine.c
> > > > +++ b/tools/perf/util/machine.c
> > > > @@ -727,8 +727,14 @@ static int machine__process_ksymbol_register(struct machine *machine,
> > > > struct map *map = maps__find(&machine->kmaps, event->ksymbol.addr);
> > > >
> > > > if (!map) {
> > > > - map = dso__new_map(event->ksymbol.name);
> > > > - if (!map)
> > > > + struct dso *dso = dso__new(event->ksymbol.name);
> > > > +
> > > > + if (dso) {
> > > > + dso->kernel = DSO_TYPE_KERNEL;
> > > > + map = map__new2(0, dso);
> > > > + }
> > > > +
> > > > + if (!dso || !map)
> > >
> > > We leak dso if map creation fails?
> >
> > yep :-\ will post v2
>
> Please collect Kim's Tested-by then,
oops, did not notice, I updated commits with them in the perf/top branch
jirka
>
> - Arnaldo
>
> > thanks,
> > jirka
> >
> > >
> > >
> > > - Arnaldo
> > >
> > > > return -ENOMEM;
> > > >
> > > > map->start = event->ksymbol.addr;
> > > > --
> > > > 2.24.1
> > > >
> > >
> > > --
> > >
> > > - Arnaldo
> > >
> >
>
> --
>
> - Arnaldo
>
Em Mon, Feb 10, 2020 at 09:08:47PM +0100, Jiri Olsa escreveu:
> On Mon, Feb 10, 2020 at 04:25:37PM +0100, Jiri Olsa wrote:
> > On Mon, Feb 10, 2020 at 12:17:59PM -0300, Arnaldo Carvalho de Melo wrote:
> > > Em Mon, Feb 10, 2020 at 03:32:16PM +0100, Jiri Olsa escreveu:
> > > > We add ksymbol map into machine->kmaps, so it needs to be
> > > > created as 'struct kmap', which is dependent on its dso
> > > > having kernel type.
> > > >
> > > > Reported-by: Ravi Bangoria <[email protected]>
> > > > Tested-by: Ravi Bangoria <[email protected]>
> > > > Signed-off-by: Jiri Olsa <[email protected]>
> > > > ---
> > > > tools/perf/util/machine.c | 10 ++++++++--
> > > > 1 file changed, 8 insertions(+), 2 deletions(-)
> > > >
> > > > diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
> > > > index e3e5490f6de5..0a43dc83d7b2 100644
> > > > --- a/tools/perf/util/machine.c
> > > > +++ b/tools/perf/util/machine.c
> > > > @@ -727,8 +727,14 @@ static int machine__process_ksymbol_register(struct machine *machine,
> > > > struct map *map = maps__find(&machine->kmaps, event->ksymbol.addr);
> > > >
> > > > if (!map) {
> > > > - map = dso__new_map(event->ksymbol.name);
> > > > - if (!map)
> > > > + struct dso *dso = dso__new(event->ksymbol.name);
> > > > +
> > > > + if (dso) {
> > > > + dso->kernel = DSO_TYPE_KERNEL;
> > > > + map = map__new2(0, dso);
> > > > + }
> > > > +
> > > > + if (!dso || !map)
> > >
> > > We leak dso if map creation fails?
> >
> > yep :-\ will post v2
>
> v2 attached, it's also all in my perf/top branch
Thanks for fixing it, will process it into my perf/urgent branch.
- Arnaldo
> thanks,
> jirka
>
>
> ---
> We add ksymbol map into machine->kmaps, so it needs to be
> created as 'struct kmap', which is dependent on its dso
> having kernel type.
>
> Reported-by: Ravi Bangoria <[email protected]>
> Tested-by: Ravi Bangoria <[email protected]>
> Signed-off-by: Jiri Olsa <[email protected]>
> ---
> tools/perf/util/machine.c | 12 ++++++++++--
> 1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
> index e3e5490f6de5..0ad026561c7f 100644
> --- a/tools/perf/util/machine.c
> +++ b/tools/perf/util/machine.c
> @@ -727,9 +727,17 @@ static int machine__process_ksymbol_register(struct machine *machine,
> struct map *map = maps__find(&machine->kmaps, event->ksymbol.addr);
>
> if (!map) {
> - map = dso__new_map(event->ksymbol.name);
> - if (!map)
> + struct dso *dso = dso__new(event->ksymbol.name);
> +
> + if (dso) {
> + dso->kernel = DSO_TYPE_KERNEL;
> + map = map__new2(0, dso);
> + }
> +
> + if (!dso || !map) {
> + dso__put(dso);
> return -ENOMEM;
> + }
>
> map->start = event->ksymbol.addr;
> map->end = map->start + event->ksymbol.len;
> --
> 2.24.1
>
--
- Arnaldo
The following commit has been merged into the perf/urgent branch of tip:
Commit-ID: 4a4eb6154d67f7766cc7eb74e9f1db424073e832
Gitweb: https://git.kernel.org/tip/4a4eb6154d67f7766cc7eb74e9f1db424073e832
Author: Jiri Olsa <[email protected]>
AuthorDate: Mon, 10 Feb 2020 21:08:47 +01:00
Committer: Arnaldo Carvalho de Melo <[email protected]>
CommitterDate: Tue, 11 Feb 2020 16:41:49 -03:00
perf maps: Mark ksymbol DSOs with kernel type
We add ksymbol map into machine->kmaps, so it needs to be created as
'struct kmap', which is dependent on its dso having kernel type.
Reported-by: Ravi Bangoria <[email protected]>
Signed-off-by: Jiri Olsa <[email protected]>
Tested-by: Ravi Bangoria <[email protected]>
Tested-by: Kim Phillips <[email protected]>
Cc: Alexander Shishkin <[email protected]>
Cc: Michael Petlan <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Link: http://lore.kernel.org/lkml/20200210200847.GA36715@krava
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
---
tools/perf/util/machine.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
index e3e5490..0ad0265 100644
--- a/tools/perf/util/machine.c
+++ b/tools/perf/util/machine.c
@@ -727,9 +727,17 @@ static int machine__process_ksymbol_register(struct machine *machine,
struct map *map = maps__find(&machine->kmaps, event->ksymbol.addr);
if (!map) {
- map = dso__new_map(event->ksymbol.name);
- if (!map)
+ struct dso *dso = dso__new(event->ksymbol.name);
+
+ if (dso) {
+ dso->kernel = DSO_TYPE_KERNEL;
+ map = map__new2(0, dso);
+ }
+
+ if (!dso || !map) {
+ dso__put(dso);
return -ENOMEM;
+ }
map->start = event->ksymbol.addr;
map->end = map->start + event->ksymbol.len;