mirror of
				https://github.com/kata-containers/kata-containers.git
				synced 2025-11-04 03:29:55 +00:00 
			
		
		
		
	scsi: Allow scsi controller to associate with an IO thread.
This enable data-plane for scsi. All drives attached to the scsi controller will have their IO processed in a single separate IO thread instead of qemu's main event loop. Signed-off-by: Archana Shinde <archana.m.shinde@intel.com>
This commit is contained in:
		@@ -841,6 +841,9 @@ type SCSIController struct {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	// DisableModern prevents qemu from relying on fast MMIO.
 | 
						// DisableModern prevents qemu from relying on fast MMIO.
 | 
				
			||||||
	DisableModern bool
 | 
						DisableModern bool
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// IOThread is the IO thread on which IO will be handled
 | 
				
			||||||
 | 
						IOThread string
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Valid returns true if the SCSIController structure is valid and complete.
 | 
					// Valid returns true if the SCSIController structure is valid and complete.
 | 
				
			||||||
@@ -867,6 +870,9 @@ func (scsiCon SCSIController) QemuParams(config *Config) []string {
 | 
				
			|||||||
	if scsiCon.DisableModern {
 | 
						if scsiCon.DisableModern {
 | 
				
			||||||
		devParams = append(devParams, fmt.Sprintf("disable-modern=true"))
 | 
							devParams = append(devParams, fmt.Sprintf("disable-modern=true"))
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						if scsiCon.IOThread != "" {
 | 
				
			||||||
 | 
							devParams = append(devParams, fmt.Sprintf("iothread=%s", scsiCon.IOThread))
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	qemuParams = append(qemuParams, "-device")
 | 
						qemuParams = append(qemuParams, "-device")
 | 
				
			||||||
	qemuParams = append(qemuParams, strings.Join(devParams, ","))
 | 
						qemuParams = append(qemuParams, strings.Join(devParams, ","))
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -350,7 +350,7 @@ func TestVSOCKValid(t *testing.T) {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
var deviceSCSIControllerStr = "-device virtio-scsi-pci,id=foo"
 | 
					var deviceSCSIControllerStr = "-device virtio-scsi-pci,id=foo"
 | 
				
			||||||
var deviceSCSIControllerBusAddrStr = "-device virtio-scsi-pci,id=foo,bus=pci.0,addr=00:04.0,disable-modern=true"
 | 
					var deviceSCSIControllerBusAddrStr = "-device virtio-scsi-pci,id=foo,bus=pci.0,addr=00:04.0,disable-modern=true,iothread=iothread1"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func TestAppendDeviceSCSIController(t *testing.T) {
 | 
					func TestAppendDeviceSCSIController(t *testing.T) {
 | 
				
			||||||
	scsiCon := SCSIController{
 | 
						scsiCon := SCSIController{
 | 
				
			||||||
@@ -361,6 +361,7 @@ func TestAppendDeviceSCSIController(t *testing.T) {
 | 
				
			|||||||
	scsiCon.Bus = "pci.0"
 | 
						scsiCon.Bus = "pci.0"
 | 
				
			||||||
	scsiCon.Addr = "00:04.0"
 | 
						scsiCon.Addr = "00:04.0"
 | 
				
			||||||
	scsiCon.DisableModern = true
 | 
						scsiCon.DisableModern = true
 | 
				
			||||||
 | 
						scsiCon.IOThread = "iothread1"
 | 
				
			||||||
	testAppend(scsiCon, deviceSCSIControllerBusAddrStr, t)
 | 
						testAppend(scsiCon, deviceSCSIControllerBusAddrStr, t)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user