From: Mark Brown <broonie(a)linaro.org>
Try to spot locking issues by asserting that the DAPM mutex is held when
it should be. There's a bit of fun due to us not requiring the lock to be
held prior to the card being instantiated which mean we need to wrap the
assert in some paths and this isn't methodical by any stretch of the
imagination.
Signed-off-by: Mark Brown <broonie(a)linaro.org>
---
I've only compile tested this so it's entirely possible there's some
oversights here - at this point I'm mostly just throwing it out there
for people to play with as a work in progress.
sound/soc/soc-dapm.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 3728e21..c8a780d 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -111,6 +111,12 @@ static int dapm_down_seq[] = {
[snd_soc_dapm_post] = 14,
};
+static void dapm_assert_locked(struct snd_soc_dapm_context *dapm)
+{
+ if (dapm->card && dapm->card->instantiated)
+ lockdep_assert_held(&dapm->card->dapm_mutex);
+}
+
static void pop_wait(u32 pop_time)
{
if (pop_time)
@@ -144,6 +150,8 @@ static bool dapm_dirty_widget(struct snd_soc_dapm_widget *w)
static void dapm_mark_dirty(struct snd_soc_dapm_widget *w, const char *reason)
{
+ dapm_assert_locked(w->dapm);
+
if (!dapm_dirty_widget(w)) {
dev_vdbg(w->dapm->dev, "Marking %s dirty due to %s\n",
w->name, reason);
@@ -356,6 +364,8 @@ static void dapm_reset(struct snd_soc_card *card)
{
struct snd_soc_dapm_widget *w;
+ lockdep_assert_held(&card->dapm_mutex);
+
memset(&card->dapm_stats, 0, sizeof(card->dapm_stats));
list_for_each_entry(w, &card->widgets, list) {
@@ -1750,6 +1760,8 @@ static int dapm_power_widgets(struct snd_soc_card *card, int event)
ASYNC_DOMAIN_EXCLUSIVE(async_domain);
enum snd_soc_bias_level bias;
+ lockdep_assert_held(&card->dapm_mutex);
+
trace_snd_soc_dapm_start(card);
list_for_each_entry(d, &card->dapm_list, list) {
@@ -2045,6 +2057,8 @@ static int soc_dapm_mux_update_power(struct snd_soc_card *card,
struct snd_soc_dapm_path *path;
int found = 0;
+ lockdep_assert_held(&card->dapm_mutex);
+
/* find dapm widget path assoc with kcontrol */
dapm_kcontrol_for_each_path(path, kcontrol) {
if (!path->name || !e->texts[mux])
@@ -2095,6 +2109,8 @@ static int soc_dapm_mixer_update_power(struct snd_soc_card *card,
struct snd_soc_dapm_path *path;
int found = 0;
+ lockdep_assert_held(&card->dapm_mutex);
+
/* find dapm widget path assoc with kcontrol */
dapm_kcontrol_for_each_path(path, kcontrol) {
found = 1;
@@ -2260,6 +2276,8 @@ static int snd_soc_dapm_set_pin(struct snd_soc_dapm_context *dapm,
{
struct snd_soc_dapm_widget *w = dapm_find_widget(dapm, pin, true);
+ dapm_assert_locked(dapm);
+
if (!w) {
dev_err(dapm->dev, "ASoC: DAPM unknown pin %s\n", pin);
return -EINVAL;
--
1.9.0
> You should apply ARM:7862/1 before the suspend series and then do not
> miss:
Think over the __get_cpu_var changes in upstream. I am going to give up too much patchset backporting for this change. and going to backport the this_cpu_ptr to __get_cpu_var by the following patch.
If we have to backport __get_cpu_var change later, it is easy to revert this patch. What's your opinions on this?
=========
*/
- for (slots = this_cpu_ptr(bp_on_reg), i = 0; i < core_num_brps; ++i) {
+ for (slots = __get_cpu_var(bp_on_reg), i = 0; i < core_num_brps; ++i) {
if (slots[i]) {
hw_breakpoint_control(slots[i], HW_BREAKPOINT_RESTORE);
} else {
@@ -870,7 +870,7 @@ static void hw_breakpoint_reset(void *unused)
}
}
- for (slots = this_cpu_ptr(wp_on_reg), i = 0; i < core_num_wrps; ++i) {
+ for (slots = __get_cpu_var(wp_on_reg), i = 0; i < core_num_wrps; ++i) {
>
> 65c021bb496a46ec06264e9d5e836dffa70ef380
> arm64: kernel: restore HW breakpoint registers in cpu_suspend
>
> fb4a96029c8a091c4365f57307e098543b48a222
> arm64: kernel: fix per-cpu offset restore on resume
>
I merged them both. Thanks!
The following is all patches for this feature, the 13th is just mentioned patch.
the git tree is git://git.linaro.org/kernel/linux-linaro-stable.git linux-linaro-lsk-test.
-rw-rw-r-- 1 alexs alexs 7620 Mar 6 11:14 0001-arm64-kernel-build-MPIDR_EL1-hash-function-data-stru.patch
-rw-rw-r-- 1 alexs alexs 4105 Mar 6 11:14 0002-arm64-kernel-suspend-resume-registers-save-restore.patch
-rw-rw-r-- 1 alexs alexs 16485 Mar 6 11:14 0003-arm64-kernel-cpu_-suspend-resume-implementation.patch
-rw-rw-r-- 1 alexs alexs 2688 Mar 6 11:14 0004-arm64-kernel-implement-fpsimd-CPU-PM-notifier.patch
-rw-rw-r-- 1 alexs alexs 1863 Mar 6 11:14 0005-arm-kvm-implement-CPU-PM-notifier.patch
-rw-rw-r-- 1 alexs alexs 5551 Mar 6 11:14 0006-arm64-kernel-refactor-code-to-install-uninstall-brea.patch
-rw-rw-r-- 1 alexs alexs 5286 Mar 6 11:14 0007-arm64-kernel-implement-HW-breakpoints-CPU-PM-notifie.patch
-rw-rw-r-- 1 alexs alexs 3195 Mar 6 11:14 0008-arm64-enable-generic-clockevent-broadcast.patch
-rw-rw-r-- 1 alexs alexs 1394 Mar 6 11:14 0009-arm64-kernel-add-CPU-idle-call.patch
-rw-rw-r-- 1 alexs alexs 2132 Mar 6 11:14 0010-arm64-kernel-add-PM-build-infrastructure.patch
-rw-rw-r-- 1 alexs alexs 892 Mar 6 11:14 0011-arm64-add-CPU-power-management-menu-entries.patch
-rw-rw-r-- 1 alexs alexs 1385 Mar 6 11:14 0012-arm64-kernel-add-MPIDR_EL1-accessors-macros.patch
-rw-rw-r-- 1 alexs alexs 1902 Mar 6 11:14 0013-arm64-hw_breakpoint-compile-error-fixing.patch
-rw-rw-r-- 1 alexs alexs 4343 Mar 6 11:14 0014-arm64-kernel-restore-HW-breakpoint-registers-in-cpu_.patch
-rw-rw-r-- 1 alexs alexs 4353 Mar 6 11:14 0015-arm64-percpu-implement-optimised-pcpu-access-using-t.patch
-rw-rw-r-- 1 alexs alexs 1814 Mar 6 11:14 0016-arm64-kernel-fix-per-cpu-offset-restore-on-resume.patch
alexs@alex-mac:~/lsk/kernel$
Thanks!
From: Mark Brown <broonie(a)linaro.org>
We now no longer have any users of hw_read() in the kernel so remove the
code in order to prevent any new users being added. Users should be using
regmap.
Signed-off-by: Mark Brown <broonie(a)linaro.org>
---
include/sound/soc.h | 1 -
sound/soc/soc-io.c | 13 -------------
2 files changed, 14 deletions(-)
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 56c4c71..dc36331 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -706,7 +706,6 @@ struct snd_soc_codec {
/* codec IO */
void *control_data; /* codec control (i2c/3wire) data */
hw_write_t hw_write;
- unsigned int (*hw_read)(struct snd_soc_codec *, unsigned int);
unsigned int (*read)(struct snd_soc_codec *, unsigned int);
int (*write)(struct snd_soc_codec *, unsigned int, unsigned int);
void *reg_cache;
diff --git a/sound/soc/soc-io.c b/sound/soc/soc-io.c
index c3b6a0a..3c1de9c 100644
--- a/sound/soc/soc-io.c
+++ b/sound/soc/soc-io.c
@@ -26,18 +26,6 @@ static int hw_write(struct snd_soc_codec *codec, unsigned int reg,
return regmap_write(codec->control_data, reg, value);
}
-static unsigned int hw_read(struct snd_soc_codec *codec, unsigned int reg)
-{
- int ret;
- unsigned int val;
-
- ret = regmap_read(codec->control_data, reg, &val);
- if (ret == 0)
- return val;
- else
- return -1;
-}
-
/**
* snd_soc_codec_set_cache_io: Set up standard I/O functions.
*
@@ -64,7 +52,6 @@ int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec,
int ret;
codec->write = hw_write;
- codec->read = hw_read;
switch (control) {
case SND_SOC_REGMAP:
--
1.9.0
From: Mark Brown <broonie(a)linaro.org>
There is no point in using FIQ if DMA is available (it is selected) and
selecting FIQ currently breaks the build on non-i.MX platforms. If FIQ
is actually required the build will need to be restricted or have a
select for the relevant FIQ code adding.
Signed-off-by: Mark Brown <broonie(a)linaro.org>
---
sound/soc/fsl/Kconfig | 1 -
1 file changed, 1 deletion(-)
diff --git a/sound/soc/fsl/Kconfig b/sound/soc/fsl/Kconfig
index a7d6ab6..b244830 100644
--- a/sound/soc/fsl/Kconfig
+++ b/sound/soc/fsl/Kconfig
@@ -175,7 +175,6 @@ config SND_SOC_EUKREA_TLV320
|| (OF && ARM)
depends on I2C
select SND_SOC_TLV320AIC23
- select SND_SOC_IMX_PCM_FIQ
select SND_SOC_IMX_AUDMUX
select SND_SOC_IMX_SSI
select SND_SOC_FSL_SSI
--
1.9.0
Patches adding support for hibernation on ARM
- ARM hibernation / suspend-to-disk
- Change soft_restart to use non-tracing raw_local_irq_disable
Patches based on v3.13 tag, verified hibernation on beaglebone black on a
branch based on 3.13 merged with initial omap support from Russ Dill which
can be found here (includes v1 patchset):
http://git.linaro.org/git-ro/people/sebastian.capella/linux.git hibernation_3.13_russMerge
[PATCH v6 1/2] ARM: avoid tracers in soft_restart
arch/arm/kernel/process.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Use raw_local_irq_disable in place of local_irq_disable to avoid
infinite abort recursion while tracing. (unchanged since v3)
[PATCH v6 2/2] ARM hibernation / suspend-to-disk
arch/arm/include/asm/memory.h | 1 +
arch/arm/kernel/Makefile | 1 +
arch/arm/kernel/hibernate.c | 113 +++++++++++++++++++++++++++++++++++++++++
arch/arm/mm/Kconfig | 5 ++
include/linux/suspend.h | 2 +
5 files changed, 122 insertions(+)
Adds support for ARM based hibernation
Additional notes:
-----------------
There are two checkpatch warnings added by this patch. These follow
behavior in existing hibernation implementations on other platforms.
WARNING: externs should be avoided in .c files
#116: FILE: arch/arm/kernel/hibernate.c:26:
+extern const void __nosave_begin, __nosave_end;
This extern is picking up the linker nosave region definitions, only
used in hibernate. Follows same extern line used mips, powerpc, s390,
sh, sparc, x86 & unicore32
WARNING: externs should be avoided in .c files
#199: FILE: arch/arm/kernel/hibernate.c:109:
+extern void call_with_stack(void (*fn)(void *), void *arg, void *sp);
This extern is used in the arch/arm/ in hibernate, process and bL_switcher
Changes in v6:
--------------
* Simplify static variable names
Changes in v5:
--------------
* Fixed checkpatch warning on trailing whitespace
Changes in v4:
--------------
* updated comment for soft_restart with review feedback
* dropped freeze_processes patch which was queued separately
to 3.14 by Rafael Wysocki:
https://lkml.org/lkml/2014/2/25/683
Changes in v3:
--------------
* added comment to use of soft_restart
* drop irq disable soft_restart patch
* add patch to avoid tracers in soft_restart by using raw_local_irq_*
Changes in v2:
--------------
* Removed unneeded flush_thread, use of __naked and cpu_init.
* dropped Cyril Chemparathy <cyril(a)ti.com> from Cc: list as
emails are bouncing.
Thanks,
Sebastian Capella