From patchwork Wed Oct 4 18:19:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: srinivas pandruvada X-Patchwork-Id: 148447 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:254a:b0:403:3b70:6f57 with SMTP id hf10csp321476vqb; Wed, 4 Oct 2023 11:19:45 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHMjnfS9PMsA+MIr+ihBPUhNKSo7p8N+iHmxQ9xi78zBdsBOowVFGTFrLax7PraeuUUclSX X-Received: by 2002:a17:902:e881:b0:1c4:4c10:6ae3 with SMTP id w1-20020a170902e88100b001c44c106ae3mr4120716plg.23.1696443585714; Wed, 04 Oct 2023 11:19:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696443585; cv=none; d=google.com; s=arc-20160816; b=HD+kk9dywUlWXnD/glX0OD72eLmW/Lnt786Iw5BvmQSYQCZjUqtrfxw9y+l0aJm4Yz 6xhgI1YvUVP4pRCT5aDlUqLyg4WPSuCX4SxF8BbP5fQFVAlO6vVvKLH0hk5jPK1gYptG 1pBUS188QgvlMBq74hwTMvZnsHaoUDZXUI5/orrHUVsIlnBDtrz7+REhxptywlfM7j9t ozj/9zVqjhBXBBYZNdyrt6fCPg5cxjPJslLzWNYmL4CJ9HP6ZuAQQjZfymm2a9bFM2Vx SxywkqJ2W+9x1frw8vcyI7gl3+w9ezJJxAGaYZjXCnPi8S7fahjFpmXhQiUktzoANyyC hB+Q== 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=qF9xaWgsaRBbUqY+UMbKWqRCA0wK6PcKkaMhSKTtAOg=; fh=WxcXzAXi1awalX5nBNdKiu2pCszhVA/a0vtqlN5we7w=; b=FOuRujTRpXtO4x1q3+0adKMiN/LzzG5J6TN9uJRhCOQydekAGrZqDu4iBKBtashdKj JBvSnmIVe7ImsKYfQaCaG2xAu0qNiWU+js2wHciYeK9zY6YfJywE0rVDSYEs6QLGiN2a 7yppQBxajwOiqk3Cz7SsUV+7ZAe6PG8UnGiGBcsUSNSq4v6APMRTdK/6occQDR9NvEKA pllqv85hKuIZSr00r9jKFE8y1ZsStpUeeXNvFUaloGCqIihS+LYxze5g1YLX0yKpcKW/ eRJV2jh/ieIMi4u2T+PA/xw7I8a0h38b24RodPzAwzP26plJ/5nPFYEVFeLLtKpNYLXy e42g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=USaAEg3l; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id u13-20020a170902e5cd00b001c74876f029si4636782plf.381.2023.10.04.11.19.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Oct 2023 11:19:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=USaAEg3l; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (Postfix) with ESMTP id 6A81C81BAA4B; Wed, 4 Oct 2023 11:19:43 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233968AbjJDST2 (ORCPT + 19 others); Wed, 4 Oct 2023 14:19:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52624 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233899AbjJDST1 (ORCPT ); Wed, 4 Oct 2023 14:19:27 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D241CA6; Wed, 4 Oct 2023 11:19:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1696443562; x=1727979562; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=398Y4rRHiy+pPsE5SVEZ7szUZOVOCdlOKy5wmqw0uZI=; b=USaAEg3lE0w4IHKBZcawZMLQFItzxy8HpLEzcQmRDxcOOjZLvYj54foI quKqYvGw5Yu+SQQnYQ3+7kbAxH1btVmZXuEHcs1rqhHXGI48AHnGbzNfj Kjl5G8pqJRaPVxAtoqVDCn3atyay+SaTp1ZmtQU64SpoOHyL1i1TxkunA Ue+PvHKMxq8pcFR0d1e988HMC3IBiNrk+45Znp8zHuhs720rx0OHFPlyO D/5GFGrFjZAalUUPRcV75JiOC/WtwMP4UurBJrN0JVyrDxsa8wXJ0tYMt neaJpHCWHMIbUo2kE1Z/21Kl/PnolbFBZW3mciezat2fyjNsDfQROw69K A==; X-IronPort-AV: E=McAfee;i="6600,9927,10853"; a="383164361" X-IronPort-AV: E=Sophos;i="6.03,201,1694761200"; d="scan'208";a="383164361" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Oct 2023 11:19:19 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10853"; a="925269272" X-IronPort-AV: E=Sophos;i="6.03,201,1694761200"; d="scan'208";a="925269272" Received: from spandruv-desk.jf.intel.com ([10.54.75.14]) by orsmga005.jf.intel.com with ESMTP; 04 Oct 2023 11:19:19 -0700 From: Srinivas Pandruvada 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 Subject: [UPDATE][PATCH] platform/x86/intel-uncore-freq: Conditionally create attribute for read frequency Date: Wed, 4 Oct 2023 11:19:15 -0700 Message-Id: <20231004181915.1887913-1-srinivas.pandruvada@linux.intel.com> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 X-Spam-Status: No, score=2.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Wed, 04 Oct 2023 11:19:43 -0700 (PDT) X-Spam-Level: ** X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778850029541813436 X-GMAIL-MSGID: 1778850029541813436 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: 414eef27283a ("platform/x86/intel/uncore-freq: Display uncore current frequency") Signed-off-by: Srinivas Pandruvada Reviewed-by: Ilpo Järvinen --- Added fixes tag which added current_freq_khz. But after this tag there is reorg of code, so need manual backport for some versions. I will separately submit to stable trees after merge. .../x86/intel/uncore-frequency/uncore-frequency-common.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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;