Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp27981pxb; Mon, 7 Feb 2022 05:51:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJxZZ6m+khZtg0XN8uDHjs+8ZnlroAsiQagB4qQmVTBxKxAvPC9nC3JYU1meYJEhWnadQe/L X-Received: by 2002:a05:6402:35d4:: with SMTP id z20mr14099339edc.13.1644241867913; Mon, 07 Feb 2022 05:51:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644241867; cv=none; d=google.com; s=arc-20160816; b=Wl/os14PmFHjm0fvudpzHBnRcrPc1PS4SZHP0RObcTaCiEUYHtuAZLU3M3Fzw0V49I nuskWciytyTRgZMJJJBhp36EFq7DpZHC8QhI6x2hzit3V+PmCURsv7BTUJ0x3HS9ooGF GmEmeKH3XsjyqkufJ62DC/l++v9UI3qc55/i66TvDGF+R//5rcSZEyAL8OAdcdhRFbD3 QlN0bQG1pHibtGjChi0kf7GTHfBOC/zmGDfBO9gt9aCRzmVpf/nr5Gzn2nmcROuhlpMb CXFPBCKd52Gff8oIkCC28/RCfisQfK9LolaJmigSiGg7QYwtBwAS+SLRv336N982CTMZ z+8Q== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=GkiUUzVe9i6a+fIe7hk2GiLZxTBYFSj52q9QJFu9QnI=; b=JplTEOIVFvTHHt4etg3iXEQN82OMLDCqhlXMB+Sa3pZInUSbqn/LMi/9tSPfg47upu 4veNvXRjgmg5mdXvOwccKe1E1VtbK5WEAqG5efhr+7FHCDdrZM4qANEnlTsdzMCysWv9 6V0Esh1m3FEI+IEwhng+Qa7VMjmaDc6McRV51OU6Q4yCHXYAuLaGDSAvg9kTJNcENAef 9UMo6O/TT7UBwYc6qKsjfLnqoj4t+riuyA0ud2o8XpWNM4ylSIOgjsyR6C4Dh8UgHH37 X6Nu5ueYRSNqbOZs127OAiP/Fju5TL0c0lMOdUhNNqaHcRxawwDyDQREcahQGgPuD0xy zKhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="foc/ui1c"; 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 he14si7379914ejc.89.2022.02.07.05.50.43; Mon, 07 Feb 2022 05:51:07 -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="foc/ui1c"; 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 S1359665AbiBDPYZ (ORCPT + 99 others); Fri, 4 Feb 2022 10:24:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59724 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238436AbiBDPYY (ORCPT ); Fri, 4 Feb 2022 10:24:24 -0500 Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BFE17C061714 for ; Fri, 4 Feb 2022 07:24:23 -0800 (PST) Received: by mail-pf1-x42f.google.com with SMTP id 192so5389777pfz.3 for ; Fri, 04 Feb 2022 07:24:23 -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:mime-version :content-transfer-encoding; bh=GkiUUzVe9i6a+fIe7hk2GiLZxTBYFSj52q9QJFu9QnI=; b=foc/ui1c4BJKma1LKd5zOOnJH+mPze1ao2DbylYdX/0nYGsd6480mFYgd+FVOWx35l PS6Ld5328J8MTOA8hx9L3xZeBXcwoIbjBo2OXHozNZUoQAO4oAbkP+DfrrtHd70dSTSy dkdZAmn6w2GhMGUQlEpUp89NoeVI2s+IHInUcPVzUTq4l5kEvbEfHtnmveTTwf9WSfxQ gH0NIVFREsgOt6s772SSlG3cWoFg8CKDG9AeYGrp3Kv3uMqjiqn3blKac9P6+jBCRv5F pQ169oQ+EFFA+KuD7e31e2ngFbGkFiCHXib2WlI1VYQvSd7KNXeM7Eut/wWsEOlgILD+ +xzQ== 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:mime-version :content-transfer-encoding; bh=GkiUUzVe9i6a+fIe7hk2GiLZxTBYFSj52q9QJFu9QnI=; b=zfbIaSh06fjVLPZwVJ+KdlW21k4VaYY3FQtUW5uSoSNCDlfsd2CcdxmiM3Zounr4Sl ft+fQRHSDPtCLih8MFazue/aLubky3wNZmQC97vHF3OCFEqB8ARHRJAaFteSMniFRxR3 WHZPXD/V1WswOVgrE+ClVRRKQOKrUFy2xNRBtWYHCHSG49FHIcgv9KF+RtmZ4K0581DH gboB++M40BiC4n7D7AokGmRvgTD3/JjffYRLu0QJQHZ5SHqBrRB3Yn8kUD+cM1NPPHlr CZQar8VoD4Ju8vZ6UFZOtMO4sGvjbPbQLA4j/9hPhKU5yLJBNSaWpP/a2uFAn7fEOFkl ToCw== X-Gm-Message-State: AOAM530XJ7Us7R8d0cBAyNX4wUveWsn/pWRBoNZByYYul2Q1kzoIdVxt JBBegwQ1OziaZ1cZUvbGGhgl8Q== X-Received: by 2002:a62:7a50:: with SMTP id v77mr3595642pfc.4.1643988263135; Fri, 04 Feb 2022 07:24:23 -0800 (PST) Received: from localhost.localdomain ([134.195.101.46]) by smtp.gmail.com with ESMTPSA id me4sm14237079pjb.26.2022.02.04.07.24.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Feb 2022 07:24:22 -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 0/4] coresight: etm: Correct PID tracing for non-root namespace Date: Fri, 4 Feb 2022 23:23:59 +0800 Message-Id: <20220204152403.71775-1-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If a profiling program runs in a non-root PID namespace and CoreSight driver enables PID tracing (with contextID), it can lead to mismatching issue between the context ID traced in hardware (from the root namespace) and the PIDs gathered by profiling tool (e.g. perf) in its non-root namespace. CoreSight driver has tried to address this issue for the contextID related interfaces under sysfs, but it misses to prevent user to set VMID (virtual contextID) for kernel runs in EL2 with VHE; furthermore, it misses to handle the case when the profiling tool runs in the non-root PID namespace. For this reason, this patch series is to correct contextID tracing for non-root namespace. After applied this patchset, patch 02 doesn't permit users to access virtual contextID via sysfs nodes in the non-root PID namespace, patch 03 and 04 stop to trace PID packet for non-root PID namespace. This patch series has been rebased on the mainline kernel and applied cleanly on latest commit dcb85f85fa6f ("gcc-plugins/stackleak: Use noinstr in favor of notrace"). Leo Yan (4): coresight: etm4x: Add lock for reading virtual context ID comparator coresight: etm4x: Don't use virtual contextID for non-root PID namespace coresight: etm4x: Don't trace PID for non-root PID namespace coresight: etm3x: Don't trace PID for non-root PID namespace .../coresight/coresight-etm3x-core.c | 4 +++ .../coresight/coresight-etm4x-core.c | 10 +++++-- .../coresight/coresight-etm4x-sysfs.c | 30 +++++++++++++++++++ 3 files changed, 42 insertions(+), 2 deletions(-) -- 2.25.1