From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F2AFFC433FE for ; Sat, 12 Nov 2022 08:48:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233225AbiKLIqw (ORCPT ); Sat, 12 Nov 2022 03:46:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230257AbiKLIqr (ORCPT ); Sat, 12 Nov 2022 03:46:47 -0500 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4644C2CE3F for ; Sat, 12 Nov 2022 00:46:45 -0800 (PST) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id D8D4022310; Sat, 12 Nov 2022 08:46:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1668242803; 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=xMQY17H7BFjnZoOCg94vz2f65Z/QFPDjM6eSMtYUsG4=; b=GKRHAElIgeK94yqtYmWY6MjQsUfYYZ2Pqe4EqeZH40pjA34oVePTRuXJLt3uwhe1JfJDV1 /0YA998hgmw98dTzg4Yw0AMGgCLKvYtelTEhTIQ52Dgw7lzI05dI7aSicqyDK/gACjssva iykTlN5DFBBKv4j39BBVBTBeVGDCuAU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1668242803; 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=xMQY17H7BFjnZoOCg94vz2f65Z/QFPDjM6eSMtYUsG4=; b=4PZ0XTMz2JdKxATjIqvUt3u59Cu1eSKXyNLHPeUE8BFpZFN1ouYZLYShEdo+sZDbQwIjdL 4o1oSr0fGNCnlMCA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id B90EB13A08; Sat, 12 Nov 2022 08:46:43 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id eiAvLHNdb2M3IAAAMHmgww (envelope-from ); Sat, 12 Nov 2022 08:46:43 +0000 Date: Sat, 12 Nov 2022 09:46:43 +0100 Message-ID: <87a64w7e6k.wl-tiwai@suse.de> From: Takashi Iwai To: Linus Torvalds Cc: Linux Kernel Mailing List Subject: Re: [GIT PULL] sound fixes for 6.1-rc5 In-Reply-To: References: <87fsepx42m.wl-tiwai@suse.de> User-Agent: Wanderlust/2.15.9 (Almost Unreal) Emacs/27.2 Mule/6.0 MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 12 Nov 2022 02:28:19 +0100, Linus Torvalds wrote: > > On Fri, Nov 11, 2022 at 12:56 AM Takashi Iwai wrote: > > > > please pull sound fixes for v6.1-rc5 from: > > Hmm. I don't know that this came in through this particular pull > request, but I don't seem to have seen it before: > > Nov 11 14:32:37 xps13 kernel: > snd_hda_intel 0000:00:1f.3: Too many BDL entries: > buffer=2097152, period=65536 > > there's six of those lines in my logs (two batches of three, five > seconds apart). > > I don't see any negative side effects aside from the messages, and > sound seems to work fine, but since I don't think I've ever seen this > one before I thought I'd just mention it. > > I also haven't been using this laptop on a while - an arm64 Fedora > uboot update broke my M2 boot, so I'm temporarily back to using my > trusty old xps13. > > So while it's new to me, the issue that introduced it may not be > particularly new. > > Google does show that the message itself has been happening for others > for a long time. But I checked with 'journalctl', and it hasn't > happened on this particular machine before. > > It might be a non-kernel change that triggers it, of course. Wooh, that must be the last change in the memalloc helper for non-contiguous pages :-< Admittedly the fix was a bit premature, sorry for the mess. Below is the quick workaround. I'm going to send another PR soon later. thanks, Takashi -- 8< -- From: Takashi Iwai Subject: [PATCH] ALSA: memalloc: Try dma_alloc_noncontiguous() at first The latest fix for the non-contiguous memalloc helper changed the allocation method for a non-IOMMU system to use only the fallback allocator. This should have worked, but it caused a problem sometimes when too many non-contiguous pages are allocated that can't be treated by HD-audio controller. As a quirk workaround, go back to the original strategy: use dma_alloc_noncontiguous() at first, and apply the fallback only when it fails, but only for non-IOMMU case. We'll need a better fix in the fallback code as well, but this workaround should paper over most cases. Fixes: 9736a325137b ("ALSA: memalloc: Don't fall back for SG-buffer with IOMMU") Reported-by: Linus Torvalds Link: https://lore.kernel.org/r/CAHk-=wgSH5ubdvt76gNwa004ooZAEJL_1Q-Fyw5M2FDdqL==dg@mail.gmail.com Signed-off-by: Takashi Iwai --- sound/core/memalloc.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/sound/core/memalloc.c b/sound/core/memalloc.c index 6a81aaab25ab..ba095558b6d1 100644 --- a/sound/core/memalloc.c +++ b/sound/core/memalloc.c @@ -542,8 +542,10 @@ static void *snd_dma_noncontig_alloc(struct snd_dma_buffer *dmab, size_t size) struct sg_table *sgt; void *p; + sgt = dma_alloc_noncontiguous(dmab->dev.dev, size, dmab->dev.dir, + DEFAULT_GFP, 0); #ifdef CONFIG_SND_DMA_SGBUF - if (!get_dma_ops(dmab->dev.dev)) { + if (!sgt && !get_dma_ops(dmab->dev.dev)) { if (dmab->dev.type == SNDRV_DMA_TYPE_DEV_WC_SG) dmab->dev.type = SNDRV_DMA_TYPE_DEV_WC_SG_FALLBACK; else @@ -551,9 +553,6 @@ static void *snd_dma_noncontig_alloc(struct snd_dma_buffer *dmab, size_t size) return snd_dma_sg_fallback_alloc(dmab, size); } #endif - - sgt = dma_alloc_noncontiguous(dmab->dev.dev, size, dmab->dev.dir, - DEFAULT_GFP, 0); if (!sgt) return NULL; -- 2.35.3