ac97: Fix device real time priority issue

- Add allow sched_setscheduler call in seccomp policy
- Change the real time priority constant AUDIO_THREAD_RTPRIO to 10 to match
all other clients' priority.

Run the following commands to test
1. ulimit -r 10
2. crosvm run -r ./vm_rootfs.img -c 1 -m 1024 -s /run --cid 5 --host_ip \
   100.115.92.25 --netmask 255.255.255.252 --cras-audio \
   --params="snd_intel8x0.inside_vm=1 snd_intel8x0.ac97_clock=48000" \
   --mac d2:47:f7:c5:9e:53 ./vm_kernel
3. aplay -Dhw:0,0 -f dat /dev/zero
4. ps -AT -o comm,rtprio | grep crosvm
should see a thread running with rtprio=10

BUG=chromium:983533
BUG=b:138262556
TEST=Test with eve (x86_64) and bob (arm)

Change-Id: Idc3711d03d716741f7cefd9a89b14ae4c20c2033
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1729089
Tested-by: kokoro <noreply+kokoro@google.com>
Tested-by: Chih-Yang Hsia <paulhsia@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Commit-Queue: Chih-Yang Hsia <paulhsia@chromium.org>
This commit is contained in:
paulhsia 2019-07-31 19:51:17 +08:00 committed by Commit Bot
parent 969a0b49ff
commit 7cf768d02d
3 changed files with 3 additions and 1 deletions

View file

@ -490,7 +490,7 @@ impl Ac97BusMaster {
}
fn start_audio(&mut self, func: Ac97Function, mixer: &Ac97Mixer) -> Result<(), Box<dyn Error>> {
const AUDIO_THREAD_RTPRIO: u16 = 12; // Matches other cros audio clients.
const AUDIO_THREAD_RTPRIO: u16 = 10; // Matches other cros audio clients.
match func {
Ac97Function::Input => {

View file

@ -8,6 +8,7 @@ madvise: 1
prlimit64: 1
setrlimit: 1
recvmsg: 1
sched_setscheduler: 1
sendmsg: 1
socketpair: arg0 == AF_UNIX
clock_gettime: 1

View file

@ -8,5 +8,6 @@ madvise: 1
prlimit64: 1
setrlimit: 1
recvmsg: 1
sched_setscheduler: 1
sendmsg: 1
socketpair: arg0 == AF_UNIX