Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp962677rwb; Tue, 27 Sep 2022 06:51:17 -0700 (PDT) X-Google-Smtp-Source: AMsMyM72cZ6NN1KadUTtLzgiX55BtQ537W26lT80m7khPGQCvY7A8bGolMW+Jz8JpgX0VjGYBKqi X-Received: by 2002:a17:907:2d2a:b0:782:3b7d:a848 with SMTP id gs42-20020a1709072d2a00b007823b7da848mr22032762ejc.569.1664286676813; Tue, 27 Sep 2022 06:51:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664286676; cv=none; d=google.com; s=arc-20160816; b=jadMy3l93E3ub2oJzIaZgzQxQH+BR9QX2chAhgU4Tr8yuDBNQgQCK+mUJHasW0voFB rE09JeutyfFy2Rlp0TytMrQzJxTEfm9P0X/B8c4PHkIyy/GnVRX98IFCctrzo/bF/J+W 4zZPBgXaejoeEp7dR+lXsnCVuvWWaj7FDh2n/bDlU65ynTPa08EwP1IDobKwzNAOAL5u jUywdIg3D1+sXzADVMJO9yx8rZ+Xr3s192CQShGEpDmfcHiprrmgsaFCuQM8YCAJMwFc V/YCk8raBvT6bEZRKxVakMYlkbBmsnPKjl+v94l6ViHra9mQyCU2AtKTK07Z33n+JaqG KrWw== 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=ZW/KPDTf9ukRczZfy3Q77SUCR49pNl6RxAOs3Fag3EE=; b=trCgZ2m+QUv93XUYobXSM9WPeJkTCcOVgMxZegPHgxFalU3VPZiBaRvABsKfDdOgyp L/ytzD1iyJJBMfrVUWSfiYTAWb0hRexNUYVffIggsCbnhzG5YGnFs7N31zFpFE4ZbSbC Q+zqn3oX08rvKzJQfD9GVOO5nHdleZc+MxwLJJk165HTX5kU+j+2/uH05ShMhORpRqxH qVCOsztEqKicVYZqlx4o3lwGdKcQtRLmsJPcLwbfAXI/WzoIy6sYxM4AiZrRxLtK5WNz wYbTJh6Lcs3JOSPQl5kVUtl9gVpKYRxJAjiXPy4Y/07tFyGFFMO2fUFtqV4ZZBut1Awi N4lA== 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 g22-20020a17090669d600b00734bbe8d2e1si1374369ejs.545.2022.09.27.06.50.50; Tue, 27 Sep 2022 06:51:15 -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 S231916AbiI0MbE (ORCPT + 99 others); Tue, 27 Sep 2022 08:31:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42516 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232358AbiI0Mas (ORCPT ); Tue, 27 Sep 2022 08:30:48 -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 DC7DDDF38F for ; Tue, 27 Sep 2022 05:30: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 17EAA520214; Tue, 27 Sep 2022 14:30:44 +0200 (CEST) Received: from lxhi-065 (10.72.94.21) 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; Tue, 27 Sep 2022 14:30:43 +0200 Date: Tue, 27 Sep 2022 14:30:43 +0200 From: Eugeniu Rosca To: Pierre-Louis Bossart CC: Eugeniu Rosca , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , , , Yanmin Zhang , Eugeniu Rosca , Jiada Wang , Zhang Yanmin , Ramesh Babu , Dean Jenkins , Ramesh Babu B , xiao jin , Cezary Rojewski Subject: Re: [PATCH] ASoC: soc-pcm: fix fe and be race when accessing substream->runtime Message-ID: <20220927123043.GB4547@lxhi-065> References: <1664210154-11552-1-git-send-email-erosca@de.adit-jv.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-Originating-IP: [10.72.94.21] 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 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 in https://lore.kernel.org/alsa-devel/20220927110022.GA3802@lxhi-065/ , 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. 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. > > 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? > 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