All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kuba Piecuch <jpiecuch@google.com>
To: Samuele Mariotti <smariotti@disroot.org>, <tj@kernel.org>
Cc: <void@manifault.com>, <arighi@nvidia.com>, <changwoo@igalia.com>,
	 <jpiecuch@google.com>, <shuah@kernel.org>,
	<sched-ext@lists.linux.dev>,  <linux-kselftest@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] selftests/sched_ext: Fix build error in dequeue_remote selftest
Date: Mon, 12 Oct 2026 13:17:39 +0000	[thread overview]
Message-ID: <DM2W05XKJT97.2ATHPA28J84ZH@google.com> (raw)
In-Reply-To: <20261012115928.1372317-1-smariotti@disroot.org>

On Mon Oct 12, 2026 at 11:59 AM UTC, Samuele Mariotti wrote:
> Building the dequeue_remote selftest with newer compilers (e.g., gcc 16)
> triggers the following error:
>
> dequeue_remote.c:39:32: error: variable ‘sum’ set but not used
>
> The 'volatile' qualifier prevents the writes from being optimized away,
> but does not silence the warning, since 'sum' is indeed only written and
> never read.
>
> Consume 'sum' via an empty asm() with a register input constraint, as
> already done for the dequeue selftest in commit 3788e3251653
> ("selftests/sched_ext: Fix build error in dequeue selftest"). This forces
> the compiler to keep the accumulated value (preserving the CPU stress loop)
> and avoids the build error.
>
> Fixes: cc07fae1de5d ("selftests/sched_ext: Add a test for ops.dequeue() on remote local DSQ moves")
>
> Signed-off-by: Samuele Mariotti <smariotti@disroot.org>
> ---
>  tools/testing/selftests/sched_ext/dequeue_remote.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/tools/testing/selftests/sched_ext/dequeue_remote.c b/tools/testing/selftests/sched_ext/dequeue_remote.c
> index f2c1901030de..af344581d5f1 100644
> --- a/tools/testing/selftests/sched_ext/dequeue_remote.c
> +++ b/tools/testing/selftests/sched_ext/dequeue_remote.c
> @@ -43,6 +43,7 @@ static void worker_fn(int id)
>  
>  		for (j = 0; j < 20000 + id * 1000; j++)
>  			sum += j;
> +		asm volatile("" : : "r"(sum));
>  		if (id & 1)
>  			usleep(100);
>  		else

LGTM, thank you Samuele!

Reviewed-by: Kuba Piecuch <jpiecuch@google.com>


  reply	other threads:[~2026-10-12 13:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-12 11:59 [PATCH] selftests/sched_ext: Fix build error in dequeue_remote selftest Samuele Mariotti
2026-10-12 13:17 ` Kuba Piecuch [this message]
2026-10-12 18:01 ` Tejun Heo

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=DM2W05XKJT97.2ATHPA28J84ZH@google.com \
    --to=jpiecuch@google.com \
    --cc=arighi@nvidia.com \
    --cc=changwoo@igalia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=sched-ext@lists.linux.dev \
    --cc=shuah@kernel.org \
    --cc=smariotti@disroot.org \
    --cc=tj@kernel.org \
    --cc=void@manifault.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.