Repository navigation
ASoC: SOF: create audio buffer page tables in a hardware-safe way - #711
Conversation
The SOF packs 20-bit page frame numbers into memory back-to-back, which produces both unaligned access and endianness problems. Use unaligned memory accessors to guarantee correct packing on all platforms. Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
|
The CI is complaining about the 80 characters limit in a comment line, which - yes - is 81 or 82 characters long and IMHO has a good reason for that. |
| pg_table = (u32 *)(page_table + idx); | ||
| pg_table = (u8 *)(page_table + idx); | ||
|
|
||
| /* |
There was a problem hiding this comment.
The commit is super nice! One thing if you can do is: explain why the compression is needed for readers who will try to understand the code later.
don't worry about this, I check where the errors happen and if it's in comments or dev_err logs I ignore them. |
|
I think we should mention that this is an optimization to handle large ring buffers even if the mailboxes are small, but that it's not required in most cases and adds a little-endian restriction so we might make this optional in a future update for cases where this compression is not required. This would be an ABI change though so the compression support will have to remain in the driver for backwards compatibility. |
Following process:
vfs_setxattr(host)
ubifs_xattr_set
down_write(host_ui->xattr_sem) <- lock first time
create_xattr
ubifs_new_inode(host)
fscrypt_prepare_new_inode(host)
fscrypt_policy_to_inherit(host)
if (IS_ENCRYPTED(inode))
fscrypt_require_key(host)
fscrypt_get_encryption_info(host)
ubifs_xattr_get(host)
down_read(host_ui->xattr_sem) <- AA deadlock
, which may trigger an AA deadlock problem:
[ 102.620871] INFO: task setfattr:1599 blocked for more than 10 seconds.
[ 102.625298] Not tainted 5.19.0-rc7-00001-gb666b6823ce0-dirty thesofproject#711
[ 102.628732] task:setfattr state:D stack: 0 pid: 1599
[ 102.628749] Call Trace:
[ 102.628753] <TASK>
[ 102.628776] __schedule+0x482/0x1060
[ 102.629964] schedule+0x92/0x1a0
[ 102.629976] rwsem_down_read_slowpath+0x287/0x8c0
[ 102.629996] down_read+0x84/0x170
[ 102.630585] ubifs_xattr_get+0xd1/0x370 [ubifs]
[ 102.630730] ubifs_crypt_get_context+0x1f/0x30 [ubifs]
[ 102.630791] fscrypt_get_encryption_info+0x7d/0x1c0
[ 102.630810] fscrypt_policy_to_inherit+0x56/0xc0
[ 102.630817] fscrypt_prepare_new_inode+0x35/0x160
[ 102.630830] ubifs_new_inode+0xcc/0x4b0 [ubifs]
[ 102.630873] ubifs_xattr_set+0x591/0x9f0 [ubifs]
[ 102.630961] xattr_set+0x8c/0x3e0 [ubifs]
[ 102.631003] __vfs_setxattr+0x71/0xc0
[ 102.631026] vfs_setxattr+0x105/0x270
[ 102.631034] do_setxattr+0x6d/0x110
[ 102.631041] setxattr+0xa0/0xd0
[ 102.631087] __x64_sys_setxattr+0x2f/0x40
Fetch a reproducer in [Link].
Just like ext4 does, which skips encrypting for inode with
EXT4_EA_INODE_FL flag. Stop encypting xattr inode for ubifs.
Link: https://bugzilla.kernel.org/show_bug.cgi?id=216260
Fixes: f4e3634 ("ubifs: Fix races between xattr_{set|get} ...")
Fixes: d475a50 ("ubifs: Add skeleton for fscrypto")
Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
The SOF packs 20-bit page frame numbers into memory back-to-back,
which produces both unaligned access and endianness problems. Use
unaligned memory accessors to guarantee correct packing on all
platforms.
A discussion is also underway to verify whether such packing is at all needed or can be safely dropped for simplicity and performance.