Received: by 10.213.65.68 with SMTP id h4csp485668imn; Wed, 4 Apr 2018 01:51:46 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/cnZBXumf595Dj7kFglrvddKFKYRusizBh7RdSwUKF7kS4PfkXN4ro42VRe1q9sulA7zPJ X-Received: by 10.99.165.66 with SMTP id r2mr11477525pgu.452.1522831906375; Wed, 04 Apr 2018 01:51:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522831906; cv=none; d=google.com; s=arc-20160816; b=1G670LDPimd33qKojiCCOmiasV+eVSTHr+oSjKfCWzB4ZKdQ4k3sQs+NhOWYBBO40Y +YZ6diLzfjjp28OLz7O5Xx052S/fVeQpwB+bgvcR0yD9XlEYTmPZb90x+hH6yjVcBzmD GXqAlR/q+wa5aXbwgRRL5sNtNcFWIccRY7XiTeocaMtNkavpUGhhjxG7yV6OUuA1LhYg 4UX55AH0QVhPK+xEn7V/x7t2bkJdMktWFReJ3Mz2Itee/Pj85OiyZzoFkSz0t4hcBEbC 8ExixEidr+b/jFhUZrf5wpFR6ERG5jE9ckxR13y64Smp1VKMB0LjE05YaM4O2oHplMpS uvxw== 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=Hes6R6fa8LU09K2+LCJVrbQkLbEInhhmhyL8njgeJRs=; b=OV41HGVoKD/2k/37gt/n5JtLVJj4nZuu0zUTwh3dwNF3qlgku1BMaYfrnq4WyCA/LG QzgGBfddUgHGfXdfPtPJwQnoUBOFYmVIwDkX8xYg7VfqeMk7DPUsmo8gLV4lLh6pYS+U +K4MzpXMLQ7/oC1WK77wi5Zgx47g/j6n9yLxF6otmIEbu76h0xypkjIVVC1Q6PsBTAq9 fKF/cg5Rz52RSuIk3Zrx8ks8zTj4/F6erZXIOGEKb/YlL7o96whN3IFG5j4aQXzaaPMG puNrCauPujBn9wYduLB0cWTzMEAnTVJATelMvKp20Vy9wbUsdEfxn0r2Op+O/WhhXr4N 1UkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CPP5kx9T; 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 u74si3382978pgc.264.2018.04.04.01.51.32; Wed, 04 Apr 2018 01:51:46 -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=CPP5kx9T; 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 S1751445AbeDDIuH (ORCPT + 99 others); Wed, 4 Apr 2018 04:50:07 -0400 Received: from mail-wm0-f45.google.com ([74.125.82.45]:53031 "EHLO mail-wm0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751284AbeDDIuF (ORCPT ); Wed, 4 Apr 2018 04:50:05 -0400 Received: by mail-wm0-f45.google.com with SMTP id g8so14899664wmd.2 for ; Wed, 04 Apr 2018 01:50:05 -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=Hes6R6fa8LU09K2+LCJVrbQkLbEInhhmhyL8njgeJRs=; b=CPP5kx9TzEyKrX7fqBp+WVPkWtmjgPutBKJHQJqi3v0wBKWrI2jTDDDNPLP8RjRqcK Tbiw2mqHHvdF5jdPScnwkvxAbAXXiZRhH/UNXUwhqIeYMHgbjR3DSSaO39qiJC/H7ZW3 sKu6w/Jj87y3O0Brf9yxbc+xN/4f89679X0mY= 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=Hes6R6fa8LU09K2+LCJVrbQkLbEInhhmhyL8njgeJRs=; b=ppsGwO0sTQEfAcdu4WBIQg2d+otcdhiJRyzKIiXawsINmydd5L44NbXoXXfUG5q1Ys ZhtUNlYx+VwvC9VkpYnBK1CukMNvZ4jv93U1YHZEmMjAgXMH23w4O8QL2vJ5SS1g5IPk qcIi0Z4pTIBeIUIIao/Ey15dijyZUYHpY2QroXVr5AeFstFmVAaQX3jrNrJRVhMTK5Cp ZEJ1WhvESO9O837wW9lJPbspIQyMHwtmwgCVVeEKy2iv8wLsnPv7P2H/HDLSUCYX8NVM h/MdFvVG8PvL/LhmMBTJgJFSIZ2bfmg6meFKmD0X8IdPmLrUGaMx5YoQZG3iiPClhJR+ wgSA== X-Gm-Message-State: AElRT7GHi/2MeEfkKmDQ+TDZap+FfiW7VD2cz5p2Fynv+/yYaKNOuCLY r4d+IdjvBrnb8egqLVIh+2tx1Q== X-Received: by 10.80.234.132 with SMTP id d4mr12032621edo.97.1522831804590; Wed, 04 Apr 2018 01:50:04 -0700 (PDT) Received: from [192.168.1.75] (lft31-1-88-121-166-205.fbx.proxad.net. [88.121.166.205]) by smtp.googlemail.com with ESMTPSA id 26sm2151813eds.17.2018.04.04.01.50.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Apr 2018 01:50:03 -0700 (PDT) Subject: Re: [PATCH V2 6/7] thermal/drivers/cpu_cooling: Introduce the cpu idle cooling driver To: Viresh Kumar Cc: edubezval@gmail.com, kevin.wangtao@linaro.org, leo.yan@linaro.org, vincent.guittot@linaro.org, amit.kachhap@gmail.com, linux-kernel@vger.kernel.org, javi.merino@kernel.org, rui.zhang@intel.com, daniel.thompson@linaro.org, linux-pm@vger.kernel.org References: <1519226968-19821-1-git-send-email-daniel.lezcano@linaro.org> <1519226968-19821-7-git-send-email-daniel.lezcano@linaro.org> <20180223073432.GF26947@vireshk-i7> <20180226043021.GK26947@vireshk-i7> From: Daniel Lezcano Message-ID: <78504a65-d21a-eea0-d8af-6e12d5747b87@linaro.org> Date: Wed, 4 Apr 2018 10:50:02 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <20180226043021.GK26947@vireshk-i7> 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 26/02/2018 05:30, Viresh Kumar wrote: [ ... ] >>>> + >>>> + for_each_possible_cpu(cpu) { >>>> + cpumask = topology_core_cpumask(cpu); >>>> + >>>> + cct = per_cpu_ptr(&cpuidle_cooling_tsk, cpu); >>>> + >>>> + /* >>>> + * This condition makes the first cpu belonging to the >>>> + * cluster to create a cooling device and allocates >>>> + * the structure. Others CPUs belonging to the same >>>> + * cluster will just increment the refcount on the >>>> + * cooling device structure and initialize it. >>>> + */ >>>> + if (cpu == cpumask_first(cpumask)) { >>> >>> Your function still have few assumptions of cpu numbering and it will >>> break in few cases. What if the CPUs on a big Little system (4x4) are >>> present in this order: B L L L L B B B ?? >>> >>> This configuration can happen if CPUs in DT are marked as: 0-3 LITTLE, >>> 4-7 big and a big CPU is used by the boot loader to bring up Linux. >> >> Ok, how can I sort it out ? > > I would do something like this: > > cpumask_copy(possible, cpu_possible_mask); > > while (!cpumask_empty(possible)) { > first = cpumask_first(possible); > cpumask = topology_core_cpumask(first); > cpumask_andnot(possible, possible, cpumask); > > allocate_cooling_dev(first); //This is most of this function in your patch. > > while (!cpumask_empty(cpumask)) { > temp = cpumask_first(possible); > //rest init "temp" > cpumask_clear_cpu(temp, cpumask); > } > > //Everything done, register cooling device for cpumask. > } Mmh, that sounds very complex. May be it is simpler to count the number of cluster and initialize the idle_cdev for each cluster and then go for this loop with the cluster cpumask. -- Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog