From nobody Tue Dec 2 02:49:41 2025 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 651E535CB74 for ; Tue, 18 Nov 2025 15:58:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763481528; cv=none; b=UD1rro4ukz3pIqSAuBZ1LY7xHcvSQKANg8fKi7TLr5AdxMGGMvvUB3yPK3/j7IacDUt1db0sBtrgH/jzr8lfbDLS6X7R8rcphVVLwFhk/i0W4doF3zl7GLwzpeZnao2riPyx/UXuYVPl0FRRUkWf+MiQeBNHFsfMEvvVzZuGLb0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763481528; c=relaxed/simple; bh=w/IZMKw3JZlQsVeZkGgKBw6RsNQiyGUgrwYveTjVUIo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tqeECYEuL2zCHq/j8E5Qa9OYHjD1LtMYARsyxowAVDqKaTUOi9HZZcozfZlwvn5S0RT79PmTd1dg0IBFjvquin63Bw+i68+6Q4admWMDUg+4t5Sg0DoP1Kdm2FFGJx+gI6M4OvQQfhiXHgpsqjcLtpR6gY/ZpgMKrBaCz6EEdfY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=arF9vD32; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="arF9vD32" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1763481526; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VR6q9nN6tLl0OjvkimuaeaYQsj1H42Iqp2Su1pl+Lbk=; b=arF9vD32gW1+kIs+fAnoX9QOZMHi3zEZNv7lvUw9TEAmhOaNcXRHE+Hi2Nl9P/x0JUOE2j J+4AFDbjdwvfRfa6JNFXYQMwxujGlNf7GcpcGHDFvxpkax4Q9RHBqkGKVOQuWbO1uSDyxX PUhiyfcTLLvyOgt5zEDC0mY1dFL8YYA= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-157-dplfiAZ1MWy2ktaNS09uKQ-1; Tue, 18 Nov 2025 10:58:39 -0500 X-MC-Unique: dplfiAZ1MWy2ktaNS09uKQ-1 X-Mimecast-MFC-AGG-ID: dplfiAZ1MWy2ktaNS09uKQ_1763481518 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (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 mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 18A581955F68; Tue, 18 Nov 2025 15:58:38 +0000 (UTC) Received: from darcari-thinkpadt14sgen1.bos.com (unknown [10.22.64.106]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id DA7C819560B0; Tue, 18 Nov 2025 15:58:36 +0000 (UTC) From: David Arcari To: lenb@kernel.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, David Arcari Subject: [PATCH 3/3] tools/power turbostat: allow turbostat to work when aperf is not available Date: Tue, 18 Nov 2025 10:58:13 -0500 Message-ID: <20251118155813.533424-4-darcari@redhat.com> In-Reply-To: <20251118155813.533424-1-darcari@redhat.com> References: <20251118155813.533424-1-darcari@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 Content-Type: text/plain; charset="utf-8" Currently when aperf is not available the function has_amperf() still returns true. The end result is that the program gets an error in delta_thread() which causes turbostat to restart. We can avoid this by not setting msr_counter_arch_infos[MSR_ARCH_INFO_APERF_INDEX].present when aperf is not available allowing turbostat to execute normally. Signed-off-by: David Arcari Cc: Len Brown Cc: linux-kernel@vger.kernel.org --- tools/power/x86/turbostat/turbostat.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbos= tat/turbostat.c index 5567b9ecd516..b3f1e4ae5813 100644 --- a/tools/power/x86/turbostat/turbostat.c +++ b/tools/power/x86/turbostat/turbostat.c @@ -8592,6 +8592,10 @@ void msr_perf_init_(void) continue; =20 if (cai->needed) { + /* check to see if APERF is available */ + if (cidx =3D=3D MSR_ARCH_INFO_APERF_INDEX && !has_aperf) + continue; + /* Use perf API for this counter */ if (add_msr_perf_counter(cpu, cci, cai) !=3D -1) { cci->source[cai->rci_index] =3D COUNTER_SOURCE_PERF; --=20 2.51.0