diff mbox series

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

Message ID 20241022114607.2908-1-roger.pau@citrix.com (mailing list archive)
State New
Headers show
Series x86/pv: remove unlikely() from BUG_ON() condition in pv_map_ldt_shadow_page() | expand

Commit Message

Roger Pau Monné Oct. 22, 2024, 11:46 a.m. UTC
BUG_ON() itself already contains an unlikely() wrapping the bug condition.

No functional change.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/pv/mm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Andrew Cooper Oct. 22, 2024, 12:32 p.m. UTC | #1
On 22/10/2024 12:46 pm, Roger Pau Monne wrote:
> BUG_ON() itself already contains an unlikely() wrapping the bug condition.
>
> No functional change.
>
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>

Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>

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...
diff mbox series

Patch

diff --git a/xen/arch/x86/pv/mm.c b/xen/arch/x86/pv/mm.c
index 24f0d2e4ff7d..187f5f6a3e8c 100644
--- a/xen/arch/x86/pv/mm.c
+++ b/xen/arch/x86/pv/mm.c
@@ -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