snd_array_free - snd: bad kfree when HDA reconfig

6 messages, 2 authors, 2011-09-15 · open the first message on its own page

snd_array_free - snd: bad kfree when HDA reconfig

From: Raymond Yau <hidden>
Date: 2011-09-02 07:16:28

These errors "snd: bad kfree" occur when reconfig HDA from model
"6stack-dig-fp" to "auto" and vice versa

Is "HD-Audio reconfiguration" still experimental ?

BTW, it seem that HDA Digital PCBeep assigned to different input after
each reconfig

input: HDA Digital PCBeep as /devices/pci0000:00/0000:00:1b.0/input/input7
input: HDA Digital PCBeep as /devices/pci0000:00/0000:00:1b.0/input/input8
input: HDA Digital PCBeep as /devices/pci0000:00/0000:00:1b.0/input/input9


aplay -l
card 1: Intel [HDA Intel], device 0: AD198x Analog [AD198x Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: Intel [HDA Intel], device 1: AD198x Digital [AD198x Digital]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: Intel [HDA Intel], device 2: AD198x Headphone [AD198x Headphone]
  Subdevices: 1/1
  Subdevice #0: subdevice #0


echo "auto" > /sys/class/sound/hwC1D0/modelname
echo 1 > /sys/class/sound/hwC1D0/reconfig


aplay -l
card 1: Intel [HDA Intel], device 0: AD198x Analog [AD198x Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: Intel [HDA Intel], device 1: AD198x Digital [AD198x Digital]
  Subdevices: 1/1
  Subdevice #0: subdevice #0


echo "6stack-dig-fp" > /sys/class/sound/hwC1D0/modelname
echo 1 > /sys/class/sound/hwC1D0/reconfig

aplay -l
card 1: Intel [HDA Intel], device 0: AD198x Analog [AD198x Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: Intel [HDA Intel], device 1: AD198x Digital [AD198x Digital]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: Intel [HDA Intel], device 2: AD198x Headphone [AD198x Headphone]
  Subdevices: 1/1
  Subdevice #0: subdevice #0







ALSA hda_hwdep.c:220: hda-codec: reconfiguring
snd: bad kfree (called from f8be4636)
Pid: 8079, comm: bash Not tainted 2.6.27.41-170.2.117.fc10.i686 #1
 [<c06aa30b>] ? printk+0xf/0x14
 [<f895523e>] snd_hidden_kfree+0x2a/0x70 [snd]
 [<f8be4636>] ? snd_array_free+0xe/0x25 [snd_hda_codec]
 [<f8be4636>] snd_array_free+0xe/0x25 [snd_hda_codec]
 [<f8be807e>] snd_hda_ctls_clear+0x35/0x45 [snd_hda_codec]
 [<f8be8180>] snd_hda_codec_reset+0xf2/0x250 [snd_hda_codec]
 [<f8959ab8>] ? __snd_printk+0x33/0x3c [snd]
 [<f8bec681>] ? reconfig_store+0x0/0xab [snd_hda_codec]
 [<f8bec6bf>] reconfig_store+0x3e/0xab [snd_hda_codec]
 [<f8bec681>] ? reconfig_store+0x0/0xab [snd_hda_codec]
 [<c0594ee1>] dev_attr_store+0x1b/0x23
 [<c04ce68a>] sysfs_write_file+0xb4/0xdf
 [<c04ce5d6>] ? sysfs_write_file+0x0/0xdf
 [<c04932ee>] vfs_write+0x84/0xdf
 [<c04933e2>] sys_write+0x3b/0x60
 [<c0404c8a>] syscall_call+0x7/0xb
 =======================
snd: bad kfree (called from f8be4636)
Pid: 8079, comm: bash Not tainted 2.6.27.41-170.2.117.fc10.i686 #1
 [<c06aa30b>] ? printk+0xf/0x14
 [<f895523e>] snd_hidden_kfree+0x2a/0x70 [snd]
 [<f8be4636>] ? snd_array_free+0xe/0x25 [snd_hda_codec]
 [<f8be4636>] snd_array_free+0xe/0x25 [snd_hda_codec]
 [<f8be8089>] snd_hda_ctls_clear+0x40/0x45 [snd_hda_codec]
 [<f8be8180>] snd_hda_codec_reset+0xf2/0x250 [snd_hda_codec]
 [<f8959ab8>] ? __snd_printk+0x33/0x3c [snd]
 [<f8bec681>] ? reconfig_store+0x0/0xab [snd_hda_codec]
 [<f8bec6bf>] reconfig_store+0x3e/0xab [snd_hda_codec]
 [<f8bec681>] ? reconfig_store+0x0/0xab [snd_hda_codec]
 [<c0594ee1>] dev_attr_store+0x1b/0x23
 [<c04ce68a>] sysfs_write_file+0xb4/0xdf
 [<c04ce5d6>] ? sysfs_write_file+0x0/0xdf
 [<c04932ee>] vfs_write+0x84/0xdf
 [<c04933e2>] sys_write+0x3b/0x60
 [<c0404c8a>] syscall_call+0x7/0xb
 =======================
snd: bad kfree (called from f8be4636)
Pid: 8079, comm: bash Not tainted 2.6.27.41-170.2.117.fc10.i686 #1
 [<c06aa30b>] ? printk+0xf/0x14
 [<f895523e>] snd_hidden_kfree+0x2a/0x70 [snd]
 [<f8be4636>] ? snd_array_free+0xe/0x25 [snd_hda_codec]
 [<f8be4636>] snd_array_free+0xe/0x25 [snd_hda_codec]
 [<f8be81de>] snd_hda_codec_reset+0x150/0x250 [snd_hda_codec]
 [<f8959ab8>] ? __snd_printk+0x33/0x3c [snd]
 [<f8bec681>] ? reconfig_store+0x0/0xab [snd_hda_codec]
 [<f8bec6bf>] reconfig_store+0x3e/0xab [snd_hda_codec]
 [<f8bec681>] ? reconfig_store+0x0/0xab [snd_hda_codec]
 [<c0594ee1>] dev_attr_store+0x1b/0x23
 [<c04ce68a>] sysfs_write_file+0xb4/0xdf
 [<c04ce5d6>] ? sysfs_write_file+0x0/0xdf
 [<c04932ee>] vfs_write+0x84/0xdf
 [<c04933e2>] sys_write+0x3b/0x60
 [<c0404c8a>] syscall_call+0x7/0xb
 =======================
snd: bad kfree (called from f8be4636)
Pid: 8079, comm: bash Not tainted 2.6.27.41-170.2.117.fc10.i686 #1
 [<c06aa30b>] ? printk+0xf/0x14
 [<f895523e>] snd_hidden_kfree+0x2a/0x70 [snd]
 [<f8be4636>] ? snd_array_free+0xe/0x25 [snd_hda_codec]
 [<f8be4636>] snd_array_free+0xe/0x25 [snd_hda_codec]
 [<f8be81e9>] snd_hda_codec_reset+0x15b/0x250 [snd_hda_codec]
 [<f8959ab8>] ? __snd_printk+0x33/0x3c [snd]
 [<f8bec681>] ? reconfig_store+0x0/0xab [snd_hda_codec]
 [<f8bec6bf>] reconfig_store+0x3e/0xab [snd_hda_codec]
 [<f8bec681>] ? reconfig_store+0x0/0xab [snd_hda_codec]
 [<c0594ee1>] dev_attr_store+0x1b/0x23
 [<c04ce68a>] sysfs_write_file+0xb4/0xdf
 [<c04ce5d6>] ? sysfs_write_file+0x0/0xdf
 [<c04932ee>] vfs_write+0x84/0xdf
 [<c04933e2>] sys_write+0x3b/0x60
 [<c0404c8a>] syscall_call+0x7/0xb
 =======================
ALSA hda_codec.c:3961: hda_codec: model 'auto' is selected
ALSA hda_codec.c:4900: autoconfig: line_outs=4
(0x12/0x16/0x24/0x25/0x0) type:line
ALSA hda_codec.c:4904:    speaker_outs=0 (0x0/0x0/0x0/0x0/0x0)
ALSA hda_codec.c:4908:    hp_outs=1 (0x11/0x0/0x0/0x0/0x0)
ALSA hda_codec.c:4909:    mono: mono_out=0x0
ALSA hda_codec.c:4912:    dig-out=0x1b/0x0
ALSA hda_codec.c:4913:    inputs:<7>ALSA hda_codec.c:4917:  Front
Mic=0x14<7>ALSA hda_codec.c:4917:  Rear Mic=0x17<7>ALSA
hda_codec.c:4917:  Line=0x15<7>ALSA hda_codec.c:4917:  CD=0x18<7>ALSA
hda_codec.c:4919:
input: HDA Digital PCBeep as /devices/pci0000:00/0000:00:1b.0/input/input8
ALSA hda_codec.c:2370: Cannot find slave Mono Playback Volume, skipped
ALSA hda_codec.c:2370: Cannot find slave Speaker Playback Volume, skipped
ALSA hda_codec.c:2370: Cannot find slave Mono Playback Switch, skipped
ALSA hda_codec.c:2370: Cannot find slave Speaker Playback Switch, skipped
snd: bad kfree (called from f8be4636)
Pid: 8079, comm: bash Not tainted 2.6.27.41-170.2.117.fc10.i686 #1
 [<c06aa30b>] ? printk+0xf/0x14
 [<f895523e>] snd_hidden_kfree+0x2a/0x70 [snd]
 [<f8be4636>] ? snd_array_free+0xe/0x25 [snd_hda_codec]
 [<f8be4636>] snd_array_free+0xe/0x25 [snd_hda_codec]
 [<f8b79d29>] ad198x_free_kctls+0x37/0x3c [snd_hda_codec_analog]
 [<f8b7ad5a>] ad198x_build_controls+0x190/0x217 [snd_hda_codec_analog]
 [<f8be7481>] snd_hda_codec_build_controls+0x31/0x3d [snd_hda_codec]
 [<f8bec704>] reconfig_store+0x83/0xab [snd_hda_codec]
 [<f8bec681>] ? reconfig_store+0x0/0xab [snd_hda_codec]
 [<c0594ee1>] dev_attr_store+0x1b/0x23
 [<c04ce68a>] sysfs_write_file+0xb4/0xdf
 [<c04ce5d6>] ? sysfs_write_file+0x0/0xdf
 [<c04932ee>] vfs_write+0x84/0xdf
 [<c04933e2>] sys_write+0x3b/0x60
 [<c0404c8a>] syscall_call+0x7/0xb
 =======================



ALSA hda_hwdep.c:220: hda-codec: reconfiguring
snd: bad kfree (called from f8be4636)
Pid: 8201, comm: bash Not tainted 2.6.27.41-170.2.117.fc10.i686 #1
 [<c06aa30b>] ? printk+0xf/0x14
 [<f895523e>] snd_hidden_kfree+0x2a/0x70 [snd]
 [<f8be4636>] ? snd_array_free+0xe/0x25 [snd_hda_codec]
 [<f8be4636>] snd_array_free+0xe/0x25 [snd_hda_codec]
 [<f8be807e>] snd_hda_ctls_clear+0x35/0x45 [snd_hda_codec]
 [<f8be8180>] snd_hda_codec_reset+0xf2/0x250 [snd_hda_codec]
 [<f8959ab8>] ? __snd_printk+0x33/0x3c [snd]
 [<f8bec681>] ? reconfig_store+0x0/0xab [snd_hda_codec]
 [<f8bec6bf>] reconfig_store+0x3e/0xab [snd_hda_codec]
 [<f8bec681>] ? reconfig_store+0x0/0xab [snd_hda_codec]
 [<c0594ee1>] dev_attr_store+0x1b/0x23
 [<c04ce68a>] sysfs_write_file+0xb4/0xdf
 [<c04ce5d6>] ? sysfs_write_file+0x0/0xdf
 [<c04932ee>] vfs_write+0x84/0xdf
 [<c04933e2>] sys_write+0x3b/0x60
 [<c0404c8a>] syscall_call+0x7/0xb
 =======================
snd: bad kfree (called from f8be4636)
Pid: 8201, comm: bash Not tainted 2.6.27.41-170.2.117.fc10.i686 #1
 [<c06aa30b>] ? printk+0xf/0x14
 [<f895523e>] snd_hidden_kfree+0x2a/0x70 [snd]
 [<f8be4636>] ? snd_array_free+0xe/0x25 [snd_hda_codec]
 [<f8be4636>] snd_array_free+0xe/0x25 [snd_hda_codec]
 [<f8be8089>] snd_hda_ctls_clear+0x40/0x45 [snd_hda_codec]
 [<f8be8180>] snd_hda_codec_reset+0xf2/0x250 [snd_hda_codec]
 [<f8959ab8>] ? __snd_printk+0x33/0x3c [snd]
 [<f8bec681>] ? reconfig_store+0x0/0xab [snd_hda_codec]
 [<f8bec6bf>] reconfig_store+0x3e/0xab [snd_hda_codec]
 [<f8bec681>] ? reconfig_store+0x0/0xab [snd_hda_codec]
 [<c0594ee1>] dev_attr_store+0x1b/0x23
 [<c04ce68a>] sysfs_write_file+0xb4/0xdf
 [<c04ce5d6>] ? sysfs_write_file+0x0/0xdf
 [<c04932ee>] vfs_write+0x84/0xdf
 [<c04933e2>] sys_write+0x3b/0x60
 [<c0404c8a>] syscall_call+0x7/0xb
 =======================
snd: bad kfree (called from f8be4636)
Pid: 8201, comm: bash Not tainted 2.6.27.41-170.2.117.fc10.i686 #1
 [<c06aa30b>] ? printk+0xf/0x14
 [<f895523e>] snd_hidden_kfree+0x2a/0x70 [snd]
 [<f8be4636>] ? snd_array_free+0xe/0x25 [snd_hda_codec]
 [<f8be4636>] snd_array_free+0xe/0x25 [snd_hda_codec]
 [<f8be81de>] snd_hda_codec_reset+0x150/0x250 [snd_hda_codec]
 [<f8959ab8>] ? __snd_printk+0x33/0x3c [snd]
 [<f8bec681>] ? reconfig_store+0x0/0xab [snd_hda_codec]
 [<f8bec6bf>] reconfig_store+0x3e/0xab [snd_hda_codec]
 [<f8bec681>] ? reconfig_store+0x0/0xab [snd_hda_codec]
 [<c0594ee1>] dev_attr_store+0x1b/0x23
 [<c04ce68a>] sysfs_write_file+0xb4/0xdf
 [<c04ce5d6>] ? sysfs_write_file+0x0/0xdf
 [<c04932ee>] vfs_write+0x84/0xdf
 [<c04933e2>] sys_write+0x3b/0x60
 [<c0404c8a>] syscall_call+0x7/0xb
 =======================
snd: bad kfree (called from f8be4636)
Pid: 8201, comm: bash Not tainted 2.6.27.41-170.2.117.fc10.i686 #1
 [<c06aa30b>] ? printk+0xf/0x14
 [<f895523e>] snd_hidden_kfree+0x2a/0x70 [snd]
 [<f8be4636>] ? snd_array_free+0xe/0x25 [snd_hda_codec]
 [<f8be4636>] snd_array_free+0xe/0x25 [snd_hda_codec]
 [<f8be81e9>] snd_hda_codec_reset+0x15b/0x250 [snd_hda_codec]
 [<f8959ab8>] ? __snd_printk+0x33/0x3c [snd]
 [<f8bec681>] ? reconfig_store+0x0/0xab [snd_hda_codec]
 [<f8bec6bf>] reconfig_store+0x3e/0xab [snd_hda_codec]
 [<f8bec681>] ? reconfig_store+0x0/0xab [snd_hda_codec]
 [<c0594ee1>] dev_attr_store+0x1b/0x23
 [<c04ce68a>] sysfs_write_file+0xb4/0xdf
 [<c04ce5d6>] ? sysfs_write_file+0x0/0xdf
 [<c04932ee>] vfs_write+0x84/0xdf
 [<c04933e2>] sys_write+0x3b/0x60
 [<c0404c8a>] syscall_call+0x7/0xb
 =======================
ALSA hda_codec.c:3961: hda_codec: model '6stack-dig-fp' is selected
input: HDA Digital PCBeep as /devices/pci0000:00/0000:00:1b.0/input/input9

Re: snd_array_free - snd: bad kfree when HDA reconfig

From: Takashi Iwai <hidden>
Date: 2011-09-12 07:46:19

At Fri, 2 Sep 2011 15:16:28 +0800,
Raymond Yau wrote:
These errors "snd: bad kfree" occur when reconfig HDA from model
"6stack-dig-fp" to "auto" and vice versa
Doesn't this happen when you unload the device, right?
And, it happens when writing to /sys/class/sound/hwC0D0/clear?
Is "HD-Audio reconfiguration" still experimental ?
Somehow yet, but mostly it worked for me :)
BTW, it seem that HDA Digital PCBeep assigned to different input after
each reconfig

input: HDA Digital PCBeep as /devices/pci0000:00/0000:00:1b.0/input/input7
input: HDA Digital PCBeep as /devices/pci0000:00/0000:00:1b.0/input/input8
input: HDA Digital PCBeep as /devices/pci0000:00/0000:00:1b.0/input/input9
This is unavoidable, unfortunately.  It's the designed implementation
of input layer.
ALSA hda_hwdep.c:220: hda-codec: reconfiguring
snd: bad kfree (called from f8be4636)
Hmm, this is a magic check in external alsa-driver builds.
I guess it's just a bug there -- the override of krealloc() is
missing.

Does the patch below (to alsa-driver tree) fix the problem?


thanks,

Takashi

---
diff --git a/acore/memory_debug.c b/acore/memory_debug.c
index 4527378..0baf9b9 100644
--- a/acore/memory_debug.c
+++ b/acore/memory_debug.c
@@ -128,6 +128,21 @@ void snd_hidden_kfree(const void *obj)
 	snd_wrapper_kfree(obj);
 }
 
+size_t snd_hidden_ksize(const void *obj)
+{
+	struct snd_alloc_track *t;
+	if (!obj)
+		return 0;
+	t = snd_alloc_track_entry(obj);
+	if (t->magic != KMALLOC_MAGIC) {
+		printk(KERN_WARNING "snd: bad ksize (called from %p)\n",
+		       __builtin_return_address(0));
+		dump_stack();
+		return 0;
+	}
+	return t->size;
+}
+
 char *snd_hidden_kstrdup(const char *s, gfp_t gfp_flags)
 {
 	int len;
diff --git a/include/adriver.h b/include/adriver.h
index 1418a5e..fe70442 100644
--- a/include/adriver.h
+++ b/include/adriver.h
@@ -892,6 +892,7 @@ void *snd_hidden_kcalloc(size_t n, size_t size, gfp_t flags);
 char *snd_hidden_kstrdup(const char *s, gfp_t flags);
 char *snd_hidden_kstrndup(const char *s, size_t len, gfp_t flags);
 void snd_hidden_kfree(const void *obj);
+size_t snd_hidden_ksize(const void *obj);
 
 static inline void *snd_wrapper_kmalloc(size_t size, gfp_t flags)
 {
@@ -907,6 +908,7 @@ static inline void snd_wrapper_kfree(const void *obj)
 #define kcalloc(n, size, flags) snd_hidden_kcalloc(n, size, flags)
 #define kstrdup(s, flags)  snd_hidden_kstrdup(s, flags)
 #define kstrndup(s, len, flags)  snd_hidden_kstrndup(s, len, flags)
+#define ksize(obj) snd_hidden_ksize(obj)
 #define kfree(obj) snd_hidden_kfree(obj)
 
 #define kmalloc_nocheck(size, flags) snd_wrapper_kmalloc(size, flags)
@@ -2000,9 +2002,9 @@ static inline bool flush_delayed_work_sync(struct delayed_work *dwork)
 #endif
 
 /* krealloc() wrapper */
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0) && LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 22)
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0) && LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 22)) || defined(CONFIG_SND_DEBUG_MEMORY)
 #include <linux/slab.h>
