Commit fd1f6fb
committed
dpif-netlink: Fix probing for broken meters on Linux v5.10+.
If someone creates a lot of meters (>1017) in the kernel datapath
and then re-starts ovs-vswitchd, OVS fails to probe meter support
and refuses to install any meters afterwards:
dpif_netlink|INFO|The kernel module has a broken meter implementation.
The reason is that probing for broken meters relies on creating
two meters with high meter IDs. Inside the kernel, however, the
meter table is not a real hash table since v5.10 and commit:
c7c4c44c9a95 ("net: openvswitch: expand the meters supported number")
Instead, it's just an array with meter IDs mapped to indexes with a
simple modulo operation. This array can expand, but only when it is
full. There is no handling of collisions, so if the meter at
ID % size is not the right one, then the lookup just fails. This is
fine as long as userspace creates meters with densely packed IDs,
which is the case for ovs-vswitchd... except for probing.
While probing, we attempt to create meters 54545401 and 54545402.
Without expanding the table size, these map onto 1017 and 1018.
So, creation of these meters fails if there are already meters with
IDs 1017 or 1018. At this point OVS declares meter implementation
broken.
Ideally, we should make the "hash" table in the kernel handle
collisions and otherwise be a more or less proper hash table. But
we can also improve probing in userspace and avoid this issue by
choosing lower numbered meter IDs and trying to get them from the
kernel first before trying to create. Choosing high values at the
top of the 0-1023 range, so they are guaranteed to fit into the
minimal size table in the kernel (1024). If one of these already
exists and has a proper ID, then meters are likely working fine
and we don't need to install new ones for probing. If these meters
are not in the kernel, then we can try to create and check.
This logic should work fine for older or future kernels with a
proper hash table as well.
There is no Fixes tag here as the check was correct at the moment
it was introduced. It's the kernel change that broke it.
Reported-at: openvswitch/ovs-issues#337
Acked-by: Aaron Conole <[email protected]>
Signed-off-by: Ilya Maximets <[email protected]>1 parent 62348e8 commit fd1f6fb
2 files changed
+66
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4277 | 4277 | | |
4278 | 4278 | | |
4279 | 4279 | | |
4280 | | - | |
4281 | | - | |
| 4280 | + | |
| 4281 | + | |
| 4282 | + | |
| 4283 | + | |
4282 | 4284 | | |
4283 | 4285 | | |
4284 | 4286 | | |
4285 | | - | |
4286 | | - | |
4287 | | - | |
4288 | | - | |
| 4287 | + | |
| 4288 | + | |
| 4289 | + | |
| 4290 | + | |
| 4291 | + | |
| 4292 | + | |
| 4293 | + | |
| 4294 | + | |
| 4295 | + | |
| 4296 | + | |
4289 | 4297 | | |
4290 | 4298 | | |
4291 | 4299 | | |
| |||
4363 | 4371 | | |
4364 | 4372 | | |
4365 | 4373 | | |
4366 | | - | |
4367 | | - | |
4368 | | - | |
| 4374 | + | |
| 4375 | + | |
| 4376 | + | |
| 4377 | + | |
| 4378 | + | |
| 4379 | + | |
| 4380 | + | |
| 4381 | + | |
| 4382 | + | |
| 4383 | + | |
| 4384 | + | |
| 4385 | + | |
| 4386 | + | |
| 4387 | + | |
| 4388 | + | |
| 4389 | + | |
4369 | 4390 | | |
4370 | 4391 | | |
4371 | 4392 | | |
4372 | 4393 | | |
| 4394 | + | |
| 4395 | + | |
| 4396 | + | |
| 4397 | + | |
| 4398 | + | |
| 4399 | + | |
| 4400 | + | |
| 4401 | + | |
4373 | 4402 | | |
4374 | 4403 | | |
4375 | 4404 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2813 | 2813 | | |
2814 | 2814 | | |
2815 | 2815 | | |
| 2816 | + | |
| 2817 | + | |
| 2818 | + | |
| 2819 | + | |
| 2820 | + | |
| 2821 | + | |
| 2822 | + | |
| 2823 | + | |
| 2824 | + | |
| 2825 | + | |
| 2826 | + | |
| 2827 | + | |
| 2828 | + | |
| 2829 | + | |
| 2830 | + | |
| 2831 | + | |
| 2832 | + | |
| 2833 | + | |
| 2834 | + | |
| 2835 | + | |
| 2836 | + | |
| 2837 | + | |
| 2838 | + | |
| 2839 | + | |
| 2840 | + | |
| 2841 | + | |
| 2842 | + | |
| 2843 | + | |
2816 | 2844 | | |
2817 | 2845 | | |
2818 | 2846 | | |
| |||
0 commit comments