Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp96441imm; Tue, 22 May 2018 14:42:43 -0700 (PDT) X-Google-Smtp-Source: AB8JxZojGLHXCqY94AEeM/kDxjhviPWHJXCk6IBlH2cGb605iIKS2OO+NGpUUkkxBzlGk57PdHJK X-Received: by 2002:a17:902:8305:: with SMTP id bd5-v6mr177013plb.13.1527025363398; Tue, 22 May 2018 14:42:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527025363; cv=none; d=google.com; s=arc-20160816; b=PaHgjfUHWaYTTntR3MhKri4U0rGWmf3/GRl75fW+q+egbbnfaajurqCh40A6a9hVFc toVLcEjLXzWs3stSXOl8NTOIpvcBMP+YFAHFUSKrugwFdJw/8k1siWyIG1WjLuvciLX3 UYHOoGCbBfkVFccJL1H3qmAIDJU0t38Dwqhf04Si6qR/Nw+NdJTlhcvE81bsaTz/HcqK ltwGV+DlZhHYxhL3ZFaVO5zNsPoztVKIGH9CkisgPuRq58vATV7D8VZdTTY7PKXxOPjm arOV2SVORFnGrHWbFJvp5NHkkooM//eVmYfNpumHx98kYDHd6m4PfjM33hrvUnLD03jN mGlg== 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=gJ68LTrg4X+pebU3m6KSVf9eE7TSju3SGtXa9B5AEdE=; b=1CUAtxnxLr9NkpARS05sjDp80Y+7qHGPZZ9QdOjP1vATc6tC/i3dYzc5r9t2yfuXzT w9NW3N4Ymz4Ls5Dpr1E3z3Y5AgwySD4Ht5p4UA6UbIU/JyRak/EB7RSYLBoNxpYkUax2 wb1Qmmtavg2HBuAOEAEIWFkxJnsxh/GJJ0BWJyxYfuQEenp/Z+PcqQusABPz6Q3sk7lF 5UYL57Y9wT9G/Tgmw+idawvfwe7Oybszru8Qrn3v/9M5kxXDK6NsGOoXQIES2JF4c4TO PPPKstuArMyTVyUv7x95ciIiVUb0PO1y0iObfJFZEMVXDNtjsVOGyhxoJRsXQxwgbisA EGaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=huUhCRk1; 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 r1-v6si17162902plo.414.2018.05.22.14.42.29; Tue, 22 May 2018 14:42:43 -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=@joelfernandes.org header.s=google header.b=huUhCRk1; 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 S1753205AbeEVVl4 (ORCPT + 99 others); Tue, 22 May 2018 17:41:56 -0400 Received: from mail-pg0-f66.google.com ([74.125.83.66]:40511 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753007AbeEVVlz (ORCPT ); Tue, 22 May 2018 17:41:55 -0400 Received: by mail-pg0-f66.google.com with SMTP id l2-v6so8424565pgc.7 for ; Tue, 22 May 2018 14:41:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=gJ68LTrg4X+pebU3m6KSVf9eE7TSju3SGtXa9B5AEdE=; b=huUhCRk11s8vIYVDAb42cNLt1DA2/WyXf7/mNlx+/4IaveEkCiqOI9m37K6ovioOjR z0IMbtkIf5DFvuq+FW5aH90FY0a5in7RfVR3RjITe1MWRx7tobnIp5sUEBU6akiVoURk jPdGbUqctkzxRs3ZLgmGSYorLXs5WYWrtuxe8= 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=gJ68LTrg4X+pebU3m6KSVf9eE7TSju3SGtXa9B5AEdE=; b=G7ZRrOZZ0khJZkq84XkzefZH6LKU+OSnAWN2mncTsXzk/2bD3kMWwN6vcaCWQvZ74l mbod/K7q5KNI5azPT5XCCpX1/B6uwEZt+mbCrD6R1Jf9LgWN1vqZU/c7LBFp3Mx9BHrV 0ePfkBTP53f9mWDksbNjVS55uI0EQ9syc0g2+nXyvaIwtBRCBAkidLV/9XTx/sxABbL4 SeH1MadKqVynfJrOAjpMj7rARDxbbRpsIYfo9kIiwkTBFdPx/ZXAnA45R33ZFROSYLoy VZ7T3rdmmpgMqd978mmkjs/ap+Yca7Wa6BTqD2PylRTvJJkpmQ1XY3UqlYvTSkKrnVHt rjyA== X-Gm-Message-State: ALKqPweFL6vJkvkal7zVpWITugG2WI/sAQUAibduJH8anf72pgxAtvW5 i78xYr78bhIfss6yUOiOKpxpVQ== X-Received: by 2002:a63:34c1:: with SMTP id b184-v6mr141772pga.396.1527025314825; Tue, 22 May 2018 14:41:54 -0700 (PDT) Received: from localhost ([100.96.59.14]) by smtp.gmail.com with ESMTPSA id w8-v6sm34086327pfk.112.2018.05.22.14.41.53 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 22 May 2018 14:41:54 -0700 (PDT) Date: Tue, 22 May 2018 14:41:53 -0700 From: Joel Fernandes To: "Rafael J. Wysocki" Cc: Viresh Kumar , Linux Kernel Mailing List , "Rafael J . Wysocki" , Peter Zijlstra , Ingo Molnar , Patrick Bellasi , Juri Lelli , Luca Abeni , Todd Kjos , Claudio Scordino , kernel-team@android.com, Linux PM , "Joel Fernandes (Google.)" Subject: Re: [PATCH v2] schedutil: Allow cpufreq requests to be made even when kthread kicked Message-ID: <20180522213113.GA40506@joelaf.mtv.corp.google.com> References: <20180518185501.173552-1-joel@joelfernandes.org> <20180522113844.5rz3skjeck57arft@vireshk-i7> <4237890.zlzv5C60QP@aspire.rjw.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 22, 2018 at 05:27:11PM +0200, Rafael J. Wysocki wrote: > On Tue, May 22, 2018 at 2:22 PM, Rafael J. Wysocki wrote: > > On Tuesday, May 22, 2018 1:42:05 PM CEST Rafael J. Wysocki wrote: > >> On Tue, May 22, 2018 at 1:38 PM, Viresh Kumar wrote: > >> > On 22-05-18, 13:31, Rafael J. Wysocki wrote: > >> >> So below is my (compiled-only) version of the $subject patch, obviously based > >> >> on the Joel's work. > >> >> > >> >> Roughly, what it does is to move the fast_switch_enabled path entirely to > >> >> sugov_update_single() and take the spinlock around sugov_update_commit() > >> >> in the one-CPU case too. > > > > [cut] > > > >> > > >> > Why do you assume that fast switch isn't possible in shared policy > >> > cases ? It infact is already enabled for few drivers. > > > > I hope that fast_switch is not used with devfs_possible_from_any_cpu set in the > > one-CPU policy case, as that looks racy even without any patching. > > Which would be the only case in which sugov_update_single() would run > on a CPU that is not the target. > > And running sugov_update_single() concurrently on two different CPUs > for the same target is a no-no, as we don't prevent concurrent updates > from occurring in that path. > > Which means that the original patch from Joel will be sufficient as > long as we ensure that sugov_update_single() can only run on one CPU > at a time. Since target CPU's runqueue lock is held, I don't see how we can run sugov_update_single concurrently with any other CPU for single policy, so protecting such race shouldn't be necessary. Also the "if (work_in_progress)" check I added to the sugov_update_single doesn't change the behavior of single policy from what it is in mainline since we were doing the same thing in already sugov_should_update_freq. thanks, - Joel