Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp4991361pxb; Sun, 6 Feb 2022 09:52:47 -0800 (PST) X-Google-Smtp-Source: ABdhPJwmnmdFmDmwGarUMmStaRntYmDaKMZ5P2TfKWU9c2cD9UgwPi8egswIA/MEB0HM79VkJ9Y7 X-Received: by 2002:a17:902:a9c5:: with SMTP id b5mr13012527plr.167.1644169966796; Sun, 06 Feb 2022 09:52:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644169966; cv=none; d=google.com; s=arc-20160816; b=ci4ku+P7xld8Qhu4Jbl5Tl7Ask0B870uIYT3zgGzfsWc23uEh6hSC2RXNB7NLL6LhL 4d/Sn6kQm0YqAuM3nyCdLu153VJxlTws/TFbA8rtJrrlnHQwpQjguUnjvlE52X0gA7u0 zeugGBMj7yBK0f+e5i2yO3f0BUoAp2LVpQdjxNT4ZNzu2Q9kDo2DaPU3Ww6f1fs7drmj /KEThRYveq8I8k8ccWT5GR3pYkDcr5oNm0hqDNSgVbgl3/dhIcdkgt4cdYvPkh6mqB3Y 382U1JD6t+6Z8olODyqK3F/JpIDhZp3+bb6aE1BXMqrwi7CLwG+6kdxtYQ2CYyix/fO+ nR4A== 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=CP130Joo5LnzHA5fd0JPgyy8qzQq4QiMmlbo4WSc/bc=; b=OXwgqJLXg9LIgIPvc+RD1XS7GpF3c4hz77qaBrqp6j+bG8mM1FokqFc9+2GxiZ9Y+5 iHXTZqUG+A2cncx6oJ1V/vHHOlvBJ/ukX2jRr6o2uYXLQwMovDskWkayCUmaxcf2qoKG 7j4L/THY+7OE2fymw6vyZxvo+fyp1jxKIqHGPgR0X5EwS2a/DOume8tkapfxadmlm8kF q4q5JnxQ+s/lE24AqNk509IonJ/526GE2I9bu+7Uqh3aR+XIA+9VNe5URC1+1aSFWWkg haRTTJEPAoQ9l0ijqkb0bPQHxF0eqx0VQB7TXPslCLaJb0kKYe+ybqvkSdciqQVX59Vh GwEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="L/e7pgEI"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k25si7855051pgl.181.2022.02.06.09.52.35; Sun, 06 Feb 2022 09:52:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="L/e7pgEI"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S1359686AbiBDPYn (ORCPT + 99 others); Fri, 4 Feb 2022 10:24:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59792 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359685AbiBDPYg (ORCPT ); Fri, 4 Feb 2022 10:24:36 -0500 Received: from mail-pj1-x102a.google.com (mail-pj1-x102a.google.com [IPv6:2607:f8b0:4864:20::102a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E263AC06173D for ; Fri, 4 Feb 2022 07:24:36 -0800 (PST) Received: by mail-pj1-x102a.google.com with SMTP id v4so32993pjh.2 for ; Fri, 04 Feb 2022 07:24:36 -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=CP130Joo5LnzHA5fd0JPgyy8qzQq4QiMmlbo4WSc/bc=; b=L/e7pgEILiyjVuGqBatpNWgdA2j6VCihnfihFatdCHPNmoY4xviCPf/nQm5bMBlzQP amlIOx/kyvPnSQj3m3GWhXKXIOA+a/ixQAcJmr78Hq0YtpO6MTDE9lX1FHMNfagK3HZS XjSYynqpHruY90Hlo5PWLIx6f3OaLgcF+xp/gx70H19rIuwS8nNLlUni73WYe46gynsG GURGyJRD/1DK7xxK8+9xaFuK/UxXPHwEdbr7m0QPU4ZzfG6x2YUMobaPHbjmceMXl+o4 su3bKwuXugi2Zt041Hk8OVTR0IWnW6yhOqS7WJa0hv89TPcSkQUhXdwGspZn8M5cugwX kjXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=CP130Joo5LnzHA5fd0JPgyy8qzQq4QiMmlbo4WSc/bc=; b=Ao77Ee6qN7b0g++EAT7WRT4QoL2td+ssggtDfwdWfgVDV6NKW7TDNmEeIKijGGlpVq Yv1m6/lcVg+oFlCDxc6E66G30ltFwBuw/VpjhP/mD6eV1hI7qS/QCpGeQ5nwI7TgCdAi 9cxrm3UD9G0FFzuc4pFzpX4JsHe2Uh6MQdsKcugNq91D5CF7BHYoIZhf9ye7dudZG+XS QZvqe+MhV3nMefSvPxfXeJhWE8IHgR9ZCf1cXsrve/Vm8RcDjZNYEGGy6OrkHXEer4wo VVRtn/utfmEZSuTiZvtGdhliLdMjabAfvZLEc40959w0FhG1uEKtkCmdSZal6w5gMpD1 LnaQ== X-Gm-Message-State: AOAM5314v9AAxvFuFm9e79xXVD/sJ5MguAGci9FDRLtk+8upYEovtIIp bWoi4XH77jwCz7V8PSU5fa2mKg== X-Received: by 2002:a17:902:ec81:: with SMTP id x1mr3384394plg.109.1643988276332; Fri, 04 Feb 2022 07:24:36 -0800 (PST) Received: from localhost.localdomain ([134.195.101.46]) by smtp.gmail.com with ESMTPSA id me4sm14237079pjb.26.2022.02.04.07.24.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Feb 2022 07:24:35 -0800 (PST) From: Leo Yan To: Mathieu Poirier , Suzuki K Poulose , Mike Leach , Alexander Shishkin , coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Leo Yan Subject: [PATCH v2 RESEND 4/4] coresight: etm3x: Don't trace PID for non-root PID namespace Date: Fri, 4 Feb 2022 23:24:03 +0800 Message-Id: <20220204152403.71775-5-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220204152403.71775-1-leo.yan@linaro.org> References: <20220204152403.71775-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 ETMv3 driver enables PID tracing by directly using perf config from userspace, this means the tracer will capture PID packets from root namespace but the profiling session runs in non-root PID namespace. Finally, the recorded packets can mislead perf reporting with the mismatched PID values. This patch changes to only enable PID tracing for root PID namespace. Note, the hardware supports VMID tracing from ETMv3.5, but the driver never enables VMID trace, this patch doesn't handle VMID trace (bit 30 in ETMCR register) particularly. Signed-off-by: Leo Yan --- drivers/hwtracing/coresight/coresight-etm3x-core.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/hwtracing/coresight/coresight-etm3x-core.c b/drivers/hwtracing/coresight/coresight-etm3x-core.c index cf64ce73a741..7d413ba8b823 100644 --- a/drivers/hwtracing/coresight/coresight-etm3x-core.c +++ b/drivers/hwtracing/coresight/coresight-etm3x-core.c @@ -340,6 +340,10 @@ static int etm_parse_event_config(struct etm_drvdata *drvdata, config->ctrl = attr->config; + /* Don't trace contextID when runs in non-root PID namespace */ + if (!task_is_in_init_pid_ns(current)) + config->ctrl &= ~ETMCR_CTXID_SIZE; + /* * Possible to have cores with PTM (supports ret stack) and ETM * (never has ret stack) on the same SoC. So if we have a request -- 2.25.1