Received: by 2002:a05:6359:322:b0:b3:69d0:12d8 with SMTP id ef34csp263099rwb; Wed, 10 Aug 2022 07:57:34 -0700 (PDT) X-Google-Smtp-Source: AA6agR4LC4NPc1Q6lTICVieUyGtCj6+SDCgBgHuCfrBe5Fh69ydFNaH4SzTHFvr3ceOywRalLt5O X-Received: by 2002:a17:906:fd84:b0:730:acee:d067 with SMTP id xa4-20020a170906fd8400b00730aceed067mr20871280ejb.206.1660143453762; Wed, 10 Aug 2022 07:57:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660143453; cv=none; d=google.com; s=arc-20160816; b=ufdt6Vm9iwm80+v36NdV2m1ufxhfnaLpnW13S8hZHWi1HH/SI+tvluzxQXiTuhv2zF MmxMmeZ0z7eiCJcBt2fVyflzsULSIjB0NgBI1uuY8fMtNHtDzr8Xs8nCUEPGvHFTWEHn E5MKZzrX1UwdUR/MGwXeX05HSJM4/cv3oWkGIlFSnjAiLlHvuy9lbL3VsS89L7JWgpXx IRC5it7fDJHD8XSR9xs4G++YgjvMOHzMjOpZwaHaCLznfTheXsmyzBvinYEDBM884+k5 IrJvUD3NSzKTHVfFPm3jG9YD8b3G/UklaR8ZptvcdVrSdx7xqhd1c3ja0el4GZlCngLw y09g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=FF8N5qPjz4PuiaHo1Nia6VVRG7u0s2tYJHXEd57XaX0=; b=fCl2vD6RVARV90cTbmqjqqkNcCo3iPW48ltCvFUqEtK49DPNnUoB1EXwDZ3+Eib1pf EeQvpU0IlGsUUR8Jq/egI8bJrQG579tYjZf/wjrB2Ny4ks5Mnt35HQO89w1q0VYbOCXe XBeSRKCJzRrQcWljCGRvQH9fp+Jd/huhV39SxH+9TsePVyGk9iOijWv8sNwnmHZNc5mY xmxl//l7Bs9T7eMFQb1IMU0FEDLFiF/rg02pS0s14M6v95NHhT4lKlqTqEAt+1ye0hIW kWLpVLMUxIhen/pgGOD2i1pXej8dA1vpnXfa8a2ARXyZd8/jTCqm3Xwyer3Cwi16c3Vp +ucA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e12-20020a056402330c00b00440a49861dcsi7390596eda.412.2022.08.10.07.57.06; Wed, 10 Aug 2022 07:57:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232545AbiHJOcf (ORCPT + 99 others); Wed, 10 Aug 2022 10:32:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230378AbiHJOcb (ORCPT ); Wed, 10 Aug 2022 10:32:31 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E13EB1EAE3; Wed, 10 Aug 2022 07:32:29 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 6B89423A; Wed, 10 Aug 2022 07:32:30 -0700 (PDT) Received: from [10.57.13.63] (unknown [10.57.13.63]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A81703F67D; Wed, 10 Aug 2022 07:32:27 -0700 (PDT) Message-ID: <64ba1dfb-a475-e667-b59d-57e5d1e5ff1f@arm.com> Date: Wed, 10 Aug 2022 15:32:26 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCH v2 1/1] ACPI: CPPC: Disable FIE if registers in PCC regions Content-Language: en-US To: Jeremy Linton Cc: rafael@kernel.org, lenb@kernel.org, viresh.kumar@linaro.org, robert.moore@intel.com, devel@acpica.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, vschneid@redhat.com, Ionela Voinescu , Dietmar Eggemann References: <20220728221043.4161903-1-jeremy.linton@arm.com> <20220728221043.4161903-2-jeremy.linton@arm.com> <3a5e7abd-9361-11ba-978d-8e8bae00ea31@arm.com> <6f565c2d-e7cb-f5a2-0b38-995c9cd2deec@arm.com> From: Lukasz Luba In-Reply-To: <6f565c2d-e7cb-f5a2-0b38-995c9cd2deec@arm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 8/10/22 15:08, Jeremy Linton wrote: > Hi, > > On 8/10/22 07:29, Lukasz Luba wrote: >> Hi Jeremy, >> >> +CC Valentin since he might be interested in this finding >> +CC Ionela, Dietmar >> >> I have a few comments for this patch. >> >> >> On 7/28/22 23:10, Jeremy Linton wrote: >>> PCC regions utilize a mailbox to set/retrieve register values used by >>> the CPPC code. This is fine as long as the operations are >>> infrequent. With the FIE code enabled though the overhead can range >>> from 2-11% of system CPU overhead (ex: as measured by top) on Arm >>> based machines. >>> >>> So, before enabling FIE assure none of the registers used by >>> cppc_get_perf_ctrs() are in the PCC region. Furthermore lets also >>> enable a module parameter which can also disable it at boot or module >>> reload. >>> >>> Signed-off-by: Jeremy Linton >>> --- >>>   drivers/acpi/cppc_acpi.c       | 41 ++++++++++++++++++++++++++++++++++ >>>   drivers/cpufreq/cppc_cpufreq.c | 19 ++++++++++++---- >>>   include/acpi/cppc_acpi.h       |  5 +++++ >>>   3 files changed, 61 insertions(+), 4 deletions(-) >> >> >> 1. You assume that all platforms would have this big overhead when >>     they have the PCC regions for this purpose. >>     Do we know which version of HW mailbox have been implemented >>     and used that have this 2-11% overhead in a platform? >>     Do also more recent MHU have such issues, so we could block >>     them by default (like in your code)? > > Well, the mailbox nature of PCC pretty much assures its "slow", relative > the alternative of providing an actual register.  If a platform provides > direct access to say MHU registers, then of course they won't actually > be in a PCC region and the FIE will remain on. > > >> >> 2. I would prefer to simply change the default Kconfig value to 'n' for >>     the ACPI_CPPC_CPUFREQ_FIE, instead of creating a runtime >>     check code which disables it. >>     We have probably introduce this overhead for older platforms with >>     this commit: > > The problem here is that these ACPI kernels are being shipped as single > images in distro's which expect them to run on a wide range of platforms > (including x86/amd in this case), and preform optimally on all of them. > > So the 'n' option basically is saying that the latest FIE code doesn't > provide a befit anywhere? How we define the 'benefit' here - it's a better task utilization. How much better it would be vs. previous approach with old-style FIE? TBH, I haven't found any test results from the development of the patch set. Maybe someone could point me to the test results which bring this benefit of better utilization. In the RFC I could find that statement [1]: "This is tested with some hacks, as I didn't have access to the right hardware, on the ARM64 hikey board to check the overall functionality and that works fine." There should be a rule that such code is tested on a real server with many CPUs under some stress-test. Ionela do you have some test results where this new FIE feature introduces some better & meaningful accuracy improvement to the tasks utilization? With this overhead measured on a real server platform I think it's not worth to keep it 'y' in default. The design is heavy, as stated in the commit message: " On an invocation of cppc_scale_freq_tick(), we schedule an irq work (since we reach here from hard-irq context), which then schedules a normal work item and cppc_scale_freq_workfn() updates the per_cpu arch_freq_scale variable based on the counter updates since the last tick. " As you said Jeremy, this mailbox would always be with overhead. IMO untill we cannot be sure we have some powerful new HW mailbox, this feature should be disabled. [1] https://lore.kernel.org/lkml/cover.1594289009.git.viresh.kumar@linaro.org/