summary refs log tree commit diff
path: root/devices/src
diff options
context:
space:
mode:
authorDavid Tolnay <dtolnay@chromium.org>2019-02-12 17:51:26 -0800
committerchrome-bot <chrome-bot@chromium.org>2019-02-20 08:20:02 -0800
commitb4bd00fdad094b16c785b8ead9f92d68264f5fb4 (patch)
tree540ad033c789aa08a1ffed17e9c161df331600d2 /devices/src
parent0373b9f154b5ec1894138b7c10ad495fcce7b64f (diff)
downloadcrosvm-b4bd00fdad094b16c785b8ead9f92d68264f5fb4.tar
crosvm-b4bd00fdad094b16c785b8ead9f92d68264f5fb4.tar.gz
crosvm-b4bd00fdad094b16c785b8ead9f92d68264f5fb4.tar.bz2
crosvm-b4bd00fdad094b16c785b8ead9f92d68264f5fb4.tar.lz
crosvm-b4bd00fdad094b16c785b8ead9f92d68264f5fb4.tar.xz
crosvm-b4bd00fdad094b16c785b8ead9f92d68264f5fb4.tar.zst
crosvm-b4bd00fdad094b16c785b8ead9f92d68264f5fb4.zip
error: Print errors using Display impl
I have been running into Debug-printed error messages too often and
needing to look up in the source code each level of nested errors to
find out from the comment on the error variant what the short name of
the variant means in human terms. Worse, many errors (like the one shown
below) already had error strings written but were being printed from the
calling code in the less helpful Debug representation anyway.

Before:
    [ERROR:src/main.rs:705] The architecture failed to build the vm: NoVarEmpty

After:
    [ERROR:src/main.rs:705] The architecture failed to build the vm: /var/empty doesn't exist, can't jail devices.

TEST=cargo check --all-features
TEST=FEATURES=test emerge-amd64-generic crosvm

Change-Id: I77122c7d6861b2d610de2fff718896918ab21e10
Reviewed-on: https://chromium-review.googlesource.com/1469225
Commit-Ready: David Tolnay <dtolnay@chromium.org>
Tested-by: David Tolnay <dtolnay@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Diffstat (limited to 'devices/src')
-rw-r--r--devices/src/bus.rs11
-rw-r--r--devices/src/i8042.rs2
-rw-r--r--devices/src/pci/ac97_bus_master.rs24
-rw-r--r--devices/src/pci/pci_device.rs14
-rw-r--r--devices/src/pit.rs18
-rw-r--r--devices/src/proxy.rs12
-rw-r--r--devices/src/serial.rs2
-rw-r--r--devices/src/virtio/balloon.rs24
-rw-r--r--devices/src/virtio/block.rs108
-rw-r--r--devices/src/virtio/gpu/backend.rs16
-rw-r--r--devices/src/virtio/gpu/mod.rs22
-rw-r--r--devices/src/virtio/gpu/protocol.rs33
-rw-r--r--devices/src/virtio/input/mod.rs43
-rw-r--r--devices/src/virtio/net.rs35
-rw-r--r--devices/src/virtio/p9.rs36
-rw-r--r--devices/src/virtio/rng.rs19
-rw-r--r--devices/src/virtio/tpm.rs8
-rw-r--r--devices/src/virtio/vhost/mod.rs36
-rw-r--r--devices/src/virtio/vhost/net.rs2
-rw-r--r--devices/src/virtio/wl.rs18
20 files changed, 362 insertions, 121 deletions
diff --git a/devices/src/bus.rs b/devices/src/bus.rs
index 1c21661..1b3481b 100644
--- a/devices/src/bus.rs
+++ b/devices/src/bus.rs
@@ -6,6 +6,7 @@
 
 use std::cmp::{Ord, Ordering, PartialEq, PartialOrd};
 use std::collections::btree_map::BTreeMap;
+use std::fmt::{self, Display};
 use std::result;
 use std::sync::Arc;
 
@@ -42,6 +43,16 @@ pub enum Error {
     Overlap,
 }
 
+impl Display for Error {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        use self::Error::*;
+
+        match self {
+            Overlap => write!(f, "new device overlaps with an old device"),
+        }
+    }
+}
+
 pub type Result<T> = result::Result<T, Error>;
 
 /// Holds a base and length representing the address space occupied by a `BusDevice`.
diff --git a/devices/src/i8042.rs b/devices/src/i8042.rs
index 0d0c31d..5e35a5a 100644
--- a/devices/src/i8042.rs
+++ b/devices/src/i8042.rs
@@ -39,7 +39,7 @@ impl BusDevice for I8042Device {
     fn write(&mut self, offset: u64, data: &[u8]) {
         if data.len() == 1 && data[0] == 0xfe && offset == 3 {
             if let Err(e) = self.reset_evt.write(1) {
-                error!("failed to trigger i8042 reset event: {:?}", e);
+                error!("failed to trigger i8042 reset event: {}", e);
             }
         }
     }
diff --git a/devices/src/pci/ac97_bus_master.rs b/devices/src/pci/ac97_bus_master.rs
index 190fdce..b67450e 100644
--- a/devices/src/pci/ac97_bus_master.rs
+++ b/devices/src/pci/ac97_bus_master.rs
@@ -82,17 +82,15 @@ impl Error for PlaybackError {}
 
 impl Display for PlaybackError {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        use self::PlaybackError::*;
+
         match self {
-            PlaybackError::ReadingGuestBufferAddress(e) => {
-                write!(f, "Failed to get the address of the audio buffer: {:?}.", e)
-            }
-            PlaybackError::ReadingGuestSamples(e) => {
-                write!(f, "Failed to read samples from guest memory: {:?}.", e)
-            }
-            PlaybackError::StreamError(e) => {
-                write!(f, "Failed to get a buffer from the stream: {:?}", e)
+            ReadingGuestBufferAddress(e) => {
+                write!(f, "Failed to get the address of the audio buffer: {}.", e)
             }
-            PlaybackError::WritingOutput(e) => write!(f, "Failed to write audio output: {:?}.", e),
+            ReadingGuestSamples(e) => write!(f, "Failed to read samples from guest memory: {}.", e),
+            StreamError(e) => write!(f, "Failed to get a buffer from the stream: {}", e),
+            WritingOutput(e) => write!(f, "Failed to write audio output: {}.", e),
         }
     }
 }
@@ -151,8 +149,8 @@ impl Ac97BusMaster {
             loop {
                 if let Err(e) = irq_resample_evt.read() {
                     error!(
-                        "Failed to read the irq event from the resample thread: {:?}.",
-                        e
+                        "Failed to read the irq event from the resample thread: {}.",
+                        e,
                     );
                     break;
                 }
@@ -163,7 +161,7 @@ impl Ac97BusMaster {
                     if regs.func_regs(Ac97Function::Output).sr & int_mask != 0 {
                         if let Some(irq_evt) = regs.irq_evt.as_ref() {
                             if let Err(e) = irq_evt.write(1) {
-                                error!("Failed to set the irq from the resample thread: {:?}.", e);
+                                error!("Failed to set the irq from the resample thread: {}.", e);
                                 break;
                             }
                         }
@@ -440,7 +438,7 @@ impl Ac97BusMaster {
                     if let Err(e) =
                         audio_out_thread(thread_regs, thread_mem, &thread_run, output_stream)
                     {
-                        error!("Playback error: {:?}", e);
+                        error!("Playback error: {}", e);
                     }
                     thread_run.store(false, Ordering::Relaxed);
                 }));
diff --git a/devices/src/pci/pci_device.rs b/devices/src/pci/pci_device.rs
index 5ccdfef..b27dc47 100644
--- a/devices/src/pci/pci_device.rs
+++ b/devices/src/pci/pci_device.rs
@@ -5,6 +5,7 @@
 use byteorder::{ByteOrder, LittleEndian};
 
 use std;
+use std::fmt::{self, Display};
 use std::os::unix::io::RawFd;
 
 use kvm::Datamatch;
@@ -24,6 +25,19 @@ pub enum Error {
 }
 pub type Result<T> = std::result::Result<T, Error>;
 
+impl Display for Error {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        use self::Error::*;
+
+        match self {
+            IoAllocationFailed(size) => {
+                write!(f, "failed to allocate space for an IO BAR, size={}", size)
+            }
+            IoRegistrationFailed(addr) => write!(f, "failed to register an IO BAR, addr={}", addr),
+        }
+    }
+}
+
 pub trait PciDevice: Send {
     /// Returns a label suitable for debug output.
     fn debug_label(&self) -> String;
diff --git a/devices/src/pit.rs b/devices/src/pit.rs
index aa8161f..c01888c 100644
--- a/devices/src/pit.rs
+++ b/devices/src/pit.rs
@@ -161,15 +161,17 @@ pub enum PitError {
 
 impl fmt::Display for PitError {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        use self::PitError::*;
+
         match self {
-            PitError::TimerFdCreateError(e) => {
-                write!(f, "failed to create pit counter due to timer fd: {:?}", e)
+            TimerFdCreateError(e) => {
+                write!(f, "failed to create pit counter due to timer fd: {}", e)
             }
-            PitError::CreatePollContext(e) => write!(f, "failed to create poll context: {:?}", e),
-            PitError::PollError(err) => write!(f, "failed to poll events: {:?}", err),
-            PitError::SpawnThread(err) => write!(f, "failed to spawn thread: {:?}", err),
-            PitError::CreateEventFd(err) => write!(f, "failed to create event fd: {:?}", err),
-            PitError::CloneEventFd(err) => write!(f, "failed to clone event fd: {:?}", err),
+            CreatePollContext(e) => write!(f, "failed to create poll context: {}", e),
+            PollError(err) => write!(f, "failed to poll events: {}", err),
+            SpawnThread(err) => write!(f, "failed to spawn thread: {}", err),
+            CreateEventFd(err) => write!(f, "failed to create event fd: {}", err),
+            CloneEventFd(err) => write!(f, "failed to clone event fd: {}", err),
         }
     }
 }
@@ -195,7 +197,7 @@ pub struct Pit {
 impl Drop for Pit {
     fn drop(&mut self) {
         if let Err(e) = self.kill_evt.write(1) {
-            error!("failed to kill PIT worker threads: {:?}", e);
+            error!("failed to kill PIT worker threads: {}", e);
             return;
         }
         if let Some(thread) = self.worker_thread.take() {
diff --git a/devices/src/proxy.rs b/devices/src/proxy.rs
index 907f33c..4bc3405 100644
--- a/devices/src/proxy.rs
+++ b/devices/src/proxy.rs
@@ -72,7 +72,7 @@ fn child_proc(sock: UnixDatagram, device: &mut BusDevice) {
         let cmd = match sock.recv() {
             Ok(cmd) => cmd,
             Err(err) => {
-                error!("child device process failed recv: {:?}", err);
+                error!("child device process failed recv: {}", err);
                 break;
             }
         };
@@ -108,7 +108,7 @@ fn child_proc(sock: UnixDatagram, device: &mut BusDevice) {
             }
         };
         if let Err(e) = res {
-            error!("child device process failed send: {:?}", e);
+            error!("child device process failed send: {}", e);
         }
     }
 }
@@ -175,15 +175,15 @@ impl ProxyDevice {
         let res = self.sock.send(&cmd);
         if let Err(e) = res {
             error!(
-                "failed write to child device process {}: {:?}",
-                self.debug_label, e
+                "failed write to child device process {}: {}",
+                self.debug_label, e,
             );
         };
         match self.sock.recv() {
             Err(e) => {
                 error!(
-                    "failed read from child device process {}: {:?}",
-                    self.debug_label, e
+                    "failed read from child device process {}: {}",
+                    self.debug_label, e,
                 );
                 None
             }
diff --git a/devices/src/serial.rs b/devices/src/serial.rs
index b2a5651..c4c5a8b 100644
--- a/devices/src/serial.rs
+++ b/devices/src/serial.rs
@@ -195,7 +195,7 @@ impl BusDevice for Serial {
         }
 
         if let Err(e) = self.handle_write(offset as u8, data[0]) {
-            error!("serial failed write: {:?}", e);
+            error!("serial failed write: {}", e);
         }
     }
 
diff --git a/devices/src/virtio/balloon.rs b/devices/src/virtio/balloon.rs
index d67c532..1dfb72c 100644
--- a/devices/src/virtio/balloon.rs
+++ b/devices/src/virtio/balloon.rs
@@ -4,6 +4,7 @@
 
 use std;
 use std::cmp;
+use std::fmt::{self, Display};
 use std::io::Write;
 use std::mem;
 use std::os::unix::io::{AsRawFd, RawFd};
@@ -29,6 +30,17 @@ pub enum BalloonError {
 }
 pub type Result<T> = std::result::Result<T, BalloonError>;
 
+impl Display for BalloonError {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        use self::BalloonError::*;
+
+        match self {
+            NotEnoughPages => write!(f, "not enough pages"),
+            WritingConfigEvent(e) => write!(f, "failed to write config event: {}", e),
+        }
+    }
+}
+
 // Balloon has three virt IO queues: Inflate, Deflate, and Stats.
 // Stats is currently not used.
 const QUEUE_SIZE: u16 = 128;
@@ -92,7 +104,7 @@ impl Worker {
                         .remove_range(guest_address, 1 << VIRTIO_BALLOON_PFN_SHIFT)
                         .is_err()
                     {
-                        warn!("Marking pages unused failed {:?}", guest_address);
+                        warn!("Marking pages unused failed; addr={}", guest_address);
                         continue;
                     }
                 }
@@ -148,7 +160,7 @@ impl Worker {
         {
             Ok(pc) => pc,
             Err(e) => {
-                error!("failed creating PollContext: {:?}", e);
+                error!("failed creating PollContext: {}", e);
                 return;
             }
         };
@@ -157,7 +169,7 @@ impl Worker {
             let events = match poll_ctx.wait() {
                 Ok(v) => v,
                 Err(e) => {
-                    error!("failed polling for events: {:?}", e);
+                    error!("failed polling for events: {}", e);
                     break;
                 }
             };
@@ -167,14 +179,14 @@ impl Worker {
                 match event.token() {
                     Token::Inflate => {
                         if let Err(e) = inflate_queue_evt.read() {
-                            error!("failed reading inflate queue EventFd: {:?}", e);
+                            error!("failed reading inflate queue EventFd: {}", e);
                             break 'poll;
                         }
                         needs_interrupt |= self.process_inflate_deflate(true);
                     }
                     Token::Deflate => {
                         if let Err(e) = deflate_queue_evt.read() {
-                            error!("failed reading deflate queue EventFd: {:?}", e);
+                            error!("failed reading deflate queue EventFd: {}", e);
                             break 'poll;
                         }
                         needs_interrupt |= self.process_inflate_deflate(false);
@@ -321,7 +333,7 @@ impl VirtioDevice for Balloon {
         let (self_kill_evt, kill_evt) = match EventFd::new().and_then(|e| Ok((e.try_clone()?, e))) {
             Ok(v) => v,
             Err(e) => {
-                error!("failed to create kill EventFd pair: {:?}", e);
+                error!("failed to create kill EventFd pair: {}", e);
                 return;
             }
         };
diff --git a/devices/src/virtio/block.rs b/devices/src/virtio/block.rs
index 223fe1f..9dcf828 100644
--- a/devices/src/virtio/block.rs
+++ b/devices/src/virtio/block.rs
@@ -3,6 +3,7 @@
 // found in the LICENSE file.
 
 use std::cmp;
+use std::fmt::{self, Display};
 use std::io::{self, Read, Seek, SeekFrom, Write};
 use std::mem::{size_of, size_of_val};
 use std::os::unix::io::{AsRawFd, RawFd};
@@ -128,6 +129,21 @@ enum RequestType {
     Unsupported(u32),
 }
 
+impl Display for RequestType {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        use self::RequestType::*;
+
+        match self {
+            In => write!(f, "in"),
+            Out => write!(f, "out"),
+            Flush => write!(f, "flush"),
+            Discard => write!(f, "discard"),
+            WriteZeroes => write!(f, "write zeroes"),
+            Unsupported(n) => write!(f, "unsupported({})", n),
+        }
+    }
+}
+
 #[derive(Debug)]
 enum ParseError {
     /// Guest gave us bad memory addresses
@@ -144,6 +160,21 @@ enum ParseError {
     DescriptorLengthTooSmall,
 }
 
+impl Display for ParseError {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        use self::ParseError::*;
+
+        match self {
+            GuestMemory(e) => write!(f, "bad guest memory address: {}", e),
+            CheckedOffset(addr, offset) => write!(f, "{}+{} would overflow a usize", addr, offset),
+            UnexpectedWriteOnlyDescriptor => write!(f, "unexpected write-only descriptor"),
+            UnexpectedReadOnlyDescriptor => write!(f, "unexpected read-only descriptor"),
+            DescriptorChainTooShort => write!(f, "descriptor chain too short"),
+            DescriptorLengthTooSmall => write!(f, "descriptor length too small"),
+        }
+    }
+}
+
 fn request_type(
     mem: &GuestMemory,
     desc_addr: GuestAddress,
@@ -214,6 +245,61 @@ enum ExecuteError {
     Unsupported(u32),
 }
 
+impl Display for ExecuteError {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        use self::ExecuteError::*;
+
+        match self {
+            Flush(e) => write!(f, "failed to flush: {}", e),
+            Read {
+                addr,
+                length,
+                sector,
+                guestmemerr,
+            } => write!(
+                f,
+                "failed to read {} bytes from address {} sector {}: {}",
+                length, addr, sector, guestmemerr,
+            ),
+            Seek { ioerr, sector } => write!(f, "failed to seek to sector {}: {}", sector, ioerr),
+            TimerFd(e) => write!(f, "{}", e),
+            Write {
+                addr,
+                length,
+                sector,
+                guestmemerr,
+            } => write!(
+                f,
+                "failed to write {} bytes to address {} sector {}: {}",
+                length, addr, sector, guestmemerr,
+            ),
+            DiscardWriteZeroes {
+                ioerr: Some(ioerr),
+                sector,
+                num_sectors,
+                flags,
+            } => write!(
+                f,
+                "failed to perform discard or write zeroes; sector={} num_sectors={} flags={}; {}",
+                sector, num_sectors, flags, ioerr,
+            ),
+            DiscardWriteZeroes {
+                ioerr: None,
+                sector,
+                num_sectors,
+                flags,
+            } => write!(
+                f,
+                "failed to perform discard or write zeroes; sector={} num_sectors={} flags={}",
+                sector, num_sectors, flags,
+            ),
+            ReadOnly { request_type } => write!(f, "read only; request_type={}", request_type),
+            OutOfRange => write!(f, "out of range"),
+            Unsupported(n) => write!(f, "unsupported ({})", n),
+        }
+    }
+}
+
 impl ExecuteError {
     fn status(&self) -> u8 {
         match self {
@@ -551,7 +637,7 @@ impl<T: DiskFile> Worker<T> {
                             VIRTIO_BLK_S_OK
                         }
                         Err(e) => {
-                            error!("failed executing disk request: {:?}", e);
+                            error!("failed executing disk request: {}", e);
                             len = 1; // 1 byte for the status
                             e.status()
                         }
@@ -563,7 +649,7 @@ impl<T: DiskFile> Worker<T> {
                         .unwrap();
                 }
                 Err(e) => {
-                    error!("failed processing available descriptor chain: {:?}", e);
+                    error!("failed processing available descriptor chain: {}", e);
                     len = 0;
                 }
             }
@@ -622,7 +708,7 @@ impl<T: DiskFile> Worker<T> {
         let mut flush_timer = match TimerFd::new() {
             Ok(t) => t,
             Err(e) => {
-                error!("Failed to create the flush timer: {:?}", e);
+                error!("Failed to create the flush timer: {}", e);
                 return;
             }
         };
@@ -642,7 +728,7 @@ impl<T: DiskFile> Worker<T> {
         {
             Ok(pc) => pc,
             Err(e) => {
-                error!("failed creating PollContext: {:?}", e);
+                error!("failed creating PollContext: {}", e);
                 return;
             }
         };
@@ -651,7 +737,7 @@ impl<T: DiskFile> Worker<T> {
             let events = match poll_ctx.wait() {
                 Ok(v) => v,
                 Err(e) => {
-                    error!("failed polling for events: {:?}", e);
+                    error!("failed polling for events: {}", e);
                     break;
                 }
             };
@@ -662,17 +748,17 @@ impl<T: DiskFile> Worker<T> {
                 match event.token() {
                     Token::FlushTimer => {
                         if let Err(e) = self.disk_image.flush() {
-                            error!("Failed to flush the disk: {:?}", e);
+                            error!("Failed to flush the disk: {}", e);
                             break 'poll;
                         }
                         if let Err(e) = flush_timer.wait() {
-                            error!("Failed to clear flush timer: {:?}", e);
+                            error!("Failed to clear flush timer: {}", e);
                             break 'poll;
                         }
                     }
                     Token::QueueAvailable => {
                         if let Err(e) = queue_evt.read() {
-                            error!("failed reading queue EventFd: {:?}", e);
+                            error!("failed reading queue EventFd: {}", e);
                             break 'poll;
                         }
                         needs_interrupt |=
@@ -682,7 +768,7 @@ impl<T: DiskFile> Worker<T> {
                         let req = match control_socket.recv() {
                             Ok(req) => req,
                             Err(e) => {
-                                error!("control socket failed recv: {:?}", e);
+                                error!("control socket failed recv: {}", e);
                                 break 'poll;
                             }
                         };
@@ -703,7 +789,7 @@ impl<T: DiskFile> Worker<T> {
                         };
 
                         if let Err(e) = control_socket.send(&resp) {
-                            error!("control socket failed send: {:?}", e);
+                            error!("control socket failed send: {}", e);
                             break 'poll;
                         }
                     }
@@ -860,7 +946,7 @@ impl<T: 'static + AsRawFd + DiskFile + Send> VirtioDevice for Block<T> {
         let (self_kill_evt, kill_evt) = match EventFd::new().and_then(|e| Ok((e.try_clone()?, e))) {
             Ok(v) => v,
             Err(e) => {
-                error!("failed creating kill EventFd pair: {:?}", e);
+                error!("failed creating kill EventFd pair: {}", e);
                 return;
             }
         };
diff --git a/devices/src/virtio/gpu/backend.rs b/devices/src/virtio/gpu/backend.rs
index b8f98e4..fad8223 100644
--- a/devices/src/virtio/gpu/backend.rs
+++ b/devices/src/virtio/gpu/backend.rs
@@ -258,7 +258,7 @@ impl VirglResource for BackedBuffer {
                 Some(import_id)
             }
             Err(e) => {
-                error!("failed to import dmabuf for display: {:?}", e);
+                error!("failed to import dmabuf for display: {}", e);
                 None
             }
         }
@@ -292,13 +292,13 @@ impl VirglResource for BackedBuffer {
                 .map(|&(addr, len)| mem.get_slice(addr.offset(), len as u64).unwrap_or_default()),
         );
         if let Err(e) = res {
-            error!("failed to write to resource from guest memory: {:?}", e)
+            error!("failed to write to resource from guest memory: {}", e)
         }
     }
 
     fn read_to_volatile(&mut self, x: u32, y: u32, width: u32, height: u32, dst: VolatileSlice) {
         if let Err(e) = self.buffer.read_to_volatile(x, y, width, height, 0, dst) {
-            error!("failed to copy resource: {:?}", e);
+            error!("failed to copy resource: {}", e);
         }
     }
 }
@@ -356,7 +356,7 @@ impl Backend {
         let request = match resource_bridge.recv() {
             Ok(msg) => msg,
             Err(e) => {
-                error!("error receiving resource bridge request: {:?}", e);
+                error!("error receiving resource bridge request: {}", e);
                 return;
             }
         };
@@ -372,7 +372,7 @@ impl Backend {
         };
 
         if let Err(e) = resource_bridge.send(&response) {
-            error!("error sending resource bridge request: {:?}", e);
+            error!("error sending resource bridge request: {}", e);
         }
     }
 
@@ -442,7 +442,7 @@ impl Backend {
             if self.scanout_surface.is_none() {
                 match display.create_surface(None, DEFAULT_WIDTH, DEFAULT_HEIGHT) {
                     Ok(surface) => self.scanout_surface = Some(surface),
-                    Err(e) => error!("failed to create display surface: {:?}", e),
+                    Err(e) => error!("failed to create display surface: {}", e),
                 }
             }
             GpuResponse::OkNoData
@@ -591,7 +591,7 @@ impl Backend {
                 ) {
                     Ok(surface) => self.cursor_surface = Some(surface),
                     Err(e) => {
-                        error!("failed to create cursor surface: {:?}", e);
+                        error!("failed to create cursor surface: {}", e);
                         return GpuResponse::ErrUnspec;
                     }
                 }
@@ -613,7 +613,7 @@ impl Backend {
                     if let Err(e) =
                         buffer.read_to_volatile(0, 0, buffer.width(), buffer.height(), 0, fb)
                     {
-                        error!("failed to copy resource to cursor: {:?}", e);
+                        error!("failed to copy resource to cursor: {}", e);
                         return GpuResponse::ErrInvalidParameter;
                     }
                 }
diff --git a/devices/src/virtio/gpu/mod.rs b/devices/src/virtio/gpu/mod.rs
index 8da15f5..c8d4dcd 100644
--- a/devices/src/virtio/gpu/mod.rs
+++ b/devices/src/virtio/gpu/mod.rs
@@ -365,14 +365,14 @@ impl Frontend {
                                 Ok(data_mem) => {
                                     resp = self.process_gpu_command(mem, cmd, Some(data_mem))
                                 }
-                                Err(e) => debug!("ctrl queue invalid data descriptor: {:?}", e),
+                                Err(e) => debug!("ctrl queue invalid data descriptor: {}", e),
                             }
                         }
                         None => resp = self.process_gpu_command(mem, cmd, None),
                     }
                     gpu_cmd = Some(cmd);
                 }
-                Err(e) => debug!("ctrl queue decode error: {:?}", e),
+                Err(e) => debug!("ctrl queue decode error: {}", e),
             }
         }
         if resp.is_err() {
@@ -402,7 +402,7 @@ impl Frontend {
                 // fence is complete.
                 match resp.encode(flags, fence_id, ctx_id, ret_desc_mem) {
                     Ok(l) => len = l,
-                    Err(e) => debug!("ctrl queue response encode error: {:?}", e),
+                    Err(e) => debug!("ctrl queue response encode error: {}", e),
                 }
 
                 if flags & VIRTIO_GPU_FLAG_FENCE != 0 {
@@ -505,14 +505,14 @@ impl Worker {
         {
             Ok(pc) => pc,
             Err(e) => {
-                error!("failed creating PollContext: {:?}", e);
+                error!("failed creating PollContext: {}", e);
                 return;
             }
         };
 
         if let Some(ref resource_bridge) = self.resource_bridge {
             if let Err(e) = poll_ctx.add(resource_bridge, Token::ResourceBridge) {
-                error!("failed to add resource bridge to PollContext: {:?}", e);
+                error!("failed to add resource bridge to PollContext: {}", e);
             }
         }
 
@@ -527,7 +527,7 @@ impl Worker {
             let events = match poll_ctx.wait_timeout(duration) {
                 Ok(v) => v,
                 Err(e) => {
-                    error!("failed polling for events: {:?}", e);
+                    error!("failed polling for events: {}", e);
                     break;
                 }
             };
@@ -722,7 +722,7 @@ impl VirtioDevice for Gpu {
         let exit_evt = match self.exit_evt.try_clone() {
             Ok(e) => e,
             Err(e) => {
-                error!("error cloning exit eventfd: {:?}", e);
+                error!("error cloning exit eventfd: {}", e);
                 return;
             }
         };
@@ -730,7 +730,7 @@ impl VirtioDevice for Gpu {
         let (self_kill_evt, kill_evt) = match EventFd::new().and_then(|e| Ok((e.try_clone()?, e))) {
             Ok(v) => v,
             Err(e) => {
-                error!("error creating kill EventFd pair: {:?}", e);
+                error!("error creating kill EventFd pair: {}", e);
                 return;
             }
         };
@@ -750,8 +750,8 @@ impl VirtioDevice for Gpu {
                     const UNDESIRED_CARDS: &[&str] = &["vgem", "pvr"];
                     let drm_card = match gpu_buffer::rendernode::open_device(UNDESIRED_CARDS) {
                         Ok(f) => f,
-                        Err(e) => {
-                            error!("failed to open card: {:?}", e);
+                        Err(()) => {
+                            error!("failed to open card");
                             return;
                         }
                     };
@@ -767,7 +767,7 @@ impl VirtioDevice for Gpu {
                     let display = match GpuDisplay::new(socket_path) {
                         Ok(c) => c,
                         Err(e) => {
-                            error!("failed to open display: {:?}", e);
+                            error!("failed to open display: {}", e);
                             return;
                         }
                     };
diff --git a/devices/src/virtio/gpu/protocol.rs b/devices/src/virtio/gpu/protocol.rs
index 8ed6b02..f0dcad8 100644
--- a/devices/src/virtio/gpu/protocol.rs
+++ b/devices/src/virtio/gpu/protocol.rs
@@ -2,7 +2,7 @@
 #![allow(non_camel_case_types)]
 
 use std::cmp::min;
-use std::fmt;
+use std::fmt::{self, Display};
 use std::marker::PhantomData;
 use std::mem::{size_of, size_of_val};
 use std::str::from_utf8;
@@ -493,6 +493,21 @@ pub enum GpuCommandDecodeError {
     InvalidType(u32),
 }
 
+impl Display for GpuCommandDecodeError {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        use self::GpuCommandDecodeError::*;
+
+        match self {
+            Memory(e) => write!(
+                f,
+                "command referenced an inaccessible area of memory: {}",
+                e,
+            ),
+            InvalidType(n) => write!(f, "invalid command type ({})", n),
+        }
+    }
+}
+
 impl From<VolatileMemoryError> for GpuCommandDecodeError {
     fn from(e: VolatileMemoryError) -> GpuCommandDecodeError {
         GpuCommandDecodeError::Memory(e)
@@ -625,6 +640,22 @@ pub enum GpuResponseEncodeError {
     TooManyPlanes(usize),
 }
 
+impl Display for GpuResponseEncodeError {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        use self::GpuResponseEncodeError::*;
+
+        match self {
+            Memory(e) => write!(
+                f,
+                "response was encoded to an inaccessible area of memory: {}",
+                e,
+            ),
+            TooManyDisplays(n) => write!(f, "{} is more displays than are valid", n),
+            TooManyPlanes(n) => write!(f, "{} is more planes than are valid", n),
+        }
+    }
+}
+
 impl From<VolatileMemoryError> for GpuResponseEncodeError {
     fn from(e: VolatileMemoryError) -> GpuResponseEncodeError {
         GpuResponseEncodeError::Memory(e)
diff --git a/devices/src/virtio/input/mod.rs b/devices/src/virtio/input/mod.rs
index 82c15c0..22ef168 100644
--- a/devices/src/virtio/input/mod.rs
+++ b/devices/src/virtio/input/mod.rs
@@ -19,6 +19,7 @@ use self::event_source::{input_event, EvdevEventSource, EventSource, SocketEvent
 use super::{Queue, VirtioDevice, INTERRUPT_STATUS_USED_RING, TYPE_INPUT};
 use std::cmp::min;
 use std::collections::BTreeMap;
+use std::fmt::{self, Display};
 use std::io::Read;
 use std::io::Write;
 use std::mem::size_of;
@@ -53,6 +54,28 @@ pub enum InputError {
 }
 pub type Result<T> = std::result::Result<T, InputError>;
 
+impl Display for InputError {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        use self::InputError::*;
+
+        match self {
+            EventsWriteError(e) => write!(f, "failed to write events to the source: {}", e),
+            EventsReadError(e) => write!(f, "failed to read events from the source: {}", e),
+            EvdevIdError(e) => write!(f, "failed to get id of event device: {}", e),
+            EvdevNameError(e) => write!(f, "failed to get name of event device: {}", e),
+            EvdevSerialError(e) => write!(f, "failed to get serial name of event device: {}", e),
+            EvdevPropertiesError(e) => write!(f, "failed to get properties of event device: {}", e),
+            EvdevEventTypesError(e) => {
+                write!(f, "failed to get event types supported by device: {}", e)
+            }
+            EvdevAbsInfoError(e) => {
+                write!(f, "failed to get axis information of event device: {}", e)
+            }
+            EvdevGrabError(e) => write!(f, "failed to grab event device: {}", e),
+        }
+    }
+}
+
 #[derive(Copy, Clone, Default, Debug)]
 #[repr(C)]
 pub struct virtio_input_device_ids {
@@ -405,7 +428,7 @@ impl<T: EventSource> Worker<T> {
                         // Read is guaranteed to succeed here, so the only possible failure would be
                         // writing outside the guest memory region, which would mean the address and
                         // length given in the queue descriptor are wrong.
-                        panic!("failed reading events into guest memory: {:?}", e);
+                        panic!("failed reading events into guest memory: {}", e);
                     }
                     used_desc_heads[used_count] = (avail_desc.index, len as u32);
                     used_count += 1;
@@ -457,7 +480,7 @@ impl<T: EventSource> Worker<T> {
         kill_evt: EventFd,
     ) {
         if let Err(e) = self.event_source.init() {
-            error!("failed initializing event source: {:?}", e);
+            error!("failed initializing event source: {}", e);
             return;
         }
 
@@ -490,7 +513,7 @@ impl<T: EventSource> Worker<T> {
         {
             Ok(poll_ctx) => poll_ctx,
             Err(e) => {
-                error!("failed creating PollContext: {:?}", e);
+                error!("failed creating PollContext: {}", e);
                 return;
             }
         };
@@ -499,7 +522,7 @@ impl<T: EventSource> Worker<T> {
             let poll_events = match poll_ctx.wait() {
                 Ok(poll_events) => poll_events,
                 Err(e) => {
-                    error!("failed polling for events: {:?}", e);
+                    error!("failed polling for events: {}", e);
                     break;
                 }
             };
@@ -509,23 +532,23 @@ impl<T: EventSource> Worker<T> {
                 match poll_event.token() {
                     Token::EventQAvailable => {
                         if let Err(e) = event_queue_evt_fd.read() {
-                            error!("failed reading event queue EventFd: {:?}", e);
+                            error!("failed reading event queue EventFd: {}", e);
                             break 'poll;
                         }
                         needs_interrupt |= self.send_events();
                     }
                     Token::StatusQAvailable => {
                         if let Err(e) = status_queue_evt_fd.read() {
-                            error!("failed reading status queue EventFd: {:?}", e);
+                            error!("failed reading status queue EventFd: {}", e);
                             break 'poll;
                         }
                         match self.process_status_queue() {
                             Ok(b) => needs_interrupt |= b,
-                            Err(e) => error!("failed processing status events: {:?}", e),
+                            Err(e) => error!("failed processing status events: {}", e),
                         }
                     }
                     Token::InputEventsAvailable => match self.event_source.receive_events() {
-                        Err(e) => error!("error receiving events: {:?}", e),
+                        Err(e) => error!("error receiving events: {}", e),
                         Ok(_cnt) => needs_interrupt |= self.send_events(),
                     },
                     Token::InterruptResample => {
@@ -546,7 +569,7 @@ impl<T: EventSource> Worker<T> {
         }
 
         if let Err(e) = self.event_source.finalize() {
-            error!("failed finalizing event source: {:?}", e);
+            error!("failed finalizing event source: {}", e);
             return;
         }
     }
@@ -612,7 +635,7 @@ where
         let (self_kill_evt, kill_evt) = match EventFd::new().and_then(|e| Ok((e.try_clone()?, e))) {
             Ok(v) => v,
             Err(e) => {
-                error!("failed to create kill EventFd pair: {:?}", e);
+                error!("failed to create kill EventFd pair: {}", e);
                 return;
             }
         };
diff --git a/devices/src/virtio/net.rs b/devices/src/virtio/net.rs
index 84249ab..088c2b8 100644
--- a/devices/src/virtio/net.rs
+++ b/devices/src/virtio/net.rs
@@ -3,6 +3,7 @@
 // found in the LICENSE file.
 
 use std::cmp;
+use std::fmt::{self, Display};
 use std::mem;
 use std::net::Ipv4Addr;
 use std::os::unix::io::{AsRawFd, RawFd};
@@ -53,6 +54,26 @@ pub enum NetError {
     PollError(SysError),
 }
 
+impl Display for NetError {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        use self::NetError::*;
+
+        match self {
+            CreateKillEventFd(e) => write!(f, "failed to create kill eventfd: {}", e),
+            CreatePollContext(e) => write!(f, "failed to create poll context: {}", e),
+            CloneKillEventFd(e) => write!(f, "failed to clone kill eventfd: {}", e),
+            TapOpen(e) => write!(f, "failed to open tap device: {}", e),
+            TapSetIp(e) => write!(f, "failed to set tap IP: {}", e),
+            TapSetNetmask(e) => write!(f, "failed to set tap netmask: {}", e),
+            TapSetMacAddress(e) => write!(f, "failed to set tap mac address: {}", e),
+            TapSetOffload(e) => write!(f, "failed to set tap interface offload flags: {}", e),
+            TapSetVnetHdrSize(e) => write!(f, "failed to set vnet header size: {}", e),
+            TapEnable(e) => write!(f, "failed to enable tap interface: {}", e),
+            PollError(e) => write!(f, "error while polling for events: {}", e),
+        }
+    }
+}
+
 struct Worker<T: TapT> {
     mem: GuestMemory,
     rx_queue: Queue,
@@ -110,7 +131,7 @@ where
                             write_count += sz;
                         }
                         Err(e) => {
-                            warn!("net: rx: failed to write slice: {:?}", e);
+                            warn!("net: rx: failed to write slice: {}", e);
                             break;
                         }
                     };
@@ -156,7 +177,7 @@ where
                     // The tap device is nonblocking, so any error aside from EAGAIN is
                     // unexpected.
                     if e.raw_os_error().unwrap() != EAGAIN {
-                        warn!("net: rx: failed to read tap: {:?}", e);
+                        warn!("net: rx: failed to read tap: {}", e);
                     }
                     break;
                 }
@@ -188,7 +209,7 @@ where
                         read_count += sz;
                     }
                     Err(e) => {
-                        warn!("net: tx: failed to read slice: {:?}", e);
+                        warn!("net: tx: failed to read slice: {}", e);
                         break;
                     }
                 }
@@ -199,7 +220,7 @@ where
             match write_result {
                 Ok(_) => {}
                 Err(e) => {
-                    warn!("net: tx: error failed to write to tap: {:?}", e);
+                    warn!("net: tx: error failed to write to tap: {}", e);
                 }
             };
 
@@ -263,7 +284,7 @@ where
                     }
                     Token::RxQueue => {
                         if let Err(e) = rx_queue_evt.read() {
-                            error!("net: error reading rx queue EventFd: {:?}", e);
+                            error!("net: error reading rx queue EventFd: {}", e);
                             break 'poll;
                         }
                         // There should be a buffer available now to receive the frame into.
@@ -273,7 +294,7 @@ where
                     }
                     Token::TxQueue => {
                         if let Err(e) = tx_queue_evt.read() {
-                            error!("net: error reading tx queue EventFd: {:?}", e);
+                            error!("net: error reading tx queue EventFd: {}", e);
                             break 'poll;
                         }
                         self.process_tx();
@@ -453,7 +474,7 @@ where
                             let tx_queue_evt = queue_evts.remove(0);
                             let result = worker.run(rx_queue_evt, tx_queue_evt, kill_evt);
                             if let Err(e) = result {
-                                error!("net worker thread exited with error: {:?}", e);
+                                error!("net worker thread exited with error: {}", e);
                             }
                         });
 
diff --git a/devices/src/virtio/p9.rs b/devices/src/virtio/p9.rs
index 50ceedb..be461a0 100644
--- a/devices/src/virtio/p9.rs
+++ b/devices/src/virtio/p9.rs
@@ -60,36 +60,32 @@ impl error::Error for P9Error {
 
 impl fmt::Display for P9Error {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        use self::P9Error::*;
+
         match self {
-            P9Error::TagTooLong(len) => write!(
+            TagTooLong(len) => write!(
                 f,
                 "P9 device tag is too long: len = {}, max = {}",
                 len,
                 ::std::u16::MAX
             ),
-            P9Error::RootNotAbsolute(buf) => write!(
+            RootNotAbsolute(buf) => write!(
                 f,
                 "P9 root directory is not absolute: root = {}",
                 buf.display()
             ),
-            P9Error::CreatePollContext(err) => write!(f, "failed to create PollContext: {:?}", err),
-            P9Error::PollError(err) => write!(f, "failed to poll events: {:?}", err),
-            P9Error::ReadQueueEventFd(err) => {
-                write!(f, "failed to read from virtio queue EventFd: {:?}", err)
-            }
-            P9Error::NoReadableDescriptors => {
-                write!(f, "request does not have any readable descriptors")
-            }
-            P9Error::NoWritableDescriptors => {
-                write!(f, "request does not have any writable descriptors")
-            }
-            P9Error::InvalidGuestAddress(addr, len) => write!(
+            CreatePollContext(err) => write!(f, "failed to create PollContext: {}", err),
+            PollError(err) => write!(f, "failed to poll events: {}", err),
+            ReadQueueEventFd(err) => write!(f, "failed to read from virtio queue EventFd: {}", err),
+            NoReadableDescriptors => write!(f, "request does not have any readable descriptors"),
+            NoWritableDescriptors => write!(f, "request does not have any writable descriptors"),
+            InvalidGuestAddress(addr, len) => write!(
                 f,
-                "descriptor contained invalid guest address range: address = {:?}, len = {}",
+                "descriptor contained invalid guest address range: address = {}, len = {}",
                 addr, len
             ),
-            P9Error::SignalUsedQueue(err) => write!(f, "failed to signal used queue: {:?}", err),
-            P9Error::Internal(err) => write!(f, "P9 internal server error: {}", err),
+            SignalUsedQueue(err) => write!(f, "failed to signal used queue: {}", err),
+            Internal(err) => write!(f, "P9 internal server error: {}", err),
         }
     }
 }
@@ -402,7 +398,7 @@ impl VirtioDevice for P9 {
         let (self_kill_evt, kill_evt) = match EventFd::new().and_then(|e| Ok((e.try_clone()?, e))) {
             Ok(v) => v,
             Err(e) => {
-                error!("failed creating kill EventFd pair: {:?}", e);
+                error!("failed creating kill EventFd pair: {}", e);
                 return;
             }
         };
@@ -427,7 +423,7 @@ impl VirtioDevice for P9 {
 
             match worker_result {
                 Ok(worker) => self.worker = Some(worker),
-                Err(e) => error!("failed to spawn virtio_9p worker: {:?}", e),
+                Err(e) => error!("failed to spawn virtio_9p worker: {}", e),
             }
         }
     }
@@ -437,7 +433,7 @@ impl Drop for P9 {
     fn drop(&mut self) {
         if let Some(kill_evt) = self.kill_evt.take() {
             if let Err(e) = kill_evt.write(1) {
-                error!("failed to kill virtio_9p worker thread: {:?}", e);
+                error!("failed to kill virtio_9p worker thread: {}", e);
                 return;
             }
 
diff --git a/devices/src/virtio/rng.rs b/devices/src/virtio/rng.rs
index 96d0d4f..7b3d9f7 100644
--- a/devices/src/virtio/rng.rs
+++ b/devices/src/virtio/rng.rs
@@ -3,6 +3,7 @@
 // found in the LICENSE file.
 
 use std;
+use std::fmt::{self, Display};
 use std::fs::File;
 use std::io;
 use std::os::unix::io::{AsRawFd, RawFd};
@@ -24,6 +25,16 @@ pub enum RngError {
 }
 pub type Result<T> = std::result::Result<T, RngError>;
 
+impl Display for RngError {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        use self::RngError::*;
+
+        match self {
+            AccessingRandomDev(e) => write!(f, "failed to access /dev/urandom: {}", e),
+        }
+    }
+}
+
 struct Worker {
     queue: Queue,
     mem: GuestMemory,
@@ -92,7 +103,7 @@ impl Worker {
         {
             Ok(pc) => pc,
             Err(e) => {
-                error!("failed creating PollContext: {:?}", e);
+                error!("failed creating PollContext: {}", e);
                 return;
             }
         };
@@ -101,7 +112,7 @@ impl Worker {
             let events = match poll_ctx.wait() {
                 Ok(v) => v,
                 Err(e) => {
-                    error!("failed polling for events: {:?}", e);
+                    error!("failed polling for events: {}", e);
                     break;
                 }
             };
@@ -111,7 +122,7 @@ impl Worker {
                 match event.token() {
                     Token::QueueAvailable => {
                         if let Err(e) = queue_evt.read() {
-                            error!("failed reading queue EventFd: {:?}", e);
+                            error!("failed reading queue EventFd: {}", e);
                             break 'poll;
                         }
                         needs_interrupt |= self.process_queue();
@@ -193,7 +204,7 @@ impl VirtioDevice for Rng {
         let (self_kill_evt, kill_evt) = match EventFd::new().and_then(|e| Ok((e.try_clone()?, e))) {
             Ok(v) => v,
             Err(e) => {
-                error!("failed to create kill EventFd pair: {:?}", e);
+                error!("failed to create kill EventFd pair: {}", e);
                 return;
             }
         };
diff --git a/devices/src/virtio/tpm.rs b/devices/src/virtio/tpm.rs
index 66574e2..0cc2e91 100644
--- a/devices/src/virtio/tpm.rs
+++ b/devices/src/virtio/tpm.rs
@@ -133,7 +133,7 @@ impl Worker {
         {
             Ok(pc) => pc,
             Err(e) => {
-                error!("vtpm failed creating PollContext: {:?}", e);
+                error!("vtpm failed creating PollContext: {}", e);
                 return;
             }
         };
@@ -142,7 +142,7 @@ impl Worker {
             let events = match poll_ctx.wait() {
                 Ok(v) => v,
                 Err(e) => {
-                    error!("vtpm failed polling for events: {:?}", e);
+                    error!("vtpm failed polling for events: {}", e);
                     break;
                 }
             };
@@ -152,7 +152,7 @@ impl Worker {
                 match event.token() {
                     Token::QueueAvailable => {
                         if let Err(e) = queue_evt.read() {
-                            error!("vtpm failed reading queue EventFd: {:?}", e);
+                            error!("vtpm failed reading queue EventFd: {}", e);
                             break 'poll;
                         }
                         needs_interrupt |= self.process_queue();
@@ -231,7 +231,7 @@ impl VirtioDevice for Tpm {
         let (self_kill_evt, kill_evt) = match EventFd::new().and_then(|e| Ok((e.try_clone()?, e))) {
             Ok(v) => v,
             Err(err) => {
-                error!("vtpm failed to create kill EventFd pair: {:?}", err);
+                error!("vtpm failed to create kill EventFd pair: {}", err);
                 return;
             }
         };
diff --git a/devices/src/virtio/vhost/mod.rs b/devices/src/virtio/vhost/mod.rs
index 0fe15df..f96bebb 100644
--- a/devices/src/virtio/vhost/mod.rs
+++ b/devices/src/virtio/vhost/mod.rs
@@ -5,6 +5,7 @@
 //! Implements vhost-based virtio devices.
 
 use std;
+use std::fmt::{self, Display};
 
 use net_util::Error as TapError;
 use sys_util::Error as SysError;
@@ -74,3 +75,38 @@ pub enum Error {
 }
 
 pub type Result<T> = std::result::Result<T, Error>;
+
+impl Display for Error {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        use self::Error::*;
+
+        match self {
+            CreateKillEventFd(e) => write!(f, "failed to create kill eventfd: {}", e),
+            CreatePollContext(e) => write!(f, "failed to create poll context: {}", e),
+            CloneKillEventFd(e) => write!(f, "failed to clone kill eventfd: {}", e),
+            PollError(e) => write!(f, "failed polling for events: {}", e),
+            TapOpen(e) => write!(f, "failed to open tap device: {}", e),
+            TapSetIp(e) => write!(f, "failed to set tap IP: {}", e),
+            TapSetNetmask(e) => write!(f, "failed to set tap netmask: {}", e),
+            TapSetMacAddress(e) => write!(f, "failed to set tap mac address: {}", e),
+            TapSetOffload(e) => write!(f, "failed to set tap interface offload flags: {}", e),
+            TapSetVnetHdrSize(e) => write!(f, "failed to set vnet header size: {}", e),
+            TapEnable(e) => write!(f, "failed to enable tap interface: {}", e),
+            VhostOpen(e) => write!(f, "failed to open vhost device: {}", e),
+            VhostSetOwner(e) => write!(f, "failed to set owner: {}", e),
+            VhostGetFeatures(e) => write!(f, "failed to get features: {}", e),
+            VhostSetFeatures(e) => write!(f, "failed to set features: {}", e),
+            VhostSetMemTable(e) => write!(f, "failed to set mem table: {}", e),
+            VhostSetVringNum(e) => write!(f, "failed to set vring num: {}", e),
+            VhostSetVringAddr(e) => write!(f, "failed to set vring addr: {}", e),
+            VhostSetVringBase(e) => write!(f, "failed to set vring base: {}", e),
+            VhostSetVringCall(e) => write!(f, "failed to set vring call: {}", e),
+            VhostSetVringKick(e) => write!(f, "failed to set vring kick: {}", e),
+            VhostNetSetBackend(e) => write!(f, "net set backend failed: {}", e),
+            VhostVsockSetCid(e) => write!(f, "failed to set CID for guest: {}", e),
+            VhostVsockStart(e) => write!(f, "failed to start vhost-vsock driver: {}", e),
+            VhostIrqCreate(e) => write!(f, "failed to create vhost eventfd: {}", e),
+            VhostIrqRead(e) => write!(f, "failed to read vhost eventfd: {}", e),
+        }
+    }
+}
diff --git a/devices/src/virtio/vhost/net.rs b/devices/src/virtio/vhost/net.rs
index 4727bbc..b8e518d 100644
--- a/devices/src/virtio/vhost/net.rs
+++ b/devices/src/virtio/vhost/net.rs
@@ -202,7 +202,7 @@ where
                                 let result =
                                     worker.run(queue_evts, QUEUE_SIZES, kill_evt, activate_vqs);
                                 if let Err(e) = result {
-                                    error!("net worker thread exited with error: {:?}", e);
+                                    error!("net worker thread exited with error: {}", e);
                                 }
                             });
 
diff --git a/devices/src/virtio/wl.rs b/devices/src/virtio/wl.rs
index 332f7c6..4d43825 100644
--- a/devices/src/virtio/wl.rs
+++ b/devices/src/virtio/wl.rs
@@ -1163,14 +1163,14 @@ impl WlState {
         let events = match self.poll_ctx.wait_timeout(Duration::from_secs(0)) {
             Ok(v) => v.to_owned(),
             Err(e) => {
-                error!("failed polling for vfd evens: {:?}", e);
+                error!("failed polling for vfd evens: {}", e);
                 return;
             }
         };
 
         for event in events.as_ref().iter_readable() {
             if let Err(e) = self.recv(event.token()) {
-                error!("failed to recv from vfd: {:?}", e)
+                error!("failed to recv from vfd: {}", e)
             }
         }
 
@@ -1179,7 +1179,7 @@ impl WlState {
                 let vfd_id = event.token();
                 if let Some(fd) = self.vfds.get(&vfd_id).and_then(|vfd| vfd.poll_fd()) {
                     if let Err(e) = self.poll_ctx.delete(fd) {
-                        warn!("failed to remove hungup vfd from poll context: {:?}", e);
+                        warn!("failed to remove hungup vfd from poll context: {}", e);
                     }
                 }
                 self.in_queue.push_back((vfd_id, WlRecv::Hup));
@@ -1263,7 +1263,7 @@ impl WlState {
                         .unwrap()
                         .send(&ResourceRequest::GetResource { id })
                     {
-                        error!("error sending resource bridge request: {:?}", e);
+                        error!("error sending resource bridge request: {}", e);
                         return Ok(WlResp::InvalidId);
                     }
                     match self.resource_bridge.as_ref().unwrap().recv() {
@@ -1276,7 +1276,7 @@ impl WlState {
                             return Ok(WlResp::InvalidId);
                         }
                         Err(e) => {
-                            error!("error receiving resource bridge response: {:?}", e);
+                            error!("error receiving resource bridge response: {}", e);
                             // If there was an error with the resource bridge, it can no longer be
                             // trusted to continue to function.
                             self.resource_bridge = None;
@@ -1538,7 +1538,7 @@ impl Worker {
             }) {
             Ok(pc) => pc,
             Err(e) => {
-                error!("failed creating PollContext: {:?}", e);
+                error!("failed creating PollContext: {}", e);
                 return;
             }
         };
@@ -1548,7 +1548,7 @@ impl Worker {
             let events = match poll_ctx.wait() {
                 Ok(v) => v,
                 Err(e) => {
-                    error!("failed polling for events: {:?}", e);
+                    error!("failed polling for events: {}", e);
                     break;
                 }
             };
@@ -1654,7 +1654,7 @@ impl Worker {
                             len
                         }
                         Err(e) => {
-                            error!("failed to encode response to descriptor chain: {:?}", e);
+                            error!("failed to encode response to descriptor chain: {}", e);
                             0
                         }
                     };
@@ -1756,7 +1756,7 @@ impl VirtioDevice for Wl {
         let (self_kill_evt, kill_evt) = match EventFd::new().and_then(|e| Ok((e.try_clone()?, e))) {
             Ok(v) => v,
             Err(e) => {
-                error!("failed creating kill EventFd pair: {:?}", e);
+                error!("failed creating kill EventFd pair: {}", e);
                 return;
             }
         };