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=-2.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS,USER_AGENT_NEOMUTT autolearn=ham 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 9869FC433F5 for ; Mon, 10 Sep 2018 08:24:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 458B3206BB for ; Mon, 10 Sep 2018 08:24:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 458B3206BB Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727939AbeIJNRO (ORCPT ); Mon, 10 Sep 2018 09:17:14 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:52640 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727649AbeIJNRO (ORCPT ); Mon, 10 Sep 2018 09:17:14 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 6F82980D; Mon, 10 Sep 2018 01:24:22 -0700 (PDT) Received: from queper01-lin (queper01-lin.emea.arm.com [10.4.13.27]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 567373F557; Mon, 10 Sep 2018 01:24:18 -0700 (PDT) Date: Mon, 10 Sep 2018 09:24:13 +0100 From: Quentin Perret To: "Rafael J. Wysocki" Cc: "Rafael J. Wysocki" , Peter Zijlstra , Linux Kernel Mailing List , Linux PM , Greg Kroah-Hartman , Ingo Molnar , Dietmar Eggemann , Morten Rasmussen , Chris Redpath , Patrick Bellasi , Valentin Schneider , Vincent Guittot , Thara Gopinath , Viresh Kumar , Todd Kjos , Joel Fernandes , Steve Muckle , adharmap@codeaurora.org, Saravana Kannan , Pavan Kondeti , Juri Lelli , Eduardo Valentin , Srinivas Pandruvada , currojerez@riseup.net, Javi Merino Subject: Re: [PATCH v6 13/14] sched/topology: Make Energy Aware Scheduling depend on schedutil Message-ID: <20180910082411.oyedkqerxs6b7um5@queper01-lin> References: <20180820094420.26590-1-quentin.perret@arm.com> <20180906143842.xlxcg5notwdaflww@queper01-lin> <1545744.fI5ZvP8FO0@aspire.rjw.lan> <20180907152923.oxsmcqciez4yhmkk@queper01-lin> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20171215 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Rafael, On Sunday 09 Sep 2018 at 22:13:52 (+0200), Rafael J. Wysocki wrote: > On Fri, Sep 7, 2018 at 5:29 PM Quentin Perret wrote: > > On Friday 07 Sep 2018 at 10:52:01 (+0200), Rafael J. Wysocki wrote: > > > Well, why don't you implement it as something like "if the governor changes > > > from sugov to something else (or the other way around), call this function > > > from the scheduler"? > > > > I just gave it a try and ended up with the diff below. It's basically > > the exact same patch with a direct function call instead of a notifier. > > (I also tried the sugov_start/stop thing I keep mentioning but it is > > more complex, so let's see if the simplest solution could work first). > > > > What do you think ? > > This generally works for me from the cpufreq perspective, but I would > add "cpufreq" to the name of the new function, that is call it > something like sched_cpufreq_governor_change(). Ok, no problem. > Also do you really need the extra work item? Governor changes are > carried out in process context anyway. Ah, good point, I can remove that. I just tried and got the following lock warning on boot, though: [ 2.518684] ============================================ [ 2.523942] WARNING: possible recursive locking detected [ 2.529200] 4.18.0-rc6-00086-g940e7a9fd5ec #10 Not tainted [ 2.534630] -------------------------------------------- [ 2.539888] kworker/2:3/1349 is trying to acquire lock: [ 2.545059] (____ptrval____) (cpu_hotplug_lock.rw_sem){++++}, at: rebuild_sched_domains_locked+0x2c/0x598 [ 2.554559] [ 2.554559] but task is already holding lock: [ 2.560332] (____ptrval____) (cpu_hotplug_lock.rw_sem){++++}, at: cpufreq_register_driver+0x80/0x1d0 [ 2.569396] [ 2.569396] other info that might help us debug this: [ 2.575858] Possible unsafe locking scenario: [ 2.575858] [ 2.581717] CPU0 [ 2.584135] ---- [ 2.586553] lock(cpu_hotplug_lock.rw_sem); [ 2.590785] lock(cpu_hotplug_lock.rw_sem); [ 2.595017] [ 2.595017] *** DEADLOCK *** [ 2.595017] [ 2.600877] May be due to missing lock nesting notation That seems to happen because cpufreq_register_driver() calls cpus_read_lock(), which is then called again by rebuild_sched_domains() down the line. So it might just be a missing lock nesting notation as the warning suggests ? I'll have a look. Thanks, Quentin