From patchwork Fri May 12 07:47:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Luba X-Patchwork-Id: 9723647 X-Patchwork-Delegate: eduardo.valentin@ti.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 98D7360348 for ; Fri, 12 May 2017 07:47:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8F854287D1 for ; Fri, 12 May 2017 07:47:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 83C37287DA; Fri, 12 May 2017 07:47:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F2CED287D1 for ; Fri, 12 May 2017 07:47:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756633AbdELHrr (ORCPT ); Fri, 12 May 2017 03:47:47 -0400 Received: from foss.arm.com ([217.140.101.70]:56546 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756554AbdELHrr (ORCPT ); Fri, 12 May 2017 03:47:47 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 8C7D21610; Fri, 12 May 2017 00:47:46 -0700 (PDT) Received: from e105217-lin.cambridge.arm.com (e105217-lin.cambridge.arm.com [10.1.210.43]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 64A9F3F23B; Fri, 12 May 2017 00:47:45 -0700 (PDT) From: Lukasz Luba To: linux-pm@vger.kernel.org Cc: lukasz.luba@arm.com, javi.merino@kernel.org, rui.zhang@intel.com, edubezval@gmail.com, Steven Rostedt , Ingo Molnar Subject: [PATCH v3 2/2] trace: power allocator: add trace for divvyup algorithm Date: Fri, 12 May 2017 08:47:28 +0100 Message-Id: <1494575248-4166-3-git-send-email-lukasz.luba@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1494575248-4166-1-git-send-email-lukasz.luba@arm.com> References: <1494575248-4166-1-git-send-email-lukasz.luba@arm.com> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This trace function helps to figure out the divvyup algorithm on some platforms. CC: Steven Rostedt CC: Ingo Molnar CC: Zhang Rui CC: Eduardo Valentin Signed-off-by: Lukasz Luba Acked-by: Steven Rostedt (VMware) --- drivers/thermal/power_allocator.c | 4 +++ include/trace/events/thermal_power_allocator.h | 40 ++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/drivers/thermal/power_allocator.c b/drivers/thermal/power_allocator.c index f9e3d3c..1929e9c 100644 --- a/drivers/thermal/power_allocator.c +++ b/drivers/thermal/power_allocator.c @@ -331,6 +331,10 @@ static void siblings_grants(struct thermal_zone_device *tz, total_avail_room += avail_room[i]; } + trace_thermal_power_allocator_divvyup(tz, granted_power, avail_room, + spare_power, max_power, + num_actors); + /* Share the extra power inside the same family. */ for (i = 0; i < num_actors; i++) { u64 power; diff --git a/include/trace/events/thermal_power_allocator.h b/include/trace/events/thermal_power_allocator.h index 5afae8f..03f224b 100644 --- a/include/trace/events/thermal_power_allocator.h +++ b/include/trace/events/thermal_power_allocator.h @@ -54,6 +54,46 @@ __entry->delta_temp) ); +TRACE_EVENT(thermal_power_allocator_divvyup, + TP_PROTO(struct thermal_zone_device *tz, u32 *granted_power, + u32 *avail_room, u32 *spare_power, u32 *max_power, + size_t num_actors), + TP_ARGS(tz, granted_power, avail_room, spare_power, max_power, + num_actors), + TP_STRUCT__entry( + __field(int, tz_id) + __dynamic_array(u32, granted_power, num_actors) + __dynamic_array(u32, avail_room, num_actors) + __dynamic_array(u32, spare_power, num_actors) + __dynamic_array(u32, max_power, num_actors) + __field(size_t, num_actors) + ), + TP_fast_assign( + __entry->tz_id = tz->id; + memcpy(__get_dynamic_array(granted_power), granted_power, + num_actors * sizeof(*granted_power)); + memcpy(__get_dynamic_array(avail_room), avail_room, + num_actors * sizeof(*avail_room)); + memcpy(__get_dynamic_array(spare_power), spare_power, + num_actors * sizeof(*spare_power)); + memcpy(__get_dynamic_array(max_power), max_power, + num_actors * sizeof(*max_power)); + __entry->num_actors = num_actors; + ), + + TP_printk("thermal_zone_id=%d granted_power={%s} avail_room={%s} spare_power={%s} max_power={%s}", + __entry->tz_id, + __print_array(__get_dynamic_array(granted_power), + __entry->num_actors, 4), + __print_array(__get_dynamic_array(avail_room), + __entry->num_actors, 4), + __print_array(__get_dynamic_array(spare_power), + __entry->num_actors, 4), + __print_array(__get_dynamic_array(max_power), + __entry->num_actors, 4) + ) +); + TRACE_EVENT(thermal_power_allocator_pid, TP_PROTO(struct thermal_zone_device *tz, s32 err, s32 err_integral, s64 p, s64 i, s64 d, s32 output),