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 B92043955CD for ; Thu, 21 May 2026 06:40:07 +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=1779345609; cv=none; b=Aq9ygBo/c5F4xkkoxMHcTftYMcTN0OQOK8GkfD6YMARLE9NXrvMbBMmEzvkWGAFhXu46FmtTP4mhZJFRhn0FnQLgx2tF++WxUK214vC09ypqohRbX2bNpIIJDifNR2zLVRCFH/0COkMatF0Oqefggl6qArb7QSqlpBFidhmRMlk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779345609; c=relaxed/simple; bh=zgB9mUITIYcZE/y0hrDzvFIcFVqkISn223M7bj/W1Qc=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=MLqNNrEPsC5ZfgflfM+qQPJU3PtsZiJLQq+YwYHenvYVWcaRYQ4kcxqpXFGvpe3Hb/K9fSaGkN4jaOx8puTtzHgW1ua5OUZYFni/51YTBjfGMsQI3I+WgtLFUBBrVnAKxga5PfSbYpe84LWz+Zp3rJD0XeuIo9LT8McnyP00uOk= 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=WgNQzhZU; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=Cv7h+yNe; 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="WgNQzhZU"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="Cv7h+yNe" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1779345606; 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:autocrypt:autocrypt; bh=pKCaTYqEYGK/9+YqKBNGD4rlt1kgVp7hhuTufJu49DQ=; b=WgNQzhZU/MAapOo8ijYoW54Ia41zhiuu8jxqock1Mz9Bd0mMgTySnlME5PwHrVcFNm3zPc fNzT+GbxUcGou8aBZk5AccZd5pUDu3TZOZuAV33xhC1w9/pzoU4MP4XkOykGpbeeS3zYk0 8JcmJP4ql8b0YKhEcDmM+R0gORVpSvQ= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-593-2q_IgitLNeCMIqntMv1CzA-1; Thu, 21 May 2026 02:40:05 -0400 X-MC-Unique: 2q_IgitLNeCMIqntMv1CzA-1 X-Mimecast-MFC-AGG-ID: 2q_IgitLNeCMIqntMv1CzA_1779345604 Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-44f1b4d0fb0so3465644f8f.1 for ; Wed, 20 May 2026 23:40:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1779345604; x=1779950404; darn=vger.kernel.org; h=mime-version:user-agent:content-transfer-encoding:autocrypt :references:in-reply-to:date:cc:to:from:subject:message-id:from:to :cc:subject:date:message-id:reply-to; bh=pKCaTYqEYGK/9+YqKBNGD4rlt1kgVp7hhuTufJu49DQ=; b=Cv7h+yNepgX/L1Qza2yVwuNWJNh6+6HQ934GtfW0iOK0tcJVuOWVJsp/6KOJOjq5SA F/joyEmw09Rq8RYblmNqh07Upop5UVAnpoAaBHBmO+wur4yanJJidDW2RNTotC5mHsbL hKMD+/O3ERBmKrSE86GI9K0rnlBf/ZY4sD3kp/GAmH5Ke7TP5jHI0Z5HDbdGOmW62ZKw UzM1GBXU5nGiCNrImD3ZQ3oYTHNV3dnH6Xk7qQ7hPW/mhhBvGK4/1zfy19ACKKrgezLF ALz7MDXxYiecs+V8QiwsqeXT4zpDcxQTCHl2Ur24Vp59W8nDBPVKyZMi4ZuemOYTjfbw 07zw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779345604; x=1779950404; h=mime-version:user-agent:content-transfer-encoding:autocrypt :references:in-reply-to:date:cc:to:from:subject:message-id:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=pKCaTYqEYGK/9+YqKBNGD4rlt1kgVp7hhuTufJu49DQ=; b=HDhH4NrxHn9E02Nm7NFUIX5fJBW1N9edPjffbdhq6voK2O/EbKGedY9vV4GsrRpI45 dkfEdQ0vg1H+4WfxtGL6KeDf9c+5W6b098QOaPso7uOQukGha9WsNTR8YZixteyl/iuX SASHpH3qAmcUTOZUqdTMwu1w1+Qf3P98TkaKIciQOxjYHsdMG8LZ6ialzEJ2jB3+4MGZ cvy+SCoBq1nocML6I5GDXtrf9abu+WIf/Af3rLJs1pJq4BjyZ6mfLk7MgGhDYe0BYJzY x3gKXyOXCELp3rdIJimY0yNWYlwJBINYXKoG+9KNb6F4G3iIisog88rWxCtOeMXr9/gN EDIw== X-Forwarded-Encrypted: i=1; AFNElJ8BDnobVG7zDG1+wxwkI97YhpXCOT966CH55Wg3xXbQ/Aii7q5jpHG9j7VbiNQPKYdh+bYFDeq+pmEElN0=@vger.kernel.org X-Gm-Message-State: AOJu0Yz/HJoH+Q2oqjG6Mm9HuY5m1DvN2Iq5vTdwrVux9ceSte3c/iG6 Fr4PjVj4kX5ojry4DI3hkj7VZk1O4Z4DEaDdqEjOOzSAkTzsThto7iH19bMuVf/h8aYog8COWgk IFO9gr3jWMrAWpKCN3vxO4ybwcT+evh8NDheRloOd45qZ7bOE7Rzv+Uj/TaVS6OMCprSs6TqTPO aa X-Gm-Gg: Acq92OHKTs5UUUL0CWp9RLanYhQmWWkgAaxJlrq3upE42RHqgduHIcjWIB5pDrp+K5E 6GMWJx66ACYS35Df2Bj/L3K7Cw7M9ya5+Ee+rrVn+qQgXVJ2dT7D+SR46tA+fvWbYeUfUvDq/iB ikjJPPen1oEnaMYSBHg/2NCs+t7HLd4nJr04fbO2bNec8yZtb/oySAlSmC5fgLZX+Czn2Su9QP+ vdm/5pVFJ2i0f5QE9v+WU+V7wJ8MuvJ5K98DMxhaj6X0qqrLTFsizDYI/2fXypUcuWho7dVwbuy yagHmps8gsForapniMSAJIa1bT5I5m8+ZKrEvMykrPmQ5Z++x2m34Qy8LB6D0i+EyPtCN3VxVTI VKAFYKIz+EeKN5HM9XKEdGb0BZdg2yaBSoTzFJl6vLg5m6q90uBXgTazuICAV9Zi7hGcwSufttd ldRfinEuQmRHmcL8M= X-Received: by 2002:a05:6000:25e8:b0:441:1cf9:4f06 with SMTP id ffacd0b85a97d-45ea410d5a8mr2013978f8f.31.1779345602957; Wed, 20 May 2026 23:40:02 -0700 (PDT) X-Received: by 2002:a05:6000:25e8:b0:441:1cf9:4f06 with SMTP id ffacd0b85a97d-45ea410d5a8mr2013868f8f.31.1779345602103; Wed, 20 May 2026 23:40:02 -0700 (PDT) Received: from gmonaco-thinkpadt14gen3.rmtit.csb (212-8-243-115.hosted-by-worldstream.net. [212.8.243.115]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-45eaa7dab28sm352092f8f.12.2026.05.20.23.40.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 May 2026 23:40:01 -0700 (PDT) Message-ID: Subject: Re: [PATCH 3/3] rv/rtapp: Add wakeup monitor From: Gabriele Monaco To: Nam Cao Cc: Steven Rostedt , linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org Date: Thu, 21 May 2026 08:40:00 +0200 In-Reply-To: References: Autocrypt: addr=gmonaco@redhat.com; prefer-encrypt=mutual; keydata=mDMEZuK5YxYJKwYBBAHaRw8BAQdAmJ3dM9Sz6/Hodu33Qrf8QH2bNeNbOikqYtxWFLVm0 1a0JEdhYnJpZWxlIE1vbmFjbyA8Z21vbmFjb0BrZXJuZWwub3JnPoiZBBMWCgBBFiEEysoR+AuB3R Zwp6j270psSVh4TfIFAmjKX2MCGwMFCQWjmoAFCwkIBwICIgIGFQoJCAsCBBYCAwECHgcCF4AACgk Q70psSVh4TfIQuAD+JulczTN6l7oJjyroySU55Fbjdvo52xiYYlMjPG7dCTsBAMFI7dSL5zg98I+8 cXY1J7kyNsY6/dcipqBM4RMaxXsOtCRHYWJyaWVsZSBNb25hY28gPGdtb25hY29AcmVkaGF0LmNvb T6InAQTFgoARAIbAwUJBaOagAULCQgHAgIiAgYVCgkICwIEFgIDAQIeBwIXgBYhBMrKEfgLgd0WcK eo9u9KbElYeE3yBQJoymCyAhkBAAoJEO9KbElYeE3yjX4BAJ/ETNnlHn8OjZPT77xGmal9kbT1bC1 7DfrYVISWV2Y1AP9HdAMhWNAvtCtN2S1beYjNybuK6IzWYcFfeOV+OBWRDQ== Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.60.1 (3.60.1-1.fc44) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 On Tue, 2026-05-19 at 09:49 +0200, Nam Cao wrote: > Add a wakeup monitor to detect a lower-priority task waking up a > higher-priority task. >=20 > The rtapp/sleep monitor already detects this. However, that monitor > triggers an error in the context of the woken task and user only gets the > stacktrace of that task. It is also extremely useful to get the stacktrac= e > of the waking task, which this monitor offers. In other words, this monit= or > complements the rtapp/sleep monitor. >=20 > Signed-off-by: Nam Cao Looks neat, so the idea here is that we are looking at the same events sleep would react for, just from a different perspective, so it does make sense to run them both together. You may want to set depends on RV_PER_TASK_MONITORS >=3D 3 in rtapp/Kconfig. Though if we plan to add more per-task monitors we may need to find a better solution. > diff --git a/tools/verification/models/rtapp/wakeup.ltl > b/tools/verification/models/rtapp/wakeup.ltl > new file mode 100644 > index 000000000000..a5d63ca0811a > --- /dev/null > +++ b/tools/verification/models/rtapp/wakeup.ltl > @@ -0,0 +1,5 @@ > +RULE =3D always (((RT and USER_THREAD) imply > + (not (WOKEN_BY_LOWER_PRIO or WOKEN_BY_SOFTIRQ)) or > ALLOWLIST)) > + > +ALLOWLIST =3D BLOCK_ON_RT_MUTEX > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 or FUTEX_LOCK_PI So here the events and atoms are similar to the ones in sleep, but since we fail on the waking event, we are going to see it from the perspective of the waker task, right? But are those really equivalent? Why do we do RT and USER_THREAD here while there is a much more nuanced set of conditions in sleep? If I understand it correctly, sleep can monitor some kernel threads but this monitor does not, is there a reason for that? Are we just not interested in the waker for kernel threads? > diff --git a/kernel/trace/rv/monitors/wakeup/Kconfig > b/kernel/trace/rv/monitors/wakeup/Kconfig > new file mode 100644 > index 000000000000..3cf11c5cd5f7 > --- /dev/null > +++ b/kernel/trace/rv/monitors/wakeup/Kconfig > @@ -0,0 +1,17 @@ > +# SPDX-License-Identifier: GPL-2.0-only > +# > +config RV_MON_WAKEUP > + depends on RV > + depends on RV_MON_RTAPP > + depends on HAVE_SYSCALL_TRACEPOINTS > + select TRACE_IRQFLAGS > + default y > + select LTL_MON_EVENTS_ID > + bool "wakeup monitor" > + help > + =C2=A0 This monitor detects a lower-priority task waking up a > + =C2=A0 higher-priority task. The RV_MON_SLEEP monitor already > + =C2=A0 detects this case, but this monitor detects in the context > + =C2=A0 of the waking task instead. This and RV_MON_SLEEP can be > + =C2=A0 enabled together to get the stacktrace of both the waking > + =C2=A0 task and the woken task. I'm not sure if there is any better terminology, but "waking" task makes me think of the task that is about to be woken, though it can mean also that task that is waking another (what you probably mean here). What about using the waker/wakee terminology? I see the kernel (events/sched.h) uses waking as well, but it says waking context (which a bit clearer to me than waking task). May be worth running it through an LLM which can produce more English-native unambiguous wording, or maybe I'm just flipping.. Also please document it in Documentation/trace/rv/monitor_rtapp.rst Thanks, Gabriele