Skip to content
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

LLVM ERROR: Cannot select #212

Closed
brendangregg opened this issue Sep 13, 2015 · 3 comments
Closed

LLVM ERROR: Cannot select #212

brendangregg opened this issue Sep 13, 2015 · 3 comments
Labels

Comments

@brendangregg
Copy link
Member

# ./vfsslower| head -50
LLVM ERROR: Cannot select: 0x29e97a0: ch,glue = BPFISD::CALL 0x1e16d00, 0x29c4f50, 0x29b9240, 0x2ac89b8, 0x29e9550, 0x1e16d00:1 [ORD=4] [ID=40]
  0x29c4f50: i64 = TargetExternalSymbol'memset' [ID=9]
  0x29b9240: i64 = Register %R1 [ID=6]
  0x2ac89b8: i64 = Register %R2 [ID=7]
  0x29e9550: i64 = Register %R3 [ID=8]
  0x1e16d00: ch,glue = CopyToReg 0x1e17078, 0x29e9550, 0x2ac8640, 0x1e17078:1 [ORD=4] [ID=39]
    0x29e9550: i64 = Register %R3 [ID=8]
    0x2ac8640: i64 = Constant<1216> [ID=3]
    0x1e17078: ch,glue = CopyToReg 0x29b95b8, 0x2ac89b8, 0x29baa58, 0x29b95b8:1 [ORD=4] [ID=38]
      0x2ac89b8: i64 = Register %R2 [ID=7]
      0x29baa58: i64 = Constant<0> [ID=4]
      0x29b95b8: ch,glue = CopyToReg 0x29c4988, 0x29b9240, 0x29bb020 [ORD=4] [ID=37]
        0x29b9240: i64 = Register %R1 [ID=6]
        0x29bb020: i64 = FrameIndex<5> [ID=2]
In function: trace_entry

Same program as #209, still trying to exclude non-storage-device I/O. Attaching this to vfs_read():

int trace_entry(struct pt_regs *ctx, struct file *file)
{
[...]
                struct super_block mnt_sb = {}, *mnt_sbp = file->f_path.mnt->mnt_sb;
                bpf_probe_read(&mnt_sb, sizeof(mnt_sb), &mnt_sbp);

... was hoping something out of the super_block could identify if this was a storage-backed FS or not.

@drzaeus77
Copy link
Collaborator

The size of super_block is likely way too big (1216 bytes) to be stored on the stack, causing the llvm codegen to give up. You will unfortunately probably have to bpf_probe_read step by step until #188 is fixed.

struct vfsmount *mnt = file->f_path.mnt;
struct super_block *mnt_sb = NULL;
bpf_probe_read(&mnt_sb, sizeof(mnt_sb), &mnt->mnt_sb);
u32 s_flags = 0;
bpf_probe_read(&s_flags, sizeof(s_flags), &mnt_sb->s_flags);

@brendangregg
Copy link
Member Author

Thanks for the code and explanation; that actually helps me understand the role of bpf_probe_read() much better -- it's to put things on the BPF stack (and satisfy the "expected=fp" messages)... Although maybe I don't need to learn it in the long term, if #188 is fixed.

Is there a way for bpf_probe_read() to check sizeof and the stack and print a better error for this?

@drzaeus77 drzaeus77 added bug and removed bug labels Sep 18, 2015
@yonghong-song
Copy link
Collaborator

The issue cannot be reproduced any more, maybe because issue #188 has been fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants