From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from mga06.intel.com ([134.134.136.31]) by Galois.linutronix.de with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1fEbKT-00055V-8t for speck@linutronix.de; Fri, 04 May 2018 16:04:58 +0200 Subject: [MODERATED] Re: [PATCH 1/5] SSB extra 2 References: =?utf-8?q?=3Ce69f3b?= =?utf-8?q?41d5b7fa52cf43682663d1f6f3c5de7d03=2E1525383411=2Egit=2Edave=2E?= =?utf-8?q?hansen=40intel=2Ecom=3E?= <20180504092050.GK12217@hirez.programming.kicks-ass.net> From: Dave Hansen Message-ID: <90f19909-5f25-ece9-e2b0-3c8cedc60caf@linux.intel.com> Date: Fri, 4 May 2018 07:04:53 -0700 MIME-Version: 1.0 In-Reply-To: <20180504092050.GK12217@hirez.programming.kicks-ass.net> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit To: speck@linutronix.de List-ID: On 05/04/2018 02:20 AM, speck for Peter Zijlstra wrote: >> @@ -357,7 +357,9 @@ int bpf_prog_array_copy(struct bpf_prog_array __rcu *old_array, >> goto _out; \ >> _prog = _array->progs; \ >> while ((__prog = READ_ONCE(*_prog))) { \ >> + bpf_enter_prog(__prog); \ >> _ret &= func(__prog, ctx); \ >> + bpf_leave_prog(__prog); \ >> _prog++; \ >> } \ >> _out: \ > So I actually had a look at this yesterday, and why did you choose to > put these hooks at the prog callsites instead of inside the prog itself? > > It seems to me that placing them inside the program (either the > interpreter or the jit) is much less invasive. It's not a bad idea. This didn't seem *too* invasive other than I had to hit all the variants of calling func(). Were you thinking we add some eBPF instruction which calls out to the kernel machinery and then the kernel BPF code inserts it as the first instruction of the program?