From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AE73DC433EF for ; Thu, 4 Nov 2021 15:26:14 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 72BF3611C4 for ; Thu, 4 Nov 2021 15:26:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 72BF3611C4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=HU+2TxbCvOBEZn00Ltr2H382t/f5my01NUaeUFvoCSo=; b=4/GxAQrWWiKyJA fjj181+QDGjvQ97pPBEEUqHiiJmK8AeiVaF1le/BLcrzPsI/JJl53js7xFsWbA6HOjk/BXZjYgBE2 QdMzirnVDQ4ZypjH3u1ZY1jlCtbLVWVomAqmZ0Z3TEEQSKCx7UFdW8e4UJRLo+W3+JFrknejna/8P A3R6nOSUp+z65/RtrYCWPgHOCpbuDXK7/0b9qzZumpNs8CXS+s04qk57hwKMGZPdUsk+wT3Z4RBHO QlQCOjC3IkC8Va95STl8iHrImcRPOnF+5r6nZb+XjD4HdbjPHeKlhNT1dd6HJC4mhereTWX9i06+z sbgIwJKHZXN0/JkBLBnQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1miebW-009FdP-8x; Thu, 04 Nov 2021 15:24:38 +0000 Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1miebS-009FcN-8e for linux-arm-kernel@lists.infradead.org; Thu, 04 Nov 2021 15:24:35 +0000 Received: by mail-pl1-x62b.google.com with SMTP id o14so7780963plg.5 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=IYB9wgSiRRVvTnLkCdktjMvbv11ky6tDzOrJz4G0tSTnEl8ytp63QVXGi6sIsULPHS 9SGbGOCUdDqts5c4wJx/u1ktxZYUMGWfl1MtTo6OhKFEHs0KKOkaDOOu6fusjbGk072R KsNPjowXOp7IUFmv5RHKLPdfNKaMBK9+C8hZNY+q9gVeFXWb1Krh4h5wlqYIR7heSpJU aZdxfgUn1KikEQm3cqA6Mx9lEPPRvFVGfEyL52h7N2koNL1i0MJjOur3Kg6Ah584ftU2 jXSjk0o1l21gu28v9/kg48PRUjEhVp+5nRvMwnhRrbWleXkIDIXNxY7Hhy1K4yarZUFQ Qkrg== X-Gm-Message-State: AOAM531Hxh1Bre+Fec/f5vKokK7SyRurWpe8/hahT3M3xZAvKSMaPjKw s9MWPGmYvxRGEYOeA1mnM2FSgQ== X-Google-Smtp-Source: ABdhPJwEdK3pIqoRs2Z3rDz6RANwPTSrWN8cUHPhDaSlDkXjwJdq9RIVHIoW3OzqbMhT8EhVBPEBAQ== 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-Disposition: inline In-Reply-To: <2cd79645-2f1f-1e59-1a26-5540aa7b6f3b@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211104_082434_367581_D23FF537 X-CRM114-Status: GOOD ( 14.82 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel