mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2025-02-10 20:19:07 +00:00
Set rtprio in virtio-snd (cras backend) worker
to 10 (following other cros audio client) BUG=b:199796992 TEST=Examine output of `ps -AT -eo rtprio,command` when the device is running Change-Id: I1293c693e1bd699788d87d5bc085fd4fd281fff1 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3159894 Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Chih-Yang Hsia <paulhsia@chromium.org> Commit-Queue: Woody Chow <woodychow@google.com>
This commit is contained in:
parent
44292f58f3
commit
f5183c26be
4 changed files with 17 additions and 0 deletions
|
@ -17,6 +17,7 @@ use data_model::DataInit;
|
|||
use futures::channel::mpsc;
|
||||
use futures::{pin_mut, Future, TryFutureExt};
|
||||
use libcras::{BoxError, CrasClient, CrasClientType, CrasSocketType};
|
||||
use sys_util::{set_rt_prio_limit, set_rt_round_robin};
|
||||
use thiserror::Error as ThisError;
|
||||
use vm_memory::GuestMemory;
|
||||
|
||||
|
@ -33,6 +34,7 @@ use crate::virtio::snd::cras_backend::async_funcs::*;
|
|||
// control + event + tx + rx queue
|
||||
const NUM_QUEUES: usize = 4;
|
||||
const QUEUE_SIZE: u16 = 1024;
|
||||
const AUDIO_THREAD_RTPRIO: u16 = 10; // Matches other cros audio clients.
|
||||
|
||||
#[derive(ThisError, Debug)]
|
||||
pub enum Error {
|
||||
|
@ -544,6 +546,12 @@ impl VirtioDevice for VirtioSndCras {
|
|||
let worker_result = thread::Builder::new()
|
||||
.name("virtio_snd w".to_string())
|
||||
.spawn(move || {
|
||||
if let Err(e) = set_rt_prio_limit(u64::from(AUDIO_THREAD_RTPRIO))
|
||||
.and_then(|_| set_rt_round_robin(i32::from(AUDIO_THREAD_RTPRIO)))
|
||||
{
|
||||
warn!("Failed to set audio thread to real time: {}", e);
|
||||
}
|
||||
|
||||
let mut streams: Vec<AsyncMutex<StreamInfo>> = Vec::new();
|
||||
streams.resize_with(pcm_info.len(), Default::default);
|
||||
|
||||
|
|
|
@ -9,3 +9,6 @@ socket: arg0 == AF_UNIX
|
|||
socketpair: arg0 == AF_UNIX
|
||||
prctl: arg0 == PR_SET_NAME
|
||||
connect: 1
|
||||
prlimit64: 1
|
||||
setrlimit: 1
|
||||
sched_setscheduler: 1
|
||||
|
|
|
@ -10,3 +10,6 @@ socket: arg0 == AF_UNIX
|
|||
socketpair: arg0 == AF_UNIX
|
||||
prctl: arg0 == PR_SET_NAME
|
||||
connect: 1
|
||||
prlimit64: 1
|
||||
setrlimit: 1
|
||||
sched_setscheduler: 1
|
||||
|
|
|
@ -10,3 +10,6 @@ socket: arg0 == AF_UNIX
|
|||
socketpair: arg0 == AF_UNIX
|
||||
prctl: arg0 == PR_SET_NAME
|
||||
connect: 1
|
||||
prlimit64: 1
|
||||
setrlimit: 1
|
||||
sched_setscheduler: 1
|
||||
|
|
Loading…
Reference in a new issue