Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp4264058pxt; Wed, 11 Aug 2021 01:41:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx+R3nfe2EzDHinpj3DCE0bpg8UGlMYb4tZF3O7hBjyb8803AyS5Q4mobVG4pXwZRQaB44d X-Received: by 2002:a05:6402:2883:: with SMTP id eg3mr7019565edb.278.1628671298648; Wed, 11 Aug 2021 01:41:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628671298; cv=none; d=google.com; s=arc-20160816; b=lzh4zd4MmTm+BtO+sQCC0+h/5Vp1log/7bCKtUAq0Kte0Pk3nPDy68nLmz79fHwyXf uK6VNkpjg3790+KbrnhfF2j1AHRb7mbq/QlF9cboBh+0rReOXlk/nvy5RrnFMA6vrPiM k3dTc25SonJHmrEwI8ysIrvJNkO7E4hjsr48e/U4JAUbvyty8hRrNSqEguPL0WpmQOYc yBxLhkpGLEj/NZp6V32XbwJ6/m+igTa5T4lxnJiVUe2quX43onOfcHI+OryV6VVr6N7i g2C72tBJgf1RDv2u1L/SU+IPOjoHPAUTjz4IFSNbsb6BERGyZ3ukKSb2jTocDl+t1xZ4 SGKA== 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=8ctvExXHxoU7MDz0lLq/Tgi84JQatciTVAxD+Fn/jcQ=; b=KgLlrUmK530h5BoMwKYo75xf5JWbdd2OwSPfLFVrTV8dq9TlGaoKN/QP5Bsfs43tQz b2Uh+GtH+b328pZMn7G2H7mjsr0Nitikgc4yQWJmte/beFwfaW+fMV9nidjX0IQy0OL7 1RNoir5zlYk4awiLFZyWCHbguA8VTkEfG9AeLTMYzDmziZlEGV7nImbAyWlK6XXlGLv/ KF1qrEE/IacRuQ099gFCTMoAuAkEsn6f0xDXYwKlsyWZUN8UxBHvwQjuvfXqDh8shiHk UoTOIFsrbvywZEO0vl4zh86m1zVJpn5gWCvHshT0M1PdvNEZUancSeIUAB1O70gOA8E1 3eTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=rEq02tPe; 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 ec14si9662421edb.84.2021.08.11.01.41.15; Wed, 11 Aug 2021 01:41:38 -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=rEq02tPe; 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 S235935AbhHKIi2 (ORCPT + 99 others); Wed, 11 Aug 2021 04:38:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58450 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236041AbhHKIi1 (ORCPT ); Wed, 11 Aug 2021 04:38:27 -0400 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 78D99C061798 for ; Wed, 11 Aug 2021 01:38:04 -0700 (PDT) Received: by mail-wr1-x436.google.com with SMTP id q10so1940243wro.2 for ; Wed, 11 Aug 2021 01:38:04 -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=8ctvExXHxoU7MDz0lLq/Tgi84JQatciTVAxD+Fn/jcQ=; b=rEq02tPeUoTDMJlCRt+ttFdA0Jr7daFhR+2ie5RBcOI3BzWNUuUWa9Gbkn4HGOW7WY 4dGznTdp6VXTPNE9W13rtYzeqx7tx7wQ393pENejnQSXz9eLj1RNBFRM1k3jq7xv7egq HC0wLX7Gfq1JdtcjNVDY4wLVGIFgnDphxa8SKvMeE6pZoYh5aVDsC/sruC06SYWsY3uM J7cw2lg+GbQUi7uuzGE1t6Q0KYY1VP89pD3oxKNUKWXB+QlwgXjHIwdMYwDYJtjhm4GA VV1DzVJB/z5IitVlWxedaVu1jjrQLyAUK9KtmHXlZnADSSCcDIKhD2TqwcqLbaym+Na8 XOdg== 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=8ctvExXHxoU7MDz0lLq/Tgi84JQatciTVAxD+Fn/jcQ=; b=YMbmFym2hXew8RBcErDvF79h9ycyhhN5W8qG6ZbcxkSnsuXKZF2f8VVWfrDs4I45li 0v7Fc7IpNv54IVGxJA1P1yoU9qRRZHpBxH4SQIkpsiL7TgU8WlFTRTtLc+j1Uvp0LK0A 8sRsi2SF1i/5BDcKE8qrhCH/Gl3Egfzzm5I6lZFpa2y16Gc+q6irX6Jg/WZtY9w10T1q okC2bNYv7PO6XmN/45gIONkEcW6tkdKb0RBLxfNv7hScOYppilr61tXoHWzl31TxjOId 23FwSazzW66oXAoHX0aS2xQK47ugkFCfqX0R/5gqON3AlUlgUAm2oUUdhuJ97ZcI7ns2 fh0g== X-Gm-Message-State: AOAM533QlIHgcSMVQJZM0ihnumZuFSggPsby1m6VxHim6tFAST+2X3lM HBMhkg3QvihY+EAI0WAjgQf8WQ== X-Received: by 2002:a5d:490b:: with SMTP id x11mr35305440wrq.322.1628671082736; Wed, 11 Aug 2021 01:38:02 -0700 (PDT) Received: from google.com ([2a00:79e0:d:210:43fd:e634:73d9:e10e]) by smtp.gmail.com with ESMTPSA id e25sm13986334wra.90.2021.08.11.01.38.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Aug 2021 01:38:02 -0700 (PDT) Date: Wed, 11 Aug 2021 09:37:56 +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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210811051859.ihjzhvrnuct2knvy@vireshk-i7> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wednesday 11 Aug 2021 at 10:48:59 (+0530), Viresh Kumar wrote: > On 10-08-21, 13:35, Quentin Perret wrote: > > On Tuesday 10 Aug 2021 at 13:06:47 (+0530), Viresh Kumar wrote: > > > Provide a cpufreq driver flag so drivers can ask the cpufreq core to register > > > with the EM core on their behalf. > > > > Hmm, that's not quite what this does. This asks the cpufreq core to > > use *PM_OPP* to register an EM, which I think is kinda wrong to do from > > there IMO. The decision to use PM_OPP or another mechanism to register > > an EM belongs to platform specific code (drivers), so it is odd for the > > PM_OPP registration to have its own cpufreq flag but not the other ways. > > > > As mentioned in another thread, the very reason to have PM_EM is to not > > depend on PM_OPP, so I'm worried about the direction of travel with this > > series TBH. > > I had to use the pm-opp version, since almost everyone was using that. > > On the other hand, there isn't a lot of OPP specific stuff in > dev_pm_opp_of_register_em(). It just uses dev_pm_opp_get_opp_count(), > that's all. This ended up in the OPP core, nothing else. Maybe we can > now move it back to the EM core and name it differently ? Well it also uses dev_pm_opp_find_freq_ceil() and dev_pm_opp_get_voltage(), so not sure how easy it will be to move, but if it is possible no objection from me. > > > This allows us to get rid of duplicated code > > > in the drivers and fix the unregistration part as well, which none of the > > > drivers have done until now. > > > > 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. > > Lets say, I am working on the cpufreq driver and I want to test that > on my ARM machine. Rebooting a simpler board to test stuff out is > easy, but if I am working on an ARM server which is running lots of > other userspace stuff as well, I won't want to reboot the machine just > to test a different versions of the driver. I will rather want to > build the driver as module and insert/remove it again and again. > > If the frequency table changes in between versions, this just breaks > as EM won't be updated again. > > This breaks one of the most basic rules of Linux Kernel. Inserting a > module should have exactly the same final behavior every single time. > This model doesn't guarantee it. It simply looks broken. Right but the EM is a description of the hardware, so it seemed fair to assume this wouldn't change across the lifetime of the OS, similar to the DT which we can't reload at run-time. Yes it can be a little odd if you load/unload your driver module, but note that you generally can't load two completely different drivers on a single system. You'll just load the same one again and the hardware hasn't changed in the meantime, so the previously loaded EM will still be correct. I hear your argument about cpufreq driver development, but the locking involved to allow 'just' that is pretty involved, and nobody has complained about this specific issue so far, so that didn't seem worth it. If we do have good reasons to change the EM at runtime, then yes I think we should do it, it just didn't seem like that was the case until now.