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 E7A6821A421 for ; Tue, 25 Nov 2025 00:46:40 +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=1764031602; cv=none; b=G0wSZmGJRSscVJSdCiXJGhhYtZ4FiOIF1D7uEQlA6uh4uA4sLNLyKt4w7WFyvTTYZCnhgLql9E/J1+jl+IdqiFNG1Y8psCpgxaE5mIGwkTMUUwhikKJyXhfsSjRkMgSNmDylJ2n9b/CfouGagMR+fmAyagswRv0il1Fpdlc+4Oo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764031602; c=relaxed/simple; bh=pnrl98pANeFRRT4olQ42d6NG6Yzwq+czl0kMIqqxVJs=; h=Message-ID:Subject:From:To:Date:In-Reply-To:References: Content-Type:MIME-Version; b=CIQNr531CTLt9KB3+uNAkt7+RRh12APxCmtwWyQxCNybc+w9tWG8BhrjMgS7vOIBFHkQa9YnGCAe4fhxmiS1QcsXnHNW2VYiWwB9YYDw1jqWeG7kPF4hbzProd6+P3Q4DYIeL3Ec/TiEi+h5gW35iuJ5qLGfuNFH9j/CWV2TfUQ= 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=ZRAxCzNW; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=a+nK2vCy; 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="ZRAxCzNW"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="a+nK2vCy" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1764031599; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uQNtnWOsotCA1HNvoVlP0i2b01R7aawce9e6oJOL594=; b=ZRAxCzNWWcNeBjpCKdosTbBL5bMyr1vPYgR7XnNOf3KfyxS5YUMsdknN7mMsonn7y/ZM/t tnuZwLbW4+OCD6OYvxnQq0QorqbIGPbuYM20m+u5Fg29nKapnq46wpcY8mrsamhJ/55nDn l0LMb1+o8C+4ge2lOo6i/rTaY9BK0ss= Received: from mail-qv1-f71.google.com (mail-qv1-f71.google.com [209.85.219.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-530-i__wRkxcNvmqiFeFCxtg5g-1; Mon, 24 Nov 2025 19:46:38 -0500 X-MC-Unique: i__wRkxcNvmqiFeFCxtg5g-1 X-Mimecast-MFC-AGG-ID: i__wRkxcNvmqiFeFCxtg5g_1764031598 Received: by mail-qv1-f71.google.com with SMTP id 6a1803df08f44-882529130acso132953686d6.2 for ; Mon, 24 Nov 2025 16:46:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1764031598; x=1764636398; darn=vger.kernel.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:from:to:cc:subject:date :message-id:reply-to; bh=uQNtnWOsotCA1HNvoVlP0i2b01R7aawce9e6oJOL594=; b=a+nK2vCyRx89fcfBJxm3DXE4nmpB/xBnlB2kF2DdIJNi5iQoE7g+w1h5ZipF9cGZO8 THkpUlObS5pRio01gJ3xgpnGMrFLxKdUxfz+BARDlupGubZHl7tySxMNT7X0MMEI2y/L eGpaYwoSB1QcDiMfmi5nhvMqRjfQlYfZ/tSbJ2xHTMLIA7aG4CveNLJg4Abc3FUM9pv6 hoCdC0PpDvY+GOOUqqnzLFQHnz06SE56A+tnnyFFmAdL6GnhZMMrlSF2iCN/1Y9ClOxV L1PieInof0/WigDBpLux7KFM7tDmQbsNPmyNs4Hpie9tlxeZj+7G+L6v9ICD2cPxxHxC 2LiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764031598; x=1764636398; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=uQNtnWOsotCA1HNvoVlP0i2b01R7aawce9e6oJOL594=; b=gj0n1I9pUux6Gr2SLDOq+LbAqMn/scyGgmQD5s/JxptQHLl30OxpEwajjusukGMxVG yWjicQdwScKyZd+ezOf5F5uWKOH4PJBZHwYgcEBiDoOs7YvSwUuT7nJoQxiwsgeVbxkB n7C/ams1byZtbqEE30ACBhJtjHtr7nSi0hYr8MjVkp2prvys95t1MtxHEZNzB4asOQ9n ki28mSzDJTZ5qEcUq9MjlGqL2HekZGzybEWnmL0eRyGULpjZP6wcQ7vh0zVBssNyHtS5 z8q5QqM8nzppEoFPyc8h5iKEVrNS5tIktI61v+9ik3MdB708hk0t9ajjfj6z+k32TVFK dZcA== X-Forwarded-Encrypted: i=1; AJvYcCXqrztnzxMcm3/dsbZS72r/XQ7zD/4e1WLIJ3gq7NLN6eJrcETzux32bCnkg6p1r8H/82Z90vOyBQpCLIk=@vger.kernel.org X-Gm-Message-State: AOJu0YxMQ8ft4R7rOF+CdWZS/SulZRPOpMowxLt5Tok9Sxcy9uj3i6Oa Pt64BF4t4LZE2G8pc28WciqMvMpTD3pvWPZ83lSqk7cYm3+B5Q9VHkesDMNIOcof4NHWRkVAfjU CUaL3R7jLQ8pnh5HSqRtk+s04Y0nbwIZop/3K0z90zi1k0w0kA0lgf5ZsJgi0aWkAPg== X-Gm-Gg: ASbGncsD3BPzs0H7cijAqlp+t4IubmShdmfld4R3g9/efw+Nm2dzEAPbrcwbOGinbKh Uq0rb45dwiMipp3t5LFGcTqacB5IcKU2b0L2ouzzB8hgErH7b6MpTjnAl3wypiHhUjEP7xxCx10 J+6A5KHF8JYsr2Nb+8FF9FlHnVqBtxcpq7cnWsjm0XvH1FnU7lahx8N7aJHtJe/Om45wpVu7Ev/ WYj7NbSvbz4mfNjf8Ze1jvQLC+RtNjMjNBoFB922X0eD6sk+hcC63beHcbtPqF1wp3ZoHkD+yvL 3JuSj5eIzy/tqwlaWnDsR3GS2S+CRIqhnKmgMiReEkwJwue7hJ8yuyPZufIbsDgVFJF5QIHHEt+ HdeKCAcEHrwVFUcnnyertnfeonofHsti2xmmfHNqGlw== X-Received: by 2002:a05:6214:4a09:b0:882:4901:e960 with SMTP id 6a1803df08f44-8847c4c8123mr198048896d6.29.1764031597831; Mon, 24 Nov 2025 16:46:37 -0800 (PST) X-Google-Smtp-Source: AGHT+IHB5+f1yDnZK7hRMic4Sah4dDpUUJqEdE7scW0eh7drx/bT1c7yAK2y5dCpUKma/dEfKV08tw== X-Received: by 2002:a05:6214:4a09:b0:882:4901:e960 with SMTP id 6a1803df08f44-8847c4c8123mr198048636d6.29.1764031597486; Mon, 24 Nov 2025 16:46:37 -0800 (PST) Received: from crwood-thinkpadp16vgen1.minnmso.csb ([2601:447:c680:2b50:ee6f:85c2:7e3e:ee98]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-8846e54e94csm110992156d6.34.2025.11.24.16.46.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Nov 2025 16:46:37 -0800 (PST) Message-ID: Subject: Re: [rtla 07/13] rtla: Introduce timerlat_restart() helper From: Crystal Wood To: Wander Lairson Costa , Steven Rostedt , Tomas Glozar , Ivan Pravdin , John Kacur , Costa Shulyupin , Tiezhu Yang , "open list:Real-time Linux Analysis (RTLA) tools" , open list , "open list:BPF [MISC]:Keyword:(?:\\b|_)bpf(?:\\b|_)" Date: Mon, 24 Nov 2025 18:46:36 -0600 In-Reply-To: <20251117184409.42831-8-wander@redhat.com> References: <20251117184409.42831-1-wander@redhat.com> <20251117184409.42831-8-wander@redhat.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.56.2 (3.56.2-2.fc42) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 On Mon, 2025-11-17 at 15:41 -0300, Wander Lairson Costa wrote: > +enum restart_result > +timerlat_restart(const struct osnoise_tool *tool, struct timerlat_params= *params) > +{ > + actions_perform(¶ms->common.threshold_actions); > + > + if (!params->common.threshold_actions.continue_flag) > + /* continue flag not set, break */ > + return RESTART_STOP; > + > + /* continue action reached, re-enable tracing */ > + if (tool->record && trace_instance_start(&tool->record->trace)) > + goto err; > + if (tool->aa && trace_instance_start(&tool->aa->trace)) > + goto err; > + return RESTART_OK; > + > +err: > + err_msg("Error restarting trace\n"); > + return RESTART_ERROR; > +} The non-BPF functions in common.c have the same logic and should also call this. This isn't timerlat-specific. > diff --git a/tools/tracing/rtla/src/timerlat_hist.c b/tools/tracing/rtla/= src/timerlat_hist.c > index 09a3da3f58630..f14fc56c5b4a5 100644 > --- a/tools/tracing/rtla/src/timerlat_hist.c > +++ b/tools/tracing/rtla/src/timerlat_hist.c > @@ -1165,18 +1165,19 @@ static int timerlat_hist_bpf_main_loop(struct osn= oise_tool *tool) > =20 > if (!stop_tracing) { > /* Threshold overflow, perform actions on threshold */ > - actions_perform(¶ms->common.threshold_actions); > + enum restart_result result; > =20 > - if (!params->common.threshold_actions.continue_flag) > - /* continue flag not set, break */ > + result =3D timerlat_restart(tool, params); > + if (result =3D=3D RESTART_STOP) > break; > =20 > - /* continue action reached, re-enable tracing */ > - if (tool->record) > - trace_instance_start(&tool->record->trace); > - if (tool->aa) > - trace_instance_start(&tool->aa->trace); > - timerlat_bpf_restart_tracing(); > + if (result =3D=3D RESTART_ERROR) > + return -1; Does it matter that we're not detaching on an error here? Is this something that gets cleaned up automatically (and if so, why do we ever need to do it explicitly)? > + > + if (timerlat_bpf_restart_tracing()) { > + err_msg("Error restarting BPF trace\n"); > + return -1; > + } [insert rant about not being able to use exceptions in userspace code in the year 2025] -Crystal