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=-15.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SIGNED_OFF_BY,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 45F66C433E1 for ; Mon, 10 Aug 2020 22:27:33 +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 064A72073E for ; Mon, 10 Aug 2020 22:27:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="acCkYKZf"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="MyiMvzSl" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 064A72073E 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=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject: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=mPZnYxiKS7QXPLbAPaEqSYwZjOCTb8cSWpPwZ5bOsk8=; b=acCkYKZfUdZD2i68QqzT80EDp nIbFntcZ8bDsffxLJIIB4pTsdLIV+W0e6Vx97m35tQltpgv2H/HS8/zi7mC8dmskoOUmbG9EKczrf q74/VyBJxpyeqo11gRvom4Y6ZweP8iblucNFseBdXkZWSUhA7nrjxoJdPZV1zPW4mPJRe9VtOObBu 3zyUGz0o3jEn7jWtdGWXYGuDvFX7CoJqPEmYyQq+w0W13JboRDVHlrPN1FGlrX1MoCBxgoOFHFbqW 7PtvUoflI4nFvfXs1iePZ3SYOWVZJArovJDItq6eaBOvSiBXc2olqgziwOmPSka2rZWecYt56XP4N 8eWeDyssQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k5GF2-0001mU-55; Mon, 10 Aug 2020 22:26:04 +0000 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k5GEz-0001lu-9r for linux-arm-kernel@lists.infradead.org; Mon, 10 Aug 2020 22:26:02 +0000 Received: by mail-pf1-x442.google.com with SMTP id 74so6496802pfx.13 for ; Mon, 10 Aug 2020 15:26:01 -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=xLU3lejvU0ve5J1CobksCT4xZRhZ00RZJa4a90xXNJc=; b=MyiMvzSlQ3BR6QPo0KVDaMHFdOSlBLngscXyrbkFm9nuZYn+WwZg9t1cKLHLBjvsEh MctSOVLC18QI7LAoa804qfhyOooV+NIRJnMgSn0eAzZeuO0Y44InbW0/lG/bG3Ly1OwW MYD+UyEnLhZWs2oR/Qdh/T6Yq+E5HFU4q5EDdXQSlELu26J9HBiuF9/f8QDkCIe2p/Ps Su543c4zEM6V5jcwrWbr2B1a4EJ1J+5oUwvEQiLNMQeP/35IXkq4JrKITSXwWGnTvjRY gkF0nrUPtLQP0AsltBy0/Hnn5XASy3NsY/RKRe8XpSjs9McebdsAgRqiKT/JrJtyxKWC C31Q== 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=xLU3lejvU0ve5J1CobksCT4xZRhZ00RZJa4a90xXNJc=; b=htUPKLa4AqKgoCXsMd0hbz2n1Y9l859rDIVP04tx5H2k4udqwhTOLWtOUW25Gf3mPg BpyBnVomfqJyQk9+Pp+d6KUnopin4QYPexBviQdBMRHU20n/2eb/LW9iNi5ybfRxVVVh Rh+vIjOmZUZCDjXDE/C+tQBVGFPiZ8IC4iry6x9QuAyOEUP3t0ul8aNt7/oE+DlOY69K QY9hGFWU+/Yb2/2rwQp8Aj4HMo345AJuX1w+miRDrRDneD8zJcA5pAV/mm2nMdxLvu4M brqPTv6BhnH2SCbdSGua6UbRG0SrGRUVVTintAJM/RYk6/obsEjZqF6axuubyeXJrgHD Jn2Q== X-Gm-Message-State: AOAM530qQfMbXpbdk8HAK2YSt9X0NQ1QvbFcWyIHngiaFQ/HG9QgwNpZ iblFRG25zRe5MEsLDhSufm97ug== X-Google-Smtp-Source: ABdhPJyQi9dGFaKeiblH1xQtawqs3AGktZy7UMZSlKuhPGgeI7+GlFM6bckxGI7XQh59oAJnfMUQNQ== X-Received: by 2002:aa7:9535:: with SMTP id c21mr3178366pfp.322.1597098359306; Mon, 10 Aug 2020 15:25:59 -0700 (PDT) Received: from xps15 (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id q33sm14930076pgb.2.2020.08.10.15.25.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Aug 2020 15:25:58 -0700 (PDT) Date: Mon, 10 Aug 2020 16:25:56 -0600 From: Mathieu Poirier To: Linu Cherian Subject: Re: [PATCH V2] coresight: Make sysFS functional on topologies with per core sink Message-ID: <20200810222556.GE3223977@xps15> References: <20200801090950.19420-1-lcherian@marvell.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200810_182601_524934_B94D3B22 X-CRM114-Status: GOOD ( 40.93 ) 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: coresight@lists.linaro.org, Mike Leach , linux-arm-kernel@lists.infradead.org, Linu Cherian , suzuki.poulose@arm.com 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 Fri, Aug 07, 2020 at 10:37:00PM +0530, Linu Cherian wrote: > Hi Mathieu, > > Any comments on this patch ? Let's see... You're poking me to review a patch that doesn't clear checkpatch (with a blatant violation) and that, 6 days after it was sent out? > > > On Sat, Aug 1, 2020 at 2:40 PM Linu Cherian wrote: > > > > Coresight driver assumes sink is common across all the ETMs, > > and tries to build a path between ETM and the first enabled > > sink found using bus based search. This breaks sysFS usage > > on implementations that has multiple per core sinks in > > enabled state. > > > > For this, > > - coresight_find_sink API is updated with an additional flag > > so that it is able to return an enabled sink > > - coresight_get_enabled_sink API is updated to do a > > connection based search, when a source reference is given. > > > > Change-Id: I6cc91ddb3ef8936a8f41a5f7c7c455b0ece9d85d > > Signed-off-by: Linu Cherian > > --- > > Applies on https://git.linaro.org/kernel/coresight.git/log/?h=next > > > > Changes in V2: > > - Fixed few typos in commit message > > - Rephrased commit message > > > > .../hwtracing/coresight/coresight-etm-perf.c | 2 +- > > drivers/hwtracing/coresight/coresight-priv.h | 5 +- > > drivers/hwtracing/coresight/coresight.c | 51 +++++++++++++++++-- > > 3 files changed, 51 insertions(+), 7 deletions(-) > > > > diff --git a/drivers/hwtracing/coresight/coresight-etm-perf.c b/drivers/hwtracing/coresight/coresight-etm-perf.c > > index 1a3169e69bb1..25041d2654e3 100644 > > --- a/drivers/hwtracing/coresight/coresight-etm-perf.c > > +++ b/drivers/hwtracing/coresight/coresight-etm-perf.c > > @@ -223,7 +223,7 @@ static void *etm_setup_aux(struct perf_event *event, void **pages, > > id = (u32)event->attr.config2; > sink = coresight_get_sink_by_id(id); > > } else { > > - sink = coresight_get_enabled_sink(true); > > + sink = coresight_get_enabled_sink(NULL, true); > > } > > > > mask = &event_data->mask; > > diff --git a/drivers/hwtracing/coresight/coresight-priv.h b/drivers/hwtracing/coresight/coresight-priv.h > > index f2dc625ea585..010ed26db340 100644 > > --- a/drivers/hwtracing/coresight/coresight-priv.h > > +++ b/drivers/hwtracing/coresight/coresight-priv.h > > @@ -148,10 +148,13 @@ static inline void coresight_write_reg_pair(void __iomem *addr, u64 val, > > void coresight_disable_path(struct list_head *path); > > int coresight_enable_path(struct list_head *path, u32 mode, void *sink_data); > > struct coresight_device *coresight_get_sink(struct list_head *path); > > -struct coresight_device *coresight_get_enabled_sink(bool reset); > > +struct coresight_device * > > +coresight_get_enabled_sink(struct coresight_device *source, bool reset); > > struct coresight_device *coresight_get_sink_by_id(u32 id); > > struct coresight_device * > > coresight_find_default_sink(struct coresight_device *csdev); > > +struct coresight_device * > > +coresight_find_enabled_sink(struct coresight_device *csdev); > > struct list_head *coresight_build_path(struct coresight_device *csdev, > > struct coresight_device *sink); > > void coresight_release_path(struct list_head *path); > > diff --git a/drivers/hwtracing/coresight/coresight.c b/drivers/hwtracing/coresight/coresight.c > > index e9c90f2de34a..ae69169c58d3 100644 > > --- a/drivers/hwtracing/coresight/coresight.c > > +++ b/drivers/hwtracing/coresight/coresight.c > > @@ -566,6 +566,10 @@ static int coresight_enabled_sink(struct device *dev, const void *data) > > > > /** > > * coresight_get_enabled_sink - returns the first enabled sink found on the bus > > + * When a source reference is given, enabled sink is found using connection based > > + * search. > > + * > > + * @source: Coresight source device reference > > * @deactivate: Whether the 'enable_sink' flag should be reset > > * > > * When operated from perf the deactivate parameter should be set to 'true'. > > @@ -576,10 +580,21 @@ static int coresight_enabled_sink(struct device *dev, const void *data) > > * parameter should be set to 'false', hence mandating users to explicitly > > * clear the flag. > > */ > > -struct coresight_device *coresight_get_enabled_sink(bool deactivate) > > +struct coresight_device * > > +coresight_get_enabled_sink(struct coresight_device *source, bool deactivate) > > { > > struct device *dev = NULL; > > + struct coresight_device *sink; > > + > > + if (!source) > > + goto bus_search; > > + sink = coresight_find_enabled_sink(source); > > + if (sink && deactivate) > > + sink->activated = false; > > + > > + return sink; > > > > +bus_search: > > dev = bus_find_device(&coresight_bustype, NULL, &deactivate, > > coresight_enabled_sink); > > > > @@ -828,6 +843,7 @@ coresight_select_best_sink(struct coresight_device *sink, int *depth, > > * > > * @csdev: source / current device to check. > > * @depth: [in] search depth of calling dev, [out] depth of found sink. > > + * @enabled: flag to search only enabled sinks > > * > > * This will walk the connection path from a source (ETM) till a suitable > > * sink is encountered and return that sink to the original caller. > > @@ -839,7 +855,7 @@ coresight_select_best_sink(struct coresight_device *sink, int *depth, > > * return best sink found, or NULL if not found at this node or child nodes. > > */ > > static struct coresight_device * > > -coresight_find_sink(struct coresight_device *csdev, int *depth) > > +coresight_find_sink(struct coresight_device *csdev, int *depth, bool enabled) > > { > > int i, curr_depth = *depth + 1, found_depth = 0; > > struct coresight_device *found_sink = NULL; > > @@ -862,7 +878,8 @@ coresight_find_sink(struct coresight_device *csdev, int *depth) > > > > child_dev = csdev->pdata->conns[i].child_dev; > > if (child_dev) > > - sink = coresight_find_sink(child_dev, &child_depth); > > + sink = coresight_find_sink(child_dev, &child_depth, > > + enabled); > > > > if (sink) > > found_sink = coresight_select_best_sink(found_sink, > > @@ -872,6 +889,10 @@ coresight_find_sink(struct coresight_device *csdev, int *depth) > > } > > > > return_def_sink: > > + /* Check if we need to return an enabled sink */ > > + if (enabled && found_sink) > > + if (!found_sink->activated) > > + found_sink = NULL; > > /* return found sink and depth */ > > if (found_sink) > > *depth = found_depth; > > @@ -901,10 +922,30 @@ coresight_find_default_sink(struct coresight_device *csdev) > > > > /* look for a default sink if we have not found for this device */ > > if (!csdev->def_sink) > > - csdev->def_sink = coresight_find_sink(csdev, &depth); > > + csdev->def_sink = coresight_find_sink(csdev, &depth, false); > > return csdev->def_sink; > > } > > > > +/** > > + * coresight_find_enabled_sink: Find the suitable enabled sink > > + * > > + * @csdev: starting source to find a connected sink. > > + * > > + * Walks connections graph looking for a suitable sink to enable for the > > + * supplied source. Uses CoreSight device subtypes and distance from source > > + * to select the best sink. > > + * > > + * Used in cases where the CoreSight user (sysfs) has selected a sink. > > + */ > > +struct coresight_device * > > +coresight_find_enabled_sink(struct coresight_device *csdev) > > +{ > > + int depth = 0; > > + > > + /* look for the enabled sink */ > > + return coresight_find_sink(csdev, &depth, true); > > +} > > + > > static int coresight_remove_sink_ref(struct device *dev, void *data) > > { > > struct coresight_device *sink = data; > > @@ -992,7 +1033,7 @@ int coresight_enable(struct coresight_device *csdev) > > * Search for a valid sink for this session but don't reset the > > * "enable_sink" flag in sysFS. Users get to do that explicitly. > > */ > > - sink = coresight_get_enabled_sink(false); > > + sink = coresight_get_enabled_sink(csdev, false); > > if (!sink) { > > ret = -EINVAL; > > goto out; > > -- > > 2.25.1 > > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel