Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp888329ybl; Tue, 13 Aug 2019 04:18:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqxwOEvINk0VpsuXCelcSW6YVDWCausthQWW9yytCO1TjzU0bAe2+7RlrhF3T9l67cbqd3fz X-Received: by 2002:aa7:9d07:: with SMTP id k7mr6302603pfp.94.1565695100006; Tue, 13 Aug 2019 04:18:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565695099; cv=none; d=google.com; s=arc-20160816; b=eHJX3OQBUUybA8XANX5JKSST4M+wtTS0yh2s2qZF0T3s6H1+csuguSvMr+q2agiO7I UZd4avkzGEbO0i0Jc8jeSSjgPDAHI/dbFsd/V3T5TBGk6lw/g1CueDgzumEwogvUOkeE e/P6FN76+tf3LmrbduD4UtizjDlKRGWEjSPu0c3oD/WoqPx+eS5AxpZHpMO5WP6Li2Hi JTLyEFOb+U4iuAv/wd4eArZOefZMvASN5q6hj/H5DmWy/YQBLEnL3qgOVfRNNOCvE1aG DpJ83HAxTjQGQ9S5WeapRfgoFKTWpE/kt+J2MkfkFEm3mnckIRo2i4pbPwtDesj3BDcO atfg== 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=DMlX9eEb1Dv80gkNSsEGX/2WCzLupkjGrm/gjwfUTwvxk6adbfFwdzImWixLRURDHe 91nHy7LnCxZR3F0sN9QuKBdRsrXgrUfNOidn9Gc6IikCBlwff4oBBC89aRmmwySsTigE 4WWH2ny53/8Rn1MVG1E2DCoeRF3waHqYN/LoulqxbTcvcyknJOeVrLyBDFxVf+Tw1wEq UxDSkmp+zmG3mHrGMh8S3Wd3Nxc01w9bCzejYiPFArtkgnE2JIxrRh/fK1sXUmUrHIyx Jixu5s8FGYzPn+7O6e4pG1LA4DLzNzaRM9/VcAP6/Bf9I99+/KPOXZjIk1Nr67hxV4ay 2lRQ== 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 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 l1si23227897pgn.367.2019.08.13.04.18.04; Tue, 13 Aug 2019 04:18:19 -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=Y0RUcptj; 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 S1728936AbfHMKX4 (ORCPT + 99 others); Tue, 13 Aug 2019 06:23:56 -0400 Received: from mail-lf1-f53.google.com ([209.85.167.53]:42544 "EHLO mail-lf1-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728914AbfHMKXw (ORCPT ); Tue, 13 Aug 2019 06:23:52 -0400 Received: by mail-lf1-f53.google.com with SMTP id s19so13706284lfb.9 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=JmhLeDbi5isvrggadAXW8jNkzi92eNuHEmvFaiMcpIQLpLP+dEH+Hqe4BxMwPsRbup x8LxZ4CHZbvadvftir50JMODM7GqOhE/nAxOzkCFTrxmFKyKOpWcIwek2uCJHdciGVHY i5VOd8cHvxDpvzSAbNmzJFVoyvO5edZS6wJt5WJw9XUt4LQXD4dXJF8OG5sKJ4pxyncH tRDbuRVTXkCgho31ies9cXYhDvTggf13lCUSoeXYcQIxY85LkvNnzvOK8Y5x9zKZeT5b FzHt6g20EyseULV6ZV0oXwbrjs/qWgObOUS3P0rDN9RSzg42FoKj/UWXBKl43fQ97E+e Kgjw== X-Gm-Message-State: APjAAAVi6V+5+33QsF+bYV1V/N4o2njLX0xvn/m60zJuESJJxJmpcuLL O4O7TZKPiu3KQa8ZyXlHT5qy+A== 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: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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(+) 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; -- 2.17.1