mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-07-06 03:56:34 +00:00
config: Add scsi_mod.scan=none for virtio-scsi
As per [1], the default scan mode of scsi is sync. kata-agent already scans the SCSI buses [2], changing it to none can reduce the guest boot time. =Before this patch= [ 0.113828] [ T1] scsi host0: Virtio SCSI HBA [ 0.134006] [ T1] tun: Universal TUN/TAP device driver, 1.6 =After this patch= [ 0.105891] [ T1] scsi host0: Virtio SCSI HBA [ 0.107868] [ T1] tun: Universal TUN/TAP device driver, 1.6 It reduces about 17ms on arm64 for virtio-scsi. This patch changes the default kernel parameter: 1. If user specifies the scan mode, use that 2. If user doesn't specify it, and the block device is virtio-scsi, use "none" by default [1] https://lwn.net/Articles/201898/ [2] https://github.com/kata-containers/agent/blob/649d44117a/device.go#L322 Fixes: #2560 Signed-off-by: Jia He <justin.he@arm.com
This commit is contained in:
parent
af24829c2a
commit
8c850d9e3a
@ -977,7 +977,6 @@ func SetKernelParams(runtimeConfig *oci.RuntimeConfig) error {
|
|||||||
if runtimeConfig.HypervisorConfig.Debug {
|
if runtimeConfig.HypervisorConfig.Debug {
|
||||||
strParams := vc.SerializeParams(defaultKernelParams, "=")
|
strParams := vc.SerializeParams(defaultKernelParams, "=")
|
||||||
formatted := strings.Join(strParams, " ")
|
formatted := strings.Join(strParams, " ")
|
||||||
|
|
||||||
kataUtilsLogger.WithField("default-kernel-parameters", formatted).Debug()
|
kataUtilsLogger.WithField("default-kernel-parameters", formatted).Debug()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -989,7 +988,18 @@ func SetKernelParams(runtimeConfig *oci.RuntimeConfig) error {
|
|||||||
|
|
||||||
// first, add default values
|
// first, add default values
|
||||||
for _, p := range defaultKernelParams {
|
for _, p := range defaultKernelParams {
|
||||||
if err := (runtimeConfig).AddKernelParam(p); err != nil {
|
if err := runtimeConfig.AddKernelParam(p); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// set the scsi scan mode to none for virtio-scsi
|
||||||
|
if runtimeConfig.HypervisorConfig.BlockDeviceDriver == config.VirtioSCSI {
|
||||||
|
p := vc.Param{
|
||||||
|
Key: "scsi_mod.scan",
|
||||||
|
Value: "none",
|
||||||
|
}
|
||||||
|
if err := runtimeConfig.AddKernelParam(p); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1004,7 +1014,7 @@ func SetKernelParams(runtimeConfig *oci.RuntimeConfig) error {
|
|||||||
params := vc.KataAgentKernelParams(agentConfig)
|
params := vc.KataAgentKernelParams(agentConfig)
|
||||||
|
|
||||||
for _, p := range params {
|
for _, p := range params {
|
||||||
if err := (runtimeConfig).AddKernelParam(p); err != nil {
|
if err := runtimeConfig.AddKernelParam(p); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1012,7 +1022,7 @@ func SetKernelParams(runtimeConfig *oci.RuntimeConfig) error {
|
|||||||
|
|
||||||
// now re-add the user-specified values so that they take priority.
|
// now re-add the user-specified values so that they take priority.
|
||||||
for _, p := range userKernelParams {
|
for _, p := range userKernelParams {
|
||||||
if err := (runtimeConfig).AddKernelParam(p); err != nil {
|
if err := runtimeConfig.AddKernelParam(p); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -208,6 +208,10 @@ func TestSetKernelParams(t *testing.T) {
|
|||||||
err := SetKernelParams(&config)
|
err := SetKernelParams(&config)
|
||||||
assert.NoError(err)
|
assert.NoError(err)
|
||||||
|
|
||||||
|
config.HypervisorConfig.BlockDeviceDriver = "virtio-scsi"
|
||||||
|
err = SetKernelParams(&config)
|
||||||
|
assert.NoError(err)
|
||||||
|
|
||||||
if needSystemd(config.HypervisorConfig) {
|
if needSystemd(config.HypervisorConfig) {
|
||||||
assert.NotEmpty(config.HypervisorConfig.KernelParams)
|
assert.NotEmpty(config.HypervisorConfig.KernelParams)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user