Skip to content

Fix perf breaking#80

Closed
iAklis wants to merge 3 commits intocilium:masterfrom
iAklis:fix-perf-breaking
Closed

Fix perf breaking#80
iAklis wants to merge 3 commits intocilium:masterfrom
iAklis:fix-perf-breaking

Conversation

@iAklis
Copy link
Copy Markdown

@iAklis iAklis commented Mar 14, 2020

I found the error is not EINVAL but ENODEV, this could fix my code. Could you help me review? @lmb

Alternative solution #78

Copy link
Copy Markdown
Contributor

@lmb lmb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left a few comments. Thanks for finding out about ENODEV, that is very valuable. To be (imo bug) compatible with libbpf we'd have to ignore EINVAL as well, which is cumbersome and seems like the wrong thing to do. I'd really like to avoid it.

Can you use max_elems: 0 in your code? If no, can you explain why not? Maybe we can find a solution together.

Comment thread perf/reader.go
for i := 0; i < nCPU; i++ {
ring, err := newPerfEventRing(i, perCPUBuffer, opts.Watermark)
if err != nil {
if xerrors.Is(err, syscall.ENODEV) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code expects you to append to rings for each CPU, and right now you skip this because of the continue. I need to look into how to handle that.

Comment thread perf/reader_test.go
t.Fatal("perf event array: ", err)
}
fd, err = createPerfEvent(onlineCPU, 1)
if !xerrors.Is(err, syscall.ENODEV) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you check the Linux sources you'll find that ENODEV is only returned if:

I think you're violating the first condition, and getting EINVAL therefore.

@lmb
Copy link
Copy Markdown
Contributor

lmb commented Mar 19, 2020

According to @iAklis he can use max_elems: 0, hence I'll close this.

@lmb lmb closed this Mar 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants