Skip to content
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

bpf: improve handling of partial failures #259

Merged
merged 3 commits into from
Dec 3, 2021
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
27 changes: 23 additions & 4 deletions src/samplers/disk/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,11 @@ impl Disk {
// attach only if 'blk_start_request' can be found.
if let Ok(results) = bpf.get_kprobe_functions("blk_start_request") {
if !results.is_empty() {
probe.try_attach_to_bpf(&mut bpf)?
if self.common.config.fault_tolerant() {
let _ = probe.try_attach_to_bpf(&mut bpf);
} else {
probe.try_attach_to_bpf(&mut bpf)?;
}
}
}
}
Expand All @@ -167,7 +171,11 @@ impl Disk {
bpf.get_kprobe_functions("blk_account_io_completion")
{
if !results.is_empty() {
probe.try_attach_to_bpf(&mut bpf)?
if self.common.config.fault_tolerant() {
let _ = probe.try_attach_to_bpf(&mut bpf);
} else {
probe.try_attach_to_bpf(&mut bpf)?;
}
}
}
}
Expand All @@ -178,11 +186,22 @@ impl Disk {
bpf.get_kprobe_functions("blk_account_io_completion")
{
if results.is_empty() {
probe.try_attach_to_bpf(&mut bpf)?
if self.common.config.fault_tolerant() {
let _ = probe.try_attach_to_bpf(&mut bpf);
} else {
probe.try_attach_to_bpf(&mut bpf)?;
}
}
}
}
_ => probe.try_attach_to_bpf(&mut bpf)?,
_ => {
// load + attach the kernel probes that are required to the bpf instance.
if self.common.config.fault_tolerant() {
let _ = probe.try_attach_to_bpf(&mut bpf);
} else {
probe.try_attach_to_bpf(&mut bpf)?;
}
}
}
}

Expand Down
6 changes: 5 additions & 1 deletion src/samplers/ext4/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,11 @@ impl Ext4 {

// load + attach the kernel probes that are required to the bpf instance.
for probe in probes {
probe.try_attach_to_bpf(&mut bpf)?;
if self.common.config.fault_tolerant() {
let _ = probe.try_attach_to_bpf(&mut bpf);
} else {
probe.try_attach_to_bpf(&mut bpf)?;
}
}

self.bpf = Some(Arc::new(Mutex::new(BPF { inner: bpf })));
Expand Down
7 changes: 6 additions & 1 deletion src/samplers/interrupt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,13 @@ impl Interrupt {

// load + attach the kernel probes that are required to the bpf instance.
for probe in probes {
probe.try_attach_to_bpf(&mut bpf)?;
if self.common.config.fault_tolerant() {
let _ = probe.try_attach_to_bpf(&mut bpf);
} else {
probe.try_attach_to_bpf(&mut bpf)?;
}
}

self.bpf = Some(Arc::new(Mutex::new(BPF { inner: bpf })))
}
}
Expand Down
6 changes: 5 additions & 1 deletion src/samplers/network/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,11 @@ impl Network {

// load + attach the kernel probes that are required to the bpf instance.
for probe in probes {
probe.try_attach_to_bpf(&mut bpf)?;
if self.common.config.fault_tolerant() {
let _ = probe.try_attach_to_bpf(&mut bpf);
} else {
probe.try_attach_to_bpf(&mut bpf)?;
}
}

self.bpf = Some(Arc::new(Mutex::new(BPF { inner: bpf })));
Expand Down
6 changes: 5 additions & 1 deletion src/samplers/page_cache/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,11 @@ impl PageCache {

// load + attach the kernel probes that are required to the bpf instance.
for probe in probes {
probe.try_attach_to_bpf(&mut bpf)?;
if self.common.config.fault_tolerant() {
let _ = probe.try_attach_to_bpf(&mut bpf);
} else {
probe.try_attach_to_bpf(&mut bpf)?;
}
}

self.bpf = Some(Arc::new(Mutex::new(BPF { inner: bpf })))
Expand Down
6 changes: 5 additions & 1 deletion src/samplers/scheduler/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,11 @@ impl Scheduler {

// load + attach the kernel probes that are required to the bpf instance.
for probe in probes {
probe.try_attach_to_bpf(&mut bpf)?;
if self.common.config.fault_tolerant() {
let _ = probe.try_attach_to_bpf(&mut bpf);
} else {
probe.try_attach_to_bpf(&mut bpf)?;
}
}

self.bpf = Some(Arc::new(Mutex::new(BPF { inner: bpf })));
Expand Down
6 changes: 5 additions & 1 deletion src/samplers/tcp/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,11 @@ impl Tcp {

// load + attach the kernel probes that are required to the bpf instance.
for probe in probes {
probe.try_attach_to_bpf(&mut bpf)?;
if self.common.config.fault_tolerant() {
let _ = probe.try_attach_to_bpf(&mut bpf);
} else {
probe.try_attach_to_bpf(&mut bpf)?;
}
}

self.bpf = Some(Arc::new(Mutex::new(BPF { inner: bpf })))
Expand Down
6 changes: 5 additions & 1 deletion src/samplers/xfs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,11 @@ impl Xfs {

// load + attach the kernel probes that are required to the bpf instance.
for probe in probes {
probe.try_attach_to_bpf(&mut bpf)?;
if self.common.config.fault_tolerant() {
let _ = probe.try_attach_to_bpf(&mut bpf);
} else {
probe.try_attach_to_bpf(&mut bpf)?;
}
}

self.bpf = Some(Arc::new(Mutex::new(BPF { inner: bpf })));
Expand Down