From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BN3-obe.outbound.protection.outlook.com (mail-bn3nam01on0048.outbound.protection.outlook.com [104.47.33.48]) by dpdk.org (Postfix) with ESMTP id ECA241C81B for ; Wed, 4 Apr 2018 19:52:04 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=uwrmxTTmEwzk4PQERCbgchbSKEvxx4y1Xa8jPi2xqjw=; b=GGVlpGgfuOZXkGAm3VD9gFQLmX+/2voXeBWIeqxn1/Oc8lHHh/pqizXodZG12XwjL0CkQnVAMbLWexbcwMRo3rN69kT7Oc3+McFmq8wf7glf9COGCs2QRvhQUM/Nt67T3pRSZtQWeFSi1skMgWLy98blD02oJvGmPWsUE2McOJI= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jerin.JacobKollanukkaran@cavium.com; Received: from jerin (106.200.202.48) by BN3PR07MB2513.namprd07.prod.outlook.com (2a01:111:e400:7bbf::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.653.12; Wed, 4 Apr 2018 17:52:02 +0000 Date: Wed, 4 Apr 2018 23:21:47 +0530 From: Jerin Jacob To: "Ananyev, Konstantin" Cc: "dev@dpdk.org" Message-ID: <20180404175146.GA8576@jerin> References: <1520613725-9176-1-git-send-email-konstantin.ananyev@intel.com> <1522431163-25621-6-git-send-email-konstantin.ananyev@intel.com> <20180402224440.GB1501@jerin> <2601191342CEEE43887BDE71AB977258A0AB7FA5@irsmsx105.ger.corp.intel.com> <20180403170015.GA24166@jerin> <2601191342CEEE43887BDE71AB977258A0AB8A4E@irsmsx105.ger.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2601191342CEEE43887BDE71AB977258A0AB8A4E@irsmsx105.ger.corp.intel.com> User-Agent: Mutt/1.9.4 (2018-02-28) X-Originating-IP: [106.200.202.48] X-ClientProxiedBy: MA1PR0101CA0028.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:22::14) To BN3PR07MB2513.namprd07.prod.outlook.com (2a01:111:e400:7bbf::10) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3b731432-d513-41f3-3906-08d59a54c66c X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:BN3PR07MB2513; X-Microsoft-Exchange-Diagnostics: 1; BN3PR07MB2513; 3:XOHRrUQxaipc/+fkQreHiczSAz2R96BbVLYYtnVcSIQ7Oz59TvBgq7skDC6/bKcm0Pk2E6qifWW1RC7zVf77X/YpW/vy8MxPo0BRgEDVY4UBV66j9UxhNjqfIf4mOP2aNzx9oLQXsiOgMOVaC5eUanwpxkPbXxoIO7sZ9FBn4pfqBis9uVBOUrRnDyc1p18DoXH3rSsr5G/UfiOJd5ZDL8TVsqPUNmG/wh/zw2nQrP8jJx20ee6oR9yAHnBpNa42; 25:OeXEQYn97A7P+v9mbOFZNRYwnVfyX4NOe+lrcV/LkfPvKU7tpcfPraX1Ncs1b2y1EUZQd/jwZ5w00+527h/jn8IA+dB0QrYsqQZR149obc8Al+f086Po3Uryset8d1KzH7Go2zSqp+khO2++uzquYxIugZVlazYJGUx6TU+MmSPH5pAWrorYnfu9xRCyKQba2AiUNfp8K1QX4GAj+BlC3PoO4i9/bc1lZtWauFKZjDWBdpr4qqVhZ8qq4tBzRy58H1oZ4rgghSYq9yQ3AZJ/2Yq+rML3iFnRC0FHVDfARn5VcjoXigGtXgPXDGomvu450a0mBsHEHQXbcPbx7nYnNw==; 31:DHnIMBV/ahNV7M4oxAzjTlojG3edth8+0Vxvx5Ysk3ZDvi1s0zB8dLYhCNKYTBAMP/YS4eZI/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5Jx2kEs2xOp4C6Dj9IefcwhKM/AKAeljSItISM0vtYtxj9sWcEfNopqLzwn/iOTOyX82/Om2S0MPXXLn2U5s7GfLj X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(228905959029699); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3002001)(93006095)(10201501046)(3231221)(944501327)(52105095)(6041310)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:BN3PR07MB2513; BCL:0; PCL:0; RULEID:; SRVR:BN3PR07MB2513; X-Forefront-PRVS: 0632519F33 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(39860400002)(366004)(346002)(39380400002)(396003)(189003)(199004)(13464003)(7736002)(81156014)(561944003)(446003)(50466002)(305945005)(956004)(16526019)(26005)(16586007)(8676002)(186003)(4326008)(5660300001)(33656002)(6496006)(11346002)(52116002)(55016002)(33716001)(33896004)(97736004)(105586002)(316002)(8936002)(81166006)(58126008)(106356001)(72206003)(386003)(2906002)(6666003)(5009440100003)(6916009)(3846002)(6246003)(66066001)(478600001)(1076002)(23726003)(42882007)(25786009)(53936002)(229853002)(93886005)(6116002)(76176011)(68736007)(486006)(47776003)(476003)(9686003)(59450400001)(18370500001); DIR:OUT; SFP:1101; SCL:1; SRVR:BN3PR07MB2513; H:jerin; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN3PR07MB2513; 23:Yy4XHwQ+qTL0CdlQZgNpi0a5T3hgrSVSLNUZckGhs?= =?us-ascii?Q?uscM0PONDwW311sbpFoSxq+GU4WIi0U8qBzplvmj4qqGWmYp5/9mLTegchH/?= =?us-ascii?Q?st42CePnH2+Zmclyez/FXk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-ascii?Q?xMdBsHQtsTsx+L04DlRk4TqT7gWznnKsDvcGthnpqGZb3ldMywcwSs0d09OU?= =?us-ascii?Q?rqon6dkYjfiox+Aawj+hukGkvzz9+mB7N3I8MZtgkPSSxKxlvGhtBTQzV0Md?= =?us-ascii?Q?5b6rt19rKEY1Z7ADY7QZ1DvYE6rmXftB+S8hlB01yUOP1nKaqAULAj3IUS3P?= =?us-ascii?Q?XzvZ4lreT3Yt1ZLMfoUcWX014lVMGlvAQZTFsdsdPqtNsiznR2A1pTB8HIln?= =?us-ascii?Q?8opYrijndMcwz93bFm9qthqxhm704g1269K+mD9ufocGptceX/2RP619I7Sm?= =?us-ascii?Q?uKnWSWmQJjYEMN0xOqmDPKjF22hP4BFRt3s6nVRJDQa8wl0CRyMGBmCm1Sc0?= =?us-ascii?Q?cBwrwFswM9tufsTxQYlyM0LXrMJvjbI0EPJExNxdg4kpF7WJxbzHxwTuk26R?= =?us-ascii?Q?5aHym6kQA=3D=3D?= X-Microsoft-Antispam-Message-Info: z4+6mGvYXd1dxYpuz3HfPZnq84ebY5s/u09ifW7iWDP8rLcYx/wON9eVmRp5XND6ukaQAy0vDYrPtaRkijISIqHbvyW/65GeYnqyf+KX2t+A50Jjr0q8LxDlxyUkv3IKJmCU7v1ncNyckszdd12IxN9lo6Ygho0NKkWMvEqWvdhNlppnir52HzCvOLs732JS X-Microsoft-Exchange-Diagnostics: 1; BN3PR07MB2513; 6:MrJCska9WecYytpImLfjR82EZitfVG8dnqoOZG9tQ2WonKJjyiv3rXLU080JEpNLkSO61ALKIUQHwTAbJixNnnm+8ItWLvKU1sIt8SGdAlncgmfRXF/ewSGF0+64ONUqBvLaB/+gqceIdLUi5MTMw5zIGdXBK0PlD3vGZGcp6SPS0yD1nwA/PzAzbKeYzGac8vfSKWH84Gx6HonmrdMcMLIt5gtJ1Yi0F+QAjo14czo0In0kudfJWMLszUh4Co0J53BebYhUy0r8t7WhqxUaxgN5iLXknTR5AWzNL5YoOVdeZKPp97+oVmxXhtQHRMx/rc15AgsIeukKKiZuES0Hlll1vhdF2ryhA9nxFkCURUvsFqFHooHNmTy4RSO4sHVW4KtU++1NIKcIKezNlDW5+aPra/AUSp/xinSzwfzBXyXkatSCH0PV9sz3VtPfgkDNoxUg80uaiamkGDMfgc4k8w==; 5:AObR/7IL1+OSskS1Ms2pAA1Fr+fqJgsRnX17bs9F9C7BQQymRvyAhyrka/FTnWxZmY2SfNf+WnsDcOLKh5VLobyEpcQUb8qFnVxxu7rYAOChSfnA8JQ1d+XMoxRDhssf+Fwm8V5FJJUpD6Gh2kH4KHi40+uappHim6QtdbK9XeI=; 24:Bd/yo0LzFlJbSmHZREoqmCYM3yr+15TrD65VaU+VXTcMs8DUqG+sEYFmvXKEaw6L01OFjaGeQ6jzQnmpPp28fWm22Dl8oyYTGuamUXrjToc= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN3PR07MB2513; 7:90tUvA3x7AD055g4FRYQyQxfJFCUOoLCTRzyOlEne28hYuCLb4lzq6bu98tZg385urtFL95h4AAl3qxRT8vs37vDS5YWfkslZVTBSWeam8ZumWMDfIx+Ek7z3xtqA6tBE+8KtFL1Ect4JDTlZziey3vhaSkUakkUifr1e2S6Dm3E9tL4N/KHfFmZIWWpgfgOdJB5SGQq7UDxyC1Xl3CWsSyCsBnyuELlNOQtf2Tjbl5xNL5JBwyJW7SbBdvcCHJO X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Apr 2018 17:52:02.6303 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3b731432-d513-41f3-3906-08d59a54c66c X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3PR07MB2513 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: Wed, 04 Apr 2018 17:52:05 -0000 -----Original Message----- > Date: Wed, 4 Apr 2018 11:39:59 +0000 > From: "Ananyev, Konstantin" > To: Jerin Jacob > CC: "dev@dpdk.org" > Subject: RE: [dpdk-dev] [PATCH v2 5/7] bpf: introduce basic RX/TX BPF > filters > Hi Konstantin, > > > > > > > > > > +/* > > > > > + * 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(); > > > > > > > > We earlier discussed this barrier. Will following scheme works out to > > > > fix the bpf_eth_cbi_wait() without cbi->use scheme? > > > > > > > > #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... > > > > If I understand it correctly, bpf_eth_cbi_wait() is used to _wait_ until > > eBPF program exits? Right? > > Kind off, but not only. > After bpf_eth_cbi_wait() finishes it is guaranteed that data-path wouldn't try > to access the resources associated with given bpf_eth_cbi (bpf, jit), so we > can proceed with freeing them. > > > . Instead of using bpf_eth_cbi_[un]use() > > scheme which involves the barrier. How about, > > > > in bpf_eth_cbi_wait() > > { > > > > memset the EBPF "program memory" with 0x95 value. Which is an "exit" and > > "return r0" EPBF opcode, Which makes program to terminate by it own > > as on 0x95 instruction, CPU decodes and it gets out from EPBF program. > > > > } > > > > In jitted case, it is not 0x95 instruction, which will be an arch > > specific instructions, We can have arch abstraction to generated > > such instruction for "exit" opcode. And use common code to fill the instructions > > to exit from EPBF program provided by arch code. > > > > Does that makes sense? > > There is no much point in doing it. It helps in avoiding the barrier on non x86 case. Right? So it is useful thing. Right? and avoid the extra logic in fastpath increment/decrement "inuse" counters for all the archs. > What we need is a guarantee that after some point data-path wouldn't try to access > given bpf context, so we can destroy it. Is there any reason why you think, above proposed solution wont guarantee the termination eBPF program? -ie, 1)memset to "exit" instruction in eBPF memory 2)Wait for N instruction cycles to terminate the program. Where N can maximum cycles required to complete an eBPF instruction. OR Are you recommending the eBPF program termination is not just enough, there are others stuffs to relinquish in order to free the bpf context? if so, what other stuffs to relinquish apart from eBPF program termination.