Received: by 10.213.65.68 with SMTP id h4csp245455imn; Mon, 26 Mar 2018 20:37:32 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/hzMAoTaxQPEcIeiuMi35iStnCJ+kCiqNqOf5kAN6sUxYUEeov3eTuroXH/nJjze0LScDo X-Received: by 2002:a17:902:206:: with SMTP id 6-v6mr8787747plc.376.1522121852268; Mon, 26 Mar 2018 20:37:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522121852; cv=none; d=google.com; s=arc-20160816; b=ZbU7+xVQSF5VIcZvnaVDqA/essQFq/BMvsUziRDD6FHAQaoPflWwOI62774nZb+Yww guPOY97o2tMA00xqKPg9InVEVUpXoMzJ/CjUob0Ijp4D1eU+OJWL/g/7wtWeWU3seqKR h6J05FoalRI6U/0OCuBh2L9OqbsJ7ueUQx/JY9Ug/QVtM4wI7L6qYAi2NGFA2ALutJrX Qu6kAgGogOV8OKVaVWMWKtasBQEu2Oy3VnjG9QAyFhReM9q7U985qTu++GSx7uHstinm oS4LbFecMbmr7yCA+3R3+dz9XgeKIwYiI9gKOaxhzNRgZ++K3Qdx2SYiHUYVgd4FcCux zxPA== 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:dkim-signature:arc-authentication-results; bh=aqUO8+Y02a+qZatUGvioA3E/E0xFRthpBVq2+bplDyQ=; b=Xe8Fhsf4iyVTliigGWR3WkEBUK3CJ4Ou5YQy5YYeGiwQ52KFI+6RFtZiWkRvXkNZHv w2dJUHKwFglO9laP/h2lVv1WSs/VL2njLGlDZBvgNUbtD4KPCZBtanLDo0jRBEzcezA9 iMAUvAHMooj5moPblBzPi+FTVAQVLSxaHU/hSx+GA7nz18Ru/YQB9m97eOVe8tc7lhAs 0efY8pO3Z775eMsnTN7uU+akZLSfCD6Kq5OrwM4qNJAIrdnJo6ovLttsiFctHjfoSZin 40a/YuB2NngoWhWBjxQlLqynIsktWCFyjQEr/l8uXRgIcDAsUwteIWZowOwS/4E9M9pT DKAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HXwHkZg/; 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 k8-v6si321665pli.7.2018.03.26.20.37.18; Mon, 26 Mar 2018 20:37:32 -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=HXwHkZg/; 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 S1752084AbeC0DgL (ORCPT + 99 others); Mon, 26 Mar 2018 23:36:11 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:33454 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751714AbeC0DgJ (ORCPT ); Mon, 26 Mar 2018 23:36:09 -0400 Received: by mail-wm0-f67.google.com with SMTP id o23so7684270wmf.0 for ; Mon, 26 Mar 2018 20:36:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=aqUO8+Y02a+qZatUGvioA3E/E0xFRthpBVq2+bplDyQ=; b=HXwHkZg/13vvxEk0TJTzVpyPlI3cTip46xD1xVIi64A+HK82IrMUM7RWxlyg+F6o+z i0C/bYBPxiFA9yrBzgGyXT4VbVkeBKLM041AIBOHLq64cuHEXadWNvYGTOqDqNRv7JOF EbzKxwlAjpECHri6idjaVzs+2iw+d8MkJ3ybg= 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=aqUO8+Y02a+qZatUGvioA3E/E0xFRthpBVq2+bplDyQ=; b=IrH7r3S1UjP2unLoKeGDu+CuW1rMTFILVQa4Vc7Z2KIazbbf5aZWwGaUBUBf3i/8hA HPksiQku6dNaxA/DzsK1ZKM9ObFXGpkHM5pfJMzkQ5s276uItXd22b35sotRbD12Mw2b bD1+IbL+/NXAiOuVDuNHBYNngGhzsR863nfoMKxq1dx/9+FNW7kQ1ZGCsDDR8qudwQHj xGLZE41Vdumn5g0DyDaIfUpAEIVK6zFsrboNuJ7sn0lx4m5hEgJ/1FWsrNxIib7c45p9 0AXZSWWcZU05clvrSENMjF/jxFCMQGkeV7D/NOL5MsyLnZXR8gPJEl+5IeNjOYhKpzkN lLEg== X-Gm-Message-State: AElRT7HJMvh2xLOm3ZrGHwxRj1UIurfpnRYMglanVWzvLbtijgnww7/+ ftlx1hvAKhsq/eVP8wm3OcsTxw== X-Received: by 10.28.26.73 with SMTP id a70mr14835489wma.30.1522121767878; Mon, 26 Mar 2018 20:36:07 -0700 (PDT) Received: from leoy-ThinkPad-X240s (li622-172.members.linode.com. [212.71.249.172]) by smtp.gmail.com with ESMTPSA id l73sm2333310wma.10.2018.03.26.20.36.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Mar 2018 20:36:06 -0700 (PDT) Date: Tue, 27 Mar 2018 11:35:54 +0800 From: Leo Yan To: Daniel Lezcano Cc: edubezval@gmail.com, kevin.wangtao@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, Viresh Kumar Subject: Re: [PATCH V2 6/7] thermal/drivers/cpu_cooling: Introduce the cpu idle cooling driver Message-ID: <20180327033554.GB21693@leoy-ThinkPad-X240s> References: <1519226968-19821-1-git-send-email-daniel.lezcano@linaro.org> <1519226968-19821-7-git-send-email-daniel.lezcano@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1519226968-19821-7-git-send-email-daniel.lezcano@linaro.org> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 21, 2018 at 04:29:27PM +0100, Daniel Lezcano wrote: [...] > +/** > + * cpuidle_cooling_injection_thread - Idle injection mainloop thread function > + * @arg: a void pointer containing the idle cooling device address > + * > + * This main function does basically two operations: > + * > + * - Goes idle for a specific amount of time > + * > + * - Sets a timer to wake up all the idle injection threads after a > + * running period > + * > + * That happens only when the mitigation is enabled, otherwise the > + * task is scheduled out. > + * > + * In order to keep the tasks synchronized together, it is the last > + * task exiting the idle period which is in charge of setting the > + * timer. > + * > + * This function never returns. > + */ > +static int cpuidle_cooling_injection_thread(void *arg) > +{ > + struct sched_param param = { .sched_priority = MAX_USER_RT_PRIO/2 }; I am just wandering if should set priority to (MAX_RT_PRIO - 1)? Otherwise I am concern it might be cannot enter deep idle state when any CPU idle injection thread is preempted by other higher priority RT threads so all CPUs have no alignment for idle state entering/exiting. > + struct cpuidle_cooling_device *idle_cdev = arg; > + struct cpuidle_cooling_tsk *cct = per_cpu_ptr(&cpuidle_cooling_tsk, > + smp_processor_id()); > + DEFINE_WAIT(wait); > + > + set_freezable(); > + > + sched_setscheduler(current, SCHED_FIFO, ¶m); > + > + while (1) { > + s64 next_wakeup; > + > + prepare_to_wait(&cct->waitq, &wait, TASK_INTERRUPTIBLE); > + > + schedule(); > + > + atomic_inc(&idle_cdev->count); > + > + play_idle(idle_cdev->idle_cycle / USEC_PER_MSEC); > + > + /* > + * The last CPU waking up is in charge of setting the > + * timer. If the CPU is hotplugged, the timer will > + * move to another CPU (which may not belong to the > + * same cluster) but that is not a problem as the > + * timer will be set again by another CPU belonging to > + * the cluster, so this mechanism is self adaptive and > + * does not require any hotplugging dance. > + */ > + if (!atomic_dec_and_test(&idle_cdev->count)) > + continue; > + > + if (!idle_cdev->state) > + continue; > + > + next_wakeup = cpuidle_cooling_runtime(idle_cdev); > + > + hrtimer_start(&idle_cdev->timer, ns_to_ktime(next_wakeup), > + HRTIMER_MODE_REL_PINNED); If SoC temperature descreases under tipping point, will the timer be disabled for this case? Or will here set next timer event with big value from next_wakeup? [...] Thanks, Leo Yan