Skip to content

XDP by default - #12119

Merged
gregcusack merged 1 commit into
anza-xyz:masterfrom
alexpyattaev:xdp_by_default
Jun 22, 2026
Merged

XDP by default#12119
gregcusack merged 1 commit into
anza-xyz:masterfrom
alexpyattaev:xdp_by_default

Conversation

@alexpyattaev

@alexpyattaev alexpyattaev commented Apr 22, 2026

Copy link
Copy Markdown

Problem

XDP should not be experimental anymore https://discord.com/channels/428295358100013066/478692221441409024/1496253676891930865

Summary of Changes

  • Enable by default for agave-validator
  • Still disabled for multinode and test-validator (since those are expected to run on localhost)

Testing

  • This is currently running on an a staked testnet node DZ6m64cghUKgVcvsFgAb3NDaeEyRpuMSK8hwqETndNTS

@alexpyattaev alexpyattaev changed the title Xdp by default XDP by default Apr 22, 2026
Comment thread validator/src/commands/run/args.rs Outdated
Comment thread validator/src/commands/run/execute.rs Outdated
Comment thread validator/src/commands/run/execute.rs Outdated
Comment thread xdp/src/cpu_topology.rs Outdated
Comment thread validator/src/commands/run/args.rs Outdated
@alexpyattaev alexpyattaev added noCI Suppress CI on this Pull Request CI Pull Request is ready to enter CI and removed noCI Suppress CI on this Pull Request labels Apr 23, 2026
@anza-team anza-team removed the CI Pull Request is ready to enter CI label Apr 24, 2026
@bw-solana bw-solana mentioned this pull request Apr 24, 2026
@codecov-commenter

codecov-commenter commented Apr 25, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 78.04878% with 27 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.2%. Comparing base (10bb14c) to head (e9c098a).
⚠️ Report is 7 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff             @@
##           master   #12119       +/-   ##
===========================================
+ Coverage    72.1%    83.2%    +11.0%     
===========================================
  Files         748      855      +107     
  Lines      227236   341670   +114434     
===========================================
+ Hits       164042   284518   +120476     
+ Misses      63194    57152     -6042     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@alexpyattaev
alexpyattaev force-pushed the xdp_by_default branch 2 times, most recently from 1e17c53 to e39da1a Compare June 12, 2026 09:58
@alexpyattaev
alexpyattaev marked this pull request as ready for review June 12, 2026 10:53
@alexpyattaev
alexpyattaev requested a review from a team June 12, 2026 10:53
@gregcusack

Copy link
Copy Markdown

made a replacement PR here: #13192
^ did this since:

  1. we want copy mode default
  2. we want to use --no-xdp
  3. alex focusing on votor work.

although, I happy to build on top of this PR is and get rid of mine. but if we go that way, we need to add the things mentioned above.

@alexpyattaev

Copy link
Copy Markdown
Author

made a replacement PR here: #13192 ^ did this since:

1. we want copy mode default

This is not changing the mode used by default, and agave default is copy mode.

2. we want to use `--no-xdp`

This was rejected by @bw-solana in #12119 (comment)

@gregcusack gregcusack left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

ignore my comment above! sorry, i completely misread that this had xdp copy mode on by default. closed my other PR. this looks good! few thoughts!

also should probably promote experimental poh arg before we merge this one imo. see: #13191

Comment thread multinode-demo/bootstrap-validator.sh Outdated
--no-wait-for-vote-to-start-leader
--full-rpc-api
--allow-private-addr
--disable-xdp

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

per brooks' comment and brennan's thumbs up in slack. let's change this back to --no-xdp

@bw-solana bw-solana Jun 20, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

yes, apologies for causing the thrash. I'm redacted again

Comment on lines 300 to 302
if bind_addresses.len() > 1 && public_tvu_addr.is_some() {
Err(String::from(
"--public-tvu-address can not be used in a multihoming context",
))?;
Err(String::from("XDP can not be used in a multihoming context"))?;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

we can probably remove this? doesn't seem right to base this on public_tvu_addr. in fact if someone passes in two bind addresses, we should force them to also pass in --no-xdp.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

yes!

Comment thread CHANGELOG.md Outdated
Comment on lines +45 to +47
* XDP transmit is now enabled by default on Linux. The validator requires `CAP_NET_ADMIN` and
`CAP_NET_RAW` capabilities (plus `CAP_BPF` and `CAP_PERFMON` for `--xdp-zero-copy`). Pass
`--disable-xdp` to disable XDP and fall back to UDP sockets.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

i would just mention that xdp in skb mode (copy mode) is enabled to be clear.

Comment thread CHANGELOG.md Outdated
Comment on lines +55 to +56
* The `--experimental-retransmit-xdp-interface`, `--experimental-retransmit-xdp-cpu-cores`, and
`--experimental-retransmit-xdp-zero-copy` flags have been deprecated. Use `--xdp-interface`,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

haven't these flags already been deprecated? so this should be a separate PR. they should probably be removed in 4.2, right? or we need to wait for major version bump?

this last comment should stay though:

XDP is now enabled by default; use `--disable-xdp` to opt out.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Yep just needed to rebase.

Comment thread CHANGELOG.md Outdated
`--experimental-retransmit-xdp-zero-copy` flags have been deprecated. Use `--xdp-interface`,
`--xdp-cpu-cores`, and `--xdp-zero-copy` instead. XDP is now enabled by default; use `--disable-xdp` to opt out.
#### Changes
* Added `--disable-xdp` flag to disable XDP transmit and fall back to UDP sockets.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

don't need to mentioned --disable-xdp twice. either leave here or leave above. i'd probably recommend leaving here and getting rid above

Comment thread CHANGELOG.md Outdated
Comment on lines +60 to +64
* Added `--xdp-interface` to specify the network interface for XDP transmit (auto-detected from
default route if not specified).
* Added `--xdp-cpu-cores` to specify CPU cores for XDP transmit (defaults to 1 auto-selected core
that avoids the PoH core and its hyperthread sibling).
* Added `--xdp-zero-copy` to enable XDP zero-copy mode (requires hardware/driver support).

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

this should be separate PR since these were already added in a previous PR.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

yes this somehow bypassed rebase.

Comment thread README.md Outdated
Comment on lines +70 to +71
To run without XDP, pass `--disable-xdp` instead (no capabilities required in this case).

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

tbh i wouldn't advertise that you can run without xdp. so i would delete this. make them look for it if they really want to turn it off lol

Comment thread CHANGELOG.md Outdated
#### Breaking
* `--block-production-method central-scheduler` is no longer supported. If passed, a warning is emitted and behavior
will default to the greedy-scheduler implementation.
* XDP transmit is now enabled by default on Linux. The validator requires `CAP_NET_ADMIN` and

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

i would also add in here that we now enforce pinned cpu core does not overlap with xdp core.

Comment thread validator/src/commands/run/execute.rs Outdated
Comment on lines 182 to 226
let poh_pinned_cpu_core =
value_of(matches, "poh_pinned_cpu_core").or(poh_service::DEFAULT_PINNED_CPU_CORE);
let xdp_cpu_cores = matches
.value_of("xdp_cpu_cores")
.or_else(|| matches.value_of("experimental_retransmit_xdp_cpu_cores"));
let cpus = if let Some(cpu_str) = xdp_cpu_cores {
if bind_addresses.len() > 1 {
Err(String::from(
"--xdp-cpu-cores cannot be used in a multihoming context",
))?;
}
Some(parse_cpu_ranges(cpu_str).expect("clap validator already accepted this CPU list"))
} else {
// Auto-select a single core for XDP.
match cpu_affinity(None) {
Ok(allowed) => {
match allowed
.iter()
.rev()
.map(|cpu| **cpu)
.find(|cpu| Some(*cpu) != poh_pinned_cpu_core)
{
Some(cpu) => Some(vec![cpu]),
None => {
return Err(format!(
"XDP requires a dedicated CPU core separate from PoH (core \
{poh_pinned_cpu_core:?}), but none is available. Pass \
--disable-xdp to disable XDP."
))?;
}
}
}
Err(e) => {
return Err(format!(
"failed to query CPU affinity: {e}. Pass --disable-xdp to disable XDP, or \
provide --xdp-cpu-cores explicitly."
))?;
}
}
};
cpus.map(|cpus| {
info!("XDP enabled on CPU cores: {cpus:?}");
XdpConfig::new(xdp_interface, cpus, xdp_zero_copy)
})
};

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

can we pull this out into a function so we can write a test or two to make sure we haven't screwed up slash don't screw up cli args

Comment thread validator/src/commands/run/execute.rs Outdated
Comment on lines +187 to +193
let cpus = if let Some(cpu_str) = xdp_cpu_cores {
if bind_addresses.len() > 1 {
Err(String::from(
"--xdp-cpu-cores cannot be used in a multihoming context",
))?;
}
Some(parse_cpu_ranges(cpu_str).expect("clap validator already accepted this CPU list"))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

if you explicitly pass in the same xdp core as poh core, this will not fail. so probably want to ensure these don't conflict here.

@gregcusack gregcusack left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

looks better! thank you! will you also update docs/src/operations/running-with-af-xdp.md with the changes to that md file seen here please: https://github.com/anza-xyz/agave/pull/13192/changes

Comment thread validator/src/commands/run/execute.rs Outdated
Comment on lines +329 to +330
been permitted to the current process: {missing_caps:?}. If XDP is not needed, \
pass --no-xdp to disable it",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

nit: i would remove this part lol:

If XDP is not needed, pass --no-xdp to disable it

Comment on lines -263 to -268
if bind_addresses.len() > 1 && public_tvu_addr.is_some() {
Err(String::from(
"--public-tvu-address can not be used in a multihoming context",
))?;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

this deletion seems unrelated?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

spooky action at a distance. reverted.

Comment thread README.md Outdated
Comment on lines +61 to +68
$ sudo setcap 'cap_net_admin,cap_net_raw+eip' target/release/agave-validator
```

For XDP zero-copy mode (`--xdp-zero-copy`), additional capabilities are needed:

```bash
$ sudo setcap 'cap_net_admin,cap_net_raw,cap_bpf,cap_perfmon+eip' target/release/agave-validator
```

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

above it says run ./cargo build but then we say to use setcap on target/release/agave-validator but ./cargo build won't put the agave-validator binary into release/

Comment thread validator/src/commands/run/execute.rs Outdated
fn test_explicit_xdp_core_conflicts_with_poh_core_is_error() {
let default_args = DefaultArgs::default();
let app = add_args(clap::App::new("agave-validator"), &default_args);
// poh_pinned_cpu_core defaults to DEFAULT_PINNED_CPU_CORE (1); set XDP to the same.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

this defaults to 0, not 1

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I've just removed the comment.

@alexpyattaev

Copy link
Copy Markdown
Author

will you also update docs/src/operations/running-with-af-xdp.md with the changes to that md file seen here please: https://github.com/anza-xyz/agave/pull/13192/changes

Docs would have to be another PR to another repo - docs were moved.

@alexpyattaev
alexpyattaev requested a review from gregcusack June 16, 2026 13:59
@gregcusack

Copy link
Copy Markdown

will you also update docs/src/operations/running-with-af-xdp.md with the changes to that md file seen here please: https://github.com/anza-xyz/agave/pull/13192/changes

Docs would have to be another PR to another repo - docs were moved.

they removed docs?!?! sad. ok now it's harder to match code updates to doc updates. but i get why they did it.

@gregcusack gregcusack left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

last few thoughts!

Comment thread validator/src/commands/run/execute.rs Outdated
}
Some(parsed)
} else {
// Auto-select a single core, avoiding the PoH core and its hyperthread sibling.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

nit: "and its hyperthread sibling." i am not sure this is actually true...

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

yes this used to be true with previous version that did not use cpu-utils. stale.

Comment thread README.md Outdated
Comment on lines +61 to +67
$ sudo setcap 'cap_net_admin,cap_net_raw+eip' target/debug/agave-validator
```

For XDP zero-copy mode (`--xdp-zero-copy`), additional capabilities are needed:

```bash
$ sudo setcap 'cap_net_admin,cap_net_raw,cap_bpf,cap_perfmon+eip' target/debug/agave-validator

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

nit: sorry, maybe we should just say

sudo setcap 'cap_net_admin,cap_net_raw+eip' <path-to-agave-validator-binary>

because if we're running in debug mode, why are we using xdp. but then again above it says:

> [!NOTE]
> Note that this builds a debug version that is **not suitable for running a testnet or mainnet validator**. Please read [`docs/src/cli/install.md`](docs/src/cli/install.md#build-from-source) for instructions to build a release version for test and production uses.

^ so maybe that's clear enough that if you are actually going to run a validator you don't want to run in debug mode.

Comment thread validator/src/commands/run/execute.rs Outdated
Comment on lines +1399 to +1400
let poh_pinned_cpu_core =
value_of(matches, "poh_pinned_cpu_core").or(poh_service::DEFAULT_PINNED_CPU_CORE);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

ok so we also need to check for the experimental version of this pinned poh flag as well. or else we won't catch that the xdp and poh cores overlap

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Gotta love ancient version of clap..

@mergify

mergify Bot commented Jun 20, 2026

Copy link
Copy Markdown

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

@gregcusack gregcusack left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

lgtm!

@gregcusack
gregcusack added this pull request to the merge queue Jun 22, 2026
Merged via the queue into anza-xyz:master with commit 1d0d634 Jun 22, 2026
43 checks passed
@gregcusack
gregcusack deleted the xdp_by_default branch June 22, 2026 16:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants