Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp794739ybl; Wed, 11 Dec 2019 07:37:17 -0800 (PST) X-Google-Smtp-Source: APXvYqzJDGEY2MZKNdIZHSWxSy8RYAeP8tjphwgnnjIQrIqJyGzC4XIZFZysICLkwURrgx9FNXRM X-Received: by 2002:aca:3b45:: with SMTP id i66mr2795543oia.5.1576078637688; Wed, 11 Dec 2019 07:37:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576078637; cv=none; d=google.com; s=arc-20160816; b=gVRn+0MFRPGvw4i2feZM58y4NIx3CTJU5dHJr63qaqxDe+23JeNVn8v+kJVEy9zXEC nsnDf8C2PEe6vnARNi241nXfd+b/sDbVFuSnByDUIS4Mb5PCbUMp67Blwp6cNsNpvE1/ o9dRLQ4sMduzCqPwfSnwwiDjyrAsQtL7cxMFo5bOmO2M88znVq5HtQGYvk8DE9IKtSaL T1fdCElLWppUfVF/ZpubP9QuVOprlEx8BmiXTDOqcC48pOjvB/Eb/DYMWEF/0bVxU4i3 AYxla9dG5iJsZFHKlQ2zIdP+1jkGhRMYtbSULqT3/KxN0Ri6Zr1XvknDjII0/iZrYhU6 bcxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=qyBPrl0jIA8XpDLrkV5+shSjv5CdEiMK74NsctvMAGo=; b=oXMkASU/KsNOPfDs4hNuqmor4LeiNpuikp31ECR9KHSv8WZdbfAv0sdI/soVGT73fE bHwUyK6gIvxoZk5/T0P/y3W96oOuYb7huQo+AaOh9QxymbyMJiAOEpkUedGz42en/6ai 0SQdeHA6FfUahQtNEJKcMKwWCl/NI/jcxFqcTfcSkgndivca+WFLqy+535cKyWMZgGan ItBhHogNjiA7TeJO20Qg0kUtgSbszISaC4v0DFHkqfknsJ2M7gWlFy84D987zWuwD/rZ Li48PBw/Bbmtn5lHU6BRmZe/VRb3wgX8Mdkepmlimp8L9lh3rufxP8dfdmaQiJDXd4U1 FDgA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n85si1400544oig.191.2019.12.11.07.37.05; Wed, 11 Dec 2019 07:37:17 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388290AbfLKPgF (ORCPT + 99 others); Wed, 11 Dec 2019 10:36:05 -0500 Received: from mail.kernel.org ([198.145.29.99]:45456 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731642AbfLKPf7 (ORCPT ); Wed, 11 Dec 2019 10:35:59 -0500 Received: from gandalf.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (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 AAA8A22B48; Wed, 11 Dec 2019 15:35:58 +0000 (UTC) Date: Wed, 11 Dec 2019 10:35:57 -0500 From: Steven Rostedt To: Sven Schnelle Cc: linux-trace-devel@vger.kernel.org, LKML , Tom Zanussi Subject: Re: ftrace histogram sorting broken on BE architecures Message-ID: <20191211103557.7bed6928@gandalf.local.home> In-Reply-To: <20191211123316.GD12147@stackframe.org> References: <20191211123316.GD12147@stackframe.org> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 11 Dec 2019 13:33:16 +0100 Sven Schnelle wrote: > Hi List, Hi Sven, > > i was looking into a ftracetest failure on s390: > > # ./ftracetest test.d/trigger/trigger-hist.tc > === Ftrace unit tests === > [1] event trigger - test histogram trigger [FAIL] > [2] (instance) event trigger - test histogram trigger [FAIL] > > from the -vvv log: ++ fail 'sort param on sched_process_fork did not work' > > # cat events/sched/sched_process_fork/hist > > # event histogram > # > # trigger info: hist:keys=parent_pid,child_pid:vals=hitcount:sort=child_pid:size=2048 [active] > # > > { parent_pid: 1406, child_pid: 1428 } hitcount: 1 > { parent_pid: 1406, child_pid: 1430 } hitcount: 1 > { parent_pid: 1406, child_pid: 1427 } hitcount: 1 > { parent_pid: 1406, child_pid: 1432 } hitcount: 1 > { parent_pid: 1406, child_pid: 1431 } hitcount: 1 > { parent_pid: 1406, child_pid: 1429 } hitcount: 1 > > So the test is right, the entries are not sorted. After digging into the > ftrace code i noticed that integer values always get extended to 64 bit > in event_hist_trigger(), but cmp_entries_key() from tracing_map.c uses the > type of the field (which is a pid_t, and therefore 4 bytes). > > On Little Endian this doesn't hurt, but on BE s390 this makes the compare > function compare 4 zero bytes, which is the reason why sorting doesn't > work. As a test i forced the compare function used in cmp_entries_key() to > tracing_map_cmp_s64(), which made the ftrace tests pass. > > I also tested this on 64 bit parisc with the same results, so the architecture > doesn't seem make a difference (besides LE vs. BE) > > Any thoughts on how to fix this? I'm not sure whether i fully understand the > ftrace maps... ;-) Your analysis makes sense. I'll take a deeper look at it. Thanks for reporting it! -- Steve