Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.2 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9BF36C34056 for ; Wed, 19 Feb 2020 19:28:49 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1A72F208E4 for ; Wed, 19 Feb 2020 19:28:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="SIPyQU5q" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1A72F208E4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 78C7C1695; Wed, 19 Feb 2020 20:27:57 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 78C7C1695 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1582140527; bh=485ZrrtckWWjpby7br51eluuXPCnzNqykffBxaBPluw=; h=Subject:To:References:From:Date:In-Reply-To:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=SIPyQU5qnThPEoxiyO5t3SyokTYi6WcTd/6fnAvgCacW9xgci4w1Q8JgAzeXujLmu 8OeZwGRTqi5umjCc51ymPZMXFTF0YPdqdnJQvaBhu/MAEwQ9WwBvyqekeWe8wxjqha 3JM8VPQmDHjywm1DkI5JsrIGC2J4JNK2CkSAFhpc= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id E13EDF80142; Wed, 19 Feb 2020 20:27:56 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id AF125F80114; Wed, 19 Feb 2020 20:27:50 +0100 (CET) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id F0E6DF80114 for ; Wed, 19 Feb 2020 20:27:47 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz F0E6DF80114 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Feb 2020 11:27:36 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,461,1574150400"; d="scan'208";a="436338569" Received: from aibautis-mobl2.amr.corp.intel.com (HELO [10.251.151.242]) ([10.251.151.242]) by fmsmga006.fm.intel.com with ESMTP; 19 Feb 2020 11:27:35 -0800 Subject: Re: [PATCH] ASoC: soc-pcm: Revert "call snd_soc_component_open/close() once" To: Kai Vehmanen References: <20200219182650.1416-1-kai.vehmanen@linux.intel.com> From: Pierre-Louis Bossart Message-ID: <4b7feeff-3cc7-166e-a3fd-4cfd942166a2@linux.intel.com> Date: Wed, 19 Feb 2020 13:27:35 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Cc: digetx@gmail.com, alsa-devel@alsa-project.org, broonie@kernel.org, ranjani.sridharan@linux.intel.com, kuninori.morimoto.gx@renesas.com X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" On 2/19/20 12:53 PM, Kai Vehmanen wrote: > Hey, > > On Wed, 19 Feb 2020, Kai Vehmanen wrote: > >> ASoC component open/close and snd_soc_component_module_get/put are >> called independently for each component-substream pair, so the logic >> in the reverted patch was not sufficient and led to PCM playback and >> module unload errors. > > I tried to keep part of the original patch at first, but I kept hitting > new issues either in component load, or in module unload-reload flow. > Thanks to Pierre and Ranjani for early reviews. > > So in the end I ended up with a full revert. This at least works on all > SOF device topologies I tested with. > > At the root of the problem is that component open is called with multiple > substreams and driver open (and close) should be called for each substream > as well. This also caused problems to the added module refcounting logic.. > so that is reverted as well. I also tried to find a fix in parallel with Kai's work, but no luck. First I am not sure why we need to add a 'module' state in addition to the existing module ref-counting, and the 'opened' state management looks too simple. revert-and-revisit seems like the best course of action indeed.