Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3162742ybb; Mon, 13 Apr 2020 02:00:53 -0700 (PDT) X-Google-Smtp-Source: APiQypLVC+gR3DjKMirLIJ1Q18OVqEPY6Kgz10BB+dRNFep2OaBtjz+47PVc1CNbS36VUIf/UzCV X-Received: by 2002:a50:a68a:: with SMTP id e10mr15136308edc.113.1586768453309; Mon, 13 Apr 2020 02:00:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586768453; cv=none; d=google.com; s=arc-20160816; b=QsUqUZkGgPG9LeHNQltBU9jpmyk/1Rqo6yEWyU6GRQp1YvNfFyaqckBLMBlhw3RFfL suWhQ3N0TdvfAtOiOjVtY9Y/K9zYlQm0ysL7tJKgZyTiVLXuqCSCcMDdle0JrCLNqs/e ZuDxHwUCP69hYhMq6uvQeQDBBIh2pyYLjksvrygbHJj6DXEmR+yuGBd+z4uCodpYiJrL nTYe7A9cc+b70P1GaXP3ugnpP7i41NDPXfUO22EEPuzpCWAeALATWR3yhTbomynD6dZD B/SDRprM3NFI4NfDWKQY3hO22Mpk5LfIQRPZxPhgebyK1GPDxiegTAfWTabhZVQk3D4s 13ow== 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; bh=La50agcb/2KWA0YXVPyR15X/cVxbH5EFFNzow2CasCk=; b=Xta3CVsDEVlaUsKbHCbLOZvSGQi8FCscKGOiwGjGB9yJRzbVnKI2IKcN3WJH8SMnSu QzvhgsColFc9a5LKgfiL0SR99TppVXRBeJl9xj5qaB1ENyEjUTHcveO5vD8VgsaLPsbU yvvCwGNkSgLluKHcVZIKQI+B8WszhINiGZ07ia/gUUUg7ld36xzawdPKh1wmXw1aja/8 ZE+xx9nCQGw86G6p4zUhMiaZAcvUykuRXyYuXXadJLJFeQB15VAV6H1+JMaEw8q7vRAj LBcJQPulspFS/fd4ZcjCQCPWH6NOkl/Trh+fqdCoeodsxmVis+voehXb9SVHv7hZbCor rTlw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=U4AhDKmp; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id c24si6169285eds.119.2020.04.13.02.00.29; Mon, 13 Apr 2020 02:00:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=U4AhDKmp; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1728119AbgDMGVr (ORCPT + 99 others); Mon, 13 Apr 2020 02:21:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.18]:49620 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727719AbgDMGVq (ORCPT ); Mon, 13 Apr 2020 02:21:46 -0400 Received: from mail-pg1-x529.google.com (mail-pg1-x529.google.com [IPv6:2607:f8b0:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 33AB5C008654 for ; Sun, 12 Apr 2020 23:21:46 -0700 (PDT) Received: by mail-pg1-x529.google.com with SMTP id c5so4056806pgi.7 for ; Sun, 12 Apr 2020 23:21:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=La50agcb/2KWA0YXVPyR15X/cVxbH5EFFNzow2CasCk=; b=U4AhDKmpTjiiQCZMx8qJ1pvV8qHN5/3QPa+VuBSFlJKps1DI9ITUMc5Vs0rjFqGEFk jnergkSEQGWU+5Kxd+rABuZrt2Uj2pIFjr97R4gXPKNC2B/tXBLXUEMn3jWZTCMxTC+d Y4KwetQ/ZEN+5oNXk8NX3XVPtMRJjfP50fHutrzSmg8Ifet9woNEzC0a/qi0yLFeVccx yRgkeliuuX2KAd5dT6IYcQ6e99JJXkCFk5kQixdxmzcrT9s3llqQkdUclDJTvA9sLQPS owAhwVjvH/loJKinZhJcY6sV48c57edrdQub9pYTPcZQAbuOoulrCTh1pW59H8Tz2tlK lW2Q== 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=La50agcb/2KWA0YXVPyR15X/cVxbH5EFFNzow2CasCk=; b=HgUjPHaZJQFiu+ytmxA43STDBUhbLYugfCaqNnEqtSiTmtm97gzblXlpIKUU7tJ1Og 2oXQVuGOileeVAQfW8ulyXtX0MPOYfiAh29J8N8vCNt+8Xu0eMBIrYoYqClcrnMJgBoW PQ7C+IK5Ngv3l2s0qbsv6uo2EhBPuDgUOxK2B+YU78zUl9er4U8JApi6il4Yy6307Ub6 iKd/+xmJriICmgNOOe66Z/EtgTWzOPyHqSbxRpE36y70zirO1hPGKnPAMa9x7ncTy3vv cpXKe24CuKODEnD410Sr4n6yXbShnhNKCPbcM7qGZ9Z3EMuAJ00Z64mLcBOlwNopw++4 pCMw== X-Gm-Message-State: AGi0PubZQybiQNQmGSC3MuFS3CaUBqppQRU83uOOLTodPeOJFGFvRODf igLQVkXfMs9Tk9E28dhvwEJzyA== X-Received: by 2002:a63:a50c:: with SMTP id n12mr16740745pgf.274.1586758905511; Sun, 12 Apr 2020 23:21:45 -0700 (PDT) Received: from localhost ([122.171.118.46]) by smtp.gmail.com with ESMTPSA id d203sm2351825pfd.79.2020.04.12.23.21.42 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 12 Apr 2020 23:21:44 -0700 (PDT) Date: Mon, 13 Apr 2020 11:51:41 +0530 From: Viresh Kumar To: Sumit Gupta Cc: rjw@rjwysocki.net, catalin.marinas@arm.com, will@kernel.org, thierry.reding@gmail.com, jonathanh@nvidia.com, talho@nvidia.com, linux-pm@vger.kernel.org, linux-tegra@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, bbasu@nvidia.com, mperttunen@nvidia.com Subject: Re: [TEGRA194_CPUFREQ Patch 2/3] cpufreq: Add Tegra194 cpufreq driver Message-ID: <20200413062141.a6hmwipexhv3sctq@vireshk-i7> References: <1575394348-17649-1-git-send-email-sumitg@nvidia.com> <1575394348-17649-2-git-send-email-sumitg@nvidia.com> <20200326115023.xy3n5bl7uetuw7mx@vireshk-i7> <20200406025549.qfwzlk3745y3r274@vireshk-i7> <3ab4136c-8cca-c2f9-d286-b82dac23e720@nvidia.com> <20200408055301.jhvu5bc2luu3b5qr@vireshk-i7> <08307e54-0e14-14a3-7d6a-d59e1e04a683@nvidia.com> <20200409074415.twpzu2n4frqlde7b@vireshk-i7> <00390070-38a1-19aa-ca59-42c4658bee7e@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <00390070-38a1-19aa-ca59-42c4658bee7e@nvidia.com> User-Agent: NeoMutt/20180716-391-311a52 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 09-04-20, 16:51, Sumit Gupta wrote: > We are using "read_counters_work" as local variable. So every invocation the > function will have its own copy of counters for corresponding cpu. That's > why are doing INIT_WORK_ONSTACK here. Why? To support parallel calls to reading the freq ? > > > > > > > > > + queue_work_on(cpu, read_counters_wq, &read_counters_work.work); > > > > > > > > > + flush_work(&read_counters_work.work); > > > > > > > > > > > > > > > > Why can't this be done in current context ? > > > > > > > > > > > > > > > We used work queue instead of smp_call_function_single() to have long delay. > > > > > > > > > > > > Please explain completely, you have raised more questions than you > > > > > > answered :) > > > > > > > > > > > > Why do you want to have long delays ? > > > > > > > > > > > Long delay value is used to have the observation window long enough for > > > > > correctly reconstructing the CPU frequency considering noise. > > > > > In next patch version, changed delay value to 500us which in our tests is > > > > > considered reliable. > > > > > > > > I understand that you need to put a udelay() while reading the freq from > > > > hardware, that is fine, but why do you need a workqueue for that? Why can't you > > > > just read the values directly from the same context ? > > > > > > > The register to read frequency is per core and not accessible to other > > > cores. So, we have to execute the function remotely as the target core to > > > read frequency might be different from current. > > > The functions for that are smp_call_function_single or queue_work_on. > > > We used queue_work_on() to avoid long delay inside ipi interrupt context > > > with interrupts disabled. > > > > Okay, I understand this now, finally :) > > > > But if the interrupts are disabled during some call, won't workqueues face the > > same problem ? > > > Yes, we are trying to minimize the case. But how do you know workqueues will perform better than smp_call_function_single() ? Just asking for clarity on this as normally everyone tries to do smp_call_function_single(). -- viresh