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

Re: [XEN PATCH] x86/HVM: address violations of MISRA C:2012 Rules 8.2 and 8.3


  • To: Federico Serafini <federico.serafini@xxxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Wed, 19 Jul 2023 11:23:47 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.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=3MaJNIasv1HZ9E3S6bYdCo+z4s9eakKt7nL2n+FEAts=; b=QCiFzZwnf4e2L779/rLcH5rvKFMnRNQPN0+A7sZDHKCUAAmRZ2AFmn2+Ix6qCqUTQ+hEysYz8K4sFqJm9NRtIv2EEd9RtfVRfPKHuywG53MNvjZ8oHsTIVcJXMwX7dYb8jucNVTd9mPiLXMB7sxtJCAeKHcZ771Nnbr5tp5KC7ssIJTuNORwRTOu8hJM4DagmShF6SddSvfXPXbuK6lj7R05vlgn2j4Yh4qXIzseE1OPYjZ6/CEWgKzsrvGmNJJ/m8jj9mpJTV8o7ARLJoTlmBz1KDiUMcNfVTpra8/Jfuf6BXPV2aVlEhN0sBQDsf+w16XLCHR6t6tftsNvv7ai1g==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bSPo1oBFMs614CyfeLijD0mvGRX4gSjHT/5Qv+kPJRCLreSDnnGTUTCkncVkBcCJRdqaWBIztrnkV21qSdlz9aKF6+MQGT/axn1CpFGm2i1J7COUnE/i90yh4jV1jaOImFV0UM3nW5nfLbX0ig2I78xSX4KiuokrK8nka0CTtxuDqcljXzp7uydpAkG6Xx4xSPd3UqfVUZYzC3FxGL0u8CsMoR+EuoTR0QS6g8gKNuGp1mVoMSgLY36yyDHOIxiQBPFsUuGZ9uYEtLY5jyeMbdnk8M2jBMoFNQmtu21yZFPviZ/CmahKHQp/heOb3ptKwhakGwr+l9Xo9WJJ66J/dw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: consulting@xxxxxxxxxxx, Jan Beulich <jbeulich@xxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Xenia Ragiadakou <xenia.ragiadakou@xxxxxxx>, Ayan Kumar Halder <ayan.kumar.halder@xxxxxxx>
  • Delivery-date: Wed, 19 Jul 2023 10:24:18 +0000
  • Ironport-data: A9a23:Q1pDIa8/2JXYxps6+pi3DrUDx36TJUtcMsCJ2f8bNWPcYEJGY0x3m jNNXT/VaamJYWPxc9pwb4rk8EsGvJfQzYNhTwZv+ys8E34SpcT7XtnIdU2Y0wF+jCHgZBk+s 5hBMImowOQcFCK0SsKFa+C5xZVE/fjUAOG6UKicYXoZqTZMEE8JkQhkl/MynrlmiN24BxLlk d7pqojUNUTNNwRcawr40Ird7ks21BjOkGlA5AdmOqka5Aa2e0Q9V/rzG4ngdxMUfaEMdgKKb 76r5K20+Grf4yAsBruN+losWhRXKlJ6FVHmZkt+A8BOsDAbzsAB+v9T2M4nQVVWk120c+VZk 72hg3ASpTABZcUgkMxFO/VR/roX0aduoNcrKlDn2SCfItGvn9IBDJyCAWlvVbD09NqbDkkXx fs0JhQ9YSy/juaIxZ3gUe9HmPgseZyD0IM34hmMzBn/JNN/GNXvZvuP4tVVmjAtmspJAPDSI dIDbiZiZwjBZBsJPUoLDJU5n6GjgXyXnz9w8QrJ4/ZopTWMilUujNABM/KMEjCObexTkl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PVUQtYRdr8VPpZ1fSIZMB2yffvgChPgHb3cLtB0B1vd75rspLkl7uCjf5IFiJM0hZ TaSVtd8Wo/YVjnB8GC1IBCtkmlehTLYR39jsVFo5RpsLz1Q7TmdSWFVVA1isOl5/ESGNfSVf q/MI9fR/XjMWztE4BU2BCWYegnFVAOFMkO/torUVOHpczGboXsq+zAaf7WYKHgFD41M1mPck frnAKDVfmownrbJUMQ2iKhJk8FUnaPga5NLA==
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 19/07/2023 11:07 am, Federico Serafini wrote:
> diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
> index 57363c2ae1..8f19a79f6f 100644
> --- a/xen/arch/x86/hvm/hvm.c
> +++ b/xen/arch/x86/hvm/hvm.c
> @@ -319,7 +319,7 @@ static bool pat_valid(uint64_t val)
>      return !(any_gt_7 | any_2_or_3);
>  }
>  
> -int hvm_set_guest_pat(struct vcpu *v, uint64_t guest_pat)
> +int hvm_set_guest_pat(struct vcpu *v, u64 guest_pat)

If there's a u64 vs uint64_t mismatch (or others for that matter),
resolve in the way of the stdint types.  That way you're correcting in
the direction of the Xen coding style, rather than away from it.

> diff --git a/xen/arch/x86/hvm/svm/nestedhvm.h 
> b/xen/arch/x86/hvm/svm/nestedhvm.h
> index 43245e13de..eb9c416307 100644
> --- a/xen/arch/x86/hvm/svm/nestedhvm.h
> +++ b/xen/arch/x86/hvm/svm/nestedhvm.h
> @@ -42,7 +42,7 @@ int cf_check nsvm_vcpu_initialise(struct vcpu *v);
>  int cf_check nsvm_vcpu_reset(struct vcpu *v);
>  int nsvm_vcpu_vmrun(struct vcpu *v, struct cpu_user_regs *regs);
>  int cf_check nsvm_vcpu_vmexit_event(struct vcpu *v,
> -                                    const struct x86_event *event);
> +                                    const struct x86_event *trap);

This needs to stay as event.  Trap is a related technical term, and
incorrect to use here.  (Yes, the implementation of
nsvm_vcpu_vmexit_event() is wrong.)

> diff --git a/xen/arch/x86/include/asm/hvm/hvm.h 
> b/xen/arch/x86/include/asm/hvm/hvm.h
> index 3c37f522b9..7943e287cf 100644
> --- a/xen/arch/x86/include/asm/hvm/hvm.h
> +++ b/xen/arch/x86/include/asm/hvm/hvm.h
>      int (*msr_write_intercept)(unsigned int msr, uint64_t msr_content);
>      void (*handle_cd)(struct vcpu *v, unsigned long value);
>      void (*set_info_guest)(struct vcpu *v);
> -    void (*set_rdtsc_exiting)(struct vcpu *v, bool_t);
> -    void (*set_descriptor_access_exiting)(struct vcpu *v, bool);
> +    void (*set_rdtsc_exiting)(struct vcpu *v, bool_t enable);

In this case, we want to swap to bool as well as giving a name in the
prototype.

xen.git/xen$ git grep -w bool_t | wc -l
441

I'm seriously tempted just to do a bulk fix of bool_t to get it over and
done with...

~Andrew



 


Rackspace

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