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 C16CBC43441 for ; Fri, 23 Nov 2018 16:20:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9046C20685 for ; Fri, 23 Nov 2018 16:20:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9046C20685 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.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 S2395070AbeKXDFh (ORCPT ); Fri, 23 Nov 2018 22:05:37 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:48526 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732050AbeKXDFg (ORCPT ); Fri, 23 Nov 2018 22:05:36 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 1BECC3620; Fri, 23 Nov 2018 08:20:45 -0800 (PST) Received: from e107155-lin (e107155-lin.cambridge.arm.com [10.1.196.42]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 4EE503F5CF; Fri, 23 Nov 2018 08:20:43 -0800 (PST) Date: Fri, 23 Nov 2018 16:20:40 +0000 From: Sudeep Holla To: Daniel Lezcano Cc: rjw@rjwysocki.net, vincent.guittot@linaro.org, linux-kernel@vger.kernel.org, Greg Kroah-Hartman , "Rafael J. Wysocki" , Kate Stewart , Juri Lelli , Thomas Gleixner , "Peter Zijlstra (Intel)" Subject: Re: [PATCH 2/4] base/drivers/arch_topology: Replace mutex with READ_ONCE / WRITE_ONCE Message-ID: <20181123162040.GB27793@e107155-lin> References: <1540830201-2947-1-git-send-email-daniel.lezcano@linaro.org> <1540830201-2947-2-git-send-email-daniel.lezcano@linaro.org> <20181123135807.GA14964@e107155-lin> <9cea4556-15f8-9377-305a-b629ba7e811f@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9cea4556-15f8-9377-305a-b629ba7e811f@linaro.org> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Nov 23, 2018 at 05:04:18PM +0100, Daniel Lezcano wrote: > On 23/11/2018 14:58, Sudeep Holla wrote: > > On Mon, Oct 29, 2018 at 05:23:18PM +0100, Daniel Lezcano wrote: > >> The mutex protects a per_cpu variable access. The potential race can > >> happen only when the cpufreq governor module is loaded and at the same > >> time the cpu capacity is changed in the sysfs. > >> > > > > I wonder if we really need that sysfs entry to be writable. For some > > reason, I had assumed it's read only, obviously it's not. I prefer to > > make it RO if there's no strong reason other than debug purposes. > > Are you suggesting to remove the READ_ONCE/WRITE_ONCE patch and set the > sysfs file read-only ? > Just to be sure, if we retain RW capability we still need to fix the race you are pointing out. However I just don't see the need for RW cpu_capacity sysfs and hence asking the reason here. IIRC I had pointed this out long back(not sure internally or externally) but seemed to have missed the version that got merged. So I am just asking if we really need write capability given that it has known issues. If user-space starts writing the value to influence the scheduler, then it makes it difficult for kernel to change the way it uses the cpu_capacity in future. Sorry if there's valid usecase and I am just making noise here. -- Regards, Sudeep