From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.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 0226D35CB74 for ; Tue, 18 Nov 2025 15:58:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763481517; cv=none; b=GEza5fY02cyxwV/plVaFVYL0SeZztpkv0tv0Mr6ObRAbpSl0Fr8XIfxoJcD8iyHALa8udcDWPO7ARruYV33AywGyIgL6v7Z88/eqlWUQkgwF/XRJ40g9BjFDNYKtbtTWJe5g1phzMe4sGIy+1fkEIZzXVj6HHr7bLvwD7zePkCk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763481517; c=relaxed/simple; bh=yiJDl6m3XAGcCfRTHYyJvD8loHqd12eWZyQ8i24k/iI=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=XzIBQXaGegHLvcKLv7V8PPQFmF/H0DJ7V6/cBo62Z2Mnmzmo8L/tNh7siQakRPw+LArWYkK8qPuBTlYgPQpvH1F1o28wNDV2XtA6bcwVhle+VO3zw26TOQB6EI/eKbJ+qR7mIkaalYeqkCAsZlFmba4JBDLktCz/hiFNc8HGF9g= 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=PgwrI9sK; arc=none smtp.client-ip=170.10.133.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="PgwrI9sK" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1763481514; 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; bh=bi9/FXUhgoW+SY4yZlL7frUadHPixUKVZpH6M4SJWqI=; b=PgwrI9sKKi1gienyteX0VdHwOg2IV7UXSNt3pZxi5dnbCjSK8Xic2o5RebVQ4yKl6mACqe A9Tei//WTHkg5401INDz5fws/HZp4lNqr1K2+2BRYoKREw/FizyW2CxbriETV29zjLVDJe BfnWkxnQlKWQs52dJH9jtl1An4TRfy4= Received: from mx-prod-mc-01.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-610-1SHvSqDFMPOZmChfMJx_wA-1; Tue, 18 Nov 2025 10:58:31 -0500 X-MC-Unique: 1SHvSqDFMPOZmChfMJx_wA-1 X-Mimecast-MFC-AGG-ID: 1SHvSqDFMPOZmChfMJx_wA_1763481509 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-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id C472D1956065; Tue, 18 Nov 2025 15:58:29 +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 5165C19560B0; Tue, 18 Nov 2025 15:58:28 +0000 (UTC) From: David Arcari To: lenb@kernel.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, David Arcari Subject: [PATCH 0/3] tools/power turbostat: Fix segfault and restart loop issues Date: Tue, 18 Nov 2025 10:58:10 -0500 Message-ID: <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: 8bit X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 This patch series addresses three stability issues found in turbostat, primarily affecting virtualized environments where specific hardware counters (like APERF) or MSR access may be restricted or inconsistent. Patch 1 fixes a segmentation fault caused by referencing a NULL fd_instr_count_percpu pointer. This occurs on systems where has_aperf is 0 (preventing allocation), but has_aperf_access is 1 (allowing the function call). Patch 2 prevents an infinite loop when turbostat attempts to restart. It ensures the restart limit is checked in all error paths and removes logic that incorrectly reset the retry counter. Patch 3 allows turbostat to proceed gracefully when APERF is unavailable. Previously, the missing counter caused delta_thread() to error out, triggering the restart mechanism. David Arcari (3): tools/power turbostat: avoid segfault referencing fd_instr_count_percpu tools/power turbostat: avoid an infinite loop of restarts tools/power turbostat: allow turbostat to work when aperf is not available tools/power/x86/turbostat/turbostat.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) -- 2.51.0