Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1256019ybl; Fri, 23 Aug 2019 16:18:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqxUXmEFfcaw0BK88/eNqG+5jMKJgtiqt657HbzCii9dLqlOpHohUPO95qod96E4wF6/5gpJ X-Received: by 2002:a65:654d:: with SMTP id a13mr5983090pgw.196.1566602321779; Fri, 23 Aug 2019 16:18:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566602321; cv=none; d=google.com; s=arc-20160816; b=xoExnEOXeRIRBQVKtPtShAbIZzQICcmRyQKICo7Asmn+HfehUGmjnXq940u8TX5oK7 PXxVGW69MrOdj/fs2MrFxU0eqLVhD8C4pI6vFV9tdJbvMSTJzIxEUe62oAh/dvg5tIbK FAnkDybImPAAXTt60344Qfkywuqczk3CJK9H1e2VmGN4MzxVf04VofxM86KL5r+wAODO 5GLskQ7PpNJtS56hJe/sF/yt22afKDJ5cIlwfBaz7PTObz0WaKn0naF2UJpQI2ev2Gje iWrsfWURWB3Szbexpd7euomkYe0ZK2sfpDDp13KuPpsNxRUfgW9gJ+XZq9OOB2Nqe0LE 9HnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature:dkim-filter; bh=F471OW9t2ZS0Cr+hU6yK0V0fBRMBkYv4fz1YEoZsFCM=; b=x/VwmgXVpO3TR9gdRvuQXqLdbF6K4pYhNnKZwiyrFuLyzVOMY9Yx8KMmJri3b48rS5 2wGHJY5fQpbd+lWmz2/N+YByq3zUyPcsrBxZA+JEfRn8WkA0CJdgyAeNm6s01eN0WIyX H+jSahlxw1eg3GG21i+I60MTDNY5VvYDxpzkV42staTL14MgEb9tCQGiQ08KhJlVsoXi kcXYIK4FjQ0wgs3b8iqXmwg/xacQcd+tJ4UcxJ6LuR3L0hF6HmxYbUfKLug89rWKo6VO tUR5LZOpwJkUAsw2CIOh5Id9++UfBMlj95+Mvd3ff/EoWpwW5fVQZWtoJ7rR5AQf3hCi 4A6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=osxCFJBJ; 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 n8si2925636pgq.485.2019.08.23.16.18.26; Fri, 23 Aug 2019 16:18:41 -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=pass header.i=@nifty.com header.s=dec2015msa header.b=osxCFJBJ; 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 S2394712AbfHWMue (ORCPT + 99 others); Fri, 23 Aug 2019 08:50:34 -0400 Received: from conssluserg-02.nifty.com ([210.131.2.81]:27097 "EHLO conssluserg-02.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2394663AbfHWMu2 (ORCPT ); Fri, 23 Aug 2019 08:50:28 -0400 Received: from mail-vk1-f172.google.com (mail-vk1-f172.google.com [209.85.221.172]) (authenticated) by conssluserg-02.nifty.com with ESMTP id x7NCoNJK023800 for ; Fri, 23 Aug 2019 21:50:24 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-02.nifty.com x7NCoNJK023800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1566564624; bh=F471OW9t2ZS0Cr+hU6yK0V0fBRMBkYv4fz1YEoZsFCM=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=osxCFJBJaUFzQTJDoCHztEDBRLE7N0XtnUoH3PXS99RekTt4wCr2RR1ROZNA3kDzd eRpvE0Py4TqWo5v1GmaBUiAcvQApvW0/7rjI9ulX2PQui4SiVTo7JlhzBEHnGNAWfY ExWEGeAtnuXNAMOVq5MIIm4ulQUQJjR6Fij3KbaKWaA9FQaV2BBJUeR/v3QqmjafS9 927D43oFuOSAhogofEYm7dFcPqCE9smAq6lTLTG/7n3TiDVhgbEE89570+l5jBp1Kx 4hNbCwWH2W7sDN2pJhvXhEg4das+Kt+4NLXtDoKuy4VZy1hxGKOdm+GCEU70vS9HbN vxJ1eiwApo0aQ== X-Nifty-SrcIP: [209.85.221.172] Received: by mail-vk1-f172.google.com with SMTP id u203so2367699vku.3 for ; Fri, 23 Aug 2019 05:50:24 -0700 (PDT) X-Gm-Message-State: APjAAAXBHhiBfr731rtqIT/Anyqbiqh757MVvIdHwru6Z14VaXTtL6UC 3QkFdgK76ZwocOaZBELWcIfhEwo12A78y73uRuU= X-Received: by 2002:a1f:5dc2:: with SMTP id r185mr2256017vkb.64.1566564622689; Fri, 23 Aug 2019 05:50:22 -0700 (PDT) MIME-Version: 1.0 References: <20190506223334.1834-1-nicoleotsuka@gmail.com> <20190506223334.1834-3-nicoleotsuka@gmail.com> In-Reply-To: <20190506223334.1834-3-nicoleotsuka@gmail.com> From: Masahiro Yamada Date: Fri, 23 Aug 2019 21:49:46 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 2/2] dma-contiguous: Use fallback alloc_pages for single pages To: Nicolin Chen , Christoph Hellwig Cc: Robin Murphy , Marek Szyprowski , vdumpa@nvidia.com, Russell King , Catalin Marinas , Will Deacon , Chris Zankel , Max Filippov , Joerg Roedel , David Woodhouse , Tony Lindgren , Andrew Morton , Stephen Rothwell , Thierry Reding , Kees Cook , iamjoonsoo.kim@lge.com, Wolfram Sang , linux-arm-kernel , Linux Kernel Mailing List , linux-xtensa@linux-xtensa.org, iommu@lists.linux-foundation.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 7, 2019 at 7:36 AM Nicolin Chen wrote: > > The addresses within a single page are always contiguous, so it's > not so necessary to always allocate one single page from CMA area. > Since the CMA area has a limited predefined size of space, it may > run out of space in heavy use cases, where there might be quite a > lot CMA pages being allocated for single pages. > > However, there is also a concern that a device might care where a > page comes from -- it might expect the page from CMA area and act > differently if the page doesn't. > > This patch tries to use the fallback alloc_pages path, instead of > one-page size allocations from the global CMA area in case that a > device does not have its own CMA area. This'd save resources from > the CMA global area for more CMA allocations, and also reduce CMA > fragmentations resulted from trivial allocations. > > Signed-off-by: Nicolin Chen This commit (bd2e75633c8012fc8a7431c82fda66237133bf7e) broke the DMA for my MMC driver in the following way: [ 1.876755] mmc0: ADMA error [ 1.883385] mmc0: sdhci: ============ SDHCI REGISTER DUMP =========== [ 1.889834] mmc0: sdhci: Sys addr: 0x00000000 | Version: 0x00000002 [ 1.896284] mmc0: sdhci: Blk size: 0x00007200 | Blk cnt: 0x00000001 [ 1.902733] mmc0: sdhci: Argument: 0x00000000 | Trn mode: 0x00000013 [ 1.909182] mmc0: sdhci: Present: 0x01ff02f6 | Host ctl: 0x00000019 [ 1.915631] mmc0: sdhci: Power: 0x0000000b | Blk gap: 0x00000000 [ 1.922081] mmc0: sdhci: Wake-up: 0x00000000 | Clock: 0x0000fa07 [ 1.928530] mmc0: sdhci: Timeout: 0x0000000b | Int stat: 0x00000001 [ 1.934981] mmc0: sdhci: Int enab: 0x03ff008b | Sig enab: 0x03ff008b [ 1.941429] mmc0: sdhci: ACmd stat: 0x00000000 | Slot int: 0x00000001 [ 1.947880] mmc0: sdhci: Caps: 0x546ec800 | Caps_1: 0x00000000 [ 1.954329] mmc0: sdhci: Cmd: 0x0000083a | Max curr: 0x00000000 [ 1.960778] mmc0: sdhci: Resp[0]: 0x00000900 | Resp[1]: 0xffffffff [ 1.967229] mmc0: sdhci: Resp[2]: 0x320f5903 | Resp[3]: 0x3fd05e00 [ 1.973678] mmc0: sdhci: Host ctl2: 0x00000000 [ 1.978125] mmc0: sdhci: ADMA Err: 0x00000001 | ADMA Ptr: 0x000000013965b200 [ 1.985271] mmc0: sdhci: ============================================ [ 1.991758] mmc0: error -5 whilst initialising MMC card [ 1.991913] 43fb0000.uart: ttyS1 at MMIO 0x43fb0000 (irq = 0, base_baud = 768000) is a 16550A [ 2.011011] hctosys: unable to open rtc device (rtc0) [ 2.017694] Freeing unused kernel memory: 2368K [ 2.027131] Run /init as init process Starting syslogd: OK Starting klogd: OK Initializing random number generator... [ 2.074399] random: dd: uninitialized urandom read (512 bytes read) done. Starting network: OK [ 2.109593] mmc0: ADMA error [ 2.112488] mmc0: sdhci: ============ SDHCI REGISTER DUMP =========== [ 2.118941] mmc0: sdhci: Sys addr: 0x00000000 | Version: 0x00000002 [ 2.125389] mmc0: sdhci: Blk size: 0x00007200 | Blk cnt: 0x00000001 [ 2.131840] mmc0: sdhci: Argument: 0x00000000 | Trn mode: 0x00000013 [ 2.138289] mmc0: sdhci: Present: 0x01ff02f6 | Host ctl: 0x00000019 [ 2.144738] mmc0: sdhci: Power: 0x0000000b | Blk gap: 0x00000000 [ 2.151188] mmc0: sdhci: Wake-up: 0x00000000 | Clock: 0x00004e47 [ 2.157637] mmc0: sdhci: Timeout: 0x0000000b | Int stat: 0x00000001 [ 2.164087] mmc0: sdhci: Int enab: 0x03ff008b | Sig enab: 0x03ff008b [ 2.170536] mmc0: sdhci: ACmd stat: 0x00000000 | Slot int: 0x00000001 [ 2.176987] mmc0: sdhci: Caps: 0x546ec800 | Caps_1: 0x00000000 [ 2.183435] mmc0: sdhci: Cmd: 0x0000083a | Max curr: 0x00000000 [ 2.189886] mmc0: sdhci: Resp[0]: 0x00000900 | Resp[1]: 0xffffffff [ 2.196335] mmc0: sdhci: Resp[2]: 0x320f5903 | Resp[3]: 0x3fd05e00 [ 2.202784] mmc0: sdhci: Host ctl2: 0x00000000 [ 2.207232] mmc0: sdhci: ADMA Err: 0x00000001 | ADMA Ptr: 0x000000013965b200 [ 2.214379] mmc0: sdhci: ============================================ [ 2.220881] mmc0: error -5 whilst initialising MMC card Welcome to Buildroot buildroot login: [ 2.332786] mmc0: ADMA error [ 2.335668] mmc0: sdhci: ============ SDHCI REGISTER DUMP =========== [ 2.342119] mmc0: sdhci: Sys addr: 0x00000000 | Version: 0x00000002 [ 2.348568] mmc0: sdhci: Blk size: 0x00007200 | Blk cnt: 0x00000001 [ 2.355018] mmc0: sdhci: Argument: 0x00000000 | Trn mode: 0x00000013 [ 2.361468] mmc0: sdhci: Present: 0x01ff02f6 | Host ctl: 0x00000019 [ 2.367917] mmc0: sdhci: Power: 0x0000000b | Blk gap: 0x00000000 [ 2.374367] mmc0: sdhci: Wake-up: 0x00000000 | Clock: 0x0000f447 [ 2.380816] mmc0: sdhci: Timeout: 0x0000000b | Int stat: 0x00000001 [ 2.387267] mmc0: sdhci: Int enab: 0x03ff008b | Sig enab: 0x03ff008b [ 2.393716] mmc0: sdhci: ACmd stat: 0x00000000 | Slot int: 0x00000001 [ 2.400166] mmc0: sdhci: Caps: 0x546ec800 | Caps_1: 0x00000000 [ 2.406615] mmc0: sdhci: Cmd: 0x0000083a | Max curr: 0x00000000 [ 2.413065] mmc0: sdhci: Resp[0]: 0x00000900 | Resp[1]: 0xffffffff [ 2.419515] mmc0: sdhci: Resp[2]: 0x320f5903 | Resp[3]: 0x3fd05e00 [ 2.425963] mmc0: sdhci: Host ctl2: 0x00000000 [ 2.430412] mmc0: sdhci: ADMA Err: 0x00000001 | ADMA Ptr: 0x000000013965b200 [ 2.437557] mmc0: sdhci: ============================================ [ 2.444031] mmc0: error -5 whilst initialising MMC card [ 2.572203] mmc0: ADMA error [ 2.575089] mmc0: sdhci: ============ SDHCI REGISTER DUMP =========== [ 2.581540] mmc0: sdhci: Sys addr: 0x00000000 | Version: 0x00000002 [ 2.587989] mmc0: sdhci: Blk size: 0x00007200 | Blk cnt: 0x00000001 [ 2.594439] mmc0: sdhci: Argument: 0x00000000 | Trn mode: 0x00000013 [ 2.600889] mmc0: sdhci: Present: 0x01ef02f6 | Host ctl: 0x00000019 [ 2.607339] mmc0: sdhci: Power: 0x0000000b | Blk gap: 0x00000000 [ 2.613788] mmc0: sdhci: Wake-up: 0x00000000 | Clock: 0x0000e8c7 [ 2.620237] mmc0: sdhci: Timeout: 0x0000000b | Int stat: 0x00000001 [ 2.626686] mmc0: sdhci: Int enab: 0x03ff008b | Sig enab: 0x03ff008b [ 2.633137] mmc0: sdhci: ACmd stat: 0x00000000 | Slot int: 0x00000001 [ 2.639586] mmc0: sdhci: Caps: 0x546ec800 | Caps_1: 0x00000000 [ 2.646036] mmc0: sdhci: Cmd: 0x0000083a | Max curr: 0x00000000 [ 2.652485] mmc0: sdhci: Resp[0]: 0x00000900 | Resp[1]: 0xffffffff [ 2.658936] mmc0: sdhci: Resp[2]: 0x320f5903 | Resp[3]: 0x3fd05e00 [ 2.665384] mmc0: sdhci: Host ctl2: 0x00000000 [ 2.669832] mmc0: sdhci: ADMA Err: 0x00000001 | ADMA Ptr: 0x000000013965b200 [ 2.676979] mmc0: sdhci: ============================================ [ 2.683450] mmc0: error -5 whilst initialising MMC card CTRL-A Z for help | 115200 8N1 | NOR | Minicom 2.7.1 | VT102 | Offline | ttyUSB0 Reverting this commit fixed the problem. -- Best Regards Masahiro Yamada