From patchwork Mon Feb 21 08:49:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 544701 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 54AD6C43217 for ; Mon, 21 Feb 2022 09:52:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352046AbiBUJws (ORCPT ); Mon, 21 Feb 2022 04:52:48 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:42568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351948AbiBUJu7 (ORCPT ); Mon, 21 Feb 2022 04:50:59 -0500 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 34B9635DC4; Mon, 21 Feb 2022 01:22:50 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 98485CE0E99; Mon, 21 Feb 2022 09:22:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 84606C340E9; Mon, 21 Feb 2022 09:22:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1645435366; bh=xfTfLuBCLxsgTOACm1b1I3fjPekjhfu0XQvZqy8k79U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JmLk2liX8zhN01ktOv8l/sVSPUANJJyLJEKI8qUMdHv6fA9ddW0+oy7ZvL8tnwVGI zwQNm4JV0FORBjiD0l9yErD+M8DcByh6nIGQkJq1cNk3b43sd3OzG8v2e+m6+UE6od 1B76DyZ1UPHUKQLQ27qI+m5w/SfFpZqLt/Vf93a8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ezequiel Garcia , Takashi Iwai Subject: [PATCH 5.16 138/227] ALSA: memalloc: invalidate SG pages before sync Date: Mon, 21 Feb 2022 09:49:17 +0100 Message-Id: <20220221084939.433297721@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220221084934.836145070@linuxfoundation.org> References: <20220221084934.836145070@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Takashi Iwai commit 3e16dc50d77dc3494275a241fac250c94bf45206 upstream. It seems that calling invalidate_kernel_vmap_range() is more correct to be called before dma_sync_*(), judging from the other thread: https://lore.kernel.org/all/20220111085958.GA22795@lst.de/ Although this won't matter much in practice, let's fix the call order for consistency. Fixes: a25684a95646 ("ALSA: memalloc: Support for non-contiguous page allocation") Reported-by: Ezequiel Garcia Cc: Link: https://lore.kernel.org/r/20220210123344.8756-3-tiwai@suse.de Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman --- sound/core/memalloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/sound/core/memalloc.c +++ b/sound/core/memalloc.c @@ -541,9 +541,9 @@ static void snd_dma_noncontig_sync(struc if (mode == SNDRV_DMA_SYNC_CPU) { if (dmab->dev.dir == DMA_TO_DEVICE) return; + invalidate_kernel_vmap_range(dmab->area, dmab->bytes); dma_sync_sgtable_for_cpu(dmab->dev.dev, dmab->private_data, dmab->dev.dir); - invalidate_kernel_vmap_range(dmab->area, dmab->bytes); } else { if (dmab->dev.dir == DMA_FROM_DEVICE) return;