Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp934664imw; Tue, 5 Jul 2022 00:22:20 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sIirmIe0nox5V2KNfMoSIceO4nm+HdJyAFuhGucwkA7/JUS4Xykownhm+g0S2jdDAuQq1n X-Received: by 2002:a05:6402:5303:b0:435:7c46:e411 with SMTP id eo3-20020a056402530300b004357c46e411mr45765443edb.221.1657005740660; Tue, 05 Jul 2022 00:22:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657005740; cv=none; d=google.com; s=arc-20160816; b=hzKIiNMt3wDOPWPxpbSxS25ug744ynPnSwH9b9osUjh853t7pBIi5mScpXxk6iQ0bq wnru/UKNfJwwe3sN/tGiuASiB1PzvptEJnVkFHvnmt3J1M0YtIdLjMJDlVC9grWWuUBr Eo8Tuj5sx9M8WxrO/UImQ/wXME6DRGX5wv393E2lNKJmshWDvWC/hlXIeZUtwhvChwNf D7SxkK+loe/t5Bm5QW3qQLJFf8Dj4kyGRyd99pJ9nCMpGNXatcO3hxX4uqebA7FJf7mu T51RUd4faIF/3CNRmNT9WBGhBnVCWZRiKSrBItpk+/cep84fnzzIN45jORlBEIpuVgHS p4pw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=hsy8RgpVRpOJDolyph05nBpVAaILT2BYyd7LLXQK8tY=; b=rRClNdhmlSMp69KAGBe27znLj8/Y2MLOb/hH/Oyag0Om9DuNMUQHHALIRVzi2FZJSL w4iWgV8SiJ9cywIyf4UPinMLORyYBwv/D3Wfj2CSMhBXnqN7ig08AvVjdbsWFLcpr4/e 6Lt69r9oUv7cVApfywC+4UDKlUz8MUSaEjGbqH4ZyCEOhaNkU8f5W8Hyn5AcCRP0pAml 36/fNPyL5QE+EP7ZPifEyUNxwXlAdydkOTH0R7k6l/bntJrktTrWBa5nXaCgD5gPhYCf EcWj917KCtu5SI4V6tJrW4MOqK82hL68m5nKmRQzS+/zFbbSA0UqLwwYhFREC6lPsqN2 HNcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tWLIhvIM; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hr30-20020a1709073f9e00b00711fa454fb3si4918672ejc.889.2022.07.05.00.21.54; Tue, 05 Jul 2022 00:22:20 -0700 (PDT) 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=tWLIhvIM; 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 S230440AbiGEHBN (ORCPT + 99 others); Tue, 5 Jul 2022 03:01:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230348AbiGEHA4 (ORCPT ); Tue, 5 Jul 2022 03:00:56 -0400 Received: from mail-pg1-x530.google.com (mail-pg1-x530.google.com [IPv6:2607:f8b0:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6FA531181E for ; Tue, 5 Jul 2022 00:00:52 -0700 (PDT) Received: by mail-pg1-x530.google.com with SMTP id e132so10624437pgc.5 for ; Tue, 05 Jul 2022 00:00:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=hsy8RgpVRpOJDolyph05nBpVAaILT2BYyd7LLXQK8tY=; b=tWLIhvIMi3bqQ1WIU1mnGOdt9m5zPw3uFewvM95H9pkuxcUMFi9im2HymV9Fe/cfL6 oRp8cnD6MSosK/ZVue8RFaKk5x6Pb68e0oVxf1YXUk41etd+7w6x5sXwvJcqFgVN7xjX mI5743zHcb9t5iGMOMfKFbHCZemw+02HpiqGt6FPtxLzkKurDK5jub1/BclltguVyBpK 1GNF9pjO1jjUDKjDmwNdGNTpV8UOS6oep3Ih1BDdnyWfacdKsPG7BHRkn1VdWT+H1tqK m5MWPGv8Vp7zV710mEa8SX8y1UznzMYdiXuaOBhJVfLetd9mr5Zjc6cxhkS2ah/XgVwS +wWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=hsy8RgpVRpOJDolyph05nBpVAaILT2BYyd7LLXQK8tY=; b=6bn6MFKHy+flT6bn+bw5c6sVp/SWALNsjGvJB6aeTLSGFN+n/Ceu5UbUt3tDm23X+v xw4gZSoQYYTI11Xw9DLM7KTTOek5t4oWTteEcqI+AsCUDCE62wZsgG3wapyoo3lfyki5 ewfWagm6AFszND+7KeRjVU+WNuEmWghaohD7HDcaFI8mqelGoHW8lSK6XNSf2yqYOOyI hUF9ejLTq4J6Xw2LeF5AR7TtUHbqXt2qY96w3tLAF8fWMO1Z0YfZqxQOiM83QTthAbuE FoaCYEzZe9JJdERyaf3XR4+BjVejA0nC3tqbSmrxyziy5VzorCaVsd7J1Ppni5yqqv1m wcCA== X-Gm-Message-State: AJIora9gvP1uyQHCa62AVg0QuF9YT8PQwGMPlUkSnJH90S1OYoMtnfqQ +2H/4iSfeWHLzJUi/l2XotyhqA== X-Received: by 2002:a63:185b:0:b0:411:75ee:c87a with SMTP id 27-20020a63185b000000b0041175eec87amr27710197pgy.607.1657004451865; Tue, 05 Jul 2022 00:00:51 -0700 (PDT) Received: from localhost ([122.171.18.80]) by smtp.gmail.com with ESMTPSA id f20-20020a170902ab9400b0016a109c7606sm22609436plr.259.2022.07.05.00.00.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Jul 2022 00:00:51 -0700 (PDT) From: Viresh Kumar To: Viresh Kumar , Nishanth Menon , Stephen Boyd Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , "Rafael J. Wysocki" , Krzysztof Kozlowski , linux-kernel@vger.kernel.org Subject: [PATCH V2 07/13] OPP: Compare bandwidths for all paths in _opp_compare_key() Date: Tue, 5 Jul 2022 12:30:10 +0530 Message-Id: <1bbfdbf08c010bf6687b906a6865981d0a075acd.1657003420.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.31.1.272.g89b43f80a514 In-Reply-To: References: 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,T_SCC_BODY_TEXT_LINE autolearn=ham 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: X-Mailing-List: linux-kernel@vger.kernel.org Replicate the same behavior as "rates" here and compare all values instead of relying on the first entry alone. Signed-off-by: Viresh Kumar --- drivers/opp/core.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/drivers/opp/core.c b/drivers/opp/core.c index 003cd48123d7..261f5e1abfe1 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -1683,6 +1683,20 @@ static int _opp_compare_rate(struct opp_table *opp_table, return 0; } +static int _opp_compare_bw(struct opp_table *opp_table, struct dev_pm_opp *opp1, + struct dev_pm_opp *opp2) +{ + int i; + + for (i = 0; i < opp_table->path_count; i++) { + if (opp1->bandwidth[i].peak != opp2->bandwidth[i].peak) + return opp1->bandwidth[i].peak < opp2->bandwidth[i].peak ? -1 : 1; + } + + /* Same bw for both OPPs */ + return 0; +} + /* * Returns * 0: opp1 == opp2 @@ -1698,9 +1712,9 @@ int _opp_compare_key(struct opp_table *opp_table, struct dev_pm_opp *opp1, if (ret) return ret; - if (opp1->bandwidth && opp2->bandwidth && - opp1->bandwidth[0].peak != opp2->bandwidth[0].peak) - return opp1->bandwidth[0].peak < opp2->bandwidth[0].peak ? -1 : 1; + ret = _opp_compare_bw(opp_table, opp1, opp2); + if (ret) + return ret; if (opp1->level != opp2->level) return opp1->level < opp2->level ? -1 : 1; -- 2.31.1.272.g89b43f80a514