[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e43633f6-c303-439d-8dbe-730a5762753c@linux.microsoft.com>
Date: Mon, 6 Jan 2025 12:24:32 -0800
From: Roman Kisel <romank@...ux.microsoft.com>
To: Michael Kelley <mhklinux@...look.com>, "hpa@...or.com" <hpa@...or.com>,
"kys@...rosoft.com" <kys@...rosoft.com>, "bp@...en8.de" <bp@...en8.de>,
"dave.hansen@...ux.intel.com" <dave.hansen@...ux.intel.com>,
"decui@...rosoft.com" <decui@...rosoft.com>,
"eahariha@...ux.microsoft.com" <eahariha@...ux.microsoft.com>,
"haiyangz@...rosoft.com" <haiyangz@...rosoft.com>,
"mingo@...hat.com" <mingo@...hat.com>,
"nunodasneves@...ux.microsoft.com" <nunodasneves@...ux.microsoft.com>,
"tglx@...utronix.de" <tglx@...utronix.de>,
"tiala@...rosoft.com" <tiala@...rosoft.com>,
"wei.liu@...nel.org" <wei.liu@...nel.org>,
"linux-hyperv@...r.kernel.org" <linux-hyperv@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"x86@...nel.org" <x86@...nel.org>
Cc: "apais@...rosoft.com" <apais@...rosoft.com>,
"benhill@...rosoft.com" <benhill@...rosoft.com>,
"ssengar@...rosoft.com" <ssengar@...rosoft.com>,
"sunilmut@...rosoft.com" <sunilmut@...rosoft.com>,
"vdso@...bites.dev" <vdso@...bites.dev>
Subject: Re: [PATCH v5 1/5] hyperv: Define struct hv_output_get_vp_registers
On 1/6/2025 9:37 AM, Michael Kelley wrote:
> From: Roman Kisel <romank@...ux.microsoft.com> Sent: Monday, December 30, 2024 10:10 AM
[...]
>
> These bit field definitions don't look right. We want to "fill up"
> the field size, so that we're explicit about each bit, and not leave
> it to the compiler to add padding (which __packed tells the
> compiler not to do). So in aggregate, the "u64" bit fields should
> account for all 64 bits, but here you account for only 32 bits.
> There are two ways to fix this:
>
> u32 interruption_pending : 1;
> u32 interruption_type: 1;
> u32 reserved : 30;
> u32 error_code;
> Or
> u64 interruption_pending : 1;
> u64 interruption_type: 1;
> u64 reserved : 30;
> u64 error_code : 32;
>
>
> Nuno -- your thoughts?
Quite a blunder on my side! Thank you very much for your help :)
GDB is my witness:
(gdb) ptype /o union hv_arm64_pending_synthetic_exception_event
/* offset | size */ type = union
hv_arm64_pending_synthetic_exception_event {
/* 16 */ u64 as_uint64[2];
/* 13 */ struct {
/* 0: 0 | 4 */ u32 event_pending : 1;
/* 0: 1 | 4 */ u32 event_type : 3;
/* 0: 4 | 4 */ u32 reserved : 4;
/* 1 | 4 */ u32 exception_type;
/* 5 | 8 */ u64 context;
/* total size (bytes): 13 */
};
/* total size (bytes): 16 */
}
which looks messed up to me to put it mildly. Will fix next time.
[...]
>
> Michael
>
>> +
>> +/*
>> + * NOTE: Linux helper struct - NOT from Hyper-V code.
>> + * DECLARE_FLEX_ARRAY() needs to be wrapped into
>> + * a structure and have at least one more member besides
>> + * DECLARE_FLEX_ARRAY.
>> + */
>> +struct hv_output_get_vp_registers {
>> + struct {
>> + DECLARE_FLEX_ARRAY(union hv_register_value, values);
>> + struct {} values_end;
>> + };
>> };
>>
>> #if defined(CONFIG_ARM64)
>> --
>> 2.34.1
--
Thank you,
Roman
Powered by blists - more mailing lists