Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp4160779imm; Mon, 14 May 2018 03:35:53 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqqQtXbSTw6KkVQr8k76/rOz5e1ZBA0DLDdjVLXPPv5d8dL3wyj27NbuJz7iDpdWEVoAnfK X-Received: by 2002:a65:48c9:: with SMTP id o9-v6mr8213360pgs.106.1526294153115; Mon, 14 May 2018 03:35:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526294153; cv=none; d=google.com; s=arc-20160816; b=JfVZnQ3fAlIYVZWv1EZ2hJsQPRmb/j1gdof/Go5iRPvH1HiZpSoWUUFbsMfctpuRLm VwmeTxR3dpTu0kdSe6p3M6viwdsjWaJLHZqDOkGpuPH/vKsxd0IB63B4f8h23mbF8G26 hOzWHttz6AeES/TB9WFF277D1s3lbmStrFycOVnnb2h5wWyDEPaWfaAk/OKE3TvCY7S4 k/q21yfG1KIbkq2unEzLxW6+Q8o20mIzCH+Zz4Is3wk/ov2kf0sPLMjN2etySuICR/8B 8s0lEtpuHVQEnRmtXJBfIbQLoWUL2ePr8rw5rfdbebdDtTcTRjL0AXk1yNsGxXOzqizX nmXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature:arc-authentication-results; bh=Mo984DYu6Ur1H4xrcEXVMF9PmyyatYfJzVtrR+dcfns=; b=HPS4Pv6+TnHEkq9ycVFTgSgoMT3zb1pIarJjk+XzXwGu0Z38H3eUP6s6StvTAU6K9V ck0ScPRCX2YFrYip3F3340rsw4+grwU2aTRFBojcpb24i09/jLkUgEEIl0aKyxc0h8iu m4VLuaTdGsygR8gAMmshJzp+bjs73aAiXIYkW9Vm4etoPMqYAD6rzi1KVH9ZfEmG2Clv jMKCVcFLwkcpT3Kz6Tf2DJubj8DLeXwWYvg3JRGQ+pOkjsGGnqdrcGPlgwkxPgKazLZo TZHxreYhLRajoBXvNSGvw4KxM4uAVDLCMvGW5tffmhlz9sZtKQjjWS7YYiIVRfGH3SR4 F8xw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=Ucb+UJJd; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e203-v6si9357924pfh.86.2018.05.14.03.35.37; Mon, 14 May 2018 03:35:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=Ucb+UJJd; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752207AbeENKfX (ORCPT + 99 others); Mon, 14 May 2018 06:35:23 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:52060 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751903AbeENKfT (ORCPT ); Mon, 14 May 2018 06:35:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Subject:Cc:To: From:Date:Sender:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=Mo984DYu6Ur1H4xrcEXVMF9PmyyatYfJzVtrR+dcfns=; b=Ucb+UJJdhIc/CzNPQcFsY/Gvn 4tZPlCrWMqxaFhVOCNqT+WCvJP1oIQw0oVIw3c+EsVi9zyhLsxVR/vOb8ZyZN8Zwi6O7Fo/GacM+j kEPf4wcNUXvMESZXNqNww/YlKH8774/dRtdU27NayO6cQkNWIEtpvCnnvPsAF8ka6LmvfCBoTpRv1 bMOq7nxHLGcIe54//py9u7/TB2pKsmGJ1Yq3K66QkxJXEidwQfpp8IXhPB/IudGdj5o3BO4KeJrAq 3wypARF8GWdO4VmHhC04vKhfbX1rBzfzHdQlIfnQ2gc1p6bbb4FsdHY5WVKCY4F0Jfs/cB6f6LHng 7+ssQg1VQ==; Received: from 177.17.233.3.dynamic.adsl.gvt.net.br ([177.17.233.3] helo=vento.lan) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fIAov-0001fe-0L; Mon, 14 May 2018 10:35:09 +0000 Date: Mon, 14 May 2018 07:35:03 -0300 From: Mauro Carvalho Chehab To: Fabien DESSENNE Cc: Laurent Pinchart , Jean Christophe TROTIN , Yasunari Takiguchi , Sakari Ailus , "Luis R. Rodriguez" , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" , "linux-media@vger.kernel.org" Subject: Re: Are media drivers abusing of GFP_DMA? - was: Re: [LSF/MM TOPIC NOTES] x86 ZONE_DMA love Message-ID: <20180514073503.3da05fc6@vento.lan> In-Reply-To: <547252fc-dc74-93c6-fc77-be1bfb558787@st.com> References: <20180426215406.GB27853@wotan.suse.de> <20180505130815.53a26955@vento.lan> <3561479.qPIcrWnXEC@avalon> <20180507121916.4eb7f5b2@vento.lan> <547252fc-dc74-93c6-fc77-be1bfb558787@st.com> X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.32; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Fabien, Em Mon, 14 May 2018 08:00:37 +0000 Fabien DESSENNE escreveu: > On 07/05/18 17:19, Mauro Carvalho Chehab wrote: > > Em Mon, 07 May 2018 16:26:08 +0300 > > Laurent Pinchart escreveu: > > > >> Hi Mauro, > >> > >> On Saturday, 5 May 2018 19:08:15 EEST Mauro Carvalho Chehab wrote: > >>> There was a recent discussion about the use/abuse of GFP_DMA flag when > >>> allocating memories at LSF/MM 2018 (see Luis notes enclosed). > >>> > >>> The idea seems to be to remove it, using CMA instead. Before doing that, > >>> better to check if what we have on media is are valid use cases for it, or > >>> if it is there just due to some misunderstanding (or because it was > >>> copied from some other code). > >>> > >>> Hans de Goede sent us today a patch stopping abuse at gspca, and I'm > >>> also posting today two other patches meant to stop abuse of it on USB > >>> drivers. Still, there are 4 platform drivers using it: > >>> > >>> $ git grep -l -E "GFP_DMA\\b" drivers/media/ > >>> drivers/media/platform/omap3isp/ispstat.c > >>> drivers/media/platform/sti/bdisp/bdisp-hw.c > >>> drivers/media/platform/sti/hva/hva-mem.c > > Hi Mauro, > > The two STI drivers (bdisp-hw.c and hva-mem.c) are only expected to run > on ARM platforms, not on x86. > Since this thread deals with x86 & DMA trouble, I am not sure that we > actually have a problem for the sti drivers. > > There are some other sti drivers that make use of this GFP_DMA flag > (drivers/gpu/drm/sti/sti_*.c) and it does not seem to be a problem. > > Nevertheless I can see that the media sti drivers depend on COMPILE_TEST > (which is not the case for the DRM ones). > Would it be an acceptable solution to remove the COMPILE_TEST dependency? This has nothing to do with either x86 or COMPILE_TEST. The thing is that there's a plan for removing GFP_DMA from the Kernel[1], as it was originally meant to be used only by old PCs, where the DMA controllers used only on the bottom 16 MB memory address (24 bits). IMHO, it is very unlikely that any ARM SoC have such limitation. [1] https://lwn.net/Articles/753273/ (article will be freely available on May, 17) Anyway, before the removal of GFP_DMA happens, I'd like to better understand why we're using it at media, and if we can, instead, set the DMA bit mask, just like almost all other media drivers that require to confine DMA into a certain range do. In the case of ARM, this is what we currently have: drivers/media/platform/exynos-gsc/gsc-core.c: vb2_dma_contig_set_max_seg_size(dev, DMA_BIT_MASK(32)); drivers/media/platform/exynos4-is/fimc-core.c: vb2_dma_contig_set_max_seg_size(dev, DMA_BIT_MASK(32)); drivers/media/platform/exynos4-is/fimc-is.c: vb2_dma_contig_set_max_seg_size(dev, DMA_BIT_MASK(32)); drivers/media/platform/exynos4-is/fimc-lite.c: vb2_dma_contig_set_max_seg_size(dev, DMA_BIT_MASK(32)); drivers/media/platform/mtk-mdp/mtk_mdp_core.c: vb2_dma_contig_set_max_seg_size(&pdev->dev, DMA_BIT_MASK(32)); drivers/media/platform/omap3isp/isp.c: ret = dma_coerce_mask_and_coherent(isp->dev, DMA_BIT_MASK(32)); drivers/media/platform/s5p-g2d/g2d.c: vb2_dma_contig_set_max_seg_size(&pdev->dev, DMA_BIT_MASK(32)); drivers/media/platform/s5p-jpeg/jpeg-core.c: vb2_dma_contig_set_max_seg_size(&pdev->dev, DMA_BIT_MASK(32)); drivers/media/platform/s5p-mfc/s5p_mfc.c: DMA_BIT_MASK(32)); drivers/media/platform/s5p-mfc/s5p_mfc.c: DMA_BIT_MASK(32)); drivers/media/platform/s5p-mfc/s5p_mfc.c: vb2_dma_contig_set_max_seg_size(dev, DMA_BIT_MASK(32)); > > BR > > Fabien > > >>> drivers/media/spi/cxd2880-spi.c > >>> > >>> Could you please check if GFP_DMA is really needed there, or if it is > >>> just because of some cut-and-paste from some other place? > >> I started looking at that for the omap3isp driver but Sakari beat me at > >> submitting a patch. GFP_DMA isn't needed for omap3isp. > >> > > Thank you both for looking into it. > > > > Regards, > > Mauro > > > > > > > > Thanks, > > Mauro Thanks, Mauro