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,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 AAE3AC433E0 for ; Thu, 4 Feb 2021 18:36:13 +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 52F5C64E06 for ; Thu, 4 Feb 2021 18:36:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 52F5C64E06 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=++0o8JATTx5LMzklDC6r+4pFkLfkAtm9WvuEQsT+LWU=; b=0VGOXznnywP80gg8hklV/vsr7 4xpSqLmH+tGBvpNjWZ/L0n4eucnSQhFCtyJkUWiebSLhYhheUzM2WGlPJn1ceRSUZqUq2NUsq2K2k tCq6DALhLBALw3R1NQhPeqPYX6M4LmqmHwLTxW7uXc4KwZCKf25QzQ9fUnDClhq0Q6zZUleVygsUb oGEdDj3ouyBwemducq2j7reRJqd0Fhp5+ylO8McMMxa5D/xNg5P3S3RXORHC9wXSWX3xwTeQAWz2k kgizcbQAXzMOmUXuxuYdBNzuKBFnThmtmx2VYJ+YbEwQJlnfruNhhsksYvHKJfYkLgYE43D6+Y47K sa1NhPnlw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l7jT1-0002hs-Uo; Thu, 04 Feb 2021 18:35:00 +0000 Received: from mail-pg1-x52a.google.com ([2607:f8b0:4864:20::52a]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l7jSw-0002eg-G4 for linux-arm-kernel@lists.infradead.org; Thu, 04 Feb 2021 18:34:57 +0000 Received: by mail-pg1-x52a.google.com with SMTP id b21so2715181pgk.7 for ; Thu, 04 Feb 2021 10:34:51 -0800 (PST) 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=3jvWmvModvzyLGbAMS7t2Ta/bGILZpVvmoEExacVaBo=; b=CqWkbkGkrZPiSd1/iVIeW/kBX8DyUtDrbLNu33v9s/iDYIRNZW+mJbsKT17FySRRgb hidpgGfanF689vY0kK7BljaSxeGOTksGg6jf04dJiAq99sWHB6ThTHfmWh9XBSCNjl69 OkN8z6cQOItEyuufyCFS4jz2Zw0Y3T60bQG1zIpdEdfAkYG+HJepg4bVKjSebLXm2lJa D3hg0YhCVdSgmDVVBmJtTMKExadjojKOsg0d2DjAyOoZKNiHpB/If67NKlB5woqsvrdj RYi4Vrqr0933/nBrBA8DVIRPcr8FAiScSyVYtZE1dqRq87O/93WGtUd8QEdKXEuboZsO 254Q== 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=3jvWmvModvzyLGbAMS7t2Ta/bGILZpVvmoEExacVaBo=; b=XugrX++vImG6A88dcQSI6KGOdzhC/J7ZdE6Cq4BTihUWCYF36wHzOvaKamON5FDkuS UKuu3AZTBVLZrG5Pqvex5bPyDzQFsTHe82ogRRRQZ7U7VO0inhIlt5znnBBqr2zw0AhR 2Q5BwOfH6wOzmKxS1+BTu3SoFZiRDGyC7Y3OsNQ5cLd+m4l0a0gS5O26969QaA0C/SPt oGoHYdE5SKQ2AOVLcPh8EAAQ8VwCIys90XLr9/jYPfZPCuDXoglOD3AIdCWgLpNYsZFF uIFj3mYyk/T9cTGQvzFj8gsc2/4Iq6K7kyMBle7Cnpwxjg8wd9KO/hFG9NTqImvc9Kr0 DOeg== X-Gm-Message-State: AOAM532XTa8UHGQWLv4H6K3KCX6tau61q/QtZIHTpkb/7ldXFRUSgS+t FH7YiTZBlILtYA4zTuSo4BzuBADfwGihFQ== X-Google-Smtp-Source: ABdhPJybVocQ63GzS49aUnVobaViLya0eEEs9a7Rm+Ct9hr+VYtUZX3IAqN/Jma7bF6zGBCw0zhfYQ== X-Received: by 2002:aa7:808b:0:b029:1ce:8a32:f5e8 with SMTP id v11-20020aa7808b0000b02901ce8a32f5e8mr770113pff.34.1612463690270; Thu, 04 Feb 2021 10:34:50 -0800 (PST) Received: from xps15 (S0106889e681aac74.cg.shawcable.net. [68.147.0.187]) by smtp.gmail.com with ESMTPSA id 17sm7064053pgy.53.2021.02.04.10.34.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Feb 2021 10:34:48 -0800 (PST) Date: Thu, 4 Feb 2021 11:34:46 -0700 From: Mathieu Poirier To: Suzuki K Poulose Subject: Re: [PATCH V3 08/14] coresight: core: Add support for dedicated percpu sinks Message-ID: <20210204183446.GA1636242@xps15> References: <1611737738-1493-1-git-send-email-anshuman.khandual@arm.com> <1611737738-1493-9-git-send-email-anshuman.khandual@arm.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-20210204_133454_868725_73087937 X-CRM114-Status: GOOD ( 36.39 ) 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: Anshuman Khandual , coresight@lists.linaro.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, lcherian@marvell.com, mike.leach@linaro.org 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 Thu, Jan 28, 2021 at 09:16:34AM +0000, Suzuki K Poulose wrote: > On 1/27/21 8:55 AM, Anshuman Khandual wrote: > > Add support for dedicated sinks that are bound to individual CPUs. (e.g, > > TRBE). To allow quicker access to the sink for a given CPU bound source, > > keep a percpu array of the sink devices. Also, add support for building > > a path to the CPU local sink from the ETM. > > > > This adds a new percpu sink type CORESIGHT_DEV_SUBTYPE_SINK_PERCPU_SYSMEM. > > This new sink type is exclusively available and can only work with percpu > > source type device CORESIGHT_DEV_SUBTYPE_SOURCE_PERCPU_PROC. > > > > This defines a percpu structure that accommodates a single coresight_device > > which can be used to store an initialized instance from a sink driver. As > > these sinks are exclusively linked and dependent on corresponding percpu > > sources devices, they should also be the default sink device during a perf > > session. > > > > Outwards device connections are scanned while establishing paths between a > > source and a sink device. But such connections are not present for certain > > percpu source and sink devices which are exclusively linked and dependent. > > Build the path directly and skip connection scanning for such devices. > > > > Cc: Mathieu Poirier > > Cc: Mike Leach > > Cc: Suzuki K Poulose > > Signed-off-by: Anshuman Khandual > > --- > > Changes in V3: > > > > - Updated coresight_find_default_sink() > > > > drivers/hwtracing/coresight/coresight-core.c | 16 ++++++++++++++-- > > include/linux/coresight.h | 12 ++++++++++++ > > 2 files changed, 26 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/hwtracing/coresight/coresight-core.c b/drivers/hwtracing/coresight/coresight-core.c > > index 0062c89..4795e28 100644 > > --- a/drivers/hwtracing/coresight/coresight-core.c > > +++ b/drivers/hwtracing/coresight/coresight-core.c > > @@ -23,6 +23,7 @@ > > #include "coresight-priv.h" > > static DEFINE_MUTEX(coresight_mutex); > > +DEFINE_PER_CPU(struct coresight_device *, csdev_sink); > > /** > > * struct coresight_node - elements of a path, from source to sink > > @@ -784,6 +785,13 @@ static int _coresight_build_path(struct coresight_device *csdev, > > if (csdev == sink) > > goto out; > > + if (coresight_is_percpu_source(csdev) && coresight_is_percpu_sink(sink) && > > + sink == per_cpu(csdev_sink, source_ops(csdev)->cpu_id(csdev))) { > > + _coresight_build_path(sink, sink, path); The return value for _coresight_build_path() needs to be checked. Otherwise a failure to allocate a node for the sink will go unoticed and make for a very hard problem to debug. > > + found = true; > > + goto out; > > + } > > + > > /* Not a sink - recursively explore each port found on this element */ > > for (i = 0; i < csdev->pdata->nr_outport; i++) { > > struct coresight_device *child_dev; > > @@ -999,8 +1007,12 @@ coresight_find_default_sink(struct coresight_device *csdev) > > int depth = 0; > > /* 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); > > + if (!csdev->def_sink) { > > + if (coresight_is_percpu_source(csdev)) > > + csdev->def_sink = per_cpu(csdev_sink, source_ops(csdev)->cpu_id(csdev)); > > + if (!csdev->def_sink) > > + csdev->def_sink = coresight_find_sink(csdev, &depth); > > + } > > return csdev->def_sink; > > } > > diff --git a/include/linux/coresight.h b/include/linux/coresight.h > > index 976ec26..bc3a5ca 100644 > > --- a/include/linux/coresight.h > > +++ b/include/linux/coresight.h > > @@ -50,6 +50,7 @@ enum coresight_dev_subtype_sink { > > CORESIGHT_DEV_SUBTYPE_SINK_PORT, > > CORESIGHT_DEV_SUBTYPE_SINK_BUFFER, > > CORESIGHT_DEV_SUBTYPE_SINK_SYSMEM, > > + CORESIGHT_DEV_SUBTYPE_SINK_PERCPU_SYSMEM, Do we absolutely need to add a new sink type? It is only used in _coresight_build_path() and that code could be: if (coresight_is_percpu_source(csdev)) { sink == per_cpu(csdev_sink, source_ops(csdev)->cpu_id(csdev)); if (sink && sink == csdev) { _coresight_build_path(sink, sink, path); > > }; > > enum coresight_dev_subtype_link { > > @@ -428,6 +429,17 @@ static inline void csdev_access_write64(struct csdev_access *csa, u64 val, u32 o > > csa->write(val, offset, false, true); > > } > > +static inline bool coresight_is_percpu_source(struct coresight_device *csdev) > > +{ > > + return csdev && (csdev->type == CORESIGHT_DEV_TYPE_SOURCE) && > > + csdev->subtype.source_subtype == CORESIGHT_DEV_SUBTYPE_SOURCE_PROC; > > Please add () around the last line. Same below. > > > +} > > + > > +static inline bool coresight_is_percpu_sink(struct coresight_device *csdev) > > +{ > > + return csdev && (csdev->type == CORESIGHT_DEV_TYPE_SINK) && > > + csdev->subtype.sink_subtype == CORESIGHT_DEV_SUBTYPE_SINK_PERCPU_SYSMEM; > > +} > > #else /* !CONFIG_64BIT */ > > static inline u64 csdev_access_relaxed_read64(struct csdev_access *csa, > > > > With the above : > > Tested-by: Suzuki K Poulose > Reviewed-by: Suzuki K Poulose _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel