From nobody Thu Dec 26 21:52: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; dkim=pass; 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; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1732021186; cv=none; d=zohomail.com; s=zohoarc; b=P23HypWfdOWdslDnJ69qIS7onsisSYdqzgGfHst68Pr1aX8+SLho62hD6PYJeFwXu67/NIIhKxK1KuRxaTOFNtdwFLWmlylLmdc3yXiVPF9/iwvg90beujnKeGWjbIWmXN2Y03ue+yEUX3vBRCcOxY2zjFuhQ3qJVst9AHyl8uE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1732021186; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=CxQenpaGaMzjrQymcJZ0umdG0FyNusdLvNQQSxeygiw=; b=EO3irUcbxchQgnaWsTDPt//ErmaYMYO2yUIl4fKv4Cy6lqonrXbp/aZjZxmKd2kFGE4kAnip/AVbJJxC0q7YgSRnmQaYW2/6T54Xg92gOgtChXZJFnRcuPvaHhPfRmklI+2OfJvc+g6LT2nVzIi3rSVPlYBq8kIu4OpMKEj/KqA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1732021186103365.3797152201529; Tue, 19 Nov 2024 04:59:46 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.840050.1255833 (Exim 4.92) (envelope-from ) id 1tDNp3-0007f7-KC; Tue, 19 Nov 2024 12:59:13 +0000 Received: by outflank-mailman (output) from mailman id 840050.1255833; Tue, 19 Nov 2024 12:59:13 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tDNp3-0007f0-HP; Tue, 19 Nov 2024 12:59:13 +0000 Received: by outflank-mailman (input) for mailman id 840050; Tue, 19 Nov 2024 12:59:12 +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 1tDNp2-0007eu-Oi for xen-devel@lists.xenproject.org; Tue, 19 Nov 2024 12:59:12 +0000 Received: from mail-ed1-x532.google.com (mail-ed1-x532.google.com [2a00:1450:4864:20::532]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 100ef3a0-a676-11ef-a0ca-8be0dac302b0; Tue, 19 Nov 2024 13:59:07 +0100 (CET) Received: by mail-ed1-x532.google.com with SMTP id 4fb4d7f45d1cf-5cef772621eso6989840a12.3 for ; Tue, 19 Nov 2024 04:59:07 -0800 (PST) Received: from andrewcoop.eng.citrite.net ([185.25.67.249]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5cfeada3353sm75194a12.78.2024.11.19.04.59.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Nov 2024 04:59:06 -0800 (PST) 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: 100ef3a0-a676-11ef-a0ca-8be0dac302b0 X-Custom-Connection: eyJyZW1vdGVpcCI6IjJhMDA6MTQ1MDo0ODY0OjIwOjo1MzIiLCJoZWxvIjoibWFpbC1lZDEteDUzMi5nb29nbGUuY29tIn0= X-Custom-Transaction: eyJpZCI6IjEwMGVmM2EwLWE2NzYtMTFlZi1hMGNhLThiZTBkYWMzMDJiMCIsInRzIjoxNzMyMDIxMTQ3Ljk3MzIyLCJzZW5kZXIiOiJhbmRyZXcuY29vcGVyQGNsb3VkLmNvbSIsInJlY2lwaWVudCI6Inhlbi1kZXZlbEBsaXN0cy54ZW5wcm9qZWN0Lm9yZyJ9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1732021147; x=1732625947; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=CxQenpaGaMzjrQymcJZ0umdG0FyNusdLvNQQSxeygiw=; b=lyUz5uUWdTkw4m2jQyAtFlVQM4yACuiZbTl5ZEcfi+VgzfzX3GUQA2SqulRGK4JHQT tDdy8ZnbRY3IkjHTuM8IZ5FI7UJePue4lo4LzViTuqoyH7+lTDaplBSK96z/N9DadKnt IdPNqfC4nl5s8QljF4P0hIsesqR2A9rQF4VZU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732021147; x=1732625947; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=CxQenpaGaMzjrQymcJZ0umdG0FyNusdLvNQQSxeygiw=; b=ZwPRt7Py2QaGPA3teZgc6GnsfpPk+a9Kqm1YDA56NALZKbdrydfclW8etDKOaCKxlN P/+Lca/C/f0qk5mP/5v75zcKd6J/5X3DR1U7CdyGGKxQth1W0/L5j/nA+1nUWo5Uk+wn rZRO70qpd1Yuw9ItPpZ28yykZKWhGiiLmwjKG9dud9TQB8K4AjoIAOAtBCpihtBdaMK9 TuQUlIXFzde1izIdzRkbPMU2+afveWP/xgRNyqbh7S+HB36EFbZRftj5zJi+UDbefHQ0 g+qZNvAJboL2WlMnAPlOfbNCqrsIxmY51H46GMg5tfaEaz2+l1lms6oswGN/rfzc8Xwn dZVg== X-Gm-Message-State: AOJu0YxVGRNfhzyozjq9livV0N7Iwc1JGEVN85l3aO66/kX7nnNm8iQy Hj7LjGrWd7wWpUnbC0Z99YsX8/6LKDVUjhE23DxF7pp4LijXpDG8O3YFau3gVVPxqoTYjmcKN5C G X-Google-Smtp-Source: AGHT+IHV4dsppsIcjpFTHAMZ1qHqMhEcLzq0BcxZ0lzSwUGlsJk4kaAb1f+38ufL8k6/6pqJ0e8law== X-Received: by 2002:a05:6402:234d:b0:5cf:ac34:380a with SMTP id 4fb4d7f45d1cf-5cfac34390amr6856047a12.29.1732021146955; Tue, 19 Nov 2024 04:59:06 -0800 (PST) From: Andrew Cooper To: Xen-devel Cc: Andrew Cooper , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Stefano Stabellini , "consulting @ bugseng . com" Subject: [PATCH] x86/mce: Compile do_mca() for CONFIG_PV only Date: Tue, 19 Nov 2024 12:59:04 +0000 Message-Id: <20241119125904.2681402-1-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.39.5 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1732021187504116600 Eclair reports a Misra Rule 8.4 violation; that do_mca() can't see it's declaration. It turns out that this is a consequence of do_mca() being PV-only, and the declaration being compiled out in !PV builds. Therefore, arrange for do_mca() to be compiled out in !PV builds. This in turn requires a number of static functions to become static inline. Signed-off-by: Andrew Cooper Acked-by: Jan Beulich Reviewed-by: Stefano Stabellini --- CC: Jan Beulich CC: Roger Pau Monn=C3=A9 CC: Stefano Stabellini CC: consulting@bugseng.com Bloat-o-meter on a !PV build reports: add/remove: 0/6 grow/shrink: 0/0 up/down: 0/-3717 (-3717) Function old new delta x86_mc_mceinject 31 - -31 do_mca.cold 117 - -117 x86_mc_msrinject 147 - -147 x86_mc_msrinject.cold 230 - -230 do_mc_get_cpu_info 500 - -500 do_mca 2692 - -2692 --- xen/arch/x86/cpu/mcheck/mce.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/xen/arch/x86/cpu/mcheck/mce.c b/xen/arch/x86/cpu/mcheck/mce.c index 32c1b2756b90..2a88590525f0 100644 --- a/xen/arch/x86/cpu/mcheck/mce.c +++ b/xen/arch/x86/cpu/mcheck/mce.c @@ -932,7 +932,7 @@ void x86_mcinfo_dump(struct mc_info *mi) } while ( 1 ); } =20 -static void cf_check do_mc_get_cpu_info(void *v) +static inline void cf_check do_mc_get_cpu_info(void *v) { int cpu =3D smp_processor_id(); int cindex, cpn; @@ -1114,7 +1114,7 @@ bool intpose_inval(unsigned int cpu_nr, uint64_t msr) (r) <=3D MSR_IA32_MCx_MISC(per_cpu(nr_mce_banks, cpu) - 1) && \ ((r) - MSR_IA32_MC0_CTL) % 4) /* excludes MCi_CTL */ =20 -static bool x86_mc_msrinject_verify(struct xen_mc_msrinject *mci) +static inline bool x86_mc_msrinject_verify(struct xen_mc_msrinject *mci) { const struct cpuinfo_x86 *c =3D &cpu_data[mci->mcinj_cpunr]; int i, errs =3D 0; @@ -1192,7 +1192,7 @@ static bool x86_mc_msrinject_verify(struct xen_mc_msr= inject *mci) return !errs; } =20 -static uint64_t x86_mc_hwcr_wren(void) +static inline uint64_t x86_mc_hwcr_wren(void) { uint64_t old; =20 @@ -1207,13 +1207,13 @@ static uint64_t x86_mc_hwcr_wren(void) return old; } =20 -static void x86_mc_hwcr_wren_restore(uint64_t hwcr) +static inline void x86_mc_hwcr_wren_restore(uint64_t hwcr) { if ( !(hwcr & K8_HWCR_MCi_STATUS_WREN) ) wrmsrl(MSR_K8_HWCR, hwcr); } =20 -static void cf_check x86_mc_msrinject(void *data) +static inline void cf_check x86_mc_msrinject(void *data) { struct xen_mc_msrinject *mci =3D data; struct mcinfo_msr *msr; @@ -1244,13 +1244,14 @@ static void cf_check x86_mc_msrinject(void *data) x86_mc_hwcr_wren_restore(hwcr); } =20 -/*ARGSUSED*/ -static void cf_check x86_mc_mceinject(void *data) +static inline void cf_check x86_mc_mceinject(void *data) { printk("Simulating #MC on cpu %d\n", smp_processor_id()); __asm__ __volatile__("int $0x12"); } =20 +#ifdef CONFIG_PV /* do_mca() hypercall is PV-only */ + #if BITS_PER_LONG =3D=3D 64 =20 #define ID2COOKIE(id) ((mctelem_cookie_t)(id)) @@ -1654,6 +1655,8 @@ long do_mca(XEN_GUEST_HANDLE_PARAM(xen_mc_t) u_xen_mc) return ret; } =20 +#endif /* CONFIG_PV */ + static int mcinfo_dumped; =20 static int cf_check x86_mcinfo_dump_panic(mctelem_cookie_t mctc) base-commit: 3128d7248f2ad389b8e9a3e252958cbfbd1898ee prerequisite-patch-id: 46b8fc2e9df2fd6be1bbbd6b50463e0e15a8f94d prerequisite-patch-id: c122b170f57ab96fe52c37aebf1f4bb366194637 prerequisite-patch-id: 1c2d96bf17c5da0981b6c62939d3b7cc1e05933e prerequisite-patch-id: b3e43902729416e18b4fada7f529b4cb02b1815e prerequisite-patch-id: a06452180f71021893259bb3b883185f57742a31 --=20 2.39.5