mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Nam Cao <namcao@linutronix.de>
To: Gabriele Monaco <gmonaco@redhat.com>
Cc: linux-kernel@vger.kernel.org,
	Steven Rostedt <rostedt@goodmis.org>,
	linux-trace-kernel@vger.kernel.org, linux-doc@vger.kernel.org,
	Ingo Molnar <mingo@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Tomas Glozar <tglozar@redhat.com>, Juri Lelli <jlelli@redhat.com>,
	Clark Williams <williams@redhat.com>,
	John Kacur <jkacur@redhat.com>
Subject: Re: [PATCH v5 7/9] rv: Replace tss and sncid monitors with more complete sts
Date: Tue, 29 Jul 2025 11:25:10 +0200	[thread overview]
Message-ID: <20250729092510._Hq3RWF_@linutronix.de> (raw)
In-Reply-To: <76d7e572aae2ccd1699a461aded7a6146f6d8215.camel@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1922 bytes --]

On Tue, Jul 29, 2025 at 10:46:51AM +0200, Gabriele Monaco wrote:
> On Mon, 2025-07-28 at 17:53 +0200, Nam Cao wrote:
> > I gave this a try on riscv64 and observed some errors:
> > 
> > [  620.696055] rv: monitor sts does not allow event sched_switch on
> > state enable_to_exit
> > [  621.047705] rv: monitor sts does not allow event sched_switch on
> > state enable_to_exit
> > [  642.440209] rv: monitor sts does not allow event sched_switch on
> > state enable_to_exit
> > 
> > I tested with two user programs:
> > 
> >     int main() { asm ("unimp"); }
> >     int main() { asm ("ebreak"); }
> > 
> > The two programs are repeatedly executed:
> > 
> >     #!/bin/bash
> >     ./test1 &
> >     ./test2 &
> >     # ... repeat lots of time
> > 
> > Any idea?
> 
> Mmh I see what you're doing here..
> Those instructions are supposed to raise some sort of exception in the
> CPU which apparently disables and enables interrupts without raising an
> interrupt handler tracepoint (the discriminator for this monitor).
> This lets the monitor believe we passed the time a switch is possible
> and complain when it actually sees one.
> 
> I still couldn't reproduce it on my VM, yet I find the timing a bit
> strange: it's alright we handle the illegal instruction like this, but
> do we really end up doing that while scheduling although it doesn't
> look like an interrupt?!
> 
> Could you share a bit more about your riscv setup? It might some
> configuration/hardware specific thing.

Kernel:
  - base: ftrace/for-next
  - config: defconfig + mod2noconfig + PREEMPT_RT + monitors

Hardware:
	qemu-system-riscv64 -machine virt \
	-kernel ../linux/arch/riscv/boot/Image \
	-append "console=ttyS0 root=/dev/vda rw" \
	-nographic \
	-drive if=virtio,format=raw,file=riscv64.img \
	-smp 4 -m 4G

	riscv64.img is a Debian trixie image from debootstrap

Test:
	echo 0 > /proc/sys/debug/exception-trace
	./testall # see attached

[-- Attachment #2: test.sh --]
[-- Type: application/x-sh, Size: 373 bytes --]

[-- Attachment #3: testall --]
[-- Type: text/plain, Size: 480 bytes --]

#!/bin/bash
./test.sh &
./test.sh &
./test.sh &
./test.sh &
./test.sh &
./test.sh &
./test.sh &
./test.sh &
./test.sh &
./test.sh &
./test.sh &
./test.sh &
./test.sh &
./test.sh &
./test.sh &
./test.sh &
./test.sh &
./test.sh &
./test.sh &
./test.sh &
./test.sh &
./test.sh &
./test.sh &
./test.sh &
./test.sh &
./test.sh &
./test.sh &
./test.sh &
./test.sh &
./test.sh &
./test.sh &
./test.sh &
./test.sh &
./test.sh &
./test.sh &
./test.sh &
./test.sh &
./test.sh &
./test.sh &

  reply	other threads:[~2025-07-29  9:25 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-28 13:50 [PATCH v5 0/9] rv: Add monitors to validate task switch Gabriele Monaco
2025-07-28 13:50 ` [PATCH v5 1/9] rv: Add da_handle_start_run_event_ to per-task monitors Gabriele Monaco
2025-07-28 13:50 ` [PATCH v5 2/9] rv: Remove trailing whitespace from tracepoint string Gabriele Monaco
2025-07-28 13:50 ` [PATCH v5 3/9] rv: Use strings in da monitors tracepoints Gabriele Monaco
2025-07-28 13:50 ` [PATCH v5 4/9] rv: Adjust monitor dependencies Gabriele Monaco
2025-07-28 13:50 ` [PATCH v5 5/9] rv: Retry when da monitor detects race conditions Gabriele Monaco
2025-07-28 14:18   ` Nam Cao
2025-07-28 13:50 ` [PATCH v5 6/9] sched: Adapt sched tracepoints for RV task model Gabriele Monaco
2025-07-28 16:02   ` Nam Cao
2025-07-28 13:50 ` [PATCH v5 7/9] rv: Replace tss and sncid monitors with more complete sts Gabriele Monaco
2025-07-28 15:53   ` Nam Cao
2025-07-29  8:46     ` Gabriele Monaco
2025-07-29  9:25       ` Nam Cao [this message]
2025-07-29  9:37         ` Nam Cao
2025-07-29 14:06           ` Gabriele Monaco
2025-07-30 12:52             ` Nam Cao
2025-07-30 14:16               ` Nam Cao
2025-07-30 14:44                 ` Nam Cao
2025-07-30 15:09                   ` Nam Cao
2025-07-30 16:28     ` Nam Cao
2025-07-28 13:50 ` [PATCH v5 8/9] rv: Add nrp and sssw per-task monitors Gabriele Monaco
2025-07-28 15:56   ` Nam Cao
2025-07-28 13:50 ` [PATCH v5 9/9] rv: Add opid per-cpu monitor Gabriele Monaco
2025-07-28 15:58   ` Nam Cao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250729092510._Hq3RWF_@linutronix.de \
    --to=namcao@linutronix.de \
    --cc=gmonaco@redhat.com \
    --cc=jkacur@redhat.com \
    --cc=jlelli@redhat.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=tglozar@redhat.com \
    --cc=williams@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®