From nobody Mon Nov 23 22:31:55 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1794571538; cv=none; d=zohomail.com; s=zohoarc; b=VgUpGmrOHH4M2ykfICx80TQxc9iCjV4uWOu4ez99rjFaUdVj184haikX493OOKqFLVQDZS88DXCZfu+xJURwM1q/tNQJotNfiH9arAhWDPc9myRnOKCbZ/26tcoPq9/OYC73MSyBoRi0+EB61c0NMDpCUSO+i8Y56bXJHwNp+58= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1794571538; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=KQ3E2Qf7L11ptVj3bz9Y8ujNKwQfV7Rg1joEaRM9wfI=; b=Y4ABh+xoR3a1P0rsmje37IKoiaXLJFHs8SZqmv7WIF4xZPR5Gkn91Nm08zK74GIpSzQ6h+K+ExKzpDK8qF+mudhBD3FHYRqWtQ0UouvaGosf07PfbCZVqdoAvvGHWIUJck41Mw9Hoaya+26mINOwpsI8pc7FaetxDSLaw9Vm40o= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1794571538256302.1087595711633; Fri, 13 Nov 2026 04:05:38 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.1487403.1689847 (Exim 4.92) (envelope-from ) id 1xRq1k-0004Dx-Fq; Fri, 13 Nov 2026 12:05:08 +0000 Received: by outflank-mailman (output) from mailman id 1487403.1689847; Fri, 13 Nov 2026 12:05:08 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1xRq1k-0004Dq-CZ; Fri, 13 Nov 2026 12:05:08 +0000 Received: by outflank-mailman (input) for mailman id 1487403; Fri, 13 Nov 2026 12:05:07 +0000 Received: from mx.expurgate.net ([195.190.135.20]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1xRq1j-0004Dk-NE for xen-devel@lists.xenproject.org; Fri, 13 Nov 2026 12:05:07 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1xRq1j-0051eo-3z for xen-devel@lists.xenproject.org; Fri, 13 Nov 2026 13:05:07 +0100 Received: from [10.42.69.11] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6af6fcd9-8faa-0a2a0a5109dd-0a2a450bac88-40 for ; Fri, 13 Nov 2026 13:05:07 +0100 Received: from [209.85.128.47] (helo=mail-wm1-f47.google.com) by tlsNG-42698a.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1) (envelope-from ) id 6af6fcf2-b7e8-0a2a450b0019-d155802fcd9f-3 for ; Fri, 13 Nov 2026 13:05:07 +0100 Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-4a20bdaf39cso15483195e9.1 for ; Fri, 13 Nov 2026 04:05:06 -0800 (PST) Received: from localhost.localdomain (host-78-146-248-75.as13285.net. [78.146.248.75]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4bb55a0ffcdsm55889195e9.0.2026.11.13.04.05.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Nov 2026 04:05:05 -0800 (PST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=google header.d=citrix.com header.i="@citrix.com" header.h="Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Subject:Cc:To:From" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1794571506; x=1795176306; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=KQ3E2Qf7L11ptVj3bz9Y8ujNKwQfV7Rg1joEaRM9wfI=; b=Lpd96CDL2JwxbZQcjW85JsHi6OKn2CVMhPuUQtByNPzl6NfcR969C6ut0hTQmsUKlv AUothXLtyz9UFmOgSRHWy4LMTXBKcmTJHrrzmLepnvI+OPsp1wjG9zPkwFHm7ISr/Veg MSCKjlT2FsInqAjC6UebIvH9fY/YOk+5IVlJU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794571506; x=1795176306; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=KQ3E2Qf7L11ptVj3bz9Y8ujNKwQfV7Rg1joEaRM9wfI=; b=aXrFeJpqCHPIVuIxWP8/vXhCav5GXgvY7ffrXTnx2kPFNnV0yrWYMxWD0C5kZsasSc /f2xbKf9TrE6FNJvaBxdTshIKMkSoXcWLwh7k28c62xhib47CJ33lPaFT7HIR1/F0Jbv Lr4LZHuOeTq6m2mV+t2GzhcJZeAqtfRZ1gC6m8alYbXWB6gkkxxouf41KyIDqekh4eF6 A/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Nov 2026 04:05:05 -0800 (PST) From: Andrew Cooper To: Xen-devel Cc: Andrew Cooper , Dario Faggioli , Juergen Gross , George Dunlap Subject: [PATCH] xen/sched: Drop the *_UNIT_CHECK() macros Date: Fri, 13 Nov 2026 12:05:04 +0000 Message-Id: <20261113120504.3407364-1-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.39.5 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-purgate-ID: tlsNG-42698a/1794571507-A86CA9EA-AE11F64A/0/0 X-purgate-type: clean X-purgate-size: 5380 X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1794571540333158500 Content-Type: text/plain; charset="utf-8" All these do is conditionalise calling the related check function. Compile the function generally, and use an early exit to DCE it in release builds. No functional change. Signed-off-by: Andrew Cooper Reviewed-by: Juergen Gross --- CC: Dario Faggioli CC: Juergen Gross CC: George Dunlap --- xen/common/sched/credit.c | 14 ++++++-------- xen/common/sched/credit2.c | 14 ++++++-------- xen/common/sched/null.c | 12 +++++------- 3 files changed, 17 insertions(+), 23 deletions(-) diff --git a/xen/common/sched/credit.c b/xen/common/sched/credit.c index f1a9b4aed1ae..8435c2441024 100644 --- a/xen/common/sched/credit.c +++ b/xen/common/sched/credit.c @@ -660,13 +660,15 @@ csched_switch_sched(struct scheduler *new_ops, unsign= ed int cpu, return &sr->_lock; } =20 -#ifndef NDEBUG static inline void -__csched_unit_check(const struct sched_unit *unit) +csched_unit_check(const struct sched_unit *unit) { struct csched_unit * const svc =3D CSCHED_UNIT(unit); struct csched_dom * const sdom =3D svc->sdom; =20 + if ( !IS_ENABLED(CONFIG_DEBUG) ) + return; + BUG_ON( svc->unit !=3D unit ); BUG_ON( sdom !=3D CSCHED_DOM(unit->domain) ); if ( sdom ) @@ -681,10 +683,6 @@ __csched_unit_check(const struct sched_unit *unit) =20 SCHED_STAT_CRANK(unit_check); } -#define CSCHED_UNIT_CHECK(unit) (__csched_unit_check(unit)) -#else -#define CSCHED_UNIT_CHECK(unit) -#endif =20 /* * Delay, in microseconds, between migrations of a UNIT between PCPUs. @@ -1863,7 +1861,7 @@ static void cf_check csched_schedule( bool migrated =3D false; =20 SCHED_STAT_CRANK(schedule); - CSCHED_UNIT_CHECK(unit); + csched_unit_check(unit); =20 if ( unlikely(tb_init_done) ) { @@ -2034,7 +2032,7 @@ static void cf_check csched_schedule( set_timer(&spc->ticker, now + MICROSECS(prv->tick_period_us) - now % MICROSECS(prv->tick_period_us) ); =20 - CSCHED_UNIT_CHECK(unit->next_task); + csched_unit_check(unit->next_task); } =20 static void diff --git a/xen/common/sched/credit2.c b/xen/common/sched/credit2.c index c32e753bb4f0..042168e531c6 100644 --- a/xen/common/sched/credit2.c +++ b/xen/common/sched/credit2.c @@ -2153,13 +2153,15 @@ static void cf_check replenish_domain_budget(void *= data) set_timer(&sdom->repl_timer, sdom->next_repl); } =20 -#ifndef NDEBUG static inline void csched2_unit_check(const struct sched_unit *unit) { struct csched2_unit * const svc =3D csched2_unit(unit); struct csched2_dom * const sdom =3D svc->sdom; =20 + if ( !IS_ENABLED(CONFIG_DEBUG) ) + return; + BUG_ON( svc->unit !=3D unit ); BUG_ON( sdom !=3D csched2_dom(unit->domain) ); if ( sdom ) @@ -2173,10 +2175,6 @@ csched2_unit_check(const struct sched_unit *unit) } SCHED_STAT_CRANK(unit_check); } -#define CSCHED2_UNIT_CHECK(unit) (csched2_unit_check(unit)) -#else -#define CSCHED2_UNIT_CHECK(unit) -#endif =20 static void *cf_check csched2_alloc_udata(const struct scheduler *ops, struct sched_unit *unit, @@ -3244,7 +3242,7 @@ csched2_unit_insert(const struct scheduler *ops, stru= ct sched_unit *unit) =20 SCHED_STAT_CRANK(unit_insert); =20 - CSCHED2_UNIT_CHECK(unit); + csched2_unit_check(unit); } =20 static void cf_check @@ -3595,7 +3593,7 @@ static void cf_check csched2_schedule( bool migrated =3D false; =20 SCHED_STAT_CRANK(schedule); - CSCHED2_UNIT_CHECK(currunit); + csched2_unit_check(currunit); =20 BUG_ON(!cpumask_test_cpu(sched_cpu, &csched2_priv(ops)->initialized)); =20 @@ -3777,7 +3775,7 @@ static void cf_check csched2_schedule( currunit->next_task =3D snext->unit; snext->unit->migrated =3D migrated; =20 - CSCHED2_UNIT_CHECK(currunit->next_task); + csched2_unit_check(currunit->next_task); } =20 static void diff --git a/xen/common/sched/null.c b/xen/common/sched/null.c index b3c6651fb1f5..1099041c130f 100644 --- a/xen/common/sched/null.c +++ b/xen/common/sched/null.c @@ -785,12 +785,14 @@ static void cf_check null_unit_migrate( sched_set_res(unit, get_sched_res(new_cpu)); } =20 -#ifndef NDEBUG static inline void null_unit_check(struct sched_unit *unit) { struct null_unit * const nvc =3D null_unit(unit); struct null_dom * const ndom =3D unit->domain->sched_priv; =20 + if ( !IS_ENABLED(CONFIG_DEBUG) ) + return; + BUG_ON(nvc->unit !=3D unit); =20 if ( ndom ) @@ -800,10 +802,6 @@ static inline void null_unit_check(struct sched_unit *= unit) =20 SCHED_STAT_CRANK(unit_check); } -#define NULL_UNIT_CHECK(unit) (null_unit_check(unit)) -#else -#define NULL_UNIT_CHECK(unit) -#endif =20 =20 /* @@ -823,7 +821,7 @@ static void cf_check null_schedule( struct null_unit *wvc; =20 SCHED_STAT_CRANK(schedule); - NULL_UNIT_CHECK(current->sched_unit); + null_unit_check(current->sched_unit); =20 if ( unlikely(tb_init_done) ) { @@ -940,7 +938,7 @@ static void cf_check null_schedule( !unit_runnable_state(prev->next_task)) ) prev->next_task =3D sched_idle_unit(sched_cpu); =20 - NULL_UNIT_CHECK(prev->next_task); + null_unit_check(prev->next_task); =20 prev->next_task->migrated =3D false; } --=20 2.39.5