Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1788636pxb; Thu, 4 Nov 2021 08:27:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxg6dsGAnMSY0BmW4aMnAfCgkT2JZHbDQgeWvFxyTMu2xG/a/cXTkcI8KrR5MwYUTrgOT8E X-Received: by 2002:a17:907:868c:: with SMTP id qa12mr62524476ejc.346.1636039626343; Thu, 04 Nov 2021 08:27:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1636039626; cv=none; d=google.com; s=arc-20160816; b=0ryw0Pi/1R1H5PvOPYXg4/CB98xRC5Q2HVOQZzgUeDW1X4IM0Gd3h7iS3QRGuJbhtO fN0JyhB+grVTTCjAd9CWHspy1UXjGMTrBV8gpSILz1Tjv+TgbtcgNIHWFKDi/gfV/lc1 oI4TZSCohe50VuyVEvMzvLNnqqAnntW/f4e5sG+YfG1h9jbuh9/sEY6sc7fQ+DdkBDYD 95FAD5fBIL03Tqs0uh/NrGs7NriDrWHpvoKQhQ4+vXlaaI5UXZzcz+q1iA/uvmjZaajS pYm9YLo+/FHm1B0sPDhQJO8Tjuogmi+WDjA+kKyms3vAtE9lLsuzqajLjDYzHDxLwwRj DVRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=gTtZOfoLPio4IJ+Btl36fSghDYz/De1HPU3//sxJBKc=; b=Jyo+8YYJjHAsCX/43u+nq9SAJ4aQNcaCF4hpo6ArjSAgj3/75GAQ8TyhenJjSzAA4j NN+cCgjG7D6FwgvRkIVF0H1ST4k8bCHsikPhXYwW/1YJxvuM4FW7SpC27xrHo+w4hSQo 1OCqQS6G4Sj8yk12a2BmgDfRraxPDBByhip/1aF9nxCKYR9sFyxEoScXZpU2Ez8iZLGK 31l20KDxTK6FDsZDqKS4fXZMylfxAiWtWdfqI2MUZH1Wp7xXLEvMkS9j3PkBLUuPOlvI 2mh+UyhdlUQbCyNu/bjAWjiUFrle7DNbJeJreAjZvJMydlp6swvyyaAepUj7hjNln1WK psig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JCJJxA7F; 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 o16si10725590edc.582.2021.11.04.08.26.39; Thu, 04 Nov 2021 08:27:06 -0700 (PDT) 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=JCJJxA7F; 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 S231379AbhKDP1L (ORCPT + 99 others); Thu, 4 Nov 2021 11:27:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231305AbhKDP1K (ORCPT ); Thu, 4 Nov 2021 11:27:10 -0400 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 6620CC061714 for ; Thu, 4 Nov 2021 08:24:32 -0700 (PDT) Received: by mail-pl1-x629.google.com with SMTP id u11so7792073plf.3 for ; Thu, 04 Nov 2021 08:24:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=gTtZOfoLPio4IJ+Btl36fSghDYz/De1HPU3//sxJBKc=; b=JCJJxA7FaVceWPKad16Ia+EUEGP5vWwZM6kMtupGgdtn1dQL4KaSTxcgdKDQ1guKC2 CirJoj5Hq4vKw6PEw6wgy+2HRLHXZFAt6T5uBwZA02MguPgCCcGU6WT+RKkFZHlUduQl BsXM8pWkIQc60EzOKXKWBrLYdEpvPmx6SgmDCUihbvfBapFze+bbILWZ6wDPScO2XuGx XI3/sFjzFUkfNjwjpi6G8I2oUxUcUYObMKr4z/RsmoRB67LZ+sqcnYBw/VpTzrbIPuwh qJjen8h/RQnkOFKcutAI3Lt9N/3GMNNs2rohVR2fXsNqcqbxo3kHmOTR2yu9Vke2nZXc 4d4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=gTtZOfoLPio4IJ+Btl36fSghDYz/De1HPU3//sxJBKc=; b=0LtESOBVPiumQ6JvUlQK81RTSj/sWzegV98OygSpKI+l24hgCIJ6ZyWOq3JqgIof3T GeR6/GhLYmOLBHBauhs76gk7Cq/ySPiKTvTy68ADJgjr3uCdj7N1g5xN6n/xe6AWKuwJ k4s65fCmwNJb1kPuarF0Y8f4WY6520LYJ4Ukj12yUf1v4hKLRCVlTLf1f1f5LT67QLPD HTH4J7+vUEZcSnNN8wZQqA8A0FXIy8jGacqmqF5F2OC9NI4hH5DWJIqa9Fb/C5AYV/BQ uHvl6fKHE7vTGhqMXUR3tH5YX4dl90WCZ1ut76gGl0EhWivdFVrkcCUXzOAGkDfdrfRR 2qBg== X-Gm-Message-State: AOAM531mGPg1xaKKdNc+3oRnq/Q5cSMBW+K1g1cxN7Nwpf+nOtWCtAWU jeF032Nahb3oCjXNQlllba/ZKUnSsz84PBDuHOE= X-Received: by 2002:a17:90a:8b08:: with SMTP id y8mr23426464pjn.148.1636039471789; Thu, 04 Nov 2021 08:24:31 -0700 (PDT) Received: from leoy-ThinkPad-X240s ([134.195.101.48]) by smtp.gmail.com with ESMTPSA id f11sm4194159pga.11.2021.11.04.08.24.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Nov 2021 08:24:31 -0700 (PDT) Date: Thu, 4 Nov 2021 23:24:26 +0800 From: Leo Yan To: Suzuki K Poulose Cc: Mathieu Poirier , Mike Leach , Alexander Shishkin , James Clark , coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v1 2/4] coresight: etm4x: Don't use virtual contextID for non-root PID namespace Message-ID: <20211104152426.GD743063@leoy-ThinkPad-X240s> References: <20211031144214.237879-1-leo.yan@linaro.org> <20211031144214.237879-3-leo.yan@linaro.org> <2cd79645-2f1f-1e59-1a26-5540aa7b6f3b@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2cd79645-2f1f-1e59-1a26-5540aa7b6f3b@arm.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 04, 2021 at 03:07:45PM +0000, Suzuki Kuruppassery Poulose wrote: [...] > > @@ -2111,6 +2111,13 @@ static ssize_t vmid_val_show(struct device *dev, > > struct etmv4_drvdata *drvdata = dev_get_drvdata(dev->parent); > > struct etmv4_config *config = &drvdata->config; > > + /* > > + * Don't use virtual contextID tracing if coming from a PID namespace. > > + * See comment in ctxid_pid_store(). > > + */ > > + if (task_active_pid_ns(current) != &init_pid_ns) > > + return -EINVAL; > > + > > spin_lock(&drvdata->spinlock); > > val = (unsigned long)config->vmid_val[config->vmid_idx]; > > spin_unlock(&drvdata->spinlock); > > @@ -2125,6 +2132,13 @@ static ssize_t vmid_val_store(struct device *dev, > > struct etmv4_drvdata *drvdata = dev_get_drvdata(dev->parent); > > struct etmv4_config *config = &drvdata->config; > > + /* > > + * Don't use virtual contextID tracing if coming from a PID namespace. > > + * See comment in ctxid_pid_store(). > > + */ > > + if (task_active_pid_ns(current) != &init_pid_ns) > > Please could we add a helper function to make this obvious ? > > e.g: task_is_in_root_ns(task) ? Yeah, I will use a separate patch set to add this helper function and polish relevant codes in the kernel. Thanks for suggestion. Leo