-
Notifications
You must be signed in to change notification settings - Fork 309
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-12710 build: Improve daos/tse.h handling. #13613
Conversation
Remove the dependency between daos_task.h and daos/tse.h The general rule is daos_*.h are public headers and daos/*.h are private headers although daos/tse.h was an exception and installed as part of the RPM. Move the typdes from tse.h to daos_task.h where they're needed and remove some includes from around the tree where tse.h was include but didn't need to be. Fix some doxygen style comments in daos_task.h to be correct doxygen. Required-githooks: true Signed-off-by: Ashley Pittman <[email protected]>
Bug-tracker data: |
@mchaarawi this is technically an API change but did we intend to export daos/tse.h? If there are functions there we want exported then we should move them to daos_task.h IMO. |
not really. daos_task is something different than tse. tse by itself is unrelated to DAOS and meant as a separate package. some libraries use tse without daos. but daos_task is different and depends on DAOS. |
Does anything outside the daos tree use tse directly? With this PR you can't include daos/tse.h without previously including daos_task.h which goes against what you're saying but I suspect that was the case anyway - I can check. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tse is used by HDF5 and possible other packages, so this cannot land.
daos_task.h depends on tse.h not the other way around. so this PR is not correct. |
Add daos/tse.h to doxygen file and fix annotations. Required-githooks: true Signed-off-by: Ashley Pittman <[email protected]>
Required-githooks: true Signed-off-by: Ashley Pittman <[email protected]>
Required-githooks: true Signed-off-by: Ashley Pittman <[email protected]>
Required-githooks: true Signed-off-by: Ashley Pittman <[email protected]>
Required-githooks: true Signed-off-by: Ashley Pittman <[email protected]>
Ok, updated on that basis. daos/tse.h was and still is includable without pulling in any daos_*.h headers. |
src/common/tse.c
Outdated
@@ -17,8 +17,10 @@ | |||
|
|||
#include <stdint.h> | |||
#include <pthread.h> | |||
#include <daos_task.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where does this file require daos_task.h ?
src/include/daos/common.h
Outdated
#include <daos_types.h> | ||
#include <daos_obj.h> | ||
#include <daos_prop.h> | ||
#include <daos_security.h> | ||
#include <daos_task.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why add daos_task.h here?
src/include/daos/common.h
Outdated
#include <daos/profile.h> | ||
#include <daos/dtx.h> | ||
#include <daos/cmd_parser.h> | ||
#include <daos/tse.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same, why is that needed here?
src/include/daos/tse.h
Outdated
typedef struct tse_task { | ||
/** the result */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that sounds like a useless comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"result of the task operation - valid after task completion"
src/include/daos/tse.h
Outdated
#define TSE_TASK_SIZE (TSE_PRIV_SIZE + 8) | ||
|
||
/** A single task */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that sounds like a useless comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Our documentation requires all structures and entries to be documented, some text is needed here, feel free to suggest something better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"struct for a task object that is used for tracking an operation"
#include <daos_types.h> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so even though those headers are installed, i believe we discussed at one point that really the user should just include daos.h for the daos API, then add daos_fs.h, or others for the higher level APIs vs being able to add each header. so your changes to make each public header byitself pull the other needed ones is not necessary.
Required-githooks: true
Required-githooks: true Signed-off-by: Ashley Pittman <[email protected]>
partially working. Required-githooks: true Signed-off-by: Ashley Pittman <[email protected]>
Test stage Functional Hardware Medium completed with status UNSTABLE. https://build.hpdd.intel.com/job/daos-stack/job/daos//view/change-requests/job/PR-13613/6/testReport/ |
Required-githooks: true Signed-off-by: Ashley Pittman <[email protected]>
src/include/daos/mgmt.h
Outdated
#include <daos/common.h> | ||
#include <daos/tse.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems improper, or at least not how I'm familiar with imports. Generally, if a file needs a definition, it should import the header that contains that definition.
For example, mgmt.h
uses tse_task_t
, which is defined in tse.h
. So mgmt.h
should include tse.h
directly instead of implicitly relying on other imports to import those definitions, which could change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're correct. I started this PR assuming that tse.h was a private header and trying to remove it's special handing but as @mchaarawi pointed it it's part of the API and it's special handing is warranted. An early change I made incorrectly meant that daos_task.h neeed to included before daos/tse.h and these changes were to support that.
What you're saying about includes only being included to satisfy the header they're included in is good practice and this PR is an attempt to improve on that for the public headers but we do tend to have a few header files that just catch everything and I didn't mean to exacerbate that.
I've backed those changes out now and this PR is smaller as a result, thank you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The other issue here is that we should also be using <> for public headers and "" for internal ones, plus including system headers first, then daos public, then daos private but I don't think any of our code does that.
We've also got a few headers which are included both with or without a directory in places, daos_test.h is included as "<daos_test>" 25 times, <daos_test.h> 6 times and "<suite/daos_test.h>" once.
src/include/daos/common.h
Outdated
#include <daos_types.h> | ||
#include <daos_obj.h> | ||
#include <daos_prop.h> | ||
#include <daos_security.h> | ||
#include <daos/tse.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
daos/common.h
includes daos/tse.h
, but daos/common.h
doesn't actually need the definitions in daos/tse.h
. So this seems improper to me
Required-githooks: true Signed-off-by: Ashley Pittman <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please do correct me if I'm wrong about how includes should be organized
src/include/daos/container.h
Outdated
@@ -1,5 +1,5 @@ | |||
/** | |||
* (C) Copyright 2016-2023 Intel Corporation. | |||
* (C) Copyright 2016-2024 Intel Corporation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
erroneous copyright update after changes were backed out. Here and others
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll do another pass and fix these when I'm done with other changes.
#include <daos/tse.h> | ||
#include <daos_types.h> | ||
#include <daos_pool.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file should still include <daos/tse.h>
right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On what basis? That in uses some of the defines in daos/tse.h I assume? We have to assume that every file that includes this already includes daos/tse.h via some route.
It's easy enough to run my new unit test on the private headers as well, I'll update this PR with a few more code changes to allow all of them to be included but I won't enable this by default as it means the test would need to access abt.h and also we have daos/qat.h which we don't seem to include from anywhere today.
I've also found that using the macros from gurt/debug.h depends on gurt/common.h but you can't include gurt/common.h before gurt/debug.h so you have to include gurt/debug.h then gurt/common.h or just gurt/common.h
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On what basis? That in uses some of the defines in daos/tse.h I assume?
Right.
We have to assume that every file that includes this already includes daos/tse.h via some route.
That works accidentally, but not in the general sense. daos/pool.h
now has a silent dependency on daos/tse.h
.
the macros from gurt/debug.h depends on gurt/common.h
That issue is exactly the kind of issue I'm trying to avoid. If "the macros from gurt/debug.h depends on gurt/common.h" then gurt/debug.h
should include gurt/common.h
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On what basis? That in uses some of the defines in daos/tse.h I assume?
Right.
We have to assume that every file that includes this already includes daos/tse.h via some route.
That works accidentally, but not in the general sense.
daos/pool.h
now has a silent dependency ondaos/tse.h
.
Having testing more now I don't think it does, daos/pool.h
obviously pulls in daos/tse.h
from one of the header files that it includes. We could no doubt do some pruning of includes from c files but getting the headers right is the first step towards that.
the macros from gurt/debug.h depends on gurt/common.h
That issue is exactly the kind of issue I'm trying to avoid. If "the macros from gurt/debug.h depends on gurt/common.h" then
gurt/debug.h
should includegurt/common.h
It can't, gurt/common.h
includes gurt/debug.h
. I'll deal with that another day.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could no doubt do some pruning of includes from c files
I don't think the goal should be to reduce the includes to the minimal possible that allows us to build each header independently. We should include what we need in the headers that need it. Otherwise, we end up breaking unrelated files if we reorganize, like in my example above.
src/include/daos/task.h
Outdated
#include <daos_types.h> | ||
#include <daos_api.h> | ||
#include <daos/tse.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And this one?
src/object/obj_internal.h
Outdated
@@ -14,7 +14,6 @@ | |||
#include <stdint.h> | |||
#include <daos/common.h> | |||
#include <daos/event.h> | |||
#include <daos/tse.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
Required-githooks: true Signed-off-by: Ashley Pittman <[email protected]>
Test stage Functional Hardware Medium completed with status UNSTABLE. https://build.hpdd.intel.com/job/daos-stack/job/daos//view/change-requests/job/PR-13613/9/testReport/ |
Required-githooks: true
Required-githooks: true Signed-off-by: Ashley Pittman <[email protected]>
src/include/daos/sys_debug.h
Outdated
#include <daos/common.h> | ||
#include <daos/tse.h> | ||
#include <daos_types.h> | ||
#include <daos_task.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so why here add daos_task.h but other places like https://github.com/daos-stack/daos/pull/13613/files#diff-930d69e66aac2e78ef8537ea29d976fc69620cbdeee43d117662b9e6f7f1f036R14 you added aos/tse.h
seems inconsistent.
src/include/daos/tse.h
Outdated
#define TSE_TASK_SIZE (TSE_PRIV_SIZE + 8) | ||
|
||
/** A single task */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"struct for a task object that is used for tracking an operation"
src/include/daos/tse.h
Outdated
typedef struct tse_task { | ||
/** the result */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"result of the task operation - valid after task completion"
src/include/daos/tse.h
Outdated
@@ -36,37 +42,41 @@ typedef struct tse_task { | |||
* Track all of the tasks under a scheduler. | |||
*/ | |||
typedef struct { | |||
/** the result */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above, but this is for the schedule
src/include/daos/tse.h
Outdated
typedef int (*tse_sched_comp_cb_t)(void *args, int rc); | ||
/** Callaback function for when a task is done */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this comment is wrong.
#include <daos_types.h> | ||
#include <daos_obj.h> | ||
#include <daos_obj_class.h> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
im not going to comment again on every one of those public headers and will just comment on his one.
so the idea is for user to include daos.h, and that pulls in all what's needed. so "fixing" all the headers to be able to be included by itself is not required.
#include <daos_types.h> | ||
#include <daos_obj.h> | ||
#include <daos_obj_class.h> | ||
#include <daos_array.h> | ||
#include <daos_cont.h> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not required. expectation is that user pulls in daos.h then daos_fs.h
Required-githooks: true Signed-off-by: Ashley Pittman <[email protected]>
Required-githooks: true Signed-off-by: Ashley Pittman <[email protected]>
typedef int (*tse_sched_comp_cb_t)(void *args, int rc); | ||
/** A task callback function */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is not a callback. this is the prototype def of the task body function.
- name: include checks | ||
tests: | ||
- cmd: ["utils/include_test.py"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is another case where my might want a directory of pytest tests somewhere
Fix doxygen comments in daos_task.h and daos/tse.h
Change includes so all public daos headers are independent and can
be included without including any headers prior.
Add a unit test about the above for all installed headers.
Remove the scons check for gurt and cart headers in favour
of the new unit test.
Signed-off-by: Ashley Pittman [email protected]