[RFC] interconnect: qcom: icc-rpm: Don't call __qcom_icc_set twice on the same node
Message ID | 20230303023500.2173137-1-konrad.dybcio@linaro.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp186536wrd; Thu, 2 Mar 2023 18:37:13 -0800 (PST) X-Google-Smtp-Source: AK7set+l88ISZlX4GMuxzW68d6aZ5MUj1nS7w0YHOae6ZLAg+rLu0xzAFbIqIcwG1HTmBxjvxNbA X-Received: by 2002:aa7:d958:0:b0:4af:51dc:da5e with SMTP id l24-20020aa7d958000000b004af51dcda5emr346260eds.38.1677811033443; Thu, 02 Mar 2023 18:37:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677811033; cv=none; d=google.com; s=arc-20160816; b=lXPq8uPSaSJ4Ry+Bx3m5LadgANZQgFSSaD1EZiLpnK8XpmS9UyUU2LSZ0UfL+z3Ldm 4NxBTg9fNgTeb6Hxr+fxyOMPkS06yzIE/mqODs7X+nqV7yL3XQ32aT4r/gAslodyV9vj 5Ij23jzlYSRjbDfxR74O6sWEgtBfqaEN9uYkd4+hTXnV4bY097ykIXL3SA99q5+Pkb77 JCR7dBDZD/ksY1vfuy4HzPYfp0xomO+giMa2xE+0EWB1TICXF56z0ubvUkLaxOEUqIhf o6Pu3nSPhT+BvJTxVzh+ySV51wk87euj4/qE99jswPWCXoXxVwO9VRjeRme/+PNDK71O KlZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=jLRvX/I7uLgP1lL5sZgRZ4/1Xfsiyoty5CreDeDfcFQ=; b=En2O5f/uCVRPxusWRjxqME4CKNJ4IUET9iYVG+HuH6AHsl2bjxccf4RKMJ0hY42WeR Y3Qz9GwK8UQKGj3IhM1ZdWq9Uhd222ucY3I8T9xM5CRNi14RfR6YctqzYMRF6fvXHO7q UPSvgVopSywQBDy1ioYSq2J1FszAQcSrRz6yhFOKmaKJazV4pVnXr2hwaVyhD7Y8GKIV 9UwvBfxFs2qcb1v0BsV9tYnYx3kTjoJLTXpFIN/5Wf2f2te3fKWcqzs/pjMh1uLsCay7 heRERj8KpMK/Nt8lkJooUTBbPLnTIzcp01+AxpywZJ7ZyE0lOlReD/6kqNFVixYWHXTX ZK3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CCG58myA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b11-20020aa7d48b000000b004aeeae11454si1292116edr.140.2023.03.02.18.36.50; Thu, 02 Mar 2023 18:37:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CCG58myA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S229552AbjCCCfK (ORCPT <rfc822;davidbtadokoro@gmail.com> + 99 others); Thu, 2 Mar 2023 21:35:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229494AbjCCCfJ (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 2 Mar 2023 21:35:09 -0500 Received: from mail-lf1-x136.google.com (mail-lf1-x136.google.com [IPv6:2a00:1450:4864:20::136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A7543B3D6 for <linux-kernel@vger.kernel.org>; Thu, 2 Mar 2023 18:35:07 -0800 (PST) Received: by mail-lf1-x136.google.com with SMTP id j11so1774100lfg.13 for <linux-kernel@vger.kernel.org>; Thu, 02 Mar 2023 18:35:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1677810905; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=jLRvX/I7uLgP1lL5sZgRZ4/1Xfsiyoty5CreDeDfcFQ=; b=CCG58myAHYYt0rheTGVmmZ8w/u/CvaQKetINiA1lSjLDfe62iXWW/PF+3AV6/qysQL meP02uIifxyypHpn4IwUeasomdIoWov5Zr82Cz0DUA8VabXsFrPTnPh6HxzKQ1cg2Cq0 b6oEXfBso/ZIHt0ckSs260XR2pZbjDpA0TkCONxi7cGePpRyE83pqn+k68bMPvaEXgDS RG07N04jYizbe+I/2lJLvMpim69cCvPblH4NgwkN5bFySG/MrTff/Wj2rR3W8PJqAA/h bpD6yW2uKHrsMNKYZvo4IXjBvdJnhWmW/30IDrr2ysOsf5vRWLdSq0imNsR8GxHkUJuB Motw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677810905; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=jLRvX/I7uLgP1lL5sZgRZ4/1Xfsiyoty5CreDeDfcFQ=; b=ckRlBNlCQRdBQMtJS1isvh8ePBpF0wyPp2vMpH6nALEaCesMwCBtxEj5THgaihXQ11 VoeV+CnI4M409DnbQaYZW7vKjfmsh3e21S12IFXCL6FFPqMBx7WSQmXEPkKB5IlkVVXe 4hXfXs7urCpAOBo0N55ncBc42ZyCdyhvL0f/dz+9jllzTxCWy/V/5oSKSfy4xW5RPqO/ J/emu01vqdFYOWtbjyMBLbymo3ZSDzf2uLCCwvsF4UsCGrgRhdm4KdIphZKlB4Bqzcp8 8/shPMm4vr61//rmRTjK9DtzmZrc/C/yQBXdUXNzNsThIaOgZwCpW19qYxuO9BkyGrbP mYtw== X-Gm-Message-State: AO0yUKWQm3VOFLnKyjg0N6B1lN1hxPPgBC5b6GzhUOTo42aEmaT/96Yo eToMvn4UV4OkBVEaVGVwaZMaEA== X-Received: by 2002:ac2:508f:0:b0:4dd:a5aa:accb with SMTP id f15-20020ac2508f000000b004dda5aaaccbmr98125lfm.44.1677810905658; Thu, 02 Mar 2023 18:35:05 -0800 (PST) Received: from localhost.localdomain (abym99.neoplus.adsl.tpnet.pl. [83.9.32.99]) by smtp.gmail.com with ESMTPSA id d20-20020ac241d4000000b004d856fe5121sm180218lfi.194.2023.03.02.18.35.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Mar 2023 18:35:05 -0800 (PST) From: Konrad Dybcio <konrad.dybcio@linaro.org> To: linux-arm-msm@vger.kernel.org, andersson@kernel.org, agross@kernel.org Cc: marijn.suijten@somainline.org, Konrad Dybcio <konrad.dybcio@linaro.org>, Georgi Djakov <djakov@kernel.org>, "Bryan O'Donoghue" <bryan.odonoghue@linaro.org>, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH] interconnect: qcom: icc-rpm: Don't call __qcom_icc_set twice on the same node Date: Fri, 3 Mar 2023 03:35:00 +0100 Message-Id: <20230303023500.2173137-1-konrad.dybcio@linaro.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759312381997688155?= X-GMAIL-MSGID: =?utf-8?q?1759312381997688155?= |
Series |
[RFC] interconnect: qcom: icc-rpm: Don't call __qcom_icc_set twice on the same node
|
|
Commit Message
Konrad Dybcio
March 3, 2023, 2:35 a.m. UTC
Currently, when sync_state calls set(n, n) all the paths for setting
parameters on an icc node are called twice. Avoid that.
Fixes: 751f4d14cdb4 ("interconnect: icc-rpm: Set destination bandwidth as well as source bandwidth")
Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
---
RFC comes from the fact that I *believe* this should be correct, but I'm
not entirely sure about it..
drivers/interconnect/qcom/icc-rpm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On 03/03/2023 02:35, Konrad Dybcio wrote: > Currently, when sync_state calls set(n, n) all the paths for setting > parameters on an icc node are called twice. Avoid that. > > Fixes: 751f4d14cdb4 ("interconnect: icc-rpm: Set destination bandwidth as well as source bandwidth") > Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org> > --- > RFC comes from the fact that I *believe* this should be correct, but I'm > not entirely sure about it.. > > > drivers/interconnect/qcom/icc-rpm.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/interconnect/qcom/icc-rpm.c b/drivers/interconnect/qcom/icc-rpm.c > index a6e0de03f46b..d35db1af9b08 100644 > --- a/drivers/interconnect/qcom/icc-rpm.c > +++ b/drivers/interconnect/qcom/icc-rpm.c > @@ -387,7 +387,7 @@ static int qcom_icc_set(struct icc_node *src, struct icc_node *dst) > ret = __qcom_icc_set(src, src_qn, sum_bw); > if (ret) > return ret; > - if (dst_qn) { > + if (dst_qn && src_qn != dst_qn) { > ret = __qcom_icc_set(dst, dst_qn, sum_bw); > if (ret) > return ret; Is it possible for src_qn == dst_qn ? Iff you confirm that experimentally - add my Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
On 3.03.2023 12:32, Bryan O'Donoghue wrote: > On 03/03/2023 02:35, Konrad Dybcio wrote: >> Currently, when sync_state calls set(n, n) all the paths for setting >> parameters on an icc node are called twice. Avoid that. >> >> Fixes: 751f4d14cdb4 ("interconnect: icc-rpm: Set destination bandwidth as well as source bandwidth") >> Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org> >> --- >> RFC comes from the fact that I *believe* this should be correct, but I'm >> not entirely sure about it.. >> >> >> drivers/interconnect/qcom/icc-rpm.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/interconnect/qcom/icc-rpm.c b/drivers/interconnect/qcom/icc-rpm.c >> index a6e0de03f46b..d35db1af9b08 100644 >> --- a/drivers/interconnect/qcom/icc-rpm.c >> +++ b/drivers/interconnect/qcom/icc-rpm.c >> @@ -387,7 +387,7 @@ static int qcom_icc_set(struct icc_node *src, struct icc_node *dst) >> ret = __qcom_icc_set(src, src_qn, sum_bw); >> if (ret) >> return ret; >> - if (dst_qn) { >> + if (dst_qn && src_qn != dst_qn) { >> ret = __qcom_icc_set(dst, dst_qn, sum_bw); >> if (ret) >> return ret; > > Is it possible for src_qn == dst_qn ? As the commit message says, sync_state calls set(n, n) in drivers/interconnect/core.c : icc_sync_state(struct device *dev) Konrad > > Iff you confirm that experimentally - add my > > Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
On 03/03/2023 11:33, Konrad Dybcio wrote: > > > On 3.03.2023 12:32, Bryan O'Donoghue wrote: >> On 03/03/2023 02:35, Konrad Dybcio wrote: >>> Currently, when sync_state calls set(n, n) all the paths for setting >>> parameters on an icc node are called twice. Avoid that. >>> >>> Fixes: 751f4d14cdb4 ("interconnect: icc-rpm: Set destination bandwidth as well as source bandwidth") >>> Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org> >>> --- >>> RFC comes from the fact that I *believe* this should be correct, but I'm >>> not entirely sure about it.. >>> >>> >>> drivers/interconnect/qcom/icc-rpm.c | 2 +- >>> 1 file changed, 1 insertion(+), 1 deletion(-) >>> >>> diff --git a/drivers/interconnect/qcom/icc-rpm.c b/drivers/interconnect/qcom/icc-rpm.c >>> index a6e0de03f46b..d35db1af9b08 100644 >>> --- a/drivers/interconnect/qcom/icc-rpm.c >>> +++ b/drivers/interconnect/qcom/icc-rpm.c >>> @@ -387,7 +387,7 @@ static int qcom_icc_set(struct icc_node *src, struct icc_node *dst) >>> ret = __qcom_icc_set(src, src_qn, sum_bw); >>> if (ret) >>> return ret; >>> - if (dst_qn) { >>> + if (dst_qn && src_qn != dst_qn) { >>> ret = __qcom_icc_set(dst, dst_qn, sum_bw); >>> if (ret) >>> return ret; >> >> Is it possible for src_qn == dst_qn ? > As the commit message says, sync_state calls set(n, n) in > drivers/interconnect/core.c : icc_sync_state(struct device *dev) So you've _seen_ that happen ?
On 3.03.2023 12:35, Bryan O'Donoghue wrote: > On 03/03/2023 11:33, Konrad Dybcio wrote: >> >> >> On 3.03.2023 12:32, Bryan O'Donoghue wrote: >>> On 03/03/2023 02:35, Konrad Dybcio wrote: >>>> Currently, when sync_state calls set(n, n) all the paths for setting >>>> parameters on an icc node are called twice. Avoid that. >>>> >>>> Fixes: 751f4d14cdb4 ("interconnect: icc-rpm: Set destination bandwidth as well as source bandwidth") >>>> Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org> >>>> --- >>>> RFC comes from the fact that I *believe* this should be correct, but I'm >>>> not entirely sure about it.. >>>> >>>> >>>> drivers/interconnect/qcom/icc-rpm.c | 2 +- >>>> 1 file changed, 1 insertion(+), 1 deletion(-) >>>> >>>> diff --git a/drivers/interconnect/qcom/icc-rpm.c b/drivers/interconnect/qcom/icc-rpm.c >>>> index a6e0de03f46b..d35db1af9b08 100644 >>>> --- a/drivers/interconnect/qcom/icc-rpm.c >>>> +++ b/drivers/interconnect/qcom/icc-rpm.c >>>> @@ -387,7 +387,7 @@ static int qcom_icc_set(struct icc_node *src, struct icc_node *dst) >>>> ret = __qcom_icc_set(src, src_qn, sum_bw); >>>> if (ret) >>>> return ret; >>>> - if (dst_qn) { >>>> + if (dst_qn && src_qn != dst_qn) { >>>> ret = __qcom_icc_set(dst, dst_qn, sum_bw); >>>> if (ret) >>>> return ret; >>> >>> Is it possible for src_qn == dst_qn ? >> As the commit message says, sync_state calls set(n, n) in >> drivers/interconnect/core.c : icc_sync_state(struct device *dev) > > So you've _seen_ that happen ? Yes, I did, on every boot previous to this patch, I believe. Konrad >
On 03/03/2023 11:35, Bryan O'Donoghue wrote: > On 03/03/2023 11:33, Konrad Dybcio wrote: >> >> >> On 3.03.2023 12:32, Bryan O'Donoghue wrote: >>> On 03/03/2023 02:35, Konrad Dybcio wrote: >>>> Currently, when sync_state calls set(n, n) all the paths for setting >>>> parameters on an icc node are called twice. Avoid that. >>>> >>>> Fixes: 751f4d14cdb4 ("interconnect: icc-rpm: Set destination >>>> bandwidth as well as source bandwidth") >>>> Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org> >>>> --- >>>> RFC comes from the fact that I *believe* this should be correct, but >>>> I'm >>>> not entirely sure about it.. >>>> >>>> >>>> drivers/interconnect/qcom/icc-rpm.c | 2 +- >>>> 1 file changed, 1 insertion(+), 1 deletion(-) >>>> >>>> diff --git a/drivers/interconnect/qcom/icc-rpm.c >>>> b/drivers/interconnect/qcom/icc-rpm.c >>>> index a6e0de03f46b..d35db1af9b08 100644 >>>> --- a/drivers/interconnect/qcom/icc-rpm.c >>>> +++ b/drivers/interconnect/qcom/icc-rpm.c >>>> @@ -387,7 +387,7 @@ static int qcom_icc_set(struct icc_node *src, >>>> struct icc_node *dst) >>>> ret = __qcom_icc_set(src, src_qn, sum_bw); >>>> if (ret) >>>> return ret; >>>> - if (dst_qn) { >>>> + if (dst_qn && src_qn != dst_qn) { >>>> ret = __qcom_icc_set(dst, dst_qn, sum_bw); >>>> if (ret) >>>> return ret; >>> >>> Is it possible for src_qn == dst_qn ? >> As the commit message says, sync_state calls set(n, n) in >> drivers/interconnect/core.c : icc_sync_state(struct device *dev) > > So you've _seen_ that happen ? > Assuming you have, then why isn't the fix in sync_state i.e. that's an error for everybody right ?
On 3.03.2023 12:36, Bryan O'Donoghue wrote: > On 03/03/2023 11:35, Bryan O'Donoghue wrote: >> On 03/03/2023 11:33, Konrad Dybcio wrote: >>> >>> >>> On 3.03.2023 12:32, Bryan O'Donoghue wrote: >>>> On 03/03/2023 02:35, Konrad Dybcio wrote: >>>>> Currently, when sync_state calls set(n, n) all the paths for setting >>>>> parameters on an icc node are called twice. Avoid that. >>>>> >>>>> Fixes: 751f4d14cdb4 ("interconnect: icc-rpm: Set destination bandwidth as well as source bandwidth") >>>>> Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org> >>>>> --- >>>>> RFC comes from the fact that I *believe* this should be correct, but I'm >>>>> not entirely sure about it.. >>>>> >>>>> >>>>> drivers/interconnect/qcom/icc-rpm.c | 2 +- >>>>> 1 file changed, 1 insertion(+), 1 deletion(-) >>>>> >>>>> diff --git a/drivers/interconnect/qcom/icc-rpm.c b/drivers/interconnect/qcom/icc-rpm.c >>>>> index a6e0de03f46b..d35db1af9b08 100644 >>>>> --- a/drivers/interconnect/qcom/icc-rpm.c >>>>> +++ b/drivers/interconnect/qcom/icc-rpm.c >>>>> @@ -387,7 +387,7 @@ static int qcom_icc_set(struct icc_node *src, struct icc_node *dst) >>>>> ret = __qcom_icc_set(src, src_qn, sum_bw); >>>>> if (ret) >>>>> return ret; >>>>> - if (dst_qn) { >>>>> + if (dst_qn && src_qn != dst_qn) { >>>>> ret = __qcom_icc_set(dst, dst_qn, sum_bw); >>>>> if (ret) >>>>> return ret; >>>> >>>> Is it possible for src_qn == dst_qn ? >>> As the commit message says, sync_state calls set(n, n) in >>> drivers/interconnect/core.c : icc_sync_state(struct device *dev) >> >> So you've _seen_ that happen ? >> > > Assuming you have, then why isn't the fix in sync_state i.e. that's an error for everybody right ? I believe that there's simply no other way of updating every single node on its own with the icc api, without taking any links into play. But I see exynos and i.mx also effectively calling it twice on each node. Konrad
On 03/03/2023 11:39, Konrad Dybcio wrote: > > > On 3.03.2023 12:36, Bryan O'Donoghue wrote: >> On 03/03/2023 11:35, Bryan O'Donoghue wrote: >>> On 03/03/2023 11:33, Konrad Dybcio wrote: >>>> >>>> >>>> On 3.03.2023 12:32, Bryan O'Donoghue wrote: >>>>> On 03/03/2023 02:35, Konrad Dybcio wrote: >>>>>> Currently, when sync_state calls set(n, n) all the paths for setting >>>>>> parameters on an icc node are called twice. Avoid that. >>>>>> >>>>>> Fixes: 751f4d14cdb4 ("interconnect: icc-rpm: Set destination bandwidth as well as source bandwidth") >>>>>> Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org> >>>>>> --- >>>>>> RFC comes from the fact that I *believe* this should be correct, but I'm >>>>>> not entirely sure about it.. >>>>>> >>>>>> >>>>>> drivers/interconnect/qcom/icc-rpm.c | 2 +- >>>>>> 1 file changed, 1 insertion(+), 1 deletion(-) >>>>>> >>>>>> diff --git a/drivers/interconnect/qcom/icc-rpm.c b/drivers/interconnect/qcom/icc-rpm.c >>>>>> index a6e0de03f46b..d35db1af9b08 100644 >>>>>> --- a/drivers/interconnect/qcom/icc-rpm.c >>>>>> +++ b/drivers/interconnect/qcom/icc-rpm.c >>>>>> @@ -387,7 +387,7 @@ static int qcom_icc_set(struct icc_node *src, struct icc_node *dst) >>>>>> ret = __qcom_icc_set(src, src_qn, sum_bw); >>>>>> if (ret) >>>>>> return ret; >>>>>> - if (dst_qn) { >>>>>> + if (dst_qn && src_qn != dst_qn) { >>>>>> ret = __qcom_icc_set(dst, dst_qn, sum_bw); >>>>>> if (ret) >>>>>> return ret; >>>>> >>>>> Is it possible for src_qn == dst_qn ? >>>> As the commit message says, sync_state calls set(n, n) in >>>> drivers/interconnect/core.c : icc_sync_state(struct device *dev) >>> >>> So you've _seen_ that happen ? >>> >> >> Assuming you have, then why isn't the fix in sync_state i.e. that's an error for everybody right ? > I believe that there's simply no other way of updating every single node > on its own with the icc api, without taking any links into play. But I > see exynos and i.mx also effectively calling it twice on each node. > > Konrad I mean. I'm fine for you to retain my RB on this qcom specific patch since this seems like a real bug to me but... it seems like a generic bug across arches that should probably be resolved @ the higher level. ? --- bod
On 3.03.2023 12:40, Bryan O'Donoghue wrote: > On 03/03/2023 11:39, Konrad Dybcio wrote: >> >> >> On 3.03.2023 12:36, Bryan O'Donoghue wrote: >>> On 03/03/2023 11:35, Bryan O'Donoghue wrote: >>>> On 03/03/2023 11:33, Konrad Dybcio wrote: >>>>> >>>>> >>>>> On 3.03.2023 12:32, Bryan O'Donoghue wrote: >>>>>> On 03/03/2023 02:35, Konrad Dybcio wrote: >>>>>>> Currently, when sync_state calls set(n, n) all the paths for setting >>>>>>> parameters on an icc node are called twice. Avoid that. >>>>>>> >>>>>>> Fixes: 751f4d14cdb4 ("interconnect: icc-rpm: Set destination bandwidth as well as source bandwidth") >>>>>>> Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org> >>>>>>> --- >>>>>>> RFC comes from the fact that I *believe* this should be correct, but I'm >>>>>>> not entirely sure about it.. >>>>>>> >>>>>>> >>>>>>> drivers/interconnect/qcom/icc-rpm.c | 2 +- >>>>>>> 1 file changed, 1 insertion(+), 1 deletion(-) >>>>>>> >>>>>>> diff --git a/drivers/interconnect/qcom/icc-rpm.c b/drivers/interconnect/qcom/icc-rpm.c >>>>>>> index a6e0de03f46b..d35db1af9b08 100644 >>>>>>> --- a/drivers/interconnect/qcom/icc-rpm.c >>>>>>> +++ b/drivers/interconnect/qcom/icc-rpm.c >>>>>>> @@ -387,7 +387,7 @@ static int qcom_icc_set(struct icc_node *src, struct icc_node *dst) >>>>>>> ret = __qcom_icc_set(src, src_qn, sum_bw); >>>>>>> if (ret) >>>>>>> return ret; >>>>>>> - if (dst_qn) { >>>>>>> + if (dst_qn && src_qn != dst_qn) { >>>>>>> ret = __qcom_icc_set(dst, dst_qn, sum_bw); >>>>>>> if (ret) >>>>>>> return ret; >>>>>> >>>>>> Is it possible for src_qn == dst_qn ? >>>>> As the commit message says, sync_state calls set(n, n) in >>>>> drivers/interconnect/core.c : icc_sync_state(struct device *dev) >>>> >>>> So you've _seen_ that happen ? >>>> >>> >>> Assuming you have, then why isn't the fix in sync_state i.e. that's an error for everybody right ? >> I believe that there's simply no other way of updating every single node >> on its own with the icc api, without taking any links into play. But I >> see exynos and i.mx also effectively calling it twice on each node. >> >> Konrad > > I mean. I'm fine for you to retain my RB on this qcom specific patch since this seems like a real bug to me but... it seems like a generic bug across arches that should probably be resolved @ the higher level. > > ? I suppose we could change the set(n, n) in sync_state to be set(n, NULL) and enforce parameter null-checking on all provider->set functions. Do I understand this correctly? Konrad > > --- > bod
On 03/03/2023 11:42, Konrad Dybcio wrote: > > > On 3.03.2023 12:40, Bryan O'Donoghue wrote: >> On 03/03/2023 11:39, Konrad Dybcio wrote: >>> >>> >>> On 3.03.2023 12:36, Bryan O'Donoghue wrote: >>>> On 03/03/2023 11:35, Bryan O'Donoghue wrote: >>>>> On 03/03/2023 11:33, Konrad Dybcio wrote: >>>>>> >>>>>> >>>>>> On 3.03.2023 12:32, Bryan O'Donoghue wrote: >>>>>>> On 03/03/2023 02:35, Konrad Dybcio wrote: >>>>>>>> Currently, when sync_state calls set(n, n) all the paths for setting >>>>>>>> parameters on an icc node are called twice. Avoid that. >>>>>>>> >>>>>>>> Fixes: 751f4d14cdb4 ("interconnect: icc-rpm: Set destination bandwidth as well as source bandwidth") >>>>>>>> Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org> >>>>>>>> --- >>>>>>>> RFC comes from the fact that I *believe* this should be correct, but I'm >>>>>>>> not entirely sure about it.. >>>>>>>> >>>>>>>> >>>>>>>> drivers/interconnect/qcom/icc-rpm.c | 2 +- >>>>>>>> 1 file changed, 1 insertion(+), 1 deletion(-) >>>>>>>> >>>>>>>> diff --git a/drivers/interconnect/qcom/icc-rpm.c b/drivers/interconnect/qcom/icc-rpm.c >>>>>>>> index a6e0de03f46b..d35db1af9b08 100644 >>>>>>>> --- a/drivers/interconnect/qcom/icc-rpm.c >>>>>>>> +++ b/drivers/interconnect/qcom/icc-rpm.c >>>>>>>> @@ -387,7 +387,7 @@ static int qcom_icc_set(struct icc_node *src, struct icc_node *dst) >>>>>>>> ret = __qcom_icc_set(src, src_qn, sum_bw); >>>>>>>> if (ret) >>>>>>>> return ret; >>>>>>>> - if (dst_qn) { >>>>>>>> + if (dst_qn && src_qn != dst_qn) { >>>>>>>> ret = __qcom_icc_set(dst, dst_qn, sum_bw); >>>>>>>> if (ret) >>>>>>>> return ret; >>>>>>> >>>>>>> Is it possible for src_qn == dst_qn ? >>>>>> As the commit message says, sync_state calls set(n, n) in >>>>>> drivers/interconnect/core.c : icc_sync_state(struct device *dev) >>>>> >>>>> So you've _seen_ that happen ? >>>>> >>>> >>>> Assuming you have, then why isn't the fix in sync_state i.e. that's an error for everybody right ? >>> I believe that there's simply no other way of updating every single node >>> on its own with the icc api, without taking any links into play. But I >>> see exynos and i.mx also effectively calling it twice on each node. >>> >>> Konrad >> >> I mean. I'm fine for you to retain my RB on this qcom specific patch since this seems like a real bug to me but... it seems like a generic bug across arches that should probably be resolved @ the higher level. >> >> ? > I suppose we could change the set(n, n) in sync_state to be set(n, NULL) > and enforce parameter null-checking on all provider->set functions. Do > I understand this correctly? > > Konrad >> >> --- >> bod void icc_sync_state(struct device *dev) { struct icc_provider *p; struct icc_node *n; static int count; count++; if (count < providers_count) return; mutex_lock(&icc_lock); synced_state = true; list_for_each_entry(p, &icc_providers, provider_list) { dev_dbg(p->dev, "interconnect provider is in synced state\n"); list_for_each_entry(n, &p->nodes, node_list) { if (n->init_avg || n->init_peak) { n->init_avg = 0; n->init_peak = 0; aggregate_requests(n); p->set(n, n); } } } mutex_unlock(&icc_lock); } EXPORT_SYMBOL_GPL(icc_sync_state); I mean p->set(n,n); is done like this since forever. Now that you draw attention to it, it doesn't make much sense to me..
On 3.03.2023 12:50, Bryan O'Donoghue wrote: > On 03/03/2023 11:42, Konrad Dybcio wrote: >> >> >> On 3.03.2023 12:40, Bryan O'Donoghue wrote: >>> On 03/03/2023 11:39, Konrad Dybcio wrote: >>>> >>>> >>>> On 3.03.2023 12:36, Bryan O'Donoghue wrote: >>>>> On 03/03/2023 11:35, Bryan O'Donoghue wrote: >>>>>> On 03/03/2023 11:33, Konrad Dybcio wrote: >>>>>>> >>>>>>> >>>>>>> On 3.03.2023 12:32, Bryan O'Donoghue wrote: >>>>>>>> On 03/03/2023 02:35, Konrad Dybcio wrote: >>>>>>>>> Currently, when sync_state calls set(n, n) all the paths for setting >>>>>>>>> parameters on an icc node are called twice. Avoid that. >>>>>>>>> >>>>>>>>> Fixes: 751f4d14cdb4 ("interconnect: icc-rpm: Set destination bandwidth as well as source bandwidth") >>>>>>>>> Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org> >>>>>>>>> --- >>>>>>>>> RFC comes from the fact that I *believe* this should be correct, but I'm >>>>>>>>> not entirely sure about it.. >>>>>>>>> >>>>>>>>> >>>>>>>>> drivers/interconnect/qcom/icc-rpm.c | 2 +- >>>>>>>>> 1 file changed, 1 insertion(+), 1 deletion(-) >>>>>>>>> >>>>>>>>> diff --git a/drivers/interconnect/qcom/icc-rpm.c b/drivers/interconnect/qcom/icc-rpm.c >>>>>>>>> index a6e0de03f46b..d35db1af9b08 100644 >>>>>>>>> --- a/drivers/interconnect/qcom/icc-rpm.c >>>>>>>>> +++ b/drivers/interconnect/qcom/icc-rpm.c >>>>>>>>> @@ -387,7 +387,7 @@ static int qcom_icc_set(struct icc_node *src, struct icc_node *dst) >>>>>>>>> ret = __qcom_icc_set(src, src_qn, sum_bw); >>>>>>>>> if (ret) >>>>>>>>> return ret; >>>>>>>>> - if (dst_qn) { >>>>>>>>> + if (dst_qn && src_qn != dst_qn) { >>>>>>>>> ret = __qcom_icc_set(dst, dst_qn, sum_bw); >>>>>>>>> if (ret) >>>>>>>>> return ret; >>>>>>>> >>>>>>>> Is it possible for src_qn == dst_qn ? >>>>>>> As the commit message says, sync_state calls set(n, n) in >>>>>>> drivers/interconnect/core.c : icc_sync_state(struct device *dev) >>>>>> >>>>>> So you've _seen_ that happen ? >>>>>> >>>>> >>>>> Assuming you have, then why isn't the fix in sync_state i.e. that's an error for everybody right ? >>>> I believe that there's simply no other way of updating every single node >>>> on its own with the icc api, without taking any links into play. But I >>>> see exynos and i.mx also effectively calling it twice on each node. >>>> >>>> Konrad >>> >>> I mean. I'm fine for you to retain my RB on this qcom specific patch since this seems like a real bug to me but... it seems like a generic bug across arches that should probably be resolved @ the higher level. >>> >>> ? >> I suppose we could change the set(n, n) in sync_state to be set(n, NULL) >> and enforce parameter null-checking on all provider->set functions. Do >> I understand this correctly? >> >> Konrad >>> >>> --- >>> bod > > void icc_sync_state(struct device *dev) > { > struct icc_provider *p; > struct icc_node *n; > static int count; > > count++; > > if (count < providers_count) > return; > > mutex_lock(&icc_lock); > synced_state = true; > list_for_each_entry(p, &icc_providers, provider_list) { > dev_dbg(p->dev, "interconnect provider is in synced state\n"); > list_for_each_entry(n, &p->nodes, node_list) { > if (n->init_avg || n->init_peak) { > n->init_avg = 0; > n->init_peak = 0; > aggregate_requests(n); > p->set(n, n); > } > } > } > mutex_unlock(&icc_lock); > } > EXPORT_SYMBOL_GPL(icc_sync_state); > > I mean p->set(n,n); is done like this since forever. Now that you draw attention to it, it doesn't make much sense to me.. Yeah, but we're doing the same thing twice.. So maybe this is not so much a bug fix as it's an optimization.. Thinking about it again, this could use a likely() too, as this seems to be the only occurence of set(n, n) Konrad
On 3.03.23 4:35, Konrad Dybcio wrote: > Currently, when sync_state calls set(n, n) all the paths for setting > parameters on an icc node are called twice. Avoid that. This could be optimized indeed. > Fixes: 751f4d14cdb4 ("interconnect: icc-rpm: Set destination bandwidth as well as source bandwidth") > Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org> > --- > RFC comes from the fact that I *believe* this should be correct, but I'm > not entirely sure about it.. > > > drivers/interconnect/qcom/icc-rpm.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/interconnect/qcom/icc-rpm.c b/drivers/interconnect/qcom/icc-rpm.c > index a6e0de03f46b..d35db1af9b08 100644 > --- a/drivers/interconnect/qcom/icc-rpm.c > +++ b/drivers/interconnect/qcom/icc-rpm.c > @@ -387,7 +387,7 @@ static int qcom_icc_set(struct icc_node *src, struct icc_node *dst) > ret = __qcom_icc_set(src, src_qn, sum_bw); > if (ret) > return ret; > - if (dst_qn) { > + if (dst_qn && src_qn != dst_qn) { > ret = __qcom_icc_set(dst, dst_qn, sum_bw); > if (ret) > return ret; Today we also call provider->set(node, node) in icc_node_add() to set the initial bandwidth when nodes are being added to the topology. The above change will affect that as well. BR, Georgi
diff --git a/drivers/interconnect/qcom/icc-rpm.c b/drivers/interconnect/qcom/icc-rpm.c index a6e0de03f46b..d35db1af9b08 100644 --- a/drivers/interconnect/qcom/icc-rpm.c +++ b/drivers/interconnect/qcom/icc-rpm.c @@ -387,7 +387,7 @@ static int qcom_icc_set(struct icc_node *src, struct icc_node *dst) ret = __qcom_icc_set(src, src_qn, sum_bw); if (ret) return ret; - if (dst_qn) { + if (dst_qn && src_qn != dst_qn) { ret = __qcom_icc_set(dst, dst_qn, sum_bw); if (ret) return ret;