From patchwork Wed Feb 13 01:55:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jesper Dangaard Brouer X-Patchwork-Id: 10809007 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 CA6B4922 for ; Wed, 13 Feb 2019 01:55:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B86232C042 for ; Wed, 13 Feb 2019 01:55:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AC0B12C085; Wed, 13 Feb 2019 01:55: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=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 508832C042 for ; Wed, 13 Feb 2019 01:55:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 047C68E0002; Tue, 12 Feb 2019 20:55:46 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id F11298E0001; Tue, 12 Feb 2019 20:55:45 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DD93F8E0002; Tue, 12 Feb 2019 20:55:45 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qt1-f198.google.com (mail-qt1-f198.google.com [209.85.160.198]) by kanga.kvack.org (Postfix) with ESMTP id A6B428E0001 for ; Tue, 12 Feb 2019 20:55:45 -0500 (EST) Received: by mail-qt1-f198.google.com with SMTP id i18so756935qtm.21 for ; Tue, 12 Feb 2019 17:55:45 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:subject:from :to:cc:date:message-id:in-reply-to:references:user-agent :mime-version:content-transfer-encoding; bh=Q5J1u+AnvDflsWVjNFYr7WMWX5vJAPsWaN49d9KLIhQ=; b=hFBTu1bXuMGclAInikPZo0uGVxY1ITsy1kvj5OYNbeAyzeOYRrHm6mlpxXscQr8soz xmqcSTMQTHepe+6wGvCi5kCAd0LE4C7bWVU3b5lAcVqGWtSB0WQ1GY5fK5+i1Uhg5eBk T6EQUep0xXBerCcIg4FbLgec22KzD2Al++g8IvrLoSEApvp5Wcam+yHDZZS2tlPE6AmC 1zFM5KlC7abV1LGDkUWEnEJ43oVL5WyA9rAISdHpf5czqVcyqr6Rh83H/jo0cMF70JEw DYv/iAM96hFADj9Xdts4etlxzS0kr3mIyNpUTbIcdKbEe+J1z6bPhr/ArM/cYUaX19zv Og+Q== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of brouer@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=brouer@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com X-Gm-Message-State: AHQUAubVHx7ddVkX0V0P4nsiQqLEfpT3aenwhRK2MWivnTtP2HoYRlrH MKTy8iXseszK1RPNOiAVAfDKuMR6eqhX+rbK8aGiJllrmPuaRKgKLYHWe/FvGqUw7tSVVZkmdL6 SS7umErhrXsJgO5yOo36E3H7P4PgJDqKhzGszloKa6teZWgTihiYZ7dNLuK31yHeBRQ== X-Received: by 2002:ae9:f101:: with SMTP id k1mr4979279qkg.111.1550022945415; Tue, 12 Feb 2019 17:55:45 -0800 (PST) X-Google-Smtp-Source: AHgI3IYPRDAieuXEKmdf2puAsvXyMLl9g4X9sdqdNIw9TbYtEzvrhQ6qKXK93Jx3iM9iIaxNugld X-Received: by 2002:ae9:f101:: with SMTP id k1mr4979257qkg.111.1550022944938; Tue, 12 Feb 2019 17:55:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550022944; cv=none; d=google.com; s=arc-20160816; b=fv9gvi2g98gm2rGoQW6fq+J+rZ5bbfpGiXCg85X3iJevH0lq1hn4BABKbLddbSNk0u eaR3638U/HsJy9TpUk5o1XrJPE3oDCZqblSbCcBby9pYKdgSBDaeu+kX6p3fIUObUVw5 meRjFRG4C0pKFUe2AsmHp4QVGYY+TRAZcOlzX7YP4vokNEDti7cPNXDxorLbBEIM7U3I 7yqqlclw6wZgw+GYYh4Z4wCBGQOhwrrNAvK2EwTIQAWTKmjbZSPS2Ut7W5NIBr5lvklI 2JdrCGPvBH4em0KUtTk/2fGue6FHv2/cizp51ojmGLYZb+DagBhQ02KmOTRGUMV/qD5g Lyqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:user-agent:references :in-reply-to:message-id:date:cc:to:from:subject; bh=Q5J1u+AnvDflsWVjNFYr7WMWX5vJAPsWaN49d9KLIhQ=; b=yylaZaAFPpbdETBvnr+MbPZoQotaT69rzMrjr/lCrY0jXb0/Jleo106kha4o7jmsLX YvXUwoYUnnoTqQUG2tCglh7CFXprEoHJfMPfpILnZ+5alvc/WFNkcDy/MD4cPZR5qzaz TsRlt8I2JS5UEL9NZWw2nso2RoXSv6sQVOdHhIKEx2HxH/R5lOR09Pu3o0WAKDRap4Pq q8zpDJ0+e0mr8iy1yFrlbqUHH2874Ojo+zs2KMsiF5goZyJsom1kS7ingxLUnJpzP5K9 KcxwEbfYXHj9RAC4bBsE/CjKw8QV/1Jpb8thFkyiViY7n69nBdY+g37qlT6atGgdyt4h WXEA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of brouer@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=brouer@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28]) by mx.google.com with ESMTPS id r4si4871320qtb.2.2019.02.12.17.55.44 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Feb 2019 17:55:44 -0800 (PST) Received-SPF: pass (google.com: domain of brouer@redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; Authentication-Results: mx.google.com; spf=pass (google.com: domain of brouer@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=brouer@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1B548C01DDE9; Wed, 13 Feb 2019 01:55:44 +0000 (UTC) Received: from firesoul.localdomain (ovpn-200-20.brq.redhat.com [10.40.200.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id EF59719747; Wed, 13 Feb 2019 01:55:40 +0000 (UTC) Received: from [10.1.2.1] (localhost [IPv6:::1]) by firesoul.localdomain (Postfix) with ESMTP id 22A2731256FC7; Wed, 13 Feb 2019 02:55:40 +0100 (CET) Subject: [net-next PATCH V3 1/3] mm: add dma_addr_t to struct page From: Jesper Dangaard Brouer To: netdev@vger.kernel.org, linux-mm@kvack.org Cc: Toke =?utf-8?q?H=C3=B8iland-J=C3=B8rgensen?= , Ilias Apalodimas , willy@infradead.org, Saeed Mahameed , Alexander Duyck , Jesper Dangaard Brouer , Andrew Morton , mgorman@techsingularity.net, "David S. Miller" , Tariq Toukan Date: Wed, 13 Feb 2019 02:55:40 +0100 Message-ID: <155002294008.5597.13759027075590385810.stgit@firesoul> In-Reply-To: <155002290134.5597.6544755780651689517.stgit@firesoul> References: <155002290134.5597.6544755780651689517.stgit@firesoul> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 13 Feb 2019 01:55:44 +0000 (UTC) X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP The page_pool API is using page->private to store DMA addresses. As pointed out by David Miller we can't use that on 32-bit architectures with 64-bit DMA This patch adds a new dma_addr_t struct to allow storing DMA addresses Signed-off-by: Jesper Dangaard Brouer Signed-off-by: Ilias Apalodimas Acked-by: Andrew Morton --- include/linux/mm_types.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index 2c471a2c43fa..0a36a22228e7 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -95,6 +95,13 @@ struct page { */ unsigned long private; }; + struct { /* page_pool used by netstack */ + /** + * @dma_addr: might require a 64-bit value even on + * 32-bit architectures. + */ + dma_addr_t dma_addr; + }; struct { /* slab, slob and slub */ union { struct list_head slab_list; /* uses lru */ From patchwork Wed Feb 13 01:55:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jesper Dangaard Brouer X-Patchwork-Id: 10809009 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 EF40F922 for ; Wed, 13 Feb 2019 01:55:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DC2AB2C042 for ; Wed, 13 Feb 2019 01:55:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D015C2C085; Wed, 13 Feb 2019 01:55:51 +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=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 67C592C042 for ; Wed, 13 Feb 2019 01:55:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4DE9E8E0004; Tue, 12 Feb 2019 20:55:48 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 465488E0001; Tue, 12 Feb 2019 20:55:48 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 308188E0004; Tue, 12 Feb 2019 20:55:48 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by kanga.kvack.org (Postfix) with ESMTP id 028668E0001 for ; Tue, 12 Feb 2019 20:55:48 -0500 (EST) Received: by mail-qk1-f197.google.com with SMTP id e9so727170qka.11 for ; Tue, 12 Feb 2019 17:55:47 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:subject:from :to:cc:date:message-id:in-reply-to:references:user-agent :mime-version:content-transfer-encoding; bh=xWUNDSgRU80m19aFrocMMhwrjGCARtWhKL6OErSaSMc=; b=k78qXw5eEv8fbjtd0jG29XlDXNLwtYk8i3PFxI43nAxeg0e6RUCDpxJZsRblj12yG5 OOVS1iYz2hli0DxVzhtc/jWv0WEV7PVq0KDovxqoXtzXc/Ad+ghXvNtrUSAH+PZTIF20 cwdrIaUYYWBK+w4aNF7neSFKUEEuMnvsKX6ZD3XVvI4dYy/ZY75B+gPFVGWrbIit6Rfu LdVDvEni5rYWbXXUVSZz9qADc6w6641j81KF9RuSud+hZTPaztKl/4LvTCsoztxi/lU7 DEcxk3xbX4m1wCW4U85iOXKF6UZMwWff72aa1lG0I46Q18BvEsPtT/iZxCkx/uzgUOSQ 3NbA== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of brouer@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=brouer@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com X-Gm-Message-State: AHQUAuaqyOTZsy79ZO/puknb87vCrXORMVuiwcxf+WU7EuODYfhi+NpS SgsUc1MEM7O80GTKIsLlE/YnQHgF3ctvGbMtQ3P1uNDpobefsIhcgG2b+YLbmrfDj4u8AVeOol8 +3+a0gx4WofeiXDTdIiGezgBtW3cf7jhRKdJFU2XxwnMn/3IOMMS5GVqdZ4GvjsvV8A== X-Received: by 2002:a0c:c103:: with SMTP id f3mr5008482qvh.194.1550022947756; Tue, 12 Feb 2019 17:55:47 -0800 (PST) X-Google-Smtp-Source: AHgI3IYRb009MGUqLQG0lTF9zS/BP4Cyyt2f4v8pMlQVrNzzgb399M1oEHie1fucTHiArLfy+Hwo X-Received: by 2002:a0c:c103:: with SMTP id f3mr5008463qvh.194.1550022947282; Tue, 12 Feb 2019 17:55:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550022947; cv=none; d=google.com; s=arc-20160816; b=IY3I0dbLQDs+PsouwOHpSXtmMYe48QtE9fhIHLT0p5U/PzYSGeSlAnb4qa+u+ZyBdK NDN+ErqxdDEoyv2EE9fcE+Lf1VMpFFovkfwBbEHspTRIqOTH+VeTd+le+luXuEwsYMk1 XvATNoN/LEAMRswq/RcjdF380CB36Yz03KqERqBJvKwhOED0zh4MqTuz0/UBbU4X4us8 d3FMgOmzGiBcs3B+ONw5ilU8wQIXxna7NgZrC3pfMkXpNpyd9/SuYx1B4PgbJyXDa7Xu WrYHbnrEKUsCrCvD9ajhf7Xy7+c6EC6wpczgEx/goMXIjGeyKJu46qfl8jeRY1TZvfvw 0LHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:user-agent:references :in-reply-to:message-id:date:cc:to:from:subject; bh=xWUNDSgRU80m19aFrocMMhwrjGCARtWhKL6OErSaSMc=; b=j8hutfr3RbC5xrKm1HyiYdAuRaYFe8t+UHXiNguCItPjyg12vrfHgKo/zqAA03ue3E Q0aCNfX3BXojr3R+c2GiC3iM5vK+Ol/mlhctpwm67HxO7aQ+nPy9FPsATF3xOBtd9Zkk WMVht0L6r7OtCVbWesEl82SX7SGpzHx4EY/SPJPg5/pbwxCtQFCEwRfsmTpw8/b/PFJh ZIe8CTtvLcJWT8SMfNMgi1CIqqtpVg4DHE1plVAtRe1bQrU39CUWs9wj5lZewucbQOzM MxVhQSZTKQvuN2N8/fOhpANaI/0KANZ4QG71lia28UEfa+0WSmfPjuUg+1yNn+s43LeW VjVQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of brouer@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=brouer@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28]) by mx.google.com with ESMTPS id n34si1890947qtn.318.2019.02.12.17.55.47 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Feb 2019 17:55:47 -0800 (PST) Received-SPF: pass (google.com: domain of brouer@redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; Authentication-Results: mx.google.com; spf=pass (google.com: domain of brouer@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=brouer@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 620E77F406; Wed, 13 Feb 2019 01:55:46 +0000 (UTC) Received: from firesoul.localdomain (ovpn-200-20.brq.redhat.com [10.40.200.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0BB785C635; Wed, 13 Feb 2019 01:55:46 +0000 (UTC) Received: from [10.1.2.1] (localhost [IPv6:::1]) by firesoul.localdomain (Postfix) with ESMTP id 32FE5306665E6; Wed, 13 Feb 2019 02:55:45 +0100 (CET) Subject: [net-next PATCH V3 2/3] net: page_pool: don't use page->private to store dma_addr_t From: Jesper Dangaard Brouer To: netdev@vger.kernel.org, linux-mm@kvack.org Cc: Toke =?utf-8?q?H=C3=B8iland-J=C3=B8rgensen?= , Ilias Apalodimas , willy@infradead.org, Saeed Mahameed , Alexander Duyck , Jesper Dangaard Brouer , Andrew Morton , mgorman@techsingularity.net, "David S. Miller" , Tariq Toukan Date: Wed, 13 Feb 2019 02:55:45 +0100 Message-ID: <155002294514.5597.2532233956628457927.stgit@firesoul> In-Reply-To: <155002290134.5597.6544755780651689517.stgit@firesoul> References: <155002290134.5597.6544755780651689517.stgit@firesoul> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Wed, 13 Feb 2019 01:55:46 +0000 (UTC) X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP From: Ilias Apalodimas As pointed out by David Miller the current page_pool implementation stores dma_addr_t in page->private. This won't work on 32-bit platforms with 64-bit DMA addresses since the page->private is an unsigned long and the dma_addr_t a u64. A previous patch is adding dma_addr_t on struct page to accommodate this. This patch adapts the page_pool related functions to use the newly added struct for storing and retrieving DMA addresses from network drivers. Signed-off-by: Ilias Apalodimas Signed-off-by: Jesper Dangaard Brouer --- net/core/page_pool.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/net/core/page_pool.c b/net/core/page_pool.c index 43a932cb609b..897a69a1477e 100644 --- a/net/core/page_pool.c +++ b/net/core/page_pool.c @@ -136,7 +136,9 @@ static struct page *__page_pool_alloc_pages_slow(struct page_pool *pool, if (!(pool->p.flags & PP_FLAG_DMA_MAP)) goto skip_dma_map; - /* Setup DMA mapping: use page->private for DMA-addr + /* Setup DMA mapping: use 'struct page' area for storing DMA-addr + * since dma_addr_t can be either 32 or 64 bits and does not always fit + * into page private data (i.e 32bit cpu with 64bit DMA caps) * This mapping is kept for lifetime of page, until leaving pool. */ dma = dma_map_page(pool->p.dev, page, 0, @@ -146,7 +148,7 @@ static struct page *__page_pool_alloc_pages_slow(struct page_pool *pool, put_page(page); return NULL; } - set_page_private(page, dma); /* page->private = dma; */ + page->dma_addr = dma; skip_dma_map: /* When page just alloc'ed is should/must have refcnt 1. */ @@ -175,13 +177,16 @@ EXPORT_SYMBOL(page_pool_alloc_pages); static void __page_pool_clean_page(struct page_pool *pool, struct page *page) { + dma_addr_t dma; + if (!(pool->p.flags & PP_FLAG_DMA_MAP)) return; + dma = page->dma_addr; /* DMA unmap */ - dma_unmap_page(pool->p.dev, page_private(page), + dma_unmap_page(pool->p.dev, dma, PAGE_SIZE << pool->p.order, pool->p.dma_dir); - set_page_private(page, 0); + page->dma_addr = 0; } /* Return a page to the page allocator, cleaning up our state */ From patchwork Wed Feb 13 01:55:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jesper Dangaard Brouer X-Patchwork-Id: 10809011 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 6561813A4 for ; Wed, 13 Feb 2019 01:55:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 503212C042 for ; Wed, 13 Feb 2019 01:55:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 429A82C085; Wed, 13 Feb 2019 01:55:57 +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=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D441E2C042 for ; Wed, 13 Feb 2019 01:55:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BDF7D8E0001; Tue, 12 Feb 2019 20:55:55 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id B8FF08E0005; Tue, 12 Feb 2019 20:55:55 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A7E4C8E0001; Tue, 12 Feb 2019 20:55:55 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qt1-f199.google.com (mail-qt1-f199.google.com [209.85.160.199]) by kanga.kvack.org (Postfix) with ESMTP id 7FF208E0005 for ; Tue, 12 Feb 2019 20:55:55 -0500 (EST) Received: by mail-qt1-f199.google.com with SMTP id q33so743757qte.23 for ; Tue, 12 Feb 2019 17:55:55 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:subject:from :to:cc:date:message-id:in-reply-to:references:user-agent :mime-version:content-transfer-encoding; bh=WEnDHOBP3T8BxDS3/7DSel/5EvpqQ57qB7+fl55woOI=; b=S622pZIWKo9/+l3ONVeUlXbqcODFgwnBVBlUh0OYdNYLVqLhaL/Y0cKnN3ifRdmK8q bqUVAfRqD5Gau8afwKvgys6jYdiijqX8p74t74OJUFMdKH43xcLJRHJiDxQ8aTQ3Yl1i I1eDNtpt71hNxVqlQN6jmGVYyntc8YT0eaj8uZuZQo4AFYOerK7Wu3qyrOnHWGcsMoIZ BULEMWNfWK24HdRE67kawxasmyw6jVL1gysb9VT0iwPWlZeikxbq2TWLt1gfgX6R6tEU N/OnLyrMVq+d6ZtEWIPXLRJFUGw3uUlJGEqqMhrwjhnWPvaWz/0NBkCspyum2G4etxoK M3yA== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of brouer@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=brouer@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com X-Gm-Message-State: AHQUAuY48XT2AeeUJwrnccq1v4c1VBWlMBW2DLD++nlb2v3Xtxud2pkj RKu/OJ4AvBfJm/OJEgBo/j3Pilh1/nML6IdXOggrzTdC2PkLGYxKI0ONgGkNhrXrC7HAqzvoNUj T37Vy07mdCC7M033OpDV1opmzL3Ek90TQRkyPMOj3uwm82kjN+PgMOeATt71tKnX1xw== X-Received: by 2002:a37:b8c1:: with SMTP id i184mr4592039qkf.51.1550022955278; Tue, 12 Feb 2019 17:55:55 -0800 (PST) X-Google-Smtp-Source: AHgI3IYLNHn8A/CKQYsvOD6oK7xx2owvXBlxcysGnbRuIqyr7Bo8bGh8HKcJ8sLhd9UWlp1xJ6Xn X-Received: by 2002:a37:b8c1:: with SMTP id i184mr4592025qkf.51.1550022954775; Tue, 12 Feb 2019 17:55:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550022954; cv=none; d=google.com; s=arc-20160816; b=nr9u4g2Uy17p+6pG0f26baypYC8nLqCvlPhOGeT6W9sShII9eaAkuxXXxqgO6153CJ gWZC1qkw487H5D1RsAmio55sZ3VhzmwecMXh9EfDVTih4y/dZDYiKmKYylKK94iS5pgh chmdksbrkJxu5kJsHbNm5COePVDRO0in2Q5iWYRAHdFoWgDF+wbJeYcpNUb4Wyu8wCHL eYAf4ztyvnGuNjj0NsJ0tjpUrmT6c9zpC3pZv4mEAKZUE1ke1oElW/obvin1Iopx9lpb 5TfWercUkmSyM/Fv5tGYwkUbYwjKpRB/KvUhjt1QOvzoCA1jhuR+VtmvaemAjMlqDViT 9SqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:user-agent:references :in-reply-to:message-id:date:cc:to:from:subject; bh=WEnDHOBP3T8BxDS3/7DSel/5EvpqQ57qB7+fl55woOI=; b=OLyoAP3Ya9MK1LYvhK7+fQ41Uo1tObEQ60QFiMVnYBtpDA5YV+taVcz4REbIg+cVar b3cYzjemKLw8W4cA9M20PhWskDdg+uum+iAQeocIgNvn1RSk/WG/oLs/LcJyjWrrJOVC J8K50LHogioG7uYr8oudAhk2KGBzahJv0bXGjw3Iq4cRUGQU+4NSTO7HMhNLPnxLqWzP U+Uazpt3VCVn6FM7xOtYQp1PmoPXe4ZATN/1Tb0G9x+gTrXr3Pg8JhpxQV5RxFqM9/Tc 63mO3VIYd6yqsD4SjMt7NdsedbGbC4MGv8I2eKWoyVWLhVBSKeatCQkYizYAXO9w/dmR 8qJw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of brouer@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=brouer@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28]) by mx.google.com with ESMTPS id y4si505646qve.86.2019.02.12.17.55.54 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Feb 2019 17:55:54 -0800 (PST) Received-SPF: pass (google.com: domain of brouer@redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; Authentication-Results: mx.google.com; spf=pass (google.com: domain of brouer@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=brouer@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E6F703DE0F; Wed, 13 Feb 2019 01:55:53 +0000 (UTC) Received: from firesoul.localdomain (ovpn-200-20.brq.redhat.com [10.40.200.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1946862667; Wed, 13 Feb 2019 01:55:51 +0000 (UTC) Received: from [10.1.2.1] (localhost [IPv6:::1]) by firesoul.localdomain (Postfix) with ESMTP id 4336E306665E6; Wed, 13 Feb 2019 02:55:50 +0100 (CET) Subject: [net-next PATCH V3 3/3] page_pool: use DMA_ATTR_SKIP_CPU_SYNC for DMA mappings From: Jesper Dangaard Brouer To: netdev@vger.kernel.org, linux-mm@kvack.org Cc: Toke =?utf-8?q?H=C3=B8iland-J=C3=B8rgensen?= , Ilias Apalodimas , willy@infradead.org, Saeed Mahameed , Alexander Duyck , Jesper Dangaard Brouer , Andrew Morton , mgorman@techsingularity.net, "David S. Miller" , Tariq Toukan Date: Wed, 13 Feb 2019 02:55:50 +0100 Message-ID: <155002295022.5597.14139756432375272348.stgit@firesoul> In-Reply-To: <155002290134.5597.6544755780651689517.stgit@firesoul> References: <155002290134.5597.6544755780651689517.stgit@firesoul> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Wed, 13 Feb 2019 01:55:54 +0000 (UTC) X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP As pointed out by Alexander Duyck, the DMA mapping done in page_pool needs to use the DMA attribute DMA_ATTR_SKIP_CPU_SYNC. As the principle behind page_pool keeping the pages mapped is that the driver takes over the DMA-sync steps. Reported-by: Alexander Duyck Signed-off-by: Jesper Dangaard Brouer Signed-off-by: Ilias Apalodimas --- net/core/page_pool.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/net/core/page_pool.c b/net/core/page_pool.c index 897a69a1477e..5b2252c6d49b 100644 --- a/net/core/page_pool.c +++ b/net/core/page_pool.c @@ -141,9 +141,9 @@ static struct page *__page_pool_alloc_pages_slow(struct page_pool *pool, * into page private data (i.e 32bit cpu with 64bit DMA caps) * This mapping is kept for lifetime of page, until leaving pool. */ - dma = dma_map_page(pool->p.dev, page, 0, - (PAGE_SIZE << pool->p.order), - pool->p.dma_dir); + dma = dma_map_page_attrs(pool->p.dev, page, 0, + (PAGE_SIZE << pool->p.order), + pool->p.dma_dir, DMA_ATTR_SKIP_CPU_SYNC); if (dma_mapping_error(pool->p.dev, dma)) { put_page(page); return NULL; @@ -184,8 +184,9 @@ static void __page_pool_clean_page(struct page_pool *pool, dma = page->dma_addr; /* DMA unmap */ - dma_unmap_page(pool->p.dev, dma, - PAGE_SIZE << pool->p.order, pool->p.dma_dir); + dma_unmap_page_attrs(pool->p.dev, dma, + PAGE_SIZE << pool->p.order, pool->p.dma_dir, + DMA_ATTR_SKIP_CPU_SYNC); page->dma_addr = 0; }