Skip to contentSkip to conversation

x86/pv: remove unlikely() from BUG_ON() condition in pv_map_ldt_shadow_page()

PATCH In review Roger Pau Monne 2 participants 2 messages Oct 22, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/pv: remove unlikely() from BUG_ON() condition in pv_map_ldt_shadow_page()

BUG_ON() itself already contains an unlikely() wrapping the bug condition.

No functional change.

---
 xen/arch/x86/pv/mm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/x86/pv/mm.c +1 -1
index 24f0d2e4ff7d..187f5f6a3e8c 100644
@@ -55,7 +55,7 @@ bool pv_map_ldt_shadow_page(unsigned int offset)
     l1_pgentry_t gl1e, *pl1e;
     unsigned long linear = curr->arch.pv.ldt_base + offset;
 
-    BUG_ON(unlikely(in_irq()));
+    BUG_ON(in_irq());
 
     /*
      * Prior limit checking should guarantee this property.  NB. This is
Signature · 1 line
2.46.0
Acked-by on v1 1/1
#1 lore raw
Quoted 5 lines · Roger Pau Monne

BUG_ON() itself already contains an unlikely() wrapping the bug condition.

No functional change.

likely()/unlikely() annotations are notoriously difficult for humans to reason about, and I think we have many wrong examples in Xen.

In some copious free time, I was thinking of borrowing Linux's ftrace mechanism for identifying broken annotations.  All it involves is turning if() into a macro...