Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp1254856ybk; Sat, 16 May 2020 05:55:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxeWTv/yz+yUmjaimjzvjfqp+LxXSDtMTcP43uRAAR6G7tgMu+RlzTkBmws4L4o9nmXHWEN X-Received: by 2002:a05:6402:1d06:: with SMTP id dg6mr6867963edb.314.1589633750495; Sat, 16 May 2020 05:55:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589633750; cv=none; d=google.com; s=arc-20160816; b=siG6d0zeIUAcHAGz+iDn35zgmgMRcV5G3zDPf2yF/nbWt0bcWX1kD4TUETuDLaqkOP iN18xmswdJZfbEJjm6zX9F0ih61WYDDbJDPEqzJ38uXen53TUbVuNpsmuQscGKtTvBED EmExejHXFaBOErk2PAT5vlazJK5DHPKIWvUO70xSmkCQYibkDb+Xo+z2JZg/klI0Ej47 dPxiXCXs4qTgJ1uDJOm8vSXruL0vVbZTNn03wCcU0PWKlawAB4N2OrDRUJvRg8sIwtRC 3c7Yd0WJxeSfHU4sk8bK8gmHHyLO4gf5ejyoe2zJtikvVOrXTjM6wVxOdNj1gbAYf0AE NE1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=mO/EOiLhTWUoN1BugilsH4X9ITX+1Udar2/i+69zZWo=; b=HhPdMmnzx7Id8swi0Org2cXQ6+2YIOUbVynyQknqaBCI6m23PBTUwk2ZQFw0qx7z0M M1Az9x/x12g0AFjX6KPmHaF3Y3+8JedfN/SAxMo7MbkwSdDZACsnZ8i2sbh6Z0SiKSny sYA5SpV8Ublz1z0SkYgDECs+S8ZuKLUufeBiarB+rxU7MChKAmkWj2yvYemV92Vk1rw8 47GEbDubxIa2/uoL3n8k1HvlImoRXI33/ZldUqiR1Df4n+1cDoXsb1x4kzLQGY5lZe4x CffFCQDrEFDpxujUyXfnrebMk8k24iZJUC6qbK9aR2lOT091tJhMntdwkzfqITGO6Tkk l8sA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dr2si236381ejc.265.2020.05.16.05.55.27; Sat, 16 May 2020 05:55:50 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726409AbgEPMwK (ORCPT + 99 others); Sat, 16 May 2020 08:52:10 -0400 Received: from mail.baikalelectronics.com ([87.245.175.226]:40058 "EHLO mail.baikalelectronics.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726237AbgEPMwK (ORCPT ); Sat, 16 May 2020 08:52:10 -0400 Received: from localhost (unknown [127.0.0.1]) by mail.baikalelectronics.ru (Postfix) with ESMTP id 43AD88030802; Sat, 16 May 2020 12:52:07 +0000 (UTC) X-Virus-Scanned: amavisd-new at baikalelectronics.ru Received: from mail.baikalelectronics.ru ([127.0.0.1]) by localhost (mail.baikalelectronics.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id PpvYz0io-J5L; Sat, 16 May 2020 15:52:05 +0300 (MSK) Date: Sat, 16 May 2020 15:52:03 +0300 From: Serge Semin To: "Rafael J. Wysocki" CC: Serge Semin , Thomas Bogendoerfer , "Rafael J. Wysocki" , Viresh Kumar , Ulf Hansson , Matthias Kaehlcke , Alexey Malahov , Paul Burton , Ralf Baechle , Arnd Bergmann , Rob Herring , , , , Frederic Weisbecker , Ingo Molnar , Yue Hu , , Subject: Re: [PATCH v2 20/20] cpufreq: Return zero on success in boost sw setting Message-ID: <20200516125203.et5gkv6ullkerjyd@mobilestation> References: <20200306124807.3596F80307C2@mail.baikalelectronics.ru> <20200506174238.15385-1-Sergey.Semin@baikalelectronics.ru> <20200506174238.15385-21-Sergey.Semin@baikalelectronics.ru> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: X-ClientProxiedBy: MAIL.baikal.int (192.168.51.25) To mail (192.168.51.25) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello Rafael, On Fri, May 15, 2020 at 05:58:47PM +0200, Rafael J. Wysocki wrote: > On 5/6/2020 7:42 PM, Sergey.Semin@baikalelectronics.ru wrote: > > From: Serge Semin > > > > Recent commit e61a41256edf ("cpufreq: dev_pm_qos_update_request() can > > return 1 on success") fixed a problem when active policies traverse > > was falsely stopped due to invalidly treating the non-zero return value > > from freq_qos_update_request() method as an error. Yes, that function > > can return positive values if the requested update actually took place. > > The current problem is that the returned value is then passed to the > > return cell of the cpufreq_boost_set_sw() (set_boost callback) method. > > This value is then also analyzed for being non-zero, which is also > > treated as having an error. As a result during the boost activation > > we'll get an error returned while having the QOS frequency update > > successfully performed. Fix this by returning a negative value from the > > cpufreq_boost_set_sw() if actual error was encountered and zero > > otherwise treating any positive values as the successful operations > > completion. > > > > Fixes: 18c49926c4bf ("cpufreq: Add QoS requests for userspace constraints") > > Signed-off-by: Serge Semin > > Acked-by: Viresh Kumar > > Cc: Alexey Malahov > > Cc: Thomas Bogendoerfer > > Cc: Paul Burton > > Cc: Ralf Baechle > > Cc: Arnd Bergmann > > Cc: Rob Herring > > Cc: linux-mips@vger.kernel.org > > Cc: devicetree@vger.kernel.org > > Cc: stable@vger.kernel.org > > --- > > drivers/cpufreq/cpufreq.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c > > index 045f9fe157ce..5870cdca88cf 100644 > > --- a/drivers/cpufreq/cpufreq.c > > +++ b/drivers/cpufreq/cpufreq.c > > @@ -2554,7 +2554,7 @@ static int cpufreq_boost_set_sw(int state) > > break; > > } > > - return ret; > > + return ret < 0 ? ret : 0; > > } > > int cpufreq_boost_trigger_state(int state) > > IMO it is better to update the caller of this function to handle the > positive value possibly returned by it correctly. Could you elaborate why? Viresh seems to be ok with this solution. As I see it the caller doesn't expect the positive value returned by the original freq_qos_update_request(). It just doesn't need to know whether the effective policy has been updated or not, it only needs to make sure the operations has been successful. Moreover the positive value is related only to the !last! active policy, which doesn't give the caller a full picture of the policy change anyway. So taking all of these into account I'd leave the fix as is. Regards, -Sergey > > Thanks! > >