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 5B96CC3DA7D for ; Thu, 5 Jan 2023 08:55:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231347AbjAEIzK (ORCPT ); Thu, 5 Jan 2023 03:55:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230292AbjAEIzH (ORCPT ); Thu, 5 Jan 2023 03:55:07 -0500 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5628837274 for ; Thu, 5 Jan 2023 00:55:06 -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-out2.suse.de (Postfix) with ESMTPS id 3888623071; Thu, 5 Jan 2023 08:55:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1672908904; 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=IHOYC6vfUa6VVFgCcPoqOyMNWdBh/humVgArq1I7u+A=; b=uCiWNYqLGWlCrP4+sxvzylCpKldvKj02X/dPIZ/LiBQgA1w6rsuZxTcNAgN0A39Zxrd1O/ WqEbr3aDmlfn+lcVFWWwmw1Nq0n6RFGVKJer+nMv5+eWW/8u1/ORb7zrh90efyz9k/IcJe EHtvWcyApVkMjJAA3WkvNhRIzvcqIbs= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1672908904; 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=IHOYC6vfUa6VVFgCcPoqOyMNWdBh/humVgArq1I7u+A=; b=6/bNP8g/DknzW+F86MsMEJ9LltOtvCIBf93a68f0ZF8SqXHxKk8kRGQot8mDBhlERErfwB kFnjvLITCP8cXvCA== 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 0C8A613273; Thu, 5 Jan 2023 08:55:04 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id NgZ3AmiQtmNpKAAAMHmgww (envelope-from ); Thu, 05 Jan 2023 08:55:04 +0000 Date: Thu, 05 Jan 2023 09:55:03 +0100 Message-ID: <877cy1mkd4.wl-tiwai@suse.de> From: Takashi Iwai To: Ben Carter Cc: Jaroslav Kysela , Takashi Iwai , Cezary Rojewski , Amadeusz =?ISO-8859-2?Q?S=B3awi=F1s?= =?ISO-8859-2?Q?ki?= , Mark Brown , Divya Prakash , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] sound: hda: increase timeouts to stop crash on resume with ALC3204 and others In-Reply-To: <20230104221024.23524-1-craterrender@gmail.com> References: <20230104221024.23524-1-craterrender@gmail.com> 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 Wed, 04 Jan 2023 23:10:24 +0100, Ben Carter wrote: > > Upon waking after system suspend, ALSA often crashed with: > snd_hda_intel 0000:00:1f.3: CORB reset timeout#2, CORBRP = 65535 > snd_hda_codec_hdmi hdaudioC1D2: Unable to sync register 0x2f8100. -5 > snd_hda_codec_realtek hdaudioC1D0: Unable to sync register 0x2b8000. -5 > A temporary fix was established by reloading snd_hda_intel, but increasing > the rather strict timeout of 1ms to 100ms has remedied the issue on my > device. Although this is a much larger delay, most hardware took less than > 1ms anyway and it's preferable to the whole audio system crashing. 100ms is way too long for an atomic context. How long it took in reality? If we extend to 100ms, the loop should be outside the spinlock. Maybe it's worth to rewrite with the standard iopoll helper, too. thanks, Takashi > > Signed-off-by: Ben Carter > --- > sound/hda/hdac_controller.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/sound/hda/hdac_controller.c b/sound/hda/hdac_controller.c > index 3c7af6558249..1ab573248452 100644 > --- a/sound/hda/hdac_controller.c > +++ b/sound/hda/hdac_controller.c > @@ -16,7 +16,7 @@ static void azx_clear_corbrp(struct hdac_bus *bus) > { > int timeout; > > - for (timeout = 1000; timeout > 0; timeout--) { > + for (timeout = 100000; timeout > 0; timeout--) { > if (snd_hdac_chip_readw(bus, CORBRP) & AZX_CORBRP_RST) > break; > udelay(1); > @@ -26,7 +26,7 @@ static void azx_clear_corbrp(struct hdac_bus *bus) > snd_hdac_chip_readw(bus, CORBRP)); > > snd_hdac_chip_writew(bus, CORBRP, 0); > - for (timeout = 1000; timeout > 0; timeout--) { > + for (timeout = 100000; timeout > 0; timeout--) { > if (snd_hdac_chip_readw(bus, CORBRP) == 0) > break; > udelay(1); > -- > 2.39.0 >