From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0055.outbound.protection.outlook.com [104.47.36.55]) by dpdk.org (Postfix) with ESMTP id 1EAFE1B840 for ; Tue, 3 Apr 2018 19:17:49 +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=XE0j64Y6VIeyb5L0StVPAVN1HVR3NS2vr2RejnAOuB4=; b=f9WjdeybrvHUR4TFUf0wdoWh8kVJXWe+f0vJ3D86zglY+k81Th+7BmKee0J5kKxtUMPQsh7stJ/oaDr4GR5qhiKdKBiybdwF9R885uNsZY5LxHv5o8Zwt31s3FOzhP75+auzCNab47zDjfy8fuEIXp5t0QlcCTuHIFA880anyPQ= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jerin.JacobKollanukkaran@cavium.com; Received: from jerin (106.200.202.48) by BN3PR07MB2516.namprd07.prod.outlook.com (2a01:111:e400:7bbf::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.653.12; Tue, 3 Apr 2018 17:17:45 +0000 Date: Tue, 3 Apr 2018 22:47:24 +0530 From: Jerin Jacob To: "Ananyev, Konstantin" Cc: "dev@dpdk.org" Message-ID: <20180403170015.GA24166@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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2601191342CEEE43887BDE71AB977258A0AB7FA5@irsmsx105.ger.corp.intel.com> User-Agent: Mutt/1.9.4 (2018-02-28) X-Originating-IP: [106.200.202.48] X-ClientProxiedBy: BM1PR0101CA0053.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:19::15) To BN3PR07MB2516.namprd07.prod.outlook.com (2a01:111:e400:7bbf::13) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: cae6a3cc-4472-427f-cda1-08d59986d1de X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:BN3PR07MB2516; X-Microsoft-Exchange-Diagnostics: 1; BN3PR07MB2516; 3:gIMfimUPkI4jJDiZzi6iF2h6KJ+/XEgolVNClT2BdlPxj2/lyPFC73sEUNbcmaAB+3nHS5kWSHHqrYDAqgOo03TCfDAeruT60cOLzbnMvRZczvY1MAoaB18w1Ww/ZvY0R3PGNpo7663vQh9tdIci1vHn9eJEuKnSlzMSn9HlZQryQaT6QsT7o96xhvJF/6rJMxcQx9deyprwaJrb3R+mphhrJFrd5xmgm8eSMxe0qnqk9F5k2TskdLOZX6OpJbkO; 25:dFkOd+lCa88oyQe7ayoq09MggxKXgtbotrsJ446dBDLxIbjlI55Bes8jO/tKvQ1+nUB2seAi/D8siTt1vs8wOohy/HRBCAs3t0xRUuoc9CRFlxjaNbkpUIXzqib15d9kBcjsIii6ssHE02lhfPny9IW1hGNesiGEWEnyvDHz4O9AzmQdX5JIMZVSdqJrLJ4tynw12spcA4UFAlysYDEW1Nwncyo0Kj9tc3BVtAl+IqtIV2tTsLPLl9M/NeUCqTvIqj6KjcKGrc/0CGzJJHKJrHAIvWHjnripmZPgMo3I2R9LKD2bjx0gfGLVoqq72l3PN/lAT8X6C+G/64QziDMxfA==; 31:IyevKGvAYFt4XYKWS/edc2yhtPtNCIK9ic6Qmw0t8k/0zvosJWyk07Ef6r5ErYSAAd+zmz+bXUcXJ/FBVtwgmQwWDwTKkUM6rrr6XAlqNpW+lSMjq+wUo99e8+cfd+iNiPkOxNfKxztDbHprD0T7K9mHXNf+/cKCOb5/sXTP/gaDwsshwgql/tfVoO4cKiLiQ8c64fRdeI3/AFwgmEPpGZAdfmeGS0nOYZpYVd9niyk= X-MS-TrafficTypeDiagnostic: BN3PR07MB2516: X-Microsoft-Exchange-Diagnostics: 1; BN3PR07MB2516; 20:U4NjXSFhfWNMFxWUIsY0mvs9VKVYIvyjRkPYSnLWdW3Tm57+ngLKE8GJFJvKdXHkwPOzVHKOPHzZxQy/ZOtEcgACJiZhUsI1DoSmM/CFNTzSq57rnm+97pojpVRlijXGF38KS2HhkiE4wekHVu7T5O41jShN4Z1OT1VY2KITKlRR4UYSeHNyRTqrxtdL0PzUFcEIR7xIHut0Ku/vwCGfTkhvldxYf3p9kiBwdm2DpORj/I4Hac6Njy+vE3zspP3cEB2M6usA2JOOioTWcNHKWSeB0qv3JFRL5d/fl7yvmoBoehdCYLG/2VIr3a+4Z9ZMu87YFmHXZ0/QQAl0zSqWgzFE5HqO4D9B+kvTOBumbWlM3mAzya1zM0VFCYzaMXDwSBAA4kstT6z5zZWCXHHOGlSzePlG1hByccqPndJblHh5GOKgXcQzl0nd53CNC+aCxzUpO7B7EPsA7l3bxfCX/lzSIUuzfJJ7PmM5v0xeaCpDl1AaY/gwIXqkgjvZGdXpN0E/W4L8sf1eC/cba6rPNHsx6DyVjLQyWt/JB09tb3Azf3ch0H9n2hiU+5eP1Gy5/FMOkf9nBr1E34gLO1Y6sy5vEvzhdbo6yeHa6feRBAc= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(788757137089)(228905959029699); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3002001)(3231221)(944501327)(52105095)(93006095)(10201501046)(6041310)(20161123564045)(20161123562045)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:BN3PR07MB2516; BCL:0; PCL:0; RULEID:; SRVR:BN3PR07MB2516; X-Microsoft-Exchange-Diagnostics: 1; BN3PR07MB2516; 4:otM6qgUPx6aszg7g+jKRmbnahU8DT6u9IpaEwFs2W0gIBpqs/Ra32cOhCfMBxMmA1IYt57WynoijYAnvH9z/Sl0QoZvIcwyMUmrXwaDwn3+VjP+wdKFeGmjoR74+tson8rbElURcMNJmTu9TXGkhCbKESPhny5KtXSZgRKCEVuX507agZ6m1HHuThHajQ7fymQwwSWllfgD9FhCTK7j6GOysXlwuq9qnzfQ1/lUyvbJOKgsI/qXRAR2MUySRZMdV5sC11Wx4ub0ixXLEILb4xvBZ4D6mRrMz1O7pXPpopUaTJuy5icsr30knO6IdDZB72rgxdvLA8+4E0TLT+oaEkw== X-Forefront-PRVS: 0631F0BC3D X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(396003)(39380400002)(346002)(39860400002)(366004)(189003)(199004)(13464003)(2906002)(561944003)(106356001)(4326008)(16586007)(1076002)(33656002)(6116002)(3846002)(316002)(23726003)(229853002)(5009440100003)(97736004)(25786009)(11346002)(93886005)(105586002)(58126008)(956004)(68736007)(76176011)(6496006)(478600001)(16526019)(72206003)(186003)(476003)(486005)(486005)(305945005)(6246003)(386003)(42882007)(59450400001)(9686003)(33896004)(55016002)(7736002)(47776003)(5660300001)(6916009)(53936002)(81156014)(8936002)(81166006)(52116002)(6666003)(8676002)(33716001)(50466002)(66066001)(446003)(26005)(18370500001); DIR:OUT; SFP:1101; SCL:1; SRVR:BN3PR07MB2516; 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; BN3PR07MB2516; 23:ko6ZUxWgS1Z+LkyuWVovH3r4f1scRUN3eidI93IjQ?= =?us-ascii?Q?KIIIAW7yuk9aM4DKJW25aRI90BPr/XXP0Lw7LaBDciHFqCNy9BnTYyCym3Fa?= =?us-ascii?Q?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gyijv2d+4Eaz3kSPAnLfRj3+lgKFANd07umRBehC7DZW3p6TBoe1M2cpclJU0JnF+YbuQq1dqYnvVROLGZ/ZF+WQUNmcHiZm3Eo6GPcoJ9XeUaS9+8HHIhGRjeHjwmXidqugdButNvJSw0M/KdyLv7DshO5FWQ0Ldr3e0Ik3u+LDym01zXdGdhkrWL3ENpMgIHOfwUOfjUh0XoINpk1vew/bkQ==; 5:b0ABzjJEAQCEpsGjXgsD8ISTz7j+1evom7wN2xQw57ZaDHiYww9ghAWVeLXtJ648KWGdGyotSww9VOUz/pjnYo+UF99yu993S2oa0K9PS2a2vKWtxe8PU/JkDUXmUW5skOY+YFhXQTf+9Z1GJM+CqpO0rFxpp6ygG7zVGn10mtQ=; 24:LccXe7wkkRKxdlrTPy3gYoQevJVGvEjqKyEXPKddLQCHfZEfJcrI2dEWLNkCpU6MOC57sBEzwlohs3tWX6Z/CZMT77gksoaYHuGhigoQRns= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN3PR07MB2516; 7:1bWhR6sFhu8xdydiv0r6KqPeoxtVDnClFfVRdf18z7WNXzzNizqnC/s5ZFYk63reW/2yQGcTLJSUt6qDh8OEc5gcCGIU7D44QcNVpykMVSCA5zFoVsV7ViMRW75Gvgp2VimjPIzM/9bBwvEaTAYEhHjXuKxYht2NamfoJ3rMbJfkn9tUz6Mm+6WzbffNhdC1ITz8+1g94RFBDaxvOIRW2CfLDWE/1I/Jy+ywicfO386Uk1ViaBmf0yaRdvV2/c/A X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Apr 2018 17:17:45.6640 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cae6a3cc-4472-427f-cda1-08d59986d1de X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3PR07MB2516 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 17:17:49 -0000 -----Original Message----- > Date: Tue, 3 Apr 2018 14:57:32 +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, > Hi Jerin, > > > > > 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? . 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? > 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 implementation as generic one. > Would that help? > > Konstantin > > > > > > + 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 = cbi->use; > > > + > > > + /* in use, busy wait till current RX/TX iteration is finished */ > > > + if ((puse & BPF_ETH_CBI_INUSE) != 0) { > > > + do { > > > + rte_pause(); > > > + rte_compiler_barrier(); > > > + nuse = cbi->use; > > > + } while (nuse == puse); > > > + } > > > +}