From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 7F0EA2BA5 for ; Tue, 13 Mar 2018 18:47:37 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Mar 2018 10:47:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.47,465,1515484800"; d="scan'208";a="25335291" Received: from irsmsx101.ger.corp.intel.com ([163.33.3.153]) by orsmga006.jf.intel.com with ESMTP; 13 Mar 2018 10:47:34 -0700 Received: from irsmsx105.ger.corp.intel.com ([169.254.7.221]) by IRSMSX101.ger.corp.intel.com ([169.254.1.5]) with mapi id 14.03.0319.002; Tue, 13 Mar 2018 17:47:33 +0000 From: "Ananyev, Konstantin" To: Jerin Jacob CC: "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH v1 1/5] bpf: add BPF loading and execution framework Thread-Index: AQHTt8W3STwhq1JhgU6iH+08Tvu7KqPOLbUAgABHEgA= Date: Tue, 13 Mar 2018 17:47:33 +0000 Message-ID: <2601191342CEEE43887BDE71AB9772589E28F524@irsmsx105.ger.corp.intel.com> References: <1520613725-9176-1-git-send-email-konstantin.ananyev@intel.com> <1520613725-9176-2-git-send-email-konstantin.ananyev@intel.com> <20180313132433.GA564@jerin> In-Reply-To: <20180313132433.GA564@jerin> Accept-Language: en-IE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYTRhNTQ2ZTktMjRkNS00MzExLWFlZDctODM0M2ZjNmQwMzlmIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjUuOS4zIiwiVHJ1c3RlZExhYmVsSGFzaCI6IjdCOWhiZk5VbTA3Y1FXcHJXRGRzREsyNmwwWVdUSHpRRVdDaUw2WUV3Sjg9In0= x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [163.33.239.181] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v1 1/5] bpf: add BPF loading and execution framework X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Mar 2018 17:47:38 -0000 > > diff --git a/lib/librte_bpf/bpf.c b/lib/librte_bpf/bpf.c > > new file mode 100644 > > index 000000000..4727d2251 > > --- /dev/null > > +++ b/lib/librte_bpf/bpf.c > > @@ -0,0 +1,48 @@ > > +/* SPDX-License-Identifier: BSD-3-Clause > > + * Copyright(c) 2018 Intel Corporation > > + */ > > + > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > + > > +#include > > +#include > > + > > +#include "bpf_impl.h" > > + > > +__rte_experimental void > > +rte_bpf_destroy(struct rte_bpf *bpf) > > +{ > > + if (bpf !=3D NULL) { > > + if (bpf->jit.func !=3D NULL) > > + munmap(bpf->jit.func, bpf->jit.sz); > > + munmap(bpf, bpf->sz); >=20 >=20 > Any specific reason to not use this memory from huge page using rte_zmall= oc > to avoid normal TLB misses? The main reason - I'd like to keep BPF code as read-only, and jitted one as read-only and executable. About your concern - I don't think it would cause a lot of TLB misses: most BPF programs are quite small and should fit into few 4K pages. =20 At least so far, I didn't observe any dTLB miss-rate increase. >=20 >=20 > > + } > > +} > > + > > +__rte_experimental int > > +rte_bpf_get_jit(const struct rte_bpf *bpf, struct rte_bpf_jit *jit) > > +{ > > + if (bpf =3D=3D NULL || jit =3D=3D NULL) > > + return -EINVAL; > > + > > + jit[0] =3D bpf->jit; > > + return 0; > > +} > > + > > +int > > +bpf_jit(struct rte_bpf *bpf) > > +{ > > + int32_t rc; > > + > > + rc =3D -ENOTSUP; > > + > > + if (rc !=3D 0) > > + RTE_LOG(WARNING, USER1, "%s(%p) failed, error code: %d;\n", > > + __func__, bpf, rc); >=20 > How about using new dynamic logging option for this library? Good point, will try to switch to it with v2. Konstantin