Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
ec48e73
feat: update Firecracker client to v1.14
bchalios Feb 19, 2026
665f0c6
orchestrator: add support for Firecracker v1.14
bchalios Feb 13, 2026
737f601
chore: update Firecracker v1.14 to latest build (76f16f0)
ValentaTomas Apr 16, 2026
9f1f8a5
feat: update Firecracker client to v1.14
bchalios Feb 19, 2026
4a96302
orchestrator: add support for Firecracker v1.14
bchalios Feb 13, 2026
acd254d
chore: auto-commit generated changes
github-actions[bot] Feb 23, 2026
930a691
feat(uffd): add page state tracking for guest memory
bchalios Feb 20, 2026
930725e
feat(uffd): export more CGO bindings for UFFD
bchalios Feb 12, 2026
bc94cdf
feat(uffd): handle remove events from the file descriptor
bchalios Feb 20, 2026
80dc9ba
fix(uffd): prefault with UFFD_COPY_MODE_WP
bchalios Mar 9, 2026
6fca058
fix(uffd): don't pass UFFD_COPY_MODE_WP when zeroing a page
bchalios Mar 9, 2026
cc779f4
fix(uffd): handle 4K write protection correctly
bchalios Mar 10, 2026
ba20a69
feat: enable free page reporting
bchalios Feb 12, 2026
e02c53a
Add feature flag for free page reporting
ValentaTomas Mar 10, 2026
7dcd66a
feat(uffd): add WP mode test for prefetch
ValentaTomas Mar 11, 2026
e2e49e8
feat(uffd): add tests for UFFD remove events
ValentaTomas Mar 11, 2026
ad99946
fix(uffd-test): reduce parallelism in tests
bchalios Mar 26, 2026
6ee2a2a
fix(uffd): synchronize UFFD events across iterations
bchalios Mar 26, 2026
d6de753
fix(uffd): eliminate remove / prefaulting race condition
bchalios Mar 31, 2026
74d8300
fix(uffd-test): fix defer capturing stale cleanup in gated serve
bchalios Apr 2, 2026
7c7b660
fix(uffd): copy event structs in readEvents to prevent pointer aliasing
ValentaTomas Apr 11, 2026
54f48a3
fix(uffd): add wakeup pipe to prevent orphaned deferred faults
ValentaTomas Apr 11, 2026
68f1da8
fix(uffd-test): add sleep after remove to prevent UFFD event race
ValentaTomas Apr 11, 2026
a946521
fix(uffd): wake thread on EEXIST to prevent DONTWAKE hang
ValentaTomas Apr 14, 2026
5acc7ec
fix(uffd-test): disable child process timeout and enable FPR in smoke…
ValentaTomas Apr 15, 2026
10d2311
chore: auto-commit generated changes
github-actions[bot] Apr 15, 2026
9bc0f82
chore: update FC version references to v1.14.1_76f16f0
ValentaTomas Apr 16, 2026
5265808
chore: use FC v1.14.1_458ca91 (latest deployed build)
ValentaTomas Apr 16, 2026
9e85de9
chore: use FC v1.14.1_458ca91 (latest deployed build)
ValentaTomas Apr 16, 2026
80713dc
Merge branch 'main' into feat/firecracker-v1.14
ValentaTomas Apr 18, 2026
4ed2c98
Merge remote-tracking branch 'origin/feat/firecracker-v1.14' into fea…
ValentaTomas Apr 18, 2026
8137fde
fix: address PR review comments for FC v1.14 update
ValentaTomas Apr 18, 2026
8d9b579
revert: undo manual edits to generated go-swagger files
ValentaTomas Apr 18, 2026
ab9b078
chore: auto-commit generated changes
github-actions[bot] Apr 18, 2026
69a0905
fix: add freePageReporting to proto source and regenerate pb.go
ValentaTomas Apr 18, 2026
62225f1
chore: auto-commit generated changes
github-actions[bot] Apr 18, 2026
3e1a67d
Merge remote-tracking branch 'origin/feat/firecracker-v1.14' into fea…
ValentaTomas Apr 18, 2026
0d3fa03
revert: remove freePageReporting proto field
ValentaTomas Apr 18, 2026
103c955
Merge remote-tracking branch 'origin/feat/firecracker-v1.14' into fea…
ValentaTomas Apr 18, 2026
34c4679
feat(proto): re-add freePageReporting to TemplateConfig
ValentaTomas Apr 18, 2026
edb15b6
fix(api): guard NewVersionInfo against version strings without commit…
ValentaTomas Apr 18, 2026
c3f2e99
chore(fc): wipe generated client before regen and drop stale model
ValentaTomas Apr 18, 2026
49ad274
Merge branch 'main' into feat/firecracker-v1.14
ValentaTomas Apr 18, 2026
7d1c447
Merge remote-tracking branch 'origin/feat/firecracker-v1.14' into fea…
ValentaTomas Apr 18, 2026
884c0ed
fix(uffd): UFFDIO_ZEROPAGE error message says 'zeroed' not 'copied'
ValentaTomas Apr 18, 2026
a1a4dae
refactor(uffd): drain pagefault events into a batch per poll cycle
ValentaTomas Apr 18, 2026
b6c29c2
Merge branch 'main' into feat/free-page-reporting
ValentaTomas Apr 20, 2026
08b2d17
Merge remote-tracking branch 'origin/main' into feat/free-page-reporting
ValentaTomas Apr 20, 2026
954c906
Merge branch 'main' into refactor/uffd-batch-read-events
ValentaTomas Apr 20, 2026
dd270fb
Remove change
ValentaTomas Apr 20, 2026
389f484
refactor(uffd): minimize batching diff
ValentaTomas Apr 20, 2026
a5cfbec
refactor(uffd): drop degenerate eagainCounter
ValentaTomas Apr 20, 2026
7a5ef0b
refactor(uffd): restore expanded MINOR/WP comment
ValentaTomas Apr 20, 2026
7c4267d
refactor(uffd): preserve noDataCounter semantics on empty drain
ValentaTomas Apr 20, 2026
c0294ff
refactor(uffd): keep main's MINOR/WP comment unchanged
ValentaTomas Apr 20, 2026
3e38948
Merge remote-tracking branch 'origin/refactor/uffd-batch-read-events'…
ValentaTomas Apr 20, 2026
6d4af43
Merge remote-tracking branch 'origin/main' into feat/free-page-reporting
ValentaTomas Apr 21, 2026
5335311
Merge remote-tracking branch 'origin/main' into feat/free-page-reporting
ValentaTomas Apr 21, 2026
55d3420
Merge branch 'main' into feat/free-page-reporting
ValentaTomas Apr 21, 2026
f10a5c6
refactor(uffd): replace block.Tracker with pageTracker
ValentaTomas Apr 21, 2026
9dec696
fixup: address review feedback
ValentaTomas Apr 21, 2026
417db86
test(uffd): compare faulted offsets unordered instead of sorting
ValentaTomas Apr 21, 2026
7fcda66
fixup: tighten pageStateEntries locking and clarify faultPage comment
ValentaTomas Apr 21, 2026
7abae2e
Merge branch 'refactor/uffd-page-tracker' into feat/free-page-reporting
ValentaTomas Apr 21, 2026
ecf353b
fixup: drop unused unfaulted const, remove redundant stderr print
ValentaTomas Apr 21, 2026
65c0fb1
Merge branch 'refactor/uffd-page-tracker' into feat/free-page-reporting
ValentaTomas Apr 21, 2026
a597bf6
fixup: keep unfaulted as the named zero value of pageState
ValentaTomas Apr 21, 2026
1d16b7d
Merge remote-tracking branch 'origin/refactor/uffd-page-tracker' into…
ValentaTomas Apr 21, 2026
b0b5e77
fixup: rename unfaulted to missing
ValentaTomas Apr 21, 2026
9126f4f
fixup: rename pageState unfaulted to missing
ValentaTomas Apr 21, 2026
3bce06a
Merge remote-tracking branch 'origin/refactor/uffd-page-tracker' into…
ValentaTomas Apr 21, 2026
1aa4a07
fixup: drop verbose comment on missing pageState
ValentaTomas Apr 21, 2026
10ded4c
Merge branch 'main' into feat/free-page-reporting
ValentaTomas Apr 21, 2026
bb93b9f
chore: auto-commit generated changes
github-actions[bot] Apr 21, 2026
c39e5a1
Merge branch 'main' into feat/free-page-reporting
ValentaTomas Apr 21, 2026
b2725e1
Merge remote-tracking branch 'origin/main' into feat/free-page-reporting
ValentaTomas Apr 21, 2026
1663f49
Merge remote-tracking branch 'origin/main' into feat/free-page-reporting
ValentaTomas Apr 22, 2026
8b47283
Merge branch 'main' into feat/free-page-reporting
ValentaTomas Apr 23, 2026
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
4 changes: 4 additions & 0 deletions packages/api/internal/template-manager/create_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"github.com/e2b-dev/infra/packages/db/pkg/types"
"github.com/e2b-dev/infra/packages/db/queries"
"github.com/e2b-dev/infra/packages/shared/pkg/fcversion"
"github.com/e2b-dev/infra/packages/shared/pkg/featureflags"
templatemanagergrpc "github.com/e2b-dev/infra/packages/shared/pkg/grpc/template-manager"
"github.com/e2b-dev/infra/packages/shared/pkg/id"
"github.com/e2b-dev/infra/packages/shared/pkg/logger"
Expand Down Expand Up @@ -109,6 +110,8 @@ func (tm *TemplateManager) CreateTemplate(
return fmt.Errorf("failed to convert image registry: %w", err)
}

