From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5F11DA0471 for ; Tue, 13 Aug 2019 08:50:41 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0A4141B94A; Tue, 13 Aug 2019 08:50:40 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 73A035681; Tue, 13 Aug 2019 08:50:38 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Aug 2019 23:50:37 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,380,1559545200"; d="scan'208";a="327592433" Received: from irsmsx108.ger.corp.intel.com ([163.33.3.3]) by orsmga004.jf.intel.com with ESMTP; 12 Aug 2019 23:50:35 -0700 Received: from irsmsx105.ger.corp.intel.com ([169.254.7.73]) by IRSMSX108.ger.corp.intel.com ([169.254.11.50]) with mapi id 14.03.0439.000; Tue, 13 Aug 2019 07:50:35 +0100 From: "Ananyev, Konstantin" To: Jerin Jacob Kollanukkaran , "dev@dpdk.org" CC: "thomas@monjalon.net" , "stable@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH] bpf: fix to allow ptr stack program type Thread-Index: AQHVTs+w6eiuBSAK7kqssbVdAgwC16b3NM2AgAAPwwCAAB4uUIAA/huAgABH6cA= Date: Tue, 13 Aug 2019 06:50:34 +0000 Message-ID: <2601191342CEEE43887BDE71AB977258018115DE3B@irsmsx105.ger.corp.intel.com> References: <20190809162919.5967-1-jerinj@marvell.com> <2601191342CEEE43887BDE71AB977258018115CEAE@irsmsx105.ger.corp.intel.com> <2601191342CEEE43887BDE71AB977258018115D7C8@irsmsx105.ger.corp.intel.com> In-Reply-To: Accept-Language: en-IE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYmFhMjZmNmItNTFjYS00NjBiLTgxOTctMzhkZWE4MjdmY2NmIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiTG94Rlg5eTlnNDNEd21EZ09SSm1cLzhNeUZsVEo3NDlMa3Ftbk5qcUt0Z2thS0xvUEtQd0p5YzVqNWVuN2RXVDMifQ== x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.2.0.6 dlp-reaction: no-action x-originating-ip: [163.33.239.182] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] bpf: fix to allow ptr stack program type 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Hi Jerin, > > > > > > > > > > bpf_validate does not allow to execute RTE_BPF_ARG_PTR_STACK for > > > > > no reason. > > > > > > > > I believe there is a reason, > > > > ARG_PTR_STACK is reserved for memory within BPF program internal > > > > stack only. > > > > User that calls BPF program should never pass parameter with that t= ype. > > > > > > OK. > > > Shouldn't we remove that from public header file > > > (lib/librte_bpf/rte_bpf.h) then ? > > > > Probably... or might be just put extra comments to mark it as internal? > > The reason I left it here, so we can add new public values for enum her= e, > > before RTE_BPF_ARG_PTR_STACK. > > Of course in theory we can use for RTE_BPF_ARG_PTR_STACK some > > reserved value instead. > > > > > > > > > If the user allocates parameter for bpf function on the stack, he > > > > can still use RTE_BPF_ARG_PTR for it. > > > > > > I see the _stack_ is only allocated under RTE_BPF_ARG_PTR_STACK check= s > > in bpf_validate.c. > > > Can you check? I agree that stack should be allocated for > > RTE_BPF_ARG_PTR as well. > > > > Not sure I understand your query here... > > Each BPF program can use up to MAX_BPF_STACK_SIZE bytes for stack. > > Though to avoid JIT to allocate unused space for the stack, in bpf_vali= date.c > > we figure out does given BPF program really allocate things on the stac= k and > > if yes, how many bytes is needed. > > This info is stored in rte_bpf.stack_sz and can be used later by the JI= T. > > Let say for x86 jit is used in emit_prolog(). >=20 > I thought, stack will be allocated only when user gives > RTE_BPF_ARG_PTR_STACK. > I tested following program with RTE_BPF_ARG_PTR. It allocates stacks > Properly. So everything is good. >=20 > stdw [r10-64], 0xab > mov r0, 0 > exit >=20 > I will modify this patch to following to avoid any confusion to user: > 1) Change RTE_BPF_ARG_PTR_STACK to RTE_BPF_ARG_RESERVED in public header = file > 2) In the implementation #define RTE_BPF_ARG_RESERVED BPF_ARG_PTR_STACK >=20 > Is it OK? Yes, sounds like a good approach to me. Thanks Konstantin