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 DF521C33CAA for ; Tue, 21 Jan 2020 10:09:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B5F9F22522 for ; Tue, 21 Jan 2020 10:09:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="iNHLk9So" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729260AbgAUKJB (ORCPT ); Tue, 21 Jan 2020 05:09:01 -0500 Received: from mail-wr1-f68.google.com ([209.85.221.68]:36290 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729238AbgAUKJA (ORCPT ); Tue, 21 Jan 2020 05:09:00 -0500 Received: by mail-wr1-f68.google.com with SMTP id z3so2484582wru.3 for ; Tue, 21 Jan 2020 02:08:59 -0800 (PST) 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=8os47Jh+iH/mWhGJOKaN0Ikowvgw7Dsg6piAesimf+8=; b=iNHLk9Soh1BgMmomizmi4fIcor2oN/NsBEzYcXn39v8n4anlIoYM5pz+LSafgd8Spu f+S7jCQINFEBJ4GDG4xVgihL44c++E/0Tg7Shs1Ps4QiMQ+Do8ke4XZtb91mtCCPSb17 8jgPfcy7ylRBXPBUjDLzy7qpdgFjobOdmL+AyehNXUbus45Wmkzcz9npQK6FoRh2lfld RgloPfjLJuxfGsc3KMrRsmMDzHu36mcWyIeIyYDOEtja0RuhZt+1QHUg64Sy4nQtummn SwblUn6R1sIWp1O85xu9BZGrKNkVu0yj2lUWmC2wFXq9newsw22roQLk7hwpoD5DrjFT RJtA== 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=8os47Jh+iH/mWhGJOKaN0Ikowvgw7Dsg6piAesimf+8=; b=pF9956gsZQ0yVVsT1gKCLWmsDUf7wAH+XMxU4+f/R4dRdym3xibnLcBalZDUfj4Pm2 zXaW6bJOsOeJXz7bgJmwIcg7/OSd3LDdyBAwhr7cLNBit8Dd1qTyBG3w99Cz/WAv0g2H 8V5yCdL97i/M6m9Bbf9dWzXbi59Cd3wffYZvojAi5pw28S0ax80qKg2uWiqQHpoGg+bS zl+2ER4A5Zm5YL8qzvkA+rBaFe3bjJZ7g8zsuWtRzd1LCEPaC60NWkkB/9plPAJBHMKS PbsZiUKeMPIV5I/cE4fb2qtJnOSG7gKTI8uBuaXXpEwuvEcRjXs2U2KppGyrIRWrLVL7 IA1A== X-Gm-Message-State: APjAAAVgAxZrpwlBPqk6uthqAHGaRPGEYlpPnLR8D7PJUbZllJ0UvFui PGR7Hga4ScwSXB8id2vXsRw8rg== X-Google-Smtp-Source: APXvYqzMOzjFtDVGl6edwO/7tSb9RrQo9+Hb9CFGAJn1i1sGI47f1x+xTj047nTS+b5NOSYS7F4xnw== X-Received: by 2002:adf:fcc4:: with SMTP id f4mr4493720wrs.247.1579601338751; Tue, 21 Jan 2020 02:08:58 -0800 (PST) Received: from google.com ([2a00:79e0:d:110:d6cc:2030:37c1:9964]) by smtp.gmail.com with ESMTPSA id u18sm51454016wrt.26.2020.01.21.02.08.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jan 2020 02:08:58 -0800 (PST) Date: Tue, 21 Jan 2020 10:08:54 +0000 From: Quentin Perret To: Lukasz Luba Cc: Dietmar Eggemann , linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, dri-devel@lists.freedesktop.org, linux-omap@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-imx@nxp.com, Morten.Rasmussen@arm.com, Chris.Redpath@arm.com, ionela.voinescu@arm.com, javi.merino@arm.com, cw00.choi@samsung.com, b.zolnierkie@samsung.com, rjw@rjwysocki.net, sudeep.holla@arm.com, viresh.kumar@linaro.org, nm@ti.com, sboyd@kernel.org, rui.zhang@intel.com, amit.kucheria@verdurent.com, daniel.lezcano@linaro.org, mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, shawnguo@kernel.org, s.hauer@pengutronix.de, festevam@gmail.com, kernel@pengutronix.de, khilman@kernel.org, agross@kernel.org, bjorn.andersson@linaro.org, robh@kernel.org, matthias.bgg@gmail.com, steven.price@arm.com, tomeu.vizoso@collabora.com, alyssa.rosenzweig@collabora.com, airlied@linux.ie, daniel@ffwll.ch, patrick.bellasi@matbug.net Subject: Re: [PATCH 1/4] PM / EM: and devices to Energy Model Message-ID: <20200121100854.GB157387@google.com> References: <20200116152032.11301-1-lukasz.luba@arm.com> <20200116152032.11301-2-lukasz.luba@arm.com> <17b77e0c-9455-0479-d37b-c57717c784c7@arm.com> <20200120152804.GB164543@google.com> <453034e5-f7b9-20f7-4e26-5d0d7164edd1@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <453034e5-f7b9-20f7-4e26-5d0d7164edd1@arm.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org On Monday 20 Jan 2020 at 16:20:49 (+0000), Lukasz Luba wrote: > On 1/20/20 3:28 PM, Quentin Perret wrote: > > Agreed, this looks a bit confusing. It should be trivial to make > > em_dev_get() (or whatever we end up calling it) work for CPUs too, > > though. And we could always have a em_cpu_get(int cpu) API that is a > > basically a wrapper around em_dev_get() for convenience. > > The problem not only here is that we have a CPU index 'int cpu' > and if we ask for device like: > > struct device *dev = get_cpu_device(cpu); > > It might be not the same device that was used during the > registration, when we had i.e. 4 CPUs for the same policy: > > int cpu_id = cpumask_first(policy->cpus); > struct device *cpu_dev = get_cpu_device(cpu_id); > em_register_perf_domain(cpu_dev, nr_opp, &em_cb); > > That's why the em_cpu_get() is different than em_get_pd(), mainly by: > if (cpumask_test_cpu(cpu, em_span_cpus(em_pd))) > > It won't be simple wrapper, let me think how it could be handled > differently than it is now. Right so I suppose the easiest solution would be to do the opposite of my first suggestion. That is, make em_get_pd() call em_cpu_get() if the device is a CPU device, or proceed to the PD list iteration for other devices. And em_cpu_get() can remain as you originally suggested (that is, iterate over the PDs and test the mask). That should ensure em_get_pd() always works, em_cpu_get() is still there handy for the scheduler and such, and the two EM lookup functions (for CPUs or for devices) are kept cleanly separated. Thoughts ? Thanks, Quentin 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=-0.5 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,FSL_HELO_FAKE, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 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 674A6C2D0CE for ; Tue, 21 Jan 2020 10:10:54 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2E46E20882 for ; Tue, 21 Jan 2020 10:10:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="qcyQFzsV"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="iNHLk9So" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2E46E20882 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=3A2fRNyehqbhg1xTeZUtrhtFTKRoDgQG9aclSAbviLk=; b=qcyQFzsVshRmGZ C+oG+Cs26Ps8xKGj8NU6AblVi2fdPJnt8SNsDTUujvtaJnzmv9UXuPzOFFMjzh9SHYB+Ffr+nhOG4 K60EYWBa/WnQQC4uiriHu7QcDAnsi/bUv1MRDhPkp2IlDOnLbMyce1qRjjvxPju3SiLpSYHdZ6n4k 5z/QimX/IgSX0iai97951n0fDzlSXNQlEzhWVAQF6AWBSPw0eeE+90pSZXVcTEGzb8p0I8txN27Sg T0VXQGS9BO4ycHZDG3cnfAxNjz7E9nUXTE+wOb8/aOwGDl7xSpAC/bklGAHj+Zoi7WyYMCe/J9pdN 7ZFSeGRBEvj4Ziq43ZOw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1itqUc-0004Z8-VD; Tue, 21 Jan 2020 10:10:42 +0000 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1itqSy-00022I-NL for linux-mediatek@lists.infradead.org; Tue, 21 Jan 2020 10:09:03 +0000 Received: by mail-wr1-x443.google.com with SMTP id t2so2498690wrr.1 for ; Tue, 21 Jan 2020 02:09:00 -0800 (PST) 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=8os47Jh+iH/mWhGJOKaN0Ikowvgw7Dsg6piAesimf+8=; b=iNHLk9Soh1BgMmomizmi4fIcor2oN/NsBEzYcXn39v8n4anlIoYM5pz+LSafgd8Spu f+S7jCQINFEBJ4GDG4xVgihL44c++E/0Tg7Shs1Ps4QiMQ+Do8ke4XZtb91mtCCPSb17 8jgPfcy7ylRBXPBUjDLzy7qpdgFjobOdmL+AyehNXUbus45Wmkzcz9npQK6FoRh2lfld RgloPfjLJuxfGsc3KMrRsmMDzHu36mcWyIeIyYDOEtja0RuhZt+1QHUg64Sy4nQtummn SwblUn6R1sIWp1O85xu9BZGrKNkVu0yj2lUWmC2wFXq9newsw22roQLk7hwpoD5DrjFT RJtA== 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=8os47Jh+iH/mWhGJOKaN0Ikowvgw7Dsg6piAesimf+8=; b=AoKf6dEKKhRUGlL7mrKee6uoAFRieP3IIN7PdImmF6woTpZZOua4qf3rgqSGe2b/Zk uN8hmIXUY9sq9hWZPpGG0bze2QB6DnSX87TE9xfW65cao/TomUN/fstH6JMts2SX8+XW yClENoSAiSBkwzP8ILxeagEWmMorD1e5CUuccSqJRoFexp7mIMr8IWlmQB3yw0auMJIK 2jU/a7owR+ZFh9DgRrGvK8+718B3iNg86ltO7K1e+0sJ026j80Pj+Y4kSB08JA3k73bD hz50Sdo5YuMKok+u2lMXLUanwXesc9pZ6+G3N0X5pzcbrYNrRwCJIFNCEWBwlSiSYGSi MlaA== X-Gm-Message-State: APjAAAUzUNrVQGBy+U3ld68snf/RmlvNBEMXlovf4Z0wvSaj/T2xkg08 Ty3PkTJN48/wMs6SokKuH7ahlg== X-Google-Smtp-Source: APXvYqzMOzjFtDVGl6edwO/7tSb9RrQo9+Hb9CFGAJn1i1sGI47f1x+xTj047nTS+b5NOSYS7F4xnw== X-Received: by 2002:adf:fcc4:: with SMTP id f4mr4493720wrs.247.1579601338751; Tue, 21 Jan 2020 02:08:58 -0800 (PST) Received: from google.com ([2a00:79e0:d:110:d6cc:2030:37c1:9964]) by smtp.gmail.com with ESMTPSA id u18sm51454016wrt.26.2020.01.21.02.08.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jan 2020 02:08:58 -0800 (PST) Date: Tue, 21 Jan 2020 10:08:54 +0000 From: Quentin Perret To: Lukasz Luba Subject: Re: [PATCH 1/4] PM / EM: and devices to Energy Model Message-ID: <20200121100854.GB157387@google.com> References: <20200116152032.11301-1-lukasz.luba@arm.com> <20200116152032.11301-2-lukasz.luba@arm.com> <17b77e0c-9455-0479-d37b-c57717c784c7@arm.com> <20200120152804.GB164543@google.com> <453034e5-f7b9-20f7-4e26-5d0d7164edd1@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <453034e5-f7b9-20f7-4e26-5d0d7164edd1@arm.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200121_020900_825863_E53109DE X-CRM114-Status: GOOD ( 14.87 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: nm@ti.com, juri.lelli@redhat.com, daniel.lezcano@linaro.org, peterz@infradead.org, viresh.kumar@linaro.org, dri-devel@lists.freedesktop.org, bjorn.andersson@linaro.org, bsegall@google.com, alyssa.rosenzweig@collabora.com, festevam@gmail.com, Morten.Rasmussen@arm.com, robh@kernel.org, amit.kucheria@verdurent.com, vincent.guittot@linaro.org, khilman@kernel.org, agross@kernel.org, b.zolnierkie@samsung.com, steven.price@arm.com, cw00.choi@samsung.com, mingo@redhat.com, linux-imx@nxp.com, rui.zhang@intel.com, mgorman@suse.de, daniel@ffwll.ch, linux-pm@vger.kernel.org, linux-arm-msm@vger.kernel.org, s.hauer@pengutronix.de, rostedt@goodmis.org, linux-mediatek@lists.infradead.org, matthias.bgg@gmail.com, Chris.Redpath@arm.com, linux-omap@vger.kernel.org, Dietmar Eggemann , linux-arm-kernel@lists.infradead.org, airlied@linux.ie, javi.merino@arm.com, tomeu.vizoso@collabora.com, sboyd@kernel.org, shawnguo@kernel.org, rjw@rjwysocki.net, linux-kernel@vger.kernel.org, kernel@pengutronix.de, sudeep.holla@arm.com, patrick.bellasi@matbug.net, ionela.voinescu@arm.com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org On Monday 20 Jan 2020 at 16:20:49 (+0000), Lukasz Luba wrote: > On 1/20/20 3:28 PM, Quentin Perret wrote: > > Agreed, this looks a bit confusing. It should be trivial to make > > em_dev_get() (or whatever we end up calling it) work for CPUs too, > > though. And we could always have a em_cpu_get(int cpu) API that is a > > basically a wrapper around em_dev_get() for convenience. > > The problem not only here is that we have a CPU index 'int cpu' > and if we ask for device like: > > struct device *dev = get_cpu_device(cpu); > > It might be not the same device that was used during the > registration, when we had i.e. 4 CPUs for the same policy: > > int cpu_id = cpumask_first(policy->cpus); > struct device *cpu_dev = get_cpu_device(cpu_id); > em_register_perf_domain(cpu_dev, nr_opp, &em_cb); > > That's why the em_cpu_get() is different than em_get_pd(), mainly by: > if (cpumask_test_cpu(cpu, em_span_cpus(em_pd))) > > It won't be simple wrapper, let me think how it could be handled > differently than it is now. Right so I suppose the easiest solution would be to do the opposite of my first suggestion. That is, make em_get_pd() call em_cpu_get() if the device is a CPU device, or proceed to the PD list iteration for other devices. And em_cpu_get() can remain as you originally suggested (that is, iterate over the PDs and test the mask). That should ensure em_get_pd() always works, em_cpu_get() is still there handy for the scheduler and such, and the two EM lookup functions (for CPUs or for devices) are kept cleanly separated. Thoughts ? Thanks, Quentin _______________________________________________ Linux-mediatek mailing list Linux-mediatek@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-mediatek From mboxrd@z Thu Jan 1 00:00:00 1970 From: Quentin Perret Subject: Re: [PATCH 1/4] PM / EM: and devices to Energy Model Date: Tue, 21 Jan 2020 10:08:54 +0000 Message-ID: <20200121100854.GB157387@google.com> References: <20200116152032.11301-1-lukasz.luba@arm.com> <20200116152032.11301-2-lukasz.luba@arm.com> <17b77e0c-9455-0479-d37b-c57717c784c7@arm.com> <20200120152804.GB164543@google.com> <453034e5-f7b9-20f7-4e26-5d0d7164edd1@arm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <453034e5-f7b9-20f7-4e26-5d0d7164edd1@arm.com> Sender: linux-kernel-owner@vger.kernel.org To: Lukasz Luba Cc: Dietmar Eggemann , linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, dri-devel@lists.freedesktop.org, linux-omap@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-imx@nxp.com, Morten.Rasmussen@arm.com, Chris.Redpath@arm.com, ionela.voinescu@arm.com, javi.merino@arm.com, cw00.choi@samsung.com, b.zolnierkie@samsung.com, rjw@rjwysocki.net, sudeep.holla@arm.com, viresh.kumar@linaro.org, nm@ti.com, sboyd@kernel.org, rui.zhang@intel.com, amit.kucheria@verdurent.com, daniel.lezcano@linaro.org, mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, shawnguo@kernel.org, s.hauer@pengutronix. List-Id: linux-omap@vger.kernel.org On Monday 20 Jan 2020 at 16:20:49 (+0000), Lukasz Luba wrote: > On 1/20/20 3:28 PM, Quentin Perret wrote: > > Agreed, this looks a bit confusing. It should be trivial to make > > em_dev_get() (or whatever we end up calling it) work for CPUs too, > > though. And we could always have a em_cpu_get(int cpu) API that is a > > basically a wrapper around em_dev_get() for convenience. > > The problem not only here is that we have a CPU index 'int cpu' > and if we ask for device like: > > struct device *dev = get_cpu_device(cpu); > > It might be not the same device that was used during the > registration, when we had i.e. 4 CPUs for the same policy: > > int cpu_id = cpumask_first(policy->cpus); > struct device *cpu_dev = get_cpu_device(cpu_id); > em_register_perf_domain(cpu_dev, nr_opp, &em_cb); > > That's why the em_cpu_get() is different than em_get_pd(), mainly by: > if (cpumask_test_cpu(cpu, em_span_cpus(em_pd))) > > It won't be simple wrapper, let me think how it could be handled > differently than it is now. Right so I suppose the easiest solution would be to do the opposite of my first suggestion. That is, make em_get_pd() call em_cpu_get() if the device is a CPU device, or proceed to the PD list iteration for other devices. And em_cpu_get() can remain as you originally suggested (that is, iterate over the PDs and test the mask). That should ensure em_get_pd() always works, em_cpu_get() is still there handy for the scheduler and such, and the two EM lookup functions (for CPUs or for devices) are kept cleanly separated. Thoughts ? Thanks, Quentin 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=-0.5 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,FSL_HELO_FAKE, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 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 9BE7CC2D0CE for ; Tue, 21 Jan 2020 10:10:46 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6997220663 for ; Tue, 21 Jan 2020 10:10:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="YkVZ3Gj0"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="iNHLk9So" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6997220663 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=E32poc9s06t94W2sT4IXFs2Ay/xQEHWg4fpSscpXeYE=; b=YkVZ3Gj0MI7oU8 v71I3JLM8g9TuRngttcOibV4zCFcplO1yuUJd2sCFExhTU660fTBdT2gDPEZIdcvOfFBU2OUVe2LP xCZTp/O0Akw1vcthcPYLTcm+TyI3HsOlwaai1OlH+Xuk9FVYjLZlBaW/v4WPtRLEwwlTBjSZk9Wn8 UYVmuy72kB0xgG52zWcOOoHrmV+0qLHNCXSLU7qmkGCdbrN4KE+PfnazG/bEyYs/50EhB+yBr1JzT rZtFg1hgEjuoqEM2wyV1JCtLqlZNoINQ7yC+RX3Jbh/6t3JFfoOkFYDqzFdiPzXdl2+2Si5MCr5DA ZK5I1vB/JcZf/OUgtVQA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1itqUf-0004ad-Qj; Tue, 21 Jan 2020 10:10:45 +0000 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1itqSy-00022K-SL for linux-arm-kernel@lists.infradead.org; Tue, 21 Jan 2020 10:09:03 +0000 Received: by mail-wr1-x442.google.com with SMTP id y17so2465092wrh.5 for ; Tue, 21 Jan 2020 02:09:00 -0800 (PST) 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=8os47Jh+iH/mWhGJOKaN0Ikowvgw7Dsg6piAesimf+8=; b=iNHLk9Soh1BgMmomizmi4fIcor2oN/NsBEzYcXn39v8n4anlIoYM5pz+LSafgd8Spu f+S7jCQINFEBJ4GDG4xVgihL44c++E/0Tg7Shs1Ps4QiMQ+Do8ke4XZtb91mtCCPSb17 8jgPfcy7ylRBXPBUjDLzy7qpdgFjobOdmL+AyehNXUbus45Wmkzcz9npQK6FoRh2lfld RgloPfjLJuxfGsc3KMrRsmMDzHu36mcWyIeIyYDOEtja0RuhZt+1QHUg64Sy4nQtummn SwblUn6R1sIWp1O85xu9BZGrKNkVu0yj2lUWmC2wFXq9newsw22roQLk7hwpoD5DrjFT RJtA== 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=8os47Jh+iH/mWhGJOKaN0Ikowvgw7Dsg6piAesimf+8=; b=Zn1J7CbeVZf91J8Z8uSS8zB/FnrycSECaNgwZmVOHIxeN/3z3paQ5GazK4KUADS6Kx TYM4DwFxsUxXXao3lP4pSfRf+OhZntfy1E46Ft4nvfXk37TeR3D7q9BeK3Zwo7HUZ+Rb wS9MDECZccmquw+Z5T8ac8XXPFg6isM3mZgYI5XcO86qiau0y22UPsL19sGKHmKoEts0 nK0UF9fsNJifYv98GyfV2LuKcmMFztLrzqp2ALCa7fmSwzZtJyXblviUhiW+tgLoR2jv xugrqNt/M2RWPr/WtLGi34lN6+K516K52nZFzw/Ldpp3F7ZI5+PCYLUHRnqb11qr35IC 0BKg== X-Gm-Message-State: APjAAAUkrGPaFoYZMqTvv9vr8NAKHNtYUd+a7anmIUi791UF66995YtG HQ2m1mxhTYrwOvYT0a16xyp7jA== X-Google-Smtp-Source: APXvYqzMOzjFtDVGl6edwO/7tSb9RrQo9+Hb9CFGAJn1i1sGI47f1x+xTj047nTS+b5NOSYS7F4xnw== X-Received: by 2002:adf:fcc4:: with SMTP id f4mr4493720wrs.247.1579601338751; Tue, 21 Jan 2020 02:08:58 -0800 (PST) Received: from google.com ([2a00:79e0:d:110:d6cc:2030:37c1:9964]) by smtp.gmail.com with ESMTPSA id u18sm51454016wrt.26.2020.01.21.02.08.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jan 2020 02:08:58 -0800 (PST) Date: Tue, 21 Jan 2020 10:08:54 +0000 From: Quentin Perret To: Lukasz Luba Subject: Re: [PATCH 1/4] PM / EM: and devices to Energy Model Message-ID: <20200121100854.GB157387@google.com> References: <20200116152032.11301-1-lukasz.luba@arm.com> <20200116152032.11301-2-lukasz.luba@arm.com> <17b77e0c-9455-0479-d37b-c57717c784c7@arm.com> <20200120152804.GB164543@google.com> <453034e5-f7b9-20f7-4e26-5d0d7164edd1@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <453034e5-f7b9-20f7-4e26-5d0d7164edd1@arm.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200121_020900_963811_B372D290 X-CRM114-Status: GOOD ( 16.33 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: nm@ti.com, juri.lelli@redhat.com, daniel.lezcano@linaro.org, peterz@infradead.org, viresh.kumar@linaro.org, dri-devel@lists.freedesktop.org, bjorn.andersson@linaro.org, bsegall@google.com, alyssa.rosenzweig@collabora.com, festevam@gmail.com, Morten.Rasmussen@arm.com, robh@kernel.org, amit.kucheria@verdurent.com, khilman@kernel.org, agross@kernel.org, b.zolnierkie@samsung.com, steven.price@arm.com, cw00.choi@samsung.com, mingo@redhat.com, linux-imx@nxp.com, rui.zhang@intel.com, mgorman@suse.de, daniel@ffwll.ch, linux-pm@vger.kernel.org, linux-arm-msm@vger.kernel.org, s.hauer@pengutronix.de, rostedt@goodmis.org, linux-mediatek@lists.infradead.org, matthias.bgg@gmail.com, Chris.Redpath@arm.com, linux-omap@vger.kernel.org, Dietmar Eggemann , linux-arm-kernel@lists.infradead.org, airlied@linux.ie, javi.merino@arm.com, tomeu.vizoso@collabora.com, sboyd@kernel.org, shawnguo@kernel.org, rjw@rjwysocki.net, linux-kernel@vger.kernel.org, kernel@pengutronix.de, sudeep.holla@arm.com, patrick.bellasi@matbug.net, ionela.voinescu@arm.com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Monday 20 Jan 2020 at 16:20:49 (+0000), Lukasz Luba wrote: > On 1/20/20 3:28 PM, Quentin Perret wrote: > > Agreed, this looks a bit confusing. It should be trivial to make > > em_dev_get() (or whatever we end up calling it) work for CPUs too, > > though. And we could always have a em_cpu_get(int cpu) API that is a > > basically a wrapper around em_dev_get() for convenience. > > The problem not only here is that we have a CPU index 'int cpu' > and if we ask for device like: > > struct device *dev = get_cpu_device(cpu); > > It might be not the same device that was used during the > registration, when we had i.e. 4 CPUs for the same policy: > > int cpu_id = cpumask_first(policy->cpus); > struct device *cpu_dev = get_cpu_device(cpu_id); > em_register_perf_domain(cpu_dev, nr_opp, &em_cb); > > That's why the em_cpu_get() is different than em_get_pd(), mainly by: > if (cpumask_test_cpu(cpu, em_span_cpus(em_pd))) > > It won't be simple wrapper, let me think how it could be handled > differently than it is now. Right so I suppose the easiest solution would be to do the opposite of my first suggestion. That is, make em_get_pd() call em_cpu_get() if the device is a CPU device, or proceed to the PD list iteration for other devices. And em_cpu_get() can remain as you originally suggested (that is, iterate over the PDs and test the mask). That should ensure em_get_pd() always works, em_cpu_get() is still there handy for the scheduler and such, and the two EM lookup functions (for CPUs or for devices) are kept cleanly separated. Thoughts ? Thanks, Quentin _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel 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=-0.3 required=3.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FSL_HELO_FAKE,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 8CC84C2D0DB for ; Wed, 22 Jan 2020 08:22:26 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 605E124655 for ; Wed, 22 Jan 2020 08:22:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="iNHLk9So" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 605E124655 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3187F6FAE8; Wed, 22 Jan 2020 08:21:32 +0000 (UTC) Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7CFEA6EC31 for ; Tue, 21 Jan 2020 10:09:00 +0000 (UTC) Received: by mail-wr1-x443.google.com with SMTP id w15so2478021wru.4 for ; Tue, 21 Jan 2020 02:09:00 -0800 (PST) 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=8os47Jh+iH/mWhGJOKaN0Ikowvgw7Dsg6piAesimf+8=; b=iNHLk9Soh1BgMmomizmi4fIcor2oN/NsBEzYcXn39v8n4anlIoYM5pz+LSafgd8Spu f+S7jCQINFEBJ4GDG4xVgihL44c++E/0Tg7Shs1Ps4QiMQ+Do8ke4XZtb91mtCCPSb17 8jgPfcy7ylRBXPBUjDLzy7qpdgFjobOdmL+AyehNXUbus45Wmkzcz9npQK6FoRh2lfld RgloPfjLJuxfGsc3KMrRsmMDzHu36mcWyIeIyYDOEtja0RuhZt+1QHUg64Sy4nQtummn SwblUn6R1sIWp1O85xu9BZGrKNkVu0yj2lUWmC2wFXq9newsw22roQLk7hwpoD5DrjFT RJtA== 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=8os47Jh+iH/mWhGJOKaN0Ikowvgw7Dsg6piAesimf+8=; b=HNvzd7Mn5ma+4rO6Igji/muMcdPqs1euk16shYOzoNZE3mouMCi4YHu1/jNgGGPtrn q9iAxVDtZX2GLKn1AE7SWsLHsKRCn2L3g5IHxUxewUP8oasZM3TApUrOAbMkKxtVqld5 lYC2r6CVCPoU3rzWuJZsV5yuQrT937f81eknUw9syLxWx9e0lVZ/ghXIGQFww3xpCzzj rMEHKslAxHwXLuy9wx8S0Pryk3csMKM6I7A1ppjD4SCUB71ju2isKxURx9atyxefXLgt R4yTfvm9Aj6r1UZ4FxAQeTK4CXvHzdgwW7pyGegI/+N0qLtEBT1Lv5ZPnWWwWM7Xa/fT Mj1Q== X-Gm-Message-State: APjAAAXdClHe+rtxxEdlfQH1lqoe0gy7toZPRi32bZRgAQBYKBFG/UmZ 4oZcYCRhzKbdbU+qEqxLyWH2dwMCzYk+b+8G X-Google-Smtp-Source: APXvYqzMOzjFtDVGl6edwO/7tSb9RrQo9+Hb9CFGAJn1i1sGI47f1x+xTj047nTS+b5NOSYS7F4xnw== X-Received: by 2002:adf:fcc4:: with SMTP id f4mr4493720wrs.247.1579601338751; Tue, 21 Jan 2020 02:08:58 -0800 (PST) Received: from google.com ([2a00:79e0:d:110:d6cc:2030:37c1:9964]) by smtp.gmail.com with ESMTPSA id u18sm51454016wrt.26.2020.01.21.02.08.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jan 2020 02:08:58 -0800 (PST) Date: Tue, 21 Jan 2020 10:08:54 +0000 From: Quentin Perret To: Lukasz Luba Subject: Re: [PATCH 1/4] PM / EM: and devices to Energy Model Message-ID: <20200121100854.GB157387@google.com> References: <20200116152032.11301-1-lukasz.luba@arm.com> <20200116152032.11301-2-lukasz.luba@arm.com> <17b77e0c-9455-0479-d37b-c57717c784c7@arm.com> <20200120152804.GB164543@google.com> <453034e5-f7b9-20f7-4e26-5d0d7164edd1@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <453034e5-f7b9-20f7-4e26-5d0d7164edd1@arm.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Mailman-Approved-At: Wed, 22 Jan 2020 08:21:10 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: nm@ti.com, juri.lelli@redhat.com, daniel.lezcano@linaro.org, peterz@infradead.org, viresh.kumar@linaro.org, dri-devel@lists.freedesktop.org, bjorn.andersson@linaro.org, bsegall@google.com, alyssa.rosenzweig@collabora.com, Morten.Rasmussen@arm.com, amit.kucheria@verdurent.com, vincent.guittot@linaro.org, khilman@kernel.org, agross@kernel.org, b.zolnierkie@samsung.com, steven.price@arm.com, cw00.choi@samsung.com, mingo@redhat.com, linux-imx@nxp.com, rui.zhang@intel.com, mgorman@suse.de, linux-pm@vger.kernel.org, linux-arm-msm@vger.kernel.org, s.hauer@pengutronix.de, rostedt@goodmis.org, linux-mediatek@lists.infradead.org, matthias.bgg@gmail.com, Chris.Redpath@arm.com, linux-omap@vger.kernel.org, Dietmar Eggemann , linux-arm-kernel@lists.infradead.org, airlied@linux.ie, javi.merino@arm.com, tomeu.vizoso@collabora.com, sboyd@kernel.org, shawnguo@kernel.org, rjw@rjwysocki.net, linux-kernel@vger.kernel.org, kernel@pengutronix.de, sudeep.holla@arm.com, patrick.bellasi@matbug.net, ionela.voinescu@arm.com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Monday 20 Jan 2020 at 16:20:49 (+0000), Lukasz Luba wrote: > On 1/20/20 3:28 PM, Quentin Perret wrote: > > Agreed, this looks a bit confusing. It should be trivial to make > > em_dev_get() (or whatever we end up calling it) work for CPUs too, > > though. And we could always have a em_cpu_get(int cpu) API that is a > > basically a wrapper around em_dev_get() for convenience. > > The problem not only here is that we have a CPU index 'int cpu' > and if we ask for device like: > > struct device *dev = get_cpu_device(cpu); > > It might be not the same device that was used during the > registration, when we had i.e. 4 CPUs for the same policy: > > int cpu_id = cpumask_first(policy->cpus); > struct device *cpu_dev = get_cpu_device(cpu_id); > em_register_perf_domain(cpu_dev, nr_opp, &em_cb); > > That's why the em_cpu_get() is different than em_get_pd(), mainly by: > if (cpumask_test_cpu(cpu, em_span_cpus(em_pd))) > > It won't be simple wrapper, let me think how it could be handled > differently than it is now. Right so I suppose the easiest solution would be to do the opposite of my first suggestion. That is, make em_get_pd() call em_cpu_get() if the device is a CPU device, or proceed to the PD list iteration for other devices. And em_cpu_get() can remain as you originally suggested (that is, iterate over the PDs and test the mask). That should ensure em_get_pd() always works, em_cpu_get() is still there handy for the scheduler and such, and the two EM lookup functions (for CPUs or for devices) are kept cleanly separated. Thoughts ? Thanks, Quentin _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel