* [GIT PULL 0/3] perf/urgent fixes
@ 2015-09-25 15:28 Arnaldo Carvalho de Melo
2015-09-25 15:28 ` [PATCH 1/3] perf probe: Use existing routine to look for a kernel module by dso->short_name Arnaldo Carvalho de Melo
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-09-25 15:28 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
Borislav Petkov, David Ahern, Frederic Weisbecker, Jiri Olsa,
Masami Hiramatsu, Namhyung Kim, Stephane Eranian, Wang Nan,
Arnaldo Carvalho de Melo
Hi Ingo,
Please consider pulling,
- Arnaldo
The following changes since commit d0d0313c2ae4bc220c4ed96ce340860a4e74a2e9:
Merge tag 'perf-urgent-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent (2015-09-23 09:41:09 +0200)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-urgent-for-mingo
for you to fetch changes up to b5cabbcbd157a4bf5a92dfc85134999a3b55342d:
perf tools: Fix copying of /proc/kcore (2015-09-25 10:45:50 -0300)
----------------------------------------------------------------
perf/urgent fixes:
User visible:
- Fix copying of /proc/kcore made to the ~/.debug/ DSO cache to allow using
objdump with kcore files (Adrian Hunter)
- Fix adding perf probes in kernel module functions (Arnaldo Carvalho de Melo)
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
----------------------------------------------------------------
Adrian Hunter (2):
perf intel-pt: Remove no_force_psb from documentation
perf tools: Fix copying of /proc/kcore
Arnaldo Carvalho de Melo (1):
perf probe: Use existing routine to look for a kernel module by dso->short_name
tools/perf/Documentation/intel-pt.txt | 15 ---------------
tools/perf/util/probe-event.c | 13 +++++++------
tools/perf/util/symbol-elf.c | 35 +++++++++++++----------------------
3 files changed, 20 insertions(+), 43 deletions(-)
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/3] perf probe: Use existing routine to look for a kernel module by dso->short_name
2015-09-25 15:28 [GIT PULL 0/3] perf/urgent fixes Arnaldo Carvalho de Melo
@ 2015-09-25 15:28 ` Arnaldo Carvalho de Melo
2015-09-25 15:28 ` [PATCH 2/3] perf intel-pt: Remove no_force_psb from documentation Arnaldo Carvalho de Melo
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-09-25 15:28 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
Borislav Petkov, David Ahern, Frederic Weisbecker, Jiri Olsa,
Namhyung Kim, Stephane Eranian
From: Arnaldo Carvalho de Melo <acme@redhat.com>
We have map_groups__find_by_name() to look at the list of modules that
are in place for a given machine, so use it instead of traversing the
machine dso list, which also includes DSOs for userspace.
When merging the user and kernel DSO lists a bug was introduced where
'perf probe' stopped being able to add probes to modules using its short
name:
# perf probe -m usbnet --add usbnet_start_xmit
usbnet_start_xmit is out of .text, skip it.
Error: Failed to add events.
#
With this fix it works again:
# perf probe -m usbnet --add usbnet_start_xmit
Added new event:
probe:usbnet_start_xmit (on usbnet_start_xmit in usbnet)
You can now use it in all perf tools, such as:
perf record -e probe:usbnet_start_xmit -aR sleep 1
#
Reported-by: Wang Nan <wangnan0@huawei.com>
Acked-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Borislav Petkov <bp@suse.de>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Stephane Eranian <eranian@google.com>
Fixes: 3d39ac538629 ("perf machine: No need to have two DSOs lists")
Link: http://lkml.kernel.org/r/20150924015008.GE1897@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/probe-event.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index eb5f18b75402..c6f9af78f6f5 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -270,12 +270,13 @@ static int kernel_get_module_dso(const char *module, struct dso **pdso)
int ret = 0;
if (module) {
- list_for_each_entry(dso, &host_machine->dsos.head, node) {
- if (!dso->kernel)
- continue;
- if (strncmp(dso->short_name + 1, module,
- dso->short_name_len - 2) == 0)
- goto found;
+ char module_name[128];
+
+ snprintf(module_name, sizeof(module_name), "[%s]", module);
+ map = map_groups__find_by_name(&host_machine->kmaps, MAP__FUNCTION, module_name);
+ if (map) {
+ dso = map->dso;
+ goto found;
}
pr_debug("Failed to find module %s.\n", module);
return -ENOENT;
--
2.1.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/3] perf intel-pt: Remove no_force_psb from documentation
2015-09-25 15:28 [GIT PULL 0/3] perf/urgent fixes Arnaldo Carvalho de Melo
2015-09-25 15:28 ` [PATCH 1/3] perf probe: Use existing routine to look for a kernel module by dso->short_name Arnaldo Carvalho de Melo
@ 2015-09-25 15:28 ` Arnaldo Carvalho de Melo
2015-09-25 15:28 ` [PATCH 3/3] perf tools: Fix copying of /proc/kcore Arnaldo Carvalho de Melo
2015-09-26 6:17 ` [GIT PULL 0/3] perf/urgent fixes Ingo Molnar
3 siblings, 0 replies; 5+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-09-25 15:28 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Adrian Hunter, Jiri Olsa, Arnaldo Carvalho de Melo
From: Adrian Hunter <adrian.hunter@intel.com>
no_force_psb was dropped as a late change to the kernel driver.
Consequently, remove it from the documentation.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Link: http://lkml.kernel.org/r/1443089122-19082-2-git-send-email-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/Documentation/intel-pt.txt | 15 ---------------
1 file changed, 15 deletions(-)
diff --git a/tools/perf/Documentation/intel-pt.txt b/tools/perf/Documentation/intel-pt.txt
index 4a0501d7a3b4..c94c9de3173e 100644
--- a/tools/perf/Documentation/intel-pt.txt
+++ b/tools/perf/Documentation/intel-pt.txt
@@ -364,21 +364,6 @@ cyc_thresh Specifies how frequently CYC packets are produced - see cyc
CYC packets are not requested by default.
-no_force_psb This is a driver option and is not in the IA32_RTIT_CTL MSR.
-
- It stops the driver resetting the byte count to zero whenever
- enabling the trace (for example on context switches) which in
- turn results in no PSB being forced. However some processors
- will produce a PSB anyway.
-
- In any case, there is still a PSB when the trace is enabled for
- the first time.
-
- no_force_psb can be used to slightly decrease the trace size but
- may make it harder for the decoder to recover from errors.
-
- no_force_psb is not selected by default.
-
new snapshot option
-------------------
--
2.1.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/3] perf tools: Fix copying of /proc/kcore
2015-09-25 15:28 [GIT PULL 0/3] perf/urgent fixes Arnaldo Carvalho de Melo
2015-09-25 15:28 ` [PATCH 1/3] perf probe: Use existing routine to look for a kernel module by dso->short_name Arnaldo Carvalho de Melo
2015-09-25 15:28 ` [PATCH 2/3] perf intel-pt: Remove no_force_psb from documentation Arnaldo Carvalho de Melo
@ 2015-09-25 15:28 ` Arnaldo Carvalho de Melo
2015-09-26 6:17 ` [GIT PULL 0/3] perf/urgent fixes Ingo Molnar
3 siblings, 0 replies; 5+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-09-25 15:28 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Adrian Hunter, Jiri Olsa, stable,
Arnaldo Carvalho de Melo
From: Adrian Hunter <adrian.hunter@intel.com>
A copy of /proc/kcore containing the kernel text can be made to the
buildid cache. e.g.
perf buildid-cache -v -k /proc/kcore
To workaround objdump limitations, a copy is also made when annotating
against /proc/kcore.
The copying process stops working from libelf about v1.62 onwards (the
problem was found with v1.63).
The cause is that a call to gelf_getphdr() in kcore__add_phdr() fails
because additional validation has been added to gelf_getphdr().
The use of gelf_getphdr() is a misguided attempt to get default
initialization of the Gelf_Phdr structure. That should not be
necessary because every member of the Gelf_Phdr structure is
subsequently assigned. So just remove the call to gelf_getphdr().
Similarly, a call to gelf_getehdr() in gelf_kcore__init() can be
removed also.
Committer notes:
Note to stable@kernel.org, from Adrian in the cover letter for this
patchkit:
The "Fix copying of /proc/kcore" problem goes back to v3.13 if you think
it is important enough for stable.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: stable@kernel.org
Link: http://lkml.kernel.org/r/1443089122-19082-3-git-send-email-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/symbol-elf.c | 35 +++++++++++++----------------------
1 file changed, 13 insertions(+), 22 deletions(-)
diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c
index f78ea3dc4c08..475d88d0a1c9 100644
--- a/tools/perf/util/symbol-elf.c
+++ b/tools/perf/util/symbol-elf.c
@@ -1271,8 +1271,6 @@ out_close:
static int kcore__init(struct kcore *kcore, char *filename, int elfclass,
bool temp)
{
- GElf_Ehdr *ehdr;
-
kcore->elfclass = elfclass;
if (temp)
@@ -1289,9 +1287,7 @@ static int kcore__init(struct kcore *kcore, char *filename, int elfclass,
if (!gelf_newehdr(kcore->elf, elfclass))
goto out_end;
- ehdr = gelf_getehdr(kcore->elf, &kcore->ehdr);
- if (!ehdr)
- goto out_end;
+ memset(&kcore->ehdr, 0, sizeof(GElf_Ehdr));
return 0;
@@ -1348,23 +1344,18 @@ static int kcore__copy_hdr(struct kcore *from, struct kcore *to, size_t count)
static int kcore__add_phdr(struct kcore *kcore, int idx, off_t offset,
u64 addr, u64 len)
{
- GElf_Phdr gphdr;
- GElf_Phdr *phdr;
-
- phdr = gelf_getphdr(kcore->elf, idx, &gphdr);
- if (!phdr)
- return -1;
-
- phdr->p_type = PT_LOAD;
- phdr->p_flags = PF_R | PF_W | PF_X;
- phdr->p_offset = offset;
- phdr->p_vaddr = addr;
- phdr->p_paddr = 0;
- phdr->p_filesz = len;
- phdr->p_memsz = len;
- phdr->p_align = page_size;
-
- if (!gelf_update_phdr(kcore->elf, idx, phdr))
+ GElf_Phdr phdr = {
+ .p_type = PT_LOAD,
+ .p_flags = PF_R | PF_W | PF_X,
+ .p_offset = offset,
+ .p_vaddr = addr,
+ .p_paddr = 0,
+ .p_filesz = len,
+ .p_memsz = len,
+ .p_align = page_size,
+ };
+
+ if (!gelf_update_phdr(kcore->elf, idx, &phdr))
return -1;
return 0;
--
2.1.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [GIT PULL 0/3] perf/urgent fixes
2015-09-25 15:28 [GIT PULL 0/3] perf/urgent fixes Arnaldo Carvalho de Melo
` (2 preceding siblings ...)
2015-09-25 15:28 ` [PATCH 3/3] perf tools: Fix copying of /proc/kcore Arnaldo Carvalho de Melo
@ 2015-09-26 6:17 ` Ingo Molnar
3 siblings, 0 replies; 5+ messages in thread
From: Ingo Molnar @ 2015-09-26 6:17 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: linux-kernel, Adrian Hunter, Borislav Petkov, David Ahern,
Frederic Weisbecker, Jiri Olsa, Masami Hiramatsu, Namhyung Kim,
Stephane Eranian, Wang Nan, Arnaldo Carvalho de Melo
* Arnaldo Carvalho de Melo <acme@kernel.org> wrote:
> Hi Ingo,
>
> Please consider pulling,
>
> - Arnaldo
>
> The following changes since commit d0d0313c2ae4bc220c4ed96ce340860a4e74a2e9:
>
> Merge tag 'perf-urgent-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent (2015-09-23 09:41:09 +0200)
>
> are available in the git repository at:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-urgent-for-mingo
>
> for you to fetch changes up to b5cabbcbd157a4bf5a92dfc85134999a3b55342d:
>
> perf tools: Fix copying of /proc/kcore (2015-09-25 10:45:50 -0300)
>
> ----------------------------------------------------------------
> perf/urgent fixes:
>
> User visible:
>
> - Fix copying of /proc/kcore made to the ~/.debug/ DSO cache to allow using
> objdump with kcore files (Adrian Hunter)
>
> - Fix adding perf probes in kernel module functions (Arnaldo Carvalho de Melo)
>
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
>
> ----------------------------------------------------------------
> Adrian Hunter (2):
> perf intel-pt: Remove no_force_psb from documentation
> perf tools: Fix copying of /proc/kcore
>
> Arnaldo Carvalho de Melo (1):
> perf probe: Use existing routine to look for a kernel module by dso->short_name
>
> tools/perf/Documentation/intel-pt.txt | 15 ---------------
> tools/perf/util/probe-event.c | 13 +++++++------
> tools/perf/util/symbol-elf.c | 35 +++++++++++++----------------------
> 3 files changed, 20 insertions(+), 43 deletions(-)
Pulled, thanks Arnaldo!
Ingo
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-09-26 6:17 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-25 15:28 [GIT PULL 0/3] perf/urgent fixes Arnaldo Carvalho de Melo
2015-09-25 15:28 ` [PATCH 1/3] perf probe: Use existing routine to look for a kernel module by dso->short_name Arnaldo Carvalho de Melo
2015-09-25 15:28 ` [PATCH 2/3] perf intel-pt: Remove no_force_psb from documentation Arnaldo Carvalho de Melo
2015-09-25 15:28 ` [PATCH 3/3] perf tools: Fix copying of /proc/kcore Arnaldo Carvalho de Melo
2015-09-26 6:17 ` [GIT PULL 0/3] perf/urgent fixes Ingo Molnar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox