From: Andrew Cooper <andrew.cooper3@citrix.com>
To: xen-devel@lists.xenproject.org
Cc: "Andrew Cooper" <andrew.cooper3@citrix.com>,
"Jan Beulich" <jbeulich@suse.com>,
"Roger Pau Monné" <roger@xenproject.org>,
"Teddy Astie" <teddy.astie@vates.tech>
Subject: [PATCH 3/5] x86/nmi: Misc style fixes
Date: Wed, 5 Aug 2026 13:45:23 +0100 [thread overview]
Message-ID: <20260805124525.105457-4-andrew.cooper3@citrix.com> (raw)
In-Reply-To: <20260805124525.105457-1-andrew.cooper3@citrix.com>
* Drop trailing whitespace
* Sort includes, dropping asm/mc146818rtc.h and asm/div64.h as unused
* Brace position, and types
No functional change.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <jbeulich@suse.com>
CC: Roger Pau Monné <roger@xenproject.org>
CC: Teddy Astie <teddy.astie@vates.tech>
---
xen/arch/x86/nmi.c | 54 ++++++++++++++++++++++++----------------------
1 file changed, 28 insertions(+), 26 deletions(-)
diff --git a/xen/arch/x86/nmi.c b/xen/arch/x86/nmi.c
index 113e672c4f15..d9d07870a333 100644
--- a/xen/arch/x86/nmi.c
+++ b/xen/arch/x86/nmi.c
@@ -13,26 +13,25 @@
* Mikael Pettersson : PM converted to driver model. Disable/enable API.
*/
+#include <xen/console.h>
+#include <xen/cpu.h>
+#include <xen/delay.h>
#include <xen/init.h>
+#include <xen/irq.h>
+#include <xen/keyhandler.h>
#include <xen/lib.h>
#include <xen/mm.h>
#include <xen/param.h>
-#include <xen/irq.h>
-#include <xen/delay.h>
-#include <xen/time.h>
#include <xen/sched.h>
-#include <xen/console.h>
#include <xen/smp.h>
-#include <xen/keyhandler.h>
+#include <xen/time.h>
#include <xen/watchdog.h>
-#include <xen/cpu.h>
+
+#include <asm/apic.h>
#include <asm/current.h>
-#include <asm/mc146818rtc.h>
-#include <asm/msr.h>
#include <asm/mpspec.h>
+#include <asm/msr.h>
#include <asm/nmi.h>
-#include <asm/div64.h>
-#include <asm/apic.h>
unsigned int nmi_watchdog = NMI_NONE;
static unsigned int nmi_hz = HZ;
@@ -124,10 +123,10 @@ static int nmi_active;
#define P4_CCCR_REQUIRED (3<<16)
#define P4_CCCR_ESCR_SELECT(N) ((N)<<13)
#define P4_CCCR_ENABLE (1<<12)
-/*
+/*
* Set up IQ_PERFCTR0 to behave like a clock, by having IQ_CCCR0 filter
* CRU_ESCR0 (with any non-null event selector) through a complemented
- * max threshold. [IA32-Vol3, Section 14.9.9]
+ * max threshold. [IA32-Vol3, Section 14.9.9]
*/
#define P4_NMI_CRU_ESCR0 P4_ESCR_EVENT_SELECT(0x3F)
#define P4_NMI_IQ_CCCR0 \
@@ -182,7 +181,7 @@ void __init check_nmi_watchdog(void)
* There's a limit to how slow we can go because writing the perfctr
* MSRs only sets the low 32 bits, with the top 8 bits sign-extended
* from those, so it's not possible to set up a delay larger than
- * 2^31 cycles and smaller than (2^40 - 2^31) cycles.
+ * 2^31 cycles and smaller than (2^40 - 2^31) cycles.
* (Intel SDM, section 18.22.2)
*/
if ( nmi_watchdog == NMI_LOCAL_APIC )
@@ -199,8 +198,9 @@ static void cf_check nmi_timer_fn(void *unused)
void disable_lapic_nmi_watchdog(void)
{
- if (nmi_active <= 0)
+ if ( nmi_active <= 0 )
return;
+
switch ( boot_cpu_data.vendor )
{
case X86_VENDOR_AMD:
@@ -231,9 +231,7 @@ void disable_lapic_nmi_watchdog(void)
static void clear_msr_range(unsigned int base, unsigned int n)
{
- unsigned int i;
-
- for (i = 0; i < n; i++)
+ for ( unsigned int i = 0; i < n; i++ )
wrmsrns(base + i, 0);
}
@@ -302,7 +300,7 @@ static void setup_p4_watchdog(void)
uint64_t misc_enable;
rdmsrl(MSR_IA32_MISC_ENABLE, misc_enable);
- if (!(misc_enable & MSR_IA32_MISC_ENABLE_PERF_AVAIL))
+ if ( !(misc_enable & MSR_IA32_MISC_ENABLE_PERF_AVAIL) )
return;
nmi_perfctr_msr = MSR_P4_IQ_PERFCTR0;
@@ -310,15 +308,18 @@ static void setup_p4_watchdog(void)
if ( boot_cpu_data.x86_num_siblings == 2 )
nmi_p4_cccr_val |= P4_CCCR_OVF_PMI1;
- if (!(misc_enable & MSR_IA32_MISC_ENABLE_PEBS_UNAVAIL))
+ if ( !(misc_enable & MSR_IA32_MISC_ENABLE_PEBS_UNAVAIL) )
clear_msr_range(0x3F1, 2);
/* MSR 0x3F0 seems to have a default value of 0xFC00, but current
docs doesn't fully define it, so leave it alone for now. */
- if (boot_cpu_data.model >= 0x3) {
+ if ( boot_cpu_data.model >= 0x3 )
+ {
/* MSR_P4_IQ_ESCR0/1 (0x3ba/0x3bb) removed */
clear_msr_range(0x3A0, 26);
clear_msr_range(0x3BC, 3);
- } else {
+ }
+ else
+ {
clear_msr_range(0x3A0, 31);
}
clear_msr_range(0x3C0, 6);
@@ -393,7 +394,7 @@ static int cf_check cpu_nmi_callback(
}
static struct notifier_block cpu_nmi_nfb = {
- .notifier_call = cpu_nmi_callback
+ .notifier_call = cpu_nmi_callback,
};
static DEFINE_PER_CPU(unsigned int, last_irq_sums);
@@ -444,15 +445,15 @@ bool nmi_watchdog_tick(const struct cpu_user_regs *regs)
* before doing the oops ...
*/
this_cpu(alert_counter)++;
- if ( this_cpu(alert_counter) == opt_watchdog_timeout*nmi_hz )
+ if ( this_cpu(alert_counter) == opt_watchdog_timeout * nmi_hz )
{
console_force_unlock();
printk("Watchdog timer detects that CPU%d is stuck!\n",
smp_processor_id());
fatal_trap(regs, 1);
}
- }
- else
+ }
+ else
{
this_cpu(last_irq_sums) = sum;
this_cpu(alert_counter) = 0;
@@ -512,7 +513,8 @@ bool nmi_watchdog_tick(const struct cpu_user_regs *regs)
void self_nmi(void)
{
unsigned long flags;
- u32 id = get_apic_id();
+ uint32_t id = get_apic_id();
+
local_irq_save(flags);
apic_wait_icr_idle();
apic_icr_write(APIC_DM_NMI | APIC_DEST_PHYSICAL, id);
--
2.34.1
next prev parent reply other threads:[~2026-08-05 12:45 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-05 12:45 [PATCH 0/5] x86/nmi: Watchdog fixes/improvement Part 1 Andrew Cooper
2026-08-05 12:45 ` [PATCH 1/5] x86/nmi: Drop {reserve,release}_lapic_nmi() Andrew Cooper
2026-08-05 13:48 ` Jan Beulich
2026-08-05 12:45 ` [PATCH 2/5] x86/nmi: Drop K7_NMI_EVENT Andrew Cooper
2026-08-05 13:49 ` Jan Beulich
2026-08-17 16:24 ` [PATCH 2.5/5] x86/nmi: Remove logic for pre-64bit Pentium 4 CPUs Andrew Cooper
2026-08-18 6:32 ` Jan Beulich
2026-08-05 12:45 ` Andrew Cooper [this message]
2026-08-05 13:52 ` [PATCH 3/5] x86/nmi: Misc style fixes Jan Beulich
2026-08-17 16:19 ` Andrew Cooper
2026-08-05 12:45 ` [PATCH 4/5] x86/nmi: Check MSR_MISC_ENABLE for all Intel platforms Andrew Cooper
2026-08-05 14:02 ` Jan Beulich
2026-08-05 12:45 ` [PATCH 5/5] x86/nmi: Don't configure EvtSel repeatedly Andrew Cooper
2026-08-05 14:20 ` Jan Beulich
2026-08-05 15:37 ` Andrew Cooper
2026-08-06 6:57 ` Jan Beulich
2026-08-06 9:40 ` Andrew Cooper
2026-08-17 17:23 ` [PATCH 6/5] x86/nmi: Support watchdogs on Intel Fam18/19 CPUs Andrew Cooper
2026-08-18 7:31 ` Jan Beulich
2026-08-05 13:42 ` [PATCH 0/5] x86/nmi: Watchdog fixes/improvement Part 1 Jan Beulich
2026-08-05 17:56 ` Andrew Cooper
2026-08-06 6:44 ` Jan Beulich
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=20260805124525.105457-4-andrew.cooper3@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=jbeulich@suse.com \
--cc=roger@xenproject.org \
--cc=teddy.astie@vates.tech \
--cc=xen-devel@lists.xenproject.org \
/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.