RE: [patch] Staging: hv: Fix vmbus load hang caused by wrong datapacking

From: Hank Janssen
Date: Fri Oct 16 2009 - 16:04:32 EST




Greg / Pecca,

>We don't merge fixes to the kernel unless we understand _why_ they fix
>things. It's pretty likely that the problem here is that one or more
>of the structs you are putting under "#pragma pack" just need to be
>annotated with "attribute packed".

We have figured out what the problem is with it.

It seems that the #pragma pack(push,1) doesn't change the size
of "enum vmbus_channel_message_type", the size remains as 4 bytes,
which is the default. I do not know if this is the result of
a gcc bug.

If you add __attribute__((packed)) here, the size becomes 1 byte,
which couldn't be accepted by HyperV host, and causes vmbus load
to hang.

So, the different behavior of #pragma pack(push,1) v.s.
__attribute__((packed)) on the data struct, "enum vmbus_channel_message_type",
caused this bug. The fix is to remove __attribute__((packed)) of this data.
We don't need to add #pragma pack(push,1) or #pragma pack(pop) here, since
it has no effect on this structure. (BTW, seems it's a bug of gcc's
handling of pragma pack().)

I will submit a patch later today that corrects the bug.

This patch in effect removes part of a previous patch somebody else
Submitted that introduced this problem.

This bug masked another problem we encountered as soon as we fixed this
Problem. I am getting a NULL pointer problem on insertion of the hv_vmbus
Driver. I will write a more detailed description of that problem and send
It to the list.

I checked the originally submitted code, and made that work with 2.6.32.
And that does run okay.

Thanks,

Hank.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/