From patchwork Thu Aug 15 12:13:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 171436 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp2106840ily; Thu, 15 Aug 2019 05:14:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqwAbH87TxxyZYPeIQXVprNHgnNqPKMcoueRRLkHgF1FNFUCq9NNowTf0s+4Gx3PRuvOd3/d X-Received: by 2002:a17:902:b591:: with SMTP id a17mr4125767pls.189.1565871277035; Thu, 15 Aug 2019 05:14:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565871277; cv=none; d=google.com; s=arc-20160816; b=hZ6Odkcmzrt0eGqO63QW9dk13cUmocW06PWFijrdvzET5fY0vmYpWx/jJBZVb6/HbO NLVDhy8vDmQDudJ6trZB3Ib+kBqSwLBkkuTD393kyrQjdZrhrj5rA6RsTmHok+mvHQaW 7Fu/4xwIRiN5yd3K93zCDx0oHjrq734cLWX1ddqysYQHtZk0S3hJfj/szIXAmY+1Uz6Z dIQAs9/sVUK0fowXo6/ZwZgRwJIez3JvkO4tpEXHZ6WGjfm5Wb59ESDG0fXejMao4lSE 4Xd3bkGUqSm5GIIZMHSYFVKfNFlUVaHz9yperMyAuIAQt99FVJfrz3/HYDfKToSUXS1+ oQVQ== 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=aIVfXCW1+kiXSGueAdzDW1yyefj6NecEzYan4H+pqQc=; b=MeHVuTPEjH+aqCbf38BgBpxGm+5VqThVG/nJN5lbAM7l1tMlYnJsH3cTDVO+xuKPKN 8NnF/OOdt0nxInGGf+PWP2ss4lEXnxGAL8Sj96j31A6l/aF0moP6IrBI9xQkaFY/lDeF V1LXtEHTHQ3GaAZt4asAwkQC4NK++Yrx0oN+WmuDIH/mB+BIHdxetu3W8ToOun0uBABE cM1przc32pAv4Nud/u6x/Pjefs7rD5R3xrJ5umTv+PkxxZMueGMB8iQL4CiOmvhDUzyC AOji/sYArhc8a/YHi3Js7jK2flCgSnqSmFmTlRqdEfV+gs7LqtJGKwUaxgrthNmA8xBf dhMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IWRo0YgI; 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 n14si1990139pfq.108.2019.08.15.05.14.36; Thu, 15 Aug 2019 05:14:37 -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=IWRo0YgI; 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 S1731774AbfHOMOg (ORCPT + 8 others); Thu, 15 Aug 2019 08:14:36 -0400 Received: from mail-lf1-f67.google.com ([209.85.167.67]:36781 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731777AbfHOMOc (ORCPT ); Thu, 15 Aug 2019 08:14:32 -0400 Received: by mail-lf1-f67.google.com with SMTP id j17so1510142lfp.3 for ; Thu, 15 Aug 2019 05:14:30 -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=aIVfXCW1+kiXSGueAdzDW1yyefj6NecEzYan4H+pqQc=; b=IWRo0YgIC5PrnJ7KHBk5p2MKI1bMnA25MrpR3+u6sXtARJMClbHlRjCEeBl8LlYmw+ CuA31luU5HMV8WIcc8wNZzm3INx7zoxVpNydrj/gZHlq3e6d7oTsqmtP/NkFCyrMsRvF 36oQVwiV3yUfI0TdJSpqkg73xRcBNxJBbyaqRQE+Xe/z1xejqHw1z1j67k8meNUe1BVU Mb7yn4eVM87G0tC/eNq9T/gJtQiOquVYAIS0t5nmxbHTyZkgyvRm0tyaatmWjeeghO1g 3Ab7WzGzwRqzwZ5zQS5gisf5Nnj7vvq543McaqHLPDAo0FNTP+icYMYi/mj7t2rAzo1k ybsw== 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=aIVfXCW1+kiXSGueAdzDW1yyefj6NecEzYan4H+pqQc=; b=oHjMpmTHN9hOCIc3rQ4hiMSvD62+BJ+lPi/lkwpTOg0Lf4TO5ZYIQI3wqDRm99Nep6 GU7DYGj30UvNzkfFb/t22IIZk1AjkXWAvmY/TvBzvsIEAh+hFSQdAykuI0QN33Bg10Dc 8VRWmLkFX0raJvYwn5MI4aIfgKY1fwgrlAGTAYoAI5b3Xt72PCoPxhcfVgor+G/3GGuk PMio6vcrSzfIE0z0rTJxSHxvosu/O3yTbhPatIFPCkjIcTYtnJph6Nmc3ZIz+Y3Nhhcn d0OrPo6WrREUR5CA5vtgQ4FkD4lyBkojyAITM7EOOZHhZnDhKut8M3YE5iBElpVUiau2 lRoQ== X-Gm-Message-State: APjAAAXIQwAppC/jhaAPBWfJW2a7tUxJs40B7TGh3ynSQcc2zVGtMjV9 PI7RR3Zw26flOlLh/Yx8E8ui7g== X-Received: by 2002:ac2:599b:: with SMTP id w27mr2300688lfn.75.1565871270040; Thu, 15 Aug 2019 05:14:30 -0700 (PDT) Received: from localhost.localdomain (168-200-94-178.pool.ukrtel.net. [178.94.200.168]) by smtp.gmail.com with ESMTPSA id q25sm462060ljg.30.2019.08.15.05.14.28 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Thu, 15 Aug 2019 05:14:29 -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, jlemon@flugsvamp.com, yhs@fb.com, andrii.nakryiko@gmail.com, Ivan Khoronzhuk Subject: [PATCH bpf-next v2 3/3] samples: bpf: syscal_nrs: use mmap2 if defined Date: Thu, 15 Aug 2019 15:13:56 +0300 Message-Id: <20190815121356.8848-4-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190815121356.8848-1-ivan.khoronzhuk@linaro.org> References: <20190815121356.8848-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. Declaration of __NR_mmap can be skipped and it breaks build. Signed-off-by: Ivan Khoronzhuk --- samples/bpf/syscall_nrs.c | 6 ++++++ samples/bpf/tracex5_kern.c | 13 +++++++++++++ 2 files changed, 19 insertions(+) -- 2.17.1 diff --git a/samples/bpf/syscall_nrs.c b/samples/bpf/syscall_nrs.c index 516e255cbe8f..88f940052450 100644 --- a/samples/bpf/syscall_nrs.c +++ b/samples/bpf/syscall_nrs.c @@ -9,5 +9,11 @@ void syscall_defines(void) COMMENT("Linux system call numbers."); SYSNR(__NR_write); SYSNR(__NR_read); +#ifdef __NR_mmap2 + SYSNR(__NR_mmap2); +#endif +#ifdef __NR_mmap SYSNR(__NR_mmap); +#endif + } diff --git a/samples/bpf/tracex5_kern.c b/samples/bpf/tracex5_kern.c index f57f4e1ea1ec..35cb0eed3be5 100644 --- a/samples/bpf/tracex5_kern.c +++ b/samples/bpf/tracex5_kern.c @@ -68,12 +68,25 @@ 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; +} +#endif + +#ifdef __NR_mmap 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;