Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp5150790imm; Tue, 19 Jun 2018 06:01:16 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIGhhG+lDcRr9Q4RZTpQ4npNTjBMOCndzxwwbF59ffccDxcc7duQF7mU3KWkM9UI1wRsHTo X-Received: by 2002:a17:902:5602:: with SMTP id h2-v6mr18986580pli.314.1529413276855; Tue, 19 Jun 2018 06:01:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529413276; cv=none; d=google.com; s=arc-20160816; b=feMdU0faGby8KVRtQFOWayCZZkdiIJBzkotLgcMPyUC2VynR7aPWlKq2oTjGs2XuOS 33ukbpYRdfmyzoAL3iFkpS+nXw5PQUYxZv7zVOqb5TyJH+OSPG9T4ewaDwwawnjgxR9I qDNog3WhmcajQQq1dEsFtfQfqWzQJAU4uZfaap+eHMuVtHoFzH0gh0awfLFhUV7xsw7H tgL+lStYY8xDam8AGztO+JxCnn3MB3yrOs/4IrAbpyehi6h0xlS4EQqFALI4WshrWRLa 2xjg8oT/ynjrCsdHtJbdaIGMtL3inB2nAotun3mobM8NcSs3WuFecd2HMVVdWkNdWBAq 7Gmw== 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:arc-authentication-results; bh=19fkEFCz7QxYHGfwfZ3A+IOkwSEfvJxZhxQJTfPCc0w=; b=WvdSY63xvc3uw+OYQv5sgt6L7epV0TFmnhQRDusrKji44wA+hk5Ux4+07TD1kkGX+X vbbGI1PtQXzm+mCyUacksttwF2pkEtDRgHL6uBJICEVbMdrtEYR7144sfxRyY59J+efy 6mpaLcKDSzlm+H3HYS1i6dw5tCZkyKK3T57CH2kseZk00zhm5z+KVB2k6P6BVupA66Kx E8jUUVIt9zmalLsfC1owlT9usLA0mBZajLwUF4flcmVw0nd2PDkwEqF40fbSI5AElbV1 y41MvqCjOjXYWoMyrIC2hHQAFG2G57wy/tjckUq9FKwUphZvwEI+NRnEzT8bLXHSYKmi gFAA== ARC-Authentication-Results: i=1; mx.google.com; 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 w78-v6si17651696pfa.359.2018.06.19.06.01.02; Tue, 19 Jun 2018 06:01:16 -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; 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 S966387AbeFSM7F (ORCPT + 99 others); Tue, 19 Jun 2018 08:59:05 -0400 Received: from foss.arm.com ([217.140.101.70]:49674 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965883AbeFSM7D (ORCPT ); Tue, 19 Jun 2018 08:59:03 -0400 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 773F180D; Tue, 19 Jun 2018 05:59:03 -0700 (PDT) Received: from e108498-lin.cambridge.arm.com (e108498-lin.cambridge.arm.com [10.1.211.46]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 82D6F3F557; Tue, 19 Jun 2018 05:58:59 -0700 (PDT) Date: Tue, 19 Jun 2018 13:58:58 +0100 From: Quentin Perret To: Peter Zijlstra Cc: rjw@rjwysocki.net, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, mingo@redhat.com, dietmar.eggemann@arm.com, morten.rasmussen@arm.com, chris.redpath@arm.com, patrick.bellasi@arm.com, valentin.schneider@arm.com, vincent.guittot@linaro.org, thara.gopinath@linaro.org, viresh.kumar@linaro.org, tkjos@google.com, joelaf@google.com, smuckle@google.com, adharmap@quicinc.com, skannan@quicinc.com, pkondeti@codeaurora.org, juri.lelli@redhat.com, edubezval@gmail.com, srinivas.pandruvada@linux.intel.com, currojerez@riseup.net, javi.merino@kernel.org Subject: Re: [RFC PATCH v3 03/10] PM: Introduce an Energy Model management framework Message-ID: <20180619125857.GY17720@e108498-lin.cambridge.arm.com> References: <20180521142505.6522-1-quentin.perret@arm.com> <20180521142505.6522-4-quentin.perret@arm.com> <20180619113408.GQ2458@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180619113408.GQ2458@hirez.programming.kicks-ass.net> User-Agent: Mutt/1.8.3 (2017-05-23) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tuesday 19 Jun 2018 at 13:34:08 (+0200), Peter Zijlstra wrote: > On Mon, May 21, 2018 at 03:24:58PM +0100, Quentin Perret wrote: > > +struct em_freq_domain *em_cpu_get(int cpu) > > +{ > > + struct em_freq_domain *fd; > > + unsigned long flags; > > + > > + read_lock_irqsave(&em_data_lock, flags); > > + fd = per_cpu(em_data, cpu); > > + read_unlock_irqrestore(&em_data_lock, flags); > > Why can't this use RCU? This is the exact thing read_locks are terrible > at and RCU excells at. So the idea was that clients (the scheduler for ex) can get a reference to a frequency domain object once, and they're guaranteed it always exists without asking for it again. For example, my proposal was to have the scheduler (patch 05) build its own private list of frequency domains on which it can iterate efficiently in the wake-up path. If we protect this per_cpu variable with RCU, then this isn't possible any-more. The scheduler will have to re-ask em_cpu_get() at every wake-up, and that makes iterating over frequency domains a whole lot more complex. Does that make any sense ? Thanks, Quentin