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.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham 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 CB0A4C432C0 for ; Tue, 19 Nov 2019 21:28:46 +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 AEB10206F4 for ; Tue, 19 Nov 2019 21:28:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="Bhnv8u9D" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AEB10206F4 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@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 43500168E; Tue, 19 Nov 2019 22:27:53 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 43500168E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1574198923; bh=RyTtXAPXtUpM1WeGjhfmzIOOYfF3x+7nqMzhy9lRNVk=; h=Date:From:To:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=Bhnv8u9D50vjpbEuGKVC1gXxAQMLsr2VvaWyQkPGryuUcippzp3YqorC9d7gX+/SG WP++o43CsPm2bDfyp58eJX5xdNsH1Uk72olQ42XoBJiUifcOOmNYhO8hqzC2yfq1H2 dPsOCHpeKl/QFUPNlLj7yI2Lxp1fjWtK9WnZNJV0= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id B4A29F800FF; Tue, 19 Nov 2019 22:27:52 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 8FA67F80138; Tue, 19 Nov 2019 22:27:51 +0100 (CET) Received: from mx1.suse.de (mx2.suse.de [195.135.220.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 4FA69F800FF for ; Tue, 19 Nov 2019 22:27:48 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 4FA69F800FF X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 3F5D0AFBC; Tue, 19 Nov 2019 21:27:48 +0000 (UTC) Date: Tue, 19 Nov 2019 22:27:47 +0100 Message-ID: From: Takashi Iwai To: Ranjani Sridharan In-Reply-To: References: <20191117085308.23915-1-tiwai@suse.de> <20191117085308.23915-8-tiwai@suse.de> <3b407a02-b791-52a4-2335-e21d8ab732dd@linux.intel.com> <3fc820272992362a56881abf7230f1500fdfdd2a.camel@linux.intel.com> <030249cd63d754bd70ce5de5c58e04784eecebff.camel@linux.intel.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/25.3 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Cc: Linux-ALSA , "Sridharan, Ranjani" , Pierre-Louis Bossart Subject: Re: [alsa-devel] [PATCH 7/8] ALSA: pcm: Add card sync_irq field 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" On Tue, 19 Nov 2019 17:36:46 +0100, Ranjani Sridharan wrote: > > On Tue, 2019-11-19 at 09:24 +0100, Takashi Iwai wrote: > > On Tue, 19 Nov 2019 08:40:25 +0100, > > Ranjani Sridharan wrote: > > > > > > > > > > > > > Hi Takashi, > > > > > > > > > > I just realized that In the SOF driver, we only set the > > > > > component > > > > > driver ops. The pcm ops are set when creating the new pcm. So, > > > > > should I > > > > > also add the sync_stop op in the component driver and set the > > > > > pcm > > > > > sync_stop op to point to the component sync_stop op? Just > > > > > wanted to > > > > > confirm if I am on the right track. > > > > > > > > Yes, I didn't touch this yet, but that's the way to go I suppose. > > > > One caveat is that this ops is optional and needs NULL as > > > > default, > > > > hence you'd need to set only when defined, like copy_user, page > > > > or > > > > mmap ops, at least. > > > > > > Hi Takashi, > > > > > > This is what I tried in the SOF driver: > > > https://github.com/thesofproject/linux/pull/1513/commits > > > > > > And it seems to cause the system to hang when I stop the stream and > > > I > > > have no meaningful logs to pinpoint to the problem. Could you > > > please > > > have a look at the 4 commits that I have added to your series and > > > let > > > me know what I could be missing? > > > > I couldn't find anything obvious. Could you try without changing > > snd_sof_pcm_period_elapsed(), i.e. only adding the stuff and calling > > sync_stop, in order to see whether the additional stuff broke > > anything? > It is indeed the removal of snd_sof_pcm_period_elapsed() that makes the > device hang when the stream is stoppped. But that's a bit surprising > given that all I tried was using the snd_pcm_period_elapsed() directly > instead of scheduling the delayed work to call it. If I read the code correctly, this can't work irrelevantly from the sync_stop stuff. The call of period_elapsed is from hda_dsp_stream_check() which is performed in bus->reg_lock spinlock in hda_dsp_stream_threaded_handler(). Meanwhile, the XRUN trigger goes to hda_dsp_pcm_trigger() that follows hda_dsp_stream_trigger(), and this function expects the sleepable context due to snd_sof_dsp_read_poll_timeout() call. So something like below works? Takashi --- a/sound/soc/sof/intel/hda-stream.c +++ b/sound/soc/sof/intel/hda-stream.c @@ -592,8 +592,11 @@ static bool hda_dsp_stream_check(struct hdac_bus *bus, u32 status) continue; /* Inform ALSA only in case not do that with IPC */ - if (sof_hda->no_ipc_position) - snd_sof_pcm_period_elapsed(s->substream); + if (sof_hda->no_ipc_position) { + spin_unlock_irq(&bus->reg_lock); + snd_pcm_period_elapsed(s->substream); + spin_lock_irq(&bus->reg_lock); + } } } _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org https://mailman.alsa-project.org/mailman/listinfo/alsa-devel