Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2770198pxb; Sat, 6 Feb 2021 07:12:29 -0800 (PST) X-Google-Smtp-Source: ABdhPJyoCs5af18y/5JHtOJ8/lify3WdSDKMvEjsZDHRS8KseIEmP86KaFdl4+sWkyHLBWs7ESZi X-Received: by 2002:a17:906:af86:: with SMTP id mj6mr9216459ejb.509.1612624348895; Sat, 06 Feb 2021 07:12:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612624348; cv=none; d=google.com; s=arc-20160816; b=biBuLcufhfAlEId11aeNx1/qacehVaWd6Bb7mSOqI574aDzkOe6vdE6eAdgEUzc/MJ vcBbn3fOVonooaumFegXk2q5mct2RJq9/wQX0kM8MZTXfdYq64q7UxsBLyVEKb7xZ7MS hCLoVKjskcJL1GJRN0YYPDa8n+7H2WaEgk/V5ObHL/0/alc0Iwt9E0McDDvsH8/buDJm U1vKgCkdgZYsH03UV74u+E8kKW4PcZEAK2LUqw6G+v9JGTI0Fnp+usGasof8yJc39pKg 55f7G9p2PXVKAShQ6gX/9dgcBFxlyAKw4df4XaASbJNkzeko92pcrVTTZ3VwF+ecS8W4 72GA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=MYsvbHKaWJFqmZk3Q9+ksW0atKxTMG3xftJaoncz8gs=; b=l+cXbLweDToR1sxPgsjqmjq5ggFrFVok75cyhlfIbE0cXqpTabqfkBZBKQHwwNw0/n ICjxLC7wcHNnbJg/joUylwnrL6e+TvSJk5HFaXFXuZomowRB0yY0Ly4iav5fWmUDB0Lc i/Ccv6M2lYtRcuFC/FHEVPckcM9nD9VyJMwC5TFsBb3uISvqIVO109+3hhYMKwyUIifY 7j6WZ+GusYFQerR/RWLCEN2Q7ck4qyYa1NXec7VBXddUjH+OlZU9KAjuJ3xznW4v1z02 0g9zVn7c/FcAVIqnrN8NK9os82ZBrTmcOq+gCQNdfrjZ6kc2ZLwECiMG3xbCyRex0vfv BpEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="dNGP/2hl"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c11si7562320edj.397.2021.02.06.07.12.04; Sat, 06 Feb 2021 07:12:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="dNGP/2hl"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230288AbhBFPKp (ORCPT + 99 others); Sat, 6 Feb 2021 10:10:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58558 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230171AbhBFPKG (ORCPT ); Sat, 6 Feb 2021 10:10:06 -0500 Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88EF1C061797 for ; Sat, 6 Feb 2021 07:08:53 -0800 (PST) Received: by mail-pl1-x629.google.com with SMTP id k22so708216pll.6 for ; Sat, 06 Feb 2021 07:08:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=MYsvbHKaWJFqmZk3Q9+ksW0atKxTMG3xftJaoncz8gs=; b=dNGP/2hlQACIFVgVqAZpcOMCki2v+66EQ8TBrZ0HkGU1vdF4megfua9P0HKGvpNazw GTb08ugdsqG+adcVgSFXLmRI4zB275pVV9Fe4RTFrxuqmVs/kptl/g+ugvPMrj03PEoY Zr2mA69d6sQIZHak0J1XmTDzsUGGstX31y37iYBvxpDOl7EvUd/+o0oA31eRPlHTB0Mq y8lzyTW+b18AIspZlpPPbixXmhjY6PhEN+Hrgi6RluDpznis0mF95vjrRvB0IdVz3WPn WYOWlwsw+Zf488V4rIABms4TCm80huXZD3GaVla75qIRHfTkppCzAmy1KNa7TLKftTfx eNNQ== 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:mime-version:content-transfer-encoding; bh=MYsvbHKaWJFqmZk3Q9+ksW0atKxTMG3xftJaoncz8gs=; b=clqHrZSVMUC20Dkffnn5sYjxdETiaoIyAQPmtu77OxpwONUI7DeWp9Vbs4jDXF/1nw wy+sfzYnwN8lbqrASxQgFYXOtl0uAlkfSLSi3e2hwThwu7tHRmCquzrqHGbEoKKqfE46 EFfgFjirIq8thl46O6bfkvn1QxL7PH3khthvazpsp/PGwJC0HWTL0qI5UgH/pwhWqOD0 KM6omdlMrPjEhslpZWgIYwujnhQis1E9Pu2+i1QXYp0mERUW5hV9Ce4cXB8j2+dXruhd yD9Ahc+Vm0TUSDRTJlIO99SmegnJ/QmSHGN/o6bZZh7gyEcEpBdkZxFP28rWqhr5gosB XxXw== X-Gm-Message-State: AOAM533GE9eNusAxuXaZX1ZaqXMiVV0qOZXfV3k8AhfSmFqyKMie9q7W rAJdBdHfyii6WRZi7XphHtgx6A== X-Received: by 2002:a17:90a:f0c7:: with SMTP id fa7mr8463150pjb.201.1612624133053; Sat, 06 Feb 2021 07:08:53 -0800 (PST) Received: from localhost ([45.137.216.202]) by smtp.gmail.com with ESMTPSA id x17sm13394623pff.180.2021.02.06.07.08.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Feb 2021 07:08:52 -0800 (PST) From: Leo Yan To: Arnaldo Carvalho de Melo , Mathieu Poirier , Suzuki K Poulose , Mike Leach , Jonathan Corbet , John Garry , Will Deacon , Peter Zijlstra , Ingo Molnar , Mark Rutland , Jiri Olsa , Namhyung Kim , Daniel Kiss , Denis Nikitin , Al Grant , coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Leo Yan Subject: [PATCH v3 4/8] perf cs-etm: Fix bitmap for option Date: Sat, 6 Feb 2021 23:08:29 +0800 Message-Id: <20210206150833.42120-5-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210206150833.42120-1-leo.yan@linaro.org> References: <20210206150833.42120-1-leo.yan@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Suzuki K Poulose When set option with macros ETM_OPT_CTXTID and ETM_OPT_TS, it wrongly takes these two values (14 and 28 prespectively) as bit masks, but actually both are the offset for bits. But this doesn't lead to further failure due to the AND logic operation will be always true for ETM_OPT_CTXTID / ETM_OPT_TS. This patch defines new independent macros (rather than using the "config" bits) for requesting the "contextid" and "timestamp" for cs_etm_set_option(). [leoy: Extract the change as a separate patch for easier review] Signed-off-by: Suzuki K Poulose Signed-off-by: Leo Yan Reviewed-by: Mike Leach --- tools/perf/arch/arm/util/cs-etm.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tools/perf/arch/arm/util/cs-etm.c b/tools/perf/arch/arm/util/cs-etm.c index bd446aba64f7..c25c878fd06c 100644 --- a/tools/perf/arch/arm/util/cs-etm.c +++ b/tools/perf/arch/arm/util/cs-etm.c @@ -156,6 +156,10 @@ static int cs_etm_set_timestamp(struct auxtrace_record *itr, return err; } +#define ETM_SET_OPT_CTXTID (1 << 0) +#define ETM_SET_OPT_TS (1 << 1) +#define ETM_SET_OPT_MASK (ETM_SET_OPT_CTXTID | ETM_SET_OPT_TS) + static int cs_etm_set_option(struct auxtrace_record *itr, struct evsel *evsel, u32 option) { @@ -169,17 +173,17 @@ static int cs_etm_set_option(struct auxtrace_record *itr, !cpu_map__has(online_cpus, i)) continue; - if (option & ETM_OPT_CTXTID) { + if (option & ETM_SET_OPT_CTXTID) { err = cs_etm_set_context_id(itr, evsel, i); if (err) goto out; } - if (option & ETM_OPT_TS) { + if (option & ETM_SET_OPT_TS) { err = cs_etm_set_timestamp(itr, evsel, i); if (err) goto out; } - if (option & ~(ETM_OPT_CTXTID | ETM_OPT_TS)) + if (option & ~(ETM_SET_OPT_MASK)) /* Nothing else is currently supported */ goto out; } @@ -406,7 +410,7 @@ static int cs_etm_recording_options(struct auxtrace_record *itr, evsel__set_sample_bit(cs_etm_evsel, CPU); err = cs_etm_set_option(itr, cs_etm_evsel, - ETM_OPT_CTXTID | ETM_OPT_TS); + ETM_SET_OPT_CTXTID | ETM_SET_OPT_TS); if (err) goto out; } -- 2.25.1