From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 1CCD21B3F4 for ; Tue, 3 Apr 2018 16:57:35 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Apr 2018 07:57:34 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,401,1517904000"; d="scan'208";a="33888137" Received: from irsmsx101.ger.corp.intel.com ([163.33.3.153]) by fmsmga002.fm.intel.com with ESMTP; 03 Apr 2018 07:57:33 -0700 Received: from irsmsx105.ger.corp.intel.com ([169.254.7.216]) by IRSMSX101.ger.corp.intel.com ([169.254.1.176]) with mapi id 14.03.0319.002; Tue, 3 Apr 2018 15:57:33 +0100 From: "Ananyev, Konstantin" To: Jerin Jacob CC: "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH v2 5/7] bpf: introduce basic RX/TX BPF filters Thread-Index: AQHTyE05hT6KffBHaUu9pmUd9VBIM6PuBwGAgAEXGkA= Date: Tue, 3 Apr 2018 14:57:32 +0000 Message-ID: <2601191342CEEE43887BDE71AB977258A0AB7FA5@irsmsx105.ger.corp.intel.com> References: <1520613725-9176-1-git-send-email-konstantin.ananyev@intel.com> <1522431163-25621-6-git-send-email-konstantin.ananyev@intel.com> <20180402224440.GB1501@jerin> In-Reply-To: <20180402224440.GB1501@jerin> Accept-Language: en-IE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZGM1MzgwMWItMDA5Zi00MWFkLTljMzAtODQwOTRhNTkwYzBmIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjUuOS4zIiwiVHJ1c3RlZExhYmVsSGFzaCI6IjlZNXh4Q1pudWFjeU5ZaUFXY0NETXhBZW9kek9Ha1wvU28yVTF3V2oxelQwPSJ9 x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.0.116 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 v2 5/7] bpf: introduce basic RX/TX BPF filters 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, 03 Apr 2018 14:57:36 -0000 Hi Jerin, >=20 > Hi Konstantin, >=20 > > +/* > > + * Marks given callback as used by datapath. > > + */ > > +static __rte_always_inline void > > +bpf_eth_cbi_inuse(struct bpf_eth_cbi *cbi) > > +{ > > + cbi->use++; > > + /* make sure no store/load reordering could happen */ > > + rte_smp_mb(); > > +} > > + > > +/* > > + * Marks given callback list as not used by datapath. > > + */ > > +static __rte_always_inline void > > +bpf_eth_cbi_unuse(struct bpf_eth_cbi *cbi) > > +{ > > + /* make sure all previous loads are completed */ > > + rte_smp_rmb(); >=20 > We earlier discussed this barrier. Will following scheme works out to > fix the bpf_eth_cbi_wait() without cbi->use scheme? >=20 > #ie. We need to exit from jitted or interpreted code irrespective of its > state. IMO, We can do that by an _arch_ specific function to fill jitted = memory with > "exit" opcode(value:0x95, exit, return r0),so that above code needs to be= come out i n anycase, > on next instruction execution. I know, jitted memory is read-only in your > design, I think, we can change the permission to "write" to the fill > "exit" opcode(both jitted or interpreted case) for termination. > > What you think? Not sure I understand your proposal... Are you suggesting to change bpf_exec() and bpf_jit() to make them execute = sync primitives in an arch specific manner? But some users probably will use bpf_exec/jitted program in the environment= that wouldn't require such synchronization. For these people it would be just unnecessary slowdown. If you are looking for a ways to replace 'smp_rmb' in bpf_eth_cbi_unuse() = with something arch specific, then I can make cbi_inuse/cbi_unuse - arch specific with keeping current impleme= ntation as generic one. Would that help? Konstantin >=20 > > + cbi->use++; > > +} > > + > > +/* > > + * Waits till datapath finished using given callback. > > + */ > > +static void > > +bpf_eth_cbi_wait(const struct bpf_eth_cbi *cbi) > > +{ > > + uint32_t nuse, puse; > > + > > + /* make sure all previous loads and stores are completed */ > > + rte_smp_mb(); > > + > > + puse =3D cbi->use; > > + > > + /* in use, busy wait till current RX/TX iteration is finished */ > > + if ((puse & BPF_ETH_CBI_INUSE) !=3D 0) { > > + do { > > + rte_pause(); > > + rte_compiler_barrier(); > > + nuse =3D cbi->use; > > + } while (nuse =3D=3D puse); > > + } > > +}