Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp3467307rdg; Tue, 17 Oct 2023 16:24:25 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFGOuHYdGP3+rS/L+AVn5yqqtGqu+t7N1xW68mRxMJaW/rtkItitbzmArMzAFa18qrZC6OW X-Received: by 2002:a92:d709:0:b0:357:549f:eca2 with SMTP id m9-20020a92d709000000b00357549feca2mr3655456iln.5.1697585064736; Tue, 17 Oct 2023 16:24:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697585064; cv=none; d=google.com; s=arc-20160816; b=oOnpdB3v2N4Q+CDGGYnU94p5gVIs8AT0emYWfoEPeL/WddTC4aByNTA2dYtNlt7Rwx 5/SBwqhFlz7nlO7eUlRXwS5/Y7awWGEirDHgKvdjp9snzVL0Mcy0AGegx0x1H9m84ehV Y1sY4fTOTH39PCBjIc6pkID+9+/G1KZKVg3X24cQ6EsapodFfhcDGHumOPsvXg3XvhP8 y4sPeGFlpXDZk1inItxGLerRVkNVUtqHCw1m5p1N42zbmcdxkdYxCJnPFqLiL41MgnnO 6Z3jX+Vg6IAKMzZklPxAGt10HKLaa3GFcRt/RY0zszau/JgGzTAw38dFQFHmwcFqiizZ 2niQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=BAjOuc7YTNbTFfhmlr+O2TqAzj5KAKyFGh3Xq5L6aPc=; fh=T2kIl/luTXifFXsTyrv3SMMIMK/cqEF9ESJJzecA3Cs=; b=EqHuxBcaX7oEzAyQSo09olhF21oGJU5YvOlq7Sl8jgjwE8o2NEpvLAxmObcOnnKcDR TCpPUnfmHDNnRwkDdBBTIXvITbeNk6vaur3lCd2kzvQ/QzuUNG5RWx8tzvey/6x2onPe 9H8uXq1KRZOdCKVqXwUVMS3npbOfNhNFiyLRzixULBPmSSLw8fJuJHGimbzv8xuw5O3H 7ACQnFWlO5N9+XXrXEmkZQnPxdiAMvS97fu/7UkFirH0c8GKNBg2Ivs48plMLdB6fI4b Y/OryQdHy7bgxOzVvU2MydB/RplGRaBvOv0Vy4JD5iRWI2Er+BJyJebnfRGzEIvlWLPb BUOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=dwiBqsLe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id n126-20020a632784000000b00578fe1bdfcasi858623pgn.860.2023.10.17.16.24.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Oct 2023 16:24:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=dwiBqsLe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 2908680E708D; Tue, 17 Oct 2023 16:24:22 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343819AbjJQXYM (ORCPT + 99 others); Tue, 17 Oct 2023 19:24:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55660 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344466AbjJQXXo (ORCPT ); Tue, 17 Oct 2023 19:23:44 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F1A5C134; Tue, 17 Oct 2023 16:23:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697585013; x=1729121013; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=xwQ0iV/rBOQYg8kGL3cqHi/fxn3tom61XgY6fDIexWM=; b=dwiBqsLe6z+g5ULiSf7+jnbg8yc92HCSZXMa7pkVZS4kmqGB5cook92D V4dxiAwQTeP0ZfqMSuXOuc2uV8OoPaotnPrLCl9OfvdCWtB72jDOcfS3T zy0X7tnD6SS63jHsgSd1nBvLfB9S2fcPrfJBZA1TLjVEzU3WJqSqm47GI htrZDnr6IexVAGwZDBKmB5IArS17u+g9U9tc52MdqFQD0mkIIUUva5Vl4 a9lB7FFBAtEHF/zADTPqNuQXIel8DNNkcz5S9hstWrLzkKsW6hslz8Eu8 0Qxl4uCpjxOaLwEPoDITfpiwFPj49bwY9ii5uvZcJBTk0t6clE+yC+5YL w==; X-IronPort-AV: E=McAfee;i="6600,9927,10866"; a="384778247" X-IronPort-AV: E=Sophos;i="6.03,233,1694761200"; d="scan'208";a="384778247" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Oct 2023 16:23:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10866"; a="826637527" X-IronPort-AV: E=Sophos;i="6.03,233,1694761200"; d="scan'208";a="826637527" Received: from asprado-mobl2.amr.corp.intel.com (HELO [10.212.55.179]) ([10.212.55.179]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Oct 2023 16:23:31 -0700 Message-ID: Date: Tue, 17 Oct 2023 18:11:57 -0500 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v9 34/34] ASoC: usb: Rediscover USB SND devices on USB port add Content-Language: en-US To: Wesley Cheng , mathias.nyman@intel.com, gregkh@linuxfoundation.org, lgirdwood@gmail.com, broonie@kernel.org, perex@perex.cz, tiwai@suse.com, agross@kernel.org, andersson@kernel.org, konrad.dybcio@linaro.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, srinivas.kandagatla@linaro.org, bgoswami@quicinc.com, Thinh.Nguyen@synopsys.com Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org References: <20231017200109.11407-1-quic_wcheng@quicinc.com> <20231017200109.11407-35-quic_wcheng@quicinc.com> From: Pierre-Louis Bossart In-Reply-To: <20231017200109.11407-35-quic_wcheng@quicinc.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Tue, 17 Oct 2023 16:24:22 -0700 (PDT) On 10/17/23 15:01, Wesley Cheng wrote: > In case the USB backend device has not been initialized/probed, USB SND > device connections can still occur. When the USB backend is eventually > made available, previous USB SND device connections are not communicated to > the USB backend. Call snd_usb_rediscover_devices() to generate the connect > callbacks for all USB SND devices connected. This will allow for the USB > backend to be updated with the current set of devices available. > > The chip array entries are all populated and removed while under the > register_mutex, so going over potential race conditions: > > Thread#1: > q6usb_component_probe() > --> snd_soc_usb_add_port() > --> snd_usb_rediscover_devices() > --> mutex_lock(register_mutex) > > Thread#2 > --> usb_audio_disconnect() > --> mutex_lock(register_mutex) > > So either thread#1 or thread#2 will complete first. If > > Thread#1 completes before thread#2: > SOC USB will notify DPCM backend of the device connection. Shortly > after, once thread#2 runs, we will get a disconnect event for the > connected device. > > Thread#2 completes before thread#1: > Then during snd_usb_rediscover_devices() it won't notify of any > connection for that particular chip index. Looks like you are assuming the regular USB audio stuff is probed first? What if it's not the case? Have you tested with a manual 'blacklist' and "modprobe" sequence long after all the DSP stuff is initialized? It really reminds me of audio+display issues, and the same opens apply IMHO.