From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755369AbbICMRK (ORCPT ); Thu, 3 Sep 2015 08:17:10 -0400 Received: from mga01.intel.com ([192.55.52.88]:20644 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753865AbbICMRB (ORCPT ); Thu, 3 Sep 2015 08:17:01 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,461,1437462000"; d="scan'208";a="781879662" Subject: Re: [PATCH] perf tools: Fix use of wrong event when processing exit events To: Arnaldo Carvalho de Melo References: <1439888825-27708-1-git-send-email-adrian.hunter@intel.com> <55E6F2D8.30306@intel.com> <20150902195501.GB11521@kernel.org> Cc: linux-kernel@vger.kernel.org, Jiri Olsa From: Adrian Hunter Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Message-ID: <55E83978.4050609@intel.com> Date: Thu, 3 Sep 2015 15:13:44 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: <20150902195501.GB11521@kernel.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/09/15 22:55, Arnaldo Carvalho de Melo wrote: > Em Wed, Sep 02, 2015 at 04:00:08PM +0300, Adrian Hunter escreveu: >> On 18/08/15 12:07, Adrian Hunter wrote: >>> In a couple of cases the 'comm' member of 'union event' has >>> been used instead of the correct member ('fork') when processing >>> exit events. >>> >>> In the cases where it has been used incorrectly, only the 'pid' >>> and 'tid' are affected. The 'pid' value would be correct anyway >>> because it is in the same position in 'comm' and 'fork' events, >>> but the 'tid' would have been incorrectly assigned from 'ppid'. >>> However, for exit events, the kernel puts the current task in >>> the 'ppid' and 'ttid' which is the same as the exiting task. >>> That is 'ppid' == 'pid' and if the task is not multi-threaded, >>> 'pid' == 'tid' i.e. the data goes wrong only when tracing >>> multi-threaded programs. >>> >>> It is hard to find an example of how this would produce an >>> error in practice. There are 3 occurences of the fix: >>> 1. perf script is only affected if !sample_id_all which only >>> happens on old kernels >>> 2. intel_pt is only affected when decoding without timestamps >>> and would probably still decode correctly - the exit event is >>> only used to flush out data which anyway gets flushed at the >>> end of the session >>> 3. intel_bts also uses the exit event to flush data which >>> would probably not cause errors as it would get flushed at >>> the end of the session instead >>> >>> Signed-off-by: Adrian Hunter >> >> I think it would be worth picking this one up for 4.3 > > I guess I had this picked up, is there anything else from you that is > outstanding? Only "perf tools: Add support for PERF_RECORD_SWITCH to Intel PT" but that is a feature not a bug.