diff mbox series

[2/3] ALSA: hda: Change AZX_MAX_BUF_SIZE from 1GB to 4MB

Message ID 20210318151122.2493096-3-amadeuszx.slawinski@linux.intel.com (mailing list archive)
State Superseded
Headers show
Series Fix SND_HDA_PREALLOC issue | expand

Commit Message

Amadeusz Sławiński March 18, 2021, 3:11 p.m. UTC
When SND_HDA_PREALLOC_SIZE is set to 0, applications can request as much
memory as there is allowed. With value of AZX_MAX_BUF_SIZE it is 1GB per
stream, which is not realistic use case. Change it 4MB.

Bug: https://bugzilla.kernel.org/show_bug.cgi?id=201251#c322
Suggested-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
---
 include/sound/hda_register.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Takashi Iwai March 18, 2021, 3:25 p.m. UTC | #1
On Thu, 18 Mar 2021 16:11:21 +0100,
Amadeusz Sławiński wrote:
> 
> When SND_HDA_PREALLOC_SIZE is set to 0, applications can request as much
> memory as there is allowed. With value of AZX_MAX_BUF_SIZE it is 1GB per
> stream, which is not realistic use case. Change it 4MB.
> 
> Bug: https://bugzilla.kernel.org/show_bug.cgi?id=201251#c322
> Suggested-by: Takashi Iwai <tiwai@suse.de>
> Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
> ---
>  include/sound/hda_register.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/include/sound/hda_register.h b/include/sound/hda_register.h
> index 4f987b1f32f7..68d420f3c49d 100644
> --- a/include/sound/hda_register.h
> +++ b/include/sound/hda_register.h
> @@ -140,8 +140,8 @@ enum { SDI0, SDI1, SDI2, SDI3, SDO0, SDO1, SDO2, SDO3 };
>  #define BDL_SIZE		4096
>  #define AZX_MAX_BDL_ENTRIES	(BDL_SIZE / 16)
>  #define AZX_MAX_FRAG		32
> -/* max buffer size - no h/w limit, you can increase as you like */
> -#define AZX_MAX_BUF_SIZE	(1024*1024*1024)
> +/* max buffer size - 4MB limit per stream */
> +#define AZX_MAX_BUF_SIZE	(4*1024*1024)

This deserves for a comment that it's an artificial limit just for
avoiding a pitfall.


thanks,

Takashi
diff mbox series

Patch

diff --git a/include/sound/hda_register.h b/include/sound/hda_register.h
index 4f987b1f32f7..68d420f3c49d 100644
--- a/include/sound/hda_register.h
+++ b/include/sound/hda_register.h
@@ -140,8 +140,8 @@  enum { SDI0, SDI1, SDI2, SDI3, SDO0, SDO1, SDO2, SDO3 };
 #define BDL_SIZE		4096
 #define AZX_MAX_BDL_ENTRIES	(BDL_SIZE / 16)
 #define AZX_MAX_FRAG		32
-/* max buffer size - no h/w limit, you can increase as you like */
-#define AZX_MAX_BUF_SIZE	(1024*1024*1024)
+/* max buffer size - 4MB limit per stream */
+#define AZX_MAX_BUF_SIZE	(4*1024*1024)
 
 /* RIRB int mask: overrun[2], response[0] */
 #define RIRB_INT_RESPONSE	0x01