New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ext4slower doesn't work and the error message is not very helpful #1391

Closed
afiskon opened this Issue Oct 13, 2017 · 7 comments

Comments

Projects
None yet
4 participants
@afiskon
Contributor

afiskon commented Oct 13, 2017

Hi,

I would like to use ext4slower. I execute it like this:

sudo /usr/share/bcc/tools/ext4slower 1

... and it tells me:

ERROR: no ext4_file_operations in /proc/kallsyms. Exiting.

It's not very helpful since I can't understand from this error message whether I should rebuild a kernel with some additional flags or do something else. Could you please add some hint text that would explain how to make ext4slower work?

The environment is Arch Linux x64, uname -a:

Linux e733 4.13.3-1-ARCH #1 SMP PREEMPT Thu Sep 21 20:33:16 CEST 2017 x86_64 GNU/Linux

@afiskon afiskon changed the title from ext4slower error message is not very helpful to ext4slower doesn't work and the error message is not very helpful Oct 13, 2017

@goldshtn

This comment has been minimized.

Show comment
Hide comment
@goldshtn
Collaborator

goldshtn commented Oct 14, 2017

@samuelnair

This comment has been minimized.

Show comment
Hide comment
@samuelnair

samuelnair Oct 20, 2017

Contributor

The tool is checking to see if that symbol exists in the kernel, as a means to determine if you have the ext4 compiled or loaded so as to ensure that those kprobes can attach successfully to the necessary functions.

The ext4_file_operations is a struct and should show up as a symbol of type 'd'. In all likelihood you need to compile the kernel with CONFIG_KALLSYMS_ALL option enabled to ensure that symbol table contains more than just text type symbols.

Contributor

samuelnair commented Oct 20, 2017

The tool is checking to see if that symbol exists in the kernel, as a means to determine if you have the ext4 compiled or loaded so as to ensure that those kprobes can attach successfully to the necessary functions.

The ext4_file_operations is a struct and should show up as a symbol of type 'd'. In all likelihood you need to compile the kernel with CONFIG_KALLSYMS_ALL option enabled to ensure that symbol table contains more than just text type symbols.

@afiskon

This comment has been minimized.

Show comment
Hide comment
@afiskon

afiskon Oct 20, 2017

Contributor

Indeed, CONFIG_KALLSYMS_ALL is disabled:

$ zcat /proc/config.gz | grep CONFIG_KALLSYMS_ALL
# CONFIG_KALLSYMS_ALL is not set

I believe it worth adding a corresponding hint to the script:

diff --git a/home/eax/temp/ext4slower.orig b/usr/share/bcc/tools/ext4slower
index 3b5e7ae..09e8572 100755
--- a/home/eax/temp/ext4slower.orig
+++ b/usr/share/bcc/tools/ext4slower
@@ -262,6 +262,7 @@ with open(kallsyms) as syms:
             break
     if ops == '':
         print("ERROR: no ext4_file_operations in /proc/kallsyms. Exiting.")
+        print("HINT: the kernel should be built with CONFIG_KALLSYMS_ALL.")
         exit()
     bpf_text = bpf_text.replace('EXT4_FILE_OPERATIONS', ops)
 if min_ms == 0:
Contributor

afiskon commented Oct 20, 2017

Indeed, CONFIG_KALLSYMS_ALL is disabled:

$ zcat /proc/config.gz | grep CONFIG_KALLSYMS_ALL
# CONFIG_KALLSYMS_ALL is not set

I believe it worth adding a corresponding hint to the script:

diff --git a/home/eax/temp/ext4slower.orig b/usr/share/bcc/tools/ext4slower
index 3b5e7ae..09e8572 100755
--- a/home/eax/temp/ext4slower.orig
+++ b/usr/share/bcc/tools/ext4slower
@@ -262,6 +262,7 @@ with open(kallsyms) as syms:
             break
     if ops == '':
         print("ERROR: no ext4_file_operations in /proc/kallsyms. Exiting.")
+        print("HINT: the kernel should be built with CONFIG_KALLSYMS_ALL.")
         exit()
     bpf_text = bpf_text.replace('EXT4_FILE_OPERATIONS', ops)
 if min_ms == 0:
@yonghong-song

This comment has been minimized.

Show comment
Hide comment
@yonghong-song

yonghong-song Oct 20, 2017

Collaborator

Could you submit a formal patch for this? I think this is indeed helpful.
cc @brendangregg

Collaborator

yonghong-song commented Oct 20, 2017

Could you submit a formal patch for this? I think this is indeed helpful.
cc @brendangregg

@afiskon

This comment has been minimized.

Show comment
Hide comment
@afiskon

afiskon Oct 23, 2017

Contributor

Done.

Contributor

afiskon commented Oct 23, 2017

Done.

@afiskon

This comment has been minimized.

Show comment
Hide comment
@afiskon

afiskon Oct 23, 2017

Contributor

For the record - also I've contacted Tobias Powalowski, the maintainer of the linux package for Arch Linux, and asked him if it's possible to enable CONFIG_KALLSYMS_ALL in this package.

Contributor

afiskon commented Oct 23, 2017

For the record - also I've contacted Tobias Powalowski, the maintainer of the linux package for Arch Linux, and asked him if it's possible to enable CONFIG_KALLSYMS_ALL in this package.

@afiskon

This comment has been minimized.

Show comment
Hide comment
@afiskon

afiskon Oct 23, 2017

Contributor

For the record - updated PR is here #1408

Contributor

afiskon commented Oct 23, 2017

For the record - updated PR is here #1408

yonghong-song added a commit that referenced this issue Oct 24, 2017

Merge pull request #1408 from afiskon/master
Explain possible reason of an error in scripts that rely on /proc/kallsyms (fixes #1391)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment