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

Unlock globals during create/delete ops #703

Closed
jphickey opened this issue Dec 22, 2020 · 1 comment · Fixed by #704 or #750
Closed

Unlock globals during create/delete ops #703

jphickey opened this issue Dec 22, 2020 · 1 comment · Fixed by #704 or #750
Assignees
Milestone

Comments

@jphickey
Copy link
Contributor

Is your feature request related to a problem? Please describe.
For a number of resource create/delete operations, they may take some non-deterministic amount of time to execute in the system, and may require obtaining some type of mutex in the underlying C library too (e.g. if something invokes malloc). This is especially true of creating and deleting tasks, which may need to malloc() memory for the stack, and need to create a new task resource in the kernel.

Because of this, OSAL should not hold its own global table mutex while the whole operation takes place, as this will also prevent other unrelated ops from completing.

Describe the solution you'd like
These operations should reserve an entry in the table but mark it as reserved, not with a normal ID (so distinct from a normal entry). It can then unlock the global table and complete the non-deterministic parts of the operation, then re-lock when complete.

Additional context
This is required for #642, already have it implemented but felt it was worth splitting into a separate issue/commit for tracking purposes.

Requester Info
Joseph Hickey, Vantage Systems, Inc.

@jphickey jphickey self-assigned this Dec 22, 2020
@jphickey
Copy link
Contributor Author

This becomes important/relevant for #642 because OS_TaskDelete will need to block the caller until the task actually exits, and OSAL should always avoid blocking while holding the mutex.

jphickey added a commit to jphickey/osal that referenced this issue Dec 22, 2020
Change the EXCLUSIVE lock type such that it sets the ID in the global
table to RESERVED and unlocks the global before returning to the caller.

This allows the potentially long-running operation to complete and
not block other operations from happening in other tasks.

Use the EXCLUSIVE lock for all create/delete ops as well as for
bind and connect socket ops.

Also implement a new "RESERVED" lock to handle a special case in the
vxworks timebase implementation where the impl layer needs to acquire
a token for an object as it is being created.  This case is special
because it needs to happen during OS_TimeBaseCreate, and cannot be
completed after the fact like normal tasks, because it is a factor
in determining the success/fail status of the overall operation.
jphickey added a commit to jphickey/osal that referenced this issue Dec 22, 2020
Update unit tests for idmap functions, add test cases where coverage
was incomplete.  All OS_ObjectId* function coverage is back at 100%.
@skliper skliper added this to the 6.0.0 milestone Sep 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants