Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1785857imm; Sat, 9 Jun 2018 01:24:59 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIr63LICuobPQaJn3eAcCIOG1Q3wUWkzSHZuZWd0ipxoHOHEBeOcwQYBHRocy1zUQATgx/M X-Received: by 2002:a63:7f15:: with SMTP id a21-v6mr7984637pgd.21.1528532699918; Sat, 09 Jun 2018 01:24:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528532699; cv=none; d=google.com; s=arc-20160816; b=dMgjqYlNVjUgnEOdSkGdUtSEp+4JLa9FdQ7e7k/wdAruCwNMoPF01t6MMmFniMPkR3 P6HRn5Kqc9or6xDG4YJtplxYHdPM3Y/IlzHLQgWebokMAtK93MsO9sFbwo8bqC8BECb8 ruyLhK6punmZspQzehG+am+ZmIWSaR87l3FTUdzixiD0Cqzg3JcAnyEM7txiRBJYWZe7 QJUYicbOCOxLkGsm4Yk3BMTUNmPU35GGZUugiQ2LEcMw0uq937ywr1Od7gJ5yZaX2iaR s9HO9bhPMq2xx80YSN/2L4g7XV0rJSwvYEkdtWe9Shz2YtcZtxTI5QThalrbYKhxjm+3 ECEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=Sh0bcqL+6/IYXQKK1OlJ3pPD6BMrLeOULZEwOQ3Yw0U=; b=fmrg426QzsqF9C3q1C0GVXCwsSRRO8V4e3FQptJaAYVnS7Hzrlnx4lfyciDkha+rhg 2JoCVvZsOBfC6Dq/UnrdqzrHOu7v+yjIJqejVmpd8/1Of+mZL4jEWTxuMLltrs3ki1sw P3BzVexOBlE/G8nO8WTWwX21PBW1UHIE2wNPNjK4XnUnTgl17Up/rYQdZIWTlEpx6HPG RU4lHb5drHOgSSNxpKfYGEEy8LPZ4JpsTkkjjFVolF+Iz/+9rWAVcizSQ2HcJxoaQhnN CY5mJbIOeI5SrqYeaPiqo6lvwK2coSvxSFOGMtnRbstO+J/IN26nbOpI7Eu42fjtEpMz 30TA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y40-v6si58953911pla.470.2018.06.09.01.24.44; Sat, 09 Jun 2018 01:24:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753247AbeFIIYN (ORCPT + 99 others); Sat, 9 Jun 2018 04:24:13 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:55703 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753192AbeFIIYK (ORCPT ); Sat, 9 Jun 2018 04:24:10 -0400 Received: by mail-wm0-f66.google.com with SMTP id v16-v6so6839678wmh.5; Sat, 09 Jun 2018 01:24:09 -0700 (PDT) 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:user-agent; bh=Sh0bcqL+6/IYXQKK1OlJ3pPD6BMrLeOULZEwOQ3Yw0U=; b=dXioIY6XQDR+OK5vQSGglsVLNyKZhESHauENiUpzVJGSuVcd/12J8eYN78O5q5rYbC BYI0yxhDjyZ4hzvxjwplo9XRRHfvDb+KkZ1TOAqHMB4AnlUWsPwI2cp9sKWWzkNoSOam QEjOGNtTucLcVKokUGaAk89eORMNvqn60tBqp7lxzyOR9SPSAlyIP4DMXI3+EleRM0pY RZDE+64XQAPzDGT017a854A9sBWx0gzs6y9coszQ7UNjfuaxESKiFy6pmS8eL0FCIf9o /xHRtHOIZWL1hDeWa+dD+vmxO4Ffzd+1vabcE+pJTLKAd5YO6GXndIskAg/VGxNE9PwQ SA2w== X-Gm-Message-State: APt69E2T3LoMouXIPbg+we4f0CCb6gwL301tbxz9KO70776HFfun/1Cr 3jPhPV0vgkkGl8otDHufMQ== X-Received: by 2002:a1c:20c7:: with SMTP id g190-v6mr3692628wmg.2.1528532649236; Sat, 09 Jun 2018 01:24:09 -0700 (PDT) Received: from tesla (2.154.108.25.dyn.user.ono.com. [2.154.108.25]) by smtp.googlemail.com with ESMTPSA id u11-v6sm4333018wrq.68.2018.06.09.01.24.07 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 09 Jun 2018 01:24:07 -0700 (PDT) Received: from javi by tesla with local (Exim 4.91) (envelope-from ) id 1fRZAM-0006I8-LC; Sat, 09 Jun 2018 10:24:06 +0200 Date: Sat, 9 Jun 2018 10:24:06 +0200 From: Javi Merino To: Quentin Perret Cc: Juri Lelli , Dietmar Eggemann , peterz@infradead.org, rjw@rjwysocki.net, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, mingo@redhat.com, morten.rasmussen@arm.com, chris.redpath@arm.com, patrick.bellasi@arm.com, valentin.schneider@arm.com, vincent.guittot@linaro.org, thara.gopinath@linaro.org, viresh.kumar@linaro.org, tkjos@google.com, joelaf@google.com, smuckle@google.com, adharmap@quicinc.com, skannan@quicinc.com, pkondeti@codeaurora.org, edubezval@gmail.com, srinivas.pandruvada@linux.intel.com, currojerez@riseup.net Subject: Re: [RFC PATCH v3 03/10] PM: Introduce an Energy Model management framework Message-ID: <20180609082406.GD4359@tesla> References: <20180521142505.6522-1-quentin.perret@arm.com> <20180521142505.6522-4-quentin.perret@arm.com> <20180606143739.GF10870@e108498-lin.cambridge.arm.com> <20180606152000.GB15894@localhost.localdomain> <20180606152950.GH10870@e108498-lin.cambridge.arm.com> <20180606162647.GI10870@e108498-lin.cambridge.arm.com> <20180608133942.GB4359@tesla> <20180608154738.GB7838@e108498-lin.cambridge.arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20180608154738.GB7838@e108498-lin.cambridge.arm.com> User-Agent: Mutt/1.10.0 (2018-05-17) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 08, 2018 at 04:47:39PM +0100, Quentin Perret wrote: > Hi Javi, > > On Friday 08 Jun 2018 at 14:39:42 (+0100), Javi Merino wrote: > > On Wed, Jun 06, 2018 at 05:26:47PM +0100, Quentin Perret wrote: > > > On Wednesday 06 Jun 2018 at 16:29:50 (+0100), Quentin Perret wrote: > > > > On Wednesday 06 Jun 2018 at 17:20:00 (+0200), Juri Lelli wrote: > > > > > > > This brings me to another question. Let's say there are multiple users of > > > > > > > the Energy Model in the system. Shouldn't the units of frequency and power > > > > > > > not standardized, maybe Mhz and mW? > > > > > > > The task scheduler doesn't care since it is only interested in power diffs > > > > > > > but other user might do. > > > > > > > > > > > > So the good thing about specifying units is that we can probably assume > > > > > > ranges on the values. If the power is in mW, assuming that we're talking > > > > > > about a single CPU, it'll probably fit in 16 bits. 65W/core should be > > > > > > a reasonable upper-bound ? > > > > > > But there are also vendors who might not be happy with disclosing absolute > > > > > > values ... These are sometimes considered sensitive and only relative > > > > > > numbers are discussed publicly. Now, you can also argue that we already > > > > > > have units specified in IPA for ex, and that it doesn't really matter if > > > > > > a driver "lies" about the real value, as long as the ratios are correct. > > > > > > And I guess that anyone can do measurement on the hardware and get those > > > > > > values anyway. So specifying a unit (mW) for the power is probably a > > > > > > good idea. > > > > > > > > > > Mmm, I remember we fought quite a bit while getting capacity-dmpis-mhz > > > > > binding accepted, and one of the musts was that the values were going to > > > > > be normalized. So, normalized power values again maybe? > > > > > > > > Hmmm, that's a very good point ... There should be no problems on the > > > > scheduler side -- we're only interested in correct ratios. But I'm not > > > > sure on the thermal side ... I will double check that. > > > > > > So, IPA needs to compare the power of the CPUs with the power of other > > > things (e.g. GPUs). So we can't normalize the power of the CPUs without > > > normalizing in the same scale the power of the other devices. I see two > > > possibilities: > > > > > > 1) we don't normalize the CPU power values, we specify them in mW, and > > > we document (and maybe throw a warning if we see an issue at runtime) > > > the max range of values. The max expected power for a single core > > > could be 65K for ex (16bits). And based on that we can verify > > > overflow and precision issues in the algorithms, and we keep it easy > > > to compare the CPU power numbers with other devices. > > > > > > 2) we normalize the power values, but that means that the EM framework > > > has to manage not only CPUs, but also other types of devices, and > > > normalized their power values as well. That's required to keep the > > > scale consistent across all of them, and keep comparisons doable. > > > But if we do this, we still have to keep a normalized and a "raw" > > > version of the power for all devices. And the "raw" power must still > > > be in the same unit across all devices, otherwise the re-scaling is > > > broken. The main benefit of doing this is that the range of > > > acceptable "raw" power values can be larger, probably 32bits, and > > > that the precision of the normalized range is arbitrary. > > > > > > I feel like 2) involves a lot of complexity, and not so many benefits, > > > so I'd be happy to go with 1). Unless I forgot something ? > > > > From the thermal point of view, the power values don't need to have > > any given unit, as long as the values are comparable to each other. > > OK, thanks for confirming that :-) > > > Do we need to normalize anything in the kernel though? Can't we just > > assume that whatever the platform is telling us is correct? Quentin > > mentioned it earlier: sometimes absolute values are considered > > sensitive and we only get ones that are correct relative to the rest > > of the system. > > I'm happy to specify the units as mW and let the drivers lie about the > true values. At least that helps them lie coherently if another > subsystem requires power in uW for example. I think this is a good option. Cheers, Javi