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 6B67BC433B4 for ; Tue, 18 May 2021 21:17:58 +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 EBF8C611BD for ; Tue, 18 May 2021 21:17:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EBF8C611BD 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=/eVguobvXqTai60tA4K3e5LU7v927+8222CvAbyfSs0=; b=G+M8vHr5lQYQmNWC0Xew1fH1V PqYKyG9kPmNRs42oz6PkurT8+bcZ6IQZ9J9x4+cO8HnZZ5CxlMF4AGfF9G5Dp2WTeXA0u3HwWJFna WHhgJX+0Wku59GRUyGnRcG84Hk4j9A9osCkGzPcexkM+aDeVMt39F1WjoLXCD1i78REEtkniXp29R ZlnHuL5Mf0wPtWVdijV/HFwWjjk8xY+BoxJW/Y4sz51vokExLA1mMcMuRYFZEkid57AGK4VLd0Cga 2EnODnTz2YurjB3AoHOE/UlFGhU0n2bzE5KcQ7DrQDCqag+qanPMxwaceGs3NWWRkgBmpe3b5ftBq 2jntH4v8w==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lj74Z-001uIK-Kz; Tue, 18 May 2021 21:16:15 +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 1lj74W-001uHW-94 for linux-arm-kernel@desiato.infradead.org; Tue, 18 May 2021 21:16:12 +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=1pnlwwGVt8GSRdSjF96F04FGMHr1ngIjX820x2yEzxU=; b=2SY01oZPpP5ziKi1cmSChyHETp hZi2wXXbit+6CHriDbcl/8EfVd6wslvpij/paQAK9bgp4BnENj/TzUdgvAeKT8RBlTTDuWP/O+JBa Mmmtz9Qj0Xz9O+YLkmRsetyNjaQs8hwd0PW5SIVR330Q2zHRZ2e90wn2+2+F49FXvK0U43Vr/NkoL 0n+q3MG8SWOuttA+ddgg74pYcJuOWiDMsi90V0NvzVPca+KDlHTTNkS1FvKmCUNQzaf3nC4RdiTuQ gp53FxWnLinaAwi2nn/Dkz0brTd9M4vf6zqyhNEe2LEiw0q5FwXwG1+fNh3cRKAl6+nvcYoS8KxjU k5ydD23Q==; Received: from mail-io1-xd2a.google.com ([2607:f8b0:4864:20::d2a]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lj74T-00EyLD-BH for linux-arm-kernel@lists.infradead.org; Tue, 18 May 2021 21:16:11 +0000 Received: by mail-io1-xd2a.google.com with SMTP id d11so10894187iod.5 for ; Tue, 18 May 2021 14:16:08 -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=1pnlwwGVt8GSRdSjF96F04FGMHr1ngIjX820x2yEzxU=; b=CH+kN8DUB7++dirodrKm3/3EXREtbHfrDkygOYKHiZkCARzNhYmDSE8xSB+buwBvJf VpJAOYx7rwWnIwc+M/uu07FvtXVnM5LJm4vu9z2B372iWVqT4WPjRv2mETfGvX/PuhFj C51+0b3ig64RMjUEBl2ITmwK2Ot1NjxN9/bOFhUDHfdGlJFFGa0FfIXwD7WQW3js87d5 DvyT+TzcYP76fUteEf85m4Yj2Qv42YcjEs6hCZpIK1U6BcTENRvC0Dtb2X8ctxddLCcp XA3a2sD0IWjV3jgiM+NzIV3UwQtaF/uSmpXi/sNGwYjIAvjly0MYYhjqxHkiNRIO/DxT 1VPA== 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=1pnlwwGVt8GSRdSjF96F04FGMHr1ngIjX820x2yEzxU=; b=eVmHzsXSRJlJfCAEzEwAa4n/4skUkR3ZLI1vEMLNPIoguVPWUF3TigZOyTpXSZVtTi BZ0OcsjEcAXL72Ai7womdNizhp2aEPWYp/iVNymwqNxruVZgp/j+aW5CXvyp2SfLqkFi WLFEdiZK+nDH6ILC/XxujXJ8Zta4VioXP6bJBPVJdp5rHo0M0wW9R7mcc62EXowOk4qA DP+yzsslv75jtAh8Cs16QYAeCS15y1r4ASJ3cgrl05zmrHMNgv3IEe9rF0he2Q/gvv/L 9iEdMU44CJzvKi1sce6iPRmNwK1g7HeidjzhSJoFs6XvxUKrFEXhWLxhu8/5T7Ewoj2S Smlw== X-Gm-Message-State: AOAM531jN1p/eUh+2mByQskZWQtp2nyBnmD1gzUTjCAGyaLfGOoZd3cE 6ICZMQ+NEPdPhT77tYs3cbXN7u8/Y+43LISllxPz2Q== X-Google-Smtp-Source: ABdhPJwjneR/TepY8ymxEmvLkNuvtgu34ZcpUXadrPzp6WsgsaEKufJkvpODedMdYHcnfvNHsW0RH7s8EVTq9lNaZas= X-Received: by 2002:a05:6638:2a1:: with SMTP id d1mr8072182jaq.52.1621372567842; Tue, 18 May 2021 14:16:07 -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: From: Mathieu Poirier Date: Tue, 18 May 2021 15:15:56 -0600 Message-ID: Subject: Re: [RFC PATCH 3/8] coresight: syscfg: Example CoreSight configuration loadable module To: Mike Leach 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_141609_416474_107F1026 X-CRM114-Status: GOOD ( 43.06 ) 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 On Tue, 18 May 2021 at 10:38, Mike Leach wrote: > > 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 Yes, that's exactly what I did - I should have been more precise. > > 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