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=-14.1 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 79509C433ED for ; Tue, 18 May 2021 16:40:39 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 025BD610FA for ; Tue, 18 May 2021 16:40:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 025BD610FA Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.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=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Cc: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=9wpJwidRkpiAX6wNl322MiTR8KdUAOvcN+6XCMGTGfw=; b=qYKfDD0eoU7YpV/N6SpXLWoU3 lX+Ltwh3FOSlJxpCh/PoHhDGaIdSDzbtybqhkJFGvNfFMxkIxSDjp6gKvJ3xDVCmo17s1fk6GXaeR 1NmEyLEyYabi/1IMPW+fV2sGsQib22+woc82yj0BAv+ged+WwNXL/V8J1trxnsZeFQI1ycLjnKNln xrNfgR/sLQYf53F7rS+P3cOwE1nqj2W15t/2t+OFGoEVxUFTKdhHTlL6ROYJ6bmNPZCMk45w8yltb M9Hv6wdFBobTT5/1hvNvfi1yjCuJB4wY/ggfjFZRcySrCsag1y6j4i55dqwOn42PRC7X/gtVaX18w cUVBqQoiw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lj2k0-001MHe-Eg; Tue, 18 May 2021 16:38:44 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lj2ju-001MGs-1w for linux-arm-kernel@desiato.infradead.org; Tue, 18 May 2021 16:38:38 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Type:Cc:To:Subject:Message-ID :Date:From:In-Reply-To:References:MIME-Version:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=oDZQL9vFknwp/POZxqStVQGAIx7NjXqXNjkh1NXwQOQ=; b=WuGGaauY3eBBMZu809+nP6fPUt UpM6TLVmoBsL7YtYkZHfqw36buJWOJ7J+a7peczr9ij8DzFWhYkPNJ1QQ1EhQPc9Hdt/JifaxzLHd R2AN9zrLZOXfxojbzgEQiitdCsg03yNc6+lIGZAqcPB1QLl5Q+Ug0u+FQXteTAidvXvmYKeNT/msY MjOo3VLaSNGv44BogtF9oBCdJfz5SePA0M9Vq1Fx/WWIQ7iluzhb/9R/9OkFMg8EyW2AgXFr4tvIt ngWBKHUrtJttooYgovOr+KajnoS8ITM9h88D7kml900xOHtMBa5oMrDpbzormN8VyAIjFV+wmrIBr qhWrTRxw==; Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lj2jq-00EoKF-NH for linux-arm-kernel@lists.infradead.org; Tue, 18 May 2021 16:38:36 +0000 Received: by mail-wm1-x329.google.com with SMTP id z137-20020a1c7e8f0000b02901774f2a7dc4so1919233wmc.0 for ; Tue, 18 May 2021 09:38:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=oDZQL9vFknwp/POZxqStVQGAIx7NjXqXNjkh1NXwQOQ=; b=cS9ian3jfWk4+RIAa+/IQRXYgN6CyT+U+djIOzWe2LAwW9CAokn9+G58UoxG9Dy5Ev kax15lP+qoBVLSRJn6Wx8ztUwdFi+46/ZcIdGOwzuES9ldaPNGCp0lvsZ4dwuZZGkCx+ W1glyWQyUJNRLQIIC/UtEb4+SlVFGVGJcAzPzhsClgGLqByT1+VFIojvr9uypaHEO0fc v1xXwZ3Q2DMC0jfG6C/DagxwAYMtflGihL6Re0g4wSaqm/68O3K1cphrtgM1NU3MDoXa Vida/KyB0u8qs1lCPjpCGAVCfM4q1zsXZtUaeHryZuAaBaiJn7OwRNfSMyUotIUg2se7 U8aw== 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=oDZQL9vFknwp/POZxqStVQGAIx7NjXqXNjkh1NXwQOQ=; b=qWmIj+8KLWaVAN7ycMteE2U8rx2VrPvv92vt8zSl/nF2V9PjLs45cysN80/RfZXkOx PVntkolLKNkRt6cttnCkTP/9sOg5oiGjl0aHJC3GSPqXhIcb+bPHvHN7sqQVtPnwmDon AT/VlBJ+zHxU+o3QzkcL/WUKiOePKrXss0IaiQCpJFm+w6xJI/XA4vhU8uLsnvjljSL6 o1YFGIgcngMN4YVnhBBkb7vW8n4rXAc+qznKzWK1fZk4Nmm/QpIaJAKhnZ7JyNVBB8EM IgvAHLWcviruQxvP6Ix0YxOZvU2WcvGYmQNxTyOk2JXZ/RYB86WBrzfNy1UTkI0cp9pK TfUw== X-Gm-Message-State: AOAM5313WkLGslkxG3ON2eqNcyXL8fg4iZKELPb9p4raaT9dv+LAbPV+ rjjE67uGa4dFpUw1SGU3UcNomSItMeGVJHk5a4UJHw== X-Google-Smtp-Source: ABdhPJwDaxdiqJx9/Aff8ySqhXlRrR+W0jKKxR8MslZTFNjVj8VH85Tpx9ILanZB+qglLeLYe3MDPy541S6IYW/VqQo= X-Received: by 2002:a1c:cc05:: with SMTP id h5mr5916854wmb.92.1621355911775; Tue, 18 May 2021 09:38:31 -0700 (PDT) MIME-Version: 1.0 References: <20210512211752.4103-1-mike.leach@linaro.org> <20210512211752.4103-4-mike.leach@linaro.org> <20210518155213.GB776252@xps15> In-Reply-To: <20210518155213.GB776252@xps15> From: Mike Leach Date: Tue, 18 May 2021 17:38:21 +0100 Message-ID: Subject: Re: [RFC PATCH 3/8] coresight: syscfg: Example CoreSight configuration loadable module To: Mathieu Poirier Cc: Coresight ML , linux-arm-kernel , "Suzuki K. Poulose" , Leo Yan X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210518_093834_817211_0844C944 X-CRM114-Status: GOOD ( 39.00 ) 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 Hi Mathieu, On Tue, 18 May 2021 at 16:52, Mathieu Poirier wrote: > > Good day Mike, > > On Wed, May 12, 2021 at 10:17:47PM +0100, Mike Leach wrote: > > An example of creating a loadable module to add CoreSight configurations > > into a system. > > > > In the Kernel samples/coresight directory. > > > > Signed-off-by: Mike Leach > > --- > > MAINTAINERS | 1 + > > samples/Kconfig | 9 +++ > > samples/Makefile | 1 + > > samples/coresight/Makefile | 4 ++ > > samples/coresight/coresight-cfg-sample.c | 73 ++++++++++++++++++++++++ > > 5 files changed, 88 insertions(+) > > create mode 100644 samples/coresight/Makefile > > create mode 100644 samples/coresight/coresight-cfg-sample.c > > > > diff --git a/MAINTAINERS b/MAINTAINERS > > index bd7aff0c120f..9ff5f5e7dd06 100644 > > --- a/MAINTAINERS > > +++ b/MAINTAINERS > > @@ -1789,6 +1789,7 @@ F: Documentation/trace/coresight/* > > F: drivers/hwtracing/coresight/* > > F: include/dt-bindings/arm/coresight-cti-dt.h > > F: include/linux/coresight* > > +F: samples/coresight/* > > F: tools/perf/arch/arm/util/auxtrace.c > > F: tools/perf/arch/arm/util/cs-etm.c > > F: tools/perf/arch/arm/util/cs-etm.h > > diff --git a/samples/Kconfig b/samples/Kconfig > > index b5a1a7aa7e23..0cd618e15571 100644 > > --- a/samples/Kconfig > > +++ b/samples/Kconfig > > @@ -223,4 +223,13 @@ config SAMPLE_WATCH_QUEUE > > Build example userspace program to use the new mount_notify(), > > sb_notify() syscalls and the KEYCTL_WATCH_KEY keyctl() function. > > > > +config SAMPLE_CORESIGHT_SYSCFG > > + tristate "Build example loadable module for CoreSight config" > > + depends on CORESIGHT && m > > + help > > + Build an example loadable module that adds new CoreSight features > > + and configuration using the CoreSight system configuration API. > > + This demonstrates how a user may create their own CoreSight > > + configurations and easily load them into the system at runtime. > > + > > endif # SAMPLES > > diff --git a/samples/Makefile b/samples/Makefile > > index 087e0988ccc5..6c96297001a8 100644 > > --- a/samples/Makefile > > +++ b/samples/Makefile > > @@ -30,3 +30,4 @@ obj-$(CONFIG_SAMPLE_INTEL_MEI) += mei/ > > subdir-$(CONFIG_SAMPLE_WATCHDOG) += watchdog > > subdir-$(CONFIG_SAMPLE_WATCH_QUEUE) += watch_queue > > obj-$(CONFIG_DEBUG_KMEMLEAK_TEST) += kmemleak/ > > +obj-$(CONFIG_SAMPLE_CORESIGHT_SYSCFG) += coresight/ > > diff --git a/samples/coresight/Makefile b/samples/coresight/Makefile > > new file mode 100644 > > index 000000000000..09126aabf43d > > --- /dev/null > > +++ b/samples/coresight/Makefile > > @@ -0,0 +1,4 @@ > > +# SPDX-License-Identifier: GPL-2.0-only > > + > > +obj-$(CONFIG_SAMPLE_CORESIGHT_SYSCFG) += coresight-cfg-sample.o > > +ccflags-y += -I$(src)/../../drivers/hwtracing/coresight > > On my side this really doesn't work and it's baffling. I double checked the > path that gets generated with V=1 and it is correct. I ended up replacing > $(src) with $(srctree), which gave me a full path rather than a relative path, > to get things going. Please see if that works on your side. > > I looked at other Makefiles and $(srctree) is predominant. As such I suggest to > go with that to avoid further headaches. > If I substitute $(srctree) instead of $(src) I get the header file as not found. Paths generated... using $(src) : -Isamples/coresight/../../drivers/hwtracing/coresight using $(srctree): -I./../../drivers/hwtracing/coresight However if I drop some of the relative path to make the line ccflags-y += -I$(srctree)/drivers/hwtracing/coresight then $srctree does work. Can you confirm that is what you did on your system? If so we can go with that. > > > diff --git a/samples/coresight/coresight-cfg-sample.c b/samples/coresight/coresight-cfg-sample.c > > new file mode 100644 > > index 000000000000..865c188fae34 > > --- /dev/null > > +++ b/samples/coresight/coresight-cfg-sample.c > > @@ -0,0 +1,73 @@ > > +// SPDX-License-Identifier: GPL-2.0 > > +/* > > + * Copyright(C) 2020 Linaro Limited. All rights reserved. > > + * Author: Mike Leach > > + */ > > + > > +#include "coresight-config.h" > > +#include "coresight-syscfg.h" > > + > > +/* create an alternate autofdo configuration */ > > + > > +/* we will provide 4 sets of preset parameter values */ > > +#define AFDO2_NR_PRESETS 4 > > +/* the total number of parameters in used features - strobing has 2 */ > > +#define AFDO2_NR_PARAM_SUM 2 > > + > > +static const char *afdo2_ref_names[] = { > > + "strobing", > > +}; > > + > > +/* > > + * set of presets leaves strobing window constant while varying period to allow > > + * experimentation with mark / space ratios for various workloads > > + */ > > +static u64 afdo2_presets[AFDO2_NR_PRESETS][AFDO2_NR_PARAM_SUM] = { > > + { 1000, 100 }, > > + { 1000, 1000 }, > > + { 1000, 5000 }, > > + { 1000, 10000 }, > > +}; > > + > > +struct cscfg_config_desc afdo2 = { > > + .name = "autofdo2", > > + .description = "Setup ETMs with strobing for autofdo\n" > > + "Supplied presets allow experimentation with mark-space ratio for various loads\n", > > + .nr_feat_refs = ARRAY_SIZE(afdo2_ref_names), > > + .feat_ref_names = afdo2_ref_names, > > + .nr_presets = AFDO2_NR_PRESETS, > > + .nr_total_params = AFDO2_NR_PARAM_SUM, > > + .presets = &afdo2_presets[0][0], > > +}; > > + > > +static struct cscfg_feature_desc *sample_feats[] = { > > + 0 > > NULL > > > +}; > > + > > +static struct cscfg_config_desc *sample_cfgs[] = { > > + &afdo2, > > + 0 > > NULL > > The end result is the same but it is a matter of time before it gets flagged by > a bot. > Agreed - I'll fix the Nulls Thanks Mike > With the above: > > Reviewed-by: Mathieu Poirier > > > +}; > > + > > +static struct cscfg_load_owner_info mod_owner = { > > + .type = CSCFG_OWNER_MODULE, > > + .owner_handle = THIS_MODULE, > > +}; > > + > > +/* module init and exit - just load and unload configs */ > > +static int __init cscfg_sample_init(void) > > +{ > > + return cscfg_load_config_sets(sample_cfgs, sample_feats, &mod_owner); > > +} > > + > > +static void __exit cscfg_sample_exit(void) > > +{ > > + cscfg_unload_config_sets(&mod_owner); > > +} > > + > > +module_init(cscfg_sample_init); > > +module_exit(cscfg_sample_exit); > > + > > +MODULE_LICENSE("GPL v2"); > > +MODULE_AUTHOR("Mike Leach "); > > +MODULE_DESCRIPTION("CoreSight Syscfg Example"); > > -- > > 2.17.1 > > -- Mike Leach Principal Engineer, ARM Ltd. Manchester Design Centre. UK _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel