Received: by 10.192.165.156 with SMTP id m28csp444133imm; Wed, 11 Apr 2018 01:31:53 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+E4KoPN6GGVugQZyl3abRMD1iDtZ6kobLMv6bSS/xZPIVhCeG5agQKmr0Muhp5//6kU4XH X-Received: by 10.99.117.91 with SMTP id f27mr2738601pgn.108.1523435513082; Wed, 11 Apr 2018 01:31:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523435513; cv=none; d=google.com; s=arc-20160816; b=S4L82Xi9WtdEnn+Nac/XcuhfnrZxzzhe51BY0vfozTEAUiM2t0qyjpQiMddIgCzXqJ Tn3kMk3hwRx8PY+pnmruEhpPwSxg7FzX7tAMMNTjQme2f5bLS3m60Mc/qLko6gG/7LNR LmJG1E7jhzJRcHi5jp2fDJ5/lbmOrhVQeO5aRGIjzPL54BWS8L2A8z5cwfRJISbaJcyw G8Bx/pPug6uYoJYlPtn5pgxUV1GEGVh4tJdKIoutkNI3Ab8hhYiwLMsQjwUQ86vozHpD JFzg7AqJ2WLFhe+cyI2x+ehLtoya7tes5E7prsFbSsGYdcA/X96t92Rnv9OXAazUDli7 +8HA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=CuHe+AoGEx2AFaN71Td/hWoxW4zNzc7XwOvI6RFBeoE=; b=HDNAEZGDo+gel2LU6tiBfYdcagX9CuayuVjLDwW9TPBa05TKseLgU45JkX/TWJn0jQ LbB+49ubzG020hlIYC8XYTVhq1lWMDJtu9Z7/zBMFcsnSe97R6vodkMaK//ITWbCEOGH QH5ViXvAQ+B/TUrVKuEZt2umI4j8I9u5f+j2ylVT52TUYcs4lRyRNnmExvtRBvZZdqZ6 hmk0dzOtlaINp8b0rzQyDU/Wvo9FCDFP67LrwzIM0sWk2Ec1MyUG9KTLbTB9CH/zg3b1 tm12lQz590r1+4fGcOv6ZJP/Qa9fATqwMdpU9JvBcYSIXalMIl1X4Af3MRKkXIxSRNzf uI1Q== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z85si517660pfk.194.2018.04.11.01.31.16; Wed, 11 Apr 2018 01:31: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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751972AbeDKI14 (ORCPT + 99 others); Wed, 11 Apr 2018 04:27:56 -0400 Received: from eddie.linux-mips.org ([148.251.95.138]:56560 "EHLO cvs.linux-mips.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751841AbeDKI1v (ORCPT ); Wed, 11 Apr 2018 04:27:51 -0400 Received: (from localhost user: 'ladis' uid#1021 fake: STDIN (ladis@eddie.linux-mips.org)) by eddie.linux-mips.org id S23990434AbeDKI1sw0qfO (ORCPT + 1 other); Wed, 11 Apr 2018 10:27:48 +0200 Date: Wed, 11 Apr 2018 10:27:46 +0200 From: Ladislav Michl To: Boris Brezillon Cc: Andreas Kemnade , Discussions about the Letux Kernel , Boris Brezillon , Aaro Koskinen , Tony Lindgren , Linux Kernel Mailing List , Peter Ujfalusi , linux-omap , Roger Quadros Subject: Re: [Letux-kernel] [Bug]: mtd: onenand: omap2plus: kernel panic with OneNAND on OMAP3 (DM3730) device GTA04A5 Message-ID: <20180411082746.GA20164@lenoch> References: <5D496D5C-4E3E-47B4-9981-E8F4C348DE00@goldelico.com> <20180410205643.GA2228@lenoch> <20180411065836.7e1bfc3f@aktux> <20180411062607.GA9179@lenoch> <20180411091528.4e954c32@bbrezillon> <20180411073655.GA18273@lenoch> <20180411100806.3c09bafc@bbrezillon> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180411100806.3c09bafc@bbrezillon> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 11, 2018 at 10:08:06AM +0200, Boris Brezillon wrote: > On Wed, 11 Apr 2018 09:36:56 +0200 > Ladislav Michl wrote: > > > Hi Boris, > > > > On Wed, Apr 11, 2018 at 09:15:28AM +0200, Boris Brezillon wrote: [...] > > > Not sure this approach is safe on all archs: if the cache is VIVT or > > > VIPT, you may have several entries pointing to the same phys page, and > > > then, when dma_map_page() does its cache maintenance operations, it's > > > only taking one of these entries into account. > > > > Hmm, I used the same approach Samsung OneNAND driver does since commit > > dcf08227e964a53a2cb39130b74842c7dcb6adde. > > Both TI OMAP3630 and Samsung S5PC110 are using Cortex-A8 which > > is VIPT. In that case samsung's driver code has the same problem. > > > > > In other parts of the MTD subsystem, we tend to not do DMA on buffers > > > that have been vmalloc-ed. > > > > > > You can do something like > > > > > > if (virt_addr_valid(buf)) > > > /* Use DMA */ > > > else > > > /* > > > * Do not use DMA, or use a bounce buffer > > > * allocated with kmalloc > > > */ > > > > Okay, I'll use this approach then, but first I'd like to be sure above is > > correct. Anyone? > > See this discussion [1]. The problem came up a few times already, so > might find other threads describing why it's not safe. > > [1]https://lists.linuxfoundation.org/pipermail/iommu/2016-March/016240.html Question was more likely whenever there might exist more that one mapping of the same page. But okay, I'll disable DMA for highmem. Patch will follow. ladis