Skip to contentSkip to conversation

bus/vmbus: remove unnecessary packed attribute

PATCH In review Stephen Hemminger 3 participants 5 messages Oct 22, 2024 – Oct 30, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bus/vmbus: remove unnecessary packed attribute

The VMBus ring structure was marked packed which will cause warnings if the no-address-of-packed is enabled. The structure is all 32 bit values and the packed attribute has no impact on the code layout; remove it.

---
 drivers/bus/vmbus/rte_vmbus_reg.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/bus/vmbus/rte_vmbus_reg.h +1 -1
index e3299aa871..c4f2fa4c7e 100644
@@ -108,7 +108,7 @@ struct vmbus_bufring {
 	 * !!! DO NOT place any fields below this !!!
 	 */
 	uint8_t data[];
-} __rte_packed;
+};
 
 /*
  * Channel packets
Signature · 1 line
2.45.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 34 lines

-----Original Message-----
From: Stephen Hemminger <[email protected]>
Sent: Tuesday, October 22, 2024 10:37 AM
To: [email protected]
Cc: Stephen Hemminger <[email protected]>; Long Li <[email protected]>; Wei Hu <[email protected]>
Subject: [PATCH] bus/vmbus: remove unnecessary packed attribute

The VMBus ring structure was marked packed which will cause warnings if the no-address-of-packed is enabled. The structure is all 32 bit values and the packed attribute has no impact on the code layout; remove it.

---
 drivers/bus/vmbus/rte_vmbus_reg.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/bus/vmbus/rte_vmbus_reg.h +1 -2
index e3299aa871..c4f2fa4c7e 100644
@@ -108,7 +108,7 @@ struct vmbus_bufring {
 	 * !!! DO NOT place any fields below this !!!
 	 */
 	uint8_t data[];
-} __rte_packed;
+};
 
 /*
  * Channel packets
--
Quoted 1 line

2.45.2

#2 lore raw
In reply to Stephen Hemminger
Quoted 7 lines · Stephen Hemminger

The VMBus ring structure was marked packed which will cause warnings if the no-address-of-packed is enabled. The structure is all 32 bit values and the packed attribute has no impact on the code layout; remove it.

- Why only clean this structure in this header?
I see many others which could get cleaned wrt __rte_packed.

(There are some unused structs too and it would be better not to keep unused code around).

- On a separate note, I wonder why the vmbus headers are exported as public headers.
All those seem to be for use only in drivers, for resources attached on such a bus.
Would an application benefit from talking directly to the hyperv?

Signature · 1 line
David Marchand
#3 lore raw
Quoted 8 lines · On Wed, 30 Oct 2024 10:26:38 +0100 David Marchand <[email protected]>…
Quoted 6 lines · Stephen Hemminger

The VMBus ring structure was marked packed which will cause warnings if the no-address-of-packed is enabled. The structure is all 32 bit values and the packed attribute has no impact on the code layout; remove it.

Quoted 4 lines
Quoted 1 line

- Why only clean this structure in this header?
I see many others which could get cleaned wrt __rte_packed.

Not sure, think these headers got inherited from the FreeBSD driver, and the FreeBSD driver got these from Windows. And Windows code always uses packed.

Quoted 3 lines

(There are some unused structs too and it would be better not to keep unused code around).

Yes, cleanup would be good.

Quoted 6 lines

- On a separate note, I wonder why the vmbus headers are exported as public headers.
All those seem to be for use only in drivers, for resources attached on such a bus.
Would an application benefit from talking directly to the hyperv?

Probably no need to export, Long can look into it.

#4 lore raw
In reply to David Marchand
Quoted 11 lines · On Wed, 30 Oct 2024 10:26:38 +0100 David Marchand <[email protected]>…
Quoted 7 lines · Stephen Hemminger

The VMBus ring structure was marked packed which will cause warnings if the no-address-of-packed is enabled. The structure is all 32 bit values and the packed attribute has no impact on the code layout; remove it.

- Why only clean this structure in this header?

The patch was addressing the warning generated when the address of packed member is re-enabled. The other usages are less of a problem and cause no errors.