Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp4302446pxt; Wed, 11 Aug 2021 02:52:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJylImzRaKAigEODqrqZqmpO+LYgkw5VOebrBcxfI1Qnlrfavb22ZXwEFU+1BTMRQEEr4coF X-Received: by 2002:a17:906:4784:: with SMTP id cw4mr2784923ejc.160.1628675575250; Wed, 11 Aug 2021 02:52:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628675575; cv=none; d=google.com; s=arc-20160816; b=LB8ckS+JAVUZZaeTbrzXT1U1CB42fNm1V/EfXDREiJOzV1PPkVEKYn2dz19PvVqr3t Yh1e1UOaUVIH+ZMyCwdYnUiM1jpi9qNE+kOf8CcnTKmUHzNIL05jyZbgN4K9u1CE6Dcg cQWc4BuCIGNJB5oUVnq88dUNBAStDB+EqGAc7K3tVzoWsE9tIMGs+fykCZZ67rUFY1mB HZ80wwYNFXyuRnzEATFzWE3OPuUIFlBETfjaPmMsNdCYhGJZ9ONFzQ1wlmCUmCDKDear PTjq9Jk11VsGOiXbaXKxl66kDdPXaNmdQ8/NdNvkBO6Pxrp7sLUdhxwZ2I6FioAtjWfG Do6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=p4WmlR24/y2/H/iFDZT8SMkW7O2fno0PSDl3vpvyQeE=; b=S2liIflbKjMI9k/aego6uzr/4kNsE1uEhk/stMaHSTwh+xRzRvMYQmbT0gO10dDqjx 5IY7h8m6scqxcnN0KX3sHJKIXHFo6D8pmoCqu9ZIaAX/YTXwC5Yt8RXwDbTZJbC83O9h Y45QlZ2BnVXMnrrpYoJf8fDS8ucRFsNJsiCXbdApCf0noiDK+z62Oc7YVYJnj8TCdOA2 h1FZrtBgrGQ9LHGOBTihS8NBjYxJB6DGMON6IHtVfvQ3+38NZ14rKLyFUClSmKmNuEm5 a4d3agFU2UIfAUoqZvlh+Oplj/TZ9aH4pJ0CX12fNyUhTHpYTMLvh6CEjMQaGiiK0fWa 8w/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=iaVC7Y7Z; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e1si22761147eji.452.2021.08.11.02.52.31; Wed, 11 Aug 2021 02:52:55 -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; dkim=pass header.i=@google.com header.s=20161025 header.b=iaVC7Y7Z; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236668AbhHKJtM (ORCPT + 99 others); Wed, 11 Aug 2021 05:49:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46942 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236719AbhHKJtL (ORCPT ); Wed, 11 Aug 2021 05:49:11 -0400 Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B8ACC061765 for ; Wed, 11 Aug 2021 02:48:47 -0700 (PDT) Received: by mail-wm1-x331.google.com with SMTP id l34-20020a05600c1d22b02902573c214807so3962107wms.2 for ; Wed, 11 Aug 2021 02:48:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=p4WmlR24/y2/H/iFDZT8SMkW7O2fno0PSDl3vpvyQeE=; b=iaVC7Y7Zmp0QcX38aol/tjPqpn4a9rxsP+5sEfJ55JdRHQf78WhTS54TvYm1QuiZb9 Tfv0V+kMCmuN3NlmWiy+TFbkP8Z36BybITbwzyiRLjWOhIIr9BHtWja4KxbVpcBPi/HI HuD68dSvDc/WEbgyaUM8PsEuId/nmfzZ9pPp60bwzZ1zayPm70ShfyqrudfelYC77Hsv lYfsQBRYWFNavWRipVgXXp3YGsoJzSPKV2/B/dz02TFMtktJ/TilyV8Jiu+vO4+FU2Ra CLbILl4Kx7dV2I8iGXshcBeO08NSv6p9CNlc4nncGiFlrwXLzL7ajuNEyVzb/lB2uvJY 953w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=p4WmlR24/y2/H/iFDZT8SMkW7O2fno0PSDl3vpvyQeE=; b=MrAeWZGb1GvIibYdgkOKZ0Tix+V7VrMI8U1LDldShSJhaj5JO3epzDQsfIbe+DRj7o /S8BqI2XyS2/+y3/H60oZwxLNxeeBWDjlTqYITTMDEbFyrYqyLbQbq0r2cBZXfvMZAM+ QQr6ZXDV2ZHp+qNiPvZxQ1F1hQZ8qUqULKk0iFvBAnWxFDWpOn5EFMDgHXMF/RY7yZbX /m0d1BwCjwf8bPMm0THlhcVVKbyOLoVFBLjzXPlho+7Sy777Or6OPR2Yp3Qd+SKLuxqz hI4fPu9i8vggz74CPEmzxWE5oMNjmB7H3hdCmFNeUX8NZHlAc2wRBceF5h8LC7B6veGC Ma+w== X-Gm-Message-State: AOAM530Sp9M1Tgmcv+/7it9P69Fioq7UBWgQRDDPmDWW0M5IX6o/I6eT IR9blpqWRfp+CHhhhFKIWmo6uA== X-Received: by 2002:a7b:c350:: with SMTP id l16mr8974823wmj.151.1628675325873; Wed, 11 Aug 2021 02:48:45 -0700 (PDT) Received: from google.com ([2a00:79e0:d:210:43fd:e634:73d9:e10e]) by smtp.gmail.com with ESMTPSA id p4sm14701093wrq.81.2021.08.11.02.48.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Aug 2021 02:48:45 -0700 (PDT) Date: Wed, 11 Aug 2021 10:48:39 +0100 From: Quentin Perret To: Viresh Kumar Cc: Rafael Wysocki , Vincent Donnefort , lukasz.luba@arm.com, Andy Gross , Bjorn Andersson , Cristian Marussi , Fabio Estevam , Kevin Hilman , Matthias Brugger , NXP Linux Team , Pengutronix Kernel Team , Sascha Hauer , Shawn Guo , Sudeep Holla , linux-pm@vger.kernel.org, Vincent Guittot , linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-omap@vger.kernel.org Subject: Re: [PATCH 0/8] cpufreq: Auto-register with energy model Message-ID: References: <20210811051859.ihjzhvrnuct2knvy@vireshk-i7> <20210811053406.jqwextgtnxhgsjd2@vireshk-i7> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210811053406.jqwextgtnxhgsjd2@vireshk-i7> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wednesday 11 Aug 2021 at 11:04:06 (+0530), Viresh Kumar wrote: > On 11-08-21, 10:48, Viresh Kumar wrote: > > On 10-08-21, 13:35, Quentin Perret wrote: > > > This series adds more code than it removes, > > > > Sadly yes :( > > > > > and the unregistration is > > > not a fix as we don't ever remove the EM tables by design, so not sure > > > either of these points are valid arguments. > > > > I think that design needs to be looked over again, it looks broken to > > me everytime I land onto this code. I wonder why we don't unregister > > stuff. > > Coming back to this series. We have two options, based on what I > proposed here: > > https://lore.kernel.org/linux-pm/20210811050327.3yxrk4kqxjjwaztx@vireshk-i7/ > > 1. Let cpufreq core register with EM on behalf of cpufreq drivers. If we're going that route, I think we should allow _all_ possible EM registration methods (via PM_OPP or else) to be done that way. Otherwise we're creating an inconsitency in how the EM is registered (e.g. from the ->init() cpufreq callback for some, or from cpufreq core for others) which is problematic as we risk building features that assume loading is done at a certain time, which won't work for some platforms. > 2. Update drivers to use ->ready() callback to do this stuff. I think this should work, but perhaps will be a bit tricky for cpufreq driver developers as they need to have a pretty good understanding of the stack to know that they should do the registration from here and not ->init() for instance. Suggested alternative: we introduce a ->register_em() callback to cpufreq_driver, and turn dev_pm_opp_of_register_em() into a valid handler for this callback. This should 'document' things a bit better, avoid some of the problems your other series tried to achieve, and allow us to call the EM registration in exactly the right place from cpufreq core. On the plus side, we could easily make this work for e.g. the SCMI driver which would only need to provide its own version of ->register_em(). Thoughts?