From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6F739177 for ; Sun, 8 Aug 2021 07:01:18 +0000 (UTC) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 718561FFA9; Sun, 8 Aug 2021 07:01:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1628406076; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Y5UpqnLRSiY0Moj3dbDfnxwe3jlYV3PbUnFP0GwyrTQ=; b=qEgIKjyXYF6QGoha7rkKCR+IRANTmbPGlkFFyG7Nf6rCQoPAtN9cWcMBuRQKUi2KNIl4sQ XfCbuqI167GFDIIeazBtWWgtcjmdHOwxVF2MtoeX768DlkNJFchaXq4hfGCFeMQuk7P/Id qQM5/lwA12DMUYlHMB6+AeoE1o/SJwM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1628406076; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Y5UpqnLRSiY0Moj3dbDfnxwe3jlYV3PbUnFP0GwyrTQ=; b=jsyvJN7fey1mzQjMrfh5PHVmvCZ5tJBSptfULwVepV1ij0OBFI/Jp2ngn/ubD75pGtJkCz n+g2EULDwITUp9CQ== Received: from alsa1.suse.de (alsa1.suse.de [10.160.4.42]) by relay2.suse.de (Postfix) with ESMTP id 5E0B7A3B81; Sun, 8 Aug 2021 07:01:16 +0000 (UTC) Date: Sun, 08 Aug 2021 09:01:16 +0200 Message-ID: From: Takashi Iwai To: Jeff Woods Cc: "Greg KH" , "alsa-devel" , "stable" , "regressions" Subject: Re: Kernel 5.13.6 breaks mmap with snd-hdsp module In-Reply-To: <17b22d08355.f21da1f938057.6900412371441404465@fnordco.com> References: <17b1f9647ee.1179b6a05461889.5940365952430364689@fnordco.com> <17b22d08355.f21da1f938057.6900412371441404465@fnordco.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/25.3 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) Precedence: bulk X-Mailing-List: regressions@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII On Sun, 08 Aug 2021 00:51:35 +0200, Jeff Woods wrote: > > ---- On Sat, 07 Aug 2021 02:26:32 -0700 Takashi Iwai wrote ---- > > On Sat, 07 Aug 2021 10:16:47 +0200, > > Greg KH wrote: > > > > > > On Sat, Aug 07, 2021 at 12:49:07AM -0700, Jeff Woods wrote: > > > > Specifically, commit c4824ae7db418aee6f50f308a20b832e58e997fd triggers the problem. Reverting this change restores functionality. > > > > > > > > The device is an RME Multiface II, using the snd-hdsp driver. > > > > > > > > Expected behavior: Device plays sound normally > > > > > > > > Exhibited behavior: When a program attempts to open the device, the following ALSA lib error happens: > > > > > > > > ALSA lib pcm_direct.c:1169:(snd1_pcm_direct_initialize_slave) slave plugin does not support mmap interleaved or mmap noninterleaved access > > > > > > > > This change hasn't affected my other computers with less esoteric hardware, so probably the problem lies with the snd-hdsp driver, but the device is unusable without reverting that commit. > > > > > > > > I am available to test any patches for this issue. > > > > > > Have you notified the developers involved in this change about this > > > issue? > > > > No, it's a new report :) > > > > > Adding them now... > > > > Could you try the patch below? > > > > > > thanks, > > > > Takashi > > > > -- 8< -- > > From: Takashi Iwai > > Subject: [PATCH] ALSA: pci: rme: Fix mmap breakage > > > > The recent change in the PCM core restricts the mmap of unknown buffer > > type, and this broke the mmap on RME9652 and HDSP drivers that didn't > > set up properly. Actually those driver do use the buffers allocated > > in a standard way, and the proper calls should fix the breakage. > > > > Fixes: c4824ae7db41 ("ALSA: pcm: Fix mmap capability check") > > Cc: > > Signed-off-by: Takashi Iwai > > --- > > sound/pci/rme9652/hdsp.c | 6 ++---- > > sound/pci/rme9652/rme9652.c | 6 ++---- > > 2 files changed, 4 insertions(+), 8 deletions(-) > > > > diff --git a/sound/pci/rme9652/hdsp.c b/sound/pci/rme9652/hdsp.c > > index 8457a4bbc3df..b32a72e28917 100644 > > --- a/sound/pci/rme9652/hdsp.c > > +++ b/sound/pci/rme9652/hdsp.c > > @@ -4518,8 +4518,7 @@ static int snd_hdsp_playback_open(struct snd_pcm_substream *substream) > > snd_pcm_set_sync(substream); > > > > runtime->hw = snd_hdsp_playback_subinfo; > > - runtime->dma_area = hdsp->playback_buffer; > > - runtime->dma_bytes = HDSP_DMA_AREA_BYTES; > > + snd_pcm_set_runtime_buffer(substream, hdsp->playback_dma_buf); > > > > hdsp->playback_pid = current->pid; > > hdsp->playback_substream = substream; > > @@ -4595,8 +4594,7 @@ static int snd_hdsp_capture_open(struct snd_pcm_substream *substream) > > snd_pcm_set_sync(substream); > > > > runtime->hw = snd_hdsp_capture_subinfo; > > - runtime->dma_area = hdsp->capture_buffer; > > - runtime->dma_bytes = HDSP_DMA_AREA_BYTES; > > + snd_pcm_set_runtime_buffer(substream, hdsp->capture_dma_buf); > > > > hdsp->capture_pid = current->pid; > > hdsp->capture_substream = substream; > > diff --git a/sound/pci/rme9652/rme9652.c b/sound/pci/rme9652/rme9652.c > > index f1aad38760d6..8036ed761d53 100644 > > --- a/sound/pci/rme9652/rme9652.c > > +++ b/sound/pci/rme9652/rme9652.c > > @@ -2279,8 +2279,7 @@ static int snd_rme9652_playback_open(struct snd_pcm_substream *substream) > > snd_pcm_set_sync(substream); > > > > runtime->hw = snd_rme9652_playback_subinfo; > > - runtime->dma_area = rme9652->playback_buffer; > > - runtime->dma_bytes = RME9652_DMA_AREA_BYTES; > > + snd_pcm_set_runtime_buffer(substream, rme9652->playback_dma_buf); > > > > if (rme9652->capture_substream == NULL) { > > rme9652_stop(rme9652); > > @@ -2339,8 +2338,7 @@ static int snd_rme9652_capture_open(struct snd_pcm_substream *substream) > > snd_pcm_set_sync(substream); > > > > runtime->hw = snd_rme9652_capture_subinfo; > > - runtime->dma_area = rme9652->capture_buffer; > > - runtime->dma_bytes = RME9652_DMA_AREA_BYTES; > > + snd_pcm_set_runtime_buffer(substream, rme9652->capture_dma_buf); > > > > if (rme9652->playback_substream == NULL) { > > rme9652_stop(rme9652); > > -- > > 2.26.2 > > > > I applied the patch to kernel 5.13.8, but compilation fails with these errors: Oops, sorry, that was the patch for linux-next, and I forgot the recent code change. And it turned out not to be effective. Below is another try. Scratch the previous one (although it cannot hurt), and try this one instead. thanks, Takashi -- 8< -- From: Takashi Iwai Subject: [PATCH] ALSA: pcm: Fix mmap breakage without explicit buffer setup The recent fix c4824ae7db41 ("ALSA: pcm: Fix mmap capability check") restricts the mmap capability only to the drivers that properly set up the buffers, but it caused a regression for a few drivers that manage the buffer on its own way. For those with UNKNOWN buffer type (i.e. the uninitialized / unused substream->dma_buffer), just assume that the driver handles the mmap properly and blindly trust the hardware info bit. Fixes: c4824ae7db41 ("ALSA: pcm: Fix mmap capability check") Cc: Signed-off-by: Takashi Iwai --- sound/core/pcm_native.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c index 09c0e2a6489c..71323d807dbf 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c @@ -251,7 +251,10 @@ static bool hw_support_mmap(struct snd_pcm_substream *substream) switch (substream->dma_buffer.dev.type) { case SNDRV_DMA_TYPE_UNKNOWN: - return false; + /* we can't know the device, so just assume that the driver does + * everything right + */ + return true; case SNDRV_DMA_TYPE_CONTINUOUS: case SNDRV_DMA_TYPE_VMALLOC: return true; -- 2.26.2