Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

An improved version of Pull Request #72 #130

Closed
wants to merge 2 commits into from

Conversation

lyakh
Copy link

@lyakh lyakh commented Sep 12, 2018

Please, hit this hard! Review and test it thoroughly because I couldn't do that... I might be very much off track here. This is based solely on studying the code and the code isn't very simple :-)

lyakh and others added 2 commits September 7, 2018 17:19
The snd_sgbuf_aligned_pages() inline function is currently only
defined if CONFIG_SND_DMA_SGBUF is enabled. This isn't needed, the
function doesn't need SG DMA to be valid. Move it outside of #ifdef.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@intel.com>
check the return value to free the kcontrols instance
to avoid oops caused by the pointer dereference.

Signed-off-by: Wu Zhigang <zhigang.wu@linux.intel.com>
[guennadi.liakhovetski@intel.com add handling of .autodisable=1 cases]
@lyakh lyakh requested review from lgirdwood and a user September 12, 2018 12:41
@lgirdwood
Copy link
Member

@lyakh can you change PR subject line.

@ZhendanYang or @keqiaozhang can you test before is merged. This is a kernel crash on modules unload. @zhigang-wu can you provide bug number.

@jocelyn-li
Copy link

#73 #68 #33 #46 are related bugs for test @ZhendanYang or @keqiaozhang

@ghost
Copy link

ghost commented Sep 13, 2018

I think the snd_soc_dapm_add_path() function's return value also need to be checked.
and the key point of this issue is not covered in this PR:
the default path is reached, what should we do?
the panic is caused by we goto the default path in snd_soc_dapm_new_widgets().
the pointer in w->kcontrols[] is null. we try to free it in topology stage. oops hits!

@lgirdwood
Copy link
Member

@zhigang-wu best to place your review comments inline by clicking on commits, this way its easier to follow what you mean.

break;
case snd_soc_dapm_dai_link:
dapm_new_dai_link(w);
ret = dapm_new_dai_link(w);
break;
default:
break;
Copy link

Choose a reason for hiding this comment

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

the root cause of the issue is:
One of the w->id in the link list is not processed here, it goes to the default case.
we have to handle this.

Copy link
Member

Choose a reason for hiding this comment

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

@lyakh it seems to be failing checkpatch

Copy link
Author

@lyakh lyakh Sep 18, 2018

Choose a reason for hiding this comment

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

Right, 2 errors are about the opening brace after a loop statement "list_for_each_..." is on a separate line. I saw it, I know it isn't the kernel style, but I used that style to preserve the original file formatting. That should be a separate patch to fix that. Perhaps before this one to then not have to add more such formatting issues. Or I can just fix this patch and then a separate patch should fix remaining old locations. As for "over 80 characters" warnings - yeah, 89 characters is a bit on a high end, but I see even a 92-char line in that file already, and it isn't one of printk() strings:

static int soc_dapm_mux_update_power(struct snd_soc_card *card,
				struct snd_kcontrol *kcontrol, int mux, struct soc_enum *e)

but I can make those shorter, if needed.
I think I'll make a new version with braces and long lines fixed - if those are the only problems with this patch.

@ZhendanYang
Copy link

@lgirdwood @jocelyn-li
I tested this PR for issue #33 , #46 , #68 , #73 and the test result is following below:
#33 , this issue can still reproduce with sof-byt-rt5651.tplg, but can't reproduce with sof-byt-nocodec.tplg.
#46 , can't reproduce. I ran 100 times uploading and reloading driver and no kernel panic issue. But it may be blocked by #124 .
#68 , this issue still exists, I think it may be duplicated with #33 .
#73 , can't reproduce. I ran 100 times uploading and reloading driver and no kernel panic issue. But it may be blocked by #124 .

@lyakh lyakh changed the title Pr72 An improved version of Pull Request #72 Sep 18, 2018
@lyakh lyakh closed this Sep 18, 2018
@lyakh lyakh deleted the PR72 branch September 18, 2018 09:48
plbossart pushed a commit that referenced this pull request Feb 5, 2021
A cleanup patch from my legacy timer series broke ia64 and led
to RCU stall errors and a fast system clock:

