Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp941853pxb; Wed, 3 Mar 2021 21:56:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJy1unhNhFIfyd8uVAGIcrwOqFD2fPzHFC/8Ru4fgDSnBIUQcv+hEkm3Zann0beeCWpzXyf7 X-Received: by 2002:a17:906:130c:: with SMTP id w12mr2390939ejb.253.1614837374725; Wed, 03 Mar 2021 21:56:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614837374; cv=none; d=google.com; s=arc-20160816; b=NLXQijUkrd3IQS/bOPmhPnLCYvG09vKNCb/SfuyisHoVcPsHyenNonx7oPHQo7zqb5 KM+GFYkA0+huubrkEEZtl5v2TelXSI0uD8vxfM5YZo/ZbTaARss5mxCIoUuidHhkWJhR BcCQSP2AWDPp/H084P26Ulu088pnfQJUpz5FlYz2wmFm74o/O5UoNhbIzp8LLy6ozi28 k13J8m0q6+o6fdQE1iETp2yeoR5OssvYoDx+1u8hZPezcz8SCMJEoQkWe59+vTVcGBT+ FBXIvQXGn7/+xrYE//9UBKB2GGJsRAcui9LzBY3ocK3GjYt9JrBS0uk/TNirHqEQByw+ xaOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:message-id:references:in-reply-to :subject:cc:to:from:date:content-transfer-encoding:mime-version :sender:dkim-signature; bh=CD5VoQD8VG4Us5TJXJZUUc9y5YoUCLPBIN88rpUoz5A=; b=e/xwV1c1ilKXfeWvCu7dYdEOJuBtpShR9RTacx8LXAr4O/sQtc9WPq0CxlhxsQl6w4 c4O3eCqR2RbBkCeB2DLf60/NKsi7lU0hiMI4wAGGo3h3vfrJw1v5FsHDy64GL/T2HNjX G+9KeJoQeuHXmb1GxDC5Ts7oaM5w7EJigQUOubU88fj2N2T9KBi/Bzzrei6q5ofddhL3 doK4IcULJPzZqYbUy6Rteqm7DlLe/jUBeiE9TNZqaaw1VRkxAt+VOg3Q2eg/FRIWCf5s IJquaSYgtCqhE1vYLHlLEnAky65jylRHA498SWPenaoQoPiJCsNvhD9rtofzE2TKG/t4 znjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=JuWHJteb; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id fi16si5098848ejb.239.2021.03.03.21.55.52; Wed, 03 Mar 2021 21:56:14 -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=@mg.codeaurora.org header.s=smtp header.b=JuWHJteb; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1836749AbhCBHUh (ORCPT + 99 others); Tue, 2 Mar 2021 02:20:37 -0500 Received: from m42-2.mailgun.net ([69.72.42.2]:28685 "EHLO m42-2.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344694AbhCBGmr (ORCPT ); Tue, 2 Mar 2021 01:42:47 -0500 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1614667305; h=Message-ID: References: In-Reply-To: Subject: Cc: To: From: Date: Content-Transfer-Encoding: Content-Type: MIME-Version: Sender; bh=CD5VoQD8VG4Us5TJXJZUUc9y5YoUCLPBIN88rpUoz5A=; b=JuWHJtebdSfCQhTxDI+zkQV+bmrNyhpuixVL5lg/9WxofiTWQ0OyFyrWIyRheGvaKMca8IDY +tAo11xSHe2/FSRspltTk0eQvCydBjBAjnRvasJpYCiKxvSV/5V/lVMxBoM/7B7naFXW36ua jI8srBfwxJLsmVDXtYQdD04IIzU= X-Mailgun-Sending-Ip: 69.72.42.2 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n06.prod.us-west-2.postgun.com with SMTP id 603dde23fee96fcaf477a127 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Tue, 02 Mar 2021 06:41:39 GMT Sender: saiprakash.ranjan=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id EC648C43465; Tue, 2 Mar 2021 06:41:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=ALL_TRUSTED,BAYES_00, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.codeaurora.org (localhost.localdomain [127.0.0.1]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: saiprakash.ranjan) by smtp.codeaurora.org (Postfix) with ESMTPSA id BDBE0C433CA; Tue, 2 Mar 2021 06:41:37 +0000 (UTC) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Tue, 02 Mar 2021 12:11:37 +0530 From: Sai Prakash Ranjan To: Doug Anderson Cc: Mark Rutland , Al Grant , Denis Nikitin , Mathieu Poirier , Suzuki K Poulose , Peter Zijlstra , linux-arm-msm , coresight@lists.linaro.org, Mattias Nissler , LKML , Arnaldo Carvalho de Melo , Stephen Boyd , Alexander Shishkin , Ingo Molnar , Leo Yan , Namhyung Kim , Jiri Olsa , Linux ARM , Mike Leach Subject: Re: [PATCHv2 3/4] coresight: etm4x: Add support to exclude kernel mode tracing In-Reply-To: References: Message-ID: <2da60c28dcaecfc2cb7bcd25840ffcbe@codeaurora.org> X-Sender: saiprakash.ranjan@codeaurora.org User-Agent: Roundcube Webmail/1.3.9 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021-03-02 04:13, Doug Anderson wrote: > Hi, > > On Mon, Mar 1, 2021 at 11:05 AM Sai Prakash Ranjan > wrote: >> >> On production systems with ETMs enabled, it is preferred to exclude >> kernel mode(NS EL1) tracing for security concerns and support only >> userspace(NS EL0) tracing. Perf subsystem interface uses the newly >> introduced kernel config CONFIG_EXCLUDE_KERNEL_PMU_TRACE to exclude >> kernel mode tracing, but there is an additional interface via sysfs >> for ETMs which also needs to be handled to exclude kernel >> mode tracing. So we use this same generic kernel config to handle >> the sysfs mode of tracing. This config is disabled by default and >> would not affect the current configuration which has both kernel and >> userspace tracing enabled by default. >> >> Tested-by: Denis Nikitin >> Signed-off-by: Sai Prakash Ranjan >> --- >> drivers/hwtracing/coresight/coresight-etm4x-core.c | 6 +++++- >> drivers/hwtracing/coresight/coresight-etm4x-sysfs.c | 6 ++++++ >> 2 files changed, 11 insertions(+), 1 deletion(-) > > Not that I'm an expert in the perf subsystem, but the concern I had > with v1 is now addressed. FWIW this seems fine to me now. > > Reviewed-by: Douglas Anderson > Thanks Doug. > >> --- a/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c >> +++ b/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c >> @@ -296,6 +296,12 @@ static ssize_t mode_store(struct device *dev, >> if (kstrtoul(buf, 16, &val)) >> return -EINVAL; >> >> + if (IS_ENABLED(CONFIG_EXCLUDE_KERNEL_PMU_TRACE) && (!(val & >> ETM_MODE_EXCL_KERN))) { >> + dev_warn(dev, >> + "Kernel mode tracing is not allowed, check >> your kernel config\n"); > > slight nit that I think your string needs to be indented by 1 space. > ;-) > Ah yes, I will have to post v3 anyways to fix commit message in Patch 2 after I get few more feedback for other patches, I will fix this up as well. Thanks, Sai -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation