Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2468204imm; Mon, 10 Sep 2018 01:26:22 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYJ5VoHd19YsDy09ENMelQ3EwB3rry5PvoQ5P64eG0+Ajn/BKgW321qMYKWVxy5xU+Rgp4w X-Received: by 2002:a63:1644:: with SMTP id 4-v6mr21367784pgw.103.1536567982414; Mon, 10 Sep 2018 01:26:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536567982; cv=none; d=google.com; s=arc-20160816; b=LOzNwxpqjfCGaHBa78g6WRVS8qsC/DKuhYjQ7CK+2tMYZc4G5DcMrmWX8JLauvZMCV G9SfgTE92hpHeoz3rWB+CIYJaa4irfgQKEyuTMW/nP/+kCzCIC8B1XB4eTp/tOVbsg69 Rcs74TZh/9e+DEkqHzRItgUN05fFN7EgGIzM4tI3WA2UO42bWdqrJCWF4RJe2pPZwuPw WahB0SLyJQMkUtvC8CbKoCDsw2LQ6XIF06tcEDQXq0QrTBbDujU2E2isbwEnFScG0143 W2RYdBIrVuEMDL6gCPtdfpsxrE1xDWWdebKn2SSRsG2ENRpdW/R0Mcpwqd4lnInYEtF1 4eEA== 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; bh=1WNb5aG8kY9NRrGCUGKd3c87bdqzt4FJLWTYfePmbRw=; b=Z+H2YymQrtHATUxCyubpPm+nc5eo0Rk1paLvvSG+yWLhDtgZ8Xx4KS6IRvEKfNsO96 YBMwuuziVLzleJOxnM0kTMHk1rYdI/W9XjzjG+6Wn6pPVHLyeftoIz5jldeAfHh1Pzyh EfzBaqvZAjquKtq7t7vZs3tn4JqnLHzb7Ft6wmPW740qu1aidtBsXqIJLRTzs8Oir7c3 M+Dxw2gY22uI5YuKxI91gzptlmNQli/GZFeeELb7MdPkKynPyrG9eZtnRBLMFeMeDbEq wkFyMTv5Ijnfony4weDDUCRFAxvrrT6s2IEhU2PARjXZGLi1lTf3/ihlpQ4B/uTFrP0J ra3A== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i12-v6si17767143pfj.190.2018.09.10.01.26.06; Mon, 10 Sep 2018 01:26:22 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727881AbeIJNRO (ORCPT + 99 others); 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