Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3377173pxb; Mon, 17 Jan 2022 19:02:21 -0800 (PST) X-Google-Smtp-Source: ABdhPJxPa9+rn19sHsyQATcHzg1QxvLzDETtIvTjwP/0pthYoq7xoHs/QclE43kQjw5UXzCXtPsH X-Received: by 2002:a17:90b:1a84:: with SMTP id ng4mr6974775pjb.237.1642474941378; Mon, 17 Jan 2022 19:02:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642474941; cv=none; d=google.com; s=arc-20160816; b=t3WxgMUtNEi/8271TvlEKWs27i2O7Xw3BuODEY927jjm572Am4aLxCCOsWMRsdegUl M4Qrv/vsRWxUFINcRZ3/4IZdc506dNw8lvaMkyAXafElHtml/WPeyR4Kf99GBhYhS+o9 bU63Q7JEncB68vg7vCbFgg0/19LF2/CW1TOHQewEiHL6qgeDkHz0KgH5cWFHpoDmLoiq jb+pXOKET2uUpg4wU/BHaUDgMaMQgA5Nnp6EoPW0dBuuVoc0e8rMchYkVWT+hJThRZSR yQ/yZsg8BwLQ0gAfdau81gbnWkpi8/NjQq1b11ChKcWOSEbvoYTsTEOq+jcNpQi7ehzb n3QQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:in-reply-to :subject:cc:to:from:message-id:date:dkim-signature:dkim-signature; bh=VMmfVtWZfJayBoRg9IT/rKNycU3qQzjET9EY7uXPW80=; b=UhE9z5pSNYDGLGNUdWCBbbuw7rZ3WkSH1xQLr4u1pW4MhA9Wz/0lFcrKLRTKwOi8Q0 6bF6Lkre++Mp3sHN7h1ZCl3kkxVl0xMkQeciWQWziKL1tjpW6O51jmXfb9luYbY1cJqJ sEacORxogZ/btOTaLvrLDrIOqHGcdyFKDGUwPq14hVYnNTOzserqH3BQdVX32bwknO8n uMO7W+sLGn4bSEYakipW9Cvku0Y6bKyMVvCzIpznwNoV8uROS0YYgvfwsF3/r//6yUXN KPFZfm3FikgZ0d6u0IjeypQSVvo4hCMzpBtzzTesUUfiHgPsdqs2tJ7Fq8VEDupV+g5k mOlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=kbzExjsp; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l3si16662172pgp.689.2022.01.17.19.02.09; Mon, 17 Jan 2022 19:02:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=kbzExjsp; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239334AbiAQT4d (ORCPT + 99 others); Mon, 17 Jan 2022 14:56:33 -0500 Received: from smtp-out1.suse.de ([195.135.220.28]:48414 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231292AbiAQT4c (ORCPT ); Mon, 17 Jan 2022 14:56:32 -0500 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 86BC6212BB; Mon, 17 Jan 2022 19:56:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1642449391; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=VMmfVtWZfJayBoRg9IT/rKNycU3qQzjET9EY7uXPW80=; b=kbzExjsp4JpeHHwIZRJCubyF/IB1E/jmZSzeeILWAnQH75/TrSKIkX74WmASeiVmpn5j0b hYDbjjAU6EWNB287GSpgmzFMmPDLrQfUA6QaUP12xZqZCMi3vm+3npNuDXdwWjslx5Z16T b9JchkTF2qrH3GZiAWqLpKUcBYBjFiQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1642449391; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=VMmfVtWZfJayBoRg9IT/rKNycU3qQzjET9EY7uXPW80=; b=IoKUbUflFJ6ZUB0IbLwWutrHc8uD1YJs4aDa5zqZ0YgZQ83wjCIxiIon5vDtG3qOTxXi8o 3fbo1HrBdYEh5zBQ== Received: from alsa1.suse.de (alsa1.suse.de [10.160.4.42]) by relay2.suse.de (Postfix) with ESMTP id 70B04A3B84; Mon, 17 Jan 2022 19:56:31 +0000 (UTC) Date: Mon, 17 Jan 2022 20:56:31 +0100 Message-ID: From: Takashi Iwai To: Pierre-Louis Bossart Cc: Christophe JAILLET , alsa-devel@alsa-project.org, Kai Vehmanen , Liam Girdwood , linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Ranjani Sridharan , Takashi Iwai , Mark Brown , Bard Liao Subject: Re: [PATCH] ASoC: soc-pcm: use GFP_ATOMIC in dpcm_create_debugfs_state() In-Reply-To: References: 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") Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 17 Jan 2022 18:11:42 +0100, Pierre-Louis Bossart wrote: > > > > On 1/17/22 2:49 AM, Takashi Iwai wrote: > > On Sun, 16 Jan 2022 12:18:17 +0100, > > Christophe JAILLET wrote: > >> > >> The commit below states that dpcm_be_connect() may be called from atomic > >> context. It changes a GFP_KERNEL into a GFP_ATOMIC to deal with it. > >> > >> Another memory allocation is done in dpcm_create_debugfs_state() which is > >> called by dpcm_be_connect(). Also use GFP_ATOMIC there to be consistent > >> and be compliant with atomic context. > >> > >> Fixes: d8a9c6e1f676 ("ASoC: soc-pcm: use GFP_ATOMIC for dpcm structure") > >> Signed-off-by: Christophe JAILLET > >> --- > >> Not clear to me how dpcm_be_connect() can be called from an atomic context, > >> though. But better safe than sorry. > > > > I don't think this no longer valid for the very latest code. > > The commit b7898396f4bb dropped the spurious dpcm_lock spinlock, so > > the code path you touched must be always sleepable. > > > > Similarly, the commit d8a9c6e1f676 can be reverted now. > > Can we really revert d8a9c6e1f676? > > We did propagate the non-atomic FE property to the BE, but if both FE > and BE are both atomic that constraint would be required, no? At the kzalloc() call in dpcm_be_connect, there is no spin lock involved. It's merely protected by card->pcm_mutex, instead. The spinlock is applied at the later call with snd_soc_pcm_stream_lock_irq() only for the list manipulations. (See it's *_irq(), not *_irqsave(); that means the context being sleepable at that point.) So, we can use GFP_KERNEL safely there. GFP_ATOMIC was needed in the past where dpcm_be_connect() itself is called in dpcm_lock spinlock. It was removed recently. Takashi > > > > > > thanks, > > > > Takashi > > > >> --- > >> sound/soc/soc-pcm.c | 2 +- > >> 1 file changed, 1 insertion(+), 1 deletion(-) > >> > >> diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c > >> index 7abfc48b26ca..1a536a2b9dc3 100644 > >> --- a/sound/soc/soc-pcm.c > >> +++ b/sound/soc/soc-pcm.c > >> @@ -212,7 +212,7 @@ static void dpcm_create_debugfs_state(struct snd_soc_dpcm *dpcm, int stream) > >> { > >> char *name; > >> > >> - name = kasprintf(GFP_KERNEL, "%s:%s", dpcm->be->dai_link->name, > >> + name = kasprintf(GFP_ATOMIC, "%s:%s", dpcm->be->dai_link->name, > >> stream ? "capture" : "playback"); > >> if (name) { > >> dpcm->debugfs_state = debugfs_create_dir( > >> -- > >> 2.32.0 > >> >