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

Re: [PATCH] x86/vmx: Provide named fields for IO exit qualification


  • To: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 21 Mar 2023 08:59:30 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.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=vQYifz2OlWKxooXUkRR8VTHS7EPBZTPD+DSl5TxfZl8=; b=nZghbGsaasHEZIxVT9CFPgRREuxv7UMCuSAStch0bUrD0SAZEdJiZXcSbU2t7ppy/1oYwJfULZbYqDdVaSXaXesixrX/K0gocQmAG82xf22px+VkYpAfhTiR81sHR44LlKdc20rXn5ibgX0jZoODytE2CR+DXPVAvislTTDJ6LBiIha8C1/GhDkiLSHW7MQ0Usyw8PN4gMNyEp0RY8Hs6rsvGOmx2dBMsl+VJy7RtEM7oKID3jQbRLpoZqhdHm005YKicaygPw9C616MvBCRgwqjniiKVzZKoGWnySBeK/7qzNHoiiSokNiMfSGg4dVUx1fympLb/0g3crgiXT3waw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JZBvULcIMhto7xLHrq+sRo/lV0f2S6xiEXPTBCW3sZTTMWzbQVfbTn5Si9ydGuMb3yVz4QNJx3qSGyX64vY88INQDa3L9YC/9G8A6WS1b7l9mYfxtlrlc2CfRlz2PFcIpjQh8ftKKy3Gc2wGOx0WQoWjU4EHdWyTLU23cf84NUapARlenHHJPFcPI58BxN/90N/gLGOlldSJ9lFPiWxIWUKw98kTe6IFnAYviDd+7DEkno3gly1wbiZQg0wcWEriLhADhD+EdZZS2dRJ19ok7GDVIx/IR7mlybcNARqGIoKB+Q6bX1ETgHXkFIBnUX4EaY8k7SuPq/s0bUfhGQ7F3A==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Kevin Tian <kevin.tian@xxxxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Tue, 21 Mar 2023 07:59:51 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 20.03.2023 19:20, Andrew Cooper wrote:
> This removes most of the opencoded bit logic on the exit qualification.
> Unfortunately, size is 1-based not 0-based, so need adjusting in a separate
> variable.
> 
> No functional change.
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>

In principle
Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
but ...

> --- a/xen/arch/x86/hvm/vmx/vmx.c
> +++ b/xen/arch/x86/hvm/vmx/vmx.c
> @@ -4560,23 +4560,37 @@ void vmx_vmexit_handler(struct cpu_user_regs *regs)
>          break;
>  
>      case EXIT_REASON_IO_INSTRUCTION:
> -        __vmread(EXIT_QUALIFICATION, &exit_qualification);
> -        if ( exit_qualification & 0x10 )
> +    {
> +        union {
> +            unsigned long raw;
> +            struct {
> +                uint32_t size:3;
> +                bool     in:1;
> +                bool     str:1;
> +                bool     rep:1;
> +                bool     imm:1;
> +                uint32_t :9;
> +                uint16_t port;

... I'm not sure this is sufficiently portable: Whether a bitfield of type
uint32_t followed by a non-bitfield is padded to fill the rest of the
containing 32-bit field is left unspecified by C99; this particular aspect
isn't even "implementation defined" (afaics). Therefore I think it would
be better if either uint32_t was replaced by uint16_t, or if port also was
made a bit field (and then perhaps also of type uint32_t, or unsigned int).

Jan



 


Rackspace

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