Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp942500imm; Wed, 6 Jun 2018 08:09:38 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJxjQ/YTuJZ3BaZb17lop/G+avQWxW2oF7SESiSGEZA6pEOLy09hKWdsc0GQx54HC8X0exA X-Received: by 2002:a62:6e01:: with SMTP id j1-v6mr2830002pfc.93.1528297778383; Wed, 06 Jun 2018 08:09:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528297778; cv=none; d=google.com; s=arc-20160816; b=mLFlOxZM/GOBiow6KYeEVYLph2uTPF4St32LLLgoj35CVQXS8FC0EOgSOrr5WIUbFw QlE13jUAgSy/nNIKxwKt2GUZY3MZXf6ch2wYRQ/OrgDQOv+g0U5IigKzbJGukgYt+RuP WYYtR+NMvStJqDWHJKA1Z/Ebs3qLyIPmyK6wU9LfWg3D5CtWOXlzvxQb1A/of5kf26vX JkmDDX+exVs9gwHbKIYLqptrO51UofMkJXvasy18GcQZSR6w92E4GazUd6L3r5NTe4Vq AhZMyC4piAo29BgggDLpUEXCSWIvwtdsRuTIlvL/2c4cB8jiLSRTfuTFkUAKs42E4BTR ttqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:date:message-id:autocrypt :openpgp:references:cc:to:subject:from:dkim-signature :arc-authentication-results; bh=eCr8ArSitLCDLQyfkN3knCU8fJIiV4gsfEFepCD5ahQ=; b=YQohlpXiiXC2kOhHJ4WvXS4il/y8LC3lFkbO1ucDnrncOIEUepChG9DjOjn5fuvEMB ip8aqS2mgH0Zgxm1dSZm9yc9Pr9/+zRL1kK5+1okaycFrgsQiDkk8wseQVBl5B3luOTE YSPCjcB0o6jfH7sYZoDNg13HWbUhr40p/+Bg2Uu6S3dyPgmd0Fg4SMXMRi9TgEgjkNH+ e/2STpuD4QLccQVZGrmuprcmLR+baq+nNQSUvgYSSdJRx2I4FkrNV//xBMrA4OduoE40 uHb93zCkClaBFWqY8VZEdhqBwQxy8gKY0tsYt6gZCX3To1PwkUEALHVhlkfFlKDbvUqF lMyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PeTMhAsG; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id u3-v6si52739598plb.2.2018.06.06.08.09.23; Wed, 06 Jun 2018 08:09:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PeTMhAsG; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1752366AbeFFPIZ (ORCPT + 99 others); Wed, 6 Jun 2018 11:08:25 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:51785 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752006AbeFFPIV (ORCPT ); Wed, 6 Jun 2018 11:08:21 -0400 Received: by mail-wm0-f66.google.com with SMTP id r15-v6so12168309wmc.1 for ; Wed, 06 Jun 2018 08:08:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:subject:to:cc:references:openpgp:autocrypt:message-id:date :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=eCr8ArSitLCDLQyfkN3knCU8fJIiV4gsfEFepCD5ahQ=; b=PeTMhAsGGiuHPZH6tGgBP0iPYFMrB2JGUUkT+5PLkwzHb9CkQixxsWFDXzLxlk7Lf5 I6XgZpWlbZ8S3aQDAa01hLCbB9MFxUtvjMUS5derhhrhZlfevMuM30a3E33/uyp4+b95 1SYkMNcOEBGMuBea7WtjhtsJnDfE4XeK5+soY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:subject:to:cc:references:openpgp:autocrypt :message-id:date:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=eCr8ArSitLCDLQyfkN3knCU8fJIiV4gsfEFepCD5ahQ=; b=fKhIoFnzSyFcLwev7tQxILPXweHjv0hGddC1bEKd1pbqijcv3vUtBu+6ImwrvmFz8n 5GDz1+zmxY0z5m3NLupot0PqMd5/qMr+yqM640ohnSOEKw77wN1h0CWeWSAMUK+rbeMh UUKy9xhJxa73vegK55gCcMRzOrzMlvoeyNXaSyRIEHpK7tqmV9cj86hgJtCed7S5oNxt RqJJpdhPZkvFa1ry+Pd6HZU0Nw2xH3Nje8IKjXBOWUVnQvz1hQQa8IUHVg8xrA1ni2GI 6RuYvoYSz6ZlV5n4LbaWq2fmJbFEDxK6s5eEy1a/p0ywGg8kmDyyv+q3ObcGILf9+FeK NRaA== X-Gm-Message-State: APt69E2FYtG4UfJemQcLoPJWCm5NkdmLcwFRH/c2uQxKuX6U+dqpl6ha G6amxOPVU2Jn41kH5JtuKJ5VeQ== X-Received: by 2002:a1c:e306:: with SMTP id a6-v6mr1913453wmh.15.1528297700460; Wed, 06 Jun 2018 08:08:20 -0700 (PDT) Received: from [10.44.66.8] ([212.45.67.2]) by smtp.googlemail.com with ESMTPSA id n18-v6sm32725040wrj.58.2018.06.06.08.08.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 06 Jun 2018 08:08:19 -0700 (PDT) From: Georgi Djakov Subject: Re: [PATCH v4 1/7] interconnect: Add generic on-chip interconnect API To: Amit Kucheria Cc: Linux PM list , gregkh@linuxfoundation.org, Mark Rutland , Lorenzo Pieralisi , Saravana Kannan , seansw@qti.qualcomm.com, khilman@baylibre.com, Michael Turquette , "Rafael J. Wysocki" , LKML , Bjorn Andersson , Rob Herring , linux-arm-msm@vger.kernel.org, davidai@quicinc.com, Vincent Guittot , lakml References: <20180309210958.16672-1-georgi.djakov@linaro.org> <20180309210958.16672-2-georgi.djakov@linaro.org> Openpgp: preference=signencrypt Autocrypt: addr=georgi.djakov@linaro.org; prefer-encrypt=mutual; keydata= xsFNBFjTuRcBEACyAOVzghvyN19Sa/Nit4LPBWkICi5W20p6bwiZvdjhtuh50H5q4ktyxJtp 1+s8dMSa/j58hAWhrc2SNL3fttOCo+MM1bQWwe8uMBQJP4swgXf5ZUYkSssQlXxGKqBSbWLB uFHOOBTzaQBaNgsdXo+mQ1h8UCgM0zQOmbs2ort8aHnH2i65oLs5/Xgv/Qivde/FcFtvEFaL 0TZ7odM67u+M32VetH5nBVPESmnEDjRBPw/DOPhFBPXtal53ZFiiRr6Bm1qKVu3dOEYXHHDt nF13gB+vBZ6x5pjl02NUEucSHQiuCc2Aaavo6xnuBc3lnd4z/xk6GLBqFP3P/eJ56eJv4d0B 0LLgQ7c1T3fU4/5NDRRCnyk6HJ5+HSxD4KVuluj0jnXW4CKzFkKaTxOp7jE6ZD/9Sh74DM8v etN8uwDjtYsM07I3Szlh/I+iThxe/4zVtUQsvgXjwuoOOBWWc4m4KKg+W4zm8bSCqrd1DUgL f67WiEZgvN7tPXEzi84zT1PiUOM98dOnmREIamSpKOKFereIrKX2IcnZn8jyycE12zMkk+Sc ASMfXhfywB0tXRNmzsywdxQFcJ6jblPNxscnGMh2VlY2rezmqJdcK4G4Lprkc0jOHotV/6oJ mj9h95Ouvbq5TDHx+ERn8uytPygDBR67kNHs18LkvrEex/Z1cQARAQABzShHZW9yZ2kgRGph a292IDxnZW9yZ2kuZGpha292QG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p8A39+ E9xw890l1xdERkjVKX6IEJu2hf7X3MMl9tOjBK6MvdOUxvh1bNNmXh7OlBL1MpJYY/ydIm3B KEmKjLDvB0pePJkdTw== Message-ID: <3f0e5606-c28d-6bd9-387e-23be1d0185fc@linaro.org> Date: Wed, 6 Jun 2018 18:08:19 +0300 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Amit, On 25.05.18 г. 11:26, Amit Kucheria wrote: > On Fri, Mar 9, 2018 at 11:09 PM, Georgi Djakov wrote: >> This patch introduce a new API to get requirements and configure the >> interconnect buses across the entire chipset to fit with the current >> demand. >> >> The API is using a consumer/provider-based model, where the providers are >> the interconnect buses and the consumers could be various drivers. >> The consumers request interconnect resources (path) between endpoints and >> set the desired constraints on this data flow path. The providers receive >> requests from consumers and aggregate these requests for all master-slave >> pairs on that path. Then the providers configure each participating in the >> topology node according to the requested data flow path, physical links and >> constraints. The topology could be complicated and multi-tiered and is SoC >> specific. >> >> Signed-off-by: Georgi Djakov >> --- [..] >> +Interconnect consumers >> +---------------------- >> + >> +Interconnect consumers are the clients which use the interconnect APIs to >> +get paths between endpoints and set their bandwidth/latency/QoS requirements >> +for these interconnect paths. >> + > > This document is missing a section on the locking semantics of the > framework. Does the core ensure that the entire path is locked for > set() to propagate? Yes, the core will ensure that the path is locked. Will add this to the function description. [..] >> + >> +static int path_init(struct icc_path *path) >> +{ >> + struct icc_node *node; >> + size_t i; >> + >> + for (i = 0; i < path->num_nodes; i++) { >> + node = path->reqs[i].node; >> + >> + mutex_lock(&node->provider->lock); >> + node->provider->users++; >> + mutex_unlock(&node->provider->lock); >> + } >> + >> + return 0; >> +} >> + > > Consider adding some comments for node_aggregate and > provider_aggregate's aggregation algorithm > > "We want the path to honor all bandwidth requests, so the average > bandwidth requirements from each consumer are aggregated at each node > and provider level. The peak bandwidth requirements will then be the > highest of all the peak bw requests" > > or something to the effect that. Ok, thanks. >> +static void node_aggregate(struct icc_node *node) >> +{ >> + struct icc_req *r; >> + u32 agg_avg = 0; >> + u32 agg_peak = 0; >> + >> + hlist_for_each_entry(r, &node->req_list, req_node) { >> + /* sum(averages) and max(peaks) */ >> + agg_avg += r->avg_bw; >> + agg_peak = max(agg_peak, r->peak_bw); >> + } >> + >> + node->avg_bw = agg_avg; >> + node->peak_bw = agg_peak; >> +} >> + >> +static void provider_aggregate(struct icc_provider *provider, u32 *avg_bw, >> + u32 *peak_bw) >> +{ >> + struct icc_node *n; >> + u32 agg_avg = 0; >> + u32 agg_peak = 0; >> + >> + /* aggregate for the interconnect provider */ > > You could get rid of this, the function name says as much. Ok. >> + list_for_each_entry(n, &provider->nodes, node_list) { >> + /* sum the average and max the peak */ >> + agg_avg += n->avg_bw; >> + agg_peak = max(agg_peak, n->peak_bw); >> + } >> + >> + *avg_bw = agg_avg; >> + *peak_bw = agg_peak; >> +} >> + >> +static int constraints_apply(struct icc_path *path) >> +{ >> + struct icc_node *next, *prev = NULL; >> + int i; >> + >> + for (i = 0; i < path->num_nodes; i++, prev = next) { >> + struct icc_provider *provider; >> + u32 avg_bw = 0; >> + u32 peak_bw = 0; >> + int ret; >> + >> + next = path->reqs[i].node; >> + /* >> + * Both endpoints should be valid master-slave pairs of the >> + * same interconnect provider that will be configured. >> + */ >> + if (!next || !prev) >> + continue; >> + >> + if (next->provider != prev->provider) >> + continue; >> + >> + provider = next->provider; >> + mutex_lock(&provider->lock); >> + >> + /* aggregate requests for the provider */ > > Get rid of comment. Ok. >> + provider_aggregate(provider, &avg_bw, &peak_bw); >> + >> + if (provider->set) { >> + /* set the constraints */ >> + ret = provider->set(prev, next, avg_bw, peak_bw); >> + } >> + >> + mutex_unlock(&provider->lock); >> + >> + if (ret) >> + return ret; >> + } >> + >> + return 0; >> +} >> + >> +/** >> + * icc_set() - set constraints on an interconnect path between two endpoints >> + * @path: reference to the path returned by icc_get() >> + * @avg_bw: average bandwidth in kbps >> + * @peak_bw: peak bandwidth in kbps >> + * >> + * This function is used by an interconnect consumer to express its own needs >> + * in term of bandwidth and QoS for a previously requested path between two >> + * endpoints. The requests are aggregated and each node is updated accordingly. >> + * >> + * Returns 0 on success, or an approproate error code otherwise. > > *appropriate* Ok. [..] >> +/** >> + * struct icc_node - entity that is part of the interconnect topology >> + * >> + * @id: platform specific node id >> + * @name: node name used in debugfs >> + * @links: a list of targets where we can go next when traversing >> + * @num_links: number of links to other interconnect nodes >> + * @provider: points to the interconnect provider of this node >> + * @node_list: list of interconnect nodes associated with @provider >> + * @search_list: list used when walking the nodes graph >> + * @reverse: pointer to previous node when walking the nodes graph >> + * @is_traversed: flag that is used when walking the nodes graph >> + * @req_list: a list of QoS constraint requests associated with this node > > >> + * @avg_bw: aggregated value of average bandwidth >> + * @peak_bw: aggregated value of peak bandwidth > > Consider changing to "aggregated value of {average|peak} bandwidth > requests from all consumers" Ok, will clarify. Thanks, Georgi