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

Intel10G: better initialization / closing #360

Merged
merged 7 commits into from
Feb 10, 2015

Conversation

javierguerragiraldez
Copy link
Contributor

  • unmaps PCI resource on device close
  • deallocates buffers on (vf) app close
  • don't (always) force sfi mode, autonegotiation handles this.
  • if the link doesn't come up, reset the chip and try once more.

The last point in particular made all cards on both davos and grindelwald pass all tests. I couldn't test on chur because it's all tied up in some long-term process.

No more "flaky hardware" excuses!

@lukego
Copy link
Member

lukego commented Feb 3, 2015

Looks promising! Do you see why SnabbBot failed this on the Intel selftest?

@lukego
Copy link
Member

lukego commented Feb 3, 2015

Test case is looking really good with so many iterations!

I tested this branch (on interlaken) though and I see the same error as SnabbBot.

@javierguerragiraldez
Copy link
Contributor Author

Do you see why SnabbBot failed this on the Intel selftest?

the manyreconf() test aborts when an iteration fails to advance the counters. In this case each iteration passed almost 1M each, but # 48 saw only 4873 packets and # 49 not even one, so the test failed.

This is typically what happens when some allocated resource taps out and the packet flow grinds to a halt, meaning that i'm still not releasing or reusing everything on each reconfig.

I think this test run churns packets faster than what i've seen manually, thus maybe in my test i didn't manage to totally leak out and with 'just' 100 iterations of 0.25sec each.

I'll try to make it happen earlier changing the preallocated amounts, time of iterations, size of packets, etc. to find exactly what resource is leaking.

@@ -54,9 +54,14 @@ uint32_t volatile *map_pci_resource(int fd)
}
}

void close_pci_resource(int fd)
void close_pci_resource(int fd, uint32_t volatile *addr)
Copy link
Member

Choose a reason for hiding this comment

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

I have been clarifying volatile and related issues with Mike Pall on the LuaJIT list.

Conclusions:

There is a risk that the JIT optimizations will eliminate or reorder loads and stores.

volatile is not the solution: LuaJIT ignores that. Probably we should not use it: I see a risk that we will expect it to behave in a way that it does not.

Compiler barriers are a solution. For example, immediately before reading or writing a memory mapped register we could always call a lib.c function:

void compiler_barrier() {}

and LuaJIT will flush loads/stores from registers to memory before making an FFI call.

Copy link
Member

Choose a reason for hiding this comment

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

You know, this could really be relevant to the bugs that you are seeing. The first times the NIC is initialised the code will be running interpreted. Once the init code gets hot and compiled then the behaviour could change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

About the volatile keword, it's only there to be consistent with the return value of map_pci_resource(). I agree that it's superfluous and would be better removed. Even in C it's dubious that would be any benefit as an argument or return value.

About barriers in initialization code, most of the places where order is important, the Intel docs advise to insert a wait, sometimes a few microseconds, sometimes up to a millisecond. In those cases we use C.usleep(), which should have the barrier effect as well. (and it's hard to imagine some reordering/pending write to last as long as a microsecond).

Where we could be missing some defensive coding is more in the data handling itself. Maybe the M_sf:sync_transmit () race is related to this?

Finally, I don't think the initialization code is ever compiled. Not even in the manyreconf() calls it tightly enough. What would be a simple way to check that?

@lukego lukego merged commit 18fe95c into snabbco:master Feb 10, 2015
dpino pushed a commit to dpino/snabb that referenced this pull request Jun 9, 2016
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