From patchwork Thu May 31 10:32:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaldo Carvalho de Melo X-Patchwork-Id: 137347 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp6417683lji; Thu, 31 May 2018 03:33:05 -0700 (PDT) X-Google-Smtp-Source: ADUXVKI5VgJTnHNDxf3VZ1PqA9ZQK6oPN86fZcLDfdx7ApcsL1jd/u+IHBEwvxKwWJhHk0neiFCf X-Received: by 2002:a62:b2c4:: with SMTP id z65-v6mr2792630pfl.21.1527762785791; Thu, 31 May 2018 03:33:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527762785; cv=none; d=google.com; s=arc-20160816; b=bwEll44HeY0usV4ub6lka3sj0d6FhwYX329CUYfBXkf5lw2RyYCcQCuzZalV7nRWq8 QNIzR6bSLiPF4PEWcOP+hNZ/j0Vs7Cn2r4QZaNyjYKAK2G7c6nGMw2DDo55xh8vryInv Hpv8l7u1Wap8OauBjWUmVkChDuD/E3Fohrcz3+y6wQ8ePRict+Ggqcyt45o1wHxRYxWP urWfytlOPmEXxLCnN0f9EIfqLMfkbEyGnMgF2/ZFvZDq60bjX48Ip55+5ifj/D7K5MZG nHiLQ90tVo3ZeCGBPPzzD2DFJ4Re6PEqHC1W1IipD/jVoUdIukyoCWJKMMoXjKEQ4YXb IHoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=XGs3YbR6/IHY8E3Z8pTl3fXWT7uK+qxXsNaXYK92xhE=; b=vhc4Od5wOxaDGW3E6YGVhUX6ewlMow2cHFXTh3XTMzO0Td5bfG1ja+GeZpr9bJiLqo L/fa99n8ldO7nHXnuwNqYEFXc60PQRNUOCkReaZYpLAW1/ysjPPBkSg9FYwiO3MGfTn0 wJj070MkJSwjZOZbcmF6SVopqrLSaiDzuO6Dq6UZHxk2xp0oFXck6YXwSu92x2UxoWR3 s5cAIuKsngYXNJ8pcOlqe94/mGyUDdrNLx4gu/R2j3Wt4734cMFnTUBmaKmMi/cphN25 87fLkKnWUCltQDoLa77iRCmlPr6uQyRgIWBnu528VgL2YTfpSpj1mKr6vdvRLN9deKGJ 83zw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=M46TxJAD; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v41-v6si36811392plg.451.2018.05.31.03.33.05; Thu, 31 May 2018 03:33:05 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=M46TxJAD; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754494AbeEaKdC (ORCPT + 30 others); Thu, 31 May 2018 06:33:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:57078 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754539AbeEaKcs (ORCPT ); Thu, 31 May 2018 06:32:48 -0400 Received: from jouet.infradead.org (unknown [179.97.41.186]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3E1CA208B1; Thu, 31 May 2018 10:32:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527762768; bh=DDVrNuv+pJ7wHR4n5ft/aSnTjLyvq5NXUpk0Fu1bYLY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M46TxJADQG7IsAbZx0hMEF1Hhd3v0vuB6J2ozKKR7AoGsa85BEUkkuLYa3AZ5IBgy qg8CsgL0BDuYCfycMGi605n1KuzuifKqm2/hDxX8BaH5sxoA0X0JW/fiQRzaSyR5Ds 4vdPgnnerZbudq79GlukrQ75bEcVP5bXB5bDsCmQ= From: Arnaldo Carvalho de Melo To: Ingo Molnar Cc: Clark Williams , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Mathieu Poirier , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Peter Zijlstra , Robert Walker , linux-arm-kernel@lists.infradead.org, Arnaldo Carvalho de Melo Subject: [PATCH 4/7] perf cs-etm: Fix indexing for decoder packet queue Date: Thu, 31 May 2018 07:32:17 -0300 Message-Id: <20180531103220.24684-5-acme@kernel.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180531103220.24684-1-acme@kernel.org> References: <20180531103220.24684-1-acme@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mathieu Poirier The tail of a queue is supposed to be pointing to the next available slot in a queue. In this implementation the tail is incremented before it is used and as such points to the last used element, something that has the immense advantage of centralizing tail management at a single location and eliminating a lot of redundant code. But this needs to be taken into consideration on the dequeueing side where the head also needs to be incremented before it is used, or the first available element of the queue will be skipped. Signed-off-by: Mathieu Poirier Tested-by: Leo Yan Cc: Alexander Shishkin Cc: Jiri Olsa Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Robert Walker Cc: linux-arm-kernel@lists.infradead.org Link: http://lkml.kernel.org/r/1527289854-10755-1-git-send-email-mathieu.poirier@linaro.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/cs-etm-decoder/cs-etm-decoder.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) -- 2.14.3 diff --git a/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c b/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c index c8b98fa22997..4d5fc374e730 100644 --- a/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c +++ b/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c @@ -96,11 +96,19 @@ int cs_etm_decoder__get_packet(struct cs_etm_decoder *decoder, /* Nothing to do, might as well just return */ if (decoder->packet_count == 0) return 0; + /* + * The queueing process in function cs_etm_decoder__buffer_packet() + * increments the tail *before* using it. This is somewhat counter + * intuitive but it has the advantage of centralizing tail management + * at a single location. Because of that we need to follow the same + * heuristic with the head, i.e we increment it before using its + * value. Otherwise the first element of the packet queue is not + * used. + */ + decoder->head = (decoder->head + 1) & (MAX_BUFFER - 1); *packet = decoder->packet_buffer[decoder->head]; - decoder->head = (decoder->head + 1) & (MAX_BUFFER - 1); - decoder->packet_count--; return 1; From patchwork Thu May 31 10:32:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaldo Carvalho de Melo X-Patchwork-Id: 137348 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp6417722lji; Thu, 31 May 2018 03:33:09 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKJq9OKUK8i1zEGZS+Mf4LHLzIEK1khO5EYZPcQI8obHmLor5mprJKen8I/A7IF+LsSHTXE X-Received: by 2002:a65:5003:: with SMTP id f3-v6mr5101977pgo.425.1527762789411; Thu, 31 May 2018 03:33:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527762789; cv=none; d=google.com; s=arc-20160816; b=iJ1yStMxgpU2qZDgH4NuZOdhM/ECUGHA8iRM/CZICXq70MFUNnEmYi5LYmACDYi48D yUQZ5f6F4/LQvS1Gc6W4wv87pB6AKi8ekrbaVgO4hZdv00GccklpgYeov6gSes91yxVW 4JcFomJuTw7sv20BG5UHLgnuC1udqCADNUOleWC1SATSMUWuHlCUpzf1PZO5SXPgZ1s1 r3K+c+GEvmL6kffiOQTbETmoi5FVQ1JpHMF6bkwB0ofrKwG9Pe3uXnefg4/yKgkMcVIJ 2pbMio4D4G3WBZ61wRpfaX39ZxF20AnW6ReWDMfa/h4DDBG2VeImFcfPs9RkrUp5L3qH gmHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=D1eEf65VaY+c3sofY6qb3e075VDhg9lFcByqzd4DeZk=; b=pelJV1SHlDYqVoP3FXd2V0T+DOzopdDs2W6+ayguHXLBeVS/tpH4+1pPcrHNIxNJBh g2u5Zic9hnrzlgkyE1K3McLFiTxnO5INqkBu/bIyb/s7wEZJZDVNpEgRjnIfXyFj5uge w1yXNiSlysewFd+gUSnLlgQl0Ew1JXbQJOIrKvjyf+QpqQLG9X40s1jlRdDd9sbrNBei 6D982IsIPj1lhnwJ8mtEWAhLtf4ROy3LyZePoIQMq3+HoI0q2Re3X6IkHrC5E4y6mwkU +2e5MuawCsS9zlJbDgBF7excH4yWDYQzkkvoFvk/UVCW3vNB1WiDTvCOKK6wLB8KuLOL IJYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=EPOTzMCB; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v41-v6si36811392plg.451.2018.05.31.03.33.09; Thu, 31 May 2018 03:33:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=EPOTzMCB; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754654AbeEaKdH (ORCPT + 30 others); Thu, 31 May 2018 06:33:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:57190 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754622AbeEaKc4 (ORCPT ); Thu, 31 May 2018 06:32:56 -0400 Received: from jouet.infradead.org (unknown [179.97.41.186]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4BEAD208AF; Thu, 31 May 2018 10:32:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527762775; bh=mlu6QK9XxQ6Li+Dl6cAvn4DJKpxSNP8bY/8LRp7/350=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EPOTzMCBxqM5drbQznYWEU1wo9elaU4U9onwpng/vgaCtblaIsBW4+grFwrRQl2s0 3ckxK6pzp2Nmi5iSIXsH2wH0ooXD1J8JgPXKBknQ9e/gqXlFBj0R4p4cAYDsv0aB9Y gN/on6tfUBirdugOB5inJrgvsbiYG/5ngFR4rRa4= From: Arnaldo Carvalho de Melo To: Ingo Molnar Cc: Clark Williams , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Leo Yan , Alexander Shishkin , Jiri Olsa , Jonathan Corbet , Mathieu Poirier , Mike Leach , Namhyung Kim , Peter Zijlstra , Robert Walker , Tor Jeremiassen , coresight@lists.linaro.org, kim.phillips@arm.co, linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, Arnaldo Carvalho de Melo Subject: [PATCH 6/7] perf script python: Add addr into perf sample dict Date: Thu, 31 May 2018 07:32:19 -0300 Message-Id: <20180531103220.24684-7-acme@kernel.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180531103220.24684-1-acme@kernel.org> References: <20180531103220.24684-1-acme@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Leo Yan ARM CoreSight auxtrace uses 'sample->addr' to record the target address for branch instructions, so the data of 'sample->addr' is required for tracing data analysis. This commit collects data of 'sample->addr' into perf sample dict, finally can be used for python script for parsing event. Signed-off-by: Leo Yan Cc: Alexander Shishkin Cc: Jiri Olsa Cc: Jonathan Corbet Cc: Mathieu Poirier Cc: Mike Leach Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Robert Walker Cc: Tor Jeremiassen Cc: coresight@lists.linaro.org Cc: kim.phillips@arm.co Cc: linux-arm-kernel@lists.infradead.org Cc: linux-doc@vger.kernel.org Link: http://lkml.kernel.org/r/1527497103-3593-3-git-send-email-leo.yan@linaro.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/scripting-engines/trace-event-python.c | 2 ++ 1 file changed, 2 insertions(+) -- 2.14.3 diff --git a/tools/perf/util/scripting-engines/trace-event-python.c b/tools/perf/util/scripting-engines/trace-event-python.c index 10dd5fce082b..7f8afacd08ee 100644 --- a/tools/perf/util/scripting-engines/trace-event-python.c +++ b/tools/perf/util/scripting-engines/trace-event-python.c @@ -531,6 +531,8 @@ static PyObject *get_perf_sample_dict(struct perf_sample *sample, PyLong_FromUnsignedLongLong(sample->period)); pydict_set_item_string_decref(dict_sample, "phys_addr", PyLong_FromUnsignedLongLong(sample->phys_addr)); + pydict_set_item_string_decref(dict_sample, "addr", + PyLong_FromUnsignedLongLong(sample->addr)); set_sample_read_in_dict(dict_sample, sample, evsel); pydict_set_item_string_decref(dict, "sample", dict_sample);