From patchwork Tue Aug 13 10:23:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 171178 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp707339ily; Tue, 13 Aug 2019 03:23:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqx91KrJj0Y8cYN4471jX7nqEjRUEmmtgGXsNMmjtby04WdrqRXeH9tifHN7QiEgxCCXdi27 X-Received: by 2002:a17:90a:cd03:: with SMTP id d3mr1523533pju.117.1565691832162; Tue, 13 Aug 2019 03:23:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565691832; cv=none; d=google.com; s=arc-20160816; b=Fsm/pUy7aGCtOA5psOONKBh3EX025cHB4cNRCgHK67I8iUogx+gqNHtNokfjppl6ya o7F0FMCgU7z96hRYOFo+LYw30OLopEHlfXQiBAdG/PGIaIPixPgc/FagC93OQYVNAkrr uHNMF3IaB3bkDgJpIc2RwbZSWg/AbYb3HHfe/Cz3439f/AMX1SW1OpNlfOKUf/7/fZi3 HVAXiozhzCrnARNp2YUO5NNA4NAozDuO0TfHTkzQQQxycDshy5lWEB0QFEUQ6Q9yhdjM tOeNfr/TFjDW6EzvMcIi4t2lCydOoO0t/Eug2x5nAY6GjE6fsDRCTDF15a5OI/TUEzzj bUmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=+vEsZUSwAdb3YjNql7rDM4PtC51lwjYe4ypkHR8meNg=; b=FkGTkwUMTQfPgopdL/vfKJYx1mGiHYfQ+enHnkHHkt7NCPk+KoZGOv9rj95gdxBpG+ NWkAeSgC/k+2lRazzvydzOz3udhgCTsyPyE9JzmNEfYEQKYOqKlCZIu3y/Dl9Uk3qqPH 6CQG69xcdUyD2q7TW+AtZnls9x7tyJNBai7yVlQzBUUNdsvw+/+d5n55nQn4ArcJSRlE P9fEypOLX4rCEb5mAv4TJmaUdLyGafLkwwT2uHSrS9GIcmZ/eRqmEqzdbkrohUvyOwLL 3oWsgqiWU0N5yg5YcBV8xq1ZfrS/01dBMWzVRClVau5ANDt0pklw6BRVUMQS4afFZOEa 8g0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Oz80OPwm; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-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 h64si63950843pge.208.2019.08.13.03.23.51; Tue, 13 Aug 2019 03:23:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of netdev-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=Oz80OPwm; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-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 S1728911AbfHMKXu (ORCPT + 8 others); Tue, 13 Aug 2019 06:23:50 -0400 Received: from mail-lj1-f194.google.com ([209.85.208.194]:35644 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728797AbfHMKXt (ORCPT ); Tue, 13 Aug 2019 06:23:49 -0400 Received: by mail-lj1-f194.google.com with SMTP id l14so11103250lje.2 for ; Tue, 13 Aug 2019 03:23:47 -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:in-reply-to:references; bh=+vEsZUSwAdb3YjNql7rDM4PtC51lwjYe4ypkHR8meNg=; b=Oz80OPwmh9X4xSAJ07288MD1guPoiHr5QzEzTKNgbbW0yOVRUE+9R2dtHoUBEsUqOh jfyncogTYoy1qjVIr3i7veHJPy5PAhWPX4InfS2/fcPCxjXha0LkuDHcKVMFu/h35tBF 7OvwwIzhLUNCmRZq/09ERQQedSeX9zk0DwXKJqoVegM8JC2G32PctQ3IReLpRJ+mKVDp HiwFTs8BXBnbAWsMmIx81qOWKhLfmDGGrY8SLnzwyu36w01+Ny16cUGqE8QmnsU/i0X2 R5hxQLuB3m6D1bKOaEPLUABe02nOxqEFSg8c9rBfkb0AJAgNkW5LPsYVtb/aWMtMnCFx +XsQ== 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:in-reply-to :references; bh=+vEsZUSwAdb3YjNql7rDM4PtC51lwjYe4ypkHR8meNg=; b=W6as7wsIjJPmoCD2yoEo/Kv64xTd7F1qBxedqlQ7Fd3lWmekbZVm06L0HnpPgWn4z2 0QErONA+6e3rMud3afL9g9ur5Ee87bKCwtw0iJ3QjooW3D6iaiPTwhhpv2S1dXI4/XQS Z8TJqiTxp7Dp/ohfNgmMNi8Uwa/9WstZQynOB8lzR1bmGovFJwyVrOTjeODHqZtrWR/c tE3hQ7gknHS8L0LU2pQ0MOAZ4sT1SNPvfQgIqjN95gfpBlN8aPTTHy7yWmzHgx7KKpvb K6nrymYDuN/VcEv2+YrqZAPM3J1RhbRzfPV5uV754AeUW1tZS4Z8D2mn8eoktbucmtKv Hunw== X-Gm-Message-State: APjAAAWWZNxrEZdi3c23cHNL3a8Wq42eRFnpTdi8Io1RNjPGnHsdvzkr 827lEtvIFCn3doTubsYZ2eu+JA== X-Received: by 2002:a2e:9ad1:: with SMTP id p17mr21649917ljj.34.1565691827242; Tue, 13 Aug 2019 03:23:47 -0700 (PDT) Received: from localhost.localdomain (168-200-94-178.pool.ukrtel.net. [178.94.200.168]) by smtp.gmail.com with ESMTPSA id e87sm24796942ljf.54.2019.08.13.03.23.46 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 13 Aug 2019 03:23:46 -0700 (PDT) From: Ivan Khoronzhuk To: magnus.karlsson@intel.com, bjorn.topel@intel.com Cc: davem@davemloft.net, hawk@kernel.org, john.fastabend@gmail.com, jakub.kicinski@netronome.com, daniel@iogearbox.net, netdev@vger.kernel.org, bpf@vger.kernel.org, xdp-newbies@vger.kernel.org, linux-kernel@vger.kernel.org, Ivan Khoronzhuk Subject: [PATCH bpf-next 1/3] libbpf: add asm/unistd.h to xsk to get __NR_mmap2 Date: Tue, 13 Aug 2019 13:23:16 +0300 Message-Id: <20190813102318.5521-2-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190813102318.5521-1-ivan.khoronzhuk@linaro.org> References: <20190813102318.5521-1-ivan.khoronzhuk@linaro.org> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org That's needed to get __NR_mmap2 when mmap2 syscall is used. Signed-off-by: Ivan Khoronzhuk --- tools/lib/bpf/xsk.c | 1 + 1 file changed, 1 insertion(+) -- 2.17.1 Acked-by: Jonathan Lemon diff --git a/tools/lib/bpf/xsk.c b/tools/lib/bpf/xsk.c index 5007b5d4fd2c..f2fc40f9804c 100644 --- a/tools/lib/bpf/xsk.c +++ b/tools/lib/bpf/xsk.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include From patchwork Tue Aug 13 10:23:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 171179 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp707365ily; Tue, 13 Aug 2019 03:23:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqxth/vAfNh/uQ3+mHeoz2uaKK61rlYpeSoaEusUzVn7u00LU73h8VH+eMamE7JZlB157qRp X-Received: by 2002:a63:66c5:: with SMTP id a188mr33779753pgc.127.1565691834382; Tue, 13 Aug 2019 03:23:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565691834; cv=none; d=google.com; s=arc-20160816; b=fKybuRHwo5sYrNai+XSNNfPwUlK7xvhQqTXksSlKix7HamjSpbXB5FnLx8k/zHjt3m VT9KXTp4q0jk2HA1rYA/HndBvZpWNDgisJ6GArFI/Pqi1/OQjQ0msNeW6bbIAVRy2XjC 5AOkJbyI+JwE4+qruF8vAfg3QVgcmsJk9b/DjjgvQyTYCICvL0K/EmwzBMHM+KSBaYK3 uHE4k+klflFMlaiTndcwspygeGMp8WvBdTyBwW76A7urP0qrCAUHB0eisVmmud2fuZgE Oqzp+BMhq/gIL5mkOWhUrfP9NXZAIS7RwR0aqJEAKRHV6DuusxZtD18X2EYxalZ1yP4l GElA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=mFrYdNufqJMBiXr6Fl+Xru3C6SYEreBVGiSnrc3weyc=; b=i3iqC2AQZNwW3z5GaTOQoTRWvmvL5zU5pNe0vr4b7QrwyeSSwokwbAscj1u1hJQjlM Tfs4K5zRXes3MCP1FKvAlqoCORoszCB7Ib9daw6qaB+PsTELfTSTHngIEW/N7t/NTC9W ZKQfk2e+Qvy3LK9DviOem99bUnd9a8VCYnpxtCL+niVt4Om07laxHFeYH94flxY28BML Ovbb+UHNwesDe10nB11JYXGxtafGr90hnRwcME1GvZcIYbV/mIuBUC8zLMtaCO2XkWxp 0Zi4v17Jp7+WAQH6v6AqObAE10Oom5lrThv++RNZO5Wk9d8EfS0tMku6HLISU4u0GYE8 SLZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Y0RUcptj; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-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 h64si63950843pge.208.2019.08.13.03.23.54; Tue, 13 Aug 2019 03:23:54 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of netdev-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=Y0RUcptj; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-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 S1728933AbfHMKXx (ORCPT + 8 others); Tue, 13 Aug 2019 06:23:53 -0400 Received: from mail-lf1-f49.google.com ([209.85.167.49]:35944 "EHLO mail-lf1-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728912AbfHMKXw (ORCPT ); Tue, 13 Aug 2019 06:23:52 -0400 Received: by mail-lf1-f49.google.com with SMTP id j17so22364720lfp.3 for ; Tue, 13 Aug 2019 03:23:50 -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:in-reply-to:references; bh=mFrYdNufqJMBiXr6Fl+Xru3C6SYEreBVGiSnrc3weyc=; b=Y0RUcptj1nphOy9DUsYSiUGS5oC8t0JnfW7QiIiMtYxxcHAAIyv1N4Upb4ezqwLOrZ wuZg6ub802synfGnhYu7FTj6Q+z0l0UrajtxxBKWSW8G7D+qPTE7qJu0MjppbAHzzLYm 0aOOHQIFsG4z6eviJ8yb8Cqdyw0y4/2IaU/kCNA0Qu0+tbdQv0fRSnCnCPEJJRJ6eat8 WZgcxw37voDsQAoCE3tGerY8pE+0S3QnAax+CxfMuNScM6koos5vYuslETUmiTFak7pq p1gRy0yl2o4tUwFoqJ8fYbKrrGXdLOK5OILS8ajqrmb8qo+wJlZYxAc/vIIwa6vYzrYR bYLw== 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:in-reply-to :references; bh=mFrYdNufqJMBiXr6Fl+Xru3C6SYEreBVGiSnrc3weyc=; b=YFM56VvxGGkZ1KN70ALTuJZsX6dHS6QpFMlVIJ63LBWenDda+LvNaLCI285Dz2cVB2 /d4zAfn6tIb/2U8vc7ZKdKpVphyk1rclCN7XVKsyVUNlK6wjky2sZu9AIMZEfDHZThhO snx/bzLjAC/C00otnqmaaRAlQUR+aI8Jp91ozIxqDpoQy0M7ZYWzeycifL1VppI06fau xV2sRGZePBziKSGQW/u3A3bO2bL2kU+H+b21F8iZqYNkcK2EtmD5+AYfIX5OO9C7V934 bChYgi4+Pdb4Y8NrR7CMvomtsp8o7GadX0NWsm/V9nhGccASUXzyx+XBrJuv5EGBgaNt cEog== X-Gm-Message-State: APjAAAXwt4OOGfrIt8p1s8LammNESlbl+hpUjXznfI4nCD6p/JMYNV9H AjyiO1ccTHCp/kgaYmXa/xfVnQ== X-Received: by 2002:a19:6041:: with SMTP id p1mr22325227lfk.6.1565691829914; Tue, 13 Aug 2019 03:23:49 -0700 (PDT) Received: from localhost.localdomain (168-200-94-178.pool.ukrtel.net. [178.94.200.168]) by smtp.gmail.com with ESMTPSA id e87sm24796942ljf.54.2019.08.13.03.23.48 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 13 Aug 2019 03:23:49 -0700 (PDT) From: Ivan Khoronzhuk To: magnus.karlsson@intel.com, bjorn.topel@intel.com Cc: davem@davemloft.net, hawk@kernel.org, john.fastabend@gmail.com, jakub.kicinski@netronome.com, daniel@iogearbox.net, netdev@vger.kernel.org, bpf@vger.kernel.org, xdp-newbies@vger.kernel.org, linux-kernel@vger.kernel.org, Ivan Khoronzhuk Subject: [PATCH bpf-next 3/3] samples: bpf: syscal_nrs: use mmap2 if defined Date: Tue, 13 Aug 2019 13:23:18 +0300 Message-Id: <20190813102318.5521-4-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190813102318.5521-1-ivan.khoronzhuk@linaro.org> References: <20190813102318.5521-1-ivan.khoronzhuk@linaro.org> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org For arm32 xdp sockets mmap2 is preferred, so use it if it's defined. Signed-off-by: Ivan Khoronzhuk --- samples/bpf/syscall_nrs.c | 5 +++++ samples/bpf/tracex5_kern.c | 11 +++++++++++ 2 files changed, 16 insertions(+) -- 2.17.1 diff --git a/samples/bpf/syscall_nrs.c b/samples/bpf/syscall_nrs.c index 516e255cbe8f..2dec94238350 100644 --- a/samples/bpf/syscall_nrs.c +++ b/samples/bpf/syscall_nrs.c @@ -9,5 +9,10 @@ void syscall_defines(void) COMMENT("Linux system call numbers."); SYSNR(__NR_write); SYSNR(__NR_read); +#ifdef __NR_mmap2 + SYSNR(__NR_mmap2); +#else SYSNR(__NR_mmap); +#endif + } diff --git a/samples/bpf/tracex5_kern.c b/samples/bpf/tracex5_kern.c index f57f4e1ea1ec..300350ad299a 100644 --- a/samples/bpf/tracex5_kern.c +++ b/samples/bpf/tracex5_kern.c @@ -68,12 +68,23 @@ PROG(SYS__NR_read)(struct pt_regs *ctx) return 0; } +#ifdef __NR_mmap2 +PROG(SYS__NR_mmap2)(struct pt_regs *ctx) +{ + char fmt[] = "mmap2\n"; + + bpf_trace_printk(fmt, sizeof(fmt)); + return 0; +} +#else PROG(SYS__NR_mmap)(struct pt_regs *ctx) { char fmt[] = "mmap\n"; + bpf_trace_printk(fmt, sizeof(fmt)); return 0; } +#endif char _license[] SEC("license") = "GPL"; u32 _version SEC("version") = LINUX_VERSION_CODE;