From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.3 required=3.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS,URIBL_BLOCKED, USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A5C52C10F11 for ; Wed, 24 Apr 2019 18:33:30 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 788D521773 for ; Wed, 24 Apr 2019 18:33:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="NfpSe4xR"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="eqLg0zPN" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 788D521773 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=q3I7QX1xv4EVt8lqit9h7EyZq4xyqpDosEmDZVxpuxs=; b=NfpSe4xRGTAxmW 7PZ1wynFqBLkNPmXjniAFwgt448SFCEtg0Fd0+3o2TGxLYb1k7gIihfbXb1hBSsOYx2mwYSBizRJ4 71oK7Q9H9CBLYGAXJwPFQehqIbJU1QGUMjZgEr4n49YHSSBUqmLQSc5hmdOBacof7qD61eeAfbdVb 7xUWbEYt4pytURVH/9ZVL8UbgvtIZU8p2nKXWSlnbDsOZrxtDUhMIiWQvSIc1H1Pl0ydNLhn5gU+Q HyiAAVs7PeqKLzitmZllBV+Qp3Ndyt9DUV9Q90Ogzk6c+CB6gj4C67iiLLRcIW/UWPxuSRpt2AXX6 vTOuepW6cWJqnD9a2X9w==; 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 1hJMht-0001rn-2e; Wed, 24 Apr 2019 18:33:21 +0000 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hJMhp-0001rE-PL for linux-arm-kernel@lists.infradead.org; Wed, 24 Apr 2019 18:33:19 +0000 Received: by mail-pf1-x444.google.com with SMTP id 10so9743354pfo.5 for ; Wed, 24 Apr 2019 11:33:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=8TEy0tx0jHylJx7e47yPJO+qgMm3AFlPvz5zMS1qhSY=; b=eqLg0zPNqnOMeNBKAwLI6PomFBg1//aO8UxynQI5ck9qKMhfU30AOHPk5LfJnq7R3w Z693bDoY5BcWklK0yQyMjTKsv7XI2oN9DVtSFLjkzaow2O/nmJVKJxdmbQYaeYrWAdgC MB9QCGPCFzweWL8xdNjUylzB+tT9HbflspBwpDho0ZmKLVzEB9nWwPQWn7RebXNaKkaX GZP8VlrMejBnji+h4jFl+qSeR1YKgNKytt1IzHUeXUELql2koND7HL3mAhJl3jmX1D9w 6ui9v+KD0tbMtJRny4Ow8MocSqRIze3m6r07tQlXmp3wmuwkGH1kA2lEcLf5LVuZN3CS m6yA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=8TEy0tx0jHylJx7e47yPJO+qgMm3AFlPvz5zMS1qhSY=; b=Lo9ZbRzF/6/psSXewjEkqwA1OHOUrdpqX56U6EJUQLl+DZffsFQ8M+nQ2Lt6y7qQVc fZFxK2rkibtwnOU/XgZ/Ez4f01A0LxGuMRDsc9jxiIUJwTOpAI9bKhBbQfP9B6eUqXQl 5VKdWfPzyAL0tFC/U4D45yI/ZKTGfNerC7LtrsyuEMyO5WdGFgcEzbaK3pST9hwpovD6 L9xTEFhm6sfgiUT/H9qSJbhRtU5qPPaokHMFjfQZ8PonnGEe03jlLCpfnQav3NruGrky O2N8N1fD/ZK4Ds8t4kApJPrdhLAep7LlUTGd6LwwHaWmgnH8hK2fkamlr/8e6yKH2Gs2 GZiA== X-Gm-Message-State: APjAAAUlOmCR7rFFJAT/9cMM/76M0vpbBQCwko00ZAwi5CekhEXPokHr 9wFpLtA4/byxqHCYEMmT1mk= X-Google-Smtp-Source: APXvYqyY7PI6qWpkkSXcac3wixJyG1JL6PVz0l3idYqFErVnnnB1azTnKuYcgT6q0FkE26K1aXkecg== X-Received: by 2002:a63:5a4b:: with SMTP id k11mr31878166pgm.119.1556130796862; Wed, 24 Apr 2019 11:33:16 -0700 (PDT) Received: from Asurada-Nvidia.nvidia.com (thunderhill.nvidia.com. [216.228.112.22]) by smtp.gmail.com with ESMTPSA id c28sm9686899pgm.42.2019.04.24.11.33.15 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2019 11:33:16 -0700 (PDT) Date: Wed, 24 Apr 2019 11:33:11 -0700 From: Nicolin Chen To: Christoph Hellwig Subject: Re: [PATCH v2 RFC/RFT 1/5] ARM: dma-mapping: Add fallback normal page allocations Message-ID: <20190424183310.GA6168@Asurada-Nvidia.nvidia.com> References: <20190326230131.16275-1-nicoleotsuka@gmail.com> <20190326230131.16275-2-nicoleotsuka@gmail.com> <20190424150638.GA22191@lst.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20190424150638.GA22191@lst.de> User-Agent: Mutt/1.9.4 (2018-02-28) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190424_113317_825102_9428D11E X-CRM114-Status: GOOD ( 17.02 ) 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, robin.murphy@arm.com, linux-arm-kernel@lists.infradead.org, m.szyprowski@samsung.com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Christoph, On Wed, Apr 24, 2019 at 05:06:38PM +0200, Christoph Hellwig wrote: > On Tue, Mar 26, 2019 at 04:01:27PM -0700, Nicolin Chen wrote: > > page = dma_alloc_from_contiguous(dev, count, order, gfp & __GFP_NOWARN); > > + if (!page) > > + page = alloc_pages(gfp, order); > > We have this fallback in most callers already. And with me adding > it to the dma-iommu code in one series, and you to arm here I think > we really need to take a step back and think of a better way > to handle this, and the general mess that dma_alloc_from_contiguous. > > So what about: Thanks for the suggestion! > (1) change the dma_alloc_from_contiguous prototype to be: > > struct page *dma_alloc_contiguous(struct device *dev, size_t size, gfp_t gfp); > > that is: calculate order and count internally, pass the full gfp_t > and mask it internally, and drop the pointless from in the name. > I'd also use the oppurtunity to forbid a NULL dev argument and > opencode those uses. > > (2) handle the alloc_pages fallback internally. Note that we should > use alloc_pages_node as we do in dma-direct. I feel it's similar to my previous set, which did most of these internally except the renaming part. But Catalin had a concern that some platforms might have limits on CMA range [1]. Will it be still okay to do the fallback internally? [1: https://www.spinics.net/lists/arm-kernel/msg714295.html ] _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel