From patchwork Tue Feb 12 14:49:03 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: 10808079 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 A4CD21575 for ; Tue, 12 Feb 2019 14:49:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 951312A26D for ; Tue, 12 Feb 2019 14:49:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 88FC32A3E4; Tue, 12 Feb 2019 14:49:09 +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 2BAB92A26D for ; Tue, 12 Feb 2019 14:49:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 76A1F8E0003; Tue, 12 Feb 2019 09:49:06 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 71C818E0001; Tue, 12 Feb 2019 09:49:06 -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 5BCC98E0003; Tue, 12 Feb 2019 09:49:06 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) by kanga.kvack.org (Postfix) with ESMTP id 2FBC78E0001 for ; Tue, 12 Feb 2019 09:49:06 -0500 (EST) Received: by mail-qk1-f199.google.com with SMTP id c84so15977584qkb.13 for ; Tue, 12 Feb 2019 06:49:06 -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=7JQPLh5bOMKxM6/Qt39hzwevbRQdYhVhpxmktml6+V8=; b=AWyh60Sz++jnrMREydHyrN1b7jxofF2UFMXxk0nBth1vKUNdsj2UaozUokf5elPPIm RFqq3bKuZdZQgY/GRLy19HtLSx9IGLik8fnoB351DJx/wILDAY7gYt1w40NqIquQGqf3 fs6olv2uIoa10Vy5+KefauNJYAb5KGWtMaiUykvWUbCgF5lOV+4v1sSEFtRMOfmNqByJ kDmFF3KcrmAs2l9cbx9YzKbtA/tt2laXY2+KXonB1PJYqECCJdqHgxPBsVtXzOI4EnDy Lnrlir0FiNRp/m0Mv0eNCSpyziRkfrEFWKegQa0WG/A6QJOSJpe94F45jn1SWqhJ90Bk n4Mg== 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: AHQUAuZgPAdJoueXpJMRgRCWd5aXRLo5i3dd500wbZJWpbf1MooVDHLj aoLMRNP8vGWouvEIGOq/ke4v4OzSAFtrIzl0HSU13iTsINxMKDJnJAFdx/+fpR5f9W4rLjlYQN+ TmUusN9K3LY29WYxw3w+b0fbzJOt4QRPhNq9aq3D8Nrys2Ig/XVMXdtxC/qwtI4Ip2w== X-Received: by 2002:a0c:e704:: with SMTP id d4mr2483661qvn.241.1549982945996; Tue, 12 Feb 2019 06:49:05 -0800 (PST) X-Google-Smtp-Source: AHgI3IZCJoeNSn7aFzVyX/BP7lGl8kCP1UYF4qzqwQQ7LzeISZy/WZIL+v9YBuBric2Edaeo7MtA X-Received: by 2002:a0c:e704:: with SMTP id d4mr2483630qvn.241.1549982945511; Tue, 12 Feb 2019 06:49:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549982945; cv=none; d=google.com; s=arc-20160816; b=f1oC6XZteEzRqqdj12LWCbZfmNavftSzNr05845fkzUj7P9Evqwf9JjRa+u8r6v40F NQE2bjThYclMwHTxeyeerAMvlWqpsnEdRPN/lBsFwXQAfQGJIRlKiuxe3Nf4R+aYPlGO sQ6mPUKbWg54KhochiuPsBMQOPXlgZ+uv2LRBQDA3RyMv0BKP/DFhfsq/+iLeB6fV5Fl 8m/OaI+8uGDyC1tDKGeUyd8XUUpSmRaQNbN6EDQE+aKCICEjkt+3xKey3wwwJzldJS9z jjlq6cegdcqOvf9cYJfnKNsBR2QP3cWsP+HdW5uk6zqLW9HQC1UgsWXOh3y/hzXaVheg Kt/w== 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=7JQPLh5bOMKxM6/Qt39hzwevbRQdYhVhpxmktml6+V8=; b=uJdEwAR/TpZMavFyhAKKMLUb3V8VKO0TB/1Bf9cBZWesVZe7oCsWuYPezgvpldDh/x wmuPoORvRQkvo6O3mv6eqeFaGcE1u7Zx68nVkB1R2TDMOy18lMQElY1TKqDlQz3Lbf7h clIlYuxcWUg1U1ZLYv3MfaiD1rAPhZQWxvSJEaMQayZur3v9do4iOP78EIO058rsjekz 7z5lFYMEmwF538Ss4j13XttKtG1Spcs5xHkqyeCjzYx1KxRlJiEfuAyipm6QqoyfIlHE 0nt4rkZWeJxIKPgG8G6PCcp72Kny1lO+hO/kAoH/JRWqyd15oIaCqPW9kWJYTVVkDGIX uOUA== 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 m6si5569496qtq.192.2019.02.12.06.49.05 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Feb 2019 06:49:05 -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-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9A4BA89AC7; Tue, 12 Feb 2019 14:49:04 +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 3213810021B1; Tue, 12 Feb 2019 14:49:04 +0000 (UTC) Received: from [10.1.2.1] (localhost [IPv6:::1]) by firesoul.localdomain (Postfix) with ESMTP id 49CFC31256FC7; Tue, 12 Feb 2019 15:49:03 +0100 (CET) Subject: [net-next PATCH V2 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: Tue, 12 Feb 2019 15:49:03 +0100 Message-ID: <154998294324.8783.9045146111677125556.stgit@firesoul> In-Reply-To: <154998290571.8783.11827147914798438839.stgit@firesoul> References: <154998290571.8783.11827147914798438839.stgit@firesoul> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 12 Feb 2019 14:49:04 +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..581737bd0878 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: page_pool requires 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 Tue Feb 12 14:49:08 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: 10808081 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 C634313BF for ; Tue, 12 Feb 2019 14:49:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B473F2A26D for ; Tue, 12 Feb 2019 14:49:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A82552A3CE; Tue, 12 Feb 2019 14:49:16 +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 3E9592A26D for ; Tue, 12 Feb 2019 14:49:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2D6EC8E0004; Tue, 12 Feb 2019 09:49:15 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 2866E8E0001; Tue, 12 Feb 2019 09:49:15 -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 19C888E0004; Tue, 12 Feb 2019 09:49:15 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) by kanga.kvack.org (Postfix) with ESMTP id E2F238E0001 for ; Tue, 12 Feb 2019 09:49:14 -0500 (EST) Received: by mail-qk1-f199.google.com with SMTP id s65so15873765qke.16 for ; Tue, 12 Feb 2019 06:49:14 -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=h5eP61EplTVZt6orNbkb9AgNH7gi0HjFPk0iXzmFgyCrbrs/ICsdzuEtxF8SVQ+lho 0U6BvdIv2ue7MvWP5dTN8YRI1GXUDY7/54FrBiTULq+SRo0/KFQ1KE03qWyQyoDB+yAo M0Q42TWohQgWJLy+lRvkul+lUtjUkKy0hJco6IYm+GIkKh1eqxX4sMNdB+I0NuueN5xZ FhKAY+oXc+PedT9oYSXYu9JOXYbQbV7mBhONspupHsS6pS5g6oGPi9HvZZWrgejRWiMl Jsp9a5wsgXw/n0CIa4JnPkadl7azBhDMuwXaSPVoppyxUmqGjSVcvDYMhY2OtDkAyZGb 8AuQ== 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: AHQUAuakNvGtsEPT5807BopISLC4JJ4+dxb6LkKDBM5kwwTaTAX5kyPa KeW+eebGbEDKUTNLyvXmOO2Znw3870te8C8Kn6D48S5tb8t7ofwt6aTmmBYIBI7+kyQdSkofmvu 68pJUrtUezZGw+b/VquiM1qrVkLkNUTcQA0EaIeu1VrU7u+mA3V4wIoEdT/Kn8x4Szw== X-Received: by 2002:a37:4289:: with SMTP id p131mr2899167qka.3.1549982954704; Tue, 12 Feb 2019 06:49:14 -0800 (PST) X-Google-Smtp-Source: AHgI3IZ1YpKA645uZ5q/2zSlVm5xSid2WyCGblfXmc8T34yx3JGuwN9lZDiSCCs4h1ji8Fu7F+6W X-Received: by 2002:a37:4289:: with SMTP id p131mr2899134qka.3.1549982954091; Tue, 12 Feb 2019 06:49:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549982954; cv=none; d=google.com; s=arc-20160816; b=vrRx7uDvy0Oec8gvCZGgDo/1M4LIyDshl30rPpYKEE4u985Qnj+SzgEB3oLgFiUEIR E+V4sHuycmpsmSOyp5zX8IZqYu45l+R65gDyfMKWS2zGjHYz0Yfgcdn2/iNHobOKp0ut J9AG97tIOr59m5l6WB8wrvulVNzWTocuNavkScWwKc4G3GxsyLNq3pS8I8YGhXkX/z/Q OylSONRpxYqsIIqjkI2LiOUtsSRa3ex1TYXv4XkuFI4imxbg0egy7FozsBycQhejOckO pr0dYaUUAgUSH34Q3uM8DbO7pPr7/NiwmrfNlz5SzbBc2stf7wEiZSSxeRR5v2w914mY zqqg== 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=vULg10VFUKCcxA33ULRrabFkcCCQHvNGKoYN+ocl8AZjh+FReDdGIhA4arQhP+LPM9 wdhLhLwq+VvZmPInmQLtKwih7VdkqpNrGz+7MzBC7GvNyUcFwmAIutKFcORF/hA4cBHh yuode/XvfLCZUMMXMR+h1F4TbV/kLCH9XwWMY8ZRthU+7UpoJBvWlTWe6AsDt48/z215 9KFFFyCFA8SzrqXmC08RvYUT7We3Zx4b6Sjai+2PtnNW7n4IhwC8lzdTzyX1hiwqo1Jb itR05iXo1xbS+BduK6wOxzUchO58lSWliYZR+Z8q3m4KSSO2UxXpsb7v1jM14maM019P jmMw== 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 q71si183038qkl.255.2019.02.12.06.49.13 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Feb 2019 06:49:14 -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 09C6515F26; Tue, 12 Feb 2019 14:49:13 +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 2EBC85C240; Tue, 12 Feb 2019 14:49:09 +0000 (UTC) Received: from [10.1.2.1] (localhost [IPv6:::1]) by firesoul.localdomain (Postfix) with ESMTP id 5AAB2306665E6; Tue, 12 Feb 2019 15:49:08 +0100 (CET) Subject: [net-next PATCH V2 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: Tue, 12 Feb 2019 15:49:08 +0100 Message-ID: <154998294830.8783.13100889845783259630.stgit@firesoul> In-Reply-To: <154998290571.8783.11827147914798438839.stgit@firesoul> References: <154998290571.8783.11827147914798438839.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.28]); Tue, 12 Feb 2019 14:49:13 +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 Tue Feb 12 14:49:13 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: 10808083 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 310D51575 for ; Tue, 12 Feb 2019 14:49:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1F4692B851 for ; Tue, 12 Feb 2019 14:49:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1305B2B878; Tue, 12 Feb 2019 14:49:25 +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 983012B851 for ; Tue, 12 Feb 2019 14:49:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 769668E0005; Tue, 12 Feb 2019 09:49:23 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 719A18E0001; Tue, 12 Feb 2019 09:49:23 -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 6306D8E0005; Tue, 12 Feb 2019 09:49:23 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qt1-f197.google.com (mail-qt1-f197.google.com [209.85.160.197]) by kanga.kvack.org (Postfix) with ESMTP id 3841D8E0001 for ; Tue, 12 Feb 2019 09:49:23 -0500 (EST) Received: by mail-qt1-f197.google.com with SMTP id 65so2874956qte.18 for ; Tue, 12 Feb 2019 06:49:23 -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=k6claRKQolSqXhuGN5g6xDtCSZ+CMEStpkNqDx4jpqk=; b=XF8xvuvZCpcPY0d4oAYbtsY7Jm2sUj2pug8hMBjmgK20Ot+xCo+Eu+R5ETj6jl6FxQ qk3uEmyETx+fIMxdxmZkDUb08BDZUBEHPLHxxFqTc+80pYJy4DeOKRuztgUoY6BwEvg8 M90DvnllFACHkVaD8t2AqJpVIA9YFMo4MJu6K96422ML3Q9AM7tEFLKVI62l+Mctd6aN qLKFW8Tfu05i5vgDzyxklLoBpdLAjNd6TVCUTSwW88HGj5LZ2sSUtUD9ExR6zouXkk/U r229TgFB2VurD6itZDYgmmXJK66nP8GCb1npoS4yx4ERWYXyLuZDuQN7dvPJtcb7NHF4 QQBA== 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: AHQUAubntarvyvymWRu3RzeiF8YAziuRW8whHb8WNvvVKwniC5F7AAWz aEUugEzuF4+trQsYuhPTqDVfjZhWz5wgdg0bK43YPp/l0bnTMEb2sfcEqpJDhQJj1O4BQYScc42 Ezma1HcgYCb0miLlNwSco4ZWUjWskovR0ZyZXUv6+VVwDlgWUOMhBTTfvsc/Jr4rqFA== X-Received: by 2002:a0c:966d:: with SMTP id 42mr871732qvy.109.1549982961522; Tue, 12 Feb 2019 06:49:21 -0800 (PST) X-Google-Smtp-Source: AHgI3IbUlKB+OCYYMPdTJQbaY3LvujNExTvpp2MHk42/tVW+tFTTXkGJOX0LqUcoqoZYt/faz+bS X-Received: by 2002:a0c:966d:: with SMTP id 42mr871619qvy.109.1549982959259; Tue, 12 Feb 2019 06:49:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549982959; cv=none; d=google.com; s=arc-20160816; b=EmSCnEc6pBCZ5lsDLXhKZDgKf0O6Bx2jI9+HTy4qHy7md2NUiCXCgv3TPz7/H8elpg vBbOgnkosl7Oc/UDy2bNatXYnRBjkEmkCNeQUAs/Y40Kqep0RSfJJkeuo84H4mDyuisT /SoGLM6KV5wXrnzq6dBGK9oPpRShhjZ651YPDNOlltQ6hycgpS5WOP6KosEjscCsLXRl bsaLCnl7pWUjNoST+Ww0enAlmKTirQayjot5mmA78Thh5otBk1mYQBdUbZzywhC8xrOE 6bKa8fvcur57O32LZLF4elBKgWUagL/VckV0FuaKW5BVNfgt1sZ4cRxxFq12hJyls/V/ CEfg== 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=k6claRKQolSqXhuGN5g6xDtCSZ+CMEStpkNqDx4jpqk=; b=EDJ1h491KwUkOTDAbypOKkZH4yRY6bVaz0lCkwgwgH9dnkTeOMWamFwAqlzEW+irNa fgBsWyevU7pN3Y9pwzRqKg6WgmHAYnOka6ba0zyzrbtz4EOwsSt6XgxlWVOUnvIpqDlv 7bGZ6Xd86QrSh9uhdQDk8RU38W462UlQ7Bcq+6emFWWpeCKknZ/7VG8lYSaStgzVpGXc 3h2OIQiOXR+dwdCfcXg5d4VkOIaFG5mHD4kXa8b5lhzPmYEy5bwjNf4B45kqL6cSg1b1 xGZcFpQLN3bzgQfr8N+7c1f0DdaAzIAuzY+4hnQ7P4AyzR2F7e+CE5zs0n6gK1EF1PTz y+dw== 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 z8si2974309qvn.117.2019.02.12.06.49.19 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Feb 2019 06:49:19 -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 72A143DBD2; Tue, 12 Feb 2019 14:49:18 +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 4214162662; Tue, 12 Feb 2019 14:49:14 +0000 (UTC) Received: from [10.1.2.1] (localhost [IPv6:::1]) by firesoul.localdomain (Postfix) with ESMTP id 6C204306665E6; Tue, 12 Feb 2019 15:49:13 +0100 (CET) Subject: [net-next PATCH V2 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: Tue, 12 Feb 2019 15:49:13 +0100 Message-ID: <154998295338.8783.14384429687417240826.stgit@firesoul> In-Reply-To: <154998290571.8783.11827147914798438839.stgit@firesoul> References: <154998290571.8783.11827147914798438839.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.30]); Tue, 12 Feb 2019 14:49:18 +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. 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..7e624c2cd709 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_attr(pool->p.dev, dma, + PAGE_SIZE << pool->p.order, pool->p.dma_dir, + DMA_ATTR_SKIP_CPU_SYNC); page->dma_addr = 0; }