From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BE9663793B8 for ; Thu, 8 Jan 2026 08:38:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.118.77.11 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767861497; cv=none; b=fDQgLud348n67vDa2y2YLAmH4lSMwsXpbLl4PE3aYNdbcqPkajCnDHcJznQlP1Il0OLBOZn9IpMQG1s+WSEH5YZw6CMz/Mgm6DBr/PyjpZnuAjLP1pHOxdtHvqt62qzHk9Wacg3wg/b0FIM3DaAHMCqXqnN9Z2bw277nXt0ovxU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767861497; c=relaxed/simple; bh=u8OWxiSZNBybma2krIYghSGX96zoLPTn+4X9CK59iRw=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:From:In-Reply-To: Content-Type:References; b=oOe9dJIo3oySZJxc6xVkQSKBBMTGY58R3hPw9Hv9WReClUF7yVFswnM35rhtbEszePTHyptpE96hrGYDxdd9g8tMMqrOM3GObgtqW7jhyRlJtq/iYWQ0Z6j/dT66zmLpJB1q/Mn29BhYvE8pgzQxsdBLvSzVgKZ3arzVpzf8S1I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com; spf=pass smtp.mailfrom=samsung.com; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b=VLAlD4+G; arc=none smtp.client-ip=210.118.77.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=samsung.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="VLAlD4+G" Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20260108083807euoutp01443bc7bae76ff02754c3f24173ec96e2~ItKgUIPrt2775027750euoutp01L for ; Thu, 8 Jan 2026 08:38:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20260108083807euoutp01443bc7bae76ff02754c3f24173ec96e2~ItKgUIPrt2775027750euoutp01L DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1767861487; bh=B8lQjdPHzwY5BW+8DVEc7GDTLuJ804s2dZgdDbIbuNw=; h=Date:Subject:To:Cc:From:In-Reply-To:References:From; b=VLAlD4+Gz6jgXM6GgsCe1KfORg0MRmgsZmUq+MJ65uH/fYxC6J6nna9uaoWlt3/OK YVnYMU2zV8JwFN3PHVK4l2uTw2malOdWURY1tDTdBQ0t10RjYGUdkvqF36TQmrazY1 OzncowCWkAWvAIG0D5xgcc1dyCe7Gd9OrIHFlVlk= Received: from eusmtip1.samsung.com (unknown [203.254.199.221]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20260108083807eucas1p1d3bd759adeb14c6fea800476ae33563d~ItKgGTuT71760717607eucas1p1G; Thu, 8 Jan 2026 08:38:07 +0000 (GMT) Received: from [106.210.134.192] (unknown [106.210.134.192]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20260108083806eusmtip1635c3e2a5b95dfd047d9196a94ceb056~ItKfiuTiH2688626886eusmtip1M; Thu, 8 Jan 2026 08:38:06 +0000 (GMT) Message-ID: <94dae28d-82ae-4340-9abd-097e2d08fb9f@samsung.com> Date: Thu, 8 Jan 2026 09:38:06 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Betterbird (Windows) Subject: Re: [PATCH] dma-direct: Skip cache prep for HighMem coherent allocations To: "Aneesh Kumar K.V (Arm)" , iommu@lists.linux.dev, linux-kernel@vger.kernel.org, Arnd Bergmann Cc: Robin Murphy , Linus Walleij , Matthew Wilcox , Suzuki K Poulose Content-Language: en-US From: Marek Szyprowski In-Reply-To: <20260102155118.2551804-1-aneesh.kumar@kernel.org> Content-Transfer-Encoding: 7bit X-CMS-MailID: 20260108083807eucas1p1d3bd759adeb14c6fea800476ae33563d X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20260102155138eucas1p1563e460256561f6974079d3de733e895 X-EPHeader: CA X-CMS-RootMailID: 20260102155138eucas1p1563e460256561f6974079d3de733e895 References: <20260102155118.2551804-1-aneesh.kumar@kernel.org> On 02.01.2026 16:51, Aneesh Kumar K.V (Arm) wrote: > dma_direct_alloc() calls arch_dma_prep_coherent() to clean any dirty > cache lines from the kernel linear alias before creating a coherent > remapping. > > HighMem pages have no kernel alias mapping, so there are no alias cache > lines to clean. Skip arch_dma_prep_coherent() for HighMem allocations. > > Signed-off-by: Aneesh Kumar K.V (Arm) Indeed this is an overhead to call prep for HighMem pages, but on the other hand highmem support is being phased out according to https://lwn.net/ml/all/20251219161559.556737-1-arnd@kernel.org/ Does it make sense to apply this assuming that it will be removed soon? > --- > kernel/dma/direct.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/kernel/dma/direct.c b/kernel/dma/direct.c > index 50c3fe2a1d55..ffa267020a1e 100644 > --- a/kernel/dma/direct.c > +++ b/kernel/dma/direct.c > @@ -272,7 +272,8 @@ void *dma_direct_alloc(struct device *dev, size_t size, > prot = pgprot_decrypted(prot); > > /* remove any dirty cache lines on the kernel alias */ > - arch_dma_prep_coherent(page, size); > + if (!PageHighMem(page)) > + arch_dma_prep_coherent(page, size); > > /* create a coherent mapping */ > ret = dma_common_contiguous_remap(page, size, prot, Best regards -- Marek Szyprowski, PhD Samsung R&D Institute Poland