From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.5 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS,USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EDFAFC43441 for ; Thu, 29 Nov 2018 12:40:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BB8E4206B6 for ; Thu, 29 Nov 2018 12:40:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BB8E4206B6 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728266AbeK2Xp6 (ORCPT ); Thu, 29 Nov 2018 18:45:58 -0500 Received: from mail-wm1-f68.google.com ([209.85.128.68]:55933 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727402AbeK2Xp5 (ORCPT ); Thu, 29 Nov 2018 18:45:57 -0500 Received: by mail-wm1-f68.google.com with SMTP id y139so2082800wmc.5 for ; Thu, 29 Nov 2018 04:40:42 -0800 (PST) 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=fiCwVdzVqVXF/drYKfr/com4ZXzwCezFVjx5jr/F43E=; b=dQ7AJ6DDPQqQewSFWZzsUpla9tqNKC+qcl7JkBw8SJIwq1u5OSSVM0PIFHUXBE/ORN SNE4bD4gOMUCqgb0yJvI7Krzggyn8ZBJ+MNSByCdK7J/R+TaeFZWARfrA6PLvAHaO/T4 TgUkbV3cSvBtWAZOFGz/liTuihJaBgMCjzNUKXtcW2zgplmIpcYMJUKGWBVrE/qGKVT6 fqjzAkjBFIKpbETvFVgtvSS4NScAmHQto5wKZBnHl0D+zw3Pd/3pqrRya/SoJ9rJU85b xWOZJDCqkqYZ+BGJmhkyVs9X2r1fh9i8B2Gc73EAGoXgZjSdKYpi0b7bFaq6Rundpe5R BBUg== X-Gm-Message-State: AA+aEWYTHBbravApDlxLoNjbOupvFs3UJBEBeHwMp2dANsBKbdFyTlh4 cjuhXfiAvQqdLnTh+7alTMe4UQ== X-Google-Smtp-Source: AFSGD/Vbtwinvx3HcNBw1kKGdJXU0KPs6yW4Dt9TT3nULf9wmuQkdK+loc9PAjwjJxDG+FB67oMOfg== X-Received: by 2002:a1c:5dd1:: with SMTP id r200mr1662754wmb.93.1543495242054; Thu, 29 Nov 2018 04:40:42 -0800 (PST) Received: from localhost.localdomain ([151.15.226.84]) by smtp.gmail.com with ESMTPSA id b131sm2274332wma.21.2018.11.29.04.40.40 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 29 Nov 2018 04:40:40 -0800 (PST) Date: Thu, 29 Nov 2018 13:40:38 +0100 From: Juri Lelli To: Daniel Lezcano Cc: rjw@rjwysocki.net, linux-kernel@vger.kernel.org, viresh.kumar@linaro.org, Sudeep Holla , Greg Kroah-Hartman , "Rafael J. Wysocki" , Ingo Molnar , "Peter Zijlstra (Intel)" , Morten Rasmussen Subject: Re: [PATCH V5 1/2] base/drivers/arch_topology: Replace mutex with READ_ONCE / WRITE_ONCE Message-ID: <20181129124038.GG4271@localhost.localdomain> References: <1543325060-1599-1-git-send-email-daniel.lezcano@linaro.org> <20181128114454.GC4271@localhost.localdomain> <17ecb59a-7647-ce56-0715-bfe8d520dd18@linaro.org> <20181129070437.GD4271@localhost.localdomain> <749fdda3-7af5-2899-5c91-c9a1c57025d3@linaro.org> <20181129095803.GF4271@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 29/11/18 11:02, Daniel Lezcano wrote: > On 29/11/2018 10:58, Juri Lelli wrote: > > On 29/11/18 10:18, Daniel Lezcano wrote: > >> On 29/11/2018 08:04, Juri Lelli wrote: > >> > >> [ ... ] > >> > >>>> With or without this patch, it is the case: > >>>> > >>>> task1 task2 > >>>> | | > >>>> read("/sys/.../cpu1/cpu_capacity) | > >>>> | write("/sys/.../cpu1/cpu_capacity") > >>>> read("/sys/.../cpu2/cpu_capacity) | > >>>> > >>>> > >>>> There is no guarantee userspace can have a consistent view of the > >>>> capacity. As soon as it reads a capacity, it can be changed in its back. > >>> > >>> True, but w/o the mutex task1 could read different cpu_capacity values > >>> for a cluster (it actually can also with current implementation, we > >>> should grab the mutex in the read path as well if we want to avoid > >>> this). > >> > >> Even if the mutex is on the read path, the userspace can see different > >> capacities because it will read the cpu_capacity per cpu directory. > >> > >> The mutex will be take when reading cpu0/cpu_capacity, not for > >> cpu[0-9]/cpu_capacity. Between two reads, a write can happen because the > >> lock is released in between. > >> > >> Do you agree with the patch ? Or do you want me to drop it ? > > > > I don't actually have cases at hand that are showing regression with it, > > I was just trying to understand if we might potentially hit problems in > > the future. So, I'm not against this patch. :-) > > not-not-acked-by ? :) :-) I'm not maintaining this, so, Reviewed-by: Juri Lelli