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=-13.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 20FA8C4743D for ; Fri, 11 Jun 2021 03:39:31 +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 4FDB861359 for ; Fri, 11 Jun 2021 03:39:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4FDB861359 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=sakamocchi.jp 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 CB4A91833; Fri, 11 Jun 2021 05:38:38 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz CB4A91833 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1623382768; bh=XVWr1nNaNuQm5Z5bBWiZTd4iY3wg1NfL9Rr35XpGH2c=; h=Date:From:To:Subject:References:In-Reply-To:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=da3zFfHJaB5uoIzMT7y5pNfkm4zh/c5nawnpMGBeJQJMrwkW5yhNbH84AO4PmNSsD G3cOE5QJQJkV6eIVmfdslDN3mWJp4NET8rAxY084vErHOkQBjgtiBCkqpZ5a+zdHrm +lXMYNJNKtXDq2rCaEMiW1AXE3w0CNhS2yLlj/dQ= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 6C1CFF8026C; Fri, 11 Jun 2021 05:38:38 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 2D60DF8027C; Fri, 11 Jun 2021 05:38:36 +0200 (CEST) Received: from wout5-smtp.messagingengine.com (wout5-smtp.messagingengine.com [64.147.123.21]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 88149F8026C for ; Fri, 11 Jun 2021 05:38:26 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 88149F8026C Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="jWUxjv7+"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="uY6Rc/sx" Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id 74C971BD8; Thu, 10 Jun 2021 23:38:21 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Thu, 10 Jun 2021 23:38:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sakamocchi.jp; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm1; bh=RuqBvhyE8WSoihJKDWCmmn6Ra7O TmipqE2zSj0ZRk8g=; b=jWUxjv7+BqW9Wg+OBUXDADC0tBw+hTAM4wUYusw8U5o ax2WGmJfJanQRNYxgwemtK0g0kPCUtC91o+yeflHB+0R5+gXbAT7hR7JvW2UfZrx yumRCzzCvd0wUKn28o1flKsqTdn8/56eihZaCyo7RhCZbV6Jtoy5R9ooDUzp9/Ni C2K5GXTozzHLgLP3nPSbiX9jLn/uyPLLarclEhuMxkP4jx+Q/p3xh1S+CYnNwZ+v LFRxRs2k4y4cdLJc5twFJfSbEpQJ7ev+4RH1ARxq1q3KTaDd+/qD8e1m2cGsvWB2 am2+xyYJUDuz+taqjb9httoZI3GeghOqARopa4UXN8A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=RuqBvh yE8WSoihJKDWCmmn6Ra7OTmipqE2zSj0ZRk8g=; b=uY6Rc/sxctcXuFpiYjiW34 u6kADk7N//sKNcO+LMx4NtnmjYMM8A5j4AARgcwAVYQoA5/YX94ZB9ur9z38g1lJ nNMA8EPg8Utbj8Wb9hLtTZ3GrktsCFeETyLmWMsEbJEZv99NrJSV3dWQff/XkKG0 qfrVPk3k2gDevadt1npIe04tSKf/C4M6vNCH5XlAUfuW2NKM8o6U3iEPEAcHfZSi ce+t7zzHgr9iWQr2ymH+SCmh15CzOIVzC1MEjlS1S803lygEdsn8HM1lx+3nSMXG TMEe30fjfPnTsVzwmivFCGwnHpt+abrntUSMDNq3M5gqXdI7JFIyNAN+R5mZO7mw == X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrfeduiedgjeduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfhfgggtuggjsehttdertddttddvnecuhfhrohhmpefvrghkrghs hhhiucfurghkrghmohhtohcuoehoqdhtrghkrghshhhisehsrghkrghmohgttghhihdrjh hpqeenucggtffrrghtthgvrhhnpeelhfeugedvjefgjefgudekfedutedvtddutdeuieev tddtgeetjeekvdefgeefhfenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmh grihhlfhhrohhmpehoqdhtrghkrghshhhisehsrghkrghmohgttghhihdrjhhp X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 10 Jun 2021 23:38:19 -0400 (EDT) Date: Fri, 11 Jun 2021 12:38:16 +0900 From: Takashi Sakamoto To: Takashi Iwai Subject: Re: [PATCH v2 1/3] ALSA: pcm: add snd_pcm_period_elapsed() variant without acquiring lock of PCM substream Message-ID: <20210611033816.GA10978@workstation> Mail-Followup-To: Takashi Iwai , clemens@ladisch.de, alsa-devel@alsa-project.org References: <20210609143145.146680-2-o-takashi@sakamocchi.jp> <20210609231623.GA3207@workstation> <20210610080521.GA84899@workstation> <20210610082622.GA86308@workstation> <20210610101243.GA89949@workstation> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Cc: alsa-devel@alsa-project.org, clemens@ladisch.de 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" Hi, On Thu, Jun 10, 2021 at 01:03:19PM +0200, Takashi Iwai wrote: > On Thu, 10 Jun 2021 12:12:43 +0200, Takashi Sakamoto wrote: > > > > On Thu, Jun 10, 2021 at 10:36:57AM +0200, Takashi Iwai wrote: > > > Again, my *only* point is about the sleep. You addition was: > > > > > > + * Context: Any context in which lock of PCM substream is already acquired. This function may not > > > + * sleep. > > > > > > where "This function may not sleep" is stated incorrectly. > > > > Hm. Would I request you to show the detail case that the call of function > > (snd_pcm_period_elapsed_under_stream_lock()) goes sleep except for > > driver-side implementation of snd_pcm_ops.{pointer, trigger, > > get_time_info}? At least, in callgraph I find no function call to > > yield... > > True. But the fact that those callbacks may sleep means that the > function would go sleeping after all. Thanks. After all, our discussion comes from the ambiguity that what has responsibility at yielding processor under the lock. I think it helpful to describe devide responsibilities about the yielding. I'm glad for you to review patch below: ======== 8< -------- >From 98e1b8332a95935ae875c637d3ddc27e68689aa0 Mon Sep 17 00:00:00 2001 From: Takashi Sakamoto Date: Fri, 11 Jun 2021 11:03:46 +0900 Subject: [PATCH] ALSA: pcm: add context section for documentation about period-elapsed kernel APIs This commit fulfils documentation of period-elapsed kernel APIs with their context section. Signed-off-by: Takashi Sakamoto --- sound/core/pcm_lib.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c index 7d5883432085..5d28d63a3216 100644 --- a/sound/core/pcm_lib.c +++ b/sound/core/pcm_lib.c @@ -1803,6 +1803,10 @@ EXPORT_SYMBOL(snd_pcm_lib_ioctl); * - .get_time_info - to retrieve audio time stamp if needed. * * Even if more than one periods have elapsed since the last call, you have to call this only once. + * + * Context: Any context in which lock of PCM substream is already acquired. The function may not + * sleep by ALSA PCM core. The function may sleep in the above callbacks by driver which should + * configures PCM device for it (@snd_pcm.nonatomic). */ void snd_pcm_period_elapsed_under_stream_lock(struct snd_pcm_substream *substream) { @@ -1836,6 +1840,10 @@ EXPORT_SYMBOL(snd_pcm_period_elapsed_under_stream_lock); * It's typically called by any type of IRQ handler when hardware IRQ occurs to notify event that * the batch of audio data frames as the same size as the period of buffer is already processed in * audio data transmission. + * + * Context: Any context in which lock of PCM substream is not acquired yet. It depends on + * configuration of PCM device (@snd_pcm.nonatomic) by driver whether the function may or may not + * sleep by operating lock of PCM substream. */ void snd_pcm_period_elapsed(struct snd_pcm_substream *substream) { -- 2.27.0 ======== 8< -------- Thanks Takashi Sakamoto