From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.1 required=3.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FSL_HELO_FAKE,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1, USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4756FECE588 for ; Tue, 15 Oct 2019 11:56:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 18B622067B for ; Tue, 15 Oct 2019 11:56:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="bhF8okyT" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729758AbfJOL4j (ORCPT ); Tue, 15 Oct 2019 07:56:39 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:39526 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729411AbfJOL4i (ORCPT ); Tue, 15 Oct 2019 07:56:38 -0400 Received: by mail-wr1-f65.google.com with SMTP id r3so23516410wrj.6 for ; Tue, 15 Oct 2019 04:56:36 -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:user-agent; bh=yAwedaQmhP6SnPIEV8Cz99ZuZIEK2enEAC2WtodOdw8=; b=bhF8okyTKEtKzcimYTnw/ute32N+lw/PA1aVErlt0+7GqFytvWWW/UuV9QZ+b7u9/d KdmBJouzs/udg4X3MLdcpSfC12BH0baq40PbjzQqIu41aIGSVFiHWTR3ZIEnBXuLmKPo lstQs9dPKuX1619CdQyOMPawyuMw8qAUiObWYSawPtbRjFjutB9Afy4RG7yELu16XEkT 5GPN/0bJf5l0hV8py8jMQFFR7VWohk7uW0Bgwuyfe5Zaktc45lFlWXqCqnNY3Rr2YEHv l/Dr1/eHiI5m4DOOluHL+dnLMWd5F4GrLGIBN9YWxmXnYkHni7S41YjWj+o3KOdziFK1 QQVA== 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=yAwedaQmhP6SnPIEV8Cz99ZuZIEK2enEAC2WtodOdw8=; b=lUUMgBD+AcKDUdJODw3qhgHZjmavy7K/g3TFoWBaQZl9kkHJ5KJqKFqQfVPah9NY11 1ywo8UIrd1wPv8eiIt88XmGzIHljMeHhqTSCfHgp+NKbWyOg858uqfp/VvVOYI1hDzaq CiolmUPJUdyc72M4cOw0rE2rwMUH1Rg4PNAIEuNbVA1uPIerGodlZpNyEl3kwUJsKiJG CajrtRYXqpMtGhk69cXiCDEqabuN9wD3sbzM+jnUr5bS9+/87mz6ErGWhAnOmojr92rN 2YyvJu2ONH2ZFf3NJcL95OYWn0SaiQf9VQAvf9c+X0Eb018SOEGikx90mUTTUCBlHIcx Rc9w== X-Gm-Message-State: APjAAAVyKZPQ67/5zkqvcv8FZUhXUhV49pgDKR4iEBBvL7xm+TZc63+4 k+Dz8zMWBe/D+2ySUgwJEhuCACoDP3o= X-Google-Smtp-Source: APXvYqyD0JiP5Vjzz/Ob2cl78I3RHYa2pXAFgS65YCSh3NzGL4FLqEi7nL0+DAaVfiBX1+EWTZpHfQ== X-Received: by 2002:adf:ff8e:: with SMTP id j14mr3020909wrr.178.1571140596214; Tue, 15 Oct 2019 04:56:36 -0700 (PDT) Received: from google.com ([2a00:79e0:d:210:7687:11a4:4657:121d]) by smtp.gmail.com with ESMTPSA id z9sm21434838wrl.35.2019.10.15.04.56.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Oct 2019 04:56:35 -0700 (PDT) Date: Tue, 15 Oct 2019 12:56:32 +0100 From: Quentin Perret To: Valentin Schneider Cc: linux-kernel@vger.kernel.org, mingo@kernel.org, peterz@infradead.org, vincent.guittot@linaro.org, Dietmar.Eggemann@arm.com, morten.rasmussen@arm.com, stable@vger.kernel.org Subject: Re: [PATCH v2] sched/topology: Allow sched_asym_cpucapacity to be disabled Message-ID: <20191015115632.GC242992@google.com> References: <20191015102956.20133-1-valentin.schneider@arm.com> <20191015104010.GA242992@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tuesday 15 Oct 2019 at 12:49:22 (+0100), Valentin Schneider wrote: > > > On 15/10/2019 11:58, Valentin Schneider wrote: > > On 15/10/2019 11:40, Quentin Perret wrote: > >>> @@ -2124,8 +2124,17 @@ static void detach_destroy_domains(const struct cpumask *cpu_map) > >>> int i; > >>> > >>> rcu_read_lock(); > >>> + > >>> + if (static_key_enabled(&sched_asym_cpucapacity)) { > >>> + unsigned int cpu = cpumask_any(cpu_map); > >>> + > >>> + if (rcu_dereference(per_cpu(sd_asym_cpucapacity, cpu))) > >>> + static_branch_dec_cpuslocked(&sched_asym_cpucapacity); > >> > >> Lockdep should scream for this :) > > > > Bleh, yes indeed... > > > > Urgh, I forgot about the funny hotplug lock scenario at boot time. > rebuild_sched_domains() takes the lock but sched_init_domains() doesn't, so > we don't get the might_sleep warn at boot time. > > So if we want to flip the key post boot time we probably need to separately > count our asymmetric root domains and flip the key after all the rebuilds, > outside of the hotplug lock. Hmm, a problem here is that static_branch*() can block (it uses a mutex) while you're in the rcu section, I think. I suppose you could just move this above rcu_read_lock() and use rcu_access_pointer() instead ? Thanks, Quentin