[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [XEN PATCH v3 2/6] x86/intel: move vmce_has_lmce() routine to header


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Sergiy Kibrik <sergiy_kibrik@xxxxxxxx>
  • Date: Mon, 20 May 2024 12:32:47 +0300
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=5Dobb6zopaOwVYR/Hww3nW/UPjZbNglrak70RDzBrCk=; b=L5iU1s8qHOOVcj8VnwroaFxvC9K1uxeVYxzgUgJ4TLrGyHntYaCO87rM64Ill9MENQWqdrVDqTHcGRjjhedLh0IgdILTA7nU4gODFYCSU2O2NeYuMKJwYc3qZy5PhSwZkP/pY4+Dl3sg+8K1iBMmwZgKuBtThQ+7hSTBH0HlOtSVjxGYjgu8p3thZhlEnDBKRAxmL2VuFf5ySsS94a3TiwwpgfbQroELw6k0u+WxQ+iOe8fI0QJsj9GKDYKzA0dEt21LkjcqX3EbZZ8LbBierXQ4Ulm5qeNFNfbioszmU7ETbKa2dYjmfg2JA8Ido3TWcLlep1HZjbB0HmEtUPv/Vg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Q0LC6vNfEKRauUm2Q08ZWTdsy9SwmSmy29i8A7bG8j7/6dohlpZym1E3rxKu9QUs0ZIrhZqDO2QNqjCWDHQY05XW+QNxQMJFcqk3jLMo5EkaDzGzcjsq6ek5KtHeiSVZLFgFXXUL5cc5Keu/nD4GqOptKztjMgbWZdqzIMHIr1N6p+bC6Wd/UFnJpbTE+EFiWPODFiS169wkAmwVHY+BN2lziXKU240J4KyRU6XGEI33UwGlAIaG+QCepho579NxGUOubEPoTuAsq0rYCKE72ZiFf7HQWP8/bHvVM/9Kj21g919Ie4yZeuM+IW565wNipmxCvXyA0Za1RH4jtCFTlg==
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Mon, 20 May 2024 09:33:14 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

16.05.24 12:39, Jan Beulich:
On 14.05.2024 10:20, Sergiy Kibrik wrote:
Moving this function out of mce_intel.c would make it possible to disable
build of Intel MCE code later on, because the function gets called from
common x86 code.

Why "would"? "Will" or "is going to" would seem more to the point to me.

yes, sure

But anyway.

--- a/xen/arch/x86/cpu/mcheck/mce.h
+++ b/xen/arch/x86/cpu/mcheck/mce.h
@@ -170,6 +170,11 @@ static inline int mce_bank_msr(const struct vcpu *v, 
uint32_t msr)
      return 0;
  }
+static inline bool vmce_has_lmce(const struct vcpu *v)
+{
+    return v->arch.vmce.mcg_cap & MCG_LMCE_P;
+}

Is there a particular reason this is placed here, rather than ...

--- a/xen/arch/x86/include/asm/mce.h
+++ b/xen/arch/x86/include/asm/mce.h
@@ -41,7 +41,6 @@ extern void vmce_init_vcpu(struct vcpu *v);
  extern int vmce_restore_vcpu(struct vcpu *v, const struct hvm_vmce_vcpu 
*ctxt);
  extern int vmce_wrmsr(uint32_t msr, uint64_t val);
  extern int vmce_rdmsr(uint32_t msr, uint64_t *val);
-extern bool vmce_has_lmce(const struct vcpu *v);
  extern int vmce_enable_mca_cap(struct domain *d, uint64_t cap);

... in the file the declaration was in, thus avoiding ...

--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -24,6 +24,8 @@
#include <public/hvm/params.h> +#include "cpu/mcheck/mce.h"

... the need for such a non-standard, cross-directory #include?



This is because MCG_LMCE_P is defined in arch/x86/cpu/mcheck/x86_mca.h -- so either MCG_LMCE_P (+ a bunch of MCG_* declarations) has to be moved to common header to be accessible, or local x86_mca.h got to be included from common arch/x86/include/asm/mce.h.

As for the MCG_* declarations movement I didn't think there's a good enough reason to do it; as for the inclusion of x86_mca.h it didn't look nice at all.

Are there any more options?

 -Sergiy



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.