Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
virtcontainers: support SMP die
Browse files Browse the repository at this point in the history
CPU topology has changed in QEMU 4.1: socket > die > core > thread.
die option must be specified in order to hotplug CPUs on x86_64

Depends-on: github.com/kata-containers/packaging#657

fixes #1913

Signed-off-by: Julio Montes <[email protected]>
  • Loading branch information
Julio Montes committed Jul 26, 2019
1 parent 104c04d commit 7668aeb
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion virtcontainers/qemu.go
Original file line number Diff line number Diff line change
Expand Up @@ -1307,16 +1307,18 @@ func (q *qemu) hotplugAddCPUs(amount uint32) (uint32, error) {
driver := hc.Type
cpuID := fmt.Sprintf("cpu-%d", len(q.state.HotpluggedVCPUs))
socketID := fmt.Sprintf("%d", hc.Properties.Socket)
dieID := fmt.Sprintf("%d", hc.Properties.Die)
coreID := fmt.Sprintf("%d", hc.Properties.Core)
threadID := fmt.Sprintf("%d", hc.Properties.Thread)

// If CPU type is IBM pSeries or Z, we do not set socketID and threadID
if machine.Type == "pseries" || machine.Type == "s390-ccw-virtio" {
socketID = ""
threadID = ""
dieID = ""
}

if err := q.qmpMonitorCh.qmp.ExecuteCPUDeviceAdd(q.qmpMonitorCh.ctx, driver, cpuID, socketID, coreID, threadID, romFile); err != nil {
if err := q.qmpMonitorCh.qmp.ExecuteCPUDeviceAdd(q.qmpMonitorCh.ctx, driver, cpuID, socketID, dieID, coreID, threadID, romFile); err != nil {
// don't fail, let's try with other CPU
continue
}
Expand Down

0 comments on commit 7668aeb

Please sign in to comment.