From 7cf768d02dd34aee39bf77d3524700cf1b629d8d Mon Sep 17 00:00:00 2001 From: paulhsia Date: Wed, 31 Jul 2019 19:51:17 +0800 Subject: [PATCH] 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 Tested-by: Chih-Yang Hsia Reviewed-by: Dylan Reid Commit-Queue: Chih-Yang Hsia --- devices/src/pci/ac97_bus_master.rs | 2 +- seccomp/arm/cras_audio_device.policy | 1 + seccomp/x86_64/cras_audio_device.policy | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/devices/src/pci/ac97_bus_master.rs b/devices/src/pci/ac97_bus_master.rs index cd32f3586e..83ccbc2060 100644 --- a/devices/src/pci/ac97_bus_master.rs +++ b/devices/src/pci/ac97_bus_master.rs @@ -490,7 +490,7 @@ impl Ac97BusMaster { } fn start_audio(&mut self, func: Ac97Function, mixer: &Ac97Mixer) -> Result<(), Box> { - 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 => { diff --git a/seccomp/arm/cras_audio_device.policy b/seccomp/arm/cras_audio_device.policy index 06d63d1130..ef9b5eda75 100644 --- a/seccomp/arm/cras_audio_device.policy +++ b/seccomp/arm/cras_audio_device.policy @@ -8,6 +8,7 @@ madvise: 1 prlimit64: 1 setrlimit: 1 recvmsg: 1 +sched_setscheduler: 1 sendmsg: 1 socketpair: arg0 == AF_UNIX clock_gettime: 1 diff --git a/seccomp/x86_64/cras_audio_device.policy b/seccomp/x86_64/cras_audio_device.policy index e5a074ec04..1e440e3cde 100644 --- a/seccomp/x86_64/cras_audio_device.policy +++ b/seccomp/x86_64/cras_audio_device.policy @@ -8,5 +8,6 @@ madvise: 1 prlimit64: 1 setrlimit: 1 recvmsg: 1 +sched_setscheduler: 1 sendmsg: 1 socketpair: arg0 == AF_UNIX