|  | # Copyright 2020 The Fuchsia Authors. All rights reserved. | 
|  | # Use of this source code is governed by a BSD-style license that can be | 
|  | # found in the LICENSE file. | 
|  |  | 
|  | import("//build/zbi/kernel_cmdline.gni") | 
|  |  | 
|  | # This serves as an anchor point. By expressing a dependency on | 
|  | # //boards/kernel_cmdline, build arguments declared in this file | 
|  | # (e.g. pmm_checker_from_board) are brought into scope. | 
|  | group("kernel_cmdline") { | 
|  | } | 
|  |  | 
|  | kernel_cmdline("serial-legacy") { | 
|  | args = [ "kernel.serial=legacy" ] | 
|  | deps = [ "//build/validate:non_production_tag" ] | 
|  | } | 
|  |  | 
|  | kernel_cmdline("disable-blobfs-compression") { | 
|  | args = [ "blobfs.write-compression-algorithm=UNCOMPRESSED" ] | 
|  | deps = [ "//build/validate:non_production_tag" ] | 
|  | } | 
|  |  | 
|  | kernel_cmdline("pmm-checker") { | 
|  | args = [ | 
|  | # Enable PMM checker to detect certain kinds of buffer overrun and | 
|  | # use-after-free bugs. | 
|  | "kernel.pmm-checker.enable=true", | 
|  |  | 
|  | # Use a small fill size to minimize performance impact.  In practice, | 
|  | # corruption tends to happen at the start of a page so filling/checking only | 
|  | # the first 16 bytes provides decent coverage without sacrificing | 
|  | # performance. | 
|  | "kernel.pmm-checker.fill-size=16", | 
|  | ] | 
|  | } | 
|  |  | 
|  | declare_args() { | 
|  | # Used to control whether board definitions include PMM checker options. | 
|  | pmm_checker_from_board = true | 
|  | } | 
|  |  | 
|  | group("pmm-checker-from-board") { | 
|  | if (pmm_checker_from_board) { | 
|  | deps = [ ":pmm-checker" ] | 
|  | } | 
|  | } | 
|  |  | 
|  | kernel_cmdline("toulouse") { | 
|  | args = [ | 
|  | # Fuchsia does not have a deterministic ordering for bringing up PCI devices, so the | 
|  | # /dev/class/ethernet/xxx paths have no well-defined mapping to the ports on the front of the | 
|  | # device. | 
|  | # In order for netbooting and loglistener to work, we need to let netsvc know which path corresponds | 
|  | # to the left-most ethernet port. | 
|  | "kernel.serial=legacy", | 
|  | "netsvc.interface=/dev/sys/platform/pci/00:1f.6/e1000/ethernet", | 
|  | ] | 
|  | } | 
|  |  | 
|  | # This collects settings not specific to any particular machine that are | 
|  | # recommended to minimize unintended effects on timing data.  Note that this | 
|  | # does not (as yet) include settings that may reduce overall performance, which | 
|  | # x64-reduced-perf-variation (below) does (see x64-reduced-perf-variation.gni). | 
|  | group("reduced-perf-variation") { | 
|  | deps = [ | 
|  | ":disable-page-scanner", | 
|  | ":quiet-early-boot", | 
|  | ] | 
|  | } | 
|  |  | 
|  | # This collects settings not specific to any particular machine that are | 
|  | # recommended to make the system's performance highly representative of a | 
|  | # production setup. | 
|  | group("perf-realistic") { | 
|  | deps = [ ":quiet-early-boot" ] | 
|  | } | 
|  |  | 
|  | kernel_cmdline("quiet-early-boot") { | 
|  | args = [ | 
|  | # Disable serial console printing during early boot, a phase during which | 
|  | # UART communication is single-threaded and synchronous. In production, | 
|  | # the serial console will be disabled, and so early boot benchmarks that | 
|  | # include this work is sensibly avoided. | 
|  | "kernel.phys.verbose=false", | 
|  | ] | 
|  | } | 
|  |  | 
|  | kernel_cmdline("disable-page-scanner") { | 
|  | args = [ | 
|  | # Disable page scanning in all its forms. Page scanning is intended to | 
|  | # provide a memory benefit to final systems, but the operation of the | 
|  | # scanner and its unpredictable de-duplication or eviction of memory in use | 
|  | # by benchmarks could cause noticeable variation. | 
|  | "kernel.page-scanner.start-at-boot=false", | 
|  | "kernel.page-scanner.zero-page-scans-per-second=0", | 
|  | "kernel.page-scanner.enable-eviction=false", | 
|  | ] | 
|  | } | 
|  |  | 
|  | kernel_cmdline("x64-reduced-perf-variation") { | 
|  | deps = [ ":reduced-perf-variation" ] | 
|  | args = [ | 
|  | # Disable Intel Turbo Boost. Turbo Boost provides a significant speed-up to | 
|  | # many workloads, but — because CPU frequencies vary based on previous work, | 
|  | # work in other cores, system temperature, etc — makes performance of systems | 
|  | # less predictable. We prefer stability in our performance comparison | 
|  | # benchmarks. | 
|  | "kernel.x86.turbo=false", | 
|  |  | 
|  | # Set the Intel HWP performance profile to be "stable", trying to keep the | 
|  | # CPU clock rate stable. With turbo boost disabled, this has only a small | 
|  | # effect, but helps ensure that wake ups from idle are fixed. | 
|  | "kernel.x86.hwp_policy=stable-performance", | 
|  |  | 
|  | # Disable hyper-threading. Hyper-threading reduces predictability of | 
|  | # benchmarks, because the performance of a thread is significantly affected | 
|  | # by other threads on the core. | 
|  | "kernel.smp.ht=false", | 
|  |  | 
|  | # Disable spectre mitigations. Spectre mitigations have significant | 
|  | # performance impact, but are currently only carried out on a subset of the | 
|  | # NUC fleet. This means that different devices have significantly different | 
|  | # performance characteristics, meaning that benchmark results vary | 
|  | # significantly based on the device running it. | 
|  | # | 
|  | # TODO(fxbug.dev/33161): Ideally, we should load microcode during Zircon boot, | 
|  | # which should bring all devices to the same patch level, removing the | 
|  | # performance differences when spectre mitigations are in place. | 
|  | "kernel.x86.disable_spec_mitigations=true", | 
|  | ] | 
|  | } | 
|  |  | 
|  | kernel_cmdline("gce") { | 
|  | args = [ "kernel.serial=legacy" ] | 
|  | } | 
|  |  | 
|  | kernel_cmdline("vim3") { | 
|  | deps = [ ":pmm-checker-from-board" ] | 
|  | args = [ | 
|  | # Prefer using the built-in NIC to the CDC-ether interface. | 
|  | "netsvc.interface=/dev/dwmac/dwmac/Designware-MAC/ethernet", | 
|  | ] | 
|  | } | 
|  |  | 
|  | kernel_cmdline("chromebook-x64") { | 
|  | deps = [ ":pmm-checker-from-board" ] | 
|  | args = [ | 
|  | # Depthcharge will fill this in. | 
|  | "zvb.boot-partition-uuid=%U", | 
|  | ] | 
|  | } |