-static inline void *krealloc(const void *p, size_t new_size, gfp_t flags)
+static inline void *snd_compat_krealloc(const void *p, size_t new_size, gfp_t flags)
 {
 	void *n;
 	if (!p)
@@ -2018,6 +2020,7 @@ static inline void *krealloc(const void *p, size_t new_size, gfp_t flags)
 	kfree(p);
 	return n;
 }
+#define krealloc(p, s, f)	snd_compat_krealloc(p, s, f)
 #endif
 
 #endif /* __SOUND_LOCAL_DRIVER_H */

Re: snd_array_free - snd: bad kfree when HDA reconfig

From: Raymond Yau <hidden>
Date: 2011-09-14 00:04:47

2011/9/12 Takashi Iwai [off-list ref]:
At Fri, 2 Sep 2011 15:16:28 +0800,
Raymond Yau wrote:
quoted
These errors "snd: bad kfree" occur when reconfig HDA from model
"6stack-dig-fp" to "auto" and vice versa
Doesn't this happen when you unload the device, right?
These errors "snd: bad kfree" also happen when unload and reload the driver

rmmod snd-hda-intel
insmod snd-hda-inteel

And, it happens when writing to /sys/class/sound/hwC0D0/clear?
quoted
Is "HD-Audio reconfiguration" still experimental ?
Somehow yet, but mostly it worked for me :)
I just use hda reconfig to change the model="auto" to "6stack-dig-fp"
and vice versa

