mirror of
https://github.com/apache/nuttx-apps.git
synced 2026-09-14 22:50:33 +00:00
testing/ostest/smp_call.c: fix smp_call cpu_set inconsistency issue
If we set CONFIG_SMP_DEFAULT_CPUSET=1 This will cause the value of cpuset to be 0x1, ((1 << CONFIG_SMP_NCPUS) - 1) will result in the cpuset being 0x11, leading to test case errors. Signed-off-by: hujun5 <hujun5@xiaomi.com>
This commit is contained in:
parent
e19d99022a
commit
24e1c4df6f
1 changed files with 6 additions and 8 deletions
|
|
@ -38,6 +38,7 @@
|
|||
****************************************************************************/
|
||||
|
||||
static struct smp_call_data_s g_call_data;
|
||||
static cpu_set_t g_cpuset;
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
|
|
@ -53,10 +54,8 @@ static int smp_call_func(void *arg)
|
|||
|
||||
static void wdg_wdentry(wdparm_t arg)
|
||||
{
|
||||
cpu_set_t cpus = (1 << CONFIG_SMP_NCPUS) - 1;
|
||||
|
||||
nxsched_smp_call_init(&g_call_data, smp_call_func, (FAR void *)arg);
|
||||
nxsched_smp_call_async(cpus, &g_call_data);
|
||||
nxsched_smp_call_async(g_cpuset, &g_call_data);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
|
@ -65,7 +64,6 @@ static void wdg_wdentry(wdparm_t arg)
|
|||
|
||||
void smp_call_test(void)
|
||||
{
|
||||
cpu_set_t cpuset;
|
||||
struct smp_call_data_s call_data;
|
||||
sem_t sem;
|
||||
int cpucnt;
|
||||
|
|
@ -111,10 +109,10 @@ void smp_call_test(void)
|
|||
|
||||
printf("smp_call_test: Call multi cpu, nowait\n");
|
||||
|
||||
sched_getaffinity(0, sizeof(cpu_set_t), &cpuset);
|
||||
cpucnt = CPU_COUNT(&cpuset);
|
||||
sched_getaffinity(0, sizeof(cpu_set_t), &g_cpuset);
|
||||
cpucnt = CPU_COUNT(&g_cpuset);
|
||||
|
||||
nxsched_smp_call_async(cpuset, &call_data);
|
||||
nxsched_smp_call_async(g_cpuset, &call_data);
|
||||
|
||||
for (cpu = 0; cpu < cpucnt; cpu++)
|
||||
{
|
||||
|
|
@ -142,7 +140,7 @@ void smp_call_test(void)
|
|||
|
||||
printf("smp_call_test: Call multi cpu, wait\n");
|
||||
|
||||
nxsched_smp_call(cpuset, smp_call_func, &sem);
|
||||
nxsched_smp_call(g_cpuset, smp_call_func, &sem);
|
||||
|
||||
sem_getvalue(&sem, &value);
|
||||
if (value != cpucnt)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue