[UPDATE] platform/x86/intel-uncore-freq: Conditionally create attribute for read frequency
Message ID | 20231002131817.1590966-1-srinivas.pandruvada@linux.intel.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp1508398vqb; Mon, 2 Oct 2023 08:36:15 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEiiZXkf3iall7hIiVsodDImSRGiGk8qvssmLWNeA2so+RNzwUq4t1KakV51v3Hk+WWpjIw X-Received: by 2002:a05:6a20:3c86:b0:13e:90aa:8c8b with SMTP id b6-20020a056a203c8600b0013e90aa8c8bmr17112345pzj.4.1696260975406; Mon, 02 Oct 2023 08:36:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696260975; cv=none; d=google.com; s=arc-20160816; b=AxcGJp0BVntOx8Dt1wjASJjqcTUKlBdtkiGAcRE7e8JwreZFMBJJo/CMUchABIdH3s SoVkscuj/GdEoWfSLFgRZmNy5Q0ogGqZLxdMxKby4ZtwCyXJDT0Uf0TF01MFqhzFkCmX XWIAEJHczJXxdx0PmJfo8mrNvgwAJOx1W9jqbDlFQppVPu2YOYexwKq84wtUp2Yd0KYZ XjGor6YC82J1BLQEhnJUkvSD7rzNQroLVlq1TLD1UsPyZ3htTF98Kfuzb0v4s70BsQEF vPrO/Zz4HvB4TcebBYIkSX4C+UQNH8J03hatszVigx08h2HLxVU1+gMF1uxaw8fjrVdq XQcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=23CkBdbpQbv6Pg4KRdyW87mGOsHBHOVJDo8CRvYaBXM=; fh=WxcXzAXi1awalX5nBNdKiu2pCszhVA/a0vtqlN5we7w=; b=p11XaFD8JlUjoubIOjs6e/pfLrblcauPedDSK2FLyFBHrj7t6hEE4zifPCC1PWL7TA 7tMsl5bIrx09pDV0ECUoFKK1U8PF4myEKiB36zL9FzmuyH8Zk4TXVJMlyLG7cx+7EMnJ Xw0fTjMqmn+5fOmOnfv7mzcC+zhdtbYgO/Gqbn0cGfX5bKOEcTOMtHCpsrw24KhL44vV uo5CU4QPbFSJF8WdBsO9awpAL+DqU0yOXDWsiMQ8oH3zmUyxQEnHb4sI3hFvV3HgLiLw 20xwe6zW6f0InPwgdVCtUrtitlYuZB7dqnecEM61zeab/VtNrArZiK3OHN3hZV6y5cn5 L5pw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=gNueukOY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id l128-20020a633e86000000b00577448019b5si27298654pga.276.2023.10.02.08.36.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Oct 2023 08:36:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=gNueukOY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 3EE5680A5F99; Mon, 2 Oct 2023 06:21:24 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237299AbjJBNVI (ORCPT <rfc822;pusanteemu@gmail.com> + 18 others); Mon, 2 Oct 2023 09:21:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34848 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236717AbjJBNVG (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 2 Oct 2023 09:21:06 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C61BEB0; Mon, 2 Oct 2023 06:21:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1696252862; x=1727788862; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=fUFfbgGjJz6tv9OfY0S0wOao3CYBuChbfMLdgABf2U4=; b=gNueukOY2gkIcNl6pcw8Smjc4YR5K0Hc1XEd+pDuzOEVROmDUMgvs7g/ 72YjNErK+M1Z3Kfn0OFvN4Zqu+34E4SjbmUKtbpeyvNfUDJWjHkYzmzCO XSdB8DszFxTTXvK1Nl059sY/lJfS6DDyHBf1MVkVFvP8MazF64mpt7yWn AnX1wkgZaWa0MunRUi2pobQBdro7T/pnSTqMML/zNT1DwcQHj5kKYasPf Rm5Pe9X5mbXKI5bKxHI6qqGqeDIDT/JvMNp765fiG+RN/DiXDAXLMzfiM +DIjbVtHUNHZZguCcv9FrI9ZWqs0sUkICMVfxNcXI3vcXFhY+Mzox4Evd w==; X-IronPort-AV: E=McAfee;i="6600,9927,10851"; a="382546833" X-IronPort-AV: E=Sophos;i="6.03,194,1694761200"; d="scan'208";a="382546833" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Oct 2023 06:18:27 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10851"; a="997617882" X-IronPort-AV: E=Sophos;i="6.03,194,1694761200"; d="scan'208";a="997617882" Received: from spandruv-desk.jf.intel.com ([10.54.75.14]) by fmsmga006.fm.intel.com with ESMTP; 02 Oct 2023 06:18:27 -0700 From: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> To: hdegoede@redhat.com, markgross@kernel.org, ilpo.jarvinen@linux.intel.com, andriy.shevchenko@linux.intel.com Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Subject: [UPDATE][PATCH] platform/x86/intel-uncore-freq: Conditionally create attribute for read frequency Date: Mon, 2 Oct 2023 06:18:17 -0700 Message-Id: <20231002131817.1590966-1-srinivas.pandruvada@linux.intel.com> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_NONE 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 02 Oct 2023 06:21:24 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778658548421185729 X-GMAIL-MSGID: 1778658548421185729 |
Series |
[UPDATE] platform/x86/intel-uncore-freq: Conditionally create attribute for read frequency
|
|
Commit Message
srinivas pandruvada
Oct. 2, 2023, 1:18 p.m. UTC
When the current uncore frequency can't be read, don't create attribute
"current_freq_khz" as any read will fail later. Some user space
applications like turbostat fail to continue with the failure. So, check
error during attribute creation.
Fixes: 8a54e2253e4c ("platform/x86/intel-uncore-freq: Uncore frequency control via TPMI")
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
---
update
- Added Fixes tag
.../x86/intel/uncore-frequency/uncore-frequency-common.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
Comments
On Mon, 2 Oct 2023, Srinivas Pandruvada wrote: > When the current uncore frequency can't be read, don't create attribute > "current_freq_khz" as any read will fail later. Some user space > applications like turbostat fail to continue with the failure. So, check > error during attribute creation. > > Fixes: 8a54e2253e4c ("platform/x86/intel-uncore-freq: Uncore frequency control via TPMI") Hi, Thanks for the update but that commit id looks bogus, or where the value is used w/o error check?
Hi llPo, On Tue, 2023-10-03 at 16:10 +0300, Ilpo Järvinen wrote: > On Mon, 2 Oct 2023, Srinivas Pandruvada wrote: > > > When the current uncore frequency can't be read, don't create > > attribute > > "current_freq_khz" as any read will fail later. Some user space > > applications like turbostat fail to continue with the failure. So, > > check > > error during attribute creation. > > > > Fixes: 8a54e2253e4c ("platform/x86/intel-uncore-freq: Uncore > > frequency control via TPMI") > > Hi, > > Thanks for the update but that commit id looks bogus, or where the > value > is used w/o error check? commit 8a54e2253e4c25e5b61c9a9bee157bb52da5d432 Author: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Date: Thu Apr 20 15:05:14 2023 -0700 platform/x86/intel-uncore-freq: Uncore frequency control via TPMI This is the commit exposed the issue. This is not the commit which changed the code in question. I can add also Fixes: dbce412a7733 ("platform/x86/intel-uncore-freq: Split common and enumeration part") But the change even before that as this commit just reorganized code but because of change of folders, that will look like correct commit. Thanks, Srinivas
On Tue, 3 Oct 2023, srinivas pandruvada wrote: > On Tue, 2023-10-03 at 16:10 +0300, Ilpo Järvinen wrote: > > On Mon, 2 Oct 2023, Srinivas Pandruvada wrote: > > > > > When the current uncore frequency can't be read, don't create > > > attribute > > > "current_freq_khz" as any read will fail later. Some user space > > > applications like turbostat fail to continue with the failure. So, > > > check > > > error during attribute creation. > > > > > > Fixes: 8a54e2253e4c ("platform/x86/intel-uncore-freq: Uncore > > > frequency control via TPMI") > > > > Hi, > > > > Thanks for the update but that commit id looks bogus, or where the > > value > > is used w/o error check? > > commit 8a54e2253e4c25e5b61c9a9bee157bb52da5d432 > Author: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> > Date: Thu Apr 20 15:05:14 2023 -0700 > > platform/x86/intel-uncore-freq: Uncore frequency control via TPMI > > > This is the commit exposed the issue. This is not the commit which > changed the code in question. > > > I can add also > Fixes: dbce412a7733 ("platform/x86/intel-uncore-freq: Split common and > enumeration part") > > But the change even before that as this commit just reorganized code > but because of change of folders, that will look like correct commit. I never thought dbce412a7733 is being fixed here, it's just a refactor moving code around like you say. But how about 414eef27283a ("platform/x86/intel/uncore-freq: Display uncore current frequency") which actually adds the code line you're now fixing. What was broken before it? All I see is the one call in show_perf_status_freq_khz() but that's checking for errors.
diff --git a/drivers/platform/x86/intel/uncore-frequency/uncore-frequency-common.c b/drivers/platform/x86/intel/uncore-frequency/uncore-frequency-common.c index 1152deaa0078..33ab207493e3 100644 --- a/drivers/platform/x86/intel/uncore-frequency/uncore-frequency-common.c +++ b/drivers/platform/x86/intel/uncore-frequency/uncore-frequency-common.c @@ -176,7 +176,7 @@ show_uncore_data(initial_max_freq_khz); static int create_attr_group(struct uncore_data *data, char *name) { - int ret, index = 0; + int ret, freq, index = 0; init_attribute_rw(max_freq_khz); init_attribute_rw(min_freq_khz); @@ -197,7 +197,11 @@ static int create_attr_group(struct uncore_data *data, char *name) data->uncore_attrs[index++] = &data->min_freq_khz_dev_attr.attr; data->uncore_attrs[index++] = &data->initial_min_freq_khz_dev_attr.attr; data->uncore_attrs[index++] = &data->initial_max_freq_khz_dev_attr.attr; - data->uncore_attrs[index++] = &data->current_freq_khz_dev_attr.attr; + + ret = uncore_read_freq(data, &freq); + if (!ret) + data->uncore_attrs[index++] = &data->current_freq_khz_dev_attr.attr; + data->uncore_attrs[index] = NULL; data->uncore_attr_group.name = name;