Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions sound/soc/sof/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -330,14 +330,32 @@ EXPORT_SYMBOL_GPL(snd_sof_dbg_memory_info_init);

int snd_sof_dbg_init(struct snd_sof_dev *sdev)
{
struct snd_sof_pdata *plat_data = sdev->pdata;
struct snd_sof_dsp_ops *ops = sof_ops(sdev);
const struct snd_sof_debugfs_map *map;
struct dentry *fw_profile;
int i;
int err;

/* use "sof" as top level debugFS dir */
sdev->debugfs_root = debugfs_create_dir("sof", NULL);

/* expose firmware/topology prefix/names for test purposes */
fw_profile = debugfs_create_dir("fw_profile", sdev->debugfs_root);

debugfs_create_str("fw_path", 0444, fw_profile,
(char **)&plat_data->fw_filename_prefix);
debugfs_create_str("fw_lib_path", 0444, fw_profile,
(char **)&plat_data->fw_lib_prefix);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is page_fault_oops with fw_lib_path in some configurations
Found by... testing!

root@jf-cml-rvp-sdw-3:~# cat /sys/kernel/debug/sof/fw_profile/fw_lib_path
Killed

Apr 22 23:33:23 jf-cml-rvp-sdw-3 kernel: BUG: kernel NULL pointer dereference, address: 0000000000000000
Apr 22 23:33:23 jf-cml-rvp-sdw-3 kernel: #PF: supervisor read access in kernel mode
Apr 22 23:33:23 jf-cml-rvp-sdw-3 kernel: #PF: error_code(0x0000) - not-present page
Apr 22 23:33:23 jf-cml-rvp-sdw-3 kernel: PGD 0 P4D 0
Apr 22 23:33:23 jf-cml-rvp-sdw-3 kernel: Oops: 0000 [#5] PREEMPT SMP NOPTI
Apr 22 23:33:23 jf-cml-rvp-sdw-3 kernel: CPU: 8 PID: 2096 Comm: grep Tainted: G      D            6.9.0-rc3-g0c12720aaa21 #dev
Apr 22 23:33:23 jf-cml-rvp-sdw-3 kernel: Hardware name: Intel Corporation CometLake Client Platform/CometLake U DDR4 HR RVP, BIOS CMLSFWR1.R00.1245.D00.1906>
Apr 22 23:33:23 jf-cml-rvp-sdw-3 kernel: RIP: 0010:strlen+0x4/0x30
Apr 22 23:33:23 jf-cml-rvp-sdw-3 kernel: Code: f7 75 ec 31 c0 c3 cc cc cc cc 48 89 f8 c3 cc cc cc cc 0f 1f 40 00 90 90 90 90 90 90 90 90 90 90 90 90 90 90 9>
Apr 22 23:33:23 jf-cml-rvp-sdw-3 kernel: RSP: 0018:ffffaa4b438c7e28 EFLAGS: 00010246
Apr 22 23:33:23 jf-cml-rvp-sdw-3 kernel: RAX: ffff8d2750c389b8 RBX: ffff8d2743c6b800 RCX: 0000000000000006
Apr 22 23:33:23 jf-cml-rvp-sdw-3 kernel: RDX: 0000000000000007 RSI: 0000558abe473000 RDI: 0000000000000000
Apr 22 23:33:23 jf-cml-rvp-sdw-3 kernel: RBP: ffff8d2743c6b800 R08: 0000000000000000 R09: 0000000000000000
Apr 22 23:33:23 jf-cml-rvp-sdw-3 kernel: R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000
Apr 22 23:33:23 jf-cml-rvp-sdw-3 kernel: R13: 0000000000018000 R14: ffffaa4b438c7f08 R15: ffff8d275f0ce8f8
Apr 22 23:33:23 jf-cml-rvp-sdw-3 kernel: FS:  00007f942669e740(0000) GS:ffff8d2893600000(0000) knlGS:0000000000000000
Apr 22 23:33:23 jf-cml-rvp-sdw-3 kernel: CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
Apr 22 23:33:23 jf-cml-rvp-sdw-3 kernel: CR2: 0000000000000000 CR3: 000000013bdf6004 CR4: 00000000003706f0
Apr 22 23:33:23 jf-cml-rvp-sdw-3 kernel: Call Trace:
Apr 22 23:33:23 jf-cml-rvp-sdw-3 kernel:  <TASK>
Apr 22 23:33:23 jf-cml-rvp-sdw-3 kernel:  ? __die+0x24/0x70
Apr 22 23:33:23 jf-cml-rvp-sdw-3 kernel:  ? page_fault_oops+0x15a/0x450
Apr 22 23:33:23 jf-cml-rvp-sdw-3 kernel:  ? exc_page_fault+0x68/0x1e0
Apr 22 23:33:23 jf-cml-rvp-sdw-3 kernel:  ? asm_exc_page_fault+0x26/0x30
Apr 22 23:33:23 jf-cml-rvp-sdw-3 kernel:  ? strlen+0x4/0x30
Apr 22 23:33:23 jf-cml-rvp-sdw-3 kernel:  debugfs_read_file_str+0x4d/0xf0
Apr 22 23:33:23 jf-cml-rvp-sdw-3 kernel:  vfs_read+0xab/0x340
Apr 22 23:33:23 jf-cml-rvp-sdw-3 kernel:  ? __do_sys_newfstatat+0x35/0x60
Apr 22 23:33:23 jf-cml-rvp-sdw-3 kernel:  ksys_read+0x69/0xf0
Apr 22 23:33:23 jf-cml-rvp-sdw-3 kernel:  do_syscall_64+0xad/0x1b0
Apr 22 23:33:23 jf-cml-rvp-sdw-3 kernel:  entry_SYSCALL_64_after_hwframe+0x72/0x7a

Copy link
Member Author

@plbossart plbossart Apr 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a CML platform....

I can't recall is fw_lib_path is relevant for IPC3 @ujfalusi, we could just skip the file create for IPC3 I guess.

At any rate the scripts only used this for IPC4 platforms.

Copy link
Collaborator

@marc-hb marc-hb Apr 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I confirm the oops happened only with the stable-v2.2 firmware branch. But it did happen with ALL 3 devices tested for that branch.

Because of various sudo issues (hopefully last fix in thesofproject/sof-test#1178) fw_lib_path had never been tested yet.

Copy link
Collaborator

@ujfalusi ujfalusi Apr 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, fw_lib_path is going to be NULL with IPC3, probably we can have have a static const "N/A" string here and give that to debugfs_create_str()?
Or skip creating the file in case of IPC3, it is not applicable after all.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@marc-hb what's the preferred result for scripts? A N/A reply or the file not created at all?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either can be scripted easily but no file at all is safer because there's less risk of confusing it with something valid:

https://en.wikipedia.org/wiki/Null_pointer a.k.a. the "billion dollar mistake".

Note we have no script trying to read this brand new field yet (= how I just found this bug)

debugfs_create_str("tplg_path", 0444, fw_profile,
(char **)&plat_data->tplg_filename_prefix);
debugfs_create_str("fw_name", 0444, fw_profile,
(char **)&plat_data->fw_filename);
debugfs_create_str("tplg_name", 0444, fw_profile,
(char **)&plat_data->tplg_filename);
debugfs_create_u32("ipc_type", 0444, fw_profile,
(u32 *)&plat_data->ipc_type);

/* init dfsentry list */
INIT_LIST_HEAD(&sdev->dfsentry_list);

Expand Down
3 changes: 3 additions & 0 deletions sound/soc/sof/intel/pci-lnl.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ static const struct sof_dev_desc lnl_desc = {
.default_fw_path = {
[SOF_IPC_TYPE_4] = "intel/sof-ipc4/lnl",
},
.default_lib_path = {
[SOF_IPC_TYPE_4] = "intel/sof-ipc4-lib/lnl",
},
.default_tplg_path = {
[SOF_IPC_TYPE_4] = "intel/sof-ipc4-tplg",
},
Expand Down