Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp3465471pxx; Mon, 2 Nov 2020 09:33:28 -0800 (PST) X-Google-Smtp-Source: ABdhPJzbUPGnI2mhNqjhEGQXYp7adjTq3h6EvKln0KdltzeAGxIIu6OzIjMZGWW9E3ZmION9nNTc X-Received: by 2002:a17:906:3617:: with SMTP id q23mr16008827ejb.371.1604338408162; Mon, 02 Nov 2020 09:33:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604338408; cv=none; d=google.com; s=arc-20160816; b=CW/qyyEFUWwH6jS4jDpYbx2Y9UxEPCTWlXlWZsUFSP21iP3tILP1JGomeqieJuG0CW 8l8ub5U/uMzCfyN9vProDKhv0tmOuiK7/zn2PWx43rL6DaikXnKfAhuqnKYXTnD7I0wD tC+LUkLnm6gESWpiWDZm4Iro+P5tkbuOzl9KHAMB21G34Sr4lb3xGA25xzbJuvLyuaFg sJNnKzneYnJ/3t7b3Qi2M4J6mOSegn1OYvZlFgJgftfl4h6P55wxmMsqcX+Ng6lD1XAR 5f8+xqHX5Aesv/yQenDnfkh8FcvIfZ9o8I94+V5T9p/12DnWU8jUTA5dfCIRBM701Von wdvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=p/DEdqfzjHqREFiiQ64DzLAqMoklspJdVfF8M1QhzKo=; b=FGSkWzyJ3HAlSs5ptN6PQmvVBZoEtWHaiwWt25Qjc5nNPPvJjiorOpsGVpw7nhnyPo Ka0xN+wp86rOiMgv2AsSAPmqIMWC/JQUigJfILR4vFtuxpMdxjUdRMIgoWGe918DbAbb IT9jxu+UoalSEr8O6nBwmTosy9fJMZJHp64Q1MuhAmQB8N/hoJYduKrFTfQnx8VFn6aY zFce4rYsmIpu7IDEDJgigCIrqysAV6mjj6iMG0cTHhButD8HuLdf1lujoeAY8PbfYe6b OfBQH7AmH3uTNApaoIYeWntsg/TAaRqMVLEsbupE42td+bGktrZzeM18xsX4nN2/1UZP uoGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IlK8VBmv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z8si11765133edp.59.2020.11.02.09.33.04; Mon, 02 Nov 2020 09:33:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IlK8VBmv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727288AbgKBR3f (ORCPT + 99 others); Mon, 2 Nov 2020 12:29:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727221AbgKBR3f (ORCPT ); Mon, 2 Nov 2020 12:29:35 -0500 Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58D41C0617A6 for ; Mon, 2 Nov 2020 09:29:35 -0800 (PST) Received: by mail-pf1-x444.google.com with SMTP id 72so4998161pfv.7 for ; Mon, 02 Nov 2020 09:29:35 -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=p/DEdqfzjHqREFiiQ64DzLAqMoklspJdVfF8M1QhzKo=; b=IlK8VBmv+2S4zFzKyOyhA5i2aI+QNJOQiCtjAsPuDj0QKs+j/LCVO+nUPRyqryqFFB 6zvVk9hjXuOWgnyNlZEHbdKQcNnoW4WKNdocORFPgcUNSU8n0BH9Kdn7j3IRrGrBo4IM Xa8h1LFCHeiovv41XVGiHSRZL9yNkA0OVcys5Fz3396NLUTgMeejL+9/DoKi/7j9Sn47 w6lBu7XMlIatXT8139sFwH3yLJ9pCSPvIqn7YnzuXPezAh5x40vm1HB310nhZu/7VqLW QN/fwVqwiyfiSENWEgFaWXOPUKty5KVis5vhxeV2l7AdkcGNTp4IPovC4+L6ahyAnYHE 4dLQ== 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=p/DEdqfzjHqREFiiQ64DzLAqMoklspJdVfF8M1QhzKo=; b=RrzCN09lmWPsGptvqUh3NjY7gG7JvPEMLbud5i1ANVOxFmeS/wEMdEVSpsTAjmlhQb h/rrB3ZK+My+lU2w10Zxg7I5xwIn/kAxvSz5vCSSq3Oy1rCsT9GeTk3A+TzD/+ICePZ4 jwWOnXXB4RgHwHZLH/MpNWAY/e1OsbnM/aX7PD700DK2ZU5op8obkaq8jWt/Iah/y4nl MnSUsdGF27ajl4qBbgZy6C+rLkQcy8Gf+82v79Roq8esWHreVCwrvZ+4LAx/WwsxffBL DdrEpi54BVki2cw9HqIcAsHu2TLB6bMxnKPfsGfmn/3AVM/jyL79mCRjVdJUh3RjxKS0 Pwnw== X-Gm-Message-State: AOAM532cC4IKV4SzLwkRVpA6YmiAgpp2tfJyHc1bSkHDwlO+UchXGDiX 0DOOlDbjfxSL1spYsXeIrjYpCw== X-Received: by 2002:a65:4b84:: with SMTP id t4mr13900931pgq.138.1604338174656; Mon, 02 Nov 2020 09:29:34 -0800 (PST) Received: from xps15 (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id u14sm2904349pfc.87.2020.11.02.09.29.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Nov 2020 09:29:33 -0800 (PST) Date: Mon, 2 Nov 2020 10:29:31 -0700 From: Mathieu Poirier To: Linu Cherian Cc: Sasha Levin , linux-kernel@vger.kernel.org, stable@vger.kernel.org, Greg Kroah-Hartman , Coresight ML , linux-arm-kernel , Linu Cherian Subject: Re: [PATCH AUTOSEL 5.9 075/147] coresight: Make sysfs functional on topologies with per core sink Message-ID: <20201102172931.GC2749502@xps15> References: <20201026234905.1022767-1-sashal@kernel.org> <20201026234905.1022767-75-sashal@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 02, 2020 at 12:29:34PM +0530, Linu Cherian wrote: > Hi, > > Upstream commit, > > commit bb1860efc817c18fce4112f25f51043e44346d1b > Author: Linu Cherian > Date: Wed Sep 16 13:17:34 2020 -0600 > > > > > coresight: etm: perf: Sink selection using sysfs is deprecated > > > need to go along with this, else there will be build breakage. > This applies for 5.4, 5.8 and 5.9 > > Mathieu, could you please ACK ? Top posting makes it very difficult to follow what is going on. Based on your above comment Sasha has probably dropped this patch. The best way to proceed is likely to send a patchset to stable with all the required patches. Thanks, Mathieu > > Please let me know if i need to send the patch to > stable@vger.kernel.org separately. > Thanks. > > > > > On Tue, Oct 27, 2020 at 5:20 AM Sasha Levin wrote: > > > > From: Linu Cherian > > > > [ Upstream commit 6d578258b955fc8888e1bbd9a8fefe7b10065a84 ] > > > > 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. > > > > To fix this, coresight_get_enabled_sink API is updated to > > do a connection based search starting from the given source, > > instead of bus based search. > > With sink selection using sysfs depecrated for perf interface, > > provision for reset is removed as well in this API. > > > > Signed-off-by: Linu Cherian > > [Fixed indentation problem and removed obsolete comment] > > Signed-off-by: Mathieu Poirier > > Link: https://lore.kernel.org/r/20200916191737.4001561-15-mathieu.poirier@linaro.org > > Signed-off-by: Greg Kroah-Hartman > > Signed-off-by: Sasha Levin > > --- > > drivers/hwtracing/coresight/coresight-priv.h | 3 +- > > drivers/hwtracing/coresight/coresight.c | 62 +++++++++----------- > > 2 files changed, 29 insertions(+), 36 deletions(-) > > > > diff --git a/drivers/hwtracing/coresight/coresight-priv.h b/drivers/hwtracing/coresight/coresight-priv.h > > index f2dc625ea5856..5fe773c4d6cc5 100644 > > --- a/drivers/hwtracing/coresight/coresight-priv.h > > +++ b/drivers/hwtracing/coresight/coresight-priv.h > > @@ -148,7 +148,8 @@ 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); > > struct coresight_device *coresight_get_sink_by_id(u32 id); > > struct coresight_device * > > coresight_find_default_sink(struct coresight_device *csdev); > > diff --git a/drivers/hwtracing/coresight/coresight.c b/drivers/hwtracing/coresight/coresight.c > > index e9c90f2de34ac..bb4f9e0a5438d 100644 > > --- a/drivers/hwtracing/coresight/coresight.c > > +++ b/drivers/hwtracing/coresight/coresight.c > > @@ -540,50 +540,46 @@ struct coresight_device *coresight_get_sink(struct list_head *path) > > return csdev; > > } > > > > -static int coresight_enabled_sink(struct device *dev, const void *data) > > +static struct coresight_device * > > +coresight_find_enabled_sink(struct coresight_device *csdev) > > { > > - const bool *reset = data; > > - struct coresight_device *csdev = to_coresight_device(dev); > > + int i; > > + struct coresight_device *sink; > > > > if ((csdev->type == CORESIGHT_DEV_TYPE_SINK || > > csdev->type == CORESIGHT_DEV_TYPE_LINKSINK) && > > - csdev->activated) { > > - /* > > - * Now that we have a handle on the sink for this session, > > - * disable the sysFS "enable_sink" flag so that possible > > - * concurrent perf session that wish to use another sink don't > > - * trip on it. Doing so has no ramification for the current > > - * session. > > - */ > > - if (*reset) > > - csdev->activated = false; > > + csdev->activated) > > + return csdev; > > > > - return 1; > > + /* > > + * Recursively explore each port found on this element. > > + */ > > + for (i = 0; i < csdev->pdata->nr_outport; i++) { > > + struct coresight_device *child_dev; > > + > > + child_dev = csdev->pdata->conns[i].child_dev; > > + if (child_dev) > > + sink = coresight_find_enabled_sink(child_dev); > > + if (sink) > > + return sink; > > } > > > > - return 0; > > + return NULL; > > } > > > > /** > > - * coresight_get_enabled_sink - returns the first enabled sink found on the bus > > - * @deactivate: Whether the 'enable_sink' flag should be reset > > - * > > - * When operated from perf the deactivate parameter should be set to 'true'. > > - * That way the "enabled_sink" flag of the sink that was selected can be reset, > > - * allowing for other concurrent perf sessions to choose a different sink. > > + * coresight_get_enabled_sink - returns the first enabled sink using > > + * connection based search starting from the source reference > > * > > - * When operated from sysFS users have full control and as such the deactivate > > - * parameter should be set to 'false', hence mandating users to explicitly > > - * clear the flag. > > + * @source: Coresight source device reference > > */ > > -struct coresight_device *coresight_get_enabled_sink(bool deactivate) > > +struct coresight_device * > > +coresight_get_enabled_sink(struct coresight_device *source) > > { > > - struct device *dev = NULL; > > - > > - dev = bus_find_device(&coresight_bustype, NULL, &deactivate, > > - coresight_enabled_sink); > > + if (!source) > > + return NULL; > > > > - return dev ? to_coresight_device(dev) : NULL; > > + return coresight_find_enabled_sink(source); > > } > > > > static int coresight_sink_by_id(struct device *dev, const void *data) > > @@ -988,11 +984,7 @@ int coresight_enable(struct coresight_device *csdev) > > goto out; > > } > > > > - /* > > - * 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); > > if (!sink) { > > ret = -EINVAL; > > goto out; > > -- > > 2.25.1 > > > > _______________________________________________ > > CoreSight mailing list > > CoreSight@lists.linaro.org > > https://lists.linaro.org/mailman/listinfo/coresight