Skip to content

Add PGO Applicability Feature (Prototype) #5193

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

Open
wants to merge 27 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
a7f6494
tools/devtool: add PGO helper scripting to devtool
valeriepieger May 3, 2025
69e3eae
docs/pgo-getting-started.md: added a getting started guide for PGO
valeriepieger Apr 27, 2025
41864da
feat: Add PVTime support for ARM
DakshinD Apr 24, 2025
10429dc
test: Add steal time integration tests
DakshinD Apr 24, 2025
a2ae6bd
doc: Add changelog entry for PVTime
DakshinD Apr 24, 2025
83b3e77
build(deps): Bump the firecracker group with 12 updates
dependabot[bot] Apr 28, 2025
e8a6d6a
test(signal): remove flaky unit test
Manciukic May 1, 2025
1ebf723
test(jailer): use tmp dir for mknod test
Manciukic Apr 29, 2025
ead75b7
refactor(test/cgroup): use a TempDir instead of a manually created dir
Manciukic May 1, 2025
377b7fa
test(net): add retry in test_tap_offload
Manciukic Apr 29, 2025
482b2ec
test(balloon): ensure we gave stats enough time to update before reading
Manciukic Apr 29, 2025
421b155
fix(test/pvtime): bump tolerance to 10s
Manciukic Apr 30, 2025
080c876
fix(test_reboot): do not assert thread count
Manciukic Apr 30, 2025
ee6a2cc
feat(tests): add systemd_analyze data as boot time metric
ShadowCurse Apr 29, 2025
7d164e6
refactor(tests): update boot time device metrics
ShadowCurse Apr 29, 2025
65b8b33
feat(tests): add resume metric to boot time tests
ShadowCurse Apr 29, 2025
949ac4c
chore: ignore boot test resume_time metric in A/B
ShadowCurse Apr 30, 2025
783ca67
doc: fix arguments to ab_test.py in README
roypat May 2, 2025
29517f6
fix(ab): only reduce dimension set for printing
roypat May 2, 2025
3a990f2
ab: ignore some block throughput metrics on m8g
roypat May 2, 2025
7579beb
build(deps): Bump the firecracker group with 9 updates
dependabot[bot] May 5, 2025
61a93c5
allow specifying custom cpu template inline in config json
roypat Apr 29, 2025
3582c78
chore: Update CHANGELOG in preparation of 1.12.0 release
zulinx86 May 6, 2025
85099fe
chore: Update release status in preparation of v1.12.0 release
zulinx86 May 6, 2025
3827acd
chore: Add CHANGELOG entries for newly supported instance types
zulinx86 May 6, 2025
bacff13
chore: Bump Rust dependencies
zulinx86 May 6, 2025
06b7ece
chore: Bump version to 1.13.0-dev
zulinx86 May 6, 2025
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ test_results/*
/resources/linux
/resources/x86_64
/resources/aarch64
llvm.sh
vmlinux
vmlinux.bin
Empty file added resources/rootfs.ext4
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extra file (vmlinux as well)

Empty file.
Empty file added resources/vmlinux
Empty file.
2 changes: 2 additions & 0 deletions rootfs.ext4
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<Error><Code>NoSuchKey</Code><Message>The specified key does not exist.</Message><Key>img/quickstart_guide/rootfs.ext4</Key><RequestId>F23FN2VRXVEBN5NM</RequestId><HostId>RrqeuoufdOrTKnTLGPPYxjH2RiVaSJydFn55q2W4YypHv89V3TWTxzszOt7fMQTf0w86xQRdRUk=</HostId></Error>
46 changes: 46 additions & 0 deletions tools/devtool
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,9 @@ cmd_help() {
echo " Downloads the CI artifacts used for testing from our S3 bucket. If --force is passed, purges any existing"
echo " artifacts first. Useful for refreshing local artifacts after an update, or if something got messed up."
echo ""
echo " pgo_build [instrument|profile|merge|optimize]"
echo " Build Firecracker with Profile-Guided Optimization (PGO). See README-pgo.md for more information"
echo ""

cat <<EOF
test_debug [-- [<pytest args>]]
Expand Down Expand Up @@ -1083,6 +1086,49 @@ cmd_build_ci_artifacts() {
cmd_fix_perms
}

cmd_pgo_build() {
# For error checking and detecting architecture type
set -e

PROFDATA_DIR=/tmp/firecracker-profdata
PROFDATA_FILE=/tmp/firecracker.profdata

arch=$(uname -m)
if [[ "$arch" != "x86_64" ]]; then
echo "Warning: Non-x86_64 architecture detected ($arch)"
echo "Some features like /dev/kvm and full microVM profiling may not work."
fi


case "$1" in
instrument)
echo "Building instrumented Firecracker binary"
RUSTFLAGS="-Cprofile-generate=/tmp/firecracker-profdata" cargo build --release
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these commands should be run inside the devctr to avoid the missing dependencies issues mentioned in the doc. Maybe we can extend cmd_build to add pgo-instrument and pgo-optimize profiles

echo "Instrumentation complete."
;;
profile)
echo "Run workloads manually to generate .profraw files in /tmp/firecracker-profdata/"
echo "Please consult README-pgo.md for more information."
;;
merge)
echo "Merging .profraw files"
if ! llvm-profdata merge -output=${PROFDATA_FILE} ${PROFDATA_DIR}/*.profraw; then
echo "Error: Failed to merge profile data."
echo " Make sure .profraw files exist and are readable."
exit 1
fi
echo "Merging complete."
;;
optimize)
echo "Building optimized Firecracker with profile data"
RUSTFLAGS="-Cprofile-use=/tmp/firecracker.profdata -Cllvm-args=-pgo-warn-missing-function" cargo build --release
;;
*)
echo "Usage: $0 pgo_build [instrument|profile|merge|optimize]"
exit 1
;;
esac
}

main() {

Expand Down