From patchwork Thu Aug 8 09:38:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 170789 Delivered-To: patch@linaro.org Received: by 2002:a92:512:0:0:0:0:0 with SMTP id q18csp8318442ile; Thu, 8 Aug 2019 02:38:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqwVmZyntGAMxwODHMq00y3djyBj1hQOa2fFombF3JY6vNc9YipwsVWwk5iicMjA9wnVkepm X-Received: by 2002:a65:430b:: with SMTP id j11mr11799501pgq.383.1565257091480; Thu, 08 Aug 2019 02:38:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565257091; cv=none; d=google.com; s=arc-20160816; b=vaOuRcT2IbgOe9BjtPDU7FGPd44zQ3aRsKA8E+8sElUR0RnFucjk2G3zMKRLeqJDiE i1mrK02ULgNVtTq3hE3u+fj8iL2aqmRPks6YVr2G38P5e9LBmjt5z0lSjo9uC28ayOyZ iHRODhv3RtujzOEWykw+aUB+M5la/HsNnqpXwRMBBHiR6+MMkh9KGbTA0NxAJ/F0YRpK dV5XrdcbRC8h5N98haGVR5VUkV0EI1FeYaKwMXG3MN2PIvPMV4ERPPWCvUMKaWOiL1Mn LFJ6uIcyVLcKBBq3XDvRBpprboS3ZemCH0gwJWovi6APlgBHdWI2iWbPytYVffYRKyhh tGmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=KKq6Rq+EYX8ExcTVOf/aov+7OPET0b1D6K1n31UVB3c=; b=CR3PfBcYo7y//aV2R570LBaaBCsfMwM/0+Trrvri3cBFYxa2nOTCMvAFHzY5BcZEV/ 5FIqC/ae2A/JMnQcg9HAnzqMtVVzQZ5hVdlAhUjlTnYc2a+Pgua9s8fZFVO7jwDjx9zE fIJ6gnG1JZMv5MRTTTd5F/qdoykgg8dNId6W3N+ZvrgOPAhuwY8510CyrqfvE9BHJOUS M7sHh+C1YsEUmd5eyIR7seHbM+HSd6mq/b7aEsuXEg46Ekig4dWkMcZph0HtoEPCesE7 rS3OvU2+qnKCLRc20ntS4wl3n1RImIoAZff2bzM6An9SqggAjLr6YtS1pmYDsVTIbqnG VdoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=L7g3XM0C; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l64si1526874pjb.93.2019.08.08.02.38.11; Thu, 08 Aug 2019 02:38:11 -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=@linaro.org header.s=google header.b=L7g3XM0C; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732615AbfHHJiJ (ORCPT + 28 others); Thu, 8 Aug 2019 05:38:09 -0400 Received: from mail-lf1-f67.google.com ([209.85.167.67]:33362 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732589AbfHHJiJ (ORCPT ); Thu, 8 Aug 2019 05:38:09 -0400 Received: by mail-lf1-f67.google.com with SMTP id x3so66434408lfc.0 for ; Thu, 08 Aug 2019 02:38:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=KKq6Rq+EYX8ExcTVOf/aov+7OPET0b1D6K1n31UVB3c=; b=L7g3XM0CuaMcn8hysQiAwokrdf3uqIKmkZ8fZ7ry8SmuWC3ecsFb7VNl10/lP7yd/x /E0u/ayUH8PafZlMX+eET7r8DVS3gTNBCMsxDUZOPp9OzAXvNBxfoyu3Pq8ci6XkORQe tZFRgq9gqK1ElBj747sU15wkuSikL7IVt7CezdOFlaGps24pW942lPcXuo17N4ZBg2K4 SPp7MeMtFQMhTLstz/zV1ZALgQI16ZpLEQ3UnLh1EsCu6jnXeo/q9jOCCTOZl64TjxeQ tyo8jYFPeauPU5tHKH4CppT/cCHg+74BpkE3cyHE3RzAg2xyluC015PMBevegNjPTb7i d7mg== 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:mime-version :content-transfer-encoding; bh=KKq6Rq+EYX8ExcTVOf/aov+7OPET0b1D6K1n31UVB3c=; b=ozrQEg8tN6fZ0j9t2QyUt7Iy6LmVgD1LeA6OVHg+wBVsqeVBHY2AwEzTkBmmwWHZNF 2Jh/CurbXaF53Smb0RnJHNRDIfnwQV6QnYjlxNbmbyyPWav9wvm2KuFyCcstcUhvMuKv IoxQDZengCyNI4zb7MQOgXK2M70VHx1w1yW00a1y9pef01ufllflhP2YtGmtXHfqz6Jy Tu99Osm94udTjtGHBBjJsT5aBs6jPfTdwEUSm4M4LuakiboYkmyE5AeCx6z/RpXiz19x vvxpwXnqsTc4NRYQYQydMpMWZOZD5rTvo7m5ltO8MG3W4amBE9KHzoCkiKRjw0PAXFoS JJkA== X-Gm-Message-State: APjAAAWolc1+UhqgZ3wu9RgGnSGuAiZXLTKahgFlt7gxxU/6Um6wPAaV SAkTYuuOjLgoJnppyW2gPKtEHQ== X-Received: by 2002:ac2:44ce:: with SMTP id d14mr9058953lfm.143.1565257087328; Thu, 08 Aug 2019 02:38:07 -0700 (PDT) Received: from localhost.localdomain (59-201-94-178.pool.ukrtel.net. [178.94.201.59]) by smtp.gmail.com with ESMTPSA id r21sm3444783lfi.32.2019.08.08.02.38.05 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Thu, 08 Aug 2019 02:38:06 -0700 (PDT) From: Ivan Khoronzhuk To: bjorn.topel@intel.com, magnus.karlsson@intel.com Cc: davem@davemloft.net, ast@kernel.org, daniel@iogearbox.net, john.fastabend@gmail.com, hawk@kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, xdp-newbies@vger.kernel.org, linux-kernel@vger.kernel.org, Ivan Khoronzhuk Subject: [PATCH v2 bpf-next] xdp: xdp_umem: fix umem pages mapping for 32bits systems Date: Thu, 8 Aug 2019 12:38:03 +0300 Message-Id: <20190808093803.4918-1-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use kmap instead of page_address as it's not always in low memory. Acked-by: Björn Töpel Signed-off-by: Ivan Khoronzhuk --- Based on bpf-next/master v2..v1: included highmem.h v1: https://lkml.org/lkml/2019/6/26/693 net/xdp/xdp_umem.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) -- 2.17.1 diff --git a/net/xdp/xdp_umem.c b/net/xdp/xdp_umem.c index 83de74ca729a..a0607969f8c0 100644 --- a/net/xdp/xdp_umem.c +++ b/net/xdp/xdp_umem.c @@ -14,6 +14,7 @@ #include #include #include +#include #include "xdp_umem.h" #include "xsk_queue.h" @@ -164,6 +165,14 @@ void xdp_umem_clear_dev(struct xdp_umem *umem) umem->zc = false; } +static void xdp_umem_unmap_pages(struct xdp_umem *umem) +{ + unsigned int i; + + for (i = 0; i < umem->npgs; i++) + kunmap(umem->pgs[i]); +} + static void xdp_umem_unpin_pages(struct xdp_umem *umem) { unsigned int i; @@ -207,6 +216,7 @@ static void xdp_umem_release(struct xdp_umem *umem) xsk_reuseq_destroy(umem); + xdp_umem_unmap_pages(umem); xdp_umem_unpin_pages(umem); kfree(umem->pages); @@ -369,7 +379,7 @@ static int xdp_umem_reg(struct xdp_umem *umem, struct xdp_umem_reg *mr) } for (i = 0; i < umem->npgs; i++) - umem->pages[i].addr = page_address(umem->pgs[i]); + umem->pages[i].addr = kmap(umem->pgs[i]); return 0;