This mean that I need to implement "Independent HP" switch which allow
user to change the topology if this feature is still experimental
quoted
ALSA hda_hwdep.c:220: hda-codec: reconfiguring
snd: bad kfree (called from f8be4636)
Hmm, this is a magic check in external alsa-driver builds.
I guess it's just a bug there -- the override of krealloc() is
missing.

Does the patch below (to alsa-driver tree) fix the problem?
Do I need to specify any option and run configure script again ?

alsa-driver compiled without error but fail to loaded and complain
ksize undefined symbol

Re: snd_array_free - snd: bad kfree when HDA reconfig

From: Takashi Iwai <hidden>
Date: 2011-09-14 06:02:37

At Wed, 14 Sep 2011 08:04:46 +0800,
Raymond Yau wrote:
2011/9/12 Takashi Iwai [off-list ref]:
quoted
At Fri, 2 Sep 2011 15:16:28 +0800,
Raymond Yau wrote:
quoted
These errors "snd: bad kfree" occur when reconfig HDA from model
"6stack-dig-fp" to "auto" and vice versa
Doesn't this happen when you unload the device, right?
These errors "snd: bad kfree" also happen when unload and reload the driver

rmmod snd-hda-intel
insmod snd-hda-inteel
OK, then it's just alsa-driver's debug stuff, no problem in the kernel
tree itself.
quoted
And, it happens when writing to /sys/class/sound/hwC0D0/clear?
quoted
Is "HD-Audio reconfiguration" still experimental ?
Somehow yet, but mostly it worked for me :)
I just use hda reconfig to change the model="auto" to "6stack-dig-fp"
and vice versa

