Skip to content

T7397: add "system kernel option quiet" to suppress boot messages #4477

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

Merged
merged 2 commits into from
Apr 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions interface-definitions/system_option.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@
</valueHelp>
</properties>
</leafNode>
<leafNode name="quiet">
<properties>
<help>Disable most log messages</help>
<valueless/>
</properties>
</leafNode>
<node name="debug">
<properties>
<help>Dynamic debugging for kernel module</help>
Expand Down
32 changes: 30 additions & 2 deletions smoketest/scripts/cli/test_system_option.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
#
# Copyright (C) 2024 VyOS maintainers and contributors
# Copyright (C) 2024-2025 VyOS maintainers and contributors
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 or later as
Expand All @@ -16,14 +16,18 @@

import os
import unittest

from base_vyostest_shim import VyOSUnitTestSHIM

from vyos.configsession import ConfigSessionError
from vyos.utils.cpu import get_cpus
from vyos.utils.file import read_file
from vyos.utils.process import is_systemd_service_active
from vyos.utils.system import sysctl_read
from vyos.system import image

base_path = ['system', 'option']


class TestSystemOption(VyOSUnitTestSHIM.TestCase):
def tearDown(self):
self.cli_delete(base_path)
Expand Down Expand Up @@ -96,6 +100,30 @@ def test_ssh_client_options(self):
self.cli_commit()
self.assertFalse(os.path.exists(ssh_client_opt_file))

def test_kernel_options(self):
amd_pstate_mode = 'active'

self.cli_set(['system', 'option', 'kernel', 'disable-mitigations'])
self.cli_set(['system', 'option', 'kernel', 'disable-power-saving'])
self.cli_set(['system', 'option', 'kernel', 'quiet'])

self.cli_set(['system', 'option', 'kernel', 'amd-pstate-driver', amd_pstate_mode])
cpu_vendor = get_cpus()[0]['vendor_id']
if cpu_vendor != 'AuthenticAMD':
with self.assertRaises(ConfigSessionError):
self.cli_commit()
self.cli_delete(['system', 'option', 'kernel', 'amd-pstate-driver'])

self.cli_commit()

# Read GRUB config file for current running image
tmp = read_file(f'{image.grub.GRUB_DIR_VYOS_VERS}/{image.get_running_image()}.cfg')
self.assertIn(' mitigations=off', tmp)
self.assertIn(' intel_idle.max_cstate=0 processor.max_cstate=1', tmp)
self.assertIn(' quiet', tmp)

if cpu_vendor == 'AuthenticAMD':
self.assertIn(f' initcall_blacklist=acpi_cpufreq_init amd_pstate={amd_pstate_mode}', tmp)

if __name__ == '__main__':
unittest.main(verbosity=2)
9 changes: 9 additions & 0 deletions smoketest/scripts/system/test_kernel_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,5 +134,14 @@ def test_psample_enabled(self):
tmp = re.findall(f'{option}=y', self._config_data)
self.assertTrue(tmp)

def test_amd_pstate(self):
# AMD pstate driver required as we have "set system option kernel amd-pstate-driver"
for option in ['CONFIG_X86_AMD_PSTATE']:
tmp = re.findall(f'{option}=y', self._config_data)
self.assertTrue(tmp)
for option in ['CONFIG_X86_AMD_PSTATE_DEFAULT_MODE']:
tmp = re.findall(f'{option}=3', self._config_data)
self.assertTrue(tmp)

if __name__ == '__main__':
unittest.main(verbosity=2)
4 changes: 3 additions & 1 deletion src/conf_mode/system_option.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
#
# Copyright (C) 2019-2024 VyOS maintainers and contributors
# Copyright (C) 2019-2025 VyOS maintainers and contributors
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 or later as
Expand Down Expand Up @@ -136,6 +136,8 @@ def generate(options):
mode = options['kernel']['amd_pstate_driver']
cmdline_options.append(
f'initcall_blacklist=acpi_cpufreq_init amd_pstate={mode}')
if 'quiet' in options['kernel']:
cmdline_options.append('quiet')
grub_util.update_kernel_cmdline_options(' '.join(cmdline_options))

return None
Expand Down
2 changes: 2 additions & 0 deletions src/op_mode/image_installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,8 @@ def get_cli_kernel_options(config_file: str) -> list:
mode = kernel_options['amd-pstate-driver']
cmdline_options.append(
f'initcall_blacklist=acpi_cpufreq_init amd_pstate={mode}')
if 'quiet' in kernel_options:
cmdline_options.append('quiet')

return cmdline_options

Expand Down
Loading