From patchwork Tue Mar 26 23:01:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolin Chen X-Patchwork-Id: 10872291 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 41BE8139A for ; Tue, 26 Mar 2019 23:01:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2474128D92 for ; Tue, 26 Mar 2019 23:01:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 17F2B28DA0; Tue, 26 Mar 2019 23:01:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id BE7AA28D92 for ; Tue, 26 Mar 2019 23:01:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=D6CNlsUg4bX7BUJVfsII/6+kJFm7cUjV9Tef64mJ70c=; b=qpx iKXONdOl/h4S6yB8fG1GzW05BZ7+ylSgM2JrcFazgmv5JIlL0G7d9y6STunaRlsqPdtmOj6FNE+1+ sQPNWF9tfPjvsKtEvGVUQNXoqUBTrkyNFc+PX1eQ7fMn7PXwm9AZ5WjHYJBYSBwcO9F5Tezue0PYH wlL0bblbx+AmpoAeoUS3eU66CvbKGbscM4NiuMMbgdzZSa7rZgrbuclW2lvQ0fAcZRMKx8Oq7dIpt e0fWgtEMGN9hE1U2UvYCvQcxHvOSBfHWZBkBRfV+wU/m2uZcupS8SgxysCIe9eAE2qkTzF3N0GF+Q I+nj1dkn5QPHtVkiZ3mL9QqvUe+7P5g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1h8v4h-0001LG-B5; Tue, 26 Mar 2019 23:01:43 +0000 Received: from mail-pg1-x544.google.com ([2607:f8b0:4864:20::544]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h8v4d-0001KM-Ta for linux-arm-kernel@lists.infradead.org; Tue, 26 Mar 2019 23:01:41 +0000 Received: by mail-pg1-x544.google.com with SMTP id b12so8986424pgk.0 for ; Tue, 26 Mar 2019 16:01:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=q8Pr/WZyoSRwwYcP+AJJmuJCLQP4M/GYCHOXHFc/XBU=; b=u1gUE6g/MMeAL3lZXFEu4NW+kyF84y8rdUnQmz+Y2xKYD5xFIWPz1o32knDIgktGVJ hpPYLfaXaSoqOUCWilt9IbyDmXLxWniLlJKofk7yvoEAMZh1OQoQs1q6RimBHByeKTrQ hEq5gGcVzTfZnk0hOrQN0YHEddN5c6BnnBW9nC37Rfxnlg+7QdpIEiZge4ajjltRV8UR qJ2EpXcklesKJT+RIG/Tiec4nR5MqCfAEiZ2wABAwgtShHCbIq1DiX5XD0ni8acrxiYw prcQFjKyHjZSgbcUNNUzfWHsldHZskU8Na4WKci0NSvTC3SQUrRp+bFZNn6ooOBSvC2P YPaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=q8Pr/WZyoSRwwYcP+AJJmuJCLQP4M/GYCHOXHFc/XBU=; b=SdT7Jl8JZ5DUscphRQHLhSGLcCnuoosppZRfykie/H/A+ucN8PA56pV5zNfk1YHKdu +jhuZReXoftB9GBwN0o0KldYgvxVIPvzag/agnnDuP9rOk6iStKSQmL8bQaJcImlCqgP cRhaEkdTYQm99UQZ4fuWAzbD1aQNu/F4LzrDr7RdWEH9aEz77y3SjRc/JlqGRSRVoy3P cXgoFV0J5WKsl1+egA9GQamXt1xI7VTkMTrIKopxrbm7zXsz8oPQSDUBMpakcEvNpFFL Zs5goLhsFzxLVejqgxnHiDnzUqy33uWe3NKRY0Fef4eBFIAyYMcxH2Xkc5g9AyYQ1iZh gbiA== X-Gm-Message-State: APjAAAXisi8Ut4BdE+fieLAiKaBtnaKKpgYwPpMlcbaYgKIMW+1cRV2r VxOEWV8m7tHrcrczu6WWYoY= X-Google-Smtp-Source: APXvYqyMCFrLclHWQO0W0LxDCD8UegJz2hV2qvmfChZ9v6Uk7TKPwPf3fPSLo5OEG7+v4pYFJcmL1g== X-Received: by 2002:a62:1d90:: with SMTP id d138mr31810360pfd.232.1553641297832; Tue, 26 Mar 2019 16:01:37 -0700 (PDT) Received: from Asurada-Nvidia.nvidia.com (thunderhill.nvidia.com. [216.228.112.22]) by smtp.gmail.com with ESMTPSA id n24sm43832587pfi.123.2019.03.26.16.01.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Mar 2019 16:01:37 -0700 (PDT) From: Nicolin Chen To: hch@lst.de, robin.murphy@arm.com Subject: [PATCH v2 RFC/RFT 0/5] Save single pages from CMA area Date: Tue, 26 Mar 2019 16:01:26 -0700 Message-Id: <20190326230131.16275-1-nicoleotsuka@gmail.com> X-Mailer: git-send-email 2.17.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190326_160139_982043_5A989411 X-CRM114-Status: UNSURE ( 8.26 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: tony@atomide.com, catalin.marinas@arm.com, joro@8bytes.org, will.deacon@arm.com, linux@armlinux.org.uk, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, m.szyprowski@samsung.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This series of patches try to save single pages from CMA area bypassing all CMA single page alloctions and allocating normal pages instead, as all addresses within one single page are contiguous. We had once applied the PATCH-5 but reverted it as actually not all the callers handled the fallback allocations. Per Robin's suggestion, let's stuff alloc_pages()/free_page() fallbacks to those callers before having PATCH-5. Changlog v1->v2: * PATCH-2: Initialized page pointer to NULL Nicolin Chen (5): ARM: dma-mapping: Add fallback normal page allocations dma-remap: Run alloc_pages() on failure iommu: amd_iommu: Add fallback normal page allocations arm64: dma-mapping: Add fallback normal page allocations dma-contiguous: Do not allocate a single page from CMA area arch/arm/mm/dma-mapping.c | 13 ++++++++++--- arch/arm64/mm/dma-mapping.c | 19 ++++++++++++------- drivers/iommu/amd_iommu.c | 3 +++ kernel/dma/contiguous.c | 22 +++++++++++++++++++--- kernel/dma/remap.c | 4 ++-- 5 files changed, 46 insertions(+), 15 deletions(-)