This mean that I need to implement "Independent HP" switch which allow
user to change the topology if this feature is still experimental
The feature is anyway optional (i.e. not all users enable it).
quoted
quoted
ALSA hda_hwdep.c:220: hda-codec: reconfiguring
snd: bad kfree (called from f8be4636)
Hmm, this is a magic check in external alsa-driver builds.
I guess it's just a bug there -- the override of krealloc() is
missing.

Does the patch below (to alsa-driver tree) fix the problem?
Do I need to specify any option and run configure script again ?
No.
alsa-driver compiled without error but fail to loaded and complain
ksize undefined symbol
Try the patch below in addition to the previous one.


thanks,

Takashi

---
From: Takashi Iwai <redacted>
Subject: [PATCH] Add missing export of snd_hidden_ksize()

Also fix the ifdef of krealloc() wrapper for some corner cases.

Signed-off-by: Takashi Iwai <redacted>
---
 acore/sound.inc   |    1 +
 include/adriver.h |    3 ++-
 2 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/acore/sound.inc b/acore/sound.inc
index a79755e..2e63c98 100644
--- a/acore/sound.inc
+++ b/acore/sound.inc
@@ -3,6 +3,7 @@
 EXPORT_SYMBOL(snd_hidden_kmalloc);
 EXPORT_SYMBOL(snd_hidden_kzalloc);
 EXPORT_SYMBOL(snd_hidden_kcalloc);
