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

Remove config dependency to fix ps command issue #6634

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

neel-samsung
Copy link
Contributor

No description provided.

Due to config dependency, ps command doesn't give correct output.
So, this patch fix the issue by removing config dependency for
CONFIG_SMP and CONFIG_SMP_NCPUS.

Signed-off-by: neel-samsung <[email protected]>
Due to config dependency, ps command doesn't give correct output.
So, this patch fix the issue by removing config dependency for
CONFIG_SMP and CONFIG_SMP_NCPUS between Kernel and application.
We hande it by introducing the syscall for obtaining the number
CPUs while runtime.

Signed-off-by: neel-samsung <[email protected]>

int sched_getcpucount(void)
{
return CONFIG_SMP_NCPUS;
Copy link
Contributor

Choose a reason for hiding this comment

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

What happens if this value is not present?
I think we need to define values for when config is not existing.

Copy link
Contributor

Choose a reason for hiding this comment

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

like

#if defined(CONFIG_SMP_NCPUS)
   return CONFIG_SMP_NCPUS;
#else
   return 0

or

In the file,
#if defined(CONFIG_SMP_NCPUS)
#define NCPUS CONFIG_SMP_NCPUS
#else
#define NCPUS 0
...

in sched_getcpucount()
   return NCPUS;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We are already defining the config if it is not present.

TizenRT/os/tools/mkconfig.c

Lines 302 to 304 in e28022b

printf("#ifndef CONFIG_SMP_NCPUS\n");
printf("# define CONFIG_SMP_NCPUS 1\n");
printf("#endif\n\n");

@@ -179,32 +177,24 @@ static void cpuload_print_pid_value(char *buf, void *arg)
} else {
#ifdef CONFIG_SCHED_MULTI_CPULOAD
for (i = PROC_STAT_CPULOAD_SHORT; i <= PROC_STAT_CPULOAD_LONG; i++) {
#ifdef CONFIG_SMP
char * avgload[CONFIG_SMP_NCPUS + 1];
char * avgload[ncpus + 1];
Copy link
Contributor

@jeongarmy jeongarmy Jan 17, 2025

Choose a reason for hiding this comment

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

ncpus is not static value. you define array with not defined value.. Is it ok? I think it makes warning or error.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think, this also shouldn't create issue as syscall will return a constant value based on CONFIG_SMP_NCPUS

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.

2 participants