Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add memory alignment for ARM32 #4208

Merged
merged 1 commit into from
Apr 15, 2024
Merged

add memory alignment for ARM32 #4208

merged 1 commit into from
Apr 15, 2024

Conversation

ami-GS
Copy link
Contributor

@ami-GS ami-GS commented Mar 20, 2024

Description

Fixes #3958
Support arm32 memory alignment

The fix was for an alignment problem -> arm is sensitive in places where x64 is not.

Testing

Tested and passed on raspberry pi.
It had been failed at processing 3rd or 4th packets consistently (during handshake). now it has gone with the fix.

Documentation

Is there any documentation impact for this change?

@ami-GS ami-GS requested a review from a team as a code owner March 20, 2024 23:31
@@ -76,7 +76,7 @@ typedef struct DATAPATH_RX_IO_BLOCK {

} DATAPATH_RX_IO_BLOCK;

typedef struct DATAPATH_RX_PACKET {
typedef struct __attribute__((aligned(16))) DATAPATH_RX_PACKET {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add more info in your PR description as to why this helps and is necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not 100% sure yet, so trying to run automation first

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure yet? 😄

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did play with this little bit more and it is also sufficient (as far as I can tell) to increase RecvBlockStride

Datapath->RecvBlockStride =
sizeof(DATAPATH_RX_PACKET) + ClientRecvDataLength;

I originally added +4 but it also works for me with +1 or +2. I sort of expected corrupted pointer if something overrides the location.

It seems like we are casting bunch of packets to single big buffer, right @nibanks? Are we positive the structures always land on aligned boundary? It seems like the issue is triggered only when we pack multiple packets into single buffer. In the test we look at with @ami-GS, there is single packet and then we have few together. As @ami-GS noticed it was always crashing on processing third one, e.g. first that is packed second in the buffer.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ami-GS can we shoot to get this merged this week? Please address my comment above, and associate this PR with the bug that's tracking the issue.

Copy link

codecov bot commented Mar 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 85.27%. Comparing base (7bf265f) to head (591cf19).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4208      +/-   ##
==========================================
+ Coverage   84.22%   85.27%   +1.04%     
==========================================
  Files          56       56              
  Lines       15358    15358              
==========================================
+ Hits        12935    13096     +161     
+ Misses       2423     2262     -161     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ami-GS ami-GS enabled auto-merge (squash) April 15, 2024 21:29
@ami-GS ami-GS merged commit 75d8ae4 into main Apr 15, 2024
349 of 351 checks passed
@ami-GS ami-GS deleted the dev/daiki/arm32_fix branch April 15, 2024 21:53
liveans pushed a commit to liveans/msquic that referenced this pull request Jul 16, 2024
nibanks pushed a commit that referenced this pull request Jul 16, 2024
Co-authored-by: Daiki AMINAKA <1991.daiki@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

msquic crashing on ARM32 machines
3 participants