From nobody Mon Feb 9 18:00:03 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1577119522; cv=none; d=zohomail.com; s=zohoarc; b=jyykieiBFLTiB4lxxZUDIPmoTaJzYCXY8FkWud/C+WjxbfzmaHZIk9P3xRFzzYrAtckjvbay8Hml7zWGVILFSNpqKz4XtYpWDaWxxicvNIVuXjSw1BvW/z/I2W2elWWqDEQpgK+GPdIOzin+4JdGTHU4Z7gUXmrFzP2VqdrmS6Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577119522; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=XAHi2xyBH4SRzD0JRwZurs8pJgV4u6GcZqG10xqLV5Y=; b=UkpNpnoA1ITHcmd5MAyLo1BQtV0L3mmwaO60CPNiWQTUjjYDvUThRBFecff5cdZDdJRJFDhIJlILZvTYO01t1w7cfkmcp8Fu6jBibUDR2fRiE/Z4qPGHKyQkSXv5Tw9qScHu/RIY6As0F9XniJsvrSQex0B4D7MQmS9Mk/bAhbw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1577119522473723.6710559933351; Mon, 23 Dec 2019 08:45:22 -0800 (PST) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ijQo5-0006J1-B5; Mon, 23 Dec 2019 16:43:45 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ijQo3-0006Id-VA for xen-devel@lists.xenproject.org; Mon, 23 Dec 2019 16:43:43 +0000 Received: from esa1.hc3370-68.iphmx.com (unknown [216.71.145.142]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 5bbafdb4-25a3-11ea-96fe-12813bfff9fa; Mon, 23 Dec 2019 16:43:34 +0000 (UTC) X-Inumbo-ID: 5bbafdb4-25a3-11ea-96fe-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1577119414; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=4LajtYjbMp6EySa6REpYUzL+FBkEHu6GtKsC0g+RZ1c=; b=VkLNS03auYBPUxa4z5ruzmcRWIi5To29A0hBDVoa4diQttgFcehaCh7d 86wFrN6/j0wYdnpXpSepG4qq3Wra4GTssSjirMxOtoDU7lW0AJ/S1WtVX E9STo4BjQXjokrAzUzgfisnlVYBvn2a+Ou4r18vuNpotEDsw6E25CcWmj k=; Authentication-Results: esa1.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=george.dunlap@citrix.com; spf=Pass smtp.mailfrom=George.Dunlap@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa1.hc3370-68.iphmx.com: no sender authenticity information available from domain of george.dunlap@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa1.hc3370-68.iphmx.com; envelope-from="George.Dunlap@citrix.com"; x-sender="george.dunlap@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa1.hc3370-68.iphmx.com: domain of George.Dunlap@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa1.hc3370-68.iphmx.com; envelope-from="George.Dunlap@citrix.com"; x-sender="George.Dunlap@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ip4:168.245.78.127 ~all" Received-SPF: None (esa1.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa1.hc3370-68.iphmx.com; envelope-from="George.Dunlap@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: AxsFZfHdjC5LEZb4P+WEb/mOM+GeGKy4uTMsLWWzIUTaafKoQS8ilxHcMLF+7CpZtU+6BTPe61 /vSJFaMh/xJdpaYiutyWAijRme/t+fq3S0XaE9DUs77KvFflBusgA/oDxIKtmKlh8doBfmYR31 aDkTUbyAKgUpELHrwMsAAM3/wWhWQAencHg60V6NbgkK5llQudM/9kqE11NBIWwThXrHzZnsqV 9X3TjNGIHtHmM11DJZdPd23AgG5zSsSY32GBFUbQ4KFdKLfqi+aL7gVxCm7hQXbrl1M38icCwn 36A= X-SBRS: 2.7 X-MesageID: 10229661 X-Ironport-Server: esa1.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.69,348,1571716800"; d="scan'208";a="10229661" From: George Dunlap To: Date: Mon, 23 Dec 2019 16:43:27 +0000 Message-ID: <20191223164329.3113378-3-george.dunlap@citrix.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191223164329.3113378-1-george.dunlap@citrix.com> References: <20191223164329.3113378-1-george.dunlap@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH 2/4] xen: Add 'synthetic' preemption check parameter X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Andrew Cooper , George Dunlap , Jan Beulich Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) In order to better test hypervisor preemption paths, add an option to artificially increase the number of preemptions. While modifying xen-command-line.pandoc, escape some underscores, and remove some trailing whitespace. Signed-off-by: George Dunlap --- CC: Andrew Cooper CC: Jan Beulich --- docs/misc/xen-command-line.pandoc | 20 ++++++++++++++++++-- xen/arch/x86/time.c | 11 +++++++++++ xen/include/xen/sched.h | 10 +++++++++- 3 files changed, 38 insertions(+), 3 deletions(-) diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line= .pandoc index 981a5e2381..1a9fda8627 100644 --- a/docs/misc/xen-command-line.pandoc +++ b/docs/misc/xen-command-line.pandoc @@ -636,13 +636,29 @@ Available alternatives, with their meaning, are: Specify the USB controller to use, either by instance number (when going over the PCI busses sequentially) or by PCI device (must be on segment 0). =20 -### debug_stack_lines +### debug\_stack\_lines > `=3D ` =20 > Default: `20` =20 Limits the number lines printed in Xen stack traces. =20 +### debug-synthetic-preemption +> `=3D ` + +> Default: `0` + +Artificially increases rate at which `hypercall_preempt_check()` +returns `true`, for debugging purposes, to a rate of one in `N`. (The +default, `0`, disables the feature.) + +When promoting pagetables, for instance, `hypercall_preempt_check()` +is called before processing each PTE. Since there are 512 PTEs per +page, a value of `1024` should result in pagetable promotion being +interrupted every other page on average. + +Only available in DEBUG builds. + ### debugtrace > `=3D [cpu:]` =20 @@ -1690,7 +1706,7 @@ The following resources are available: CDP, one COS will corespond two CBMs other than one with CAT, due to t= he sum of CBMs is fixed, that means actual `cos_max` in use will automati= cally reduce to half when CDP is enabled. -=09 + ### pv-linear-pt (x86) > `=3D ` =20 diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c index 64e471a39b..34302f81e7 100644 --- a/xen/arch/x86/time.c +++ b/xen/arch/x86/time.c @@ -43,6 +43,17 @@ static char __initdata opt_clocksource[10]; string_param("clocksource", opt_clocksource); =20 +#ifndef NDEBUG +int debug_synthetic_preemption =3D 0; +integer_param("debug-synthetic-preemption", debug_synthetic_preemption); + +bool synthetic_preemption_check(void) { + if ( debug_synthetic_preemption =3D=3D 0 ) + return false; + return !(rdtsc() % debug_synthetic_preemption); +} +#endif + unsigned long __read_mostly cpu_khz; /* CPU clock frequency in kHz. */ DEFINE_SPINLOCK(rtc_lock); unsigned long pit0_ticks; diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h index 9f7bc69293..c0071eee04 100644 --- a/xen/include/xen/sched.h +++ b/xen/include/xen/sched.h @@ -748,6 +748,13 @@ static inline void hypercall_cancel_continuation(struc= t vcpu *v) v->hcall_preempted =3D false; } =20 +#ifndef NDEBUG +bool synthetic_preemption_check(void); +#define synthetic_preemption_check synthetic_preemption_check +#else +#define synthetic_preempiton_check() false +#endif + /* * For long-running operations that must be in hypercall context, check * if there is background work to be done that should interrupt this @@ -755,7 +762,8 @@ static inline void hypercall_cancel_continuation(struct= vcpu *v) */ #define hypercall_preempt_check() (unlikely( \ softirq_pending(smp_processor_id()) | \ - local_events_need_delivery() \ + local_events_need_delivery() | \ + synthetic_preemption_check() \ )) =20 /* --=20 2.24.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel