Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp279780rwb; Wed, 28 Sep 2022 02:34:48 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6Edn5AHj4PAbJKBsxi2vP/Ux7hdig3gv06ptnWSexxqqJ9WNTzRcvxD6E1S9IdSS9fRa2P X-Received: by 2002:aa7:8d05:0:b0:557:f0c1:6413 with SMTP id j5-20020aa78d05000000b00557f0c16413mr18706148pfe.19.1664357688414; Wed, 28 Sep 2022 02:34:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664357688; cv=none; d=google.com; s=arc-20160816; b=hHvj/FiPlZpIUAk4bu1Nl1SM7uuTZtlYRJ+R9tuIgylGYGxgoyLmZESUJQ/lwGSPh0 CxJ01Z/D8pmbAcH3y1t30sHH4mKT00VeFSIAt/Ft0nRg4kIuVFJ4KEDSNEXSzUuJ/Sl6 l/h5XL+K8Ix58/UAIMgOIgwNncCSWRQK7SeCmeXRVZsMECUn6sBP9o80qKLwY75exUVJ LvAGHAOrl2F13/EgeXtR4Pxvmw8B3W5YnulSwXoFKOExDHStjYNZQ3ej1yZwiF3iA2/c 9SwjkAdvEz9pNLMnOSir/ILgOh1emwO+MblfYYVheCqIaJ7eYHwoQKVkWFtrDSeuJeNQ YG+A== 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=K3AKIr7gKujUZW9pFiS9iBIKTjSHa/OKW2yXqqhbkzc=; b=LDX64pRMlR2umOH3iJ7W5ZOlx9SUQKF26ecwFlPcT8V/h9q+wAvNVm8BBEnmI03iYc Qx/dYBJJu8V2EYOr+aVAMQnwl7VR+48zcYYrtKHWLfORRUVYVdAn5Hi/i/eE5fMypyOe xlJdEWFCF0AFibz5uDj7itNuYvWvUCdvp5qzEE0ZcEL7ThcrVMqCq76vby1oh9Jauv2+ nLO7kcneCTYHfGdmx6ewpyn2PbNflqOAXtatVfTWazD6IJjtoOfBbOaHNAp6u4s3LxpX i5M59zq0sgBBzSqUHglHfWgN1qMKa/pzcLOwrXrkqYy6LQEuoiQQPFgW4hEEgH7IGX5F Cing== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=R3TMPCjr; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d4-20020a63ed04000000b0043a93922655si4447490pgi.334.2022.09.28.02.34.35; Wed, 28 Sep 2022 02:34:48 -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; dkim=pass header.i=@intel.com header.s=Intel header.b=R3TMPCjr; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233035AbiI1Ijw (ORCPT + 99 others); Wed, 28 Sep 2022 04:39:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51216 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233134AbiI1IjZ (ORCPT ); Wed, 28 Sep 2022 04:39:25 -0400 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 72335A0279 for ; Wed, 28 Sep 2022 01:39:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1664354363; x=1695890363; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=Nh8zVkI764C79JD/zOGUpjoTiHdV4xPlRb3vpHlIbd4=; b=R3TMPCjr9CUyH3KBzXsdx19JE2bvGJaVMzFXGVY+oJ8EYO2C8ip0fmsD S1j5dPhIOslbUe3HIGIdFFmff3rw2sc5PgN/76E6bJI/4j88pZHSZgbTM wC6pf3aETcumgGbHhREC47ojiVIc9IB5qrbjqy4M4inXxOB1MphSY9ayY yOo/d9jyKSQhUvQu57EUgK/4UkRk491IfRZSNA16uAeU5cpr9+aFZ9lTV o+Dk4gsVJ+JzbPStVmRqUhusAB3xqf1X1ulQldsBvOwPIq8KBqVCGISUq +suvpSxjYMmeDPrida7UkelU6W2CGvq2RLcoNhX96ILl6YOZwW76vw9O4 w==; X-IronPort-AV: E=McAfee;i="6500,9779,10483"; a="288701789" X-IronPort-AV: E=Sophos;i="5.93,351,1654585200"; d="scan'208";a="288701789" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Sep 2022 01:39:22 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10483"; a="617131356" X-IronPort-AV: E=Sophos;i="5.93,351,1654585200"; d="scan'208";a="617131356" Received: from morank-mobl3.ger.corp.intel.com (HELO [10.251.211.7]) ([10.251.211.7]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Sep 2022 01:39:17 -0700 Message-ID: <9cb844a7-6eac-0085-3c8c-32004a22c849@linux.intel.com> Date: Wed, 28 Sep 2022 10:36:32 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0 Thunderbird/91.11.0 Subject: Re: [PATCH] ASoC: soc-pcm: fix fe and be race when accessing substream->runtime Content-Language: en-US To: Eugeniu Rosca Cc: Yanmin Zhang , alsa-devel@alsa-project.org, Eugeniu Rosca , Jiada Wang , linux-kernel@vger.kernel.org, Cezary Rojewski , Zhang Yanmin , Takashi Iwai , Ramesh Babu , Liam Girdwood , Dean Jenkins , Mark Brown , Ramesh Babu B , xiao jin References: <1664210154-11552-1-git-send-email-erosca@de.adit-jv.com> <20220927123043.GB4547@lxhi-065> From: Pierre-Louis Bossart In-Reply-To: <20220927123043.GB4547@lxhi-065> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE autolearn=ham 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 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 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. 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. > 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. >> >> 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. > >> 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