From nobody Thu May 16 13:00:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1689953378932422.13341329777234; Fri, 21 Jul 2023 08:29:38 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.567618.886898 (Exim 4.92) (envelope-from ) id 1qMs4A-0003ny-2h; Fri, 21 Jul 2023 15:29:14 +0000 Received: by outflank-mailman (output) from mailman id 567618.886898; Fri, 21 Jul 2023 15:29:14 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qMs49-0003nr-Vs; Fri, 21 Jul 2023 15:29:13 +0000 Received: by outflank-mailman (input) for mailman id 567618; Fri, 21 Jul 2023 15:29:13 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qMs49-0003nl-6G for xen-devel@lists.xenproject.org; Fri, 21 Jul 2023 15:29:13 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 573f3b66-27db-11ee-8611-37d641c3527e; Fri, 21 Jul 2023 17:29:11 +0200 (CEST) Received: from nico.bugseng.com (unknown [37.162.18.33]) by support.bugseng.com (Postfix) with ESMTPSA id 1894E4EE0C89; Fri, 21 Jul 2023 17:29:09 +0200 (CEST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 573f3b66-27db-11ee-8611-37d641c3527e From: Nicola Vetrini To: xen-devel@lists.xenproject.org Cc: sstabellini@kernel.org, michal.orzel@amd.com, xenia.ragiadakou@amd.com, ayan.kumar.halder@amd.com, consulting@bugseng.com, Nicola Vetrini , Andrew Cooper , George Dunlap , Jan Beulich , Julien Grall , Wei Liu Subject: [XEN PATCH] xen/spinlock: mechanically rename parameter name 'debug' Date: Fri, 21 Jul 2023 17:29:02 +0200 Message-Id: <78255b6c5caaaa02dad638c7d4102ea793a09b88.1689953306.git.nicola.vetrini@bugseng.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1689953380233100001 Content-Type: text/plain; charset="utf-8" Rule 5.3 has the following headline: "An identifier declared in an inner scope shall not hide an identifier declared in an outer scope" To avoid any confusion resulting from the parameter 'debug' hiding the homonymous function declared at 'xen/arch/x86/include/asm/processor.h:428' the rename of parameters s/debug/dbg is performed. Signed-off-by: Nicola Vetrini Reviewed-by: Stefano Stabellini --- x86 maintainers CC'ed because the violation is caused by a declaration in an x86 file, but I reckon it would harm understandability if a function was renamed to 'dbg' --- xen/common/spinlock.c | 38 +++++++++++++++++++------------------- xen/include/xen/spinlock.h | 6 +++--- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/xen/common/spinlock.c b/xen/common/spinlock.c index 7f453234a9..d8d2e6ad1a 100644 --- a/xen/common/spinlock.c +++ b/xen/common/spinlock.c @@ -78,7 +78,7 @@ static int __init cf_check lockdebug_init(void) } presmp_initcall(lockdebug_init); =20 -void check_lock(union lock_debug *debug, bool try) +void check_lock(union lock_debug *dbg, bool try) { bool irq_safe =3D !local_irq_is_enabled(); unsigned int cpu =3D smp_processor_id(); @@ -118,12 +118,12 @@ void check_lock(union lock_debug *debug, bool try) if ( try && irq_safe ) return; =20 - if ( unlikely(debug->irq_safe !=3D irq_safe) ) + if ( unlikely(dbg->irq_safe !=3D irq_safe) ) { union lock_debug seen, new =3D { 0 }; =20 new.irq_safe =3D irq_safe; - seen.val =3D cmpxchg(&debug->val, LOCK_DEBUG_INITVAL, new.val); + seen.val =3D cmpxchg(&dbg->val, LOCK_DEBUG_INITVAL, new.val); =20 if ( !seen.unseen && seen.irq_safe =3D=3D !irq_safe ) { @@ -137,14 +137,14 @@ void check_lock(union lock_debug *debug, bool try) return; =20 for ( i =3D 0; i < nr_taken; i++ ) - if ( taken[i] =3D=3D debug ) + if ( taken[i] =3D=3D dbg ) { - printk("CHECKLOCK FAILURE: lock at %p taken recursively\n", de= bug); + printk("CHECKLOCK FAILURE: lock at %p taken recursively\n", db= g); BUG(); } } =20 -static void check_barrier(union lock_debug *debug) +static void check_barrier(union lock_debug *dbg) { if ( unlikely(atomic_read(&spin_debug) <=3D 0) ) return; @@ -160,10 +160,10 @@ static void check_barrier(union lock_debug *debug) * However, if we spin on an IRQ-unsafe lock with IRQs disabled then t= hat * is clearly wrong, for the same reason outlined in check_lock() abov= e. */ - BUG_ON(!local_irq_is_enabled() && !debug->irq_safe); + BUG_ON(!local_irq_is_enabled() && !dbg->irq_safe); } =20 -void lock_enter(const union lock_debug *debug) +void lock_enter(const union lock_debug *dbg) { unsigned int cpu =3D smp_processor_id(); const union lock_debug **taken =3D per_cpu(locks_taken, cpu); @@ -176,7 +176,7 @@ void lock_enter(const union lock_debug *debug) local_irq_save(flags); =20 if ( *nr_taken < lock_depth_size ) - taken[(*nr_taken)++] =3D debug; + taken[(*nr_taken)++] =3D dbg; else if ( !max_depth_reached ) { max_depth_reached =3D true; @@ -187,7 +187,7 @@ void lock_enter(const union lock_debug *debug) local_irq_restore(flags); } =20 -void lock_exit(const union lock_debug *debug) +void lock_exit(const union lock_debug *dbg) { unsigned int cpu =3D smp_processor_id(); const union lock_debug **taken =3D per_cpu(locks_taken, cpu); @@ -202,7 +202,7 @@ void lock_exit(const union lock_debug *debug) =20 for ( i =3D *nr_taken; i > 0; i-- ) { - if ( taken[i - 1] =3D=3D debug ) + if ( taken[i - 1] =3D=3D dbg ) { memmove(taken + i - 1, taken + i, (*nr_taken - i) * sizeof(*taken)); @@ -217,28 +217,28 @@ void lock_exit(const union lock_debug *debug) =20 if ( !max_depth_reached ) { - printk("CHECKLOCK released lock at %p not recorded!\n", debug); + printk("CHECKLOCK released lock at %p not recorded!\n", dbg); WARN(); } =20 local_irq_restore(flags); } =20 -static void got_lock(union lock_debug *debug) +static void got_lock(union lock_debug *dbg) { - debug->cpu =3D smp_processor_id(); + dbg->cpu =3D smp_processor_id(); =20 - lock_enter(debug); + lock_enter(dbg); } =20 -static void rel_lock(union lock_debug *debug) +static void rel_lock(union lock_debug *dbg) { if ( atomic_read(&spin_debug) > 0 ) - BUG_ON(debug->cpu !=3D smp_processor_id()); + BUG_ON(dbg->cpu !=3D smp_processor_id()); =20 - lock_exit(debug); + lock_exit(dbg); =20 - debug->cpu =3D SPINLOCK_NO_CPU; + dbg->cpu =3D SPINLOCK_NO_CPU; } =20 void spin_debug_enable(void) diff --git a/xen/include/xen/spinlock.h b/xen/include/xen/spinlock.h index 0a02a527dc..d303c56f8a 100644 --- a/xen/include/xen/spinlock.h +++ b/xen/include/xen/spinlock.h @@ -22,9 +22,9 @@ union lock_debug { }; }; #define _LOCK_DEBUG { LOCK_DEBUG_INITVAL } -void check_lock(union lock_debug *debug, bool try); -void lock_enter(const union lock_debug *debug); -void lock_exit(const union lock_debug *debug); +void check_lock(union lock_debug *dbg, bool try); +void lock_enter(const union lock_debug *dbg); +void lock_exit(const union lock_debug *dbg); void spin_debug_enable(void); void spin_debug_disable(void); #else --=20 2.34.1