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

Roger Pau Monne posted 1 patch 1 month ago
Patches applied successfully (tree, apply log)
git fetch https://gitlab.com/xen-project/patchew/xen tags/patchew/20241022114607.2908-1-roger.pau@citrix.com
xen/arch/x86/pv/mm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] x86/pv: remove unlikely() from BUG_ON() condition in pv_map_ldt_shadow_page()
Posted by Roger Pau Monne 1 month ago
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(-)

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
-- 
2.46.0


Re: [PATCH] x86/pv: remove unlikely() from BUG_ON() condition in pv_map_ldt_shadow_page()
Posted by Andrew Cooper 1 month ago
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...