From mboxrd@z Thu Jan 1 00:00:00 1970 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=-5.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, 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 04BCEC4338F for ; Mon, 9 Aug 2021 15:37:07 +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 4FDAE60FF2 for ; Mon, 9 Aug 2021 15:37:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 4FDAE60FF2 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-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 EC6DD1654; Mon, 9 Aug 2021 17:36:12 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz EC6DD1654 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1628523423; bh=Ul8U5Q5qokvySYpt/8vNtUu0g5G6kfwAV3795wPIyCc=; h=Subject:To:References:From:Date:In-Reply-To:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=gTV5hxOo2LRJiZWH6jLqJJlc4gyv3rzvP7tMt0pDaz0HjknwBvVr95I1ydq+hFTlH SAEVQhAnloVyBqJ8Zh2c6rWETVP0i4Yq8py6w4sKoL2udexjxKGYRhOR3ALc9uhmSt XTzyAt5wY1L4Qi5A/hadW71SUIRHJM97do8GRehE= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 7C28DF80105; Mon, 9 Aug 2021 17:36:12 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 64B82F802D2; Mon, 9 Aug 2021 17:36:10 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) (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 039EAF800FD for ; Mon, 9 Aug 2021 17:36:06 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 039EAF800FD X-IronPort-AV: E=McAfee;i="6200,9189,10070"; a="194309997" X-IronPort-AV: E=Sophos;i="5.84,307,1620716400"; d="scan'208";a="194309997" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Aug 2021 08:36:01 -0700 X-IronPort-AV: E=Sophos;i="5.84,307,1620716400"; d="scan'208";a="505287039" Received: from jsmalone-mobl1.amr.corp.intel.com (HELO [10.212.48.42]) ([10.212.48.42]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Aug 2021 08:36:01 -0700 Subject: Re: [PATCH] soundwire: intel: trap TRIGGER_SUSPEND in .trigger callback To: Takashi Iwai References: <20210727053256.29949-1-yung-chuan.liao@linux.intel.com> <9ef7e341-13f4-69f7-964d-8e6efdd57ca7@linux.intel.com> From: Pierre-Louis Bossart Message-ID: <1096a0dc-0c8d-b7e8-bfd3-f157c1b696de@linux.intel.com> Date: Mon, 9 Aug 2021 10:35:58 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Cc: "alsa-devel@alsa-project.org" , Ranjani Sridharan , Vinod Koul , "broonie@kernel.org" , Bard Liao , "Liao, Bard" 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" >>> Actually, there was one big piece I overlooked. The whole DPCM BE >>> operation is *always* tied with FE's. That is, the nonatomic flag is >>> completely ignored for BE, but just follows what FE sets up. >>> >>> And that's the very confusing point when reviewing the code. You >>> cannot know whether it's written for non-atomic context or not. This >>> means that it's also error-prone; the code that assumes the operation >>> in a certain mode might mismatch with the bound FE. >>> >>> So, ideally, both FE and BE should set the proper nonatomic flags, and >>> have a consistency check with WARN_ON() at the run time. >> >> Sorry Takashi, I am not following. Are you asking me to add a .nonatomic >> flag in all the exiting BEs along with a WARN_ON? >> >> I can do this, but that's a sure way to trigger massive amounts of >> user-reported "regression in kernel 5.1x". Is this really what you want? > > That's why I wrote "ideally". We all know that the world is no > perfect... So hardening in that way would be possible, but it has to > be done carefully if we really go for it, and I'm not asking you to do > that now. > >> Also I don't understand how this would help with the specific problem >> raised in this patch: can we yes/no do something 'heavy' in a *DAI* >> callback? What is the definition of 'heavy'? > > My previous comment wasn't specifically about your patch itself but > rather arguing a generic problem. We have no notion or matching > mechanism of the atomicity of DPCM BE. I think the only problem is actually on the SoundWire dailinks. For SSP/DMIC we don't do anything for BE dailinks, there's no IPC or waits, only some settings/masks. I don't see any need to set the .nonatomic field in those cases. But for SoundWire, we do use the 'stream' functions from the BE ops callbacks - sdw_prepare_stream, sdw_trigger_stream - which will do a bank switch operation. That's certainly not an atomic operation, there's a clear wait_for_completion(). That seems like a miss indeed, I'll add a patch to set the .nonatomic field for these links. But for this patch proper, does anyone have an objection? I am still not clear on what is permissible at the DAI level. >> And last, I am not sure it's always the case that a BE follows the FE >> configuration. We've had cases of BE->BE loopbacks where the host >> doesn't see or configured the data. > > Hm, how the trigger and other PCM callbacks for BE get called in that > mode? IIRC everything was handled with DAPM, changing pin states would enable data transfers. Not 100% sure and that's not really relevant anyways, you did have a point that the SoundWire BEs are not correctly configured.