Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1918976imm; Thu, 7 Jun 2018 02:23:52 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKfDoLDbd5wnllNwH51iMvdLj76ObCjofzHRzLe/gagzdKX8p/W348Weww6uBiXlIGCTchj X-Received: by 2002:a17:902:bd95:: with SMTP id q21-v6mr1161085pls.237.1528363432499; Thu, 07 Jun 2018 02:23:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528363432; cv=none; d=google.com; s=arc-20160816; b=sdBvkxIJXNBj2sKL/8PpK3YVyhLYDsAiFlwde/hNSWQVR7Qpx3C3rDswmxa3++BsuL OmUZr8PBHgIbyt5EeM7EYgX8hNOnq8RgwlAEGqgyJYMi7LmoiUIPrOYeaGMPYNB/D00J ojBOBmg1o5kPtoV+JOMA5SxIFN0P41pwNpwKAgZ4ffNsxXvZ+Im41vZSn8RiQUI8HETJ Sl2WHTYpIf8DG9YbT92Z1e4w+MO0Yfc8mkGUVDJDmc6dKTOYsIVYG1tC6/lifupllhdm SYgRXYq+FAjBIv0TROhcDFuHo4APtmRXAIhYOYN+crA3O1rrRFUjNqT0rqEYoAa1UnZ7 S4IA== 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=fb/HVRQHmXD11lSoBJhK5C7bBDDUNmldlFd2pgh3POU=; b=jH3N65Zrj3myaZ4LjVTIlr+mSrGhibCKv5Qb13eyEgqdOS2OOGchsEwIU40jKlIoO8 xbDy/kA4iop3NkqrnLfEb+BV8iVAzd8No1Wu++zfWPGmNv94JVaAJ6V7FjNjCXjpm+jm c1erob/ZKXUznCQk+SkvXQkDNcCcmj2FxyVxUB/jtYHyHh22Rc8bgTFb4x/R2f5Hxbl/ Kh1aV5WwybTo7wR+4g8AS0VoVVFX6VAHpvoGexrsnXfLAQs4pjxzJJrviOi+MjnahAJg aQ3z9CfygXIJ+BNrf3OfTQHO4oIFHmsEIxORVCXnU04uT4023xyJ3DzBMzQykOkIUi3V 3Pvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=iUIQwu9/; 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 be5-v6si11489144plb.563.2018.06.07.02.23.37; Thu, 07 Jun 2018 02:23:52 -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=iUIQwu9/; 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 S1753434AbeFGISc (ORCPT + 99 others); Thu, 7 Jun 2018 04:18:32 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:38854 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932066AbeFGIS3 (ORCPT ); Thu, 7 Jun 2018 04:18:29 -0400 Received: by mail-wm0-f65.google.com with SMTP id 69-v6so3957458wmf.3 for ; Thu, 07 Jun 2018 01:18:29 -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=fb/HVRQHmXD11lSoBJhK5C7bBDDUNmldlFd2pgh3POU=; b=iUIQwu9/YA15+20+9bI0Ow3YM4ip+JGo8Vy1+ytwJfp8RsXM2PB6USZ0IBWeTmMANG YvAns7fLAOuKVLf5aSmZ18M2f9zZ/liVu8fz/VupucgKMuCsgMyulzp6xekmYdv1UTt4 fw3+n0JxluKePy/IXianoFygxOg78h4wE0yyU= 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=fb/HVRQHmXD11lSoBJhK5C7bBDDUNmldlFd2pgh3POU=; b=T+wmG+aKl28T1P7hSCYJelIn2SyRqgCDCSSK3FrnviNAOQY+K/T2H2Q9oMaml1BxvS I1Lk8t+v4KjAz4ynrx4AYRhz25t4Hwfrf57s5Hq4H027cRz9vui809OtYEZo0C3hGIku FZdWZ9RrjtWZlFHqoW/2e2DBoWelOnXqEuC1fZCoTFJ5awNSkd2gw2sWzcZ58xmR8i9K +gV1UtnUJHWszN3u1LPKazgw7aJbkXSG4bGyX+JysKY45tz6t3pi4kEs3lwFc4dckCu1 Oy3KoB1X0zkk4gBZV/Yghutz1LShrvYy0s4KaFZVJSHqSIU71ExcDU9Lc8Gq5sFpYhYt oiyg== X-Gm-Message-State: APt69E3LkIIYw77ak1gY935l4rP08WEkCAwqYFzV/K+uHBaFME9DNbe9 mA8ZkXIr7tGQ8+C1sIKGa61V0Q== X-Received: by 2002:a1c:d509:: with SMTP id m9-v6mr900642wmg.69.1528359508225; Thu, 07 Jun 2018 01:18:28 -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 q194-v6sm1326439wmd.26.2018.06.07.01.18.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Jun 2018 01:18:27 -0700 (PDT) Subject: Re: [PATCH V5] powercap/drivers/idle_injection: Add an idle injection framework To: Peter Zijlstra Cc: rjw@rjwysocki.net, linux-kernel@vger.kernel.org, Viresh Kumar , Eduardo Valentin , Javi Merino , Leo Yan , Kevin Wangtao , Vincent Guittot , Rui Zhang , Daniel Thompson , "open list:POWER MANAGEMENT CORE" References: <1528190208-22915-1-git-send-email-daniel.lezcano@linaro.org> <20180606122357.GN12258@hirez.programming.kicks-ass.net> <22f5cf0b-049e-7938-55f6-4b4b154f8389@linaro.org> <20180606150203.GE12180@hirez.programming.kicks-ass.net> From: Daniel Lezcano Message-ID: Date: Thu, 7 Jun 2018 10:18:27 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <20180606150203.GE12180@hirez.programming.kicks-ass.net> 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 06/06/2018 17:02, Peter Zijlstra wrote: > On Wed, Jun 06, 2018 at 03:42:08PM +0200, Daniel Lezcano wrote: >> On 06/06/2018 14:23, Peter Zijlstra wrote: >>> On Tue, Jun 05, 2018 at 11:16:40AM +0200, Daniel Lezcano wrote: >>>> + atomic_t idle_duration_ms; >>>> + atomic_t run_duration_ms; >>> >>>> + idle_duration_ms = atomic_read(&ii_dev->idle_duration_ms); >>> >>>> + run_duration_ms = atomic_read(&ii_dev->run_duration_ms); >>> >>>> + atomic_set(&ii_dev->run_duration_ms, run_duration_ms); >>>> + atomic_set(&ii_dev->idle_duration_ms, idle_duration_ms); >>> >>>> + *run_duration_ms = atomic_read(&ii_dev->run_duration_ms); >>>> + *idle_duration_ms = atomic_read(&ii_dev->idle_duration_ms); >>> >>>> + if (!atomic_read(&ii_dev->idle_duration_ms)) >>> >>>> + if (!atomic_read(&ii_dev->run_duration_ms)) >>> >>> What is the point of atomic_t here ?! >> >> idle_duration and run_duration can be changed from different places at >> the same time. The atomic is here to ensure the read/write are consistent. >> >> Do you think it is pointless ? > > Yes, atomic_read() / atomic_set() are no more atomic than READ_ONCE() / > WRITE_ONCE(). So IIUC, neither atomic or WRITE|READ_ONCE are necessary in this code because of the wake_up_process() barrier is enough, right ? -- Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog