Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2070430pxa; Mon, 3 Aug 2020 06:48:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzdu6oxI542lrRdq4MDT/GcNzUufCGmiXrWOSesQwQzGK6QnKqBdVXS7EXhRbnVyKxyEZef X-Received: by 2002:a50:bf07:: with SMTP id f7mr16190740edk.356.1596462522516; Mon, 03 Aug 2020 06:48:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596462522; cv=none; d=google.com; s=arc-20160816; b=zHIuEB9pUAwQz4RUD9+Rv544KJ6mTLFe7xo+oo1C6E7gRRrgCUM/NeNzi9bJkBAyJ5 E9aKeRxzghjs8NRWkPTfDk/G79S6pKvsnhFZWSRDo3kufClDxF3OIYMlcB7SKXk0D2M6 1iZJwP2Hjuju3XuTUe3Re3rDq/82XD/LL706xcswa7TJA/CE1Fwct6VPPmu+V6lTG1KP uvWq2Ngs+/z3kMRG+dxqEAF2wM7JVJps5Eu/jOfLcl0hjXGWMqQT8HxmvPKCqRGWDYYa q3ZwVlap4Oft+pPI10H0fH051vR6Wd0geCoq9jYx8B9rhN2bqLXnhPkvgFE3jxFaEBB1 itRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=h8dgWfdFWbvh9ZWZ1ZNBTHX4VAGf175AsYQyWP17dNI=; b=dcvSzWxtQevAVImixHVTbSoxaomWBf853RumAu9sfHr/poT5jA9kXAkSwPpeDUhzWx XLfb9xC0ZiwosE+nR3vkR7sG5r0+DlcOV4SheQKUzHtvub5asFOujBDspcVVB1WUyGwt wT2cD56sAhFEhxv+YCFpsxvH3qDnPqgBRQJOADHUWoEpLVR/SidNxJyNVkSxLd74v8Tn gPo3Ng1vbO2CDQjkATFPQ20XoZ97ZpO3tqBkmESBPhsq7NUGZjOu+L2mDBqxPuZH7V2t FA3l+TVYkJ+hfLvnOl0B9K4yrS+hUY5kGviIvJAqMtkdV+cflKzCiAPSH1oU08OMXEz/ cRGw== 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id mb9si10170829ejb.536.2020.08.03.06.48.19; Mon, 03 Aug 2020 06:48:42 -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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727855AbgHCNrM (ORCPT + 99 others); Mon, 3 Aug 2020 09:47:12 -0400 Received: from mail-oi1-f193.google.com ([209.85.167.193]:38118 "EHLO mail-oi1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727790AbgHCNrL (ORCPT ); Mon, 3 Aug 2020 09:47:11 -0400 Received: by mail-oi1-f193.google.com with SMTP id u63so21515204oie.5; Mon, 03 Aug 2020 06:47:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=h8dgWfdFWbvh9ZWZ1ZNBTHX4VAGf175AsYQyWP17dNI=; b=RaSbfZuS52aO3YmqbAr3ZVDPgLhOeWHaJ+jj31gcLJE5P/JL5j+J/fDhbJtFpq+kil QmLU+f2mFk/zKJoRRlaXaDPaqpmPuGEM1E1Jp6xjXrzKwSdaLcHKxQgGjFyCjGLlPzKn fQmhDf7pZlbEo22R/CyTeqgc+AR0ewx/gvAouFb1SBsE6ajx7jjhTgyyiuQvvPU8z8S/ Qbt82EPkarhouJBklY4uniK5VzCCpIQqSev3zWegmKmMHVo0hBmRjEIrlE3e5E9Pkmdp YLWe+N5ykTdT17/b6963lqAolfvrWoVuUX9XRc1D2TLqnJJibT0owIpUhbKL4noV4fIN xKuw== X-Gm-Message-State: AOAM530cQBS2uTzw82PoVB7TQMmsi9iLb8RkAJS1vlcMrafgU2utQZFH rN06kQwyAzx+FyArtaIF2hW1Z4poWf9udFys+L4= X-Received: by 2002:a54:4f14:: with SMTP id e20mr10487303oiy.103.1596462430736; Mon, 03 Aug 2020 06:47:10 -0700 (PDT) MIME-Version: 1.0 References: <20200722093732.14297-1-ionela.voinescu@arm.com> <20200722093732.14297-2-ionela.voinescu@arm.com> <20200730034128.k4fmblfuwjcmqdze@vireshk-mac-ubuntu> <20200803132617.GA9512@arm.com> In-Reply-To: <20200803132617.GA9512@arm.com> From: "Rafael J. Wysocki" Date: Mon, 3 Aug 2020 15:46:59 +0200 Message-ID: Subject: Re: [PATCH v2 1/7] cpufreq: move invariance setter calls in cpufreq core To: Ionela Voinescu Cc: Viresh Kumar , "Rafael J. Wysocki" , "Rafael J. Wysocki" , Dietmar Eggemann , Catalin Marinas , Sudeep Holla , Will Deacon , Russell King - ARM Linux , Ingo Molnar , Peter Zijlstra , Linux PM , Linux ARM , Linux Kernel Mailing List , Valentin Schneider Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 3, 2020 at 3:26 PM Ionela Voinescu wrote: > > Hi guys, > > On Thursday 30 Jul 2020 at 09:11:28 (+0530), Viresh Kumar wrote: > > On 27-07-20, 15:48, Rafael J. Wysocki wrote: > > > On Wed, Jul 22, 2020 at 11:38 AM Ionela Voinescu > > > wrote: > > > > diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c > > > > index 036f4cc42ede..bac4101546db 100644 > > > > --- a/drivers/cpufreq/cpufreq.c > > > > +++ b/drivers/cpufreq/cpufreq.c > > > > @@ -2058,9 +2058,16 @@ EXPORT_SYMBOL(cpufreq_unregister_notifier); > > > > unsigned int cpufreq_driver_fast_switch(struct cpufreq_policy *policy, > > > > unsigned int target_freq) > > > > { > > > > + unsigned int freq; > > > > + > > > > target_freq = clamp_val(target_freq, policy->min, policy->max); > > > > + freq = cpufreq_driver->fast_switch(policy, target_freq); > > > > + > > > > + if (freq) > > > > + arch_set_freq_scale(policy->related_cpus, freq, > > > > + policy->cpuinfo.max_freq); > > > > > > Why can't arch_set_freq_scale() handle freq == 0? > > > > Sorry, I seem to have missed this question the first time around. > > arch_set_freq_scale() could handle freq == 0, but given that freq == 0 > is signaling an error here, I do believe this check is well placed, to > prevent a useless call to arch_set_freq_scale(). Also [1]: So let me rephrase: Doesn't this check add overhead in the empty arch_set_freq_scale() case?