Skip to contentSkip to conversation

vmlinux buildid doesn't match the running one (/sys/kernel/notes)

DISCUSSION Francis Moreau 2 participants 4 messages Apr 28, 2011 – May 5, 2011 1 message not in the archive perf events

lore
Share & tools
lore
#0 lore raw

Hello,

I'm trying to use perf-probe, but it fails.

Basically it's due to the buildid of the running kernel (the one which can be read from /sys/kernel/notes) and the one in vmlinx (which I compiled my self).

I did this:

  $ make
  $ make modules_install install
  $ ls vmlinux
  vmlinux

reboot

  $ perf probe -k vmlinux -L schedule
  Failed to find path of kernel module.
  Failed to open debuginfo file.
  Error: Failed to show lines. (-2)

So my question is why the buildids doesn't match ?

I guess I did something wrong since it's pretty a standard use case but I don't see why...

Thanks

Signature · 1 line
Francis
#1 lore raw

Hi,

Sorry for asking again but I would be really greatfull is someone can tell me what's wrong when using a kernel that I compiled by my own.

I do not have that issue is I use the kernel shipped by my distro (FC14).

Thanks

Quoted 31 lines · Francis Moreau

Hello,

I'm trying to use perf-probe, but it fails.

Basically it's due to the buildid of the running kernel (the one which can be read from /sys/kernel/notes) and the one in vmlinx (which I compiled my self).

I did this:

 $ make
 $ make modules_install install
 $ ls vmlinux
 vmlinux

reboot

 $ perf probe -k vmlinux -L schedule
 Failed to find path of kernel module.
 Failed to open debuginfo file.
 Error: Failed to show lines. (-2)

So my question is why the buildids doesn't match ?

I guess I did something wrong since it's pretty a standard use case but I don't see why...

Thanks
--
Francis

Signature · 1 line
Francis
#3 lore raw
In reply to a message not in the archive
Quoted 9 lines

From: Francis Moreau <[email protected]>
Date: Mon, May 2, 2011 at 3:02 AM
Subject: Re: vmlinux buildid doesn't match the running one (/sys/kernel/notes)
To: [email protected]

Hi,

Quoted 24 lines

Sorry for asking again but I would be really greatfull is someone can tell me what's wrong when using a kernel that I compiled by my own.

I do not have that issue is I use the kernel shipped by my distro (FC14).

Thanks

Quoted 16 lines · Francis Moreau

Hello,

I'm trying to use perf-probe, but it fails.

Basically it's due to the buildid of the running kernel (the one which can be read from /sys/kernel/notes) and the one in vmlinx (which I compiled my self).

I did this:

 $ make
 $ make modules_install install
 $ ls vmlinux
 vmlinux

reboot

Could you make sure you indeed reboot with the new kernel running?

Use below patch to dump the 2 build_ids.

tools/perf/util/symbol.c +13 -1
index 516876d..4b66c1c 100644
@@ -1036,6 +1036,15 @@ static size_t elf_addr_to_index(Elf *elf, GElf_Addr addr)
 	return -1;
 }
 
+static void dump_build_id(u8 *build_id)
+{
+	int i;
+
+	for (i = 0; i < BUILD_ID_SIZE; i++)
+		printf("%02x ", build_id[i]);
+	printf("\n");
+}
+
 static int dso__load_sym(struct dso *dso, struct map *map, const char *name,
 			 int fd, symbol_filter_t filter, int kmodule,
 			 int want_symtab)
@@ -1075,8 +1084,11 @@ static int dso__load_sym(struct dso *dso, struct map *map, const char *name,
 				      BUILD_ID_SIZE) != BUILD_ID_SIZE)
 			goto out_elf_end;
 
-		if (!dso__build_id_equal(dso, build_id))
+		if (!dso__build_id_equal(dso, build_id)) {
+			dump_build_id(build_id);
+			dump_build_id(dso->build_id);
 			goto out_elf_end;
+		}
 	}
 
 	sec = elf_section_by_name(elf, &ehdr, &shdr, ".symtab", NULL);
Quoted 14 lines
Quoted 14 lines
 $ perf probe -k vmlinux -L schedule
 Failed to find path of kernel module.
 Failed to open debuginfo file.
 Error: Failed to show lines. (-2)

So my question is why the buildids doesn't match ?

I guess I did something wrong since it's pretty a standard use case but I don't see why...

Thanks
--
Francis

#4 lore raw
Quoted 3 lines · Lin Ming

Could you make sure you indeed reboot with the new kernel running?

I really don't know what happened when I tried, but now it works as expected (/me hiding).

Sorry for the noise

Thanks

Signature · 1 line
Francis