All of lore.kernel.org
 help / color / mirror / Atom feed
* [bug report][stable] perf probe: failed to add events
@ 2019-02-26  7:31 Joseph Qi
  2019-02-26  9:05 ` Greg KH
  0 siblings, 1 reply; 16+ messages in thread
From: Joseph Qi @ 2019-02-26  7:31 UTC (permalink / raw)
  To: linux-kernel, gregkh, luto; +Cc: Jiufei Xue, Xu Yu, peterz, mingo, acme

Hi,

I'm using kernel v4.19.24 and have found that there is an issue when
using perf probe to define a new dynamic tracepoint.

$ perf probe -a handle_mm_fault
Failed to write event: Numerical result out of range
  Error: Failed to add events.

I've also tried kernel v4.20, and it can pass.

So I've bisected and finally found the first good commit is:
bf904d2762ee x86/pti/64: Remove the SYSCALL64 entry trampoline
which is based on another commit:
98f05b5138f0 Use the TSS sp2 slot for SYSCALL/SYSRET scratch space

Once I've backpoted these two commits into 4.19.24, the above case can
pass, though I'm not sure how it is fixed.
So is there any plan to let them go into stable as well?

Thanks,
Joseph

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [bug report][stable] perf probe: failed to add events
  2019-02-26  7:31 [bug report][stable] perf probe: failed to add events Joseph Qi
@ 2019-02-26  9:05 ` Greg KH
  2019-02-26 12:32   ` Joseph Qi
  0 siblings, 1 reply; 16+ messages in thread
From: Greg KH @ 2019-02-26  9:05 UTC (permalink / raw)
  To: Joseph Qi; +Cc: linux-kernel, luto, Jiufei Xue, Xu Yu, peterz, mingo, acme

On Tue, Feb 26, 2019 at 03:31:14PM +0800, Joseph Qi wrote:
> Hi,
> 
> I'm using kernel v4.19.24 and have found that there is an issue when
> using perf probe to define a new dynamic tracepoint.
> 
> $ perf probe -a handle_mm_fault
> Failed to write event: Numerical result out of range
>   Error: Failed to add events.
> 
> I've also tried kernel v4.20, and it can pass.

Ick, has this ever worked on the 4.19 stable tree?  If so, any chance
you can run 'git bisect' to find the offending commit?

> So I've bisected and finally found the first good commit is:
> bf904d2762ee x86/pti/64: Remove the SYSCALL64 entry trampoline
> which is based on another commit:
> 98f05b5138f0 Use the TSS sp2 slot for SYSCALL/SYSRET scratch space
> 
> Once I've backpoted these two commits into 4.19.24, the above case can
> pass, though I'm not sure how it is fixed.
> So is there any plan to let them go into stable as well?

If they are needed, I'll gladly queue them up, but this feels like
something might have broken, so it should be easier to just revert the
offending commit instead.

Andy, any ideas?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [bug report][stable] perf probe: failed to add events
  2019-02-26  9:05 ` Greg KH
@ 2019-02-26 12:32   ` Joseph Qi
  2019-02-26 13:08     ` Greg KH
  0 siblings, 1 reply; 16+ messages in thread
From: Joseph Qi @ 2019-02-26 12:32 UTC (permalink / raw)
  To: Greg KH; +Cc: linux-kernel, luto, Jiufei Xue, Xu Yu, peterz, mingo, acme



On 19/2/26 17:05, Greg KH wrote:
> On Tue, Feb 26, 2019 at 03:31:14PM +0800, Joseph Qi wrote:
>> Hi,
>>
>> I'm using kernel v4.19.24 and have found that there is an issue when
>> using perf probe to define a new dynamic tracepoint.
>>
>> $ perf probe -a handle_mm_fault
>> Failed to write event: Numerical result out of range
>>   Error: Failed to add events.
>>
>> I've also tried kernel v4.20, and it can pass.
> 
> Ick, has this ever worked on the 4.19 stable tree?  If so, any chance
> you can run 'git bisect' to find the offending commit?
> 
From my test, v4.19.0 also has this issue.
Bisect locates that it is introduced by commit bf904d2762ee
"x86/pti/64: Remove the SYSCALL64 entry trampoline".

Thanks,
Joseph

