All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrea Righi <arighi@nvidia.com>
To: Tejun Heo <tj@kernel.org>
Cc: David Vernet <void@manifault.com>,
	Changwoo Min <changwoo@igalia.com>,
	Emil Tsalapatis <etsal@meta.com>,
	Emil Tsalapatis <emil@etsalapatis.com>,
	David Dai <david.dai@linux.dev>,
	Cheng-Yang Chou <yphbchou0911@gmail.com>,
	sched-ext@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] selftests/sched_ext: Add lazy preemption tests
Date: Fri, 18 Sep 2026 08:30:01 +0200	[thread overview]
Message-ID: <aqzaaWBFmXWGmo9I@gpd4> (raw)
In-Reply-To: <04f2f87431aae3f2d5f34349f685b397@kernel.org>

Hi Tejun,

On Thu, Sep 17, 2026 at 09:19:07AM -1000, Tejun Heo wrote:
> Hello, Andrea.
> 
> This is an AI review. The series was built and the tests pass under vng here
> in lazy and full modes, with nohz_full on 2-3 and on 1-3. Three things worth
> fixing and some leftovers.
> 
> On Thu, Sep 17, 2026 at 09:02:53AM +0200, Andrea Righi wrote:
> > +enum kick_scenario {
> 
> exit_test.h and hotplug_test.h share such enums between the BPF and user
> sides. The same would work here and for nohz_phase. run_invalid() and
> is_trace_scenario() depend on the two copies staying in order.
> 
> > +#ifdef HAVE_GENHDR
> > +#include "autoconf.h"
> > +#endif
> 
> Nothing uses CONFIG_ in kick.c anymore.
> 
> > +static struct victim spawn_victim(int cpu)
> 
> Same as spawn_gated_worker() in nohz_tick.c except for sched_setscheduler().
> util.c could hold one copy.
> 
> > +	file = fopen("/sys/kernel/debug/sched/preempt", "r");
> > +	if (!file)
> > +		return -1;
> 
> That file only exists with PREEMPT_DYNAMIC, and needs debugfs mounted. Every
> static kernel takes the INFO path and passes without comparing, including
> static PREEMPT_LAZY, which is the default on arm64, riscv, powerpc, s390 and
> loongarch where PREEMPT_DYNAMIC defaults off. uname can't tell either, as
> PREEMPT_LAZY selects PREEMPT_BUILD. /proc/config.gz covers static kernels
> when it's there. Otherwise skipping would be more honest than passing.
> 
> > +	SCX_EQ(both.resched_tif, immediate.resched_tif);
> > +	SCX_EQ(lazy_wait.resched_tif, immediate.resched_tif);
> 
> Outside lazy mode the lazy TIF is the immediate one, so these and the
> override checks in run_tick() hold whatever kick_one_cpu() decided. Maybe
> skip or note it when the mode isn't lazy.
> 
> > +	case NOHZ_PHASE_LAZY_ENQ:
> > +	case NOHZ_PHASE_LAZY_KICK:
> > +		dsq_id = SCX_DSQ_LOCAL;
> > +		slice = p->pid == victim_pid ? SCX_SLICE_INF : SCX_SLICE_DFL;
> 
> The victim gets an infinite slice on every enqueue, including the one after
> the lazy preemption puts it back. In the kick phase the challenger is stopped
> first; if its slice runs out before the SIGKILL lands, it's re-enqueued
> behind the victim and never runs again, waitpid() blocks, and the 5s watchdog
> aborts the scheduler, which then fails the test at check_exit. The enqueue
> phase is safe as the challenger re-inserts at the head. Stopping the victim
> first avoids it. ENQ_BOTH in kick.c has the same shape with the global DSQ
> and the default 30s watchdog, a stall rather than a failure there.
> 
> > +static bool wait_for_tick_stop(const u64 *counter, int timeout_ms)
> 
> Neither this nor wait_for_counter() checks uei.kind, so a watchdog abort
> mid-phase reports as no progress.
> 
> > +	if (!start_gated_worker(&challenger) ||
> > +	    !wait_for_counter(&skel->bss->nr_lazy_enq_running, 1,
> > +			      PHASE_TIMEOUT_MS)) {
> > +		SCX_ERR("Lazy enqueue made no progress on CPU %d", ctx->test_cpu);
> 
> This passes even without the tick dependency restore. sched_tick_remote()
> runs task_tick_scx() once a second on the tick-stopped CPU, and as
> nohz_tick_ops doesn't set SCX_OPS_LAZY_SLICE_EXPIRY that path does
> resched_curr() with an IPI, so the challenger runs within a second either
> way. Setting the flag on nohz_tick_ops keeps the remote tick lazy, so a
> missing restore shows up as the timeout. Both phases only test anything in
> lazy mode.

Agree to all of the above. I'll send a new version with all of these fixed.

Thanks,
-Andrea

  reply	other threads:[~2026-09-18  6:30 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-17  7:02 [PATCHSET v6 sched_ext/for-7.4] sched_ext: Add lazy preemption support Andrea Righi
2026-09-17  7:02 ` [PATCH 1/2] " Andrea Righi
2026-09-17 19:19   ` Tejun Heo
2026-09-18  6:27     ` Andrea Righi
2026-09-18  3:35   ` Tao Cui
2026-09-18  6:37     ` Andrea Righi
2026-09-17  7:02 ` [PATCH 2/2] selftests/sched_ext: Add lazy preemption tests Andrea Righi
2026-09-17 19:19   ` Tejun Heo
2026-09-18  6:30     ` Andrea Righi [this message]
  -- strict thread matches above, loose matches on Subject: below --
2026-09-18 17:13 [PATCHSET v7 sched_ext/for-7.4] sched_ext: Add lazy preemption support Andrea Righi
2026-09-18 17:13 ` [PATCH 2/2] selftests/sched_ext: Add lazy preemption tests Andrea Righi
2026-09-15 19:45 [PATCHSET v5 sched_ext/for-7.4] sched_ext: Add lazy preemption support Andrea Righi
2026-09-15 19:45 ` [PATCH 2/2] selftests/sched_ext: Add lazy preemption tests Andrea Righi
2026-09-16 21:03   ` Tejun Heo
2026-09-15  9:00 [PATCHSET v4 sched_ext/for-7.4] sched_ext: Add lazy preemption support Andrea Righi
2026-09-15  9:00 ` [PATCH 2/2] selftests/sched_ext: Add lazy preemption tests Andrea Righi
2026-09-14 14:44 [PATCHSET v3 sched_ext/for-7.4] sched_ext: Add lazy preemption support Andrea Righi
2026-09-14 14:44 ` [PATCH 2/2] selftests/sched_ext: Add lazy preemption tests Andrea Righi
2026-09-14 14:59   ` sashiko-bot
2026-09-14  8:47 [PATCHSET v2 sched_ext/for-7.4] sched_ext: Add lazy preemption support Andrea Righi
2026-09-14  8:47 ` [PATCH 2/2] selftests/sched_ext: Add lazy preemption tests Andrea Righi
2026-09-14  9:01   ` sashiko-bot
2026-09-14 12:21     ` Andrea Righi
2026-09-14 14:55   ` Cheng-Yang Chou
2026-09-15 13:35     ` Andrea Righi

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=aqzaaWBFmXWGmo9I@gpd4 \
    --to=arighi@nvidia.com \
    --cc=changwoo@igalia.com \
    --cc=david.dai@linux.dev \
    --cc=emil@etsalapatis.com \
    --cc=etsal@meta.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sched-ext@lists.linux.dev \
    --cc=tj@kernel.org \
    --cc=void@manifault.com \
    --cc=yphbchou0911@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.