From patchwork Thu Feb 21 12:42:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yordan Karadzhov X-Patchwork-Id: 10824039 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A59791390 for ; Thu, 21 Feb 2019 12:42:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 969BF2EC7E for ; Thu, 21 Feb 2019 12:42:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8AB342F00B; Thu, 21 Feb 2019 12:42:21 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, 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 34F1C2EC7E for ; Thu, 21 Feb 2019 12:42:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725932AbfBUMmV (ORCPT ); Thu, 21 Feb 2019 07:42:21 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:44682 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725920AbfBUMmU (ORCPT ); Thu, 21 Feb 2019 07:42:20 -0500 Received: by mail-wr1-f65.google.com with SMTP id w2so15251322wrt.11 for ; Thu, 21 Feb 2019 04:42:19 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=4kQJpN+KUQE58ceT6NtlUhUDUnVRmifNoacwSxV2NUM=; b=sv4zzRBMlLiCD3ayPhU9D8rh2qUMmZmx2DgFaW0v937aw9uOAZGTzXuBf0KvN8IPrX 1DWK8yQ58e3rJj3puqtp7Ywcokp1ZY3cuYDV9rQVV8zstZr4AqeIpyY5cO533lIzPEec nLl2Viu6riwPRTM01YqZzVkZUNGLKuHtXaDE53u0Wz/78Zloo1yYXUcsF4O1B9l98lb2 z89LBPyeEoWA0D36MVNsH6HKofyCls9a2bay8nI4Z2GLRUGM7J8MHMiZmo+vffXtAkNy PyR1AL3suiC7EGuAR2XwwL3aV6GiuI+oRVCLw6XeFqCU1aOV1CxlW+LDONkp/SdEYZWT +/nQ== X-Gm-Message-State: AHQUAuamK8LDSbmG1tjmw8SXgFTAA3Hj0f163Zedv3tO1VswRR24+lLf NVAoaBplb+KUR9ejRHAZ9WI1Ys26 X-Google-Smtp-Source: AHgI3IZzI3gBxdCikWt79f4hH9ww471DCHBLUpeFwIOgO2AMA9hinae0QpS3ByYEwIP5D0XPSQILxQ== X-Received: by 2002:a05:6000:14d:: with SMTP id r13mr1537792wrx.231.1550752939072; Thu, 21 Feb 2019 04:42:19 -0800 (PST) Received: from mamba.eng.vmware.com ([146.247.46.5]) by smtp.gmail.com with ESMTPSA id b4sm1359517wrr.64.2019.02.21.04.42.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 Feb 2019 04:42:18 -0800 (PST) From: Yordan Karadzhov To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org, Yordan Karadzhov Subject: [PATCH 1/3] kernel-shark: Fix a bug in ksmodel_shift_backward() Date: Thu, 21 Feb 2019 14:42:03 +0200 Message-Id: <20190221124205.21115-2-ykaradzhov@vmware.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190221124205.21115-1-ykaradzhov@vmware.com> References: <20190221124205.21115-1-ykaradzhov@vmware.com> Sender: linux-trace-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-trace-devel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Bin 0 of the new model has to be set after copying the overlaping bins from the old model. Otherwise the new content of Bin 0 will be copied into Bin "n". This bug has no effect because ksmodel_shift_backward() has a second bug in the loop over the non-overlapping bins. The second bug will be fixed in the following patch. Fixes: f97e31f00 ("kernel-shark-qt: Introduce the visualization model ..") Signed-off-by: Yordan Karadzhov --- kernel-shark/src/libkshark-model.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/kernel-shark/src/libkshark-model.c b/kernel-shark/src/libkshark-model.c index b71a9b8..a185d6b 100644 --- a/kernel-shark/src/libkshark-model.c +++ b/kernel-shark/src/libkshark-model.c @@ -557,17 +557,18 @@ void ksmodel_shift_backward(struct kshark_trace_histo *histo, size_t n) ksmodel_fill(histo, histo->data, histo->data_size); return; } - /* Set the new Lower Overflow bin. */ - ksmodel_set_lower_edge(histo); /* - * Copy the the mapping indexes of all overlaping bins starting from + * Copy the mapping indexes of all overlaping bins starting from * bin "0" of the old histo. Note that the number of overlaping bins * is histo->n_bins - n. */ memmove(&histo->map[n], &histo->map[0], sizeof(histo->map[0]) * (histo->n_bins - n)); + /* Set the new Lower Overflow bin. */ + ksmodel_set_lower_edge(histo); + /* Calculate only the content of the new (non-overlapping) bins. */ for (bin = 0; bin < n; ++bin) { ksmodel_set_next_bin_edge(histo, bin, last_row);