From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1173776AbdDXSY7 (ORCPT ); Mon, 24 Apr 2017 14:24:59 -0400 Received: from shards.monkeyblade.net ([184.105.139.130]:55872 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1173634AbdDXSYj (ORCPT ); Mon, 24 Apr 2017 14:24:39 -0400 Date: Mon, 24 Apr 2017 14:24:20 -0400 (EDT) Message-Id: <20170424.142420.290668473718207530.davem@davemloft.net> To: jslaby@suse.cz Cc: alexei.starovoitov@gmail.com, mingo@kernel.org, mingo@redhat.com, tglx@linutronix.de, hpa@zytor.com, x86@kernel.org, jpoimboe@redhat.com, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, daniel@iogearbox.net, edumazet@google.com Subject: Re: [PATCH v3 07/29] x86: bpf_jit, use ENTRY+ENDPROC From: David Miller In-Reply-To: <26f5afd7-d70b-effa-e528-8d0a2b95717a@suse.cz> References: <71301a81-1c61-fd4d-5b1b-5154fa723859@suse.cz> <20170424164717.GA80404@ast-mbp.thefacebook.com> <26f5afd7-d70b-effa-e528-8d0a2b95717a@suse.cz> X-Mailer: Mew version 6.7 on Emacs 24.5 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Mon, 24 Apr 2017 10:42:59 -0700 (PDT) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jiri Slaby Date: Mon, 24 Apr 2017 19:51:54 +0200 > For example what's the point of making the sk_load_word_positive_offset > label a global, callable function? Note that this is exactly the reason > why this particular two hunks look weird to you even though the > annotations only mechanically paraphrase what is in the current code. So that it can be referenced by the eBPF JIT, because these are helpers for eBPF JIT generated code. Every architecture implementing an eBPF JIT has this "mess". You can't even put a tracepoint or kprobe on these things and expect to see "arguments" or "return PC" values in the usual spots. This code has special calling conventions and register usage as Alexei explained. I would suggest that you read and understand how this assembler is designed, how it is called from the generated JIT code, and what it's semantics and register usage are, before trying to annotating it. Thank you.