Skip to content

Remove Trace Facility Requirement for Several Event Groups Functions #969

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

Closed
wants to merge 2 commits into from
Closed

Remove Trace Facility Requirement for Several Event Groups Functions #969

wants to merge 2 commits into from

Conversation

HTRamsey
Copy link
Contributor

Remove Trace Facility Requirement for Several Event Groups Functions

Description

There is no configUSE_TRACE_FACILITY requirement for these functions, and no mention in documentation of it only being used for debugging.

Test Steps

Checklist:

  • I have tested my changes. No regression in existing tests.
  • I have modified and/or added unit-tests to cover the code changes in this Pull Request.

Related Issue

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@HTRamsey HTRamsey requested a review from a team as a code owner January 30, 2024 20:33
@paulbartell
Copy link
Contributor

@HTRamsey thanks for the PR. I'll work on getting this reviewed and merged.

Copy link
Member

@AniruddhaKanhere AniruddhaKanhere left a comment

Choose a reason for hiding this comment

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

I am not sure I understand this change completely.

If we are removing the dependence of the function definitions and declarations from configUSE_TRACE_FACILITY then should we not use the #defined definitions instead of the ones which have tracing macro calls (i.e. traceENTER_xEventGroupClearBitsFromISR) in them?

Am I missing something? Can you please take a look at my question @HTRamsey?

Copy link

codecov bot commented Jan 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (c565fd4) 93.64% compared to head (4bab0fb) 93.64%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #969   +/-   ##
=======================================
  Coverage   93.64%   93.64%           
=======================================
  Files           6        6           
  Lines        3194     3194           
  Branches      885      885           
=======================================
  Hits         2991     2991           
  Misses         91       91           
  Partials      112      112           
Flag Coverage Δ
unittests 93.64% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

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

Copy link

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@HTRamsey
Copy link
Contributor Author

@AniruddhaKanhere I guess that's preference on if you still want to be able to use the traceENTER, traceEVENT, and traceEXIT macros for event groups separately from a generic call to xTimerPendFunctionCallFromISR. I kept it that way because there are other functions that could have been macros instead as well (i.e. vEventGroupClearBitsCallback & vEventGroupSetBitsCallback, which by the way I am not sure these are ever used anywhere).

@RichardBarry
Copy link
Contributor

Clearing event group bits form an ISR isn't done within the ISR itself because its not deterministic - the operation is instead deferred to the timer task so it occurs outside of the ISR context. If you are not tracing, then xEventGroupsClearBitsFromISR() calls the function in the timer task directly (https://github.com/FreeRTOS/FreeRTOS-Kernel/blob/main/include/event_groups.h#L443), but doing that when tracing obfuscates the reason for calling the timer task function. Hence, when tracing, xEventGroupsClearBitsFromISR() is a function in its own right. So the original code, before this PR, is the intentional behaviour. I recommend changing the PR to instead add a comment to the existing code explaining why it is so.

@HTRamsey
Copy link
Contributor Author

HTRamsey commented Jan 31, 2024

@RichardBarry from what I gathered from the rest of the code, the tracing macros (traceENTER, traceEVENT, traceEXIT, etc) are not dependent on configUSE_TRACE_FACILITY. If those macros are undefined by the user, then this functionally becomes a direct call to xTimerPendFunctionCallFromISR regardless of the value of configUSE_TRACE_FACILITY. There are a handful of other functions that are like this as well (xQueueCreateSet or xQueueSelectFromSetFromISR just for example). It seemed redundant to change the definition based on configUSE_TRACE_FACILITY, or at least inconsistent with other functions that contain a single operation as well.

Edit: Is the concern about the overhead of an extra function call on an unoptimized build? If so then I would suggest defining functions like xQueueSelectFromSetFromISR in a similar manner.

Also an unrelated question, is there a method or reason behind the inconsistencies of certain function declarations being guarded by config checks and others only having checks around the function definitions? Example being xStreamBufferGenericCreate doesn't have a configSUPPORT_DYNAMIC_ALLOCATION check on its declaration but does for its definition while xQueueGenericCreate does have a configSUPPORT_DYNAMIC_ALLOCATION around its definition and declaration. Also xTaskCreateRestricted doesn't check configSUPPORT_DYNAMIC_ALLOCATION but xTaskCreateRestrictedStatic does check configSUPPORT_STATIC_ALLOCATION at their definitions. I would think it would be fine (cleaner and easier) to always declare functions and just declare based on the config values, because a linker error would occur if attempting to call a function that should be disabled otherwise.

@HTRamsey HTRamsey closed this by deleting the head repository Feb 2, 2024
laroche pushed a commit to laroche/FreeRTOS-Kernel that referenced this pull request Apr 18, 2024
* Add IPv6 Demo (FreeRTOS#937)

* Add demo changes

* Update kernel and library paths

* Update main.c

* Run uncrustify

* Fix spell checker

* CI check file headers update

* Add IPv6/v4 UDP echo server with zero copy/non-zero copy versions

* Add VS proj file changes to include the UDP echo sample code

* readme update

---------

Co-authored-by: Tony Josi <tonyjosi@amazon.com>

* Update Backward Compatibility Flag (FreeRTOS#954)

* Update Backward Compatibility Flag

* Update FreeRTOS_GetUDPPayloadBuffer_ByIPType

* Update FreeRTOS_IPStart to FreeRTOS_IPInit_Multi

* Update Application APIs

* Remove ipconfigCOMPATIBLE_WITH_SINGLE

* Update Static Lib files (FreeRTOS#956)

* Update Static Lib files

* making vApplicationIPNetworkEventHook backward compatible in demos

* Update CI check file headers

---------

Co-authored-by: Tony Josi <tonyjosi@amazon.com>

* Add WinPCap NetworkInterface Changes (FreeRTOS#958)

* Update winpcap network interface

* Run uncrustify

* Update function to include NetworkInterface_t parameters

* Adding compatibility for xApplicationDNSQueryHook with latest dev branch for old demos (FreeRTOS#957)

* adding compatibility for xApplicationDNSQueryHook with latest dev branch

* adding tcp echo server source

* removing unused sub demos

* fix build issues (FreeRTOS#969)

* Update demo to latest +TCP dev/IPv6_integration (FreeRTOS#978)

* remove macro namings

* rename sin_addr to sin_address.ulIP_IPv4 for ipv6 demo

* replace in6addr_any with FreeRTOS_in6addr_any

* replace mainCREATE_UDP_ECHO_SERVER_TASK with mainCREATE_UDP_ECHO_TASKS_SINGLE

* handle removal of sin_addr macro to sin_address.ulIP_IPv4

* updating +TCP repo to latest dev/IPv6_integration

* minor update to more clear code

* more sin_addr to sin_address.ulIP_IPv4 replacements

* fix makefiles for qemu and posix demos

* review feedback changes

* Update FreeRTOS-Plus-TCP for RC2

* Change from PR (FreeRTOS#994)

* Update FreeRTOS-Plus-TCP for RC2

* Update copyright

* Ignore WinPCap for files header check failure.

* Update checker

* Update manifest

* Point manifest to latest commit

* Fix Spell-checker

* Update doxygen

* Update xApplicationDHCPHook for backward compatibility  (FreeRTOS#999)

* Update xApplicationDHCPHook for backward compatability

* Update IPv6

* Update VisualStudio Static Project files

* Update pxEndPoint error (FreeRTOS#1002)

* Update IPv6 demo ReadMe (FreeRTOS#1004)

* Update ReadMe

* Update setup requirement

* Update UDP demo info

* Update comment

* TCP demo changes post build separation (FreeRTOS#1011)

* adding sin_family to dest adddr for FreeRTOS_sendto

* updating FreeRTOS_bind to input sin_family post build separation changes

* updating FreeRTOS_connect to input sin_family post build separation changes

* minor fix

* updating copyright year

* updating file headers

* updating +TCP submodule

* updating file headers

* updating file headers

* updating manifest file to have latest +TCP submodule hash

* Fix issue with posix demo while running with ipconfigIPv4_BACKWARD_COMPATIBLE enabled for +TCP stack (FreeRTOS#1027)

* Update the submodule pointer to IPv6 main

* Update manifest with latest TCP commit

* Update file checker exception

* Ignore Visual studio project file from file header checker

---------

Co-authored-by: Tony Josi <tonyjosi@amazon.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.

4 participants