Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1885820imm; Thu, 7 Jun 2018 01:47:47 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLfculRrh0XYxFmrFuwSEW1+kV1KkOh6TjAJyO2Pf+h7L4J4OTK4cmX9wXzJGIRA0B8mf2c X-Received: by 2002:a62:968f:: with SMTP id s15-v6mr936154pfk.191.1528361267588; Thu, 07 Jun 2018 01:47:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528361267; cv=none; d=google.com; s=arc-20160816; b=TRndtIZu8G3u+tTkJw03oubHLFyvlkhHEXzeQSFK5zDOs0EJ7RbWwFCt73kNNw9Dm/ HJQaF+DKoI/qMi+0Jlv1Kf6wCHV/Gc0BHcsIu1DMk4I0oSJey9VQ1eKo1tk72dOBI+SD maakPs1pLNzaUl3o3hPJFQ8GbwR/iLz5fNOB2bLb34KzxqzoISlJIulEMA8ryfA7BzlQ 0powi5BQ0tIn755T+yUIHUY77spmD7DI3Xf59anOHdJ6RcZL/KZEKkKvTb4oCoyvDYVj 7RxvpzsMLr/PKjCzvhcnIVofuR1PsfjvNqrvVB6F3+PvHA+5Kbm/j/UyG3wagnCYMgIc w8YA== 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=TuKujEVZEvlNaf2eg9Wfnq/Vxwa1ZH5uK4jFxIqCpuI=; b=Yj1yBnQ6gvpAFPlS8Io+kCy0tSEktri5LOGifFWEdzh5YFejxtMGrrRSxZ+fGbVmfO QUrqEEMBx/o6Q0O1w+Hg+ZnbQrMO8Mscn23alF2JpwPD+YVHkqOjWap0m5SN5A5G3bKs W0DzAN5NP56FT+sMhXJL9Da7Db4rYvZkesrzE8vkWcRL0TZzbvhIge1EL2ndxqBQnlnX RVg43jAu5g12pl7ezD4gaq/t1lvVzbC2zPmqR/qafK1WTPXm+WBUFPfYbLKGXfZn3a+4 w9lrJtUUOdz0GMpY221+a81T/yd4evE8MujxDEXpHm++KU8a7Wi2QF9JLrrLEUwoQeC3 queA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EfHZJbAf; 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 r12-v6si15227332pfj.331.2018.06.07.01.47.32; Thu, 07 Jun 2018 01:47:47 -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=EfHZJbAf; 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 S1753529AbeFGIqJ (ORCPT + 99 others); Thu, 7 Jun 2018 04:46:09 -0400 Received: from mail-wr0-f194.google.com ([209.85.128.194]:40411 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753190AbeFGIqG (ORCPT ); Thu, 7 Jun 2018 04:46:06 -0400 Received: by mail-wr0-f194.google.com with SMTP id l41-v6so9135395wre.7 for ; Thu, 07 Jun 2018 01:46:06 -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=TuKujEVZEvlNaf2eg9Wfnq/Vxwa1ZH5uK4jFxIqCpuI=; b=EfHZJbAfHjHVdKY3XFNISoHLptbxFtmPTrUI9Vy/FUMIa0tYLdWYf01mWiOyMJrEgm /hIBAGea1ojarLs6HhteE+x+v49sgIwXCYqRJi2iIiotc+A7+YuIBTbJAFZp/fakb+ul NtVy4kcXOx9ItNIQYiSoiJ+Cf4538sbx161/A= 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=TuKujEVZEvlNaf2eg9Wfnq/Vxwa1ZH5uK4jFxIqCpuI=; b=DFCSCiqssstyVnXqF3n/ICEdjpjzm+prRstdCWrVaBWoDqDpRUsTD77dTXNhXbkkqQ EtjWMc1HW3P6V+pt27pYx1If3GZBeCx0qQtkT5yNO0ipW6ZRivRsG4QJlmmHb8u7Zf46 OvVPymmkrDNdNTQHAnqf8flPJqpo/9X2IFRhHzF2PG/nw5jBiW8SsNx4lg7R9f8U91jC B2CwAFIWItTWG6qnlqH+eyltXmKwiVKaY+/g244Le+dbssniu0sDpUxzEVewnBdR1amS 5Lcbg5vdPHc2pmdbDMhJM7RDMNv4+htj8GD0M9RNMDcW0WN8ZyfOq2x1Kqat0I/gdoN+ pcyA== X-Gm-Message-State: APt69E2XGxvJsi/wDotIGNEHi4bSgdO8IaC01pSW8fnCCPNNstvjs2KU zI/xiTl3UKhgWC7XADi6QzlgXg== X-Received: by 2002:adf:979c:: with SMTP id s28-v6mr958160wrb.28.1528361165503; Thu, 07 Jun 2018 01:46:05 -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 b124-v6sm1458465wmf.11.2018.06.07.01.46.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Jun 2018 01:46:04 -0700 (PDT) Subject: Re: [PATCH V5] powercap/drivers/idle_injection: Add an idle injection framework To: Viresh Kumar , Peter Zijlstra Cc: 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" 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> <20180607084251.rv2tg3kgz4aohlpd@vireshk-i7> From: Daniel Lezcano Message-ID: <9996fb40-c7aa-db61-5445-52c146f44d85@linaro.org> Date: Thu, 7 Jun 2018 10:46:04 +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: <20180607084251.rv2tg3kgz4aohlpd@vireshk-i7> 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 07/06/2018 10:42, Viresh Kumar wrote: > 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. Yes, correct. But if we don't care about who wins to store to value, is there a risk of scramble variable if we just assign a value ? -- Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog