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

Use small lock to protect usbdev and endpoint in arch ARM. #15506

Merged
merged 1 commit into from
Jan 20, 2025

Conversation

wangzhi-art
Copy link
Contributor

Note: Please adhere to Contributing Guidelines.

Summary

Use small lock to protect usbdev and endpoint in arch ARM.

Impact

arch/arm/src/cxd56xx/cxd56_usbdev.c
arch/arm/src/dm320/dm320_usbdev.c
arch/arm/src/efm32/efm32_usbdev.c
arch/arm/src/imxrt/imxrt_usbdev.c
arch/arm/src/kinetis/kinetis_usbdev.c
arch/arm/src/lpc17xx_40xx/lpc17_40_usbdev.c
arch/arm/src/lpc214x/lpc214x_usbdev.c
arch/arm/src/lpc31xx/lpc31_usbdev.c
arch/arm/src/rp2040/rp2040_usbdev.c
arch/arm/src/rp23xx/rp23xx_usbdev.c
arch/arm/src/samv7/sam_usbdevhs.c
arch/arm/src/stm32/stm32_usbdev.c
arch/arm/src/stm32f0l0g0/stm32_usbdev.c
arch/arm/src/stm32l4/stm32l4_usbdev.c
include/nuttx/usb/usbdev.h

Testing

CI

@github-actions github-actions bot added Arch: arm Issues related to ARM (32-bit) architecture Area: USB Size: L The size of the change in this PR is large labels Jan 13, 2025
@nuttxpr
Copy link

nuttxpr commented Jan 13, 2025

[Experimental Bot, please feedback here]

This PR appears to mostly meet the NuttX requirements, but is lacking some crucial information. Here's a breakdown:

Strengths:

  • Clear Summary of Changes: The summary clearly states the what and how of the change. Using a small lock to protect shared resources is a good practice.
  • Specific File List: Listing the impacted files is extremely helpful for reviewers.
  • Mentions CI: Indicating that Continuous Integration (CI) testing will be performed is good.

Weaknesses:

  • Missing "Why": The summary lacks the crucial why. Why is this lock necessary? Is there a bug being fixed? Is this a performance optimization? A race condition being prevented? This is the most important part of the summary. Reference a specific NuttX issue number if one exists.
  • Impact Section Incomplete: While the file list gives a technical impact, the Impact section is missing the user impact descriptions. The PR author assumes NO impact across the board, which is unlikely. Even internal changes can have indirect effects. Think carefully about each point. For example:
    • Impact on Build: Will adding locks increase code size? Will it change any build dependencies?
    • Impact on Hardware: Will the use of locks affect real-time performance on any particular architectures?
    • Impact on Security: Does this change mitigate any potential vulnerabilities related to concurrent access to USB resources? If so, be explicit.
  • Testing Section Severely Lacking: Just saying "CI" isn't sufficient. While CI is important, local testing is crucial. The PR needs to demonstrate that the change actually works and fixes the intended problem (which is currently undefined). Provide specific test cases and their before and after logs. What platforms did you test on? Be explicit (e.g., "Build Host: Linux, x86_64, GCC 11.2. Target: STM32F4 Discovery board"). If it's a bug fix, show how the bug manifested before and how it's resolved after. If a performance improvement, provide benchmarks.

Recommendations for Improvement:

  1. Explain the "Why": Provide a concise explanation of the problem this PR solves. Is it a bug fix? Performance improvement? Preemptive fix for a potential issue? Link to a NuttX issue if one exists.
  2. Complete the Impact Section: Address each point, even if the answer is "NO." If "NO," briefly justify why there's no impact. If "YES," provide specific details.
  3. Provide Detailed Testing Information: Include specific test cases, platforms tested (host and target), and before and after logs demonstrating the effect of the change. Don't just rely on CI.

By addressing these weaknesses, the PR will be much stronger and easier for reviewers to evaluate. A good PR saves everyone time and leads to a higher quality codebase.

@wangzhi-art wangzhi-art force-pushed the lock_4 branch 3 times, most recently from f47a60b to 9a6dac6 Compare January 13, 2025 09:14
arch/arm/src/dm320/dm320_usbdev.c Outdated Show resolved Hide resolved
@github-actions github-actions bot added Size: XL The size of the change in this PR is very large. Consider breaking down the PR into smaller pieces. and removed Area: USB Size: L The size of the change in this PR is large labels Jan 14, 2025
@wangzhi-art wangzhi-art force-pushed the lock_4 branch 3 times, most recently from 39c411d to 067d117 Compare January 15, 2025 01:32
@github-actions github-actions bot added Size: XS The size of the change in this PR is very small and removed Size: XL The size of the change in this PR is very large. Consider breaking down the PR into smaller pieces. labels Jan 15, 2025
@wangzhi-art wangzhi-art reopened this Jan 15, 2025
@github-actions github-actions bot added Size: XL The size of the change in this PR is very large. Consider breaking down the PR into smaller pieces. and removed Size: XS The size of the change in this PR is very small labels Jan 15, 2025
arch/arm/src/lpc214x/lpc214x_usbdev.c Outdated Show resolved Hide resolved
arch/arm/src/samv7/sam_usbdevhs.c Show resolved Hide resolved
@wangzhi-art wangzhi-art force-pushed the lock_4 branch 2 times, most recently from 01000e6 to e23d432 Compare January 15, 2025 08:55
arch/arm/src/stm32l4/stm32l4_usbdev.c Outdated Show resolved Hide resolved
@wangzhi-art wangzhi-art force-pushed the lock_4 branch 2 times, most recently from ae510e5 to 497d301 Compare January 15, 2025 10:09
@wangzhi-art wangzhi-art force-pushed the lock_4 branch 4 times, most recently from 0864a12 to ad991ae Compare January 16, 2025 06:52
arch/arm/src/imxrt/imxrt_usbdev.c Outdated Show resolved Hide resolved
arch/arm/src/samv7/sam_usbdevhs.c Outdated Show resolved Hide resolved
arch/arm/src/stm32/stm32_usbdev.c Outdated Show resolved Hide resolved
arch/arm/src/stm32f0l0g0/stm32_usbdev.c Outdated Show resolved Hide resolved
@xiaoxiang781216 xiaoxiang781216 merged commit e177ff9 into apache:master Jan 20, 2025
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Arch: arm Issues related to ARM (32-bit) architecture Size: XL The size of the change in this PR is very large. Consider breaking down the PR into smaller pieces.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants