portaudio causes kernel crash in L4T_R21.1 and L4T_R21.2

Hi, Im having trouble running an application which uses portaudio in L4T_R21.1 and L4T_R21.2. Building the app is successful. But while running it, portaudio related APIs cause the kernel to emit a Kernel Oops. The same application runs fine on L4T_R19.3.

The API that I am using is Pa_Initialize().

The errors that are emitted are as follows.

[ 4363.234087] nvavp nvavp: using SMMU at 8ff00000 to load AVP kernel
[ 4363.235229] misc tegra_avpchannel: firmware: direct-loading firmware nvavp_os_8ff00000.bin
[ 4363.235244] nvavp nvavp: read firmware from ‘nvavp_os_8ff00000.bin’ (15900 bytes)
[ 4363.236038] nvavp nvavp: entry=00000094 control=00004bf0 debug=000053f0 size=15876
[ 4363.236066] nvavp nvavp: AVP os at vaddr=f0087000 paddr=8ff00000 reset_addr=8ff00094
[ 4363.238947] tegra30-avp-audio tegra30-avp-audio: cannot read audio firmware nvavp_aud_ucode.bin
[ 4363.248265] tegra30-avp-audio tegra30-avp-audio: Failed to load ucode.
[ 4363.255826] tegra-offload tegra-offload: Failed to open offload stream err -2
[ 4363.263493] tegra-offload tegra-offload: ASoC: can’t open platform tegra-offload: -2
[ 4363.271722] offload-pcm: ASoC: failed to start FE -2
[ 4363.277213] Unable to handle kernel paging request at virtual address f0403114
[ 4363.284445] pgd = e9a64000
[ 4363.287326] [f0403114] *pgd=ae0ec811, *pte=00000000, *ppte=00000000
[ 4363.293667] Internal error: Oops: 7 [#1] PREEMPT SMP ARM
[ 4363.298963] Modules linked in: joydev dm_crypt dm_mod rfcomm bnep bluetooth rfkill nvhost_vi

What could be the reason for this error. Am I missing any required firmware binaries? I checked in the L4T_R19.3 rootfs for nvavp_aud_ucode.bin, but nothing by the name was present.

I don’t know what is causing the issue, but the firmware will be in /lib/firmware/. Files with related names should be there.

I have searched in the rootfs for all three available versions of L4T. Especially in /lib/firmware. No firmware with that file name is present in any of them. I searched the kernel_supplements.tbz2 and nvidia_drivers.tbz2. No file by that name is present there as well. But as I said earlier, L4T_R19.3 works fine. I haven’t tested audio though… At least I’m not getting any errors. Maybe it is due to some changes in the new kernel.? Further debug info from the kernel error shows this…

[ 86.129669] PC is at tegra30_avp_pcm_open+0x94/0x19c
[ 86.134618] LR is at tegra30_avp_pcm_open+0x3c/0x19c

[ 87.243729] [] (tegra30_avp_pcm_open+0x94/0x19c) from [] (tegra_offload_pcm_open+0xd0/0x174)
[ 87.253883] [] (tegra_offload_pcm_open+0xd0/0x174) from [] (soc_pcm_open+0xbc/0x5f0)
[ 87.263344] [] (soc_pcm_open+0xbc/0x5f0) from [] (dpcm_fe_dai_startup+0x5c/0x10c)
[ 87.272542] [] (dpcm_fe_dai_startup+0x5c/0x10c) from [] (dpcm_fe_dai_open+0x6c/0x180)
[ 87.282090] [] (dpcm_fe_dai_open+0x6c/0x180) from [] (snd_pcm_open_substream+0x64/0xa4)
[ 87.291812] [] (snd_pcm_open_substream+0x64/0xa4) from [] (snd_pcm_open+0xa8/0x1d0)
[ 87.301186] [] (snd_pcm_open+0xa8/0x1d0) from [] (snd_pcm_playback_open+0x48/0x64)
[ 87.310473] [] (snd_pcm_playback_open+0x48/0x64) from [] (snd_open+0x9c/0x1a0)
[ 87.319413] [] (snd_open+0x9c/0x1a0) from [] (chrdev_open+0x9c/0x164)
[ 87.327573] [] (chrdev_open+0x9c/0x164) from [] (do_dentry_open.isra.15+0x1c8/0x25c)
[ 87.337031] [] (do_dentry_open.isra.15+0x1c8/0x25c) from [] (finish_open+0x28/0x40)
[ 87.346404] [] (finish_open+0x28/0x40) from [] (do_last.isra.39+0x380/0x68c)
[ 87.355171] [] (do_last.isra.39+0x380/0x68c) from [] (path_openat+0xb4/0x438)
[ 87.364024] [] (path_openat+0xb4/0x438) from [] (do_filp_open+0x34/0x88)
[ 87.372450] [] (do_filp_open+0x34/0x88) from [] (do_sys_open+0xf0/0x17c)
[ 87.380872] [] (do_sys_open+0xf0/0x17c) from [] (SyS_open+0x3c/0x14c)
[ 87.389041] [] (SyS_open+0x3c/0x14c) from [] (ret_fast_syscall+0x0/0x30)
[ 87.397461] Code: e3a07000 ebffff71 e1a00007 e8bd81f0 (e5953114)
[ 87.415944] —[ end trace 207cb1bfe2eec6aa ]—

I searched for “nvavp*” in the R19.x kernel, and found this is a driver included in kernel source rather than from the outside firmware. Still, the error says it is loading firmware, so both must be required. You are probably right that something is missing, via this message:

tegra30-avp-audio tegra30-avp-audio: cannot read audio firmware nvavp_aud_ucode.bin

This still does not answer whether something is missing or simply unreachable. If you have information on steps to recreate this it would help.

Steps to Recreate :

  1. sudo apt-get install portaudio19-dev

  2. Save the following as test_portaudio.c:

#include <portaudio.h>
#include <stdio.h>

int main(int argc, char *argv[])
{
	PaError err;
	int ret = 0;
	printf("Starting portaudio...\n");
	err = Pa_Initialize(); //Should be used before using any other portaudio APIs
	if (err){
		printf("Error = %s\n",Pa_GetErrorText(err));
		ret = -1;
	} else {
		printf("init done.\n"); 
		//Rest of portaudio related code here.
		printf("terminating...\n");
		err = Pa_Terminate(); // Should be called for each successful instance of Pa_initialize()
		if (err){
			printf("Error = %s\n",Pa_GetErrorText(err));
			ret = -2;
		}
		printf("done.\n");
	}
	printf("exit code = %d\n",ret);
	return ret;
}
  1. Compile it as follows:
gcc test_portaudio.c -lportaudio -o test_portaudio
  1. Execute the compiled app:
./test_portaudio

Do the above steps in a Jetson flashed with L4T_R19.3. The code will compile and execute successfully with exit code 0. But when the same procedure is done on a board flashed with L4T_R21.1 or 21.1, the program will hang at line 9 and a kernel oops occurs. I have already shared the details of that kernel error.

Thanks Dilip, NVIDIA has verified that it worked in R19.3 but not R21.2 and is looking into the issue. (It will definitely get fixed, but please remember that the fix may take longer than usual since this is holiday period).

Thanks for the update Shervin. Will be looking forward to a bug fix for this issue. And have a merry christmas all of you.

Hi Shervin. any fix for this bug available yet?

Hello Dilip,

No fix has been posted as yet, but we do hope to have it in an upcoming release.

Thanks,

-Chris