>> So I've bisected and finally found the first good commit is:
>> bf904d2762ee x86/pti/64: Remove the SYSCALL64 entry trampoline
>> which is based on another commit:
>> 98f05b5138f0 Use the TSS sp2 slot for SYSCALL/SYSRET scratch space
>>
>> Once I've backpoted these two commits into 4.19.24, the above case can
>> pass, though I'm not sure how it is fixed.
>> So is there any plan to let them go into stable as well?
> 
> If they are needed, I'll gladly queue them up, but this feels like
> something might have broken, so it should be easier to just revert the
> offending commit instead.
> 
> Andy, any ideas?
> 
> thanks,
> 
> greg k-h
> 

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [bug report][stable] perf probe: failed to add events
  2019-02-26 12:32   ` Joseph Qi
@ 2019-02-26 13:08     ` Greg KH
  2019-02-26 14:20       ` Arnaldo Carvalho de Melo
  2019-02-27  1:53       ` Joseph Qi
  0 siblings, 2 replies; 16+ messages in thread
From: Greg KH @ 2019-02-26 13:08 UTC (permalink / raw)
  To: Joseph Qi; +Cc: linux-kernel, luto, Jiufei Xue, Xu Yu, peterz, mingo, acme

On Tue, Feb 26, 2019 at 08:32:34PM +0800, Joseph Qi wrote:
> 
> 
> On 19/2/26 17:05, Greg KH wrote:
> > On Tue, Feb 26, 2019 at 03:31:14PM +0800, Joseph Qi wrote:
> >> Hi,
> >>
> >> I'm using kernel v4.19.24 and have found that there is an issue when
> >> using perf probe to define a new dynamic tracepoint.
> >>
> >> $ perf probe -a handle_mm_fault
> >> Failed to write event: Numerical result out of range
> >>   Error: Failed to add events.
> >>
> >> I've also tried kernel v4.20, and it can pass.
> > 
> > Ick, has this ever worked on the 4.19 stable tree?  If so, any chance
> > you can run 'git bisect' to find the offending commit?
> > 
> >From my test, v4.19.0 also has this issue.
> Bisect locates that it is introduced by commit bf904d2762ee
> "x86/pti/64: Remove the SYSCALL64 entry trampoline".

But that commit was in 4.20, not 4.19.  So if this never worked, it's
not a regression?

confused,

greg k-h

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [bug report][stable] perf probe: failed to add events
  2019-02-26 13:08     ` Greg KH
@ 2019-02-26 14:20       ` Arnaldo Carvalho de Melo
  2019-02-27 12:39         ` Adrian Hunter
  2019-02-27  1:53       ` Joseph Qi
  1 sibling, 1 reply; 16+ messages in thread
From: Arnaldo Carvalho de Melo @ 2019-02-26 14:20 UTC (permalink / raw)
  To: Adrian Hunter, Alexander Shishkin
  Cc: Greg KH, Joseph Qi, linux-kernel, luto, Jiufei Xue, Xu Yu, peterz, mingo

Em Tue, Feb 26, 2019 at 02:08:02PM +0100, Greg KH escreveu:
> On Tue, Feb 26, 2019 at 08:32:34PM +0800, Joseph Qi wrote:
> > 
> > 
> > On 19/2/26 17:05, Greg KH wrote:
> > > On Tue, Feb 26, 2019 at 03:31:14PM +0800, Joseph Qi wrote:
> > >> Hi,
> > >>
> > >> I'm using kernel v4.19.24 and have found that there is an issue when
> > >> using perf probe to define a new dynamic tracepoint.
> > >>
> > >> $ perf probe -a handle_mm_fault
> > >> Failed to write event: Numerical result out of range
> > >>   Error: Failed to add events.
> > >>
> > >> I've also tried kernel v4.20, and it can pass.
> > > 
> > > Ick, has this ever worked on the 4.19 stable tree?  If so, any chance
> > > you can run 'git bisect' to find the offending commit?
> > > 
> > >From my test, v4.19.0 also has this issue.
> > Bisect locates that it is introduced by commit bf904d2762ee
> > "x86/pti/64: Remove the SYSCALL64 entry trampoline".
> 
> But that commit was in 4.20, not 4.19.  So if this never worked, it's
> not a regression?
> 
> confused,

Adrian, Ideas?

- Arnaldo

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [bug report][stable] perf probe: failed to add events
  2019-02-26 13:08     ` Greg KH
  2019-02-26 14:20       ` Arnaldo Carvalho de Melo
