Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp2585984ybk; Mon, 18 May 2020 02:55:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwHShEqWInULqavNVEAnsTxCMu3cBWIUKsrsEGI6Q6/fIrprQ4XpLCG1d7LVD6t2WqWg3qx X-Received: by 2002:a17:906:c344:: with SMTP id ci4mr5799672ejb.331.1589795721566; Mon, 18 May 2020 02:55:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589795721; cv=none; d=google.com; s=arc-20160816; b=ZZ3tvO2V5vyFnavBtzMI4GByXR6QHVKjXITIWHDAQQjyuBLcnvtsdjoislJUfbOkpK 7J6B6nU7nnGVqb18ApfPnzBCbnaS+WVidouPN6Rqs2oXwuGfT6B6pyfhb5Ic+EuueQDv vl/gpmtALJdlMYxtDTtgi+B3Ob9fqh0svwoMF6AKxoDRMhI7IwuW8fmDAmZyVI053VKw BZYZcSUx7RTLh3WTwBly3jsaAjtABuCQeM9OQEuLgUsTzLGDsYiFNctKlDYYLZEh9MQe yOz3/NIvyPwZ3uzZUyWBJXOD6/NZva0Ngd8uPs3VorRf+oJ0VapgwwtHUW6qryXq9KfV Z5kw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:organization:from:references:cc:to:subject:ironport-sdr :ironport-sdr; bh=AWMQWdt/npcB8Ec5qnTK70M9w+oIUL+rAmsWeAD4biE=; b=FJOiGjG5yN5jccWvFXbrFir8SCl7pLVZPB2bU6NplPleRwcJQEkEUeN4dpmLcxz3D5 zyjMYJZ8Fiq+JfcyKu3dxH9vqv/btM0a4/GvscKlYj5A+tW7MC37qsUsBoO1VWz7KMxL cadF2olJg1gUtJ7hvtkoY0qGiRK5K917q3FIJFatBlWRj5om6pDvrQV6OFbgbT7cZmjV l0AdkDD1nyOQgZ2Td5JPkocSiUH3GtVt3vHmydsiEindPxpoIHz2I27xu0/xtJ1mki/D G89pUw3W3NfZphacbNkn2GB/VCZaX0nJ8gUAYte8lPQDPz9CGU9D6mzGZzWbJ9krJmZO O4Dg== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ob21si6499205ejb.522.2020.05.18.02.54.57; Mon, 18 May 2020 02:55:21 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726494AbgERJx3 (ORCPT + 99 others); Mon, 18 May 2020 05:53:29 -0400 Received: from mga07.intel.com ([134.134.136.100]:29861 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726127AbgERJx2 (ORCPT ); Mon, 18 May 2020 05:53:28 -0400 IronPort-SDR: fOjCcUXM30INFO0ZwLVMQwn3+o3YQtSBOVuGF3mmX3lnNvlIX0vDS3dHB4tjpbW6kaABYLmnlQ 2ezaBRLQDbiA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 May 2020 02:53:28 -0700 IronPort-SDR: IPxhcZLdyUPpSJDtRywqmENMCEXb8iNw2LOGME7vov3Pi2g/kBh+2kmc4fcyM75/P26UqVcqln tzZ03x2Y4dtA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,406,1583222400"; d="scan'208";a="281919241" Received: from rjwysock-mobl1.ger.corp.intel.com (HELO [10.249.149.12]) ([10.249.149.12]) by orsmga002.jf.intel.com with ESMTP; 18 May 2020 02:53:22 -0700 Subject: Re: [PATCH v2 20/20] cpufreq: Return zero on success in boost sw setting To: Viresh Kumar , Serge Semin Cc: Serge Semin , Thomas Bogendoerfer , "Rafael J. Wysocki" , Ulf Hansson , Matthias Kaehlcke , Alexey Malahov , Paul Burton , Ralf Baechle , Arnd Bergmann , Rob Herring , linux-mips@vger.kernel.org, devicetree@vger.kernel.org, stable@vger.kernel.org, Frederic Weisbecker , Ingo Molnar , Yue Hu , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org References: <20200306124807.3596F80307C2@mail.baikalelectronics.ru> <20200506174238.15385-1-Sergey.Semin@baikalelectronics.ru> <20200506174238.15385-21-Sergey.Semin@baikalelectronics.ru> <20200516125203.et5gkv6ullkerjyd@mobilestation> <20200518074142.c6kbofpdlxro2pjz@vireshk-i7> From: "Rafael J. Wysocki" Organization: Intel Technology Poland Sp. z o. o., KRS 101882, ul. Slowackiego 173, 80-298 Gdansk Message-ID: Date: Mon, 18 May 2020 11:53:22 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: <20200518074142.c6kbofpdlxro2pjz@vireshk-i7> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/18/2020 9:41 AM, Viresh Kumar wrote: > On 16-05-20, 15:52, Serge Semin wrote: >> On Fri, May 15, 2020 at 05:58:47PM +0200, Rafael J. Wysocki wrote: >>>> @@ -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. > And it is absolutely fine for Rafael to not agree with it :) > >> 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. > Rafael: This function is called via a function pointer, which can call > this or a platform dependent routine (like in acpi-cpufreq.c), and it > would be reasonable IMO for the return of that callback to only look > for 0 or negative values, as is generally done in the kernel. But it only has one caller that can easily check ret < 0 instead of just ret, so the extra branch can be saved. That said if you really only want it to return 0 on success, you may as well add a ret = 0; statement (with a comment explaining why it is needed) after the last break in the loop. Cheers!