Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp5526602rwb; Tue, 22 Nov 2022 00:58:14 -0800 (PST) X-Google-Smtp-Source: AA0mqf60yCU7zgNTOHOeEVAjo5/Y1yANZeRMErJ6HftHUTSBg0zN7nb4PQHIhJedEV8HA0oFUzqh X-Received: by 2002:a17:906:3708:b0:7ad:93df:db1e with SMTP id d8-20020a170906370800b007ad93dfdb1emr5199540ejc.445.1669107494346; Tue, 22 Nov 2022 00:58:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669107494; cv=none; d=google.com; s=arc-20160816; b=fmP/n+1dSn7/hND44rmEwVNdk+J8JtuXPPlCygmfjfdumqcCXYk6SlmOL47kuxb7Oq nzInINqXjocHPBvnLgz27qOz4Cix5IBtnMjEfhgWrpgqDDTSxgo2Cun0fx+dWKxil63b ZDAvCFRtoIMGglhy07/cljs35hWKK18yGmBzjTHWtGwBMQz8CazgWUYPJ66+RfcyDejA tbsiDLPBAjYGC8pmq8KN54yKZi9hyoJq5UhxrkuF5V6iY/fvnxIVlmXoSDAnnXts3hSw e3OhBQdC0V9s3hRk1LArvjYBU5+NDI0tgMp2m4Q+aY6j4PJiDOOehdNDsFuVfMNI6mpx HVpw== 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=dXel8N1xdWLbkJWBa3cPHmwpPDZdmAoVd+uJGgsXh4A=; b=cIJRYD4XogM9ZgeZZh1nihRomHqD2hRyJxGz0NpEawZGdJ52SaBH4SLAc5Cnz4fMzW gpA+CdCAGnZxRykKzF2KfLQHDzEqkEt+MBGRY4u+kI6/iaaIjaYqLcfN3wmEwSBAdp3+ zifzonZF0UefCj+CkRnFAbYalai7YFxIzyLbxnNpcy+xKXU3W89sJZ+QElAn1vB/9rmf 8ZZPfpZzzE8AkN43JVdCdcj8ZQ5JDdGdU3VHK4hvXcsUAr/bkB/fS/PhCxc1h9mDUZj5 gaOQaYeq743PC2zxWKMb8JQTE2b7FXN7Sx02JGd/5i9zoMnpmcKVVCVt2buYIkjIyVmC iEtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=XeVfiBP9; dkim=neutral (no key) header.i=@suse.de header.b="hB/jCjDJ"; 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 e13-20020a17090658cd00b007ae43ee86aesi12728775ejs.69.2022.11.22.00.57.51; Tue, 22 Nov 2022 00:58:14 -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=XeVfiBP9; dkim=neutral (no key) header.i=@suse.de header.b="hB/jCjDJ"; 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 S232353AbiKVIqZ (ORCPT + 92 others); Tue, 22 Nov 2022 03:46:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230284AbiKVIqX (ORCPT ); Tue, 22 Nov 2022 03:46:23 -0500 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1CA6F28E37 for ; Tue, 22 Nov 2022 00:46:22 -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 BF2331F86C; Tue, 22 Nov 2022 08:46:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1669106780; 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=dXel8N1xdWLbkJWBa3cPHmwpPDZdmAoVd+uJGgsXh4A=; b=XeVfiBP9oK2YcOJON2fbP20TLQCkdS1CpOlcmLSDbN+w8OK3PvZSauF9KZTVYqxemH2xI+ n/Tl0WUAN1Sq1ifXz6rQjj2uWlhEEjiJo2H9v+QnEfUVafoV5EgosHU5GbC1LeJPjSyfEX aOomPsUzHypUqpuj0hpb2ucRAdFXF6k= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1669106780; 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=dXel8N1xdWLbkJWBa3cPHmwpPDZdmAoVd+uJGgsXh4A=; b=hB/jCjDJEXLoJ1JadX6vM2lN/Kb+ltO0/n2a70XTNU1meIXRXp/n/LU7X6S5jAdebFtwUp IXr9wLlR/JN7yODw== 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 9929113B01; Tue, 22 Nov 2022 08:46:20 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id iefMJFyMfGNHJAAAMHmgww (envelope-from ); Tue, 22 Nov 2022 08:46:20 +0000 Date: Tue, 22 Nov 2022 09:46:20 +0100 Message-ID: <87tu2rv0kj.wl-tiwai@suse.de> From: Takashi Iwai To: Michael Wu Cc: perex@perex.cz, tiwai@suse.com, aichao@kylinos.cn, wanjiabing@vivo.com, ubizjak@gmail.com, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] ALSA: usb-audio: fix urb timeout with URB_ISO_ASAP flag In-Reply-To: <20221122082040.48591-1-michael@allwinnertech.com> References: <20221122082040.48591-1-michael@allwinnertech.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 Tue, 22 Nov 2022 09:20:40 +0100, Michael Wu wrote: > > When the loglevel is greater than 4, with a long messages printed on the > console while playing or recording audios, the usb controller may become > abnormal. > `usb 1-2: timeout: still 1 active urbs on EP #1` > > Fix it by configuring the transfer_flags URB_ISO_ASAP flag. > > Signed-off-by: Michael Wu Hrm, that's somewhat backward action to the change we've done years ago, commit c75c5ab575af7db707689cdbb5a5c458e9a034bb: ALSA: USB: adjust for changed 3.8 USB API The recent changes in the USB API ("implement new semantics for URB_ISO_ASAP") made the former meaning of the URB_ISO_ASAP flag the default, and changed this flag to mean that URBs can be delayed. This is not the behaviour wanted by any of the audio drivers because it leads to discontinuous playback with very small period sizes. Therefore, our URBs need to be submitted without this flag. I rather suspect that your problem is in the USB controller side. thanks, Takashi > --- > sound/usb/endpoint.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c > index 310cd6fb0038..df9a91c2fc7d 100644 > --- a/sound/usb/endpoint.c > +++ b/sound/usb/endpoint.c > @@ -1245,7 +1245,7 @@ static int data_ep_set_params(struct snd_usb_endpoint *ep) > if (!u->urb->transfer_buffer) > goto out_of_memory; > u->urb->pipe = ep->pipe; > - u->urb->transfer_flags = URB_NO_TRANSFER_DMA_MAP; > + u->urb->transfer_flags = URB_ISO_ASAP | URB_NO_TRANSFER_DMA_MAP; > u->urb->interval = 1 << ep->datainterval; > u->urb->context = u; > u->urb->complete = snd_complete_urb; > @@ -1288,7 +1288,7 @@ static int sync_ep_set_params(struct snd_usb_endpoint *ep) > u->urb->transfer_dma = ep->sync_dma + i * 4; > u->urb->transfer_buffer_length = 4; > u->urb->pipe = ep->pipe; > - u->urb->transfer_flags = URB_NO_TRANSFER_DMA_MAP; > + u->urb->transfer_flags = URB_ISO_ASAP | URB_NO_TRANSFER_DMA_MAP; > u->urb->number_of_packets = 1; > u->urb->interval = 1 << ep->syncinterval; > u->urb->context = u; > -- > 2.29.0 >