Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757670AbbGQNGH (ORCPT ); Fri, 17 Jul 2015 09:06:07 -0400 Received: from m12-14.163.com ([220.181.12.14]:56301 "EHLO m12-14.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753778AbbGQNGF convert rfc822-to-8bit (ORCPT ); Fri, 17 Jul 2015 09:06:05 -0400 Content-Type: text/plain; charset=gb2312 Mime-Version: 1.0 (1.0) Subject: Re: [RFC PATCH 5/6] bpf: Implement function bpf_read_pmu() that get the selected hardware PMU conuter From: pi3orama X-Mailer: iPhone Mail (12H143) In-Reply-To: <20150717124538.GI19282@twins.programming.kicks-ass.net> Date: Fri, 17 Jul 2015 20:57:00 +0800 Cc: "Wangnan (F)" , kaixu xia , "ast@plumgrid.com" , "davem@davemloft.net" , "acme@kernel.org" , "mingo@redhat.com" , "masami.hiramatsu.pt@hitachi.com" , "jolsa@kernel.org" , "linux-kernel@vger.kernel.org" , "hekuang@huawei.com" Content-Transfer-Encoding: 8BIT Message-Id: <45F8BB22-F978-4671-BAD0-6DE3643EA04C@163.com> References: <1437129816-13176-6-git-send-email-xiakaixu@huawei.com> <20150717110541.GJ12596@twins.programming.kicks-ass.net> <55A8E703.70306@huawei.com> <20150717113924.GD19282@twins.programming.kicks-ass.net> <55A8EABE.1060308@huawei.com> <20150717115505.GF19282@twins.programming.kicks-ass.net> <20150717115615.GA18673@twins.programming.kicks-ass.net> <55A8EE83.3000708@huawei.com> <20150717121836.GH19282@twins.programming.kicks-ass.net> <55A8F4BF.3020902@huawei.com> <20150717124538.GI19282@twins.programming.kicks-ass.net> To: Peter Zijlstra X-CM-TRANSID: DsCowEBpo0Cb+6hVOfRZAA--.10864S2 X-Coremail-Antispam: 1Uf129KBjvJXoW7tw15WrykXrW7Zr1ruFWUtwb_yoW8JFW8p3 4ay34jka1DJrsIyw1Iv3y7ZF1FkrykJF45C34rWw4Yy3y5Kry2grW3K3W5uFy5Zr18Xw42 vrWqv34DC3s8AaDanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07j0T5dUUUUU= X-Originating-IP: [223.104.3.226] X-CM-SenderInfo: lslt02xdpdqiywtou0bp/xtbBzQQ6QFO-vPRxBwAAsh Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1558 Lines: 40 ?????ҵ? iPhone > ?? 2015??7??17?գ?????8:45??Peter Zijlstra д???? > >> On Fri, Jul 17, 2015 at 08:27:43PM +0800, Wangnan (F) wrote: >> I think we can check the limitation in BPF program. > > You typically do not want to rely on your program for correctness. Sorry. NOT BPF program. What I want to express is bpf_read_pmu() function which is called from BPF program. User can put anything into the map during preparation but he or she gets only error code if the perf event he or she read from doesn't meet our restriction at runtime. >> What about this: >> >> event must on current CPU or must be on current process. If not, >> bpf_read_pmu() should simply return an error. > > OK, that's workable. That enforces the constraints outside of the > program itself. > >> With current design it is easy to implement, and users can still control >> it through bpf map. >> >> But what if we really want cross-cpu PMU accessing? Impossible? > > Under the assumption that the eBPF program is called from tracing, and > therefore from any context (task, softirq, irq and nmi), yes impossible. > > You cannot do (synchronous) IPIs from either IRQ context or with IRQs > disabled. And both are valid trace contexts. What about software perf event? For example, tracepoints? Thank you. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/