From nobody Mon Sep 16 19:35:27 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 1719398932707171.75710025066303; Wed, 26 Jun 2024 03:48:52 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.748739.1156555 (Exim 4.92) (envelope-from ) id 1sMQCc-0005k7-Pj; Wed, 26 Jun 2024 10:48:38 +0000 Received: by outflank-mailman (output) from mailman id 748739.1156555; Wed, 26 Jun 2024 10:48:38 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sMQCc-0005k0-N4; Wed, 26 Jun 2024 10:48:38 +0000 Received: by outflank-mailman (input) for mailman id 748739; Wed, 26 Jun 2024 10:48:36 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sMQCa-0005jc-Ow for xen-devel@lists.xenproject.org; Wed, 26 Jun 2024 10:48:36 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id a3722aee-33a9-11ef-90a3-e314d9c70b13; Wed, 26 Jun 2024 12:48:35 +0200 (CEST) Received: from nico.bugseng.com (unknown [46.228.253.214]) by support.bugseng.com (Postfix) with ESMTPSA id 2E3584EE0738; Wed, 26 Jun 2024 12:48:34 +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: a3722aee-33a9-11ef-90a3-e314d9c70b13 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, Alessandro Zucchelli , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Nicola Vetrini Subject: [XEN PATCH v2] x86/mctelem: address violations of MISRA C: 2012 Rule 5.3 Date: Wed, 26 Jun 2024 12:48:31 +0200 Message-Id: <94752f77597b05ef9b8a387bf29512b11c0d1e15.1719398571.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: 1719398933957100001 Content-Type: text/plain; charset="utf-8" From: Alessandro Zucchelli This addresses violations of MISRA C:2012 Rule 5.3 which states as following: An identifier declared in an inner scope shall not hide an identifier declared in an outer scope. In this case the gloabl variable being shadowed is the global static struct mctctl in this file, therefore the local variables are renamed to avoid thi= s. No functional change. Signed-off-by: Alessandro Zucchelli Signed-off-by: Nicola Vetrini Acked-by: Jan Beulich Reviewed-by: Stefano Stabellini --- Changes in v2: - s/mctctl_cpu/ctl/ and amended file comment and commit message --- xen/arch/x86/cpu/mcheck/mctelem.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/xen/arch/x86/cpu/mcheck/mctelem.c b/xen/arch/x86/cpu/mcheck/mc= telem.c index b8d0368a7d37..123e4102adca 100644 --- a/xen/arch/x86/cpu/mcheck/mctelem.c +++ b/xen/arch/x86/cpu/mcheck/mctelem.c @@ -168,28 +168,28 @@ static void mctelem_xchg_head(struct mctelem_ent **he= adp, void mctelem_defer(mctelem_cookie_t cookie, bool lmce) { struct mctelem_ent *tep =3D COOKIE2MCTE(cookie); - struct mc_telem_cpu_ctl *mctctl =3D &this_cpu(mctctl); + struct mc_telem_cpu_ctl *ctl =3D &this_cpu(mctctl); =20 - ASSERT(mctctl->pending =3D=3D NULL || mctctl->lmce_pending =3D=3D NULL); + ASSERT(ctl->pending =3D=3D NULL || ctl->lmce_pending =3D=3D NULL); =20 - if (mctctl->pending) - mctelem_xchg_head(&mctctl->pending, &tep->mcte_next, tep); + if (ctl->pending) + mctelem_xchg_head(&ctl->pending, &tep->mcte_next, tep); else if (lmce) - mctelem_xchg_head(&mctctl->lmce_pending, &tep->mcte_next, tep); + mctelem_xchg_head(&ctl->lmce_pending, &tep->mcte_next, tep); else { /* * LMCE is supported on Skylake-server and later CPUs, on * which mce_broadcast is always true. Therefore, non-empty - * mctctl->lmce_pending in this branch implies a broadcasting + * ctl->lmce_pending in this branch implies a broadcasting * MC# is being handled, every CPU is in the exception - * context, and no one is consuming mctctl->pending at this + * context, and no one is consuming ctl->pending at this * moment. As a result, the following two exchanges together * can be treated as atomic. */ - if (mctctl->lmce_pending) - mctelem_xchg_head(&mctctl->lmce_pending, - &mctctl->pending, NULL); - mctelem_xchg_head(&mctctl->pending, &tep->mcte_next, tep); + if (ctl->lmce_pending) + mctelem_xchg_head(&ctl->lmce_pending, + &ctl->pending, NULL); + mctelem_xchg_head(&ctl->pending, &tep->mcte_next, tep); } } =20 @@ -213,7 +213,7 @@ void mctelem_process_deferred(unsigned int cpu, { struct mctelem_ent *tep; struct mctelem_ent *head, *prev; - struct mc_telem_cpu_ctl *mctctl =3D &per_cpu(mctctl, cpu); + struct mc_telem_cpu_ctl *ctl =3D &per_cpu(mctctl, cpu); int ret; =20 /* @@ -232,7 +232,7 @@ void mctelem_process_deferred(unsigned int cpu, * Any MC# occurring after the following atomic exchange will be * handled by another round of MCE softirq. */ - mctelem_xchg_head(lmce ? &mctctl->lmce_pending : &mctctl->pending, + mctelem_xchg_head(lmce ? &ctl->lmce_pending : &ctl->pending, &this_cpu(mctctl.processing), NULL); =20 head =3D this_cpu(mctctl.processing); --=20 2.34.1