Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2495564imm; Mon, 10 Sep 2018 01:57:44 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdb03z2o1I7y2omeeRcc353GDNCmZwvkk69mnvZW3In+fPJrCz3UtcvyfcOtRs6dnNXPYD2Y X-Received: by 2002:a62:c182:: with SMTP id i124-v6mr22317239pfg.248.1536569864583; Mon, 10 Sep 2018 01:57:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536569864; cv=none; d=google.com; s=arc-20160816; b=Wf1wCqdHni/sLXplEYkRlCdQk0w2l4vLPS4PHBbpsam3DAonDHu6NBIdK8MAraoz84 0U6/CSrgNHjEtFHT2zC2zDhiJmEOHVNDXhZ9g8vkz3uH03XVB0/OQ83DLsHagOigmkdN QuvkAb3hguEQGKktuK2JgP2JE8Fnc7Df6yXccOaj8dyLV2qwZEf975DokMTZ2vMekeuR e8njK8Eujxg6poYYPKzrHGoYKXybcQjz2+AWNVA/If1fWCOK9CZR51JMzihTyyDHI4EF Ye4vvQV0LfpV3DGC2nxADpoabThE0G+5wI5kCyT6boz+KvFCjWXrTq39iywzCWN/2sYK Qp0w== 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; bh=DGLsywjddJXC95QmXvnQeAyW7HEgg9qQMTLWVdRMHXY=; b=F8qG80UIsnuk9x402/As5kswpQ5TaJovnVQwg5ZVwmh3wT3UgjfBaZqYBQ/uK6S2pr 3suWMCu4OcwuKXnDVSAoi93LWWpBjrvEfAC6iwbgm0wH2tgy/pkG83E0G395LevOFzua 0UHvsJSz5hu5zxpVYePZLQGEk3SnVqpO17oq8ME8kRFBckUaACq83PakKomab5wW8R4H /+jdLVAatdpVqHtF3B8y6Xnweph5x8Xl/7rwj94QYcA1ebLAygsJwm/xJFWKBbRVKXL5 W1JCLc+ls14suWu+qtUiBQKy7bzrg+1WoA8I59x/mgiGqLtw6TSGcnc+pwmRRq/Nm/Hi vYKQ== 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 d10-v6si16406197pla.436.2018.09.10.01.57.29; Mon, 10 Sep 2018 01:57:44 -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 S1727860AbeIJNs4 (ORCPT + 99 others); Mon, 10 Sep 2018 09:48:56 -0400 Received: from mail-oi0-f66.google.com ([209.85.218.66]:36017 "EHLO mail-oi0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726505AbeIJNsz (ORCPT ); Mon, 10 Sep 2018 09:48:55 -0400 Received: by mail-oi0-f66.google.com with SMTP id r69-v6so38682501oie.3; Mon, 10 Sep 2018 01:55:55 -0700 (PDT) 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=DGLsywjddJXC95QmXvnQeAyW7HEgg9qQMTLWVdRMHXY=; b=i2MfCJO4MB4WwZ/uuLpmhbhYk6y4jdFW0vC3OxY+YgMqIYjRG9+NIM+uUC8muyY9Qb 7vaGp0BrHURTY18hVmU0JkgL/tWa8lU1ET5RAihe+a/QhjWtkoshNJUxAXdJw8Ssze6L 5V2iXcrZS/F486qU/pEEGR5sTcUsylak4vDoTZcmG+7cK3tDEMUyEyfh1dGiKdAtlzpM CAOgRmHDU3opUCvuRuigSLuGDPE4PhAKaxVL3Ri3mtUZM+TV3kWMTD5a6FkiqI71855T W3oVYTnRsyf9khfHywm06ia3oxZ/57hE8SUpcoDPmEuipaPCQ/8tIclNs/yOAuFZlvu/ p5SQ== X-Gm-Message-State: APzg51D1FKfXGSy8F/niTd9NH4eBQdYB42EdGpSPZUADHMnTzv0mxw8E 2FbZByDLYAKn1VSEOPEMxXnXzrY5Cx51gDx964s= X-Received: by 2002:aca:b844:: with SMTP id i65-v6mr21844174oif.177.1536569755181; Mon, 10 Sep 2018 01:55:55 -0700 (PDT) MIME-Version: 1.0 References: <20180820094420.26590-1-quentin.perret@arm.com> <20180906143842.xlxcg5notwdaflww@queper01-lin> <1545744.fI5ZvP8FO0@aspire.rjw.lan> <20180907152923.oxsmcqciez4yhmkk@queper01-lin> <20180910082411.oyedkqerxs6b7um5@queper01-lin> In-Reply-To: <20180910082411.oyedkqerxs6b7um5@queper01-lin> From: "Rafael J. Wysocki" Date: Mon, 10 Sep 2018 10:55:43 +0200 Message-ID: Subject: Re: [PATCH v6 13/14] sched/topology: Make Energy Aware Scheduling depend on schedutil To: Quentin Perret Cc: "Rafael J. Wysocki" , "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 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 Mon, Sep 10, 2018 at 10:24 AM Quentin Perret wrote: > > 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. It only is nested in the _register_driver() code path, otherwise it may not be. Using the work item may be the most straightforward way to deal with that, but then I would add a comment to explain what's up. Thanks, Rafael