@ 2019-02-27  1:53       ` Joseph Qi
  1 sibling, 0 replies; 16+ messages in thread
From: Joseph Qi @ 2019-02-27  1:53 UTC (permalink / raw)
  To: Greg KH; +Cc: linux-kernel, luto, Jiufei Xue, Xu Yu, peterz, mingo, acme



On 19/2/26 21:08, Greg KH wrote:
> On Tue, Feb 26, 2019 at 08:32:34PM +0800, Joseph Qi wrote:
>>
>>
>> On 19/2/26 17:05, Greg KH wrote:
>>> On Tue, Feb 26, 2019 at 03:31:14PM +0800, Joseph Qi wrote:
>>>> Hi,
>>>>
>>>> I'm using kernel v4.19.24 and have found that there is an issue when
>>>> using perf probe to define a new dynamic tracepoint.
>>>>
>>>> $ perf probe -a handle_mm_fault
>>>> Failed to write event: Numerical result out of range
>>>>   Error: Failed to add events.
>>>>
>>>> I've also tried kernel v4.20, and it can pass.
>>>
>>> Ick, has this ever worked on the 4.19 stable tree?  If so, any chance
>>> you can run 'git bisect' to find the offending commit?
>>>
>> >From my test, v4.19.0 also has this issue.
>> Bisect locates that it is introduced by commit bf904d2762ee
>> "x86/pti/64: Remove the SYSCALL64 entry trampoline".
> 
> But that commit was in 4.20, not 4.19.  So if this never worked, it's
> not a regression?
> 
> confused,
Oops, my fault.
The first bad commit is:
d83212d5dd67 kallsyms, x86: Export addresses of PTI entry trampolines

It is between v4.18 and v4.19.

> 
> greg k-h
> 

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [bug report][stable] perf probe: failed to add events
  2019-02-26 14:20       ` Arnaldo Carvalho de Melo
@ 2019-02-27 12:39         ` Adrian Hunter
  2019-02-28  2:07           ` Joseph Qi
  0 siblings, 1 reply; 16+ messages in thread
From: Adrian Hunter @ 2019-02-27 12:39 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo, Alexander Shishkin
  Cc: Greg KH, Joseph Qi, linux-kernel, luto, Jiufei Xue, Xu Yu, peterz, mingo

On 26/02/19 4:20 PM, Arnaldo Carvalho de Melo wrote:
> Em Tue, Feb 26, 2019 at 02:08:02PM +0100, Greg KH escreveu:
>> On Tue, Feb 26, 2019 at 08:32:34PM +0800, Joseph Qi wrote:
>>>
>>>
>>> On 19/2/26 17:05, Greg KH wrote:
>>>> On Tue, Feb 26, 2019 at 03:31:14PM +0800, Joseph Qi wrote:
>>>>> Hi,
>>>>>
>>>>> I'm using kernel v4.19.24 and have found that there is an issue when
>>>>> using perf probe to define a new dynamic tracepoint.
>>>>>
>>>>> $ perf probe -a handle_mm_fault
>>>>> Failed to write event: Numerical result out of range
>>>>>   Error: Failed to add events.
>>>>>
>>>>> I've also tried kernel v4.20, and it can pass.
>>>>
>>>> Ick, has this ever worked on the 4.19 stable tree?  If so, any chance
>>>> you can run 'git bisect' to find the offending commit?
>>>>
>>> >From my test, v4.19.0 also has this issue.
>>> Bisect locates that it is introduced by commit bf904d2762ee
>>> "x86/pti/64: Remove the SYSCALL64 entry trampoline".
>>
>> But that commit was in 4.20, not 4.19.  So if this never worked, it's
>> not a regression?
>>
>> confused,
> 
> Adrian, Ideas?
> 

Seems to be fixed by this:

From: Adrian Hunter <adrian.hunter@intel.com>
Date: Wed, 27 Feb 2019 05:35:25 +0200
Subject: [PATCH] perf probe: Fix getting the kernel map

