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.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 81DB4C433E0 for ; Mon, 1 Mar 2021 22:45:07 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 35F0360230 for ; Mon, 1 Mar 2021 22:45:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 35F0360230 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=sV4cTWPMZizjlZAzRF3+mJj9tj+neTrf24+nn7aXvxs=; b=EBz9v5yfgUsHUCpaFAJbReGdy Nb8x3XEAz0xgKbufDg3uQlS7ZeegNEYh1IZZZDoqoSMnOllW2wAXM5WgJSpXo0zS5rHjCKgzTCbUb JUzLGlZIr0eHLSxplvP+qOagcLcx0RdvIw5UfZN4Ar3Bpm4xEpQYA90o2UW737hOvX7QNXW6Ja9AR WV2k/dNhqWIZSDaHw8kuUzrGQIHRTVQrEMpTn/9p0Zt2UNk4dijBpA4u22UZVH2ov2N9cE7DkhRbR 3hBjz+7FI2s/QimdSqsyv7HYLDaN7Lw8gbyUWfd3cTzc1DFTSeAPy2Bt+ovpR5HPS3zOugDfEpF0a GBnfebd3w==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1lGrGg-0000cS-Gn; Mon, 01 Mar 2021 22:43:58 +0000 Received: from mail-qt1-x82b.google.com ([2607:f8b0:4864:20::82b]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1lGrGe-0000bc-3j for linux-arm-kernel@lists.infradead.org; Mon, 01 Mar 2021 22:43:56 +0000 Received: by mail-qt1-x82b.google.com with SMTP id r24so13376823qtt.8 for ; Mon, 01 Mar 2021 14:43:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=lod5AV9stobf9YNREve+YsqCj5E/GdBeQLdaIwH06w8=; b=J+1SzQlP7bzH6srtUJ5VsXzAJWbsJC91YMbGucsxFWtvOoqjiUQJuvFiOKPPGAFbZn uBGKb2TP1MBkakw/ZKMPRyJkNQwAYQHx5IaBzczl+N4CdBPVv2HgVh+WLOvUWGXMTwUQ 7T997WUnCUbqgoyxLmeMmGEH//xMy3QoEfirU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=lod5AV9stobf9YNREve+YsqCj5E/GdBeQLdaIwH06w8=; b=Havij1+ZVmhSOpt9WoU5LIIDqKcxxMi8wzOJ8TQwWMk7t+PY470S+pw5mEtJtkz+sh wmG5EfV+VKeRx+Sxh2T90cnjCgxf3bXR2ojatl46qbwydjEIfVDHLKom0fKewdqozkK8 LW61B6OmbunnHp6kn0MpeCSRb5pP00OGFea0IpdmP9rL1xNunj4N/YC2O98RDveWdVgX YzVgBDEHH/KTY2Qe8xNtsQc8x+RVYBzZyFk44WMM1TuVl8F+98MagUIjnMfGAI2sS1Wv 8mzSA6RzhXemZMF6+ItquBQIJC1uyWSv8lolZkvNkAJD/dpT2CIAFqaogp1g4rhAUZnb VY0A== X-Gm-Message-State: AOAM532Aq3SuulH2rTOkWOGWwHWWBuh/Z0Wn9olj3RkrOHnysbKtApGr T0ucG3gRdUq8kDXAEfuGEXW4s62cR+F6lg== X-Google-Smtp-Source: ABdhPJy3tOuC6HRpK6jz5y8c/99M4inTrEQdiddeaNdsjIcBEQh2o3UPMZ+DcxpqtUa3jS6n20eVZQ== X-Received: by 2002:ac8:4759:: with SMTP id k25mr15597749qtp.390.1614638634191; Mon, 01 Mar 2021 14:43:54 -0800 (PST) Received: from mail-yb1-f175.google.com (mail-yb1-f175.google.com. [209.85.219.175]) by smtp.gmail.com with ESMTPSA id b27sm2875141qkl.102.2021.03.01.14.43.53 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 01 Mar 2021 14:43:53 -0800 (PST) Received: by mail-yb1-f175.google.com with SMTP id u3so18679341ybk.6 for ; Mon, 01 Mar 2021 14:43:53 -0800 (PST) X-Received: by 2002:a25:ab54:: with SMTP id u78mr27378505ybi.276.1614638632804; Mon, 01 Mar 2021 14:43:52 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Doug Anderson Date: Mon, 1 Mar 2021 14:43:41 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCHv2 3/4] coresight: etm4x: Add support to exclude kernel mode tracing To: Sai Prakash Ranjan X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210301_174356_164969_E135F5CF X-CRM114-Status: GOOD ( 20.02 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 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 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 > --- 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. ;-) _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel