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 E9091C433B4 for ; Tue, 18 May 2021 15:53:51 +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 683DF6113C for ; Tue, 18 May 2021 15:53:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 683DF6113C 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: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=REy5JEA8q9ArKBSttcSXi5yQBzpuOWytPE08lmig0R0=; b=VsdjOFOXFGxF32ywPerc8MO5t E41Gs0ThIjWUyFg7nuXw58Lilv5BNScxhX2/BDCeNvlt7agc4MA1mguZL63ZyWlTnKc4HLcK22jss z510lc3w6Fu453VvGiwODtSbwLT3+PLdoXHbMhiIU4TljIvNtPwwYEaYYjPB+IszaRjeMteXZ3fzg B4NMHoo/J/tbaQPKeB973hF7Z7Uz6KGM3grfnGuljW+9MrqXP4nHVEYvTjGRmt+gHd1fWhCx5nwGl W/CAL9VokXbywv9WFXu+buuiE5E0lumAJbCoYp0BrJ9boP66Nag8leErzV4L/szE1CNgDCGKeJgkd fsTVZq6zA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lj21B-001ET4-8q; Tue, 18 May 2021 15:52:25 +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 1lj217-001ESP-9k for linux-arm-kernel@desiato.infradead.org; Tue, 18 May 2021 15:52:21 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=bvWu/YxNYDl8n91Vq4oS2MYu1VHk9VLYYrFoMYFQkHs=; b=G9xnRxFwm9gevf47u7lgl3jUa9 ifEixlzifqoUoo3gKmhaoQfKvfoLz634Wy5EvDj3/1ZFmkmi6vCRW5t4xlZnfOUs272b9UbULoGx4 Nl4G2clC9/Up5OdKlg/NhvD8xEI1wcnzne+3YbwVc4pAxXylBd49ngZuLoifap+w0w1bIudXgg6Zm /sjsrbV1UkAhr998a5gTIDnGt1R3CbrrNZwEzu7Njbm7VdXL6RlTWapx7IQFpbi6favgRb3z7uMf/ N+FFC3OHP1M6yHc26A4bgplkJEwRu5OUjb5ccYrz4n8Hwo2VTR6y8UorBXyfQq3ZgnabS3D3BFfKW hz9Ntilw==; Received: from mail-pj1-x102b.google.com ([2607:f8b0:4864:20::102b]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lj213-00EmKT-9U for linux-arm-kernel@lists.infradead.org; Tue, 18 May 2021 15:52:19 +0000 Received: by mail-pj1-x102b.google.com with SMTP id gm21so5733107pjb.5 for ; Tue, 18 May 2021 08:52:16 -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=bvWu/YxNYDl8n91Vq4oS2MYu1VHk9VLYYrFoMYFQkHs=; b=Vpftha5NbjADQPBytMWCn7OhZGD0UClX7wY/voP2Vrm8gBM3kcUyn7qkSYgMAF91su jy8mgxtvfPT8S2fx5PJTNb9YgoMle7OiEluwt4CfmuJhMAhfZ70Ee8hy/Emod2ncnWIk cgPWGPitA8dayulhuEAAr7O85vIG8AGHEttAQ/g/oe/Km2PKS4EPqB+fK4hazUKEHWnC 1GwTycgjSipgjbnss+9UoEC0ecIt/1OFduGQBq0EiUTc7GhStdaXsTifa8/9SyZHcR4A tzkJv/ZV3jYqVDhIfEgJ21mqaJrJlWarlTaToGWsayG/GIw+xcX/VhAL6Y07nGCcf0oy 0+LA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=bvWu/YxNYDl8n91Vq4oS2MYu1VHk9VLYYrFoMYFQkHs=; b=e37hpdN7t/IqFwpRD49QQY2cUHflAXL35NnLIhkRt7bjEt4yhpP3QOzKYJl8vx2h6C hO7j1xJ0FkxLnOUBveQ0ufi4hAvib2K3+RmN1BEVut9mRPquFAbgBiPhW31x2IihUx9+ iXZ3991R2AU6/9FMDdZ7iwkr0qsAMt6EFeMXa6GbHfl6PWeg0hBgy0e8wvwsG3fGBEjI T4+nlBIgi96SdjmZLkUFhaBIwNQdjkS9tihWklhBHm+LNACZQp5qJ3gq2jHxr/SZPyiA PMlBxDQTpinw9e5CKKGgdf8d+hVZRclSjLODianahVoUS52Mz+D0h4L1J+XgxVXdU+ff bOcQ== X-Gm-Message-State: AOAM530h8w65Kcnf0jgpOwHicK6AI/glvXa8KJrIrSVCsC3eUbMia7av a9cC4wIaJ6Brob5PLK29hoodj0+y57cZ4w== X-Google-Smtp-Source: ABdhPJwEuAJ7F1FxyMPBF2reHGPugT7EHAxYhGv8o6KuHC+QrrLiN0B0v8HSquYQpicsSHXpkReqnQ== X-Received: by 2002:a17:902:f68c:b029:f0:c1be:5651 with SMTP id l12-20020a170902f68cb02900f0c1be5651mr5302750plg.24.1621353136031; Tue, 18 May 2021 08:52:16 -0700 (PDT) Received: from xps15 (S0106889e681aac74.cg.shawcable.net. [68.147.0.187]) by smtp.gmail.com with ESMTPSA id lp13sm2294716pjb.0.2021.05.18.08.52.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 May 2021 08:52:15 -0700 (PDT) Date: Tue, 18 May 2021 09:52:13 -0600 From: Mathieu Poirier To: Mike Leach Cc: coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, suzuki.poulose@arm.com, leo.yan@linaro.org Subject: Re: [RFC PATCH 3/8] coresight: syscfg: Example CoreSight configuration loadable module Message-ID: <20210518155213.GB776252@xps15> References: <20210512211752.4103-1-mike.leach@linaro.org> <20210512211752.4103-4-mike.leach@linaro.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210512211752.4103-4-mike.leach@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210518_085217_362972_1E9E7BD7 X-CRM114-Status: GOOD ( 29.17 ) 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 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. > 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. 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 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel