You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "pkarashchenko (via GitHub)" <gi...@apache.org> on 2023/04/11 13:09:34 UTC
[GitHub] [nuttx-apps] pkarashchenko opened a new pull request, #1711: testing/ostest: add test case for task priority change with locked scheduler
pkarashchenko opened a new pull request, #1711:
URL: https://github.com/apache/nuttx-apps/pull/1711
## Summary
This test helps to verify that scheduler lock/unlock functionality is working as expected.
Currently there is a bug, so test fails.
## Impact
More test coverage
## Testing
The test pass if https://github.com/apache/nuttx/pull/7464 is applied
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nuttx-apps] xiaoxiang781216 commented on pull request #1711: testing/ostest: add test case for task priority change with locked scheduler
Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 commented on PR #1711:
URL: https://github.com/apache/nuttx-apps/pull/1711#issuecomment-1663242834
> @xiaoxiang781216 seems this should fix the root cause [apache/nuttx#10016](https://github.com/apache/nuttx/pull/10016) But still I do not understand why it works locally for me.
without SIM_WALLTIME_SIGNAL, simulator timing doesn't sync with the PC wall clock. I guess the ci server either run to fast or slow than your PC.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nuttx-apps] pkarashchenko commented on pull request #1711: testing/ostest: add test case for task priority change with locked scheduler
Posted by "pkarashchenko (via GitHub)" <gi...@apache.org>.
pkarashchenko commented on PR #1711:
URL: https://github.com/apache/nuttx-apps/pull/1711#issuecomment-1659284638
Seems like https://github.com/apache/nuttx/pull/9981 is needed to move forward
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nuttx-apps] pkarashchenko commented on a diff in pull request #1711: testing/ostest: add test case for task priority change with locked scheduler
Posted by "pkarashchenko (via GitHub)" <gi...@apache.org>.
pkarashchenko commented on code in PR #1711:
URL: https://github.com/apache/nuttx-apps/pull/1711#discussion_r1162995359
##########
testing/ostest/schedlock.c:
##########
@@ -0,0 +1,242 @@
+/****************************************************************************
+ * apps/testing/ostest/schedlock.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <stdio.h>
+#include <unistd.h>
+#include <pthread.h>
+#include <errno.h>
+#include <sched.h>
+#include <unistd.h>
+#include <stdint.h>
+
+#include "ostest.h"
+
+#include <sys/wait.h>
+
+static pthread_t g_lowpri;
+static pthread_t g_highpri;
+static volatile bool g_locked;
+static volatile bool g_pass;
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: highpri_thread
+ ****************************************************************************/
+
+static FAR void *highpri_thread(FAR void *parameter)
+{
+ struct sched_param param;
+ int policy;
+ bool self = (bool)(uintptr_t)parameter;
+ pthread_t thread = self ? 0 : g_lowpri;
+
+ usleep(100);
+
+ pthread_getschedparam(0, &policy, ¶m);
+ if (self)
+ {
+ param.sched_priority -= 2;
+ }
+ else
+ {
+ param.sched_priority += 2;
+ }
+
+ sched_lock();
+
+ g_locked = true;
+
+ nxsched_set_param(thread, ¶m);
Review Comment:
Need to fix this copy paste
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nuttx-apps] pkarashchenko commented on pull request #1711: testing/ostest: add test case for task priority change with locked scheduler
Posted by "pkarashchenko (via GitHub)" <gi...@apache.org>.
pkarashchenko commented on PR #1711:
URL: https://github.com/apache/nuttx-apps/pull/1711#issuecomment-1513747711
Currently this is blocked by https://github.com/apache/nuttx-apps/issues/1716
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nuttx-apps] pkarashchenko commented on pull request #1711: testing/ostest: add test case for task priority change with locked scheduler
Posted by "pkarashchenko (via GitHub)" <gi...@apache.org>.
pkarashchenko commented on PR #1711:
URL: https://github.com/apache/nuttx-apps/pull/1711#issuecomment-1661140687
@xiaoxiang781216 do you have any ideas why `sim:citest` fails? Initially I thought that it is a timeout issue, but seems like it is not, I can run the tests locally and all test pass
```
=========================================================== test session starts ===========================================================
platform linux -- Python 3.8.10, pytest-6.2.5, py-1.11.0, pluggy-1.2.0 -- /usr/bin/python3
cachedir: .pytest_cache
rootdir: /home/pkarashchenko/eclipse-workspace/nuttx-upstream/nuttx/tools/ci/testrun, configfile: pytest.ini
plugins: repeat-0.9.1, ordering-0.6, json-0.4.0
collected 12 items
test_example/test_example.py::test_hello PASSED [ 8%]
test_example/test_example.py::test_helloxx PASSED [ 16%]
test_example/test_example.py::test_pipe PASSED [ 25%]
test_example/test_example.py::test_popen PASSED [ 33%]
test_example/test_example.py::test_usrsocktest PASSED [ 41%]
test_os/test_os.py::test_ostest PASSED [ 50%]
test_os/test_os.py::test_mm PASSED [ 58%]
test_os/test_os.py::test_cxxtest PASSED [ 66%]
test_os/test_os.py::test_scanftest PASSED [ 75%]
test_os/test_os.py::test_getprime PASSED [ 83%]
test_os/test_os.py::test_fs_test PASSED [ 91%]
test_os/test_os.py::test_psram_test PASSED [100%]
```
But on CI the `test_os/test_os.py::test_ostest` fails.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nuttx-apps] pkarashchenko commented on a diff in pull request #1711: testing/ostest: add test case for task priority change with locked scheduler
Posted by "pkarashchenko (via GitHub)" <gi...@apache.org>.
pkarashchenko commented on code in PR #1711:
URL: https://github.com/apache/nuttx-apps/pull/1711#discussion_r1171106452
##########
testing/ostest/schedlock.c:
##########
@@ -0,0 +1,259 @@
+/****************************************************************************
+ * apps/testing/ostest/schedlock.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
Review Comment:
Will do
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nuttx-apps] pkarashchenko commented on a diff in pull request #1711: testing/ostest: add test case for task priority change with locked scheduler
Posted by "pkarashchenko (via GitHub)" <gi...@apache.org>.
pkarashchenko commented on code in PR #1711:
URL: https://github.com/apache/nuttx-apps/pull/1711#discussion_r1163335340
##########
testing/ostest/Makefile:
##########
@@ -97,6 +97,14 @@ endif
ifeq ($(CONFIG_SCHED_WORKQUEUE),y)
CSRCS += wqueue.c
endif
+
+ifeq ($(CONFIG_PRIORITY_INHERITANCE),y)
+CSRCS += prioinherit.c
+endif
+
+ifneq ($(CONFIG_ARCH_SIM),y)
Review Comment:
I've done more tests and found out that priority inheritance test does not work with `CONFIG_SIM_WALLTIME_SLEEP=y`, but only works with `CONFIG_SIM_WALLTIME_SIGNAL=y`. @xiaoxiang781216 do you know what may be the reason?
I will update the test case and include it unconditionally, but `sim:ostest` should be updated to use `CONFIG_SIM_WALLTIME_SIGNAL=y` to get this test working
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nuttx-apps] xiaoxiang781216 commented on pull request #1711: testing/ostest: add test case for task priority change with locked scheduler
Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 commented on PR #1711:
URL: https://github.com/apache/nuttx-apps/pull/1711#issuecomment-1661544625
@ttnie could you check why the citest fail?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nuttx-apps] hartmannathan commented on pull request #1711: testing/ostest: add test case for task priority change with locked scheduler
Posted by "hartmannathan (via GitHub)" <gi...@apache.org>.
hartmannathan commented on PR #1711:
URL: https://github.com/apache/nuttx-apps/pull/1711#issuecomment-1529234799
Continuing what @davids5 was saying, I think a comment in the code that explains the purpose of the test and what we expect from it will help people reading the code later.
Separately, another idea:
Since the test is expected to fail due to a bug, I think we should modify the ostest program to tally five possible results from each test, like some other test suites do: pass, fail, expected fail, unexpected pass, skipped.
Explanation:
- pass: the test passed as expected
- fail: the test should have passed but it failed
- expected fail: the test failed and it was expected to fail because of a known bug; that is the situation with the test in this PR. We should tally such failures separately from above-mentioned fail because they are caused by known bugs
- unexpected pass: we expected the test to fail with "expected fail" because of a known bug, but to our surprise, it passed unexpectedly
- skipped: the test is not being run because the hardware or build doesn't support it; e.g., the priority inheritance tests will be skipped in a non-priority-inheritance build
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nuttx-apps] xiaoxiang781216 commented on a diff in pull request #1711: testing/ostest: add test case for task priority change with locked scheduler
Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #1711:
URL: https://github.com/apache/nuttx-apps/pull/1711#discussion_r1163132150
##########
testing/ostest/Makefile:
##########
@@ -97,6 +97,14 @@ endif
ifeq ($(CONFIG_SCHED_WORKQUEUE),y)
CSRCS += wqueue.c
endif
+
+ifeq ($(CONFIG_PRIORITY_INHERITANCE),y)
+CSRCS += prioinherit.c
+endif
+
+ifneq ($(CONFIG_ARCH_SIM),y)
Review Comment:
why check sim?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nuttx-apps] pkarashchenko commented on a diff in pull request #1711: testing/ostest: add test case for task priority change with locked scheduler
Posted by "pkarashchenko (via GitHub)" <gi...@apache.org>.
pkarashchenko commented on code in PR #1711:
URL: https://github.com/apache/nuttx-apps/pull/1711#discussion_r1166451542
##########
testing/ostest/schedlock.c:
##########
@@ -0,0 +1,259 @@
+/****************************************************************************
+ * apps/testing/ostest/schedlock.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <stdio.h>
+#include <unistd.h>
+#include <pthread.h>
+#include <errno.h>
+#include <sched.h>
+#include <unistd.h>
+#include <stdint.h>
+
+#ifdef CONFIG_ARCH_SIM
+# include <nuttx/arch.h>
+#endif
+
+#include <sys/wait.h>
+
+#include "ostest.h"
+
+static pthread_t g_lowpri;
+static pthread_t g_highpri;
+static volatile bool g_locked;
+static volatile bool g_pass;
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: highpri_thread
+ ****************************************************************************/
+
+static FAR void *highpri_thread(FAR void *parameter)
+{
+ struct sched_param param;
+ int policy;
+ bool self = (bool)(uintptr_t)parameter;
+ pthread_t thread = self ? 0 : g_lowpri;
+
+ usleep(100);
+
+ pthread_getschedparam(0, &policy, ¶m);
+ if (self)
+ {
+ param.sched_priority -= 2;
+ }
+ else
+ {
+ param.sched_priority += 2;
+ }
+
+ sched_lock();
+
+ g_locked = true;
+
+ pthread_setschedprio(thread, param.sched_priority);
+
+ /* Test pass if g_locked was not cleared by lowpri thread while scheduler
+ * is locked
+ */
+
+ g_pass = g_locked;
+
+ sched_unlock();
+
+ return NULL;
+}
+
+/****************************************************************************
+ * Name: lowpri_thread
+ ****************************************************************************/
+
+static FAR void *lowpri_thread(FAR void *parameter)
+{
+ /* Wait until highpri thread starts the scheduler lock test */
+
+ while (!g_locked)
+ {
+#ifdef CONFIG_ARCH_SIM
+ /* The simulator doesn't have any mechanism to do asynchronous
+ * pre-emption (basically because it doesn't have any
+ * interrupts/asynchronous events). The simulator does "fake" a timer
+ * interrupt in up_idle() -- the idle thread that only executes when
+ * nothing else is running. In the simulator, we cannot suspend the
+ * middle priority task, or we wouldn't have the test that we want.
+ * So, we have no option but to pump the fake clock here by calling
+ * up_idle(). Sigh!
+ */
+
+ up_idle();
Review Comment:
@xiaoxiang781216 @anchao @masayuki2009 do toy have any idea why this does not work in case of `CONFIG_SIM_WALLTIME_SLEEP=y`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nuttx-apps] xiaoxiang781216 commented on a diff in pull request #1711: testing/ostest: add test case for task priority change with locked scheduler
Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #1711:
URL: https://github.com/apache/nuttx-apps/pull/1711#discussion_r1174620385
##########
testing/ostest/Makefile:
##########
@@ -97,6 +97,14 @@ endif
ifeq ($(CONFIG_SCHED_WORKQUEUE),y)
CSRCS += wqueue.c
endif
+
+ifeq ($(CONFIG_PRIORITY_INHERITANCE),y)
+CSRCS += prioinherit.c
+endif
+
+ifneq ($(CONFIG_ARCH_SIM),y)
Review Comment:
let's list this as a know issue before we can fix it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nuttx-apps] pkarashchenko commented on a diff in pull request #1711: testing/ostest: add test case for task priority change with locked scheduler
Posted by "pkarashchenko (via GitHub)" <gi...@apache.org>.
pkarashchenko commented on code in PR #1711:
URL: https://github.com/apache/nuttx-apps/pull/1711#discussion_r1239079465
##########
testing/ostest/schedlock.c:
##########
@@ -0,0 +1,259 @@
+/****************************************************************************
+ * apps/testing/ostest/schedlock.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
Review Comment:
Please check if description is sufficient.
##########
testing/ostest/schedlock.c:
##########
@@ -0,0 +1,259 @@
+/****************************************************************************
+ * apps/testing/ostest/schedlock.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <stdio.h>
+#include <unistd.h>
+#include <pthread.h>
+#include <errno.h>
+#include <sched.h>
+#include <unistd.h>
+#include <stdint.h>
+
+#ifdef CONFIG_ARCH_SIM
+# include <nuttx/arch.h>
+#endif
+
+#include <sys/wait.h>
+
+#include "ostest.h"
+
+static pthread_t g_lowpri;
+static pthread_t g_highpri;
+static volatile bool g_locked;
+static volatile bool g_pass;
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: highpri_thread
+ ****************************************************************************/
+
+static FAR void *highpri_thread(FAR void *parameter)
+{
+ struct sched_param param;
+ int policy;
+ bool self = (bool)(uintptr_t)parameter;
+ pthread_t thread = self ? 0 : g_lowpri;
+
+ usleep(100);
+
+ pthread_getschedparam(0, &policy, ¶m);
+ if (self)
+ {
+ param.sched_priority -= 2;
+ }
+ else
+ {
+ param.sched_priority += 2;
+ }
+
+ sched_lock();
+
+ g_locked = true;
+
+ pthread_setschedprio(thread, param.sched_priority);
+
+ /* Test pass if g_locked was not cleared by lowpri thread while scheduler
+ * is locked
+ */
+
+ g_pass = g_locked;
+
+ sched_unlock();
+
+ return NULL;
+}
+
+/****************************************************************************
+ * Name: lowpri_thread
+ ****************************************************************************/
+
+static FAR void *lowpri_thread(FAR void *parameter)
+{
+ /* Wait until highpri thread starts the scheduler lock test */
+
+ while (!g_locked)
+ {
+#ifdef CONFIG_ARCH_SIM
+ /* The simulator doesn't have any mechanism to do asynchronous
+ * pre-emption (basically because it doesn't have any
+ * interrupts/asynchronous events). The simulator does "fake" a timer
+ * interrupt in up_idle() -- the idle thread that only executes when
+ * nothing else is running. In the simulator, we cannot suspend the
+ * middle priority task, or we wouldn't have the test that we want.
+ * So, we have no option but to pump the fake clock here by calling
+ * up_idle(). Sigh!
+ */
+
+ up_idle();
Review Comment:
Done
##########
testing/ostest/prioinherit.c:
##########
@@ -31,7 +31,7 @@
#include <stdlib.h>
#include <unistd.h>
-#ifdef CONFIG_ARCH_SIM
+#ifdef CONFIG_SIM_WALLTIME_SLEEP
Review Comment:
I think that change is consistent as it changes `#ifdef CONFIG_ARCH_SIM` to `#ifdef CONFIG_SIM_WALLTIME_SLEEP` in all related places
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nuttx-apps] xiaoxiang781216 merged pull request #1711: testing/ostest: add test case for task priority change with locked scheduler
Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 merged PR #1711:
URL: https://github.com/apache/nuttx-apps/pull/1711
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nuttx-apps] pkarashchenko commented on pull request #1711: testing/ostest: add test case for task priority change with locked scheduler
Posted by "pkarashchenko (via GitHub)" <gi...@apache.org>.
pkarashchenko commented on PR #1711:
URL: https://github.com/apache/nuttx-apps/pull/1711#issuecomment-1513595873
Ok. Could you please point me to some examples, or should I just place some explanations in the comments?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nuttx-apps] pkarashchenko commented on a diff in pull request #1711: testing/ostest: add test case for task priority change with locked scheduler
Posted by "pkarashchenko (via GitHub)" <gi...@apache.org>.
pkarashchenko commented on code in PR #1711:
URL: https://github.com/apache/nuttx-apps/pull/1711#discussion_r1170528717
##########
testing/ostest/schedlock.c:
##########
@@ -0,0 +1,259 @@
+/****************************************************************************
+ * apps/testing/ostest/schedlock.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <stdio.h>
+#include <unistd.h>
+#include <pthread.h>
+#include <errno.h>
+#include <sched.h>
+#include <unistd.h>
+#include <stdint.h>
+
+#ifdef CONFIG_ARCH_SIM
+# include <nuttx/arch.h>
+#endif
+
+#include <sys/wait.h>
+
+#include "ostest.h"
+
+static pthread_t g_lowpri;
+static pthread_t g_highpri;
+static volatile bool g_locked;
+static volatile bool g_pass;
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: highpri_thread
+ ****************************************************************************/
+
+static FAR void *highpri_thread(FAR void *parameter)
+{
+ struct sched_param param;
+ int policy;
+ bool self = (bool)(uintptr_t)parameter;
+ pthread_t thread = self ? 0 : g_lowpri;
+
+ usleep(100);
+
+ pthread_getschedparam(0, &policy, ¶m);
+ if (self)
+ {
+ param.sched_priority -= 2;
+ }
+ else
+ {
+ param.sched_priority += 2;
+ }
+
+ sched_lock();
+
+ g_locked = true;
+
+ pthread_setschedprio(thread, param.sched_priority);
+
+ /* Test pass if g_locked was not cleared by lowpri thread while scheduler
+ * is locked
+ */
+
+ g_pass = g_locked;
+
+ sched_unlock();
+
+ return NULL;
+}
+
+/****************************************************************************
+ * Name: lowpri_thread
+ ****************************************************************************/
+
+static FAR void *lowpri_thread(FAR void *parameter)
+{
+ /* Wait until highpri thread starts the scheduler lock test */
+
+ while (!g_locked)
+ {
+#ifdef CONFIG_ARCH_SIM
+ /* The simulator doesn't have any mechanism to do asynchronous
+ * pre-emption (basically because it doesn't have any
+ * interrupts/asynchronous events). The simulator does "fake" a timer
+ * interrupt in up_idle() -- the idle thread that only executes when
+ * nothing else is running. In the simulator, we cannot suspend the
+ * middle priority task, or we wouldn't have the test that we want.
+ * So, we have no option but to pump the fake clock here by calling
+ * up_idle(). Sigh!
+ */
+
+ up_idle();
Review Comment:
Reposted here https://github.com/apache/nuttx-apps/issues/1716
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nuttx-apps] xiaoxiang781216 commented on a diff in pull request #1711: testing/ostest: add test case for task priority change with locked scheduler
Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #1711:
URL: https://github.com/apache/nuttx-apps/pull/1711#discussion_r1174620277
##########
testing/ostest/prioinherit.c:
##########
@@ -31,7 +31,7 @@
#include <stdlib.h>
#include <unistd.h>
-#ifdef CONFIG_ARCH_SIM
+#ifdef CONFIG_SIM_WALLTIME_SLEEP
Review Comment:
merge to previous patch
##########
testing/ostest/schedlock.c:
##########
@@ -0,0 +1,259 @@
+/****************************************************************************
+ * apps/testing/ostest/schedlock.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <stdio.h>
+#include <unistd.h>
+#include <pthread.h>
+#include <errno.h>
+#include <sched.h>
+#include <unistd.h>
+#include <stdint.h>
+
+#ifdef CONFIG_ARCH_SIM
+# include <nuttx/arch.h>
+#endif
+
+#include <sys/wait.h>
+
+#include "ostest.h"
+
+static pthread_t g_lowpri;
+static pthread_t g_highpri;
+static volatile bool g_locked;
+static volatile bool g_pass;
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: highpri_thread
+ ****************************************************************************/
+
+static FAR void *highpri_thread(FAR void *parameter)
+{
+ struct sched_param param;
+ int policy;
+ bool self = (bool)(uintptr_t)parameter;
+ pthread_t thread = self ? 0 : g_lowpri;
+
+ usleep(100);
+
+ pthread_getschedparam(0, &policy, ¶m);
+ if (self)
+ {
+ param.sched_priority -= 2;
+ }
+ else
+ {
+ param.sched_priority += 2;
+ }
+
+ sched_lock();
+
+ g_locked = true;
+
+ pthread_setschedprio(thread, param.sched_priority);
+
+ /* Test pass if g_locked was not cleared by lowpri thread while scheduler
+ * is locked
+ */
+
+ g_pass = g_locked;
+
+ sched_unlock();
+
+ return NULL;
+}
+
+/****************************************************************************
+ * Name: lowpri_thread
+ ****************************************************************************/
+
+static FAR void *lowpri_thread(FAR void *parameter)
+{
+ /* Wait until highpri thread starts the scheduler lock test */
+
+ while (!g_locked)
+ {
+#ifdef CONFIG_ARCH_SIM
+ /* The simulator doesn't have any mechanism to do asynchronous
+ * pre-emption (basically because it doesn't have any
+ * interrupts/asynchronous events). The simulator does "fake" a timer
+ * interrupt in up_idle() -- the idle thread that only executes when
+ * nothing else is running. In the simulator, we cannot suspend the
+ * middle priority task, or we wouldn't have the test that we want.
+ * So, we have no option but to pump the fake clock here by calling
+ * up_idle(). Sigh!
+ */
+
+ up_idle();
Review Comment:
change CONFIG_ARCH_SIM to CONFIG_SIM_WALLTIME_SLEEP
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nuttx-apps] pkarashchenko commented on pull request #1711: testing/ostest: add test case for task priority change with locked scheduler
Posted by "pkarashchenko (via GitHub)" <gi...@apache.org>.
pkarashchenko commented on PR #1711:
URL: https://github.com/apache/nuttx-apps/pull/1711#issuecomment-1603383546
> @pkarashchenko please add commit message describing the change
Should I modify all the three commits? I'm not sure that commit that adds missing comment needs any other description than `testing/ostest: add missing section comments` currently available.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nuttx-apps] pkarashchenko commented on pull request #1711: testing/ostest: add test case for task priority change with locked scheduler
Posted by "pkarashchenko (via GitHub)" <gi...@apache.org>.
pkarashchenko commented on PR #1711:
URL: https://github.com/apache/nuttx-apps/pull/1711#issuecomment-1663054907
@xiaoxiang781216 seems this should fix the root cause https://github.com/apache/nuttx/pull/10016
But still I do not understand why it works locally for me.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nuttx-apps] jerpelea commented on pull request #1711: testing/ostest: add test case for task priority change with locked scheduler
Posted by "jerpelea (via GitHub)" <gi...@apache.org>.
jerpelea commented on PR #1711:
URL: https://github.com/apache/nuttx-apps/pull/1711#issuecomment-1531044914
@pkarashchenko please add commit message describing the change
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nuttx-apps] xiaoxiang781216 commented on pull request #1711: testing/ostest: add test case for task priority change with locked scheduler
Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 commented on PR #1711:
URL: https://github.com/apache/nuttx-apps/pull/1711#issuecomment-1519291584
@pkarashchenko please rebase your patch
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nuttx-apps] davids5 commented on a diff in pull request #1711: testing/ostest: add test case for task priority change with locked scheduler
Posted by "davids5 (via GitHub)" <gi...@apache.org>.
davids5 commented on code in PR #1711:
URL: https://github.com/apache/nuttx-apps/pull/1711#discussion_r1171022090
##########
testing/ostest/schedlock.c:
##########
@@ -0,0 +1,259 @@
+/****************************************************************************
+ * apps/testing/ostest/schedlock.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
Review Comment:
Adding a comment block here with the short explanation of what the test method is and what is expected.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org