From nobody Mon Feb 9 06:24:49 2026 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 F423920D4F4 for ; Wed, 14 May 2025 08:43:50 +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=1747212233; cv=none; b=h2ocJf+FEU8uIb1gYna/nC1v1QZEfWIO93YO4YHOZ0STbCYcEwSe5opdcNsme03QRdMiLrbJQ6c62PWQ3NB8h2VaNvfJWavtIENECi4vGpdjnSuFESumPIRz2zHQ12zavPYB6Q+umku1Gyv8zsC+MoxpQ8BbVQumqR4a97NFfwI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747212233; c=relaxed/simple; bh=t5YF7ZRNaz9q2EPYPyAIqR71z7VJx5Ztej15EcEYpVQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rf9BSLwQIWezwIiaHHy47PPIxDZ3QaNpF9epZD2L89Lq2JSHgBvDYuziB7+WMtD4jadF+oaV3gSSgAlSbkaAxFLEISF/4in4VHgmDOppYWio+PKBAFs6ujcgWFiRZXlKIKL81+pqQptkG55rjg19QsrH874+/wBHxp4/nVqs5lU= 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=YDKJ92gE; 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="YDKJ92gE" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1747212229; 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=KRoRGCXU3N75lAiWUaCzoWUZ/uQ4F+w7zRjkjVXsgqU=; b=YDKJ92gEOslmrysHhlNW8kpM0rtGiQ4CcirKnAA9SNnE5EiJ8kVbjSu2QgRm59JyGH1c51 ukNoDXHA1VFj29cmMhUWJvHX0Or8GOmbN2h+8JamAnT0qBtySnZZ6jxD11KDg0FnxvzCfC Rl8CB2pw45uZ2DhhXxjSJ5WF6HUi2gU= Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-335-6RD3GlvWNxm06YaGDXE5mA-1; Wed, 14 May 2025 04:43:45 -0400 X-MC-Unique: 6RD3GlvWNxm06YaGDXE5mA-1 X-Mimecast-MFC-AGG-ID: 6RD3GlvWNxm06YaGDXE5mA_1747212223 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (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-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 3DEF71800361; Wed, 14 May 2025 08:43:42 +0000 (UTC) Received: from gmonaco-thinkpadt14gen3.rmtit.com (unknown [10.44.32.189]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 439F81953B80; Wed, 14 May 2025 08:43:36 +0000 (UTC) From: Gabriele Monaco To: linux-kernel@vger.kernel.org, Steven Rostedt , linux-trace-kernel@vger.kernel.org Cc: Gabriele Monaco , Ingo Molnar , Peter Zijlstra , Nam Cao , Tomas Glozar , Juri Lelli Subject: [RFC PATCH v2 03/12] rv: Add da_handle_start_run_event_ to per-task monitors Date: Wed, 14 May 2025 10:43:05 +0200 Message-ID: <20250514084314.57976-4-gmonaco@redhat.com> In-Reply-To: <20250514084314.57976-1-gmonaco@redhat.com> References: <20250514084314.57976-1-gmonaco@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.15 Content-Type: text/plain; charset="utf-8" The RV da_monitor API allows to start monitors in two ways: da_handle_start_event_NAME and da_handle_start_run_event_NAME. The former is used when the event is followed by the initial state of the module, so we ignore the event but we know the monitor is in the initial state and can start monitoring, the latter can be used if the event can only occur in the initial state, so we do handle the event as if the monitor was in the initial state. This latter API is defined for implicit monitors but not per-task ones. Define da_handle_start_run_event_NAME macro also for per-task monitors. Signed-off-by: Gabriele Monaco Reviewed-by: Nam Cao --- include/rv/da_monitor.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/include/rv/da_monitor.h b/include/rv/da_monitor.h index 510c88bfabd4..215c3eb770cc 100644 --- a/include/rv/da_monitor.h +++ b/include/rv/da_monitor.h @@ -512,6 +512,30 @@ da_handle_start_event_##name(struct task_struct *tsk, = enum events_##name event) __da_handle_event_##name(da_mon, tsk, event); \ \ return 1; \ +} \ + \ +/* \ + * da_handle_start_run_event_##name - start monitoring and handle event = \ + * \ + * This function is used to notify the monitor that the system is in the = \ + * initial state, so the monitor can start monitoring and handling event. = \ + */ \ +static inline bool \ +da_handle_start_run_event_##name(struct task_struct *tsk, enum events_##na= me event) \ +{ \ + struct da_monitor *da_mon; \ + \ + if (!da_monitor_enabled_##name()) \ + return 0; \ + \ + da_mon =3D da_get_monitor_##name(tsk); \ + \ + if (unlikely(!da_monitoring_##name(da_mon))) \ + da_monitor_start_##name(da_mon); \ + \ + __da_handle_event_##name(da_mon, tsk, event); \ + \ + return 1; \ } =20 /* --=20 2.49.0