From patchwork Mon Jul 27 22:41:19 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 51570 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f72.google.com (mail-la0-f72.google.com [209.85.215.72]) by patches.linaro.org (Postfix) with ESMTPS id 5C6A522918 for ; Mon, 27 Jul 2015 22:42:47 +0000 (UTC) Received: by laef2 with SMTP id f2sf32009449lae.0 for ; Mon, 27 Jul 2015 15:42:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=iAfAcW2hnPO1hdK0M8ghBujgA4RfQPQdsipF2+gGPs0=; b=VWb/fB7HcWpayZzszOvAHtkR5T9pTkgsHgcWdozbrYPLQ5OaWlO6tFVCqMtbN1/Dn8 BWO3EbsALaxY3EGiEkP9A8f6wJP3FvuaYbYI3OaqGfOLU17J5l5TF5tYDqdVFMGQlZHm IoQKN0y6CD39FfdmrBOmfbReh9Mu2Z6i+EW2EV3CIxuV28RAWB7lrJO4P6CEkKGb7iYY pfK7kI87l8xmZSbH5RarJh7KMgqJHhJY2sK8uj5LfK8/UZOxqCX6Ok8CtL8gG1lXFzfa fcyIIT6sY/5JGnGHJrTc/ibeuxokvYYYV1UhFA1xV4nNeizTVXKKrqeDYcQz4HTgpjbm vqWg== X-Gm-Message-State: ALoCoQlyGsunACJnbpJawcoVqcBnyw3qmbPshA4ZyUzOj3rwCKVTaiA0c4T2LqzwV0CIiYiV4qXm X-Received: by 10.113.3.8 with SMTP id bs8mr11294944lbd.23.1438036966000; Mon, 27 Jul 2015 15:42:46 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.120.198 with SMTP id le6ls650199lab.56.gmail; Mon, 27 Jul 2015 15:42:45 -0700 (PDT) X-Received: by 10.152.5.228 with SMTP id v4mr29167437lav.36.1438036965823; Mon, 27 Jul 2015 15:42:45 -0700 (PDT) Received: from mail-la0-f49.google.com (mail-la0-f49.google.com. [209.85.215.49]) by mx.google.com with ESMTPS id o2si16496488lah.162.2015.07.27.15.42.45 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 27 Jul 2015 15:42:45 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.49 as permitted sender) client-ip=209.85.215.49; Received: by lahh5 with SMTP id h5so57861452lah.2 for ; Mon, 27 Jul 2015 15:42:45 -0700 (PDT) X-Received: by 10.112.209.106 with SMTP id ml10mr28830921lbc.112.1438036965717; Mon, 27 Jul 2015 15:42:45 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.7.198 with SMTP id l6csp1788747lba; Mon, 27 Jul 2015 15:42:44 -0700 (PDT) X-Received: by 10.50.79.196 with SMTP id l4mr411440igx.48.1438036964248; Mon, 27 Jul 2015 15:42:44 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id vt1si47443222pab.197.2015.07.27.15.42.43; Mon, 27 Jul 2015 15:42:44 -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; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755011AbbG0Wmm (ORCPT + 25 others); Mon, 27 Jul 2015 18:42:42 -0400 Received: from mail-pd0-f169.google.com ([209.85.192.169]:34991 "EHLO mail-pd0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754956AbbG0WmW (ORCPT ); Mon, 27 Jul 2015 18:42:22 -0400 Received: by pdrg1 with SMTP id g1so59009878pdr.2 for ; Mon, 27 Jul 2015 15:42:22 -0700 (PDT) X-Received: by 10.70.109.162 with SMTP id ht2mr72576588pdb.101.1438036942196; Mon, 27 Jul 2015 15:42:22 -0700 (PDT) Received: from t430.cg.shawcable.net ([184.64.168.246]) by smtp.gmail.com with ESMTPSA id br14sm26769220pdb.47.2015.07.27.15.42.20 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 27 Jul 2015 15:42:21 -0700 (PDT) From: Mathieu Poirier To: a.p.zijlstra@chello.nl, mingo@redhat.com, acme@kernel.org, alexander.shishkin@linux.intel.com Cc: linux-kernel@vger.kernel.org, mathieu.poirier@linaro.org Subject: [PATCH] perf: fixing variable initialisation Date: Mon, 27 Jul 2015 16:41:19 -0600 Message-Id: <1438036879-16340-1-git-send-email-mathieu.poirier@linaro.org> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: mathieu.poirier@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.49 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Variable 'max_order' needs to be initialised to log2 of the number of pages invariant of the no scather-gather PMU option. Otherwise 'rb_alloc_aux_page' gets an order that is equal to '0', which prevents the private page information to be set properly. Signed-off-by: Mathieu Poirier --- kernel/events/ring_buffer.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/kernel/events/ring_buffer.c b/kernel/events/ring_buffer.c index 96472824a752..bd3da7bebe9e 100644 --- a/kernel/events/ring_buffer.c +++ b/kernel/events/ring_buffer.c @@ -449,18 +449,18 @@ int rb_alloc_aux(struct ring_buffer *rb, struct perf_event *event, { bool overwrite = !(flags & RING_BUFFER_WRITABLE); int node = (event->cpu == -1) ? -1 : cpu_to_node(event->cpu); - int ret = -ENOMEM, max_order = 0; + int ret = -ENOMEM, max_order; if (!has_aux(event)) return -ENOTSUPP; - if (event->pmu->capabilities & PERF_PMU_CAP_AUX_NO_SG) { - /* - * We need to start with the max_order that fits in nr_pages, - * not the other way around, hence ilog2() and not get_order. - */ - max_order = ilog2(nr_pages); + /* + * We need to start with the max_order that fits in nr_pages, + * not the other way around, hence ilog2() and not get_order. + */ + max_order = ilog2(nr_pages); + if (event->pmu->capabilities & PERF_PMU_CAP_AUX_NO_SG) { /* * PMU requests more than one contiguous chunks of memory * for SW double buffering