Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932846AbbDOSgk (ORCPT ); Wed, 15 Apr 2015 14:36:40 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:54929 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932370AbbDOSgj (ORCPT ); Wed, 15 Apr 2015 14:36:39 -0400 Date: Wed, 15 Apr 2015 20:36:25 +0200 From: Peter Zijlstra To: Kan Liang Cc: linux-kernel@vger.kernel.org, mingo@kernel.org, acme@infradead.org, eranian@google.com, andi@firstfloor.org Subject: Re: [PATCH V6 4/6] perf, x86: handle multiple records in PEBS buffer Message-ID: <20150415183625.GY23123@twins.programming.kicks-ass.net> References: <1428597466-8154-1-git-send-email-kan.liang@intel.com> <1428597466-8154-5-git-send-email-kan.liang@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1428597466-8154-5-git-send-email-kan.liang@intel.com> 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: 1103 Lines: 39 On Thu, Apr 09, 2015 at 12:37:44PM -0400, Kan Liang wrote: > +/* Clear all non-PEBS bits */ > +static u64 > +nonpebs_bit_clear(u64 pebs_status) > +{ > + struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events); > + struct perf_event *event; > + int bit; > + > + for_each_set_bit(bit, (unsigned long *)&pebs_status, 64) { > + > + if (bit >= x86_pmu.max_pebs_events) > + clear_bit(bit, (unsigned long *)&pebs_status); > + else { > + event = cpuc->events[bit]; > + WARN_ON_ONCE(!event); > + > + if (!event->attr.precise_ip) > + clear_bit(bit, (unsigned long *)&pebs_status); > + } > + } > + > + return pebs_status; > +} What was wrong with: status = p->status & cpuc->pebs_enabled; ? We use the same index bits in the PEBS_ENABLE MSR as in the status reg, right? If you're really paranoid you can mask out the high (>31) bits too I suppose. -- 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/