[  909.360108] INFO: task systemd-sysv-ge:200 blocked for more than 127 seconds.
[  909.360108]       Not tainted 5.10.0+ #130
[  909.360108] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[  909.360108] task:systemd-sysv-ge state:D stack:    0 pid:  200 ppid:   189 flags:0x00000000
[  909.364108]
[  909.364108] Call Trace:
[  909.364423]  [<a00000010109b210>] __schedule+0x890/0x21e0
[  909.364423]                                 sp=e0000100487d7b70 bsp=e0000100487d1748
[  909.368423]  [<a00000010109cc00>] schedule+0xa0/0x240
[  909.368423]                                 sp=e0000100487d7b90 bsp=e0000100487d16e0
[  909.368558]  [<a00000010109ce70>] io_schedule+0x70/0xa0
[  909.368558]                                 sp=e0000100487d7b90 bsp=e0000100487d16c0
[  909.372290]  [<a00000010109e1c0>] bit_wait_io+0x20/0xe0
[  909.372290]                                 sp=e0000100487d7b90 bsp=e0000100487d1698
[  909.374168] rcu: INFO: rcu_sched detected stalls on CPUs/tasks:
[  909.376290]  [<a00000010109d860>] __wait_on_bit+0xc0/0x1c0
[  909.376290]                                 sp=e0000100487d7b90 bsp=e0000100487d1648
[  909.374168] rcu:     3-....: (2 ticks this GP) idle=19e/1/0x4000000000000002 softirq=1581/1581 fqs=2
[  909.374168]  (detected by 0, t=5661 jiffies, g=1089, q=3)
[  909.376290]  [<a00000010109da80>] out_of_line_wait_on_bit+0x120/0x140
[  909.376290]                                 sp=e0000100487d7b90 bsp=e0000100487d1610
[  909.374168] Task dump for CPU 3:
[  909.374168] task:khungtaskd      state:R  running task

Revert most of my patch to make this work again, including the extra
update_process_times()/profile_tick() and the local_irq_enable() in the
loop that I expected not to be needed here.

I have not found out exactly what goes wrong, and would suggest that
someone with hardware access tries to convert this code into a singleshot
clockevent driver, which should give better behavior in all cases.

Reported-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Fixes: 2b49ddc ("ia64: convert to legacy_timer_tick")
Cc: John Stultz <john.stultz@linaro.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Stephen Boyd <sboyd@kernel.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
aiChaoSONG pushed a commit to aiChaoSONG/linux that referenced this pull request May 6, 2021
vijendarmukunda pushed a commit to vijendarmukunda/linux that referenced this pull request Feb 13, 2024
Like commit 1cf3bfc ("bpf: Support 64-bit pointers to kfuncs")
for s390x, add support for 64-bit pointers to kfuncs for LoongArch.
Since the infrastructure is already implemented in BPF core, the only
thing need to be done is to override bpf_jit_supports_far_kfunc_call().

Before this change, several test_verifier tests failed:

  # ./test_verifier | grep # | grep FAIL
  thesofproject#119/p calls: invalid kfunc call: ptr_to_mem to struct with non-scalar FAIL
  thesofproject#120/p calls: invalid kfunc call: ptr_to_mem to struct with nesting depth > 4 FAIL
  thesofproject#121/p calls: invalid kfunc call: ptr_to_mem to struct with FAM FAIL
  thesofproject#122/p calls: invalid kfunc call: reg->type != PTR_TO_CTX FAIL
  thesofproject#123/p calls: invalid kfunc call: void * not allowed in func proto without mem size arg FAIL
  thesofproject#124/p calls: trigger reg2btf_ids[reg->type] for reg->type > __BPF_REG_TYPE_MAX FAIL
  thesofproject#125/p calls: invalid kfunc call: reg->off must be zero when passed to release kfunc FAIL
  thesofproject#126/p calls: invalid kfunc call: don't match first member type when passed to release kfunc FAIL
  thesofproject#127/p calls: invalid kfunc call: PTR_TO_BTF_ID with negative offset FAIL
  thesofproject#128/p calls: invalid kfunc call: PTR_TO_BTF_ID with variable offset FAIL
  thesofproject#129/p calls: invalid kfunc call: referenced arg needs refcounted PTR_TO_BTF_ID FAIL
  thesofproject#130/p calls: valid kfunc call: referenced arg needs refcounted PTR_TO_BTF_ID FAIL
  thesofproject#486/p map_kptr: ref: reference state created and released on xchg FAIL

This is because the kfuncs in the loaded module are far away from
__bpf_call_base:

  ffff800002009440 t bpf_kfunc_call_test_fail1    [bpf_testmod]
  9000000002e128d8 T __bpf_call_base

The offset relative to __bpf_call_base does NOT fit in s32, which breaks
the assumption in BPF core. Enable bpf_jit_supports_far_kfunc_call() lifts
this limit.

Note that to reproduce the above result, tools/testing/selftests/bpf/config
should be applied, and run the test with JIT enabled, unpriv BPF enabled.

With this change, the test_verifier tests now all passed:

  # ./test_verifier
  ...
  Summary: 777 PASSED, 0 SKIPPED, 0 FAILED

Tested-by: Tiezhu Yang <yangtiezhu@loongson.cn>
Signed-off-by: Hengqi Chen <hengqi.chen@gmail.com>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants