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=-8.0 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no 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 4CAE1C433E1 for ; Sat, 22 Aug 2020 13:19:54 +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 1643020720 for ; Sat, 22 Aug 2020 13:19:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="f4cL5Pfk"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="EYGmCoSZ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1643020720 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com 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=q02Nh/ZutTzFg1LbSgIDA1FoXVkzGjdHrVTLCuC8Btg=; b=f4cL5PfkT1dTJUjr5GmsF8VZm uhI9sAzwHr2MAkYiRbVO6oJonZejGET8FFaFSqprCF6oEDeBDZrrKmt0vXO/ux9S3Ea6MCXEiRXrO I7ZIlyJTIGeH6/vCs9jaKYNxC28OVYy8Lur+NXxBCeHFQeAc+zvkgKiXqNfGgkZ4LO1rGy6eOm4FC mTBPabSGYUHiCAKHORyS5lPBC3m6BMXI/7mztMBK7E+9z30ndFA9kD4xk/lIVkPcwqWbe9ZjRsCCD JNJ8K0vLv3QYubcOhB7AXagXw8kIM26U/tEVW4G+o6sgxR8uemyclQdufwR2PuMEV5Rv9/OB7NYk7 uSHipnvTw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k9TPx-0000op-D1; Sat, 22 Aug 2020 13:18:45 +0000 Received: from mail-pl1-x642.google.com ([2607:f8b0:4864:20::642]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k9TPu-0000oD-2d for linux-arm-kernel@lists.infradead.org; Sat, 22 Aug 2020 13:18:43 +0000 Received: by mail-pl1-x642.google.com with SMTP id bh1so2100725plb.12 for ; Sat, 22 Aug 2020 06:18:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=8KQSfAGJ2lqEtzd3NqVma3UDNPHQ32ZBvoN8f2R0RxQ=; b=EYGmCoSZk55FoXsN9BHw9FE0v9mBs5iHmGUuKZYPL1bE7Jyj0Y4/uuBdLfV0002Owb ZeORk/Wri/gtBC2bpSDy0LzkOFH/6szVVF7+10EJEuGRfxYKwz2uXMJqzJXgLN18tIo+ HWgyqOILrBWwUUux6Jk12s6+oI2QwqP+bjFyLYs0Oz75eeSUNTo6Z2IE3feFnYTQzWDY uZlN/qT5zrZjr3YgGWoucMRDfzoxTBNXauLG9N4n/7lMawHJBwacnOWu5X9qa99EHcwE i1dik1Sfd2NiMDZ8khnhiSaFvoJKwpNS09CfyD8841xdCtnUv4X6feECggPpDNL9iG2V 1s+g== 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:user-agent; bh=8KQSfAGJ2lqEtzd3NqVma3UDNPHQ32ZBvoN8f2R0RxQ=; b=Nivz9WP4qR0aYY8grVmBdAXwI9J67FtUadNvonWZCthMrEe/o0eUQC/+VSW8zfPGnh rOW7kfSbDVTv9WQgtcRPy5pMs6XR1mx7zOcOUdzFlg+WF6Kc++hDSErT3q+dfknpS7+w XmOYHwshQ2nYfn3bobXqfzhSxYq4H1AImHJaVrTJFP+jcHojviLDMkAm3LLyyL2zfSd5 moiml9/tJXN5MjeYQLsIdDPo6ixs8bZTjdZOwxVIl3k9I4BUDkgOOgRc7mFA7zWA8Ynt 97t137FYm3Emkx6MB04rbDu8olW35dXwoVvfb6IYPGHVYfTHubOCDg8vh+WOT6rjebZ/ YkIA== X-Gm-Message-State: AOAM533U+OfgvEVg4RsKhCLbZTXbYGMRAO6eL3Fi5SpVJh2PWDNlHlJS IQyur59kWhF133ScLe39GM0= X-Google-Smtp-Source: ABdhPJyBOWGRsjtZ9p+BN3YK4XafRZkp6wnR2ux7nDFlNALrmdJGAGkZ7gnnfXEqtD44+OTPSIQr9w== X-Received: by 2002:a17:90a:d597:: with SMTP id v23mr5961628pju.24.1598102318750; Sat, 22 Aug 2020 06:18:38 -0700 (PDT) Received: from BG-LT6221.marvell.com ([122.172.254.64]) by smtp.gmail.com with ESMTPSA id g129sm5642142pfb.33.2020.08.22.06.18.35 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 22 Aug 2020 06:18:38 -0700 (PDT) Date: Sat, 22 Aug 2020 18:48:28 +0530 From: Linu Cherian To: Mathieu Poirier Subject: Re: [PATCH V3] coresight: Make sysFS functional on topologies with per core sink Message-ID: <20200822131828.GA77@BG-LT6221.marvell.com> References: <20200811022842.20129-1-lcherian@marvell.com> <20200820170259.GA3933623@xps15> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200820170259.GA3933623@xps15> User-Agent: Mutt/1.5.24 (2015-08-30) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200822_091842_164179_E803F8C3 X-CRM114-Status: GOOD ( 28.69 ) 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@linaro.org, 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 Hi Mathieu, > > 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); > > It is time for this subsystem to move out of the prehistoric age. Please remove > the call to coresight_get_enabled_sink() entirely. In the change log you can > write that selecting a sink from sysfs is deprecated when using the perf > interface. I will personally refactor the code if someone complains that it > broke their user space. Okay fine. > > > } > > > > 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) > > This code was written during a time when all sources were able to reach a sink, > something that is no longer the case. Starting from a source is the right way > to go. > > > { > > struct device *dev = NULL; > > + struct coresight_device *sink; > > + > > + if (!source) > > + goto bus_search; > > Return NULL if a source was not given. Agree, since we are removing invocations from perf. > > > + sink = coresight_find_enabled_sink(source); > > + if (sink && deactivate) > > + sink->activated = false; > > + > > + return sink; > > You get credits for trying to re-use code but in this case I would like to avoid > modifying coresight_find_sink() to keep it as simple as possible. I suggest to > copy the for() loop in coresight_find_sink() and stop the search when the first > activated sink is found. It will introduce a little bit of code duplication but > I think we will gain a lot in maintainability. Fine. > > > > > +bus_search: > > dev = bus_find_device(&coresight_bustype, NULL, &deactivate, > > coresight_enabled_sink); > > Get rid of this. You can also get rid of the 'deactivate' parameter since it > won't be used anymore. Agree, since perf doesnt require this anymore. > > Let me know if you have questions. Sure. Thanks. -- Linu cherian _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel