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

[xen staging-4.18] x86/domctl: fix maximum number of MSRs in XEN_DOMCTL_{get,set}_vcpu_msrs



commit 2f5fc982f5e7193e5e22baeaa23df3a2f4b1e399
Author:     Roger Pau Monné <roger.pau@xxxxxxxxxx>
AuthorDate: Tue Oct 29 16:40:58 2024 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Tue Oct 29 16:40:58 2024 +0100

    x86/domctl: fix maximum number of MSRs in XEN_DOMCTL_{get,set}_vcpu_msrs
    
    Since the addition of the MSR_AMD64_DR{1-4}_ADDRESS_MASK MSRs to the
    msrs_to_send array, the calculations for the maximum number of MSRs that
    the hypercall can handle is off by 4.
    
    Remove the addition of 4 to the maximum number of MSRs that
    XEN_DOMCTL_{set,get}_vcpu_msrs supports, as those are already part of the
    array.
    
    A further adjustment could be to subtract 4 from the maximum size if the 
DBEXT
    CPUID feature is not exposed to the guest, but guest_{rd,wr}msr() will 
already
    perform that check when fetching or loading the MSRs.  The maximum array is
    used to indicate the caller of the buffer it needs to allocate in the get 
case,
    and as an early input sanitation in the set case, using a buffer size 
slightly
    lager than required is not an issue.
    
    Fixes: 86d47adcd3c4 ('x86/msr: Handle MSR_AMD64_DR{0-3}_ADDRESS_MASK in the 
new MSR infrastructure')
    Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
    Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
    master commit: c95cd5f9c5a8c1c6ab1b0b366d829fa8561958fd
    master date: 2024-10-08 14:37:53 +0200
---
 xen/arch/x86/domctl.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/xen/arch/x86/domctl.c b/xen/arch/x86/domctl.c
index 1a8b4cff48..9bb90a83cf 100644
--- a/xen/arch/x86/domctl.c
+++ b/xen/arch/x86/domctl.c
@@ -1110,10 +1110,6 @@ long arch_do_domctl(
              !is_pv_domain(d) )
             break;
 
-        /* Count maximum number of optional msrs. */
-        if ( boot_cpu_has(X86_FEATURE_DBEXT) )
-            nr_msrs += 4;
-
         if ( domctl->cmd == XEN_DOMCTL_get_vcpu_msrs )
         {
             ret = 0; copyback = true;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18



 


Rackspace

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