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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 48B95C32771 for ; Mon, 26 Sep 2022 06:58:49 +0000 (UTC) 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 93887F3; Mon, 26 Sep 2022 08:57:57 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 93887F3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1664175527; bh=8r23R9X27jYrnHl5Gblxk/D/ddqTMH3K5AFcSwzmpg4=; h=Date:From:To:Subject:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=YTdVL1zev+r7U3SzCVIMGEVUgA/Q3dMAF3tBPH0HmAr/ADMi2gaQm6whT7Ofw6tLp iQi4zW6m6UIW8U1p/u0N/7IK0fxY2vAZukuiEQMcGpg8K0O2svxU96WBzsB9Dd46xe N4egmGx5EAkBfraViyeXzWSMz+yxRL7LRScGNLcw= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 23C18F80254; Mon, 26 Sep 2022 08:57:57 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 4F1E2F8027D; Mon, 26 Sep 2022 08:57:56 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 40DEAF80134 for ; Mon, 26 Sep 2022 08:57:49 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 40DEAF80134 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="NURtnkYS"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="Yg/WIRxV" Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 73E5D1FD5A; Mon, 26 Sep 2022 06:57:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1664175469; 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=HvGCRGblRKqpczkrIBa7Na5EeRjeE58QYEnKaH9ObVs=; b=NURtnkYSZIhB7Awx1bD/T0wr0VeOK1gcVWLKvMq9LRumyybIzaT50jNuYXB6eYJ0Rz9Zre bd8MPc4CgwFLebd1retvi13nbraZsIZFq37T4MEW9YcVz7otNlTb73Pt5RrnZKj9W48Y6m KCXH+UG+cpSNd3q5RfVzSg57YRx++kU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1664175469; 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=HvGCRGblRKqpczkrIBa7Na5EeRjeE58QYEnKaH9ObVs=; b=Yg/WIRxVtDcjzyM0tiL+O8cD2pf0ETwMAeD682VT8GCTLxZo9nkn/kF3AcRqmnGclSp7kv 6fhJz0lslqQjOVDg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 2E32713486; Mon, 26 Sep 2022 06:57:49 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id NbHdCG1NMWNkLAAAMHmgww (envelope-from ); Mon, 26 Sep 2022 06:57:49 +0000 Date: Mon, 26 Sep 2022 08:57:48 +0200 Message-ID: <877d1q4o7n.wl-tiwai@suse.de> From: Takashi Iwai To: Kai Vehmanen Subject: Re: [PATCH] ALSA: memalloc: use __GFP_RETRY_MAYFAIL for DMA mem allocs In-Reply-To: <20220923153501.3326041-1-kai.vehmanen@linux.intel.com> References: <20220923153501.3326041-1-kai.vehmanen@linux.intel.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) Emacs/27.2 Mule/6.0 MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII Cc: alsa-devel@alsa-project.org, peter.ujfalusi@linux.intel.com, Pierre-Louis Bossart 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" On Fri, 23 Sep 2022 17:35:01 +0200, Kai Vehmanen wrote: > > Use __GFP_RETRY_MAYFAIL instead of __GFP__NORETRY in > snd_dma_dev_alloc(), snd_dma_wc_alloc() and friends, to allocate pages > for device memory. The MAYFAIL flag retains the semantics of not > triggering the OOM killer, but lowers the risk of alloc failure. > > MAYFAIL flag was added in commit dcda9b04713c3 ("mm, tree wide: replace > __GFP_REPEAT by __GFP_RETRY_MAYFAIL with more useful semantic"). > > This change addresses recurring failures with SOF audio driver in test > cases where a system suspend-resume stress test is run, combined with an > active high memory-load use-case. The failure typically shows up as: > > [ 379.480229] sof-audio-pci-intel-tgl 0000:00:1f.3: booting DSP firmware > [ 379.484803] sof-audio-pci-intel-tgl 0000:00:1f.3: error: memory alloc failed: -12 > [ 379.484810] sof-audio-pci-intel-tgl 0000:00:1f.3: error: dma prepare for ICCMAX stream failed > > Multiple fixes to reduce the memory usage of DSP boot have been > identified in SOF driver, but even with those fixes, debug on affected > systems has shown that even a single page alloc may fail with > __GFP_NORETRY. When this occurs, system is under significant load on > physical memory, but a lot of reclaimable pages are available, so the > system has not run out of memory. With __GFP_RETRY_MAYFAIL, the errors > are not hit in these stress tests. > > The alloc failure is severe as audio capability is completely lost if > alloc failure is hit at system resume. > > An alternative solution was considered where the resources for DSP boot > would be kept allocated until driver is unbound. This would avoid the > allocation failure, but consume memory that is only needed temporarily > at probe and resume time. It seems better to not hang on to the memory, > but rather work a bit harder for allocating the pages at resume. > > BugLink: https://github.com/thesofproject/linux/issues/3844 > Signed-off-by: Kai Vehmanen > Reviewed-by: Pierre-Louis Bossart Thanks, applied. Takashi