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 X-Spam-Level: X-Spam-Status: No, score=-13.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D18ADC433DB for ; Tue, 2 Mar 2021 08:27:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 81D1A64D9E for ; Tue, 2 Mar 2021 08:27:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1836754AbhCBHUj (ORCPT ); Tue, 2 Mar 2021 02:20:39 -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) 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