Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1882731imm; Thu, 7 Jun 2018 01:44:05 -0700 (PDT) X-Google-Smtp-Source: ADUXVKI7eRouq3eDKglZAaVQXnT3qfVeEz3ctczDFRdPklnaW+QJTvkC03hx2KrmROdulVt9iwCP X-Received: by 2002:a17:902:7685:: with SMTP id m5-v6mr1101705pll.76.1528361045408; Thu, 07 Jun 2018 01:44:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528361045; cv=none; d=google.com; s=arc-20160816; b=VHyQI1CZpZQ0vtDAqmpxl6gUogb0JnRVqs0l8SeIwJVkR4qRIBJRR/tLtmDatEQ5/E SJL5Rnc7Tf90kjVAWNTSMc6v5IZTAEBJU/8REWi/ee9StBCfpv6rgl3vHNfGkQGbzejX /t2gz8n6D08ls+sgT1J7Y1gjCfnyojjCWl2xJd+VEPio6lX0C9Ddrbe5wH0QDaz0c8ce W8RX37schpUd20zoYb/vdGcSsKjNQnRs1sZhYzGsH9kV5F890XnncUx+fcNTOw726DRA 1y3pSLPbig1TieC8qaSTRBW6cBMMwocqP6Bsf8rJznsQeOGfbCK1V/KK2GnaN3O/PVW8 yVHg== 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=owR9MIRm/vT+/AACYyDHAQ+Gug1zAEJ17yzB4qBkKk4=; b=jLeAgFDxYp33H/wPgUU0Sfw6IwS4XjQLmXH1bNITwkyjlEnkYuyga8SZ2Bkixkc/pH VB56+TpTD+d6Ov5b3fPmfVHEhUGDA5IYGKtBrbCq6WDkiYAb2eTZ9Pgo+h4YIRLTYiV3 oBRNlESjAgxxvkt8ywc78aqrPA55tQG9zi/2me5r4SzeUVslyBO26U/pChoyKSSrO/Cw A7qc2mQAo2wMOnGB8GZg9Gmulo/SbYFIgiwwq7QOXE58uNTvT5RO53thuQ4gxxdPSS/b 2rFxW/Jhh0rukE+UZc4f0DkdqEyPhqBU5bgjAN13MttpSUmFwSFM9OI0AVFycYt7E8lO zojw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Zih4WSeW; 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 t12-v6si21258805pgp.565.2018.06.07.01.43.51; Thu, 07 Jun 2018 01:44:05 -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=Zih4WSeW; 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 S932741AbeFGInB (ORCPT + 99 others); Thu, 7 Jun 2018 04:43:01 -0400 Received: from mail-pl0-f68.google.com ([209.85.160.68]:44918 "EHLO mail-pl0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753480AbeFGImy (ORCPT ); Thu, 7 Jun 2018 04:42:54 -0400 Received: by mail-pl0-f68.google.com with SMTP id z9-v6so5672948plk.11 for ; Thu, 07 Jun 2018 01:42:54 -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=owR9MIRm/vT+/AACYyDHAQ+Gug1zAEJ17yzB4qBkKk4=; b=Zih4WSeWqUbSkc1qU0Dvv/W0VHMDNNnJxOlFxtnKRSwPlS4GFuW85++7uDiO4wWEkO U7FwGRFYRuOc8gWA3F4SqvKfW+x0uedVOG1GRLKbZm3EIEOzLPa2+F4T68EMSJ8e4DF2 BUIV2BlKN5EWb/YzD37DbWAmIRJHbX/ulqdUg= 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=owR9MIRm/vT+/AACYyDHAQ+Gug1zAEJ17yzB4qBkKk4=; b=DrTNZ6vUJ+0ohyK0SNrJlrS5eiwgivNElVaqESINFx/ObUJhVi9BhgV9IA+teXI4Fa YWS05p701GdDkXVe5ADEU2pgebXm4m6D/Mq82Ff2rgAmIHfV3W8o0NqtMvgaieZa2Fj5 iO5L1c8QALKheD8siE0XhHaW0W9GkPJuyvlcVdatyqYboLDTXWJ7kPLHowB3EegvQ9NJ 87DN32DZR3y23L7eXE3Jt2FkCcdOwrJtHkdCahYAO6tthBmKYUTuaZhjZPXAgHzWcQ8a krA/u4jnCnw1Qp3/N2JB3w5SywTs3Z8RqxKcyE7YMX9L/MT4CKYC/vsoKF/bjvAubgWX dsGw== X-Gm-Message-State: APt69E0FMOHcFh6NoOCqcMz25uu0k02m3lfuwQ2XUcemLRpJ8xsDSEwm L2d+9sAYjlgP1xtjz7uU5i5f0g== X-Received: by 2002:a17:902:6b09:: with SMTP id o9-v6mr1107309plk.256.1528360974138; Thu, 07 Jun 2018 01:42:54 -0700 (PDT) Received: from localhost ([122.172.167.207]) by smtp.gmail.com with ESMTPSA id v26-v6sm31170188pfe.13.2018.06.07.01.42.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Jun 2018 01:42:53 -0700 (PDT) Date: Thu, 7 Jun 2018 14:12:51 +0530 From: Viresh Kumar To: Peter Zijlstra 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" Subject: Re: [PATCH V5] powercap/drivers/idle_injection: Add an idle injection framework Message-ID: <20180607084251.rv2tg3kgz4aohlpd@vireshk-i7> 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> <20180607083229.GJ12198@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180607083229.GJ12198@hirez.programming.kicks-ass.net> User-Agent: NeoMutt/20180323-120-3dd1ac Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 07-06-18, 10:32, Peter Zijlstra wrote: > On Thu, Jun 07, 2018 at 10:18:27AM +0200, Daniel Lezcano wrote: > > So IIUC, neither atomic or WRITE|READ_ONCE are necessary in this code > > because of the wake_up_process() barrier is enough, right ? > > I didn't look hard enough; if there ever is a time where the loads and > stores happen concurrently, you need READ/WRITE_ONCE(). If there is no > concurrency on the variables, you don't need anything. > > Neither atomic_read/set() nor REAd/WRITE_ONCE() will help with ordering, > which is what the wake_up_process() would provide here, different things > entirely. Right and you still need the READ/WRITE_ONCE() thing as idle_injection_set_duration() may run in parallel with the idle_injection_fn() thread. And I don't think the purpose of atomic_read/write was ever to take care of the ordering issues in this code, it was always about parallel loads/stores. -- viresh