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

DAOS-15961 cart: Reorganize how envs are handled #14504

Merged
merged 14 commits into from
Jun 11, 2024
Merged

Conversation

frostedcmos
Copy link
Contributor

Change to how cart deals with envariables:

  • env list is now controlled by CRT_ENV_LIST macro in crt_types_internal.h
  • all envs stored in structure generated from CRT_ENV_LST (g_env) now, ENV is read out at crt_env_init() time and env strings deallocated at crt_env_fini().
  • accsor functions/macros crt_env_init/fini/get/dump are provided.
  • string-type envs no longer need to be freed after retrieval.

With this change, any env to be used will need to appear on the list first, ensuring it gets dumped as well as ensuring proper name usage later. Env name typos when using crt_env_get() will now result in compile time errors

Required-githooks: true

Before requesting gatekeeper:

  • Two review approvals and any prior change requests have been resolved.
  • Testing is complete and all tests passed or there is a reason documented in the PR why it should be force landed and forced-landing tag is set.
  • Features: (or Test-tag*) commit pragma was used or there is a reason documented that there are no appropriate tags for this PR.
  • Commit messages follows the guidelines outlined here.
  • Any tests skipped by the ticket being addressed have been run and passed in the PR.

Gatekeeper:

  • You are the appropriate gatekeeper to be landing the patch.
  • The PR has 2 reviews by people familiar with the code, including appropriate owners.
  • Githooks were used. If not, request that user install them and check copyright dates.
  • Checkpatch issues are resolved. Pay particular attention to ones that will show up on future PRs.
  • All builds have passed. Check non-required builds for any new compiler warnings.
  • Sufficient testing is done. Check feature pragmas and test tags and that tests skipped for the ticket are run and now pass with the changes.
  • If applicable, the PR has addressed any potential version compatibility issues.
  • Check the target branch. If it is master branch, should the PR go to a feature branch? If it is a release branch, does it have merge approval in the JIRA ticket.
  • Extra checks if forced landing is requested
    • Review comments are sufficiently resolved, particularly by prior reviewers that requested changes.
    • No new NLT or valgrind warnings. Check the classic view.
    • Quick-build or Quick-functional is not used.
  • Fix the commit message upon landing. Check the standard here. Edit it to create a single commit. If necessary, ask submitter for a new summary.

Change to how cart deals with envariables:
- env list is now controlled by CRT_ENV_LIST macro in crt_types_internal.h
- all envs stored in structure generated from CRT_ENV_LST (g_env) now,
  ENV is read out at crt_env_init() time and env strings deallocated at crt_env_fini().
- accsor functions/macros crt_env_init/fini/get/dump are provided.
- string-type envs no longer need to be freed after retrieval.

With this change, any env to be used will need to appear on the list first, ensuring it gets
dumped as well as ensuring proper name usage later. Env name typos when using crt_env_get()
will now result in compile time errors

Required-githooks: true

Signed-off-by: Alexander A Oganezov <[email protected]>
Required-githooks: true

Signed-off-by: Alexander A Oganezov <[email protected]>
Copy link

github-actions bot commented Jun 4, 2024

Ticket title is 'Reorganize how cart handles envariables'
Status is 'In Review'
https://daosio.atlassian.net/browse/DAOS-15961

@daosbuild1
Copy link
Collaborator

Test stage Build on Leap 15.5 with Intel-C and TARGET_PREFIX completed with status FAILURE. https://build.hpdd.intel.com//job/daos-stack/job/daos/view/change-requests/job/PR-14504/2/execution/node/384/log

@daosbuild1
Copy link
Collaborator

Test stage Build RPM on EL 9 completed with status FAILURE. https://build.hpdd.intel.com//job/daos-stack/job/daos/view/change-requests/job/PR-14504/2/execution/node/315/log

@daosbuild1
Copy link
Collaborator

Test stage Build RPM on Leap 15.5 completed with status FAILURE. https://build.hpdd.intel.com//job/daos-stack/job/daos/view/change-requests/job/PR-14504/2/execution/node/308/log

@daosbuild1
Copy link
Collaborator

Test stage Build RPM on EL 8 completed with status FAILURE. https://build.hpdd.intel.com//job/daos-stack/job/daos/view/change-requests/job/PR-14504/2/execution/node/318/log

@daosbuild1
Copy link
Collaborator

Test stage Build DEB on Ubuntu 20.04 completed with status FAILURE. https://build.hpdd.intel.com//job/daos-stack/job/daos/view/change-requests/job/PR-14504/2/execution/node/358/log

Required-githooks: true

Signed-off-by: Alexander A Oganezov <[email protected]>
@daosbuild1
Copy link
Collaborator

Test stage NLT on EL 8.8 completed with status UNSTABLE. https://build.hpdd.intel.com/job/daos-stack/job/daos//view/change-requests/job/PR-14504/3/testReport/

@daosbuild1
Copy link
Collaborator

Test stage Functional on EL 8.8 completed with status FAILURE. https://build.hpdd.intel.com//job/daos-stack/job/daos/view/change-requests/job/PR-14504/3/execution/node/1188/log

jolivier23
jolivier23 previously approved these changes Jun 4, 2024
- add flag to indicate whether g_envs was inited
- assert on crt_env_get() if called when env is not inited
- move crt_env_get() in utils after crt_init()

Required-githooks: true

Signed-off-by: Alexander A Oganezov <[email protected]>
@daosbuild1
Copy link
Collaborator

Test stage NLT on EL 8.8 completed with status UNSTABLE. https://build.hpdd.intel.com/job/daos-stack/job/daos//view/change-requests/job/PR-14504/4/testReport/

Required-githooks: true

Signed-off-by: Alexander A Oganezov <[email protected]>
@daosbuild1
Copy link
Collaborator

Test stage NLT on EL 8.8 completed with status UNSTABLE. https://build.hpdd.intel.com/job/daos-stack/job/daos//view/change-requests/job/PR-14504/5/testReport/

@frostedcmos frostedcmos marked this pull request as ready for review June 5, 2024 00:22
@frostedcmos frostedcmos requested review from a team as code owners June 5, 2024 00:22
@daosbuild1
Copy link
Collaborator

Test stage Functional on EL 8.8 completed with status FAILURE. https://build.hpdd.intel.com//job/daos-stack/job/daos/view/change-requests/job/PR-14504/6/execution/node/1184/log

@daosbuild1
Copy link
Collaborator

Test stage Functional on EL 8.8 completed with status FAILURE. https://build.hpdd.intel.com//job/daos-stack/job/daos/view/change-requests/job/PR-14504/9/execution/node/1229/log

setting and querying env.

Required-githooks: true

Signed-off-by: Alexander A Oganezov <[email protected]>
Required-githooks: true

Signed-off-by: Alexander A Oganezov <[email protected]>
@daosbuild1
Copy link
Collaborator

Test stage Build on Leap 15.5 with Intel-C and TARGET_PREFIX completed with status FAILURE. https://build.hpdd.intel.com//job/daos-stack/job/daos/view/change-requests/job/PR-14504/11/execution/node/502/log

Required-githooks: true

Signed-off-by: Alexander A Oganezov <[email protected]>
jolivier23
jolivier23 previously approved these changes Jun 7, 2024
jgmoore-or
jgmoore-or previously approved these changes Jun 7, 2024
Copy link
Collaborator

@soumagne soumagne left a comment

Choose a reason for hiding this comment

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

a few minor things but looks good to me otherwise.

@@ -13,48 +13,11 @@
#include "crt_internal.h"

struct crt_gdata crt_gdata;
struct crt_envs_t g_envs;
Copy link
Collaborator

Choose a reason for hiding this comment

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

we should be consistent and prefix global variables with crt_, even more if it's not static.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok

@@ -90,6 +53,9 @@ crt_lib_init(void)
crt_gdata.cg_rpcid = start_rpcid;
crt_gdata.cg_num_cores = sysconf(_SC_NPROCESSORS_ONLN);
crt_gdata.cg_iv_inline_limit = 19456; /* 19KB */

/* envs not inited until crt_init() time */
memset(&g_envs, 0x0, sizeof(struct crt_envs_t));
Copy link
Collaborator

Choose a reason for hiding this comment

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

you could do sizeof(g_envs) to not worry about the type.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok


#define ENV_STR_NO_PRINT(x) ENV_STR(x)

struct crt_envs_t {
Copy link
Collaborator

Choose a reason for hiding this comment

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

we should not not use _t after struct names :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok

#undef ENV_STR
#undef ENV_STR_NO_PRINT

extern struct crt_envs_t g_envs;
Copy link
Collaborator

Choose a reason for hiding this comment

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

ideally you'd want to use __attribute__ ((visibility ("hidden"))) for all global private declarations so that they remain hidden from public users.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hmm.. i remember before we had something in scons to make everything hidden by default, but i cant find it. Does it ring any bells @jolivier23 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

anyway, i tried adding visibility hidden here and it has issues linking numerous files:
build/release/gcc/src/cart/utils/s_crt_utils.os: In function write_completion_file':
/home/aaoganez/github/daos_master/src/cart/utils/crt_utils.c:104: undefined reference to crt_genvs' /home/aaoganez/github/daos_master/src/cart/utils/crt_utils.c:104: undefined reference to crt_genvs'
/home/aaoganez/github/daos_master/src/cart/utils/crt_utils.c:104: undefined reference to crt_genvs'

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ah ok well if you use it in crt_utils then it's not really private 😄

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, we did this in CPPR and IOF via an option to the linker and then defined a PUBLIC define to mark things visible

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like it carried over to src/client/dfuse/SConstruct where we set -fvisibility=hidden and then we use DFUSE_PUBLIC to mark the visible routines.

@frostedcmos frostedcmos merged commit 993558e into master Jun 11, 2024
52 checks passed
@frostedcmos frostedcmos deleted the aaoganez/DAOS-15961 branch June 11, 2024 17:11
frostedcmos added a commit that referenced this pull request Aug 6, 2024
Change to how cart deals with envariables:
- env list is now controlled by CRT_ENV_LIST macro in crt_types_internal.h
- all envs stored in structure generated from CRT_ENV_LST (crrt_genv) now,
  ENV is read out at crt_env_init() time and env strings deallocated at crt_env_fini().
- accsor functions/macros crt_env_init/fini/get/dump are provided.
- string-type envs no longer need to be freed after retrieval.
- Change cart utility function to populate crt_init_options_t instead of setting and querying env.

With this change, any env to be used will need to appear on the list first, ensuring it gets
dumped as well as ensuring proper name usage later. Env name typos when using crt_env_get()
will now result in compile time errors

Required-githooks: true

Signed-off-by: Alexander A Oganezov <[email protected]>
frostedcmos added a commit that referenced this pull request Aug 6, 2024
Change to how cart deals with envariables:
- env list is now controlled by CRT_ENV_LIST macro in crt_types_internal.h
- all envs stored in structure generated from CRT_ENV_LST (crrt_genv) now,
  ENV is read out at crt_env_init() time and env strings deallocated at crt_env_fini().
- accsor functions/macros crt_env_init/fini/get/dump are provided.
- string-type envs no longer need to be freed after retrieval.
- Change cart utility function to populate crt_init_options_t instead of setting and querying env.

With this change, any env to be used will need to appear on the list first, ensuring it gets
dumped as well as ensuring proper name usage later. Env name typos when using crt_env_get()
will now result in compile time errors

Required-githooks: true

Signed-off-by: Alexander A Oganezov <[email protected]>
daltonbohning pushed a commit that referenced this pull request Aug 8, 2024
Change to how cart deals with envariables:
- env list is now controlled by CRT_ENV_LIST macro in crt_types_internal.h
- all envs stored in structure generated from CRT_ENV_LST (crrt_genv) now,
  ENV is read out at crt_env_init() time and env strings deallocated at crt_env_fini().
- accsor functions/macros crt_env_init/fini/get/dump are provided.
- string-type envs no longer need to be freed after retrieval.
- Change cart utility function to populate crt_init_options_t instead of setting and querying env.

With this change, any env to be used will need to appear on the list first, ensuring it gets
dumped as well as ensuring proper name usage later. Env name typos when using crt_env_get()
will now result in compile time errors

Signed-off-by: Alexander A Oganezov <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

5 participants