Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754072AbbHEN7h (ORCPT ); Wed, 5 Aug 2015 09:59:37 -0400 Received: from casper.infradead.org ([85.118.1.10]:36660 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752847AbbHEN7f (ORCPT ); Wed, 5 Aug 2015 09:59:35 -0400 Date: Wed, 5 Aug 2015 15:59:32 +0200 From: Peter Zijlstra To: Kaixu Xia Cc: ast@plumgrid.com, davem@davemloft.net, acme@kernel.org, mingo@redhat.com, masami.hiramatsu.pt@hitachi.com, jolsa@kernel.org, daniel@iogearbox.net, wangnan0@huawei.com, linux-kernel@vger.kernel.org, pi3orama@163.com, hekuang@huawei.com, netdev@vger.kernel.org Subject: Re: [PATCH v6 3/4] bpf: Implement function bpf_perf_event_read() that get the selected hardware PMU conuter Message-ID: <20150805135932.GA18673@twins.programming.kicks-ass.net> References: <1438678696-88289-1-git-send-email-xiakaixu@huawei.com> <1438678696-88289-4-git-send-email-xiakaixu@huawei.com> <20150805100425.GZ25159@twins.programming.kicks-ass.net> <20150805135317.GZ18673@twins.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150805135317.GZ18673@twins.programming.kicks-ass.net> User-Agent: Mutt/1.5.21 (2012-12-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1000 Lines: 27 On Wed, Aug 05, 2015 at 03:53:17PM +0200, Peter Zijlstra wrote: > +/* > + * NMI-safe method to read a local event, that is an event that > + * is: > + * - either for the current task, or for this CPU > + * - does not have inherit set, for inherited task events > + * will not be local and we cannot read them atomically > + * - must not have a pmu::count method > + */ > +u64 perf_event_read_local(struct perf_event *event) > +{ > + unsigned long flags; > + u64 val; > + > + /* > + * Disabling interrupts avoids all counter scheduling (context > + * switches, timer based rotation and IPIs). > + */ > + local_irq_safe(flags); Hmm, I think local_irq_save(flags) will compile much better. Obviously this patch hasn't seen a compiler up close. -- 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/