freePageReporting := features.HasFreePageReporting() && tm.featureFlags.BoolFlag(ctx, featureflags.FreePageReportingFlag, featureflags.TeamContext(teamID.String()))

// TODO(ENG-3852): Remove later. KernelVersion and FirecrackerVersion are deprecated on
// template-manager selects its own versions and reports the ones it actually
// used via TemplateBuildMetadata. They are still populated here for
Expand All @@ -123,6 +126,7 @@ func (tm *TemplateManager) CreateTemplate(
KernelVersion: kernelVersion,
FirecrackerVersion: firecrackerVersion,
HugePages: features.HasHugePages(),
FreePageReporting: &freePageReporting,
StartCommand: startCmd,
ReadyCommand: readyCmd,
Force: force,
Expand Down
30 changes: 27 additions & 3 deletions packages/orchestrator/cmd/create-build/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ func main() {
memory := flag.Int("memory", 1024, "memory MB")
disk := flag.Int("disk", 1024, "disk MB")
hugePages := flag.Bool("hugepages", true, "use 2MB huge pages for memory (false = 4KB pages)")
freePageReporting := flag.Bool("free-page-reporting", false, "enable free page reporting via balloon device (requires Firecracker v1.14+)")
startCmd := flag.String("start-cmd", "", "start command")
setupCmd := flag.String("setup-cmd", "", "setup command to run during build (e.g., install deps)")
readyCmd := flag.String("ready-cmd", "", "ready check command")
Expand Down Expand Up @@ -100,7 +101,16 @@ func main() {
log.Fatalf("network config: %v", err)
}

err = doBuild(ctx, *templateID, *toBuild, *fromBuild, *kernel, *fc, *vcpu, *memory, *disk, *hugePages, *startCmd, *setupCmd, *readyCmd, localMode, *verbose, *timeout, builderConfig, networkConfig)
// Detect if --free-page-reporting was explicitly set; if not, pass nil so
// doBuild can default based on the Firecracker version.
var fprOverride *bool
flag.Visit(func(f *flag.Flag) {
if f.Name == "free-page-reporting" {
fprOverride = freePageReporting
}
})

err = doBuild(ctx, *templateID, *toBuild, *fromBuild, *kernel, *fc, *vcpu, *memory, *disk, *hugePages, fprOverride, *startCmd, *setupCmd, *readyCmd, localMode, *verbose, *timeout, builderConfig, networkConfig)
if err != nil {
log.Fatal(err)
}
Expand Down Expand Up @@ -199,9 +209,10 @@ func setupEnv(ctx context.Context, storagePath, sandboxDir, kernel, fc string, l

func doBuild(
parentCtx context.Context,
templateID, buildID, fromBuild, kernel, fc string,
templateID, buildID, fromBuild, kernel, fcVersion string,
vcpu, memory, disk int,
hugePages bool,
freePageReporting *bool,
startCmd, setupCmd, readyCmd string,
localMode, verbose bool,
timeout int,
Expand Down Expand Up @@ -341,6 +352,18 @@ func doBuild(
})
}

// Default FPR to enabled when the FC version supports it (v1.14+); explicit flag overrides.
var fprEnabled bool
if freePageReporting != nil {
fprEnabled = *freePageReporting
} else {
versionOnly, _, _ := strings.Cut(fcVersion, "_")
supported, err := utils.IsGTEVersion(versionOnly, "v1.14.0")
if err == nil {
fprEnabled = supported
}
}

tmpl := config.TemplateConfig{
Version: templates.TemplateV2LatestVersion,
TemplateID: templateID,
Expand All @@ -349,10 +372,11 @@ func doBuild(
MemoryMB: int64(memory),
DiskSizeMB: int64(disk),
HugePages: hugePages,
FreePageReporting: fprEnabled,
StartCmd: startCmd,
ReadyCmd: readyCmd,
KernelVersion: kernel,
FirecrackerVersion: fc,
FirecrackerVersion: fcVersion,
Steps: steps,
}

Expand Down
16 changes: 11 additions & 5 deletions packages/orchestrator/cmd/smoketest/smoke_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import (
sbxlogger "github.com/e2b-dev/infra/packages/shared/pkg/logger/sandbox"
"github.com/e2b-dev/infra/packages/shared/pkg/storage"
"github.com/e2b-dev/infra/packages/shared/pkg/templates"
"github.com/e2b-dev/infra/packages/shared/pkg/utils"
)

const (
Expand Down Expand Up @@ -71,11 +72,14 @@ func TestSmokeAllFCVersions(t *testing.T) { //nolint:paralleltest // subtests sh
defer infra.close(ctx)

for fcMajor, fcVersion := range featureflags.FirecrackerVersionMap { //nolint:paralleltest // sequential by design
versionOnly, _, _ := strings.Cut(fcVersion, "_")
fpr, _ := utils.IsGTEVersion(versionOnly, "v1.14.0")

t.Run("fc-"+fcMajor, func(t *testing.T) {
buildID := uuid.New().String()

// Phase 1: create build
t.Logf("creating build %s with FC %s", buildID, fcVersion)
t.Logf("creating build %s with FC %s (freePageReporting=%v)", buildID, fcVersion, fpr)
force := true
_, err := infra.builder.Build(
ctx,
Expand All @@ -88,6 +92,7 @@ func TestSmokeAllFCVersions(t *testing.T) { //nolint:paralleltest // subtests sh
MemoryMB: 512,
DiskSizeMB: 512,
HugePages: true,
FreePageReporting: fpr,
KernelVersion: featureflags.DefaultKernelVersion,
FirecrackerVersion: fcVersion,
FromImage: baseImage,
Expand All @@ -111,10 +116,11 @@ func TestSmokeAllFCVersions(t *testing.T) { //nolint:paralleltest // subtests sh
ctx,
tmpl,
sandbox.NewConfig(sandbox.Config{
BaseTemplateID: "smoke-" + fcMajor,
Vcpu: 2,
RamMB: 512,
HugePages: true,
BaseTemplateID: "smoke-" + fcMajor,
Vcpu: 2,
RamMB: 512,
HugePages: true,
FreePageReporting: fpr,
Envd: sandbox.EnvdMetadata{
Vars: map[string]string{},
AccessToken: &token,
Expand Down
24 changes: 24 additions & 0 deletions packages/orchestrator/pkg/sandbox/fc/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,30 @@ func (c *apiClient) startVM(ctx context.Context) error {
return nil
}

func (c *apiClient) enableFreePageReporting(ctx context.Context) error {
ctx, span := tracer.Start(ctx, "enable-free-page-reporting")
defer span.End()

amountMib := int64(0)
deflateOnOom := false

balloonConfig := operations.PutBalloonParams{
Context: ctx,
Body: &models.Balloon{
AmountMib: &amountMib,
DeflateOnOom: &deflateOnOom,
FreePageReporting: true,
},
}

_, err := c.client.Operations.PutBalloon(&balloonConfig)
if err != nil {
return fmt.Errorf("error setting up balloon device: %w", err)
}

return nil
}

func (c *apiClient) memoryMapping(ctx context.Context) (*memory.Mapping, error) {
params := operations.GetMemoryMappingsParams{
Context: ctx,
Expand Down
11 changes: 11 additions & 0 deletions packages/orchestrator/pkg/sandbox/fc/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,7 @@ func (p *Process) Create(
vCPUCount int64,
memoryMB int64,
hugePages bool,
freePageReporting bool,
options ProcessOptions,
txRateLimit RateLimiterConfig,
driveRateLimit RateLimiterConfig,
Expand Down Expand Up @@ -438,6 +439,16 @@ func (p *Process) Create(
}
telemetry.ReportEvent(ctx, "set fc entropy config")

if freePageReporting {
err = p.client.enableFreePageReporting(ctx)
if err != nil {
fcStopErr := p.Stop(ctx)

return errors.Join(fmt.Errorf("error enabling free page reporting: %w", err), fcStopErr)
}
telemetry.ReportEvent(ctx, "enabled free page reporting")
}

err = p.client.startVM(ctx)
if err != nil {
fcStopErr := p.Stop(ctx)
Expand Down
4 changes: 4 additions & 0 deletions packages/orchestrator/pkg/sandbox/sandbox.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ type Config struct {
TotalDiskSizeMB int64
HugePages bool

// Enable free page reporting
FreePageReporting bool

Envd EnvdMetadata

FirecrackerConfig fc.Config
Expand Down Expand Up @@ -495,6 +498,7 @@ func (f *Factory) CreateSandbox(
config.Vcpu,
config.RamMB,
config.HugePages,
config.FreePageReporting,
processOptions,
fc.RateLimiterConfig{
Ops: fc.TokenBucketConfig(throttleConfig.Ops),
Expand Down
Loading
Loading