Since commit 4d99e4136580 ("perf machine: Workaround missing maps for x86
PTI entry trampolines"), perf tools has been creating more than one kernel
map, however 'perf probe' assumed there could be only one.

Fix by using machine__kernel_map() to get the main kernel map.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Fixes: 4d99e4136580 ("perf machine: Workaround missing maps for x86 PTI entry trampolines")
---
 tools/perf/util/probe-event.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index e86f8be89157..6cd96f9b346d 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -157,8 +157,10 @@ static struct map *kernel_get_module_map(const char *module)
 	if (module && strchr(module, '/'))
 		return dso__new_map(module);
 
-	if (!module)
-		module = "kernel";
+	if (!module) {
+		pos = machine__kernel_map(host_machine);
+		return map__get(pos);
+	}
 
 	for (pos = maps__first(maps); pos; pos = map__next(pos)) {
 		/* short_name is "[module]" */
-- 
2.19.1

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [bug report][stable] perf probe: failed to add events
  2019-02-27 12:39         ` Adrian Hunter
@ 2019-02-28  2:07           ` Joseph Qi
  2019-02-28  7:19             ` Adrian Hunter
  0 siblings, 1 reply; 16+ messages in thread
From: Joseph Qi @ 2019-02-28  2:07 UTC (permalink / raw)
  To: Adrian Hunter, Arnaldo Carvalho de Melo, Alexander Shishkin
  Cc: Greg KH, linux-kernel, luto, Jiufei Xue, Xu Yu, peterz, mingo

Hi Adrian,

On 19/2/27 20:39, Adrian Hunter wrote:
> Seems to be fixed by this:
> 
> From: Adrian Hunter <adrian.hunter@intel.com>
> Date: Wed, 27 Feb 2019 05:35:25 +0200
> Subject: [PATCH] perf probe: Fix getting the kernel map
> 
> Since commit 4d99e4136580 ("perf machine: Workaround missing maps for x86
> PTI entry trampolines"), perf tools has been creating more than one kernel
> map, however 'perf probe' assumed there could be only one.
> 
> Fix by using machine__kernel_map() to get the main kernel map.
> 
> Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
> Fixes: 4d99e4136580 ("perf machine: Workaround missing maps for x86 PTI entry trampolines")

Below is my investigation result before, FYI.
the first bad commit (v4.18 ~ v4.19):
d83212d5dd67 kallsyms, x86: Export addresses of PTI entry trampolines
revert this commit on 4.19.0, it works.
the first good commit again (v4.19 ~ v4.20):
bf904d2762ee x86/pti/64: Remove the SYSCALL64 entry trampoline
backported this commit as well as the related commit 98f05b5138f0 on
v4.19.24, it works.

And I've tested your fix on v4.19.24, it also works.
Tested-by: Joseph Qi <joseph.qi@linux.alibaba.com>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [bug report][stable] perf probe: failed to add events
  2019-02-28  2:07           ` Joseph Qi
@ 2019-02-28  7:19             ` Adrian Hunter
  2019-03-02 10:58               ` Joseph Qi
  2019-03-21 10:10               ` [bug report][stable] perf probe: failed to add events Greg KH
  0 siblings, 2 replies; 16+ messages in thread
From: Adrian Hunter @ 2019-02-28  7:19 UTC (permalink / raw)
  To: Joseph Qi, Arnaldo Carvalho de Melo
  Cc: Alexander Shishkin, Greg KH, linux-kernel, luto, Jiufei Xue,
	Xu Yu, peterz, mingo

On 28/02/19 4:07 AM, Joseph Qi wrote:
> Hi Adrian,
> 
> On 19/2/27 20:39, Adrian Hunter wrote:
>> Seems to be fixed by this:
>>
>> From: Adrian Hunter <adrian.hunter@intel.com>
>> Date: Wed, 27 Feb 2019 05:35:25 +0200
>> Subject: [PATCH] perf probe: Fix getting the kernel map
>>
>> Since commit 4d99e4136580 ("perf machine: Workaround missing maps for x86
>> PTI entry trampolines"), perf tools has been creating more than one kernel
>> map, however 'perf probe' assumed there could be only one.
>>
>> Fix by using machine__kernel_map() to get the main kernel map.
>>
>> Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
>> Fixes: 4d99e4136580 ("perf machine: Workaround missing maps for x86 PTI entry trampolines")
> 
> Below is my investigation result before, FYI.
> the first bad commit (v4.18 ~ v4.19):
> d83212d5dd67 kallsyms, x86: Export addresses of PTI entry trampolines

Yes we should add a fixes tag for that also.

> revert this commit on 4.19.0, it works.
> the first good commit again (v4.19 ~ v4.20):
> bf904d2762ee x86/pti/64: Remove the SYSCALL64 entry trampoline
> backported this commit as well as the related commit 98f05b5138f0 on
> v4.19.24, it works.
> 
> And I've tested your fix on v4.19.24, it also works.
> Tested-by: Joseph Qi <joseph.qi@linux.alibaba.com>
> 


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [bug report][stable] perf probe: failed to add events
  2019-02-28  7:19             ` Adrian Hunter
@ 2019-03-02 10:58               ` Joseph Qi
  2019-03-04 13:13                 ` [PATCH] perf probe: Fix getting the kernel map Adrian Hunter
  2019-03-21 10:10               ` [bug report][stable] perf probe: failed to add events Greg KH
  1 sibling, 1 reply; 16+ messages in thread
From: Joseph Qi @ 2019-03-02 10:58 UTC (permalink / raw)
  To: Adrian Hunter, Arnaldo Carvalho de Melo
  Cc: Alexander Shishkin, Greg KH, linux-kernel, luto, Jiufei Xue,
	Xu Yu, peterz, mingo

Hi Adrian,

On 19/2/28 15:19, Adrian Hunter wrote:
> On 28/02/19 4:07 AM, Joseph Qi wrote:
>> Hi Adrian,
>>
>> On 19/2/27 20:39, Adrian Hunter wrote:
>>> Seems to be fixed by this:
>>>
>>> From: Adrian Hunter <adrian.hunter@intel.com>
>>> Date: Wed, 27 Feb 2019 05:35:25 +0200
>>> Subject: [PATCH] perf probe: Fix getting the kernel map
>>>
>>> Since commit 4d99e4136580 ("perf machine: Workaround missing maps for x86
>>> PTI entry trampolines"), perf tools has been creating more than one kernel
>>> map, however 'perf probe' assumed there could be only one.
>>>
>>> Fix by using machine__kernel_map() to get the main kernel map.
>>>
>>> Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
>>> Fixes: 4d99e4136580 ("perf machine: Workaround missing maps for x86 PTI entry trampolines")
>>
>> Below is my investigation result before, FYI.
>> the first bad commit (v4.18 ~ v4.19):
>> d83212d5dd67 kallsyms, x86: Export addresses of PTI entry trampolines
> 
> Yes we should add a fixes tag for that also.
> 
Have you sent out the patch officially?
I can't find it in the mail list.

Thanks,
Joseph

>> revert this commit on 4.19.0, it works.
>> the first good commit again (v4.19 ~ v4.20):
>> bf904d2762ee x86/pti/64: Remove the SYSCALL64 entry trampoline
>> backported this commit as well as the related commit 98f05b5138f0 on
>> v4.19.24, it works.
>>
>> And I've tested your fix on v4.19.24, it also works.
>> Tested-by: Joseph Qi <joseph.qi@linux.alibaba.com>
>>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH] perf probe: Fix getting the kernel map
  2019-03-02 10:58               ` Joseph Qi
@ 2019-03-04 13:13                 ` Adrian Hunter
  2019-03-08 14:39                   ` Arnaldo Carvalho de Melo
  2019-03-22 22:01                   ` [tip:perf/urgent] " tip-bot for Adrian Hunter
  0 siblings, 2 replies; 16+ messages in thread
From: Adrian Hunter @ 2019-03-04 13:13 UTC (permalink / raw)
  To: Joseph Qi, Arnaldo Carvalho de Melo
  Cc: Alexander Shishkin, Greg KH, linux-kernel, luto, Jiufei Xue,
	Xu Yu, peterz, mingo

Since commit 4d99e4136580 ("perf machine: Workaround missing maps for x86
PTI entry trampolines"), perf tools has been creating more than one kernel
map, however 'perf probe' assumed there could be only one.

Fix by using machine__kernel_map() to get the main kernel map.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Fixes: 4d99e4136580 ("perf machine: Workaround missing maps for x86 PTI entry trampolines")
Fixes: d83212d5dd67 ("kallsyms, x86: Export addresses of PTI entry trampolines")
Tested-by: Joseph Qi <joseph.qi@linux.alibaba.com>
Cc: stable@vger.kernel.org
---
 tools/perf/util/probe-event.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index e86f8be89157..6cd96f9b346d 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -157,8 +157,10 @@ static struct map *kernel_get_module_map(const char *module)
 	if (module && strchr(module, '/'))
 		return dso__new_map(module);
 
-	if (!module)
-		module = "kernel";
+	if (!module) {
+		pos = machine__kernel_map(host_machine);
+		return map__get(pos);
+	}
 
 	for (pos = maps__first(maps); pos; pos = map__next(pos)) {
 		/* short_name is "[module]" */
-- 
2.19.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [PATCH] perf probe: Fix getting the kernel map
  2019-03-04 13:13                 ` [PATCH] perf probe: Fix getting the kernel map Adrian Hunter
@ 2019-03-08 14:39                   ` Arnaldo Carvalho de Melo
  2019-03-11  9:23                     ` Masami Hiramatsu
  2019-03-22 22:01                   ` [tip:perf/urgent] " tip-bot for Adrian Hunter
  1 sibling, 1 reply; 16+ messages in thread
From: Arnaldo Carvalho de Melo @ 2019-03-08 14:39 UTC (permalink / raw)
  To: Adrian Hunter, Masami Hiramatsu
  Cc: Joseph Qi, Arnaldo Carvalho de Melo, Alexander Shishkin, Greg KH,
	linux-kernel, luto, Jiufei Xue, Xu Yu, peterz, mingo

Em Mon, Mar 04, 2019 at 03:13:21PM +0200, Adrian Hunter escreveu:
> Since commit 4d99e4136580 ("perf machine: Workaround missing maps for x86
> PTI entry trampolines"), perf tools has been creating more than one kernel
> map, however 'perf probe' assumed there could be only one.
> 
> Fix by using machine__kernel_map() to get the main kernel map.

Masami, can I get your Acked-by?

- Arnaldo
 
> Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
> Fixes: 4d99e4136580 ("perf machine: Workaround missing maps for x86 PTI entry trampolines")
> Fixes: d83212d5dd67 ("kallsyms, x86: Export addresses of PTI entry trampolines")
> Tested-by: Joseph Qi <joseph.qi@linux.alibaba.com>
> Cc: stable@vger.kernel.org
> ---
>  tools/perf/util/probe-event.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
> index e86f8be89157..6cd96f9b346d 100644
> --- a/tools/perf/util/probe-event.c
> +++ b/tools/perf/util/probe-event.c
> @@ -157,8 +157,10 @@ static struct map *kernel_get_module_map(const char *module)
>  	if (module && strchr(module, '/'))
>  		return dso__new_map(module);
>  
> -	if (!module)
> -		module = "kernel";
> +	if (!module) {
> +		pos = machine__kernel_map(host_machine);
> +		return map__get(pos);
> +	}
>  
>  	for (pos = maps__first(maps); pos; pos = map__next(pos)) {
>  		/* short_name is "[module]" */
> -- 
> 2.19.1

-- 

- Arnaldo

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] perf probe: Fix getting the kernel map
  2019-03-08 14:39                   ` Arnaldo Carvalho de Melo
@ 2019-03-11  9:23                     ` Masami Hiramatsu
  0 siblings, 0 replies; 16+ messages in thread
From: Masami Hiramatsu @ 2019-03-11  9:23 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Adrian Hunter, Joseph Qi, Arnaldo Carvalho de Melo,
	Alexander Shishkin, Greg KH, linux-kernel, luto, Jiufei Xue,
	Xu Yu, peterz, mingo

On Fri, 8 Mar 2019 11:39:26 -0300
Arnaldo Carvalho de Melo <acme@kernel.org> wrote:

> Em Mon, Mar 04, 2019 at 03:13:21PM +0200, Adrian Hunter escreveu:
> > Since commit 4d99e4136580 ("perf machine: Workaround missing maps for x86
> > PTI entry trampolines"), perf tools has been creating more than one kernel
> > map, however 'perf probe' assumed there could be only one.
> > 
> > Fix by using machine__kernel_map() to get the main kernel map.
> 
> Masami, can I get your Acked-by?

Yes, this looks good to me :)

Acked-by: Masami Hiramatsu <mhiramat@kernel.org>

Thank you Adrian!

> 
> - Arnaldo
>  
> > Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
> > Fixes: 4d99e4136580 ("perf machine: Workaround missing maps for x86 PTI entry trampolines")
> > Fixes: d83212d5dd67 ("kallsyms, x86: Export addresses of PTI entry trampolines")
> > Tested-by: Joseph Qi <joseph.qi@linux.alibaba.com>
> > Cc: stable@vger.kernel.org
> > ---
> >  tools/perf/util/probe-event.c | 6 ++++--
> >  1 file changed, 4 insertions(+), 2 deletions(-)
> > 
> > diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
> > index e86f8be89157..6cd96f9b346d 100644
> > --- a/tools/perf/util/probe-event.c
> > +++ b/tools/perf/util/probe-event.c
> > @@ -157,8 +157,10 @@ static struct map *kernel_get_module_map(const char *module)
> >  	if (module && strchr(module, '/'))
> >  		return dso__new_map(module);
> >  
> > -	if (!module)
> > -		module = "kernel";
> > +	if (!module) {
> > +		pos = machine__kernel_map(host_machine);
> > +		return map__get(pos);
> > +	}
> >  
> >  	for (pos = maps__first(maps); pos; pos = map__next(pos)) {
> >  		/* short_name is "[module]" */
> > -- 
> > 2.19.1
> 
> -- 
> 
> - Arnaldo


-- 
Masami Hiramatsu <mhiramat@kernel.org>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [bug report][stable] perf probe: failed to add events
  2019-02-28  7:19             ` Adrian Hunter
  2019-03-02 10:58               ` Joseph Qi
@ 2019-03-21 10:10               ` Greg KH
  2019-03-25 10:02                 ` Adrian Hunter
  1 sibling, 1 reply; 16+ messages in thread
From: Greg KH @ 2019-03-21 10:10 UTC (permalink / raw)
  To: Adrian Hunter
  Cc: Joseph Qi, Arnaldo Carvalho de Melo, Alexander Shishkin,
	linux-kernel, luto, Jiufei Xue, Xu Yu, peterz, mingo

On Thu, Feb 28, 2019 at 09:19:08AM +0200, Adrian Hunter wrote:
> On 28/02/19 4:07 AM, Joseph Qi wrote:
> > Hi Adrian,
> > 
> > On 19/2/27 20:39, Adrian Hunter wrote:
> >> Seems to be fixed by this:
> >>
> >> From: Adrian Hunter <adrian.hunter@intel.com>
> >> Date: Wed, 27 Feb 2019 05:35:25 +0200
> >> Subject: [PATCH] perf probe: Fix getting the kernel map
> >>
> >> Since commit 4d99e4136580 ("perf machine: Workaround missing maps for x86
> >> PTI entry trampolines"), perf tools has been creating more than one kernel
> >> map, however 'perf probe' assumed there could be only one.
> >>
> >> Fix by using machine__kernel_map() to get the main kernel map.
> >>
> >> Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
> >> Fixes: 4d99e4136580 ("perf machine: Workaround missing maps for x86 PTI entry trampolines")
> > 
> > Below is my investigation result before, FYI.
> > the first bad commit (v4.18 ~ v4.19):
> > d83212d5dd67 kallsyms, x86: Export addresses of PTI entry trampolines
> 
> Yes we should add a fixes tag for that also.

So, what do I need to do here for the stable tree(s) to resolve this
issue?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [tip:perf/urgent] perf probe: Fix getting the kernel map
  2019-03-04 13:13                 ` [PATCH] perf probe: Fix getting the kernel map Adrian Hunter
  2019-03-08 14:39                   ` Arnaldo Carvalho de Melo
@ 2019-03-22 22:01                   ` tip-bot for Adrian Hunter
  1 sibling, 0 replies; 16+ messages in thread
From: tip-bot for Adrian Hunter @ 2019-03-22 22:01 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: jiufei.xue, alexander.shishkin, adrian.hunter, peterz,
	linux-kernel, hpa, gregkh, xuyu, acme, joseph.qi, mhiramat,
	mingo, luto, tglx

Commit-ID:  eaeffeb9838a7c0dec981d258666bfcc0fa6a947
Gitweb:     https://git.kernel.org/tip/eaeffeb9838a7c0dec981d258666bfcc0fa6a947
Author:     Adrian Hunter <adrian.hunter@intel.com>
AuthorDate: Mon, 4 Mar 2019 15:13:21 +0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 11 Mar 2019 11:56:03 -0300

perf probe: Fix getting the kernel map

Since commit 4d99e4136580 ("perf machine: Workaround missing maps for
x86 PTI entry trampolines"), perf tools has been creating more than one
kernel map, however 'perf probe' assumed there could be only one.

Fix by using machine__kernel_map() to get the main kernel map.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Tested-by: Joseph Qi <joseph.qi@linux.alibaba.com>
Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Jiufei Xue <jiufei.xue@linux.alibaba.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: stable@vger.kernel.org
Cc: Xu Yu <xuyu@linux.alibaba.com>
Fixes: 4d99e4136580 ("perf machine: Workaround missing maps for x86 PTI entry trampolines")
Fixes: d83212d5dd67 ("kallsyms, x86: Export addresses of PTI entry trampolines")
Link: http://lkml.kernel.org/r/2ed432de-e904-85d2-5c36-5897ddc5b23b@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/probe-event.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index a1b8d9649ca7..198e09ff611e 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -160,8 +160,10 @@ static struct map *kernel_get_module_map(const char *module)
 	if (module && strchr(module, '/'))
 		return dso__new_map(module);
 
-	if (!module)
-		module = "kernel";
+	if (!module) {
+		pos = machine__kernel_map(host_machine);
+		return map__get(pos);
+	}
 
 	for (pos = maps__first(maps); pos; pos = map__next(pos)) {
 		/* short_name is "[module]" */

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [bug report][stable] perf probe: failed to add events
  2019-03-21 10:10               ` [bug report][stable] perf probe: failed to add events Greg KH
@ 2019-03-25 10:02                 ` Adrian Hunter
  0 siblings, 0 replies; 16+ messages in thread
From: Adrian Hunter @ 2019-03-25 10:02 UTC (permalink / raw)
  To: Greg KH
  Cc: Joseph Qi, Arnaldo Carvalho de Melo, Alexander Shishkin,
	linux-kernel, luto, Jiufei Xue, Xu Yu, peterz, mingo

On 21/03/19 12:10 PM, Greg KH wrote:
> On Thu, Feb 28, 2019 at 09:19:08AM +0200, Adrian Hunter wrote:
>> On 28/02/19 4:07 AM, Joseph Qi wrote:
>>> Hi Adrian,
>>>
>>> On 19/2/27 20:39, Adrian Hunter wrote:
>>>> Seems to be fixed by this:
>>>>
>>>> From: Adrian Hunter <adrian.hunter@intel.com>
>>>> Date: Wed, 27 Feb 2019 05:35:25 +0200
>>>> Subject: [PATCH] perf probe: Fix getting the kernel map
>>>>
>>>> Since commit 4d99e4136580 ("perf machine: Workaround missing maps for x86
>>>> PTI entry trampolines"), perf tools has been creating more than one kernel
>>>> map, however 'perf probe' assumed there could be only one.
>>>>
>>>> Fix by using machine__kernel_map() to get the main kernel map.
>>>>
>>>> Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
>>>> Fixes: 4d99e4136580 ("perf machine: Workaround missing maps for x86 PTI entry trampolines")
>>>
>>> Below is my investigation result before, FYI.
>>> the first bad commit (v4.18 ~ v4.19):
>>> d83212d5dd67 kallsyms, x86: Export addresses of PTI entry trampolines
>>
>> Yes we should add a fixes tag for that also.
> 
> So, what do I need to do here for the stable tree(s) to resolve this
> issue?

Nothing.

Patch was re-sent with a stable tag so will go through like normal:

	https://lore.kernel.org/lkml/2ed432de-e904-85d2-5c36-5897ddc5b23b@intel.com/


^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2019-03-25 10:04 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-26  7:31 [bug report][stable] perf probe: failed to add events Joseph Qi
2019-02-26  9:05 ` Greg KH
2019-02-26 12:32   ` Joseph Qi
2019-02-26 13:08     ` Greg KH
2019-02-26 14:20       ` Arnaldo Carvalho de Melo
2019-02-27 12:39         ` Adrian Hunter
2019-02-28  2:07           ` Joseph Qi
2019-02-28  7:19             ` Adrian Hunter
2019-03-02 10:58               ` Joseph Qi
2019-03-04 13:13                 ` [PATCH] perf probe: Fix getting the kernel map Adrian Hunter
2019-03-08 14:39                   ` Arnaldo Carvalho de Melo
2019-03-11  9:23                     ` Masami Hiramatsu
2019-03-22 22:01                   ` [tip:perf/urgent] " tip-bot for Adrian Hunter
2019-03-21 10:10               ` [bug report][stable] perf probe: failed to add events Greg KH
2019-03-25 10:02                 ` Adrian Hunter
2019-02-27  1:53       ` Joseph Qi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.