-
Notifications
You must be signed in to change notification settings - Fork 908
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
Support more than 256 vCPUs for VMs attached to bridges #13484
Comments
After Linux kernel 4.0+, the configureQueues := func(cpuCount int) int {
// Number of queues is the same as number of vCPUs. Run with a minimum of two queues.
queueCount := cpuCount
if queueCount < 2 {
queueCount = 2
}
if queueCount > 256 {
queueCount = 256
}
// Number of vectors is number of vCPUs * 2 (RX/TX) + 2 (config/control MSI-X).
vectors := 2*queueCount + 2
if vectors > 0 {
qemuDev["mq"] = "on"
if shared.ValueInSlice(busName, []string{"pcie", "pci"}) {
qemuDev["vectors"] = strconv.Itoa(vectors)
}
}
return queueCount
} and devFile := func(cpus int) (*os.File, error) {
revert := revert.New()
defer revert.Fail()
f, err := os.OpenFile("/dev/net/tun", os.O_RDWR, 0)
if err != nil {
return nil, err
}
revert.Add(func() { _ = f.Close() })
ifr, err := unix.NewIfreq(nicName)
if err != nil {
return nil, fmt.Errorf("Error creating new ifreq for %q: %w", nicName, err)
}
if cpus > 256 {
ifr.SetUint16(unix.IFF_TAP | unix.IFF_NO_PI | unix.IFF_MULTI_QUEUE | unix.IFF_VNET_HDR)
} else {
ifr.SetUint16(unix.IFF_TAP | unix.IFF_NO_PI | unix.IFF_ONE_QUEUE | unix.IFF_MULTI_QUEUE | unix.IFF_VNET_HDR)
}
// Sets the file handle to point to the requested NIC interface.
err = unix.IoctlIfreq(int(f.Fd()), unix.TUNSETIFF, ifr)
if err != nil {
return nil, fmt.Errorf("Error getting TAP file handle for %q: %w", nicName, err)
}
revert.Success()
return f, nil
} Maybe its a naive solution. Maybe it does not even work (I don't have that kind of hardware for testing ah). But maybe its worth a try... @simondeziel @mihalicyn thoughts ? |
|
@simondeziel @mihalicyn Ok, after trying that (
|
@tomponline do you have any thoughts on how to proceed? |
As this isnt a roadmap item and is not an issue currently assigned to a milestone i would suggest leaving this issue for now and tackling the high priority roadmap items and any unresolved milestone bugs first. Unless you have been specifically asked to work in the issue by your manager of course. |
I'll leave it then as this was just out of curiosity. |
Looks like a bug in QEMU. At some point, we should check what happens with this on a newer versions and report/fix this. |
In #13186 (comment), it was identified that at 257 vCPU the VM will fail to start due to LXD not being able to setup the bridged NIC using
unix.TUNSETIFF
:This 256 max CPU is below QEMU's own limit of 288 vCPUs.
The text was updated successfully, but these errors were encountered: