xen/treewide: Remove NDEBUG
cover xen/treewide: Remove NDEBUG
We have two ways of spelling debug build in Xen. Reduce this down to just one way.
Andrew Cooper (3):
xen/treewide: Convert all #ifndef NDEBUG to CONFIG_DEBUG xen/treewide: Convert all #ifdef NDEBUG to CONFIG_DEBUG xen/config: Drop NDEBUG
xen/arch/arm/gic-vgic.c | 2 +- xen/arch/arm/include/asm/grant_table.h | 2 +- xen/arch/arm/irq.c | 2 +- xen/arch/arm/mmu/domain_page.c | 2 +- xen/arch/arm/mmu/pt.c | 10 +++++----- xen/arch/arm/traps.c | 8 ++++---- xen/arch/x86/acpi/cpufreq/amd-cppc.c | 2 +- xen/arch/x86/domain_page.c | 6 +++--- xen/arch/x86/hvm/emulate.c | 6 +++--- xen/arch/x86/hvm/irq.c | 2 +- xen/arch/x86/hvm/svm/emulate.c | 4 ++-- xen/arch/x86/hvm/vmx/intr.c | 2 +- xen/arch/x86/include/asm/asm_defns.h | 4 ++-- xen/arch/x86/include/asm/hvm/hvm.h | 2 +- xen/arch/x86/include/asm/hvm/support.h | 2 +- xen/arch/x86/include/asm/hypercall.h | 4 ++-- xen/arch/x86/include/asm/mem_sharing.h | 2 +- xen/arch/x86/include/asm/mm.h | 2 +- xen/arch/x86/include/asm/p2m.h | 2 +- xen/arch/x86/include/asm/page.h | 3 ++- xen/arch/x86/include/asm/setup.h | 6 +++--- xen/arch/x86/mm.c | 12 ++++++------ xen/arch/x86/mm/p2m-pod.c | 2 +- xen/arch/x86/mm/shadow/common.c | 4 ++-- xen/arch/x86/mm/shadow/hvm.c | 2 +- xen/arch/x86/mm/shadow/multi.c | 2 +- xen/arch/x86/mm/shadow/private.h | 8 ++++---- xen/arch/x86/pv/dom0_build.c | 6 +++--- xen/arch/x86/pv/emulate.c | 2 +- xen/arch/x86/pv/mm.h | 2 +- xen/arch/x86/setup.c | 2 +- xen/arch/x86/traps.c | 6 +++--- xen/arch/x86/x86_64/compat/entry.S | 2 +- xen/arch/x86/x86_64/entry.S | 2 +- xen/arch/x86/x86_emulate/decode.c | 2 +- xen/arch/x86/x86_emulate/private.h | 4 ++-- xen/arch/x86/x86_emulate/util-xen.c | 2 +- xen/arch/x86/x86_emulate/x86_emulate.c | 6 +++--- xen/arch/x86/x86_emulate/x86_emulate.h | 4 ++-- xen/arch/x86/xstate.c | 2 +- xen/common/event_channel.c | 4 ++-- xen/common/grant_table.c | 8 ++++---- xen/common/multicall.c | 2 +- xen/common/page_alloc.c | 4 ++-- xen/common/preempt.c | 2 +- xen/drivers/char/console.c | 12 ++++++------ xen/include/xen/bug.h | 2 +- xen/include/xen/config.h | 4 ---- xen/include/xen/lib.h | 18 +++++++++--------- xen/include/xen/pci.h | 2 +- xen/include/xen/preempt.h | 2 +- xen/include/xen/rwlock.h | 4 ++-- xen/include/xen/sched.h | 2 +- xen/include/xen/typesafe.h | 2 +- 54 files changed, 106 insertions(+), 109 deletions(-)
base-commit: aa6070d2c840301bceae28763d20a32c48f0d3e4
Signature · 1 line
2.39.5
PATCH 1/3 xen/treewide: Convert all #ifndef NDEBUG to CONFIG_DEBUG
We have two ways of spelling debug build in Xen, one with positive form and one with an inverted form.
Switch to consistently using CONFIG_DEBUG in order to remove NDEBUG.
No functional change.
---
CC: Jan Beulich <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Teddy Astie <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Julien Grall <[email protected]>
CC: Volodymyr Babchuk <[email protected]>
CC: Bertrand Marquis <[email protected]>
CC: Michal Orzel <[email protected]>
CC: Oleksii Kurochko <[email protected]>
CC: Baptiste Le Duc <[email protected]>
--- xen/arch/arm/gic-vgic.c | 2 +- xen/arch/arm/include/asm/grant_table.h | 2 +- xen/arch/arm/irq.c | 2 +- xen/arch/arm/mmu/domain_page.c | 2 +- xen/arch/arm/traps.c | 8 ++++---- xen/arch/x86/acpi/cpufreq/amd-cppc.c | 2 +- xen/arch/x86/hvm/emulate.c | 6 +++--- xen/arch/x86/hvm/irq.c | 2 +- xen/arch/x86/hvm/svm/emulate.c | 2 +- xen/arch/x86/hvm/vmx/intr.c | 2 +- xen/arch/x86/include/asm/asm_defns.h | 4 ++-- xen/arch/x86/include/asm/hvm/hvm.h | 2 +- xen/arch/x86/include/asm/hvm/support.h | 2 +- xen/arch/x86/include/asm/hypercall.h | 4 ++-- xen/arch/x86/include/asm/mem_sharing.h | 2 +- xen/arch/x86/include/asm/mm.h | 2 +- xen/arch/x86/include/asm/p2m.h | 2 +- xen/arch/x86/mm.c | 12 ++++++------ xen/arch/x86/mm/p2m-pod.c | 2 +- xen/arch/x86/mm/shadow/common.c | 4 ++-- xen/arch/x86/mm/shadow/hvm.c | 2 +- xen/arch/x86/mm/shadow/multi.c | 2 +- xen/arch/x86/pv/dom0_build.c | 6 +++--- xen/arch/x86/pv/emulate.c | 2 +- xen/arch/x86/pv/mm.h | 2 +- xen/arch/x86/setup.c | 2 +- xen/arch/x86/x86_64/compat/entry.S | 2 +- xen/arch/x86/x86_64/entry.S | 2 +- xen/arch/x86/x86_emulate/decode.c | 2 +- xen/arch/x86/x86_emulate/private.h | 4 ++-- xen/arch/x86/x86_emulate/util-xen.c | 2 +- xen/arch/x86/x86_emulate/x86_emulate.c | 6 +++--- xen/arch/x86/x86_emulate/x86_emulate.h | 2 +- xen/arch/x86/xstate.c | 2 +- xen/common/event_channel.c | 4 ++-- xen/common/grant_table.c | 8 ++++---- xen/common/multicall.c | 2 +- xen/common/page_alloc.c | 4 ++-- xen/common/preempt.c | 2 +- xen/include/xen/bug.h | 2 +- xen/include/xen/pci.h | 2 +- xen/include/xen/preempt.h | 2 +- xen/include/xen/rwlock.h | 4 ++-- xen/include/xen/sched.h | 2 +- xen/include/xen/typesafe.h | 2 +- 45 files changed, 69 insertions(+), 69 deletions(-)
xen/arch/arm/gic-vgic.c +1 -1
@@ -206,7 +206,7 @@ static void gic_update_one_lr(struct vcpu *v, int i) }else { -#ifndef NDEBUG +#ifdef CONFIG_DEBUG gic_hw_ops->clear_lr (i);#endif clear_bit (i, &this_cpu (lr_mask));
xen/arch/arm/include/asm/grant_table.h +1 -1
@@ -18,7 +18,7 @@ static inline void gnttab_clear_flags(struct domain *d,static inline void gnttab_mark_dirty (struct domain *d,mfn_t mfn) { -#ifndef NDEBUG +#ifdef CONFIG_DEBUG printk_once (XENLOG_G_WARNING "gnttab_mark_dirty not implemented yet\n" );#endif }
xen/arch/arm/irq.c +1 -1
@@ -290,7 +290,7 @@ void do_IRQ(struct cpu_user_regs *regs, unsigned int irq, int is_fiq)spin_lock (&desc->lock); desc->handler->ack (desc); -#ifndef NDEBUG +#ifdef CONFIG_DEBUG if ( !desc->action ) { printk("Unknown %s %#3.3x\n",
xen/arch/arm/mmu/domain_page.c +1 -1
@@ -120,7 +120,7 @@ void *map_domain_page(mfn_t mfn)/* If the map fills up, the callers have misbehaved. */ BUG_ON (i ==DOMHEAP_ENTRIES ); -#ifndef NDEBUG +#ifdef CONFIG_DEBUG /* Searching the hash could get slow if the map starts filling up. * Cross that bridge when we come to it */ {
xen/arch/arm/traps.c +4 -4
@@ -1364,7 +1364,7 @@ long dep_physdev_op_compat(XEN_GUEST_HANDLE_PARAM(physdev_op_t) uop)return do_deprecated_hypercall (); } -#ifndef NDEBUG +#ifdef CONFIG_DEBUG static void do_debug_trap (struct cpu_user_regs *regs,unsigned int code) {uint32_t reg;
@@ -1431,7 +1431,7 @@ static void do_trap_hypercall(struct cpu_user_regs *regs, register_t *nr,HYPERCALL_ARG2 (regs),HYPERCALL_ARG3 (regs), HYPERCALL_ARG4(regs), HYPERCALL_ARG5(regs)); -#ifndef NDEBUG +#ifdef CONFIG_DEBUG if ( !curr->hcall_preempted &&HYPERCALL_RESULT_REG (regs) != -ENOSYS ) {/* Deliberately corrupt parameter regs used by this hypercall. */
@@ -2108,7 +2108,7 @@ void asmlinkage do_trap_guest_sync(struct cpu_user_regs *regs)GUEST_BUG_ON (!regs_mode_is_32bit (regs));perfc_incr (trap_hvc32); -#ifndef NDEBUG +#ifdef CONFIG_DEBUG if ( (hsr.iss &0xff00 ) ==0xff00 )return do_debug_trap (regs, hsr.iss &0x00ff );#endif
@@ -2123,7 +2123,7 @@ void asmlinkage do_trap_guest_sync(struct cpu_user_regs *regs)case HSR_EC_HVC64 :GUEST_BUG_ON (regs_mode_is_32bit (regs));perfc_incr (trap_hvc64); -#ifndef NDEBUG +#ifdef CONFIG_DEBUG if ( (hsr.iss &0xff00 ) ==0xff00 )return do_debug_trap (regs, hsr.iss &0x00ff );#endif
xen/arch/x86/acpi/cpufreq/amd-cppc.c +1 -1
@@ -30,7 +30,7 @@ printk(XENLOG_DEBUG "AMD-CPPC: CPU%u " fmt, cpu, ## args); \ }) -#ifndef NDEBUG +#ifdef CONFIG_DEBUG static bool __ro_after_init opt_active_mode;#else static bool __initdata opt_active_mode;
xen/arch/x86/hvm/emulate.c +3 -3
@@ -788,7 +788,7 @@ static void *hvmemul_map_linear_addr( nr_frames)) == NULL ) goto unhandleable; -#ifndef NDEBUG /* Poision unused mfn[]s with INVALID_MFN. */ +#ifdef CONFIG_DEBUG /* Poision unused mfn[]s with INVALID_MFN. */ while ( mfn < hvmemul_ctxt->mfn +ARRAY_SIZE (hvmemul_ctxt->mfn) ) {ASSERT (mfn_x (*mfn) ==0 );
@@ -805,7 +805,7 @@ static void *hvmemul_map_linear_addr(while ( mfn-- > hvmemul_ctxt->mfn ) {put_page (mfn_to_page (*mfn)); -#ifndef NDEBUG /* Clean slot for a subsequent map()'s error checking. */ +#ifdef CONFIG_DEBUG /* Clean slot for a subsequent map()'s error checking. */ *mfn =_mfn (0 );#endif }
@@ -837,7 +837,7 @@ static void hvmemul_unmap_linear_addr( *mfn++ =_mfn (0 );/* Clean slot for map()'s error checking. */ } -#ifndef NDEBUG /* Check (and clean) all unused mfns. */ +#ifdef CONFIG_DEBUG /* Check (and clean) all unused mfns. */ while ( mfn < hvmemul_ctxt->mfn +ARRAY_SIZE (hvmemul_ctxt->mfn) ) {ASSERT (mfn_eq (*mfn,INVALID_MFN ));
xen/arch/x86/hvm/irq.c +1 -1
@@ -489,7 +489,7 @@ void hvm_set_callback_via(struct domain *d, uint64_t via)if (is_vcpu_online (v) )hvm_assert_evtchn_irq (v); -#ifndef NDEBUG +#ifdef CONFIG_DEBUG printk (XENLOG_G_INFO "Dom%u callback via changed to " , d->domain_id);switch ( via_type ) {
xen/arch/x86/hvm/svm/emulate.c +1 -1
@@ -23,7 +23,7 @@ static unsigned long svm_nextrip_insn_length(struct vcpu *v)if ( !cpu_has_svm_nrips )return 0 ; -#ifndef NDEBUG +#ifdef CONFIG_DEBUG switch ( vmcb->exitcode ) { case VMEXIT_CR0_READ ... VMEXIT_DR15_WRITE:
xen/arch/x86/hvm/vmx/intr.c +1 -1
@@ -330,7 +330,7 @@ void asmlinkage vmx_intr_assist(void)*/ if ( pt_vector !=-1 ) { -#ifndef NDEBUG +#ifdef CONFIG_DEBUG /* * We assert that intack.vector is the highest priority vector for * only an interrupt from vlapic can reach this point and the
xen/arch/x86/include/asm/asm_defns.h +2 -2
@@ -41,7 +41,7 @@ register unsigned long current_stack_pointer asm("rsp");#endif -#ifndef NDEBUG +#ifdef CONFIG_DEBUG #define ASSERT_INTERRUPT_STATUS (x, msg) \ pushf; \ testb $X86_EFLAGS_IF>>8,1(%rsp); \
@@ -156,7 +156,7 @@ register unsigned long current_stack_pointer asm("rsp");GET_STACK_END (reg); \ movq STACK_CPUINFO_FIELD(current_vcpu)(%r##reg), %r##reg -#ifndef NDEBUG +#ifdef CONFIG_DEBUG #define ASSERT_NOT_IN_ATOMIC \ sti;/* sometimes called with interrupts disabled: safe to enable */ \call ASSERT_NOT_IN_ATOMIC
xen/arch/x86/include/asm/hvm/hvm.h +1 -1
@@ -633,7 +633,7 @@ static inline void hvm_sanitize_regs_fields(struct cpu_user_regs *regs, regs->rsp = (uint32_t )regs->rsp; } -#ifndef NDEBUG +#ifdef CONFIG_DEBUG regs->error_code =0xbeef ; regs->entry_vector =0xbeef ; regs->saved_upcall_mask =0xbf ;
xen/arch/x86/include/asm/hvm/support.h +1 -1
@@ -15,7 +15,7 @@#include <asm/processor.h> #include <asm/p2m.h> -#ifndef NDEBUG +#ifdef CONFIG_DEBUG #define DBG_LEVEL_0 (1 << 0)#define DBG_LEVEL_1 (1 << 1)#define DBG_LEVEL_2 (1 << 2)
xen/arch/x86/include/asm/hypercall.h +2 -2
@@ -45,7 +45,7 @@ compat_common_vcpu_op(static inline void clobber_regs64 (struct cpu_user_regs *regs,unsigned int nargs) { -#ifndef NDEBUG +#ifdef CONFIG_DEBUG /* Deliberately corrupt used parameter regs. */ switch ( nargs ) {
@@ -61,7 +61,7 @@ static inline void clobber_regs64(struct cpu_user_regs *regs,static inline void clobber_regs32 (struct cpu_user_regs *regs,unsigned int nargs) { -#ifndef NDEBUG +#ifdef CONFIG_DEBUG /* Deliberately corrupt used parameter regs. */ switch ( nargs ) {
xen/arch/x86/include/asm/mem_sharing.h +1 -1
@@ -19,7 +19,7 @@ struct xen_mem_sharing_op;#define mem_sharing_enabled (d) ((d)->arch.hvm.mem_sharing.enabled)/* Auditing of memory sharing code? */ -#ifndef NDEBUG +#ifdef CONFIG_DEBUG #define MEM_SHARING_AUDIT 1#else #define MEM_SHARING_AUDIT 0
xen/arch/x86/include/asm/mm.h +1 -1
@@ -568,7 +568,7 @@ int audit_adjust_pgtables(struct domain *d, int dir, int noisy);extern int pagefault_by_memadd (unsigned long addr,struct cpu_user_regs *regs);extern int handle_memadd_fault (unsigned long addr,struct cpu_user_regs *regs); -#ifndef NDEBUG +#ifdef CONFIG_DEBUG #define AUDIT_SHADOW_ALREADY_LOCKED ( 1u << 0 )#define AUDIT_ERRORS_OK ( 1u << 1 )
xen/arch/x86/include/asm/p2m.h +1 -1
@@ -20,7 +20,7 @@#include <asm/page.h> /* for pagetable_t */ /* Debugging and auditing of the P2M code? */ -#if !defined(NDEBUG ) && defined(CONFIG_HVM ) +#if defined(CONFIG_DEBUG ) && defined(CONFIG_HVM )#define P2M_AUDIT 1#else #define P2M_AUDIT 0
xen/arch/x86/mm.c +6 -6
@@ -249,7 +249,7 @@ void __init init_frametable(void)memset (end_pg,-1 , (unsigned long )top_pg - (unsigned long )end_pg); } -#ifndef NDEBUG +#ifdef CONFIG_DEBUG static unsigned int __read_mostly root_pgt_pv_xen_slots =ROOT_PAGETABLE_PV_XEN_SLOTS ;static l4_pgentry_t __read_mostly split_l4e;
@@ -340,7 +340,7 @@ void __init arch_init_memory(void)brk_free_unused (); -#ifndef NDEBUG +#ifdef CONFIG_DEBUG if ( highmem_start ) {unsigned long split_va = (unsigned long )__va (highmem_start);
@@ -839,7 +839,7 @@ bool is_memory_hole(mfn_t start, mfn_t end) #if defined(CONFIG_PV) || defined(CONFIG_SHADOW_PAGING) -#ifndef NDEBUG +#ifdef CONFIG_DEBUG struct mmio_emul_range_ctxt { const struct domain *d; unsigned long mfn;
@@ -971,7 +971,7 @@ get_page_from_l1e( }else if ( l1f & _PAGE_RW ) { -#ifndef NDEBUG +#ifdef CONFIG_DEBUG const unsigned long *ro_map;unsigned int seg, bdf;
@@ -1736,7 +1736,7 @@ void init_xen_l4_slots(l4_pgentry_t *l4t, mfn_t l4mfn, l4t[l4_table_offset (PERDOMAIN_VIRT_START )];/* Slot 261-: text/data/bss, RW M2P, vmap, frametable, directmap. */ -#ifndef NDEBUG +#ifdef CONFIG_DEBUG if ( short_directmap &&unlikely (root_pgt_pv_xen_slots <ROOT_PAGETABLE_PV_XEN_SLOTS ) ) {
@@ -2045,7 +2045,7 @@ static int demote_l4_table(struct page_info *page) }#endif /* CONFIG_PV */ -#ifndef NDEBUG +#ifdef CONFIG_DEBUG /* * We must never call _put_page_type() while holding a page_lock() for * that page; doing so may cause a deadlock under the right
xen/arch/x86/mm/p2m-pod.c +1 -1
@@ -51,7 +51,7 @@ p2m_pod_cache_add(struct p2m_domain *p2m,struct domain *d = p2m->domain;mfn_t mfn =page_to_mfn (page); -#ifndef NDEBUG +#ifdef CONFIG_DEBUG /* Check to make sure this is a contiguous region */ if (mfn_x (mfn) & ((1UL << order) -1 ) ) {
xen/arch/x86/mm/shadow/common.c +2 -2
@@ -496,7 +496,7 @@ void shadow_blow_tables_per_domain(struct domain *d) } } -#ifndef NDEBUG +#ifdef CONFIG_DEBUG /* Blow all shadows of all shadowed domains: this can be used to cause the * guest's pagetables to be re-shadowed if we suspect that the shadows * have somehow got out of sync */
@@ -517,7 +517,7 @@ static int __init cf_check shadow_blow_tables_keyhandler_init(void)return 0 ; }__initcall (shadow_blow_tables_keyhandler_init); -#endif /* !NDEBUG */ +#endif /* CONFIG_DEBUG */ /* Accessors for the singly-linked list that's used for hash chains */ static inline struct page_info *
xen/arch/x86/mm/shadow/hvm.c +1 -1
@@ -456,7 +456,7 @@ static void *sh_emulate_map_dest(struct vcpu *v, unsigned long vaddr,struct domain *d = v->domain;void *map; -#ifndef NDEBUG +#ifdef CONFIG_DEBUG /* We don't emulate user-mode writes to page tables. */ if (hvm_get_cpl (v) ==3 ) {
xen/arch/x86/mm/shadow/multi.c +1 -1
@@ -3202,7 +3202,7 @@ static pagetable_t cf_check sh_update_cr3(struct vcpu *v, bool noflush)//// vcpu->arch.guest_table is already set //// -#ifndef NDEBUG +#ifdef CONFIG_DEBUG /* Double-check that the HVM code has sent us a sane guest_table */ if (is_hvm_domain (d) ) {
xen/arch/x86/pv/dom0_build.c +3 -3
@@ -899,7 +899,7 @@ static int __init dom0_construct(const struct boot_domain *bd)else mfn -=PFN_UP (initrd_len); } -#ifndef NDEBUG +#ifdef CONFIG_DEBUG #define REVERSE_START ((v_end - v_start) >> PAGE_SHIFT)if ( pfn >REVERSE_START && (vinitrd_start || pfn < initrd_pfn) ) mfn = alloc_epfn - (pfn -REVERSE_START );
@@ -929,7 +929,7 @@ static int __init dom0_construct(const struct boot_domain *bd) } }BUG_ON (pfn !=domain_tot_pages (d)); -#ifndef NDEBUG +#ifdef CONFIG_DEBUG alloc_epfn +=PFN_UP (initrd_len) + si->nr_p2m_frames;#endif while ( pfn < nr_pages )
@@ -943,7 +943,7 @@ static int __init dom0_construct(const struct boot_domain *bd)while ( pfn <domain_tot_pages (d) ) { mfn =mfn_x (page_to_mfn (page)); -#ifndef NDEBUG +#ifdef CONFIG_DEBUG #define pfn (nr_pages - 1 - (pfn - (alloc_epfn - alloc_spfn)))#endif dom0_update_physmap (compat, pfn, mfn, vphysmap_start);
xen/arch/x86/pv/emulate.c +1 -1
@@ -48,7 +48,7 @@ int pv_emul_read_descriptor(unsigned int sel, const struct vcpu *v, *limit = (desc.a &0xffff ) | (desc.b &0x000f0000 );if ( desc.b & _SEGMENT_G ) *limit = ((*limit +1 ) <<12 ) -1 ; -#ifndef NDEBUG +#ifdef CONFIG_DEBUG if ( sel >3 ) {unsigned int a, l;
xen/arch/x86/pv/mm.h +1 -1
@@ -56,7 +56,7 @@ static inline intpte_t paging_cmpxchg_guest_entry(* PTE updates can be done with ordinary writes except: * 1. Debug builds get extra checking by using CMPXCHG[8B]. */ -#ifndef NDEBUG +#ifdef CONFIG_DEBUG #define PTE_UPDATE_WITH_CMPXCHG #else #undef PTE_UPDATE_WITH_CMPXCHG
xen/arch/x86/setup.c +1 -1
@@ -99,7 +99,7 @@ boolean_param("noapic", skip_ioapic_setup);int8_t __read_mostly xen_cpuidle =-1 ;boolean_param ("cpuidle" , xen_cpuidle); -#ifndef NDEBUG +#ifdef CONFIG_DEBUG unsigned long __initdata highmem_start;size_param ("highmem-start" , highmem_start);#endif
xen/arch/x86/x86_64/compat/entry.S +1 -1
@@ -182,7 +182,7 @@ FUNC(cr4_pv32_restore) mov %rax, (%rcx) RET 0: -#ifndef NDEBUG +#ifdef CONFIG_DEBUG /* Check that _all_ of the bits intended to be set actually are. */ mov %cr4, %rax and cr4_pv32_mask(%rip), %rax
xen/arch/x86/x86_64/entry.S +1 -1
@@ -14,7 +14,7 @@ /* %rsp: struct cpu_user_regs */ .macro ASSERT_CONTEXT_IS_XEN -#ifndef NDEBUG +#ifdef CONFIG_DEBUG testb $3, UREGS_cs(%rsp) UNLIKELY_START(nz, ASSERT_XEN_\@) ASSERT_FAILED("INTERRUPTED XEN CONTEXT")
xen/arch/x86/x86_emulate/decode.c +1 -1
@@ -39,7 +39,7 @@ x86_decode_insn(if (unlikely (rc !=X86EMUL_OKAY ) )return ERR_PTR (-rc); -#if defined(__XEN__) && !defined(NDEBUG ) +#if defined(__XEN__) && defined(CONFIG_DEBUG )/* * While we avoid memory allocation (by use of per-CPU data) above, * nevertheless make sure callers properly release the state structure
xen/arch/x86/x86_emulate/private.h +2 -2
@@ -336,7 +336,7 @@ struct x86_emulate_state {struct stub_exn *stub_exn; -#ifndef NDEBUG +#ifdef CONFIG_DEBUG /* * Track caller of x86_decode_insn() to spot missing as well as * premature calls to x86_emulate_free_state().
@@ -347,7 +347,7 @@ struct x86_emulate_state {static inline void check_state (const struct x86_emulate_state *s) { -#if defined(__XEN__) && !defined(NDEBUG ) +#if defined(__XEN__) && defined(CONFIG_DEBUG )ASSERT (s->caller);#endif }
xen/arch/x86/x86_emulate/util-xen.c +1 -1
@@ -13,7 +13,7 @@#include <asm/debugreg.h> #include <asm/xstate.h> -#ifndef NDEBUG +#ifdef CONFIG_DEBUG void x86_emulate_free_state (struct x86_emulate_state *s) {check_state (s);
xen/arch/x86/x86_emulate/x86_emulate.c +3 -3
@@ -1344,11 +1344,11 @@ x86_emulate(if ( ops->validate ) { -#ifndef NDEBUG +#ifdef CONFIG_DEBUG state.caller =__builtin_return_address (0 );#endif rc = ops->validate (&state, ctxt); -#ifndef NDEBUG +#ifdef CONFIG_DEBUG state.caller =NULL ;#endif if ( rc ==X86EMUL_DONE )
@@ -8702,7 +8702,7 @@ static void __init __maybe_unused build_assertions(void)BUILD_BUG_ON (X86_ET_OTHER !=7 ); } -#ifndef NDEBUG +#ifdef CONFIG_DEBUG /* * In debug builds, wrap x86_emulate() with some assertions about its expected * behaviour.
xen/arch/x86/x86_emulate/x86_emulate.h +1 -1
@@ -614,7 +614,7 @@ x86_emulate(struct x86_emulate_ctxt *ctxt, const struct x86_emulate_ops *ops); -#ifndef NDEBUG +#ifdef CONFIG_DEBUG /* * In debug builds, wrap x86_emulate() with some assertions about its expected * behaviour.
xen/arch/x86/xstate.c +1 -1
@@ -448,7 +448,7 @@ void xrstor(struct vcpu *v, uint64_t mask) }if (likely (faults == prev_faults) )break ; -#ifndef NDEBUG +#ifdef CONFIG_DEBUG gprintk (XENLOG_WARNING ,"fault#%u: mxcsr=%08x\n" , faults, ptr->fpu_sse.mxcsr); gprintk(XENLOG_WARNING, "xs=%016lx xc=%016lx\n",
xen/common/event_channel.c +2 -2
@@ -99,14 +99,14 @@ static always_inline void evtchn_write_lock(struct evtchn *evtchn) {write_lock (&evtchn->lock); -#ifndef NDEBUG +#ifdef CONFIG_DEBUG evtchn->old_state = evtchn->state;#endif }static inline unsigned int old_state (const struct evtchn *evtchn) { -#ifndef NDEBUG +#ifdef CONFIG_DEBUG return evtchn->old_state;#else return ECS_RESERVED ;/* Just to allow things to build. */
xen/common/grant_table.c +4 -4
@@ -386,7 +386,7 @@ struct active_grant_entry {grant. */ grant_ref_t trans_gref;mfn_t mfn;/* Machine frame being granted. */ -#ifndef NDEBUG +#ifdef CONFIG_DEBUG gfn_t gfn;/* Guest's idea of the frame being granted. */ #endif spinlock_t lock;/* lock to protect access of this entry.
@@ -400,7 +400,7 @@ struct active_grant_entry {static inline void act_set_gfn (struct active_grant_entry *act,gfn_t gfn) { -#ifndef NDEBUG +#ifdef CONFIG_DEBUG act->gfn = gfn;#endif }
@@ -4084,12 +4084,12 @@ void grant_table_warn_active_grants(struct domain *d) nr_active++;if ( nr_active <=WARN_GRANT_MAX ) printk(XENLOG_G_DEBUG "d%d has active grant %x (" -#ifndef NDEBUG +#ifdef CONFIG_DEBUG "GFN %lx, " #endif"MFN: %#" PRI_mfn")\n" , d->domain_id, ref, -#ifndef NDEBUG +#ifdef CONFIG_DEBUGgfn_x (act->gfn), #endifmfn_x (act->mfn));
xen/common/multicall.c +1 -1
@@ -73,7 +73,7 @@ ret_t do_multicall(*/ ASSERT_NOT_IN_ATOMIC (); -#ifndef NDEBUG +#ifdef CONFIG_DEBUG {/* * Deliberately corrupt the contents of the multicall structure.
xen/common/page_alloc.c +2 -2
@@ -436,7 +436,7 @@ mfn_t __init alloc_boot_pages(unsigned long nr_pfns, unsigned long pfn_align)if ( pg >= r->e || pg < r->s )continue ; -#if defined(CONFIG_X86 ) && !defined(NDEBUG ) +#if defined(CONFIG_X86 ) && defined(CONFIG_DEBUG )/* * Filtering pfn_align == 1 since the only allocations using a bigger * alignment are the ones used for setting up the frame table chunks.
@@ -2611,7 +2611,7 @@ int assign_pages( goto out; } -#ifndef NDEBUG +#ifdef CONFIG_DEBUG {unsigned int extra_pages =0 ;
xen/common/preempt.c +1 -1
@@ -30,7 +30,7 @@ bool in_atomic(void)return preempt_count () ||in_irq () || !local_irq_is_enabled (); } -#ifndef NDEBUG +#ifdef CONFIG_DEBUG void ASSERT_NOT_IN_ATOMIC (void ) {ASSERT (!preempt_count ());
xen/include/xen/bug.h +1 -1
@@ -137,7 +137,7 @@ static void always_inline run_in_exception_handler(bug_fn_t *fn)unlikely (ret_warn_on_); \ }) -#ifndef NDEBUG +#ifdef CONFIG_DEBUG #define ASSERT (p) \ do { if ( unlikely(!(p)) ) assert_failed(#p); } while (0)#define ASSERT_UNREACHABLE () assert_failed("unreachable")
xen/include/xen/pci.h +1 -1
@@ -204,7 +204,7 @@ static always_inline bool pcidevs_trylock(void)return lock_evaluate_nospec (pcidevs_trylock_unsafe ()); } -#ifndef NDEBUG +#ifdef CONFIG_DEBUG /* * Check to ensure there will be no changes to the entries in d->pdev_list (but * not the contents of each entry).
xen/include/xen/preempt.h +1 -1
@@ -28,7 +28,7 @@ DECLARE_PER_CPU(unsigned int, __preempt_count);bool in_atomic (void ); -#ifndef NDEBUG +#ifdef CONFIG_DEBUG void ASSERT_NOT_IN_ATOMIC (void );#else #define ASSERT_NOT_IN_ATOMIC () ((void)0)
xen/include/xen/rwlock.h +2 -2
@@ -325,12 +325,12 @@ typedef struct percpu_rwlock percpu_rwlock_t;struct percpu_rwlock {rwlock_t rwlock;bool writer_activating; -#ifndef NDEBUG +#ifdef CONFIG_DEBUG percpu_rwlock_t **percpu_owner;#endif }; -#ifndef NDEBUG +#ifdef CONFIG_DEBUG #define PERCPU_RW_LOCK_UNLOCKED (owner) { RW_LOCK_UNLOCKED, 0, owner }static inline void _percpu_rwlock_owner_check (percpu_rwlock_t **per_cpudata,percpu_rwlock_t *percpu_rwlock)
xen/include/xen/sched.h +1 -1
@@ -102,7 +102,7 @@ struct evtchn#define ECS_VIRQ 5/* Channel is bound to a virtual IRQ line. */ #define ECS_IPI 6/* Channel is bound to a virtual IPI line. */ unsigned char state;/* ECS_* */ -#ifndef NDEBUG +#ifdef CONFIG_DEBUG unsigned char old_state;/* State when taking lock in write mode. */ #endif unsigned char xen_consumer:XEN_CONSUMER_BITS; /* Consumer in Xen if != 0 */
xen/include/xen/typesafe.h +1 -1
@@ -17,7 +17,7 @@* Non-debug builds degrade to a simple typedef and noops for the functions. */ -#ifndef NDEBUG +#ifdef CONFIG_DEBUG #define TYPE_SAFE (_type, _name) \ typedef struct { _type _name; } _name##_t; \
Signature · 1 line
2.39.5
PATCH 2/3 xen/treewide: Convert all #ifdef NDEBUG to CONFIG_DEBUG
In reply to Andrew CooperWe have two ways of spelling debug build in Xen, one with positive form and one with an inverted form.
Convert the remaining uses of NDEBUG to CONFIG_DEBUG. In some cases, rearrange the #if/#else to keep using CONFIG_DEBUG in a positive form.
No functional change.
---
CC: Jan Beulich <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Teddy Astie <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Julien Grall <[email protected]>
CC: Volodymyr Babchuk <[email protected]>
CC: Bertrand Marquis <[email protected]>
CC: Michal Orzel <[email protected]>
CC: Oleksii Kurochko <[email protected]>
CC: Baptiste Le Duc <[email protected]>
--- xen/arch/arm/mmu/pt.c | 10 +++++----- xen/arch/x86/domain_page.c | 6 +++--- xen/arch/x86/hvm/svm/emulate.c | 2 +- xen/arch/x86/include/asm/page.h | 3 ++- xen/arch/x86/include/asm/setup.h | 6 +++--- xen/arch/x86/mm/shadow/private.h | 8 ++++---- xen/arch/x86/traps.c | 6 +++--- xen/arch/x86/x86_emulate/x86_emulate.h | 2 +- xen/drivers/char/console.c | 12 ++++++------ xen/include/xen/lib.h | 18 +++++++++--------- 10 files changed, 37 insertions(+), 36 deletions(-)
xen/arch/arm/mmu/pt.c +5 -5
@@ -14,17 +14,17 @@#include <asm/current.h> #include <asm/fixmap.h> -#ifdef NDEBUG -static inline void -__attribute__ ((__format__ (__printf__,1 ,2 ))) -mm_printk (const char *fmt, ...) {} -#else +#ifdef CONFIG_DEBUG #define mm_printk(fmt, args...) \ do \ { \ dprintk(XENLOG_ERR, fmt, ## args); \ WARN(); \ } while (0) +#else +static inline void +__attribute__ ((__format__ (__printf__,1 ,2 ))) +mm_printk (const char *fmt, ...) {}#endif #ifdef CONFIG_ARM_64
xen/arch/x86/domain_page.c +3 -3
@@ -68,7 +68,7 @@ void *map_domain_page(mfn_t mfn)struct mapcache_vcpu *vcache;struct vcpu_maphash_entry *hashent; -#ifdef NDEBUG +#ifndef CONFIG_DEBUG if (mfn_x (mfn) <=PFN_DOWN (__pa (HYPERVISOR_VIRT_END -1 )) )return mfn_to_virt (mfn_x (mfn));#endif
@@ -230,7 +230,7 @@ void mapcache_domain_init(struct domain *d)ASSERT (is_pv_domain (d)); -#ifdef NDEBUG +#ifndef CONFIG_DEBUG if ( !mem_hotplug && max_page <=PFN_DOWN (__pa (HYPERVISOR_VIRT_END -1 )) )return ;#endif
@@ -297,7 +297,7 @@ void *map_domain_page_global(mfn_t mfn) system_state < SYS_STATE_active) || local_irq_is_enabled())); -#ifdef NDEBUG +#ifndef CONFIG_DEBUG if (mfn_x (mfn) <=PFN_DOWN (__pa (HYPERVISOR_VIRT_END -1 )) )return mfn_to_virt (mfn_x (mfn));#endif
xen/arch/x86/hvm/svm/emulate.c +1 -1
@@ -63,7 +63,7 @@ unsigned int svm_get_insn_len(struct vcpu *v, unsigned int instr_enc) nrip_len =svm_nextrip_insn_length (v); -#ifdef NDEBUG +#ifndef CONFIG_DEBUG if ( nrip_len >MAX_INST_LEN )gprintk (XENLOG_WARNING ,"NRip reported inst_len %lu\n" , nrip_len);else if ( nrip_len !=0 )
xen/arch/x86/include/asm/page.h +2 -1
@@ -333,9 +333,10 @@ void efi_update_l4_pgtable(unsigned int l4idx, l4_pgentry_t l4e);* WARNING: This will need to be disabled to run OSes that use the spare PTE * bits themselves (e.g., *BSD). */ -#ifdef NDEBUG +#ifndef CONFIG_DEBUG #undef _PAGE_GNTTAB#endif +#ifndef _PAGE_GNTTAB#define _PAGE_GNTTAB 0#endif
xen/arch/x86/include/asm/setup.h +3 -3
@@ -46,10 +46,10 @@ int remove_xen_ranges(struct rangeset *r); int cf_check stub_selftest(void); -#ifdef NDEBUG -# define highmem_start 0 -#else +#ifdef CONFIG_DEBUG extern unsigned long highmem_start; +#else +# define highmem_start 0#endif extern unsigned int i8259A_alias_mask;
xen/arch/x86/mm/shadow/private.h +4 -4
@@ -31,12 +31,12 @@#define SHADOW_AUDIT_ENTRIES_FULL 0x08/* Check every shadow */ #define SHADOW_AUDIT_ENTRIES_MFNS 0x10/* Check gfn-mfn map in shadows */ -#ifdef NDEBUG -#define SHADOW_AUDIT 0 -#define shadow_audit_enable false -#else +#ifdef CONFIG_DEBUG #define SHADOW_AUDIT 0x15/* Basic audit of all */ extern bool shadow_audit_enable; +#else +#define SHADOW_AUDIT 0 +#define shadow_audit_enable false#endif /******************************************************************************
xen/arch/x86/traps.c +3 -3
@@ -60,10 +60,10 @@* dom0: The NMI is virtualised to DOM0. * ignore: The NMI error is cleared and ignored. */ -#ifdef NDEBUG -static char __read_mostly opt_nmi[10 ] ="dom0" ; -#else +#ifdef CONFIG_DEBUG static char __read_mostly opt_nmi[10 ] ="fatal" ; +#else +static char __read_mostly opt_nmi[10 ] ="dom0" ;#endif string_param ("nmi" , opt_nmi);
xen/arch/x86/x86_emulate/x86_emulate.h +1 -1
@@ -699,7 +699,7 @@ bool cf_check x86_insn_is_cr_access(const struct x86_emulate_state *s, const struct x86_emulate_ctxt *ctxt); -#if !defined(__XEN__) || defined(NDEBUG ) +#if !defined(__XEN__) || !defined(CONFIG_DEBUG )static inline void x86_emulate_free_state (struct x86_emulate_state *s) {}#else void x86_emulate_free_state (struct x86_emulate_state *s);
xen/drivers/char/console.c +6 -6
@@ -148,16 +148,16 @@ static DEFINE_RSPINLOCK(console_lock);* Note, in the above algorithm, to disable rate limiting simply make * the lower threshold equal to the upper. */ -#ifdef NDEBUG -#define XENLOG_UPPER_THRESHOLD 3/* Do not print DEBUG */ -#define XENLOG_LOWER_THRESHOLD 3/* Always print INFO, ERR and WARNING */ -#define XENLOG_GUEST_UPPER_THRESHOLD 2/* Do not print INFO and DEBUG */ -#define XENLOG_GUEST_LOWER_THRESHOLD 0/* Rate-limit ERR and WARNING */ -#else +#ifdef CONFIG_DEBUG #define XENLOG_UPPER_THRESHOLD 4/* Do not discard anything */ #define XENLOG_LOWER_THRESHOLD 4/* Print everything */ #define XENLOG_GUEST_UPPER_THRESHOLD 4/* Do not discard anything */ #define XENLOG_GUEST_LOWER_THRESHOLD 4/* Print everything */ +#else +#define XENLOG_UPPER_THRESHOLD 3/* Do not print DEBUG */ +#define XENLOG_LOWER_THRESHOLD 3/* Always print INFO, ERR and WARNING */ +#define XENLOG_GUEST_UPPER_THRESHOLD 2/* Do not print INFO and DEBUG */ +#define XENLOG_GUEST_LOWER_THRESHOLD 0/* Rate-limit ERR and WARNING */ #endif /* * The XENLOG_DEFAULT is the default given to printks that
xen/include/xen/lib.h +9 -9
@@ -100,7 +100,15 @@ extern bool printk_ratelimit(void); #define gprintk(lvl, fmt, args...) \ printk(XENLOG_GUEST lvl "%pv " fmt, current, ## args) -#ifdef NDEBUG +#ifdef CONFIG_DEBUG + +#define dprintk(lvl, fmt, args...) \ + printk(lvl "%s:%d: " fmt, __FILE__, __LINE__, ## args) +#define gdprintk(lvl, fmt, args...) \ + printk(XENLOG_GUEST lvl "%s:%d:%pv " fmt, \ + __FILE__, __LINE__, current, ## args) + +#else static inline void __attribute__ ((__format__ (__printf__, 2, 3)))
@@ -110,14 +118,6 @@ static inline void __attribute__ ((__format__ (__printf__,2 ,3 ))) gdprintk(const char *lvl, const char *fmt, ...) {} -#else - -#define dprintk(lvl, fmt, args...) \ - printk(lvl "%s:%d: " fmt, __FILE__, __LINE__, ## args) -#define gdprintk(lvl, fmt, args...) \ - printk(XENLOG_GUEST lvl "%s:%d:%pv " fmt, \ - __FILE__, __LINE__, current, ## args) - #endif/* vsprintf.c */
Signature · 1 line
2.39.5
PATCH 3/3 xen/config: Drop NDEBUG
In reply to Andrew CooperThere are no remaining users.
---
CC: Jan Beulich <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Teddy Astie <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Julien Grall <[email protected]>
CC: Volodymyr Babchuk <[email protected]>
CC: Bertrand Marquis <[email protected]>
CC: Michal Orzel <[email protected]>
CC: Oleksii Kurochko <[email protected]>
CC: Baptiste Le Duc <[email protected]>
--- xen/include/xen/config.h | 4 ---- 1 file changed, 4 deletions(-)
xen/include/xen/config.h +0 -4
@@ -85,10 +85,6 @@/* allow existing code to work with Kconfig variable */ #define NR_CPUS CONFIG_NR_CPUS -#ifndef CONFIG_DEBUG -#define NDEBUG -#endif -#ifndef ZERO_BLOCK_PTR /* Return value for zero-size allocation, distinguished from NULL. */ #define ZERO_BLOCK_PTR ((void *)-1L)
Signature · 1 line
2.39.5
Quoted 7 lines · Andrew Cooper
We have two ways of spelling debug build in Xen. Reduce this down to just one way.
Andrew Cooper (3):
xen/treewide: Convert all #ifndef NDEBUG toCONFIG_DEBUGxen/treewide: Convert all #ifdef NDEBUG toCONFIG_DEBUGxen/config: Drop NDEBUG
While the ASSERT() related distinction was helpful imo, I don't mind the folding:
I wonder whether in x86_emulate/ keeping constructs like
#if defined(__XEN__) && defined(CONFIG_DEBUG)
is actually necessary: CONFIG_DEBUG shouldn't be defined in the test or fuzzing harnesses.
Jan
Quoted 11 lines · Jan Beulich
Quoted 7 lines · Andrew Cooper
We have two ways of spelling debug build in Xen. Reduce this down to just one way.
Andrew Cooper (3):
xen/treewide: Convert all #ifndef NDEBUG toCONFIG_DEBUGxen/treewide: Convert all #ifdef NDEBUG toCONFIG_DEBUGxen/config: Drop NDEBUGWhile the
ASSERT()related distinction was helpful imo, I don't mind the folding:Acked-by Jan Beulich <[email protected]>
Thanks.
I'm open to the idea of having CONFIG_ASSERTS separate from CONFIG_DEBUG, but if we're going to do that, it should be a separate change.
The problem is a) having two different ways of identifying general debug-ness, and b) them having different polarities.
Quoted 7 lines
I wonder whether in x86_emulate/ keeping constructs like
#if
defined(__XEN__)&&defined(CONFIG_DEBUG)is actually necessary:
CONFIG_DEBUGshouldn't be defined in the test or fuzzing harnesses.
In this case I think the __XEN__ is helpful context when reading.
~Andrew
Quoted 9 lines · Andrew Cooper
Quoted 8 lines · Jan Beulich
Quoted 7 lines · Andrew Cooper
We have two ways of spelling debug build in Xen. Reduce this down to just one way.
Andrew Cooper (3):
xen/treewide: Convert all #ifndef NDEBUG toCONFIG_DEBUGxen/treewide: Convert all #ifdef NDEBUG toCONFIG_DEBUGxen/config: Drop NDEBUG
Quoted 8 lines
Quoted 3 lines
While the
ASSERT()related distinction was helpful imo, I don't mind the folding:Acked-by Jan Beulich <[email protected]>Thanks.
I'm open to the idea of having
CONFIG_ASSERTSseparate fromCONFIG_DEBUG, but if we're going to do that, it should be a separate change.
Just to confirm - yes, doing that separately (if at all) is what I, too, would have expected here.
Jan
Quoted 10 lines · Jan Beulich
Quoted 7 lines · Andrew Cooper
We have two ways of spelling debug build in Xen. Reduce this down to just one way.
Andrew Cooper (3):
xen/treewide: Convert all #ifndef NDEBUG toCONFIG_DEBUGxen/treewide: Convert all #ifdef NDEBUG toCONFIG_DEBUGxen/config: Drop NDEBUGWhile the
ASSERT()related distinction was helpful imo, I don't mind the folding:
Quoted 8 lines
Acked-by Jan Beulich <[email protected]>I wonder whether in x86_emulate/ keeping constructs like
#if
defined(__XEN__)&&defined(CONFIG_DEBUG)is actually necessary:
CONFIG_DEBUGshouldn't be defined in the test or fuzzing harnesses.
It turns out to be more complicated than that.
Because neither the test harness nor fuzzer defined NDEBUG, the non-__XEN__-guarded #ifndef NDEBUG sections did used to get compiled in. This is the state.caller checking and x86_emulate_wrapper().
I'll insert CONFIG_DEBUG into those two paths, to keep the checking as-before, meaning the __XEN__ guards must stay.
~Andrew
Quoted 7 lines · Andrew Cooper
We have two ways of spelling debug build in Xen. Reduce this down to just one way.
Andrew Cooper (3):
xen/treewide: Convert all #ifndef NDEBUG toCONFIG_DEBUGxen/treewide: Convert all #ifdef NDEBUG toCONFIG_DEBUGxen/config: Drop NDEBUG
~Michal