Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp598045rwl; Thu, 5 Jan 2023 01:40:34 -0800 (PST) X-Google-Smtp-Source: AMrXdXtdVHkpZGirHkNzJ8494SolAduugTq/9BfnxzSf/+Muo5kNjpJPXllWt4OB6wHVsJEUDukm X-Received: by 2002:a17:906:c0ce:b0:7ad:d7a4:4346 with SMTP id bn14-20020a170906c0ce00b007add7a44346mr53175365ejb.66.1672911634774; Thu, 05 Jan 2023 01:40:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672911634; cv=none; d=google.com; s=arc-20160816; b=wWLGJGPUgKj/U2bWgFOK/JCujVLJFU7p6mW+fk5YXJN2OWTLrvlB7tSz1imeDN0qtY LE0MNrRp7Qh35/RNYMRugnMQJoSX/0qU3F7TP5QnJyAxFiQgCo3aa3K6LBKGD1fOnjG7 DNu4Mm0QQivGqlYoJUXAhRDmOGF8g4jccVMgQfKFDlcIp4v2pl47nt+BtS1J5FSWir4P +7kgzoXaEMt+kyDwip7fuPaWCTcH9Qhvcr1xERc1f47kMoiZbnhPvPB3+R84aOuHgA2b f6vnz6M3oouNUZKCYNYDBfXnvgls9RTSV3/tqM9RrZl0ju6ELJkiwF98F6VTqXcrMFRu e44Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:in-reply-to :subject:cc:to:from:message-id:date:dkim-signature:dkim-signature; bh=IHOYC6vfUa6VVFgCcPoqOyMNWdBh/humVgArq1I7u+A=; b=rDA82TnNVcSUo3ZO9iKPoNcWKv4nX/tKaPjw0eETwV0fYi8SATq0zqNIy790Q0ukxW +4DKd6wuQakJs5ZDHRGUn+Jsa3Q+wDmvVncyGeyhlPbpl9njPjef9YXPPndS74WOb7Gr cLznrVEmCuXSzFNJI4qYt0Y13XXcgbc3RZctu7u/pkxOfQMuD20mo/QUkOrATfrp3q6V k7RqdM0j8yyALl6VBfODO2s0oBE4ezUtQ2fwqSCZ0Ud0jlzJdHAPXnTGDl+Uur1OwRjh xZFvkp6cAd7JE+i7GcOb6yR9hWN0e6/cflAL1qF/9Mpzk3CimEKH0cwwg+vr8dpLyINk E6pA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=uCiWNYqL; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dp19-20020a170906c15300b0082033822e26si34009670ejc.487.2023.01.05.01.40.21; Thu, 05 Jan 2023 01:40:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=uCiWNYqL; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231261AbjAEIzJ (ORCPT + 55 others); Thu, 5 Jan 2023 03:55:09 -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 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 >