Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp2454966rwb; Thu, 29 Sep 2022 10:21:42 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5nDTqnYYKeTg+3yZ8LoXL0TGrKN6mXzmQ1l/YHxhtG2cHastZ+28e7bMFdLGnfTtA5xEYr X-Received: by 2002:a17:906:ee8e:b0:730:3646:d178 with SMTP id wt14-20020a170906ee8e00b007303646d178mr3514601ejb.426.1664472102349; Thu, 29 Sep 2022 10:21:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664472102; cv=none; d=google.com; s=arc-20160816; b=Rmvht4lp/1reWUw36QMbIy8nfkajcai+/BU3beLnBZhG111F3lsfVXgktNSGDrl0Cf +G85LyqBKDnfRZxk6n8bjTmVGJZPg9fRwPykKp6siszX4s8Ijll8DhVyIYrb1vCcE2OO kTEDCnbWEtzQwFJep67TK9NL6I7rsK7isbMHwmuYL0xeb5PqnclVDrje3eQv0+d0igIL Fe1MPUZP6oKtF5G8QxZWoJlYFoY8PH3Axt9jiFkc89ClYYKQfn0VhWTnnlWk7ZjOx2iN 3O7DqhREov8Wg5bIA2tBntmC9mfBw6G25ss1J8oZ09vuwWdOh3Vms64idP0YHlEXkAxV okQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=dyJ5rwn73dwiiJko+zVQa45bKr1QyrlkAIuqAe9epTY=; b=YtB2ovvjvXnAQq91TCIIrH+mc2lK9Oawbba0egHFGDyFLF0mzkLHlKY3QT08XUd3Vd B2w1fHTW7LYiWeiqBwEMHC3N+Isk1PqIBeY2jXQjk8i0QkuZPWRrzgY5yOijhvLG9m7M aP+2h6k0xHFNOOotm1y1exgpazFcx5ZgSj/1SRi6fKcBTrpWOWOmlU6LEQ62yd/wRQVK KNoLXp4M7MCEoMqyhF12oE4OFkx8twf51mNqSty+HAlxLZUKZ8cRXXdx0ruJs/XPCQkG /SLzJLZJhoToOChqQQX4vCcayES4T0WMlI9BnRSNCCUdRFktNgUfLt9XtA4pOumG+S9Q jmdA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h13-20020a05640250cd00b00457dbbf8336si28650edb.456.2022.09.29.10.21.16; Thu, 29 Sep 2022 10:21:42 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235489AbiI2Qgu (ORCPT + 99 others); Thu, 29 Sep 2022 12:36:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33286 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234352AbiI2Qgq (ORCPT ); Thu, 29 Sep 2022 12:36:46 -0400 Received: from hi1smtp01.de.adit-jv.com (smtp1.de.adit-jv.com [93.241.18.167]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8BB6F12BD87 for ; Thu, 29 Sep 2022 09:36:45 -0700 (PDT) Received: from hi2exch02.adit-jv.com (hi2exch02.adit-jv.com [10.72.92.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by hi1smtp01.de.adit-jv.com (Postfix) with ESMTPS id 1F03A5201DA; Thu, 29 Sep 2022 18:36:44 +0200 (CEST) Received: from lxhi-065 (10.72.94.4) by hi2exch02.adit-jv.com (10.72.92.28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.12; Thu, 29 Sep 2022 18:36:43 +0200 Date: Thu, 29 Sep 2022 18:36:38 +0200 From: Eugeniu Rosca To: Pierre-Louis Bossart CC: Eugeniu Rosca , Yanmin Zhang , , Eugeniu Rosca , Jiada Wang , , Cezary Rojewski , Zhang Yanmin , Takashi Iwai , Ramesh Babu , Liam Girdwood , Dean Jenkins , Mark Brown , Ramesh Babu B , xiao jin Subject: Re: [PATCH] ASoC: soc-pcm: fix fe and be race when accessing substream->runtime Message-ID: <20220929163638.GA8106@lxhi-065> References: <1664210154-11552-1-git-send-email-erosca@de.adit-jv.com> <20220927123043.GB4547@lxhi-065> <9cb844a7-6eac-0085-3c8c-32004a22c849@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <9cb844a7-6eac-0085-3c8c-32004a22c849@linux.intel.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-Originating-IP: [10.72.94.4] X-ClientProxiedBy: hi2exch02.adit-jv.com (10.72.92.28) To hi2exch02.adit-jv.com (10.72.92.28) X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,KHOP_HELO_FCRDNS, SPF_HELO_NONE,SPF_NONE autolearn=no 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 Hi Pierre, On Mi, Sep 28, 2022 at 10:36:32 +0200, Pierre-Louis Bossart wrote: > > > On 9/27/22 14:30, Eugeniu Rosca wrote: > > Hi Pierre, > > > > On Di, Sep 27, 2022 at 09:51:46 +0200, Pierre-Louis Bossart wrote: > >> On 9/26/22 18:35, Eugeniu Rosca wrote: > >>> From: xiao jin > >>> > >>> After start of fe and be, fe might go to close without triggering > >>> STOP, and substream->runtime is freed. However, be is still at > >>> START state and its substream->runtime still points to the > >>> freed runtime. > >>> > >>> Later on, FE is opened/started again, and triggers STOP. > >>> snd_pcm_do_stop => dpcm_fe_dai_trigger > >>> => dpcm_fe_dai_do_trigger > >>> => dpcm_be_dai_trigger > >>> => dpcm_do_trigger > >>> => soc_pcm_trigger > >>> => skl_platform_pcm_trigger > >>> skl_platform_pcm_trigger accesses the freed old runtime data and > >>> kernel panic. > >>> > >>> The patch fixes it by assigning be_substream->runtime in > >>> dpcm_be_dai_startup when be's state is START. > >> > >> Can I ask on which kernel this patch was validated and on what platform? > > > > As shared with Czarek, > > this patch was originally extracted from the out-of-tree Intel Apollo > > Lake v4.1 KNL releases, hence it was validated on Intel ref.boards. > > > > No re-testing/re-validation has been performed on the latest vanilla. > > There's no way to predict how a patch for a kernel 4.1 - released 7 > years ago - would behave with a new kernel. If it's not tested it cannot > be merged. No disagreement here :) > > > One of the goals behind submitting the patch is getting in touch > > with the original authors, as well as the members of alsa-devel, > > to assess if the patch is still relevant. > > The only thing we could do is have more clarity on the test case and try > to reproduce it. Agreed. As soon as a test-case pops up where the patch makes a difference in the runtime behavior, you will hear back from us. > > >> > >> We've done a lot of work since last year on DPCM states, > > > > Could you please feedback if the work on the DPCM states is > > pre- or post-v5.10? > > It doesn't matter for this discussion on the upstream kernel. But yes > it's post v5.10. Thanks. This is helpful in the downstream context. > > > > >> and I wonder > >> the problem mentioned above actually exists on recent kernels. > >> > >> Specifically, if the FE is closed, I don't get how the BE is not closed > >> as well. And if this problem is found on a recent kernel, then it should > >> be seen in the AVS driver as well, no? > > > > It is totally conceivable (if not very likely) that the mainline > > advancements in the sound subsystem make this patch obsolete. > > > > I would be happy if that's the final outcome of our discussion > > (since this will allow dropping the patch in our downstream kernel). Best Regards Eugeniu