+EXPORT_SYMBOL(snd_hidden_ksize);
 EXPORT_SYMBOL(snd_hidden_kfree);
 EXPORT_SYMBOL(snd_hidden_kstrdup);
 EXPORT_SYMBOL(snd_hidden_kstrndup);
diff --git a/include/adriver.h b/include/adriver.h
index fe70442..848bc17 100644
--- a/include/adriver.h
+++ b/include/adriver.h
@@ -2002,7 +2002,8 @@ static inline bool flush_delayed_work_sync(struct delayed_work *dwork)
 #endif
 
 /* krealloc() wrapper */
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0) && LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 22)) || defined(CONFIG_SND_DEBUG_MEMORY)
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0) && LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 22)) || \
+	(defined(CONFIG_SND_DEBUG_MEMORY) && !defined(SKIP_HIDDEN_MALLOCS))
 #include <linux/slab.h>
 static inline void *snd_compat_krealloc(const void *p, size_t new_size, gfp_t flags)
 {
-- 
1.7.6.1

Re: snd_array_free - snd: bad kfree when HDA reconfig

From: Raymond Yau <hidden>
Date: 2011-09-15 14:23:13

2011/9/14 Takashi Iwai [off-list ref]:
quoted hunk
Try the patch below in addition to the previous one.


thanks,

Takashi

---
From: Takashi Iwai <redacted>
Subject: [PATCH] Add missing export of snd_hidden_ksize()

Also fix the ifdef of krealloc() wrapper for some corner cases.

Signed-off-by: Takashi Iwai <redacted>
---
 acore/sound.inc   |    1 +
 include/adriver.h |    3 ++-
 2 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/acore/sound.inc b/acore/sound.inc
index a79755e..2e63c98 100644
--- a/acore/sound.inc
+++ b/acore/sound.inc
@@ -3,6 +3,7 @@
 EXPORT_SYMBOL(snd_hidden_kmalloc);
 EXPORT_SYMBOL(snd_hidden_kzalloc);
 EXPORT_SYMBOL(snd_hidden_kcalloc);
+EXPORT_SYMBOL(snd_hidden_ksize);
 EXPORT_SYMBOL(snd_hidden_kfree);
 EXPORT_SYMBOL(snd_hidden_kstrdup);
 EXPORT_SYMBOL(snd_hidden_kstrndup);
diff --git a/include/adriver.h b/include/adriver.h
index fe70442..848bc17 100644
--- a/include/adriver.h
+++ b/include/adriver.h
@@ -2002,7 +2002,8 @@ static inline bool flush_delayed_work_sync(struct delayed_work *dwork)
 #endif

 /* krealloc() wrapper */
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0) && LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 22)) || defined(CONFIG_SND_DEBUG_MEMORY)
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0) && LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 22)) || \
+       (defined(CONFIG_SND_DEBUG_MEMORY) && !defined(SKIP_HIDDEN_MALLOCS))
 #include <linux/slab.h>
 static inline void *snd_compat_krealloc(const void *p, size_t new_size, gfp_t flags)
 {
--
1.7.6.1
your patch fix the problem

BTW, there is some strange behaviour of the non-sticky pcm
implementation on ad1988

Refer to commit 0e7adbe263f89ea2ef15b5af5e80a812b2a85025

Disable sticky PCM stream assignment for AD codecs

why hda_codec_cleanup_stream is called twice  and this also occur with
capture and playback


ALSA hda_intel.c:1755: azx_pcm_prepare: bufsize=0x10000, format=0x4011
ALSA hda_codec.c:1408: hda_codec_setup_stream: NID=0x4, stream=0x5,
channel=0, format=0x4011
ALSA hda_codec.c:1408: hda_codec_setup_stream: NID=0x3, stream=0x5,
channel=0, format=0x4011
ALSA hda_codec.c:1408: hda_codec_setup_stream: NID=0x6, stream=0x5,
channel=0, format=0x4011
ALSA hda_codec.c:1408: hda_codec_setup_stream: NID=0x5, stream=0x5,
channel=0, format=0x4011
ALSA hda_codec.c:1408: hda_codec_setup_stream: NID=0xa, stream=0x5,
channel=0, format=0x4011
ALSA hda_codec.c:1471: hda_codec_cleanup_stream: NID=0x4
ALSA hda_codec.c:1471: hda_codec_cleanup_stream: NID=0x6
ALSA hda_codec.c:1471: hda_codec_cleanup_stream: NID=0x5
ALSA hda_codec.c:1471: hda_codec_cleanup_stream: NID=0xa
ALSA hda_codec.c:1471: hda_codec_cleanup_stream: NID=0x3
ALSA hda_codec.c:1471: hda_codec_cleanup_stream: NID=0x4
ALSA hda_codec.c:1471: hda_codec_cleanup_stream: NID=0x6
ALSA hda_codec.c:1471: hda_codec_cleanup_stream: NID=0x5
ALSA hda_codec.c:1471: hda_codec_cleanup_stream: NID=0xa
ALSA hda_codec.c:1471: hda_codec_cleanup_stream: NID=0x3



ALSA hda_intel.c:1755: azx_pcm_prepare: bufsize=0x10000, format=0x4011
ALSA hda_codec.c:1408: hda_codec_setup_stream: NID=0x8, stream=0x1,
channel=0, format=0x4011
ALSA hda_codec.c:1471: hda_codec_cleanup_stream: NID=0x8
ALSA hda_codec.c:1471: hda_codec_cleanup_stream: NID=0x8

Re: snd_array_free - snd: bad kfree when HDA reconfig

From: Takashi Iwai <hidden>
Date: 2011-09-15 14:30:54

At Thu, 15 Sep 2011 22:23:12 +0800,
Raymond Yau wrote:
2011/9/14 Takashi Iwai [off-list ref]:
quoted
Try the patch below in addition to the previous one.


thanks,

Takashi

---
From: Takashi Iwai <redacted>
Subject: [PATCH] Add missing export of snd_hidden_ksize()

Also fix the ifdef of krealloc() wrapper for some corner cases.

Signed-off-by: Takashi Iwai <redacted>
---
 acore/sound.inc   |    1 +
 include/adriver.h |    3 ++-
 2 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/acore/sound.inc b/acore/sound.inc
index a79755e..2e63c98 100644
--- a/acore/sound.inc
+++ b/acore/sound.inc
@@ -3,6 +3,7 @@
 EXPORT_SYMBOL(snd_hidden_kmalloc);
 EXPORT_SYMBOL(snd_hidden_kzalloc);
 EXPORT_SYMBOL(snd_hidden_kcalloc);
+EXPORT_SYMBOL(snd_hidden_ksize);
 EXPORT_SYMBOL(snd_hidden_kfree);
 EXPORT_SYMBOL(snd_hidden_kstrdup);
 EXPORT_SYMBOL(snd_hidden_kstrndup);
diff --git a/include/adriver.h b/include/adriver.h
index fe70442..848bc17 100644
--- a/include/adriver.h
+++ b/include/adriver.h
@@ -2002,7 +2002,8 @@ static inline bool flush_delayed_work_sync(struct delayed_work *dwork)
 #endif

 /* krealloc() wrapper */
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0) && LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 22)) || defined(CONFIG_SND_DEBUG_MEMORY)
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0) && LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 22)) || \
+       (defined(CONFIG_SND_DEBUG_MEMORY) && !defined(SKIP_HIDDEN_MALLOCS))
 #include <linux/slab.h>
 static inline void *snd_compat_krealloc(const void *p, size_t new_size, gfp_t flags)
 {
--
1.7.6.1
your patch fix the problem

BTW, there is some strange behaviour of the non-sticky pcm
implementation on ad1988

Refer to commit 0e7adbe263f89ea2ef15b5af5e80a812b2a85025

Disable sticky PCM stream assignment for AD codecs

why hda_codec_cleanup_stream is called twice  and this also occur with
capture and playback
Isn't it just the power-save?  The suspend calls
hda_cleanup_all_streams().

That is, the first call is the normal one, and it doesn't clean up the
stream actually because of stickiness.  The second call is the real
cleanup at power-saving.


Takashi
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help