Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp721212imm; Wed, 6 Jun 2018 05:06:30 -0700 (PDT) X-Google-Smtp-Source: ADUXVKI4juPWLphlALEPEDmGDIznmAg8dJ8HzYJ+NzKT4bOHA+cnhCX2tk1ZNrB47DqmTC/cBMan X-Received: by 2002:a17:902:b417:: with SMTP id x23-v6mr3026407plr.388.1528286790258; Wed, 06 Jun 2018 05:06:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528286790; cv=none; d=google.com; s=arc-20160816; b=BDDDN0SqjnGK1sFgY0UmlLOCDKgpFs7KnXURseA8CdWiSFI91mccTA9FhqtJKMOsTf 8ZmiGyWdJKX/HZVFiW+kUF1iELeK3QqPJYa/Emucg4Ek/iwbp9anG9t7nnhsxFlJmTEw ayv09gpAEbVhKLA3J9qZ5XEBZ92GSpxP9llpFcVlXhA3H7J0jpuQD76t7iJEfVUjwHTp tX+UA7a6MkooHOuGn6Ixcbfao1hw/jBx8mGeag1axfgFr0yL2WOGVgwsZBU9nTN6UHer YO0Fqudg4AHobdxZ53cFkgarsfx1NWHAjqKVgj9qOSVdeKIWBiQeFqPiETWZcAMn28V8 1+NQ== 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=IMD4CUfqtVfmBK749ZQ1h1H2O72IJAl0OGHMy0RdCTI=; b=L2yHGhNA/TjLyRhOPTttX0hkbVMgkrbzez8q15BlrFy30AO1myq+vdyJc0vJj0ZJxf 8I41AuBj1AXSXLw9IiU5ZXkR8lFePxIiJJUUr28v6dEsFl1xc3uZdEdd4Ean60upI/nV /Yc7FDdCFr5Rki3R1YewGyh3elgF+KitUNP3Hq75c6K82ZHqdNXiCnR70Daeq4E5R7Hn 0HUj0Pn6i64yFXYL8JwBneoqlA7bu3CulJzl5tJcDwVoCjkZV8v5fvc9Io6/ZgPA8jKQ W/DUiwOgjlV5V3pmk9kiWzm4yUbGXQU/ll7wV1ctsfunTmMkA1KRRRs5vU9pgqxtOc7r pqRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=A8jtXw/N; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p14-v6si41651569pgc.216.2018.06.06.05.06.15; Wed, 06 Jun 2018 05:06:30 -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=@amarulasolutions.com header.s=google header.b=A8jtXw/N; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752008AbeFFMFu (ORCPT + 99 others); Wed, 6 Jun 2018 08:05:50 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:50625 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750864AbeFFMFs (ORCPT ); Wed, 6 Jun 2018 08:05:48 -0400 Received: by mail-wm0-f67.google.com with SMTP id e16-v6so11014428wmd.0 for ; Wed, 06 Jun 2018 05:05:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=IMD4CUfqtVfmBK749ZQ1h1H2O72IJAl0OGHMy0RdCTI=; b=A8jtXw/NytJV4nT0d3DrSn8prI/lhHeq6oIFhj2Pv3uj8NPlN0jOn2sgkXthbXOpDj 8bO7tCVflOtI2Mm/ygQ01SgVqV9gPlGfiuzZ7NXk+n+eDgJpSamKrG9lq/EFi749kyfa tzpeHttKJdQ+HVXdocEUW54JUZWy1nVaRi/VA= 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=IMD4CUfqtVfmBK749ZQ1h1H2O72IJAl0OGHMy0RdCTI=; b=HISVJC4Yd4TUobsWAGjnVAr6LdOd8OeP+ZH0QgH2WAIIrowvoeY0Is3G7vPQO0SUxu 0EZ0Y7hZmuq02T+B2qEfy+c+JkAXIKioxkP7ylrz7H4+t8tga2Lr1zp8tvMoBQUkLT6W Wm6pxYHg72c/WcXFC6Y5iiRfqesABdiH0WZ3AzM29l64UfKijCTfkIcnKJjP/JJhaGoa T3zSpQg9K/+VcUnQMllk1MLQ5M0eLCCzdRinLq6CGJ7sCNI1a16qgxX2QtW2fy9X0qWo AXSl13nNVffE60aeVij7G8So4CwCe2pAn2a3bC5l8FuUuazIsXkdZSrdxqNvAMvIDElq 5UNw== X-Gm-Message-State: APt69E0Vhr3SFL44yNtmZ+SLQ5vxjWzOfncx0ksKWWlUAMrONnSqZYQR zhhQ71la8JFPDEtzNO5wWJImPw== X-Received: by 2002:a1c:f106:: with SMTP id p6-v6mr1578451wmh.68.1528286746894; Wed, 06 Jun 2018 05:05:46 -0700 (PDT) Received: from andrea (85.100.broadband17.iol.cz. [109.80.100.85]) by smtp.gmail.com with ESMTPSA id a15-v6sm2112264wrs.26.2018.06.06.05.05.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 06 Jun 2018 05:05:46 -0700 (PDT) Date: Wed, 6 Jun 2018 14:05:39 +0200 From: Andrea Parri To: Viresh Kumar Cc: Daniel Lezcano , rjw@rjwysocki.net, linux-kernel@vger.kernel.org, Eduardo Valentin , Javi Merino , Leo Yan , Kevin Wangtao , Vincent Guittot , Rui Zhang , Daniel Thompson , "open list:POWER MANAGEMENT CORE" , Peter Zijlstra Subject: Re: [PATCH V5] powercap/drivers/idle_injection: Add an idle injection framework Message-ID: <20180606120539.GA13130@andrea> References: <1528190208-22915-1-git-send-email-daniel.lezcano@linaro.org> <20180605103917.pyhhcobdvaivqv6g@vireshk-i7> <57d769f8-46ea-512e-8f89-a0439c9d053f@linaro.org> <20180606042708.mtwd66ecy2cnjp7a@vireshk-i7> <2bebd1bc-e1ad-6d22-ad1e-aee2cf8ba878@linaro.org> <20180606104528.nhwcd2qnxeouk6il@vireshk-i7> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180606104528.nhwcd2qnxeouk6il@vireshk-i7> 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 Hi Daniel, Viresh, On Wed, Jun 06, 2018 at 04:15:28PM +0530, Viresh Kumar wrote: > On 06-06-18, 12:22, Daniel Lezcano wrote: > > (mb() are done in the atomic operations AFAICT). To do my bit, not all atomic ops do/imply memory barriers; e.g., [from Documentation/atomic_t.txt] - non-RMW operations [e.g., atomic_set()] are unordered - RMW operations that have no return value [e.g., atomic_inc()] are unordered > > AFAIU, it is required to make sure the operations are seen in a particular order > on another CPU and the compiler doesn't reorganize code to optimize it. > > For example, in our case what if the compiler reorganizes the atomic-set > operation after wakeup-process ? But maybe that wouldn't happen across function > calls and we should be safe then. IIUC, wake_up_process() implies a full memory barrier and a compiler barrier, due to: raw_spin_lock_irqsave(&p->pi_lock, flags); smp_mb__after_spinlock(); The pattern under discussion isn't clear to me, but if you'll end up relying on this "implicit" barrier I'd suggest documenting it with a comment. Andrea