From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756263AbbGGN0F (ORCPT ); Tue, 7 Jul 2015 09:26:05 -0400 Received: from mail.kernel.org ([198.145.29.136]:41122 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757168AbbGGNZ5 (ORCPT ); Tue, 7 Jul 2015 09:25:57 -0400 Date: Tue, 7 Jul 2015 10:25:52 -0300 From: Arnaldo Carvalho de Melo To: Adrian Hunter Cc: Peter Zijlstra , Andi Kleen , Ingo Molnar , linux-kernel@vger.kernel.org, Jiri Olsa , Stephane Eranian , mathieu.poirier@linaro.org, Pawel Moll Subject: Re: [PATCH V3 1/4] perf: Add PERF_RECORD_SWITCH to indicate context switches Message-ID: <20150707132552.GA3326@kernel.org> References: <1436258202-6540-1-git-send-email-adrian.hunter@intel.com> <1436258202-6540-2-git-send-email-adrian.hunter@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1436258202-6540-2-git-send-email-adrian.hunter@intel.com> X-Url: http://acmel.wordpress.com User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Tue, Jul 07, 2015 at 11:36:39AM +0300, Adrian Hunter escreveu: > To make the event useful for privileged users also, if the > context is cpu-wide then the event will also provide the > next or previous pid/tid. > + /* > + * Records a context switch in or out (flagged by > + * PERF_RECORD_MISC_SWITCH_OUT). next_prev_pid and next_prev_tid are > + * (u32)-1 unless the context is cpu-wide, in which case they are the Why carry those extra 8 bytes for non priviledged users, all the time with -1? Can't userspace cope with this, i.e. we should be able to look for those fields when the context is CPU wide, and to not look for them otherwise, no? > + * next (switching out) or previous (switching in) pid/tid. > + * > + * struct { > + * struct perf_event_header header; > + * u32 next_prev_pid; > + * u32 next_prev_tid; > + * struct sample_id sample_id; > + * }; > + */ > + PERF_RECORD_SWITCH = 14, > + - Arnaldo