Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1690747ybb; Thu, 9 Apr 2020 07:15:52 -0700 (PDT) X-Google-Smtp-Source: APiQypIr9qBgfTI9SDgggf9MopDG2O4NOFZD88z6RKvhgiYERsnwa0CuhdZWen5UiJkBoKJv2e7g X-Received: by 2002:a0c:ec47:: with SMTP id n7mr171028qvq.209.1586441751688; Thu, 09 Apr 2020 07:15:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586441751; cv=none; d=google.com; s=arc-20160816; b=Sf9P8onpGMAuVH5SgkULMzF/cPhp8DeHVzxw9FAytUJ0D/I/8worxZvrjd3CZHFTZ6 btN3Cvff4owpw3VC7mNNVK+fpb1fXlktj9nwfMOl8CqEBMLDWqIUkCMMkJGuEltH2xIz N9BPXszLc6/kspDpVV3adNSX4PTOX3K1Xk6d/JQQy59SiI/6ehE2TMuZ4Xne5kUAJl9S S44bxIZrBEzwxlt7q+bOmnwt0j2UAaWAYa5xEiYaXwoNfGoDoNUIVnFP7F4QCGIeJahz nz5qk434v4Zzfa9EGINXyBvsHcb0EggswGmGzYqiM6W97Zzggmoz3lg8M5a7DUGLO28M nz0w== 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:dkim-signature; bh=4S3HX591o8/xcYJ4XU8XYvNjiwmEXUx35NNSt95/Fjc=; b=fngJQnvSSFqcv2WuFq2gkQ0Ok3zcBsNJbo2GXKdpke7rY5r4TteJ/u19E80v8Cjhj1 GYR8dO2wbXd+mkegmLd1uC4eKjeK1B+pEAUppSqELrfIxAJtQafNG3TwfwQWpG4bhMkt pdIha0F15TQDYR3bVVnZUxg45e4mmFHkqjXAMpt2MDPZI71G+tjws7/5ikvWR5ylvFbJ 3AQKoQLoAxVX9t8OTDnOF8E72WDfDSMYWDOhHh5iH2JlWE6cP4+iBHSTP6bkagFa/u/G Gcp2qNWydZRCWxPmzSdvzDCkAbZOnMNEbvFWdduOh3D3apt01ueJaAB8C5zXHYukFf+R zgrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kYetJAgd; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n29si5591426qtc.55.2020.04.09.07.15.28; Thu, 09 Apr 2020 07:15:51 -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; dkim=pass header.i=@linaro.org header.s=google header.b=kYetJAgd; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727573AbgDIOOP (ORCPT + 99 others); Thu, 9 Apr 2020 10:14:15 -0400 Received: from mail-lf1-f66.google.com ([209.85.167.66]:44563 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726552AbgDIOOO (ORCPT ); Thu, 9 Apr 2020 10:14:14 -0400 Received: by mail-lf1-f66.google.com with SMTP id 131so7977355lfh.11 for ; Thu, 09 Apr 2020 07:14:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=4S3HX591o8/xcYJ4XU8XYvNjiwmEXUx35NNSt95/Fjc=; b=kYetJAgd6bjPTJ2QgJ3rcqCBlnniSqZ4/o3Dc8YagTnpRM4BbGIUttUIzP+qt5ML51 4Z63bOY09q66wVz+cnbKMPcsw9xfMaaUObwm0UnaU9hFQBeb8SE3CkTJWf7Fk0EevzSd 3x5tiR4mfVQ4kbyQOvh66/fub84dDSc0MeywPd95loch/hvD2L9VGWar5TLZRKeQI9dF UtPTguasOGyA79CzwySGjPL21/ENR8hu92yYfMKooIHJrJop7dy4oY5uByG5zi40GZL1 vIjtlkMEwJkH0XbviAkFpZEp49/Ae83IlRCR330ga3xN+cRa87ful08JuygEC6AlkJIN rN0w== 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=4S3HX591o8/xcYJ4XU8XYvNjiwmEXUx35NNSt95/Fjc=; b=ZeyOsh/T7Gbz05sZcteu4CunebOex0XXHcajRMjKqTFT6iC/bD9tT3gplUrriKxRYd nTQnNz2cGJeLDjTQ4VyTdfOutNBcPINxJW87ocxh/jKWpP1F0btmVnn1WBvDzmElx6jw G+jsfr4ZNyP3ZOzQPlmeWe1TAD9AcAxqCHAaZL6OOn48Urb/rxuRs/j7VvWl7j+b2kSa vXoz6ZNaX212pF+S+vvsaR8Cs2x/z6P1xxKSfuyc2UOFzBpeG5/jLGWObyEwHVj3m691 vzpj3T8cgj6NyLNiqSlIZCoadasbaWn/ig/FKRJxMiOKCdh4D/O1BuegH5vaO2AqkG8n 2CyA== X-Gm-Message-State: AGi0PuYelJTuiGSD/5qd55j6UjIsw7EqJUAfPIn5GgxQVgM10GRlQM16 zStPlzG6SuPtA9K3kuHzZzfR4Al8cKTopGNlm4HU+g== X-Received: by 2002:ac2:46f9:: with SMTP id q25mr7996813lfo.149.1586441652020; Thu, 09 Apr 2020 07:14:12 -0700 (PDT) MIME-Version: 1.0 References: <20200408095012.3819-1-dietmar.eggemann@arm.com> <20200408095012.3819-2-dietmar.eggemann@arm.com> <42cc3878-4c57-96ba-3ebd-1b4d4ef87fae@arm.com> In-Reply-To: From: Vincent Guittot Date: Thu, 9 Apr 2020 16:13:58 +0200 Message-ID: Subject: Re: [PATCH 1/4] sched/topology: Store root domain CPU capacity sum To: Dietmar Eggemann Cc: Ingo Molnar , Peter Zijlstra , Juri Lelli , Steven Rostedt , Luca Abeni , Daniel Bristot de Oliveira , Wei Wang , Quentin Perret , Alessio Balsini , Pavan Kondeti , Patrick Bellasi , Morten Rasmussen , Valentin Schneider , Qais Yousef , linux-kernel 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 Thu, 9 Apr 2020 at 15:50, Dietmar Eggemann wrote: > > On 08.04.20 19:03, Vincent Guittot wrote: > > On Wed, 8 Apr 2020 at 18:31, Dietmar Eggemann wrote: > >> > >> On 08.04.20 14:29, Vincent Guittot wrote: > >>> On Wed, 8 Apr 2020 at 11:50, Dietmar Eggemann wrote: > >> > >> [...] > >> > >>>> /** > >>>> diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c > >>>> index 8344757bba6e..74b0c0fa4b1b 100644 > >>>> --- a/kernel/sched/topology.c > >>>> +++ b/kernel/sched/topology.c > >>>> @@ -2052,12 +2052,17 @@ build_sched_domains(const struct cpumask *cpu_map, struct sched_domain_attr *att > >>>> /* Attach the domains */ > >>>> rcu_read_lock(); > >>>> for_each_cpu(i, cpu_map) { > >>>> + unsigned long cap = arch_scale_cpu_capacity(i); > >>> > >>> Why do you replace the use of rq->cpu_capacity_orig by > >>> arch_scale_cpu_capacity(i) ? > >>> There is nothing about this change in the commit message > >> > >> True. And I can change this back. > >> > >> It seems though that the solution is not sufficient because of the > >> 'rd->span &nsub cpu_active_mask' issue discussed under patch 2/4. > >>ap > >> But this remind me of another question I have. > >> > >> Currently we use arch_scale_cpu_capacity() more often (16 times) than > >> capacity_orig_of()/rq->cpu_capacity_orig . > >> > >> What's hindering us to remove rq->cpu_capacity_orig and the code around > >> it and solely rely on arch_scale_cpu_capacity()? I mean the arch > >> implementation should be fast. > > > > Or we can do the opposite and only use capacity_orig_of()/rq->cpu_capacity_orig. > > > > Is there a case where the max cpu capacity changes over time ? So I > > would prefer to use cpu_capacity_orig which is a field of scheduler > > instead of always calling an external arch specific function > > I see. So far it only changes during startup. > > And it looks like that asym_cpu_capacity_level() [topology.c] would fail > if we would use capacity_orig_of() instead of arch_scale_cpu_capacity(). Yes I agree. See below > > post_init_entity_util_avg() [fair.c] and sugov_get_util() > [cpufreq_schedutil.c] would be temporarily off until > update_cpu_capacity() has updated cpu_rq(cpu)->cpu_capacity_orig. I think that we could even get rid of this update in update_cpu_capacity(). cpu_capacity_orig should be set while building the sched_domain topology because the topology itself is built based on this max cpu capacity with asym_cpu_capacity_level(). So changing the capacity without rebuilding the domain could break the sched_domain topology correctness. And we can't really set cpu_capacity_orig earlier during the boot because the capacity of b.L is set late during the boot and a rebuild of the sched_domain topology is then triggered. > > compute_energy() [fair.c] is guarded by sched_energy_enabled() from > being used at startup. > > scale_rt_capacity() could be changed in case we call it after the > cpu_rq(cpu)->cpu_capacity_orig = arch_scale_cpu_capacity(cpu) in > update_cpu_capacity(). With the removal of the update in update_cpu_capacity(), we don't have a problem anymore, isn't it ? > > The Energy Model (and CPUfreq cooling) code would need > capacity_orig_of() exported. arch_scale_cpu_capacity() currently is > exported via include/linux/sched/topology.h. Not sure that we need to export it outside scheduler, they can still use arch_scale_cpu_capacity() > > I guess Pelt and 'scale invariant Deadline bandwidth enforcement' should > continue using arch_scale_cpu_capacity() in sync with > arch_scale_freq_capacity(). Why can't they use capacity_orig_of ? we keep using arch_scale_freq_capacity() because it's dynamic but we don't really need to keep using arch_scale_cpu_capacity() > > IMHO it's hard to give clear advice when to use the one or the other. > > We probably don't want to set cpu_rq(cpu)->cpu_capacity_orig in the arch > cpu scale setter. We have arch_scale_cpu_capacity() to decouple that. Yes I agree