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

Increase size of receive buffer #365

Merged
merged 2 commits into from
Jul 5, 2018
Merged

Conversation

jellonek
Copy link
Contributor

@jellonek jellonek commented Jul 2, 2018

Closes #354

Previous attemt to fix #354 was only hiding a true issue with too small buffer to pick up the message from kernel.
According to #354 (comment)
such situation could occur not only during dump of VF list, but also when we are asking for:

  • statistics
  • tc rules and tc filters
  • large conn track dump
  • rdma resource details dump for debugging
    or any other place where kernel can return more data than default (4kB) sized buffer could hold.

iproute2 in this case for rtnl_dump_filter_l has buffer with size of 16kB, but we don't have distinction between different receiving funcs, so I'm proposing to stick with original issue cause finder (kudos to Parav Pandit aka paravmellanox) who is proposing 64kB as a buffer size.

That's improvement in handling of received packets which should keep us safe with issues like #354 but the real solution should be to add in future handling of truncate flag (msg.msg_flags & MSG_TRUNC) if kernel wants to sent us something even bigger than 64k.

@jellonek jellonek changed the title Bufsize Increase size of receive buffer Jul 2, 2018
@jellonek
Copy link
Contributor Author

jellonek commented Jul 2, 2018

@vishvananda, @fcrisciani, @aboch, @paravmellanox - PTAL

@jellonek
Copy link
Contributor Author

jellonek commented Jul 3, 2018

ping

jellonek added a commit to Mirantis/virtlet that referenced this pull request Jul 3, 2018
While waiting for merge of vishvananda/netlink#365
which is needed to read vlan info of VFs using PF - switching to fork
containing required patch.
jellonek added a commit to Mirantis/virtlet that referenced this pull request Jul 3, 2018
While waiting for merge of vishvananda/netlink#365
which is needed to read vlan info of VFs using PF - switching to fork
containing required patch.
jellonek added a commit to Mirantis/virtlet that referenced this pull request Jul 3, 2018
While waiting for merge of vishvananda/netlink#365
which is needed to read vlan info of VFs using PF - switching to fork
containing required patch.
@jellonek
Copy link
Contributor Author

jellonek commented Jul 3, 2018

@paravmellanox can you confirm or deny that this resolves an issue in #354?
I've just started to observe such EINVAL even after applying patch from this PR on hardware with ... mellanox NIC.

nl/nl_linux.go Outdated
// Set a big temporary buffer because returned message from kernel can
// be quite verbose if kernel is asked e.g. for statistics,
// tc rules or filters, or other more memory requiring data.
rb := make([]byte, 65536)
Copy link
Contributor

Choose a reason for hiding this comment

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

@jellonek, I will test later today.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Please define a constant for this.

Copy link
Contributor

Choose a reason for hiding this comment

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

@jellonek , sorry for the late response. Something came up.

I tested now with 100 VFs invalid request error is not present with this change.

Please define a const and also add comment there.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thx for the test.
Const added and commented.

nl/nl_linux.go Outdated
// Set a big temporary buffer because returned message from kernel can
// be quite verbose if kernel is asked e.g. for statistics,
// tc rules or filters, or other more memory requiring data.
rb := make([]byte, 65536)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please define a constant for this.

Closes vishvananda#354

Previous attemt to fix vishvananda#354 was only hiding a true issue with too small
buffer to pick up the message from kernel.
According to vishvananda#354 (comment)
such situation could occur not only during dump of VF list, but also
 * statistics
 * tc rules and tc filters
 * large conn track dump
 * rdma resource details dump for debugging
or any other place where kernel can return more data than default (4kB)
sized buffer could hold.

iproute2 in this case for rtnl_dump_filter_l has buffer with size of
16kB, but we don't have distinction between different receiving funcs,
so I'm proposing to stick with original issue cause finder (kudos to
Parav Pandit aka paravmellanox) who is proposing 64kB as a buffer size.
@aboch
Copy link
Collaborator

aboch commented Jul 5, 2018

LGTM

Copy link
Collaborator

@fcrisciani fcrisciani left a comment

Choose a reason for hiding this comment

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

LGTM

@fcrisciani
Copy link
Collaborator

Considering @aboch LGTM also, will merge

@fcrisciani
Copy link
Collaborator

Actually @jellonek can you squash in 1 commmit?

@jellonek
Copy link
Contributor Author

jellonek commented Jul 5, 2018

I would like to have revert in a separate commit. That seems to be more logical and more standard in git world. What would be the purpose of squashing them to single one?

@paravmellanox
Copy link
Contributor

I also prefer two commits as they are unrelated. When in future when we address truncated response, it will be logical to refer to 64K limit commit.

@jellonek
Copy link
Contributor Author

jellonek commented Jul 5, 2018

@aboch I see your LGTM, but review is still blocked by you ;)

@fcrisciani
Copy link
Collaborator

sure no prob, did not notice that was a revert of a previous patch

@fcrisciani
Copy link
Collaborator

comments got addressed and LGTM given, merging it

@fcrisciani fcrisciani merged commit a06dabf into vishvananda:master Jul 5, 2018
@jellonek jellonek deleted the bufsize branch July 9, 2018 15:44
@bboreham
Copy link
Contributor

This change is quite painful for performance - allocating then discarding 64K on every call drives the garbage-collector to run faster.

I'll open an issue to discuss.

@jellonek
Copy link
Contributor Author

In PR description i have noted what needs to be done to correctly support smaller packages - we need to handle truncate flag (msg.msg_flags & MSG_TRUNC).
Unfortunately i don't have a time to implement that myself at the moment.

xuyang2 pushed a commit to easyops-cn/pnetlink that referenced this pull request Aug 24, 2021
xuyang2 pushed a commit to easyops-cn/pnetlink that referenced this pull request Aug 24, 2021
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.

LinkList method doesn't work. Error: incorrect argument
5 participants