Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2052284pxb; Sun, 17 Oct 2021 04:46:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzVDBBUbaujP+ddjoYTSQJFY8ltR16qpsaYri+vm4gE1P4BZIpwzrm66o7V8gjVCvNfLin2 X-Received: by 2002:a17:90b:4b07:: with SMTP id lx7mr25994024pjb.195.1634471164696; Sun, 17 Oct 2021 04:46:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634471164; cv=none; d=google.com; s=arc-20160816; b=f2HtNNuLXq1V4STqv5KLPDskPMJQGpYoCMndy6E5vqtsXDoIYNOMIOCPy4ceO8JDuk 6rNUcM8/tEs0hhs2FSEEGRGhey/A/hJ+xW40nUL+JsVE4YyGXZU/xJZCsM+F7XW/FiAi DxdTKx2lcr5msLw1ivepFh29vAsswuD0kTqc13ZumdFTJLJLV87lpotEvxbnkNThcIPC HT2QCJoHyKd18AzVu90NbxuLw/2+SmNza7q98aqYbSdu3oCKoU/Qh0m/xKPOT9sVvOXN L7eA/YxndKa4SQ1wGw6VNh5tQRQkchuLA07CnhNjO8DDXLGENXkPI8zpxQ9fpZlQlqd+ Zq0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=du59NtEQ3Xl02aC1xGX4Dwy2jHGL+KIMWUdIOUQPLeg=; b=mUPMKAFh+ocKCpelkkMvYUrfAXnZ5u8Hpp9UEY5BDPiOej5vHmjbFAC98GSA+Wk3Uh /QeID4q6uweckxfFbOZGljrL/t5VpaUkgYN4JsKYYP2mcqS1uGOO9ENE1tZlJBqL6a8T vWxQ73xKRyo3kywLguiR+QH5DNs9vLAaubyJ5FzAg6oh5LlYnvFdaiIC3YPDeUwc19Hq UblQboqGO118qsAEI+ZPwCK/Q+LFVDnBgVhvM/MhokKY+rKTILfX/6/1eyB/D8MtN1QD YXhtKR0EJBpMDKhKy7Q+SDTdxmpgl1e67qFzDmjKB4jWA09yWqaKCV5MB7DoktrIGBs4 ycHQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d15si15440414pgb.244.2021.10.17.04.45.52; Sun, 17 Oct 2021 04:46:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241996AbhJORLC (ORCPT + 99 others); Fri, 15 Oct 2021 13:11:02 -0400 Received: from mga04.intel.com ([192.55.52.120]:25206 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237786AbhJORLB (ORCPT ); Fri, 15 Oct 2021 13:11:01 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10138"; a="226726371" X-IronPort-AV: E=Sophos;i="5.85,376,1624345200"; d="scan'208";a="226726371" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Oct 2021 10:08:53 -0700 X-IronPort-AV: E=Sophos;i="5.85,376,1624345200"; d="scan'208";a="492640732" Received: from liminghu-mobl.ccr.corp.intel.com (HELO [10.212.23.213]) ([10.212.23.213]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Oct 2021 10:08:51 -0700 Subject: Re: [RFC PATCH v3 05/13] ASoC: soc-pcm: align BE 'atomicity' with that of the FE To: Takashi Iwai Cc: alsa-devel@alsa-project.org, Kuninori Morimoto , open list , Sameer Pujar , Liam Girdwood , Takashi Iwai , vkoul@kernel.org, broonie@kernel.org, Gyeongtaek Lee , Peter Ujfalusi References: <20211013143050.244444-1-pierre-louis.bossart@linux.intel.com> <20211013143050.244444-6-pierre-louis.bossart@linux.intel.com> <2847a6d1-d97f-4161-c8b6-03672cf6645c@nvidia.com> <8aa4fa07-2b55-3927-f482-c2fd2b01a22e@linux.intel.com> From: Pierre-Louis Bossart Message-ID: Date: Fri, 15 Oct 2021 12:08:48 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org >> I have not been able to figure out when you need >> a) the pcm_mutex only >> b) the fe stream lock only >> c) both pcm_mutex and fe stream lock > > The pcm_mutex is needed for every sleepable function that treat DPCM > FE link, but the mutex is taken only at the upper level, i.e. the > top-most caller like PCM ops FE itself or the DAPM calls. > > That said, pcm_mutex is the top-most protection of BE links in FE. > But, there is a code path where a mutex can't be used, and that's the > FE and BE trigger. For protecting against this, the FE stream lock is > taken only at the placing both adding and deleting a BE *in addition*. > At those places, both pcm_mutex and FE stream lock are taken. > > BE stream lock is taken in addition below the above mutex and FE > locks. Thanks Takashi, now I get the idea. Makes sense indeed. I'll make sure to add this explanation to the commit message/cover so that it's not lost. I added your three patches to my tests, so far so good, code is that https://github.com/thesofproject/linux/pull/3215 Thanks and have a nice week-end. -Pierre