From mboxrd@z Thu Jan 1 00:00:00 1970 From: neidhard.kim@lge.com (Jongsung Kim) Date: Mon, 12 Oct 2015 14:30:39 +0900 Subject: [PATCH] ARM:mm: fix kmap_atomic_to_page In-Reply-To: <20151007090121.GC21513@n2100.arm.linux.org.uk> References: <1444129773-12632-1-git-send-email-chanho.min@lge.com> <20151006192836.GX21513@n2100.arm.linux.org.uk> <5614979C.30100@lge.com> <20151007090121.GC21513@n2100.arm.linux.org.uk> Message-ID: <561B457F.5090104@lge.com> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org We tried to utilize a HW compressor as a zram backend. Current zram uses kmap_atomic to map a page, and the HW DMAes. So we needed to use kmap_atomic_to_page to get the page to be dma-mapped. On 10/07/2015 06:01 PM, Russell King - ARM Linux wrote: > On Wed, Oct 07, 2015 at 12:55:08PM +0900, Jongsung Kim wrote: >> Recently, we made a driver utilizing kmap_atomic_to_page. Of course, >> it's not mainlined. People may be using it outside mainline just like us. > Since kmap_atomic() mappings are supposed to be short-lived, why do you > need it in your driver? Don't you already have the struct page pointer > when setting up the kmap_atomic() mapping? > > It is invalid to setup a mapping, and leave it setup across any context > switching or similar. > > Also, kmap_atomic_to_page() is not exported to modules, so you can only > use it when built-in. > >> vmalloc has vmalloc_to_page, pkmap has kmap_to page, and fixmap has >> kmap_atomic_to_page. Then.. how about letting virt_to_page do them all? > No. virt_to_page() is defined to only work on the lowmem mapping, and > that's not going to change. > > Please show the outline of your code making use of this function so we > can better understand your use case. > From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751235AbbJLFbu (ORCPT ); Mon, 12 Oct 2015 01:31:50 -0400 Received: from LGEAMRELO12.lge.com ([156.147.23.52]:56674 "EHLO lgeamrelo12.lge.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750729AbbJLFbt (ORCPT ); Mon, 12 Oct 2015 01:31:49 -0400 X-Original-SENDERIP: 156.147.1.126 X-Original-MAILFROM: neidhard.kim@lge.com X-Original-SENDERIP: 10.178.37.74 X-Original-MAILFROM: neidhard.kim@lge.com Subject: Re: [PATCH] ARM:mm: fix kmap_atomic_to_page To: Russell King - ARM Linux References: <1444129773-12632-1-git-send-email-chanho.min@lge.com> <20151006192836.GX21513@n2100.arm.linux.org.uk> <5614979C.30100@lge.com> <20151007090121.GC21513@n2100.arm.linux.org.uk> Cc: Nicolas Pitre , Chanho Min , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Gunho Lee From: Jongsung Kim Message-ID: <561B457F.5090104@lge.com> Date: Mon, 12 Oct 2015 14:30:39 +0900 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: <20151007090121.GC21513@n2100.arm.linux.org.uk> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We tried to utilize a HW compressor as a zram backend. Current zram uses kmap_atomic to map a page, and the HW DMAes. So we needed to use kmap_atomic_to_page to get the page to be dma-mapped. On 10/07/2015 06:01 PM, Russell King - ARM Linux wrote: > On Wed, Oct 07, 2015 at 12:55:08PM +0900, Jongsung Kim wrote: >> Recently, we made a driver utilizing kmap_atomic_to_page. Of course, >> it's not mainlined. People may be using it outside mainline just like us. > Since kmap_atomic() mappings are supposed to be short-lived, why do you > need it in your driver? Don't you already have the struct page pointer > when setting up the kmap_atomic() mapping? > > It is invalid to setup a mapping, and leave it setup across any context > switching or similar. > > Also, kmap_atomic_to_page() is not exported to modules, so you can only > use it when built-in. > >> vmalloc has vmalloc_to_page, pkmap has kmap_to page, and fixmap has >> kmap_atomic_to_page. Then.. how about letting virt_to_page do them all? > No. virt_to_page() is defined to only work on the lowmem mapping, and > that's not going to change. > > Please show the outline of your code making use of this function so we > can better understand your use case. >