From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 85F2CA0C4D for ; Mon, 6 Sep 2021 13:01:04 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 54FE0410E6; Mon, 6 Sep 2021 13:01:04 +0200 (CEST) Received: from smtp-relay-internal-0.canonical.com (smtp-relay-internal-0.canonical.com [185.125.188.122]) by mails.dpdk.org (Postfix) with ESMTP id DAE2E410E6 for ; Mon, 6 Sep 2021 13:01:02 +0200 (CEST) Received: from mail-qt1-f198.google.com (mail-qt1-f198.google.com [209.85.160.198]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id 6FCEA40194 for ; Mon, 6 Sep 2021 11:01:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1630926062; bh=HUTcADzYo5yp1Kyhpgy2f4rso6Icf2GIpmS/2CGRUF4=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=AhR2IZoibU+uyqE7JA4B4U5dcC97WBTDBZBajKcOUhMAcmO7aMP9VeSzTClkN0Peh qy9gbO7FLnEXsnxqpX2iI3SkX8/yBBTmX1S/AhzVt33/2sWZ7P6+yAU7yW7p++Ci7G mFPWo706CnPJU23Tle09Vw+XPeYapdBFN4qLda5RXEGePZdDkr9nh1dONdwNz7oLfd AS41H/EhX1mzyLsk/ggBl/faw1uQKyjMFmAkzANWpHBD7cpJitgRorYg38No10FZKn iHXq9slYqT1Qwtl+nReWmuC0yLZwSz6zH96Zc7WFP+vKPDcBK4L1iLvSlO7edQrizm UYRuA83D4Vmeg== Received: by mail-qt1-f198.google.com with SMTP id b15-20020a05622a020f00b0029e28300d94so8952360qtx.16 for ; Mon, 06 Sep 2021 04:01:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=HUTcADzYo5yp1Kyhpgy2f4rso6Icf2GIpmS/2CGRUF4=; b=dEMgM6HV3FgnxYyFlYGNAnZ/R6dazHogJVvIJPrl3hLIDrThfE/KkMybJpbgAfO2ly Z0pCoHlcUqHWxackWtMwMpv58XnUOJoH8EZJJ0B7wsQHjK+dA5IeUvYVTJj6pBFabzKW 2FsGV17VtP9YjyI2G/QcboNUlJY5n9SnU9fy55uz1iU+uZX/rOjzEY4E4V8AJF0AU4i5 Th0r2mSsn/YYxzi6fSsTrpZZimLA1T/6eTEVuamiEvPzcD/zenr6EZ/ZgVxXud8wnAxs ccujCLTnZAuOR47ofw1LKVNhfvoQE2jz4p6FeFl0/VX8wkgxOkLse+hQ3zkV9gUBKEeh EC+g== X-Gm-Message-State: AOAM532EkLSUzvMhwCLBkEPSLxf+K2NOq4mgfExGtntJYtbYrO/xl0Zy AK/X8iSlCc0yUaQ9rA4VIEgSKdMAYfqovbHuxlR5kQjQojqIVfYKYkQd2kfcDXP79MeEIGyt9x5 TVPqvthp2ZTMziVCzZj0F94+/x8LGiLWtoEcz9NKN X-Received: by 2002:ac8:1183:: with SMTP id d3mr10016287qtj.223.1630926061042; Mon, 06 Sep 2021 04:01:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxN2km7CsZD/ZOWmoto521qjOU27ng8FCfwJ30mKOfwafa3YqZAnfCy8Dbc4P+xk4CZy3ZIGrVCukD33TB91NY= X-Received: by 2002:ac8:1183:: with SMTP id d3mr10016268qtj.223.1630926060774; Mon, 06 Sep 2021 04:01:00 -0700 (PDT) MIME-Version: 1.0 References: <20210903083736.27922-1-david.hunt@intel.com> In-Reply-To: <20210903083736.27922-1-david.hunt@intel.com> From: Christian Ehrhardt Date: Mon, 6 Sep 2021 13:00:35 +0200 Message-ID: To: David Hunt Cc: dpdk stable , "Jiang, YuX" , Richael Zhuang Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-stable] [19.11.9] test/power: fix CPU frequency when turbo enabled X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" On Fri, Sep 3, 2021 at 10:37 AM David Hunt wrote: > x missing proper reference to upstream commit > On arm platform, the value in "/sys/.../cpuinfo_cur_freq" may not > be exactly the same as what was set when using CPPC cpufreq driver. > For other cpufreq driver, no need to round it currently, or else > this check will fail with turbo enabled. For example, with acpi_cpufreq, > cpuinfo_cur_freq can be 2401000 which is equal to freqs[0].It should > not be rounded to 2400000. > > This is a version of the patch for 19.11.9 that fixes this issue > withouth the dependency of having the CPPC support applied first ^^ typo > (modified version of 29343b9030e38e8c3519ba01cb66724d45b13dc8) Hi David, thank you for the backport. I have fixed the typo and reference and made it part of the WIP 19.11 branch at https://github.com/cpaelzer/dpdk-stable-queue/commits/19.11 It came too late for 19.11.10 which was released today and this wasn't urgent enough to reset all the testing. But you are very early in line for the next release :-) > Fixes: 606a234c6d360 ("test/power: round CPU frequency to check") > Cc: stable@dpdk.org > > Signed-off-by: David Hunt > --- > app/test/test_power_cpufreq.c | 29 ++++++++++++++++++----------- > 1 file changed, 18 insertions(+), 11 deletions(-) > > diff --git a/app/test/test_power_cpufreq.c b/app/test/test_power_cpufreq.c > index d0c7e60ca5..51105f35be 100644 > --- a/app/test/test_power_cpufreq.c > +++ b/app/test/test_power_cpufreq.c > @@ -55,18 +55,20 @@ check_cur_freq(unsigned int lcore_id, uint32_t idx, bool turbo) > FILE *f; > char fullpath[PATH_MAX]; > char buf[BUFSIZ]; > + enum power_management_env env; > uint32_t cur_freq; > + uint32_t freq_conv; > int ret = -1; > int i; > > if (snprintf(fullpath, sizeof(fullpath), > - TEST_POWER_SYSFILE_SCALING_FREQ, lcore_id) < 0) { > + TEST_POWER_SYSFILE_CPUINFO_FREQ, lcore_id) < 0) { > return 0; > } > f = fopen(fullpath, "r"); > if (f == NULL) { > if (snprintf(fullpath, sizeof(fullpath), > - TEST_POWER_SYSFILE_CPUINFO_FREQ, lcore_id) < 0) { > + TEST_POWER_SYSFILE_SCALING_FREQ, lcore_id) < 0) { > return 0; > } > f = fopen(fullpath, "r"); > @@ -80,15 +82,20 @@ check_cur_freq(unsigned int lcore_id, uint32_t idx, bool turbo) > goto fail_all; > > cur_freq = strtoul(buf, NULL, TEST_POWER_CONVERT_TO_DECIMAL); > - > - /* convert the frequency to nearest 100000 value > - * Ex: if cur_freq=1396789 then freq_conv=1400000 > - * Ex: if cur_freq=800030 then freq_conv=800000 > - */ > - unsigned int freq_conv = 0; > - freq_conv = (cur_freq + TEST_FREQ_ROUNDING_DELTA) > - / TEST_ROUND_FREQ_TO_N_100000; > - freq_conv = freq_conv * TEST_ROUND_FREQ_TO_N_100000; > + freq_conv = cur_freq; > + > + env = rte_power_get_env(); > + > + if (env == PM_ENV_PSTATE_CPUFREQ) { > + /* convert the frequency to nearest 100000 value > + * Ex: if cur_freq=1396789 then freq_conv=1400000 > + * Ex: if cur_freq=800030 then freq_conv=800000 > + */ > + unsigned int freq_conv = 0; > + freq_conv = (cur_freq + TEST_FREQ_ROUNDING_DELTA) > + / TEST_ROUND_FREQ_TO_N_100000; > + freq_conv = freq_conv * TEST_ROUND_FREQ_TO_N_100000; > + } > > if (turbo) > ret = (freqs[idx] <= freq_conv ? 0 : -1); > -- > 2.17.1 > -- Christian Ehrhardt Staff Engineer, Ubuntu Server Canonical Ltd