Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp834259imm; Wed, 6 Jun 2018 06:42:57 -0700 (PDT) X-Google-Smtp-Source: ADUXVKL1HotrSfVuDxzZuUImMjy02wWo+cwSDEB3gVAjxxdOo12cTPVUB48mQhPQQySAmaZlYkiP X-Received: by 2002:a17:902:6ac7:: with SMTP id i7-v6mr3272537plt.288.1528292577311; Wed, 06 Jun 2018 06:42:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528292577; cv=none; d=google.com; s=arc-20160816; b=BiG0KYVHVIHVi24wYmUcl51MIbB0pZxHEWJcajF+NBaldRLi7kLcbYAY4mqcgLxk5d Xg8wdh/UrPOZZJfDfuK6F4HX7lZ5YuzSE+3ftFZK1fb6pH2Oh53u0qd/gdnUpcu77++0 G88g2gHVXMsqlCyp9tyzowgy/+be6vybPU94MRiGXEeo1gN0hPOOyw59jCvz71QD9JGC ryvx9diw0cfGb1UGKAVG6CN2k3dMgatFIypMRUKHmHLpEPTR1gINZ9twAO9+FqIFdQ7D ltDU5UAYd4JXgEColmu4oPwHYzHmO6UoJcddnU1sBPi23jQTH3PHgI8b13zI7GPbU9R/ 2U1A== 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=Dbnu3fxHdj31RM7ziOgpMOJip3cs/w+XuCHB9pVKIoE=; b=b49GKGqnExKdgTlkbrcFG8TLsCzmc3gRv5UBKs64jqOirw0OkcAnjdWLsC7LtiktFV jFqR5Vmo90VMm++2gQIcFeJ87x8XoYoZmOFTUtbdq4fd0gQ3GGG63dL2Rf6k/1arUdUE pPoNTafxRf+JGRvVEPipx8RvJ/nPL6qObP+ESko27y6QmWo0DpqTEU2N4CO4aaKN25SC yEYMvuK6Ct+ZFjJ/xOSjgZfKDn7iwlhYyTosUegL0xTQnWdxhqYvGsYQ667+31SqBC04 8lUbLHBf23aFLtMfiUa2PwcF1Ns4jSgoCMJY0WKu1ldkgreTI8it2XRy1SQ4C0QUFOLO rXbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Qm0rNzw1; 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 f89-v6si24818509pff.208.2018.06.06.06.42.42; Wed, 06 Jun 2018 06:42:57 -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=Qm0rNzw1; 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 S1752073AbeFFNmP (ORCPT + 99 others); Wed, 6 Jun 2018 09:42:15 -0400 Received: from mail-wr0-f196.google.com ([209.85.128.196]:37615 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751409AbeFFNmL (ORCPT ); Wed, 6 Jun 2018 09:42:11 -0400 Received: by mail-wr0-f196.google.com with SMTP id d8-v6so6372791wro.4 for ; Wed, 06 Jun 2018 06:42:10 -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=Dbnu3fxHdj31RM7ziOgpMOJip3cs/w+XuCHB9pVKIoE=; b=Qm0rNzw1+M2cI34AiS2nQJprjW9/FEgkVRp8+8VnKBsfUQWcNh12hllK/hWN4OIsPj Zk/oxKbAcuC3xDQhMW/99Jpp6pnhQ3fWrsHJNjqZ99SIb0pBkpURU7fzfcebC06K+49E g+eyT60n/n5SZ+DExFGuiN2VXHvgUgUywTf3A= 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=Dbnu3fxHdj31RM7ziOgpMOJip3cs/w+XuCHB9pVKIoE=; b=NueurKNv3OpYSS4r3c1FWNLU1G97KUkbqkV+NXKR8LgHtGB4nZ4kpZiOi7JWULppm7 b9oWRpaBcF+7TEvctz7zlCtKVauTpq8j3N99hWYdRcdcFAl+azAV+sH7wdA/T4xzTz6f bKen2M8dpDxtE7HD9cz8owEM/Z4n+nv0GOoYzajK3yVn29ZBp9X9nfK5XswxhNw8pF50 qz0E9IEiYl2DUUoJcy4iekA27aw+QAtzQtAx1D9INPNuOcyIeX3T3YuFXrud+1likmlR ToLIVr3OQYjpKENJ4JBmcSZ+bvS0SuYw8Vv2BUCrmGVkcm09QYwWukzJix8fSMkVJlJL VBKw== X-Gm-Message-State: APt69E1ZoY+IAsqB4QAp5+cWIJk++J1zDhOvNgpQuK7vjByhtRlRCdRu P7Z/0GrSiUfTskXGRvVQhNoscA== X-Received: by 2002:adf:8567:: with SMTP id 94-v6mr2339478wrh.24.1528292530105; Wed, 06 Jun 2018 06:42:10 -0700 (PDT) Received: from [192.168.8.101] ([37.173.27.39]) by smtp.googlemail.com with ESMTPSA id q77-v6sm6150441wmg.25.2018.06.06.06.42.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 06 Jun 2018 06:42:09 -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> From: Daniel Lezcano Message-ID: <22f5cf0b-049e-7938-55f6-4b4b154f8389@linaro.org> Date: Wed, 6 Jun 2018 15:42:08 +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: <20180606122357.GN12258@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 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 ? -- Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog