Received: by 10.192.165.156 with SMTP id m28csp654307imm; Fri, 13 Apr 2018 05:45:29 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+ku3N5Yi46dTV/19QphSOFWbxxEZqxleEOMzltIsnp04f2ogQjMAj7IxzLe3+5moxJkOV0 X-Received: by 2002:a17:902:1006:: with SMTP id b6-v6mr5154476pla.252.1523623529285; Fri, 13 Apr 2018 05:45:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523623529; cv=none; d=google.com; s=arc-20160816; b=lphARWeI7Wu/RPzyV+zW46w1QBd8cAOSJCDRd0GBOQV+ISVLuug+YRACvbF+aM8d3L hi08rKjwbdTvIk5e6TEIf7RSyO6/Ig3f2hz/aEALkvqLFb3r9EMwp9s/jJ7SCfjmxK6E YlXynJVDgGL6SuZa+Bqllt1auD4rJzlqq9nkwTvGgiUhyTXKX/1tNPNv6CrfKW+9zKbY UVa80cSRdOieM7JYxI6hU56vcqUU02CjIMjFCYM78s216y/8vvnwgS7CmRWQlepq54KG jLXy8E+n/ynQT/9/zpzKZZ0OYRwJ5hLrjVms8FS63r2BwLJrx7YPwcHcUc9QCV+R/VAo 2HPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=FK9BOkG5YtWFA0E3t/xS9PhdbgJ1dSBOBOvcVrnDoew=; b=xckgWlX1vM7XROhey4Z7Ut1xlCdNZAUMOkbQDoDSpABsa6em6DkJVVgFUvEucBPX5J 3/cWnoGkwf9ZbqbZlNKuiaH+dBi+SSj5Rh5rfakkM018NjjVI+zurwjvJ29WwsA22VMs u2UlTghwYm+naDuLGcgzburimsj3lTuoBaCtvdmcg+50TcD3pBMnjJNily9YIhk24nwP pkky0kpwjKxO6oLcWY+nDY4Ulk+sJ+bZ2kpunCEn4+qZQhOtb1ET8kTQANuJnWB5KNgu HLlgUA0NLOniPa+a1kIuwFWTLrIymwz9qQGSae/tb3peyGH5I7BbXagM6668/kBepwEV O6Kg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bVPOk0mn; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l1si3960632pga.536.2018.04.13.05.45.15; Fri, 13 Apr 2018 05:45:29 -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; dkim=pass header.i=@linaro.org header.s=google header.b=bVPOk0mn; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754749AbeDMLr4 (ORCPT + 99 others); Fri, 13 Apr 2018 07:47:56 -0400 Received: from mail-wr0-f196.google.com ([209.85.128.196]:42045 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754560AbeDMLrx (ORCPT ); Fri, 13 Apr 2018 07:47:53 -0400 Received: by mail-wr0-f196.google.com with SMTP id s18so8020552wrg.9 for ; Fri, 13 Apr 2018 04:47:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=FK9BOkG5YtWFA0E3t/xS9PhdbgJ1dSBOBOvcVrnDoew=; b=bVPOk0mnWxcqdX6e9jI/CF1D8QCuUlAuXyoFB9eJddu4lRsdo39btjmYum4g1QLYYP im6bT2Ns8EZJWyNKrorFb806DjNw5/xAP9sqFf44CNZo38ZvuACmZ9ZQsNhcN/QHmyjr r3Y9cOr2fd6YLI8u0DrIjzoRdVZTLbm3tQejU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=FK9BOkG5YtWFA0E3t/xS9PhdbgJ1dSBOBOvcVrnDoew=; b=f/zv9jX2q3t0YmoSmnr85JSV5w7MwKfCVYlpzxyUafNvPcV6LCjMCtrajbr7gAQ8qB 88VXQEdJ27OCDoH/Jft0aWxjRWKd4CigLhxcBTSWSn/XN5Vani2odnGhk9rRSQRMeCDG 8svxTzAkO745XnMjnxaUbpouQKDjc9uk9lEwK6xR44tfb81YHr7chJP29OCb0kch+hpG iIl86K+dg7u2P+KxASB9KFf78Esky8u6wW69rlHc1IwFYWk0tHNmhLB/yY0rr25MGgeP GDaLVUSCw0SvK+fzm/R6pGcI+yFNiaDL+U2rlA5/kHi6Yem6l5R79e1jxE+EwSHJdfxB LcHw== X-Gm-Message-State: ALQs6tBsOg0a/w0N9zqs/D0HTy1pSnbihaAyZuu9qLbu0VoKhvDz7tpi 38Pidk/ZhrzG32xOUZO+gUFY2A== X-Received: by 10.223.210.13 with SMTP id g13mr3363149wri.59.1523620072121; Fri, 13 Apr 2018 04:47:52 -0700 (PDT) Received: from [192.168.8.101] ([37.170.104.147]) by smtp.googlemail.com with ESMTPSA id k89sm1869966wmc.15.2018.04.13.04.47.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 13 Apr 2018 04:47:51 -0700 (PDT) Subject: Re: [PATCH v3 6/7] thermal/drivers/cpu_cooling: Introduce the cpu idle cooling driver To: Sudeep Holla Cc: viresh.kumar@linaro.org, edubezval@gmail.com, kevin.wangtao@linaro.org, leo.yan@linaro.org, vincent.guittot@linaro.org, linux-kernel@vger.kernel.org, javi.merino@kernel.org, rui.zhang@intel.com, daniel.thompson@linaro.org, linux-pm@vger.kernel.org, Amit Daniel Kachhap References: <1522945005-7165-1-git-send-email-daniel.lezcano@linaro.org> <1522945005-7165-7-git-send-email-daniel.lezcano@linaro.org> <3f3b3b7a-3b74-aee2-2fac-f2759babe3f0@arm.com> From: Daniel Lezcano Message-ID: <939f7943-feec-aaa2-3bd3-59a6618330c0@linaro.org> Date: Fri, 13 Apr 2018 13:47:50 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <3f3b3b7a-3b74-aee2-2fac-f2759babe3f0@arm.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 13/04/2018 13:23, Sudeep Holla wrote: > Hi Daniel, > > On 05/04/18 17:16, Daniel Lezcano wrote: > > [...] > >> +/** >> + * cpuidle_cooling_register - Idle cooling device initialization function >> + * >> + * This function is in charge of creating a cooling device per cluster >> + * and register it to thermal framework. For this we rely on the >> + * topology as there is nothing yet describing better the idle state >> + * power domains. >> + * >> + * We create a cpuidle cooling device per cluster. For this reason we >> + * must, for each cluster, allocate and initialize the cooling device >> + * and for each cpu belonging to this cluster, do the initialization >> + * on a cpu basis. >> + * >> + * This approach for creating the cooling device is needed as we don't >> + * have the guarantee the CPU numbering is sequential. >> + * >> + * Unfortunately, there is no API to browse from top to bottom the >> + * topology, cluster->cpu, only the usual for_each_possible_cpu loop. >> + * In order to solve that, we use a cpumask to flag the cluster_id we >> + * already processed. The cpumask will always have enough room for all >> + * the cluster because it is based on NR_CPUS and it is not possible >> + * to have more clusters than cpus. >> + * >> + */ >> +void __init cpuidle_cooling_register(void) >> +{ >> + struct cpuidle_cooling_device *idle_cdev = NULL; >> + struct thermal_cooling_device *cdev; >> + struct device_node *np; >> + cpumask_var_t cpumask; >> + char dev_name[THERMAL_NAME_LENGTH]; >> + int ret = -ENOMEM, cpu; >> + int cluster_id; >> + >> + if (!zalloc_cpumask_var(&cpumask, GFP_KERNEL)) >> + return; >> + >> + for_each_possible_cpu(cpu) { >> + >> + cluster_id = topology_physical_package_id(cpu); >> + if (cpumask_test_cpu(cluster_id, cpumask)) >> + continue; > > Sorry for chiming in randomly, I haven't read the patches in detail. > But it was brought to my notice that topology_physical_package_id is > being used for cluster ID here. It's completely wrong and will > changesoon with ACPI topology related changes Jeremy is working on. > > You will get the physical socket number(which is mostly 0 on single SoC > system). Makes sure that this won't break with that change. > > Please note with cluster id not defined architecturally, relying on that > is simply problematic. Ok, noted. At the first glance, it should not be a problem. -- Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog