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.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 B88732F6579 for ; Mon, 1 Dec 2025 12:18:41 +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=1764591523; cv=none; b=LuVWowHwZpHSzTzgS1w1Fx1wMCRsg98OeJaKiYeU5bbpL2ljUbUksCxEHWLuhIq5H/yX3TVVu6IJaW1ldGBP+RU3DswocB7XQAuUjWTNpY4cO89AzhUgq3ljB8q1cgd8dC74Qb308w/DMz+nQj1Be8WX2Xms32BTj47rgi237Wg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764591523; c=relaxed/simple; bh=oCHZXbXEVdz5K26qu7KvkuPVN4xxQZUgIPc1punUYiA=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=aN9LoKqN2DJA911V2+eB3I3AShWCYvn9h49PAcpZNGXBVl18acK0lMKXDGcAKBvSQQx6LDeS7NUDYLCZXxyP93AFj7EIyE+pXWDMS/1NSiYGsardwGmD+bRX/FZ1smDxEnUl47DkwF4TReaZDjzYjrjdchCQJQRtrkyGb9L6wV0= 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=TxKPbHjr; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=ViT3gJUf; 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="TxKPbHjr"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="ViT3gJUf" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1764591520; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0sUJlSyAUSGPuoTmGrlvdIcvz2TUMh3K5nx8FOyBU/s=; b=TxKPbHjrPtoHRu0BYnB9WRVlqd0n4Rl41Nn8vXq45+a/2Y6pOfJfLc2fcYzLI0+I+hqO2H 0TJhO7BKrrKb2KrSFw9nS+mvJDbkGFZUoRnTUI2tdzS1oxb68RUSqAWFnKuMnGvbTSvsMn OewT15wCzqaKbE1c8BRkF6tnyLxdF90= Received: from mail-qv1-f72.google.com (mail-qv1-f72.google.com [209.85.219.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-567-vjrd57PfPK2mR0rfYe7Yng-1; Mon, 01 Dec 2025 07:18:39 -0500 X-MC-Unique: vjrd57PfPK2mR0rfYe7Yng-1 X-Mimecast-MFC-AGG-ID: vjrd57PfPK2mR0rfYe7Yng_1764591519 Received: by mail-qv1-f72.google.com with SMTP id 6a1803df08f44-8823f4666abso81131706d6.0 for ; Mon, 01 Dec 2025 04:18:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1764591519; x=1765196319; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=0sUJlSyAUSGPuoTmGrlvdIcvz2TUMh3K5nx8FOyBU/s=; b=ViT3gJUfP5neRmRfC+Hsad7EAUasd9KRh56WrNh8Qh8S7dDFk8YGXHnYsE00ZX5RWX W9LHQ8ZFF2jNCtV4ha/EdpYTWY7qs2nKWIqutla3+I4/UxxaHBXXGWZsxx+GTQ0u3S6I GZzhtEIhrbZDAdzz4FNwduCXiAFa7ej3Kyuj4reDjjrw3tE5MPwAY8GAaSvfOs/PzfAo FDY442gpnXThljT1NqKzS0v5m3PrgxLLPuZoYM/cBQtyZ80gba7FNkJKZaoWuHk0SwYk RApjD6bZvhSc5L8XdE6RpxNFBJdzp8/iKBy73ugLivAMdOCID2UKe5vVsP92IABwONNh xTIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764591519; x=1765196319; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=0sUJlSyAUSGPuoTmGrlvdIcvz2TUMh3K5nx8FOyBU/s=; b=pmmlw2TqZhC6iu5ac0gYtmJxb88QL9+qwr59LuLL6WAVoRo9ER/WoVvG0wBKsBBhY+ hH6iT4vAs7PQefSKtQMip6GYdPNqfLT8KwAKNpLWyz7/4Z6Yb5BmR792pn3yBDuA44cy BiwIAaxHY0FK/7scBtRRlpUud4DL2d1zbgiOLY/wWBeGc5jNaoR1iIUQbghEMAbKCOS/ 1vAPA8s1gS/t2aLpZFES30SFdWeXEkCjvmlEpVVjCGBqFGn8L3euHfG6LDj9MUZdwt7m X3FaKQvMcgF8ZzPahzSEqsFWWRMRVqsdN2PV7DL3kL6RWnoEURTWQ6U8htstsSz14gEQ JThg== X-Forwarded-Encrypted: i=1; AJvYcCVM2ya4Lf6RzYZGfU0tpxX2KNFAFw7N2EiKMl2KaqGE2gA/DIv93piLt+htvVzdsYuPBuSJjEou6FBd7p4=@vger.kernel.org X-Gm-Message-State: AOJu0Yw/gpF/yQ9xj7oLuE16PppTbJbvkigzfrUbjmrxM+q5JMBu0wHb NgeJmtbO/UAhOEE/2Ando5fpi7rb6bKjqm8tQ1SFjSC/JhPnBBwJONVNR5LpvSDt2n1Zxm2snzd c7GgRLH//z0P7AwQ55aL0lhDSqzVaMP6xmU84aA0p/7JXMjePUC5LZloxLQLsau+fw6oJ4iy3Pg == X-Gm-Gg: ASbGncuAgzxW8n/kaJnKVjH10d6qgMRD/B57GL08GlGmwlDKBvRCUj3UbYkqI2TaDUk CyR1OAHqzylg5MQ4lFXkHsTtpDKQg/7i/ReSzz/NoqLyvgTQtG5P4G05DHJuty0IX6f+9O3GI+s a6pWslKwL1h/qy//qr2oBHkhzt+7jFbz898ee7y/YU5kvXVrMpPO8hLGz1W8dx4Zff1vSzNbjQd Kff903nY+J9/zF+e/g1gybHH6Dd0SJisgP7TueU8kHPjZCygQUQvArs2PR6bbiyLzXiXq4eXnL9 OsdLOwbeb2DPsLOR+SlLh5c2evMqMLnH1tNpP1Hugms8CnmnH76/O3ATatSD6wJ3DePKICO85uK Hudbv+KTXpQ== X-Received: by 2002:ac8:5812:0:b0:4ed:685e:f3d3 with SMTP id d75a77b69052e-4ee58b3ece8mr533090331cf.81.1764591518989; Mon, 01 Dec 2025 04:18:38 -0800 (PST) X-Google-Smtp-Source: AGHT+IEN6yol5HTKr2uldB/3oVvsj1QC1opMKCsf6GxKBwGiJ4IH5kVwSXOATuZ79XukZteMYFMRTg== X-Received: by 2002:ac8:5812:0:b0:4ed:685e:f3d3 with SMTP id d75a77b69052e-4ee58b3ece8mr533089771cf.81.1764591518549; Mon, 01 Dec 2025 04:18:38 -0800 (PST) Received: from [10.26.1.94] ([66.187.232.136]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-4efd344a188sm73518701cf.33.2025.12.01.04.18.37 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 01 Dec 2025 04:18:37 -0800 (PST) Message-ID: <10b3298c-99ab-4567-a793-9f12fa7f1dd0@redhat.com> Date: Mon, 1 Dec 2025 07:18:36 -0500 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 2/3] tools/power turbostat: avoid an infinite loop of restarts To: Len Brown Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org References: <20251118155813.533424-1-darcari@redhat.com> <20251118155813.533424-3-darcari@redhat.com> <41373082-e421-496f-955d-bc9abbf44be4@redhat.com> Content-Language: en-US From: David Arcari In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit I'll take a look with that in mind, but this is really a second order issue and could be deferred until a latter date. It's patches 1 and 3 that resolve the main issue and should be resolved more quickly. -DA On 11/27/25 12:45 PM, Len Brown wrote: > I guess it is sort of an art form upon malfunction to decide whether > it is fatal or not. > > I suppose if we know that a counter used to work, and it stops working, then we > are responding to a configuration change. We don't want to count a > certain number > of configuration changes as a fatal error. > > A more useful heuristic may be to recognize when there are failures > without any intervening successes, > and if those happen many times per second. Likely that is the > infinite loop case we're looking for... > > On Tue, Nov 25, 2025 at 4:51 PM David Arcari wrote: >> >> >> I see. Perhaps this isn't fixable then. I'll take another look. >> >> -DA >> >> On 11/25/25 2:12 PM, Len Brown wrote: >>> this patch introduces a limit of 10-restarts per turbostat lifetime, >>> down from infinity. >>> >>> some turbostat invocations span multiple uses of cpu online/offline -- >>> so this limit will not fly. >>> >>> On Tue, Nov 18, 2025 at 10:58 AM David Arcari wrote: >>>> >>>> There are some error cases where turbostat will attempt to reinitialize >>>> by calling the re_initialize() function. The code attempts to avoid >>>> an infinite loop by checking the value of 'restarted' in one case, but >>>> not others. It should be checked in all cases of restart. Additonally, >>>> the 'restarted' is reset to zero at the start of the loop which also >>>> needs to be removed. >>>> >>>> Signed-off-by: David Arcari >>>> Cc: Len Brown >>>> Cc: linux-kernel@vger.kernel.org >>>> --- >>>> tools/power/x86/turbostat/turbostat.c | 10 +++++----- >>>> 1 file changed, 5 insertions(+), 5 deletions(-) >>>> >>>> diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c >>>> index 584b0f7f9067..5567b9ecd516 100644 >>>> --- a/tools/power/x86/turbostat/turbostat.c >>>> +++ b/tools/power/x86/turbostat/turbostat.c >>>> @@ -6722,7 +6722,11 @@ void turbostat_loop() >>>> set_my_sched_priority(-20); >>>> >>>> restart: >>>> - restarted++; >>>> + if (restarted++ > 10) { >>>> + if (!retval) >>>> + retval = -1; >>>> + exit(retval); >>>> + } >>>> >>>> snapshot_proc_sysfs_files(); >>>> retval = for_all_cpus(get_counters, EVEN_COUNTERS); >>>> @@ -6730,13 +6734,9 @@ void turbostat_loop() >>>> if (retval < -1) { >>>> exit(retval); >>>> } else if (retval == -1) { >>>> - if (restarted > 10) { >>>> - exit(retval); >>>> - } >>>> re_initialize(); >>>> goto restart; >>>> } >>>> - restarted = 0; >>>> done_iters = 0; >>>> gettimeofday(&tv_even, (struct timezone *)NULL); >>>> >>>> -- >>>> 2.51.0 >>>> >>>> >>> >>> >> > >