Skip to contentSkip to conversation

doc: Document process_state

PATCH Superseded Cyril Hrubis 3 participants 25 messages Dec 15, 2025 – Jan 7

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 doc: Document process_state

---
 doc/developers/api_c_tests.rst |  5 ++++
 include/tst_process_state.h    | 55 +++++++++++++++++++++-------------
 2 files changed, 40 insertions(+), 20 deletions(-)

New in v2.

doc/developers/api_c_tests.rst +5 -0
index 2ca0f0464..13fc8651b 100644
@@ -43,6 +43,11 @@ Kernel
 .. kernel-doc:: ../../include/tst_kernel.h
 .. kernel-doc:: ../../include/tst_kvercmp.h
 
+Process state
+-------------
+
+.. kernel-doc:: ../../include/tst_process_state.h
+
 NUMA
 ----
 .. kernel-doc:: ../../include/tst_numa.h
include/tst_process_state.h +35 -20

74 lines not on this page · raw message

Signature · 5 lines
2.51.2


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#1 lore raw

PATCH v2 2/2 doc: Add ground rules page

This is a continued effort to write down the unwritten rules we have in the project. Feel free to suggest more topics for the page.

---
 doc/developers/ground_rules.rst | 91 +++++++++++++++++++++++++++++++++
 doc/index.rst                   |  1 +
 2 files changed, 92 insertions(+)
 create mode 100644 doc/developers/ground_rules.rst

Changes in v2:

- added two more rules
- fixes and typos as pointed out by Peter

doc/developers/ground_rules.rst new file +91 -0
new file mode 100644
index 000000000..2bef426aa
@@ -0,0 +1,91 @@
+.. SPDX-License-Identifier: GPL-2.0-or-later
+
+Ground Rules
+============
+
+Do not work around kernel bugs
+------------------------------
+
+We have decided what we will not work around bugs in upstream LTP sources. If a
+test fails on your system for a good reason, e.g. patch wasn't backported and
+the bug is present, work around for this will not be accepted upstream. The
+main reason for this decision is that this masks the failure for everyone else.
+
+
+Do not synchronize by sleep
+---------------------------
+
+Why is sleep in tests bad then?
+```````````````````````````````
+
+The first problem is that it will likely introduce very rare test failures,
+that means somebody has to spend time looking into these, which is a wasted
+effort. Nobody likes tests that will fail rarely for no good reason. Even more
+so you cannot run such tests with a background load to ensure that everything
+works correctly on a busy system, because that will increase the likehood of a
+failure.
+
+The second problem is that this wastes resources and slows down a test run. If
+you think that adding a sleep to a test is not a big deal, lets have a look at
+the bigger perspective. There is about 1600 syscall tests in Linux Test
+Project, if 7.5% of them would sleep just for one second, we would end up with
+two minutes of wasted time per testrun. In practice most of the test, that
+historically misused sleep for synchronization, waited for much longer just to
+be sure that things will works even on slower hardware. With sleeps between 2
+and 5 seconds that puts us somewhere between 4 and 10 minutes which is between
+13% and 33% of the syscall runtime on an outdated thinkpad, where the run
+finishes in a bit less than half an hour. It's even worse on newer hardware,
+because this slowdown will not change no matter how fast your machine is, which
+is maybe the reason why this was acceptable twenty years ago but it's not now.
+
+
+What to do instead?
+```````````````````
+
+Use proper synchronization.
+
+There are different problems and different solutions. Most often test needs to
+synchronize between child and parent proces.
+
+The easiest case is that parent needs to wait for a child to finish, that can
+be fixed just be adding a :man2:`waitpid` in the parent which ensures that child is
+finished before parent runs.
+
+Commonly child has to execute certain piece of code before parent can continue.
+For that LTP library implements checkpoints with simple
+:c:func:`TST_CHECKPOINT_WAIT()` and :c:func:`TST_CHECKPOINT_WAKE()` functions based
+on futexes on a piece of shared memory set up by the test library.
+
+Another common case is where child must sleep in a syscall before parent can
+continue, for which we have a :c:func:`TST_PROCESS_STATE_WAIT()` helper that
+polls `/proc/$PID/stat`.
+
+Less often test needs to wait for an action that is done asynchronously, or a
+kernel resource deallocation is deferred to a later time. In such cases the
+best we can do is to poll. In LTP we ended up with a macro that polls by
+calling a piece of code in a loop with exponentially increasing sleeps between
+retries until it succeeds. Which means that instead of sleeping for a maximal
+time event can possibly take the sleep is capped by twice of the optimal
+sleeping time while we avoid polling too aggressively.
+
+
+Use runtime checks for kernel features
+======================================
+
+What is and what isn't supported by kernel is determined by the version
+and configuration of the kernel the systems is currently running on.
+That especially means that any checks done during the compilation cannot
+be used to assume features supported by the kernel the tests end up
+running on. The compile time checks, done by configure script, are only
+useful for enabling fallback kernel API definitions when missing, as we
+do in lapi/ directory.
+
+
+Kernel features and RCs
+=======================
+
+LTP tests or fixes for kernel changes that were not released yet can be posted
+to the LTP list for a review but will not be be accepted until respective
+kernel changes are released. Review of such changes is also considered to be
+lower priority than rest of the changes. This is because kernel changes
+especially in the early RC phase are volatile and could be changed or reverted.
doc/index.rst +1 -0
index 06b75616f..659549cc3 100644
@@ -19,6 +19,7 @@
    :hidden:
    :caption: For developers
 
+   developers/ground_rules
    developers/setup_mailinglist
    developers/writing_tests
    developers/test_case_tutorial
Signature · 5 lines
2.51.2


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#2 lore raw

Re: [LTP] [PATCH v2 2/2] doc: Add ground rules page

Quoted 144 lines · Cyril Hrubis

This is a continued effort to write down the unwritten rules we have in the project. Feel free to suggest more topics for the page.

---
 doc/developers/ground_rules.rst | 91 +++++++++++++++++++++++++++++++++
 doc/index.rst                   |  1 +
 2 files changed, 92 insertions(+)
 create mode 100644 doc/developers/ground_rules.rst

Changes in v2:

- added two more rules
- fixes and typos as pointed out by Peter

doc/developers/ground_rules.rst new file +9 -0
new file mode 100644
index 000000000..2bef426aa
@@ -0,0 +1,91 @@
+.. SPDX-License-Identifier: GPL-2.0-or-later
+
+Ground Rules
+============
+
+Do not work around kernel bugs
+------------------------------
+
+We have decided what we will not work around bugs in upstream LTP

sources. If a
+test fails on your system for a good reason, e.g. patch wasn't backported and
+the bug is present, work around for this will not be accepted upstream. The
+main reason for this decision is that this masks the failure for everyone else.

doc/developers/ground_rules.rst new file +9 -0
+
+
+Do not synchronize by sleep
+---------------------------
+
+Why is sleep in tests bad then?
+```````````````````````````````
+
+The first problem is that it will likely introduce very rare test

failures,
+that means somebody has to spend time looking into these, which is a wasted
+effort. Nobody likes tests that will fail rarely for no good reason. Even more
+so you cannot run such tests with a background load to ensure that everything
+works correctly on a busy system, because that will increase the likehood of a

doc/developers/ground_rules.rst new file +3 -0
+failure.
+
+The second problem is that this wastes resources and slows down a test

run. If
+you think that adding a sleep to a test is not a big deal, lets have a look at

doc/developers/ground_rules.rst new file +2 -0
+the bigger perspective. There is about 1600 syscall tests in Linux Test
+Project, if 7.5% of them would sleep just for one second, we would end up

with

doc/developers/ground_rules.rst new file +2 -0
+two minutes of wasted time per testrun. In practice most of the test, that
+historically misused sleep for synchronization, waited for much longer

just to
+be sure that things will works even on slower hardware. With sleeps between 2
+and 5 seconds that puts us somewhere between 4 and 10 minutes which is between
+13% and 33% of the syscall runtime on an outdated thinkpad, where the run +finishes in a bit less than half an hour. It's even worse on newer hardware,
+because this slowdown will not change no matter how fast your machine is, which
+is maybe the reason why this was acceptable twenty years ago but it's not now.

doc/developers/ground_rules.rst new file +8 -0
+
+
+What to do instead?
+```````````````````
+
+Use proper synchronization.
+
+There are different problems and different solutions. Most often test

needs to

doc/developers/ground_rules.rst new file +3 -0
+synchronize between child and parent proces.
+
+The easiest case is that parent needs to wait for a child to finish, that

can
+be fixed just be adding a :man2:waitpid in the parent which ensures that child is

doc/developers/ground_rules.rst new file +3 -0
+finished before parent runs.
+
+Commonly child has to execute certain piece of code before parent can

continue.
+For that LTP library implements checkpoints with simple +:c:func:TST_CHECKPOINT_WAIT() and :c:func:TST_CHECKPOINT_WAKE() functions based

doc/developers/ground_rules.rst new file +3 -0
+on futexes on a piece of shared memory set up by the test library.
+
+Another common case is where child must sleep in a syscall before parent

can
+continue, for which we have a :c:func:TST_PROCESS_STATE_WAIT() helper that

doc/developers/ground_rules.rst new file +3 -0
+polls `/proc/$PID/stat`.
+
+Less often test needs to wait for an action that is done asynchronously,

or a
+kernel resource deallocation is deferred to a later time. In such cases the

doc/developers/ground_rules.rst new file +2 -0
+best we can do is to poll. In LTP we ended up with a macro that polls by
+calling a piece of code in a loop with exponentially increasing sleeps

between
+retries until it succeeds. Which means that instead of sleeping for a maximal

doc/developers/ground_rules.rst new file +20 -0
+time event can possibly take the sleep is capped by twice of the optimal
+sleeping time while we avoid polling too aggressively.
+
+
+Use runtime checks for kernel features
+======================================
+
+What is and what isn't supported by kernel is determined by the version
+and configuration of the kernel the systems is currently running on.
+That especially means that any checks done during the compilation cannot
+be used to assume features supported by the kernel the tests end up
+running on. The compile time checks, done by configure script, are only
+useful for enabling fallback kernel API definitions when missing, as we
+do in lapi/ directory.
+
+
+Kernel features and RCs
+=======================
+
+LTP tests or fixes for kernel changes that were not released yet can be

posted

doc/developers/ground_rules.rst new file +2 -0
+to the LTP list for a review but will not be be accepted until respective
+kernel changes are released. Review of such changes is also considered to

be

doc/developers/ground_rules.rst new file +2 -0
+lower priority than rest of the changes. This is because kernel changes
+especially in the early RC phase are volatile and could be changed or
Quoted 2 lines

reverted.

It's really good to write these rules down, especially since maintainers can reuse them in patch reviews to comment on issues and avoid repeatedly responding to the same questions. Below are what I can think of:

Don’t require root unless it’s essential
============================
If root/caps are needed, say why in the test output. Drop privileges for the part that doesn’t need them (and avoid running the whole test as root “because it’s easier”).

Always clean up, even on failure
==========================
Every test should leave the system as it found it: unmount, restore sysctls, delete temp files/dirs, kill spawned processes, remove cgroups/namespaces, detach loop devices, restore ulimits, etc. Cleanup must run on early-exit paths too.

Respect LTP portability goals
===========================
Avoid nonstandard libc APIs when a portable equivalent exists; don’t assume 64-bit,
page size, endianness, or particular tool versions.

doc/index.rst +0 -0
Quoted 19 lines

index 06b75616f..659549cc3 100644

doc/index.rst +1 -1
@@ -19,6 +19,7 @@
    :hidden:
    :caption: For developers
 
+   developers/ground_rules
    developers/setup_mailinglist
    developers/writing_tests
    developers/test_case_tutorial
--

2.51.2

--
Mailing list info: https://lists.linux.it/listinfo/ltp

Signature · 5 lines
Regards,
Li Wang

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#3 lore raw

Re: [LTP] [PATCH v2 2/2] doc: Add ground rules page

Another *important* rule concerns artificial intelligence. I've noticed some beginners submitting LTP patches directly generated by AI tools. This puts a significant burden on patch review, as AI can sometimes introduce a weird/unreliable perspective into the code.

Be careful when using AI tools
========================
AI tools can be useful for executing, summarizing, or suggesting approaches, but they can also be confidently wrong and give an illusion of correctness. Treat AI output as untrusted: verify claims against the code, documentation, and actual behavior on a reproducer.

Do not send AI-generated changes as raw patches. AI-generated diffs often contain
irrelevant churn, incorrect assumptions, inconsistent style, or subtle bugs, which
creates additional burden for maintainers to review and fix.

Best practice is to write your own patches and have them reviewed by AI before
submitting them, which helps add beneficial improvements to your work.

Signature · 5 lines
Regards,
Li Wang

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#4 lore raw

Re: [LTP] [PATCH v2 2/2] doc: Add ground rules page

Hi!

Quoted 18 lines · Li Wang via ltp

Another *important* rule concerns artificial intelligence. I've noticed some beginners submitting LTP patches directly generated by AI tools. This puts a significant burden on patch review, as AI can sometimes introduce a weird/unreliable perspective into the code.

Be careful when using AI tools
========================
AI tools can be useful for executing, summarizing, or suggesting approaches, but they can also be confidently wrong and give an illusion of correctness. Treat AI output as untrusted: verify claims against the code, documentation, and actual behavior on a reproducer.

Do not send AI-generated changes as raw patches. AI-generated diffs often contain
irrelevant churn, incorrect assumptions, inconsistent style, or subtle bugs, which
creates additional burden for maintainers to review and fix.

Quoted 5 lines

Best practice is to write your own patches and have them reviewed by AI before
submitting them, which helps add beneficial improvements to your work.

+1 for this.

- Andrea

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#5 lore raw

Re: [LTP] [PATCH v2 2/2] doc: Add ground rules page

In reply to Li Wang via ltp
Quoted 6 lines

Another *important* rule concerns artificial intelligence. I've noticed some beginners submitting LTP patches directly generated by AI tools. This puts a significant burden on patch review, as AI can sometimes introduce a weird/unreliable perspective into the code.

Be careful when using AI tools

+1 I like this title.

Quoted 12 lines

========================
AI tools can be useful for executing, summarizing, or suggesting approaches, but they can also be confidently wrong and give an illusion of correctness. Treat AI output as untrusted: verify claims against the code, documentation, and actual behavior on a reproducer.

Do not send AI-generated changes as raw patches. AI-generated diffs often contain
irrelevant churn, incorrect assumptions, inconsistent style, or subtle bugs, which
creates additional burden for maintainers to review and fix.

Quoted 3 lines

Best practice is to write your own patches and have them reviewed by AI before
submitting them, which helps add beneficial improvements to your work.

Hopefully the last paragraph will be understand how it is meant. Because we really don't want to encourage people to send something generated by AI they don't really understand at all. I'd consider not suggesting any AI.

I remember briefly reading kernel folks discussing their policy [1]:

Quoted 2 lines

We cannot keep complaining about maintainer overload and, at the same time, encourage people to bombard us with even more of that stuff.

And another one I can't find any more talking that it's about the trust. If somebody sends wrong patches generated by AI he risks patches will be simply ignored.

Kind regards,
Petr

[1] https://lore.kernel.org/all/[email protected]/

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#6 lore raw

Re: [LTP] [PATCH v2 2/2] doc: Add ground rules page

Hi!

Quoted 24 lines · Petr Vorel
Quoted 6 lines

Another *important* rule concerns artificial intelligence. I've noticed some beginners submitting LTP patches directly generated by AI tools. This puts a significant burden on patch review, as AI can sometimes introduce a weird/unreliable perspective into the code.

Be careful when using AI tools

+1 I like this title.

Quoted 12 lines

========================
AI tools can be useful for executing, summarizing, or suggesting approaches, but they can also be confidently wrong and give an illusion of correctness. Treat AI output as untrusted: verify claims against the code, documentation, and actual behavior on a reproducer.

Do not send AI-generated changes as raw patches. AI-generated diffs often contain
irrelevant churn, incorrect assumptions, inconsistent style, or subtle bugs, which
creates additional burden for maintainers to review and fix.

Quoted 3 lines

Best practice is to write your own patches and have them reviewed by AI before
submitting them, which helps add beneficial improvements to your work.

Quoted 6 lines

Hopefully the last paragraph will be understand how it is meant. Because we really don't want to encourage people to send something generated by AI they don't really understand at all. I'd consider not suggesting any AI.

I remember briefly reading kernel folks discussing their policy [1]:

There's nothing wrong with AI usage nowadays, since it's proven that they can shine on certain specific tasks. In general, code generation works bad, especially inside the kernel development. And in LTP, obviously.

But when it comes to correct commit messages, learning what a certain code is doing or understanding compile errors, they can be useful.

Said so, I like the Li approach, because it gives to AI the right place, without expanding its boundaries which are well defined and well known.

Quoted 11 lines
Quoted 2 lines

We cannot keep complaining about maintainer overload and, at the same time, encourage people to bombard us with even more of that stuff.

And another one I can't find any more talking that it's about the trust. If somebody sends wrong patches generated by AI he risks patches will be simply ignored.

Kind regards,
Petr

[1] https://lore.kernel.org/all/[email protected]/

Signature · 7 lines
Andrea Cervesato
SUSE QE Automation Engineer Linux
[email protected]


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#7 lore raw

Re: [LTP] [PATCH v2 2/2] doc: Add ground rules page

Quoted 40 lines · Andrea Cervesato

Hi!

Quoted 10 lines · Petr Vorel
Quoted 6 lines

Another *important* rule concerns artificial intelligence. I've noticed some beginners submitting LTP patches directly generated by AI tools. This puts a significant burden on patch review, as AI can sometimes introduce a weird/unreliable perspective into the code.

Be careful when using AI tools

+1 I like this title.

Quoted 2 lines

========================
AI tools can be useful for executing, summarizing, or suggesting

approaches,

Quoted 1 line
Quoted 1 line

but they can also be confidently wrong and give an illusion of

correctness.

Quoted 1 line
Quoted 1 line

Treat AI output as untrusted: verify claims against the code,

documentation,

Quoted 3 lines
Quoted 3 lines

and actual behavior on a reproducer.

Do not send AI-generated changes as raw patches. AI-generated diffs

often

Quoted 10 lines
Quoted 8 lines

contain
irrelevant churn, incorrect assumptions, inconsistent style, or subtle bugs, which
creates additional burden for maintainers to review and fix.

Best practice is to write your own patches and have them reviewed by AI before
submitting them, which helps add beneficial improvements to your work.

Hopefully the last paragraph will be understand how it is meant. Because

we

Quoted 1 line

really don't want to encourage people to send something generated by AI

they

Quoted 4 lines

don't really understand at all. I'd consider not suggesting any AI.

I remember briefly reading kernel folks discussing their policy [1]:

Quoted 8 lines

There's nothing wrong with AI usage nowadays, since it's proven that they can shine on certain specific tasks. In general, code generation works bad, especially inside the kernel development. And in LTP, obviously.

But when it comes to correct commit messages, learning what a certain code is doing or understanding compile errors, they can be useful.

Exactly!

Using AI wisely can speed up debugging work, but user experience is ultimately needed to determine its correctness.

Quoted 3 lines

Said so, I like the Li approach, because it gives to AI the right place, without expanding its boundaries which are well defined and well known.

Thanks!

Signature · 5 lines
Regards,
Li Wang

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#8 lore raw

Re: [LTP] [PATCH v2 2/2] doc: Add ground rules page

In reply to Petr Vorel
Quoted 42 lines · Petr Vorel
Quoted 6 lines

Another *important* rule concerns artificial intelligence. I've noticed some beginners submitting LTP patches directly generated by AI tools. This puts a significant burden on patch review, as AI can sometimes introduce a weird/unreliable perspective into the code.

Be careful when using AI tools

+1 I like this title.

Quoted 2 lines

========================
AI tools can be useful for executing, summarizing, or suggesting

approaches,

Quoted 1 line

but they can also be confidently wrong and give an illusion of

correctness.

Quoted 1 line

Treat AI output as untrusted: verify claims against the code,

documentation,

Quoted 11 lines

and actual behavior on a reproducer.

Do not send AI-generated changes as raw patches. AI-generated diffs often contain
irrelevant churn, incorrect assumptions, inconsistent style, or subtle bugs, which
creates additional burden for maintainers to review and fix.

Best practice is to write your own patches and have them reviewed by AI before
submitting them, which helps add beneficial improvements to your work.

Hopefully the last paragraph will be understand how it is meant. Because we really don't want to encourage people to send something generated by AI they
don't really understand at all. I'd consider not suggesting any AI.

I remember briefly reading kernel folks discussing their policy [1]:

Quoted 2 lines

We cannot keep complaining about maintainer overload and, at the same time, encourage people to bombard us with even more of that stuff.

And another one I can't find any more talking that it's about the trust. If somebody sends wrong patches generated by AI he risks patches will be simply
ignored.

Quoted 8 lines

Kind regards,
Petr

[1]
https://lore.kernel.org/all/[email protected]/

What a coincidence! I just spoke face-to-face with David Hildenbrand at LPC last Friday. He expressed concerns about the increasing amount of AI-generated code being sent to the LKML, pointing out that it does indeed place a considerable review burden on maintainers. Moreover, he himself rarely uses AI.

Furthermore, some experts at Huawei told me that they only allow patch senders to review patches before sending them, but do not permit the use of AI-generated code.

And, of course, clearly flagging content as AI-generated code in the patch might help.

Signature · 5 lines
Regards,
Li Wang

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#9 lore raw

Re: [LTP] [PATCH v2 2/2] doc: Add ground rules page

...

Quoted 9 lines
Quoted 2 lines

[1]
https://lore.kernel.org/all/[email protected]/

What a coincidence! I just spoke face-to-face with David Hildenbrand at LPC last Friday. He expressed concerns about the increasing amount of AI-generated code being sent to the LKML, pointing out that it does indeed place a considerable review burden on maintainers. Moreover, he himself rarely uses AI.

Nice :).

"DoS kernel maintainers with AI slop" is a real danger.

Quoted 3 lines

Furthermore, some experts at Huawei told me that they only allow patch senders to review patches before sending them, but do not permit the use of AI-generated code.

+1. Is that due "AI slop" or legal issues?

While I also share the fear of "AI slop", I was surprised that QEMU really strictly bans AI generated code due legal issues. I wonder if kernel endup the same as well.

https://www.qemu.org/docs/master/devel/code-provenance.html#use-of-ai-generated-content

Quoted 2 lines

And, of course, clearly flagging content as AI-generated code in the patch might help.

+1.

IMHO using AI for help with manual work, e.g. converting docs from asciidoc to RST format is ok. For me the question is whether it can be used for generating a test code (new tests from scratch, rewrite into into new API which is often clearer write from scratch).

Anyway, because we already had some AI generated patches it'd be good to have an AI policy. But I would like not to block this patchset it (it'd be nice to get the patchset merged before Christmas and solve AI policy afterwards).

Kind regards,
Petr

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#10 lore raw

Re: [LTP] [PATCH v2 2/2] doc: Add ground rules page

Quoted 14 lines · Petr Vorel

...

Quoted 2 lines
Quoted 2 lines

[1]

https://lore.kernel.org/all/[email protected]/

Quoted 5 lines

What a coincidence! I just spoke face-to-face with David Hildenbrand at LPC last Friday. He expressed concerns about the increasing amount of AI-generated code being sent to the LKML, pointing out that it does indeed place a considerable review burden on maintainers. Moreover, he himself rarely uses AI.

Nice :).

Quoted 8 lines

"DoS kernel maintainers with AI slop" is a real danger.

Quoted 3 lines

Furthermore, some experts at Huawei told me that they only allow patch senders to review patches before sending them, but do not permit the use of AI-generated code.

+1. Is that due "AI slop" or legal issues?

Due "AI slop", cuz mostly nowadays AI is unable to perfectly generate suitable
code for complex projects such as kernels. They only used it in the first round
of patch review.

Quoted 8 lines

While I also share the fear of "AI slop", I was surprised that QEMU really strictly bans AI generated code due legal issues. I wonder if kernel endup the
same as well.

https://www.qemu.org/docs/master/devel/code-provenance.html#use-of-ai-generated-content

Quoted 8 lines
Quoted 1 line

And, of course, clearly flagging content as AI-generated code in the

patch

Quoted 1 line

might help.

+1.

IMHO using AI for help with manual work, e.g. converting docs from asciidoc

Yes.

to RST format is ok. For me the question is whether it can be used for

Quoted 4 lines

generating a test code (new tests from scratch, rewrite into into new API which
is often clearer write from scratch).

I don't think AI can write better code than mankind for the whole test, it might offer suggestions for a piece of function.

Just like Ying Huang (From Alibaba) spoke to me:
"I found that AI performs better only when I break the work down into atomic units."

Therefore, it's especially important to rely on engineers' experience to clearly understand what problems are hindering them and how to communicate with AI.

Quoted 7 lines

Anyway, because we already had some AI generated patches it'd be good to have an
AI policy. But I would like not to block this patchset it (it'd be nice to get
the patchset merged before Christmas and solve AI policy afterwards).

+1

Signature · 5 lines
Regards,
Li Wang

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#11 lore raw

Re: [LTP] [PATCH v2 2/2] doc: Add ground rules page

Quoted 4 lines

Just like Ying Huang (From Alibaba) spoke to me:
"I found that AI performs better only when I break the work down into atomic units."

The problem I have with this approach is that there's a risk of "dumb effect", where an engineer will rely on AI so much to forget how to write 100 lines of clean code.

Quoted 4 lines

Therefore, it's especially important to rely on engineers' experience to clearly understand what problems are hindering them and how to communicate with AI.

I agree with this. Boring, repetitive tasks is why we created automation and AI is a part of it. Let's give it the right space and we won't end working double because of AI madness :-)

This part of documentation is needed and it would be nice to have it already by the end of the year. WDYT?

Signature · 7 lines
Andrea Cervesato
SUSE QE Automation Engineer Linux
[email protected]


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#12 lore raw

Re: [LTP] [PATCH v2 2/2] doc: Add ground rules page

Quoted 9 lines · Andrea Cervesato
Quoted 4 lines

Just like Ying Huang (From Alibaba) spoke to me:
"I found that AI performs better only when I break the work down into atomic units."

The problem I have with this approach is that there's a risk of "dumb effect", where an engineer will rely on AI so much to forget how to write 100 lines of clean code.

That's absolutely right.

Quoted 6 lines
Quoted 5 lines

Therefore, it's especially important to rely on engineers' experience to clearly understand what problems are hindering them and how to communicate with AI.

Quoted 7 lines

I agree with this. Boring, repetitive tasks is why we created automation and AI is a part of it. Let's give it the right space and we won't end working double because of AI madness :-)

This part of documentation is needed and it would be nice to have it already by the end of the year. WDYT?

I agree. In conclusion, we need a specific AI rule for LTP community.

Signature · 5 lines
Regards,
Li Wang

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#13 lore raw

Re: [LTP] [PATCH v2 2/2] doc: Add ground rules page

In reply to Li Wang via ltp

Hi!

Quoted 19 lines

It's really good to write these rules down, especially since maintainers can reuse them in patch reviews to comment on issues and avoid repeatedly responding to the same questions. Below are what I can think of:

Don’t require root unless it’s essential
============================
If root/caps are needed, say why in the test output. Drop privileges for the part that doesn’t need them (and avoid running the whole test as root “because it’s easier”).

Always clean up, even on failure
==========================
Every test should leave the system as it found it: unmount, restore sysctls, delete temp files/dirs, kill spawned processes, remove cgroups/namespaces, detach loop devices, restore ulimits, etc. Cleanup must run on early-exit paths too.

Quoted 5 lines

Respect LTP portability goals
===========================
Avoid nonstandard libc APIs when a portable equivalent exists; don’t assume 64-bit,
page size, endianness, or particular tool versions.

Shall I send a V3 with these included, or do you want to send a patch on the top of the one I send?

Signature · 5 lines
Cyril Hrubis
[email protected]

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#14 lore raw

Re: [LTP] [PATCH v2 2/2] doc: Add ground rules page

Quoted 25 lines · Cyril Hrubis

Hi!

Quoted 11 lines

It's really good to write these rules down, especially since maintainers can reuse them in patch reviews to comment on issues and avoid repeatedly responding to the same questions. Below are what I can think of:

Don’t require root unless it’s essential
============================
If root/caps are needed, say why in the test output. Drop privileges for the part that doesn’t need them (and avoid running the whole test as root “because it’s easier”).

Quoted 3 lines

Always clean up, even on failure
==========================
Every test should leave the system as it found it: unmount, restore

sysctls,

Quoted 1 line

delete temp files/dirs, kill spawned processes, remove

cgroups/namespaces,

Quoted 7 lines

detach loop devices, restore ulimits, etc. Cleanup must run on early-exit paths too.

Respect LTP portability goals
===========================
Avoid nonstandard libc APIs when a portable equivalent exists; don’t

Quoted 7 lines

assume

Quoted 2 lines

64-bit,
page size, endianness, or particular tool versions.

Shall I send a V3 with these included, or do you want to send a patch on the top of the one I send?

Cyril, you can add those topics we discussed into your patch v3 directly.

Signature · 5 lines
Regards,
Li Wang

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#15 lore raw

Re: [LTP] [PATCH v2 2/2] doc: Add ground rules page

In reply to Li Wang via ltp

Hi all,

Quoted 3 lines

It's really good to write these rules down, especially since maintainers can reuse them in patch reviews to comment on issues and avoid repeatedly responding to the same questions. Below are what I can think of:

+1

Quoted 15 lines

Don’t require root unless it’s essential
============================
If root/caps are needed, say why in the test output. Drop privileges for the part that doesn’t need them (and avoid running the whole test as root “because it’s easier”).

Always clean up, even on failure
==========================
Every test should leave the system as it found it: unmount, restore sysctls, delete temp files/dirs, kill spawned processes, remove cgroups/namespaces, detach loop devices, restore ulimits, etc. Cleanup must run on early-exit paths too.

Quoted 5 lines

Respect LTP portability goals
===========================
Avoid nonstandard libc APIs when a portable equivalent exists; don’t assume 64-bit,
page size, endianness, or particular tool versions.

+1.
I would also mention POSIX shell compatibility.

Maybe also mention 'make check'.

"No regressions"
================
Each commit needs to compile. None commit can actually deliberately break tests.

As the document is getting quite big, I'd put AI policy into separate page.

Kind regards,
Petr

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#16 lore raw

Re: [LTP] [PATCH v2 2/2] doc: Add ground rules page

In reply to Cyril Hrubis

Hi!

In general I like the idea, but many sentences can be shorten. I didn't use AI for this review, but usually they work pretty well on spotting errors and english mistakes and it might be a good idea to review it first with that.

Some comments below.

Quoted 62 lines · Cyril Hrubis

This is a continued effort to write down the unwritten rules we have in the project. Feel free to suggest more topics for the page.

---
 doc/developers/ground_rules.rst | 91 +++++++++++++++++++++++++++++++++
 doc/index.rst                   |  1 +
 2 files changed, 92 insertions(+)
 create mode 100644 doc/developers/ground_rules.rst

Changes in v2:

- added two more rules
- fixes and typos as pointed out by Peter

doc/developers/ground_rules.rst new file +41 -0
new file mode 100644
index 000000000..2bef426aa
@@ -0,0 +1,91 @@
+.. SPDX-License-Identifier: GPL-2.0-or-later
+
+Ground Rules
+============
+
+Do not work around kernel bugs
+------------------------------
+
+We have decided what we will not work around bugs in upstream LTP sources. If a
+test fails on your system for a good reason, e.g. patch wasn't backported and
+the bug is present, work around for this will not be accepted upstream. The
+main reason for this decision is that this masks the failure for everyone else.
+
+
+Do not synchronize by sleep
+---------------------------
+
+Why is sleep in tests bad then?
+```````````````````````````````
+
+The first problem is that it will likely introduce very rare test failures,
+that means somebody has to spend time looking into these, which is a wasted
+effort. Nobody likes tests that will fail rarely for no good reason. Even more
+so you cannot run such tests with a background load to ensure that everything
+works correctly on a busy system, because that will increase the likehood of a
+failure.
+
+The second problem is that this wastes resources and slows down a test run. If
+you think that adding a sleep to a test is not a big deal, lets have a look at
+the bigger perspective. There is about 1600 syscall tests in Linux Test
+Project, if 7.5% of them would sleep just for one second, we would end up with
+two minutes of wasted time per testrun. In practice most of the test, that
+historically misused sleep for synchronization, waited for much longer just to
+be sure that things will works even on slower hardware. With sleeps between 2
+and 5 seconds that puts us somewhere between 4 and 10 minutes which is between
+13% and 33% of the syscall runtime on an outdated thinkpad, where the run
+finishes in a bit less than half an hour. It's even worse on newer hardware,
+because this slowdown will not change no matter how fast your machine is, which
+is maybe the reason why this was acceptable twenty years ago but it's not now.
+
+

doc/developers/ground_rules.rst line 51

Quoted 10 lines
doc/developers/ground_rules.rst new file +10 -0
+What to do instead?
+```````````````````
+
+Use proper synchronization.
+
+There are different problems and different solutions. Most often test needs to
+synchronize between child and parent proces.
+
+The easiest case is that parent needs to wait for a child to finish, that can
+be fixed just be adding a :man2:`waitpid` in the parent which ensures that child is

^ by ^ . This ensures

doc/developers/ground_rules.rst line 54

Quoted 3 lines
doc/developers/ground_rules.rst new file +3 -0
+finished before parent runs.
+
+Commonly child has to execute certain piece of code before parent can continue.
           ^ ,

doc/developers/ground_rules.rst line 55

Quoted 1 line
doc/developers/ground_rules.rst new file +1 -0
+For that LTP library implements checkpoints with simple

In these cases, LTP library implements..

doc/developers/ground_rules.rst line 60

Quoted 5 lines
doc/developers/ground_rules.rst new file +5 -0
+:c:func:`TST_CHECKPOINT_WAIT()` and :c:func:`TST_CHECKPOINT_WAKE()` functions based
+on futexes on a piece of shared memory set up by the test library.
+
+Another common case is where child must sleep in a syscall before parent can
+continue, for which we have a :c:func:`TST_PROCESS_STATE_WAIT()` helper that

^ . In this case we have..

doc/developers/ground_rules.rst line 69

Quoted 9 lines
doc/developers/ground_rules.rst new file +9 -0
+polls `/proc/$PID/stat`.
+
+Less often test needs to wait for an action that is done asynchronously, or a
+kernel resource deallocation is deferred to a later time. In such cases the
+best we can do is to poll. In LTP we ended up with a macro that polls by
+calling a piece of code in a loop with exponentially increasing sleeps between
+retries until it succeeds. Which means that instead of sleeping for a maximal
+time event can possibly take the sleep is capped by twice of the optimal
+sleeping time while we avoid polling too aggressively.

Less often, tests need to wait for an action that is done asynchronously or they need to wait for a kernel resource deallocation. In such cases, the best we can do is using polling mechanism. In LTP we have a macro that loops over a piece of code, exponentially increasing sleeps between retries until succeed.

-> it would be nice to add the link to it.

----
For the entire section I would put a bullet points list.

doc/developers/ground_rules.rst line 76

Quoted 7 lines
doc/developers/ground_rules.rst new file +7 -0
+
+
+Use runtime checks for kernel features
+======================================
+
+What is and what isn't supported by kernel is determined by the version
+and configuration of the kernel the systems is currently running on.

Supported kernel features are determined by version and configuration of the kernel running on the system.

doc/developers/ground_rules.rst line 81

Quoted 5 lines
doc/developers/ground_rules.rst new file +5 -0
+That especially means that any checks done during the compilation cannot
+be used to assume features supported by the kernel the tests end up
+running on. The compile time checks, done by configure script, are only
+useful for enabling fallback kernel API definitions when missing, as we
+do in lapi/ directory.

This means that kernel features can't be always checked at compile-time. Please keep compile-time checks only for fallback kernel API definitions, when needed. -> (reference to lapi?)

doc/developers/ground_rules.rst line 91

Quoted 10 lines
doc/developers/ground_rules.rst new file +10 -0
+
+
+Kernel features and RCs
+=======================
+
+LTP tests or fixes for kernel changes that were not released yet can be posted
+to the LTP list for a review but will not be be accepted until respective
+kernel changes are released. Review of such changes is also considered to be
+lower priority than rest of the changes. This is because kernel changes
+especially in the early RC phase are volatile and could be changed or reverted.

LTP tests for new kernel features inside the mainline can be sent to the mailing list, but they will get a low priority in the review process due to the highly volatile nature of Linux kernel before release.

Quoted 12 lines
doc/index.rst +1 -0
index 06b75616f..659549cc3 100644
@@ -19,6 +19,7 @@
    :hidden:
    :caption: For developers
 
+   developers/ground_rules
    developers/setup_mailinglist
    developers/writing_tests
    developers/test_case_tutorial
Signature · 7 lines
Andrea Cervesato
SUSE QE Automation Engineer Linux
[email protected]


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
Reviewed-by on v2 2/2
#17 lore raw

Re: [LTP] [PATCH v2 2/2] doc: Add ground rules page

In reply to Cyril Hrubis

Hi Cyril,

Thanks, very nice doc!

Few more style/typo/grammar notes below. Found by chatgpt, I picked just few of them which looked to me significant (obviously AI would improve the style, but lets ignore that). Feel free to ignore, otherwise just amend before merge. Labels "typo:" or "grammar:" should probably be fixed.

AI also suggests to use often articles, e.g. for "parent" and "child" (mostly "the", sometimes "a"), but let's ignore that.

Quoted 1 line

+We have decided what we will not work around bugs in upstream LTP sources. If a

decided what => decided that

...

Quoted 1 line

+Why is sleep in tests bad then?

Missing "using", also maybe more formal (it's not a blog post but official doc):
Why is using sleep in tests bad?

Quoted 1 line

+```````````````````````````````

...

doc/developers/ground_rules.rst line 30

Quoted 3 lines
doc/developers/ground_rules.rst new file +3 -0
+The second problem is that this wastes resources and slows down a test run. If
+you think that adding a sleep to a test is not a big deal, lets have a look at
+the bigger perspective. There is about 1600 syscall tests in Linux Test

grammar (plural): There is about 1600 => There are about 1600 (You have it wrong also in your blog post.)

doc/developers/ground_rules.rst line 35

Quoted 5 lines
doc/developers/ground_rules.rst new file +5 -0
+Project, if 7.5% of them would sleep just for one second, we would end up with
+two minutes of wasted time per testrun. In practice most of the test, that
+historically misused sleep for synchronization, waited for much longer just to
+be sure that things will works even on slower hardware. With sleeps between 2
+and 5 seconds that puts us somewhere between 4 and 10 minutes which is between

And here "sleeps" is plural, maybe: puts => put.
Or maybe just use "sleep"?

doc/developers/ground_rules.rst line 48

Quoted 13 lines

+13% and 33% of the syscall runtime on an outdated thinkpad, where the run

doc/developers/ground_rules.rst new file +12 -0
+finishes in a bit less than half an hour. It's even worse on newer hardware,
+because this slowdown will not change no matter how fast your machine is, which
+is maybe the reason why this was acceptable twenty years ago but it's not now.
+
+
+What to do instead?
+```````````````````
+
+Use proper synchronization.
+
+There are different problems and different solutions. Most often test needs to
+synchronize between child and parent proces.

typo: proces => process

Review

Quoted 2 lines
(quoted diff) +2 -0
+
+The easiest case is that parent needs to wait for a child to finish, that can

that parent => when parent

doc/developers/ground_rules.rst line 52

Quoted 2 lines
doc/developers/ground_rules.rst new file +2 -0
+be fixed just be adding a :man2:`waitpid` in the parent which ensures that child is
+finished before parent runs.

"child is finished" => "child finished" (or "child has finished")

doc/developers/ground_rules.rst line 59

Quoted 7 lines
doc/developers/ground_rules.rst new file +7 -0
+
+Commonly child has to execute certain piece of code before parent can continue.
+For that LTP library implements checkpoints with simple
+:c:func:`TST_CHECKPOINT_WAIT()` and :c:func:`TST_CHECKPOINT_WAKE()` functions based
+on futexes on a piece of shared memory set up by the test library.
+
+Another common case is where child must sleep in a syscall before parent can

"where child" => "when child"

doc/developers/ground_rules.rst line 64

Quoted 5 lines
doc/developers/ground_rules.rst new file +5 -0
+continue, for which we have a :c:func:`TST_PROCESS_STATE_WAIT()` helper that
+polls `/proc/$PID/stat`.
+
+Less often test needs to wait for an action that is done asynchronously, or a
+kernel resource deallocation is deferred to a later time. In such cases the

"a kernel resource deallocation is deferred to a later time" Maybe:
"for kernel resource deallocation that is deferred to a later time"

doc/developers/ground_rules.rst line 76

Quoted 12 lines
doc/developers/ground_rules.rst new file +12 -0
+best we can do is to poll. In LTP we ended up with a macro that polls by
+calling a piece of code in a loop with exponentially increasing sleeps between
+retries until it succeeds. Which means that instead of sleeping for a maximal
+time event can possibly take the sleep is capped by twice of the optimal
+sleeping time while we avoid polling too aggressively.
+
+
+Use runtime checks for kernel features
+======================================
+
+What is and what isn't supported by kernel is determined by the version
+and configuration of the kernel the systems is currently running on.

grammar (singular): "systems is ... running on." => "system is ... running."

doc/developers/ground_rules.rst line 87

Quoted 11 lines
doc/developers/ground_rules.rst new file +11 -0
+That especially means that any checks done during the compilation cannot
+be used to assume features supported by the kernel the tests end up
+running on. The compile time checks, done by configure script, are only
+useful for enabling fallback kernel API definitions when missing, as we
+do in lapi/ directory.
+
+
+Kernel features and RCs
+=======================
+
+LTP tests or fixes for kernel changes that were not released yet can be posted

grammar (present perfect): "were not released yet can" => "have not yet been released may"

Quoted 1 line

+to the LTP list for a review but will not be be accepted until respective

"review but will" => "review but they will"

Kind regards,
Petr

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#18 lore raw

Re: [LTP] [PATCH v2 2/2] doc: Add ground rules page

In reply to Cyril Hrubis

Hi Cyril,

Few more notes.
...

doc/developers/ground_rules.rst line 79

Quoted 8 lines
doc/developers/ground_rules.rst new file +8 -0
+Use runtime checks for kernel features
+======================================
+
+What is and what isn't supported by kernel is determined by the version
+and configuration of the kernel the systems is currently running on.
+That especially means that any checks done during the compilation cannot
+be used to assume features supported by the kernel the tests end up
+running on. The compile time checks, done by configure script, are only

Also please use link to the script:

-running on. The compile time checks, done by configure script, are only +running on. The compile time checks, done by :master:configure.ac, are only

doc/developers/ground_rules.rst line 81

Quoted 2 lines
doc/developers/ground_rules.rst new file +2 -0
+useful for enabling fallback kernel API definitions when missing, as we
+do in lapi/ directory.

And to the lapi directory:

-do in lapi/ directory.
+do in headers in :master:include/lapi/.

(I'm not sure whether you just overlooked it or you don't see it useful.)

doc/developers/ground_rules.rst line 91

Quoted 8 lines
doc/developers/ground_rules.rst new file +8 -0
+Kernel features and RCs
+=======================
+
+LTP tests or fixes for kernel changes that were not released yet can be posted
+to the LTP list for a review but will not be be accepted until respective
+kernel changes are released. Review of such changes is also considered to be
+lower priority than rest of the changes. This is because kernel changes
+especially in the early RC phase are volatile and could be changed or reverted.

I would personally mention staging runtest file, but maybe I overlook your

:master:runtest/staging

Kind regards,
Petr

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Reviewed-by on v2 1/2
#19 lore raw
In reply to Cyril Hrubis
Quoted 40 lines
---
 doc/developers/api_c_tests.rst |  5 ++++
 include/tst_process_state.h    | 55 +++++++++++++++++++++-------------
 2 files changed, 40 insertions(+), 20 deletions(-)

New in v2.

doc/developers/api_c_tests.rst +5 -0
index 2ca0f0464..13fc8651b 100644
@@ -43,6 +43,11 @@ Kernel
 .. kernel-doc:: ../../include/tst_kernel.h
 .. kernel-doc:: ../../include/tst_kvercmp.h
 
+Process state
+-------------
+
+.. kernel-doc:: ../../include/tst_process_state.h
+
 NUMA
 ----
 .. kernel-doc:: ../../include/tst_numa.h
include/tst_process_state.h +4 -3
index b1d83e109..3691bba7a 100644
@@ -15,39 +15,54 @@
 
 #ifdef TST_TEST_H__
 
-/*
- * Waits for process state change.
+/**
+ * TST_PROCESS_STATE_WAIT() - Waits for a process state change.
+ *
+ * Polls `/proc/$PID/state` for a process state changes.
  *
- * The state is one of the following:

include/tst_process_state.h line 27

Quoted 10 lines
include/tst_process_state.h +4 -5
+ * @pid: A process pid.
+ * @state: A state to wait for.
+ * @msec_timeout: A timeout for the wait.
  *
- * R - process is running
- * S - process is sleeping
- * D - process sleeping uninterruptibly
- * Z - zombie process
- * T - process is traced
+ * Possible process states:

Maybe: use link to https://man7.org/linux/man-pages/man1/ps.1.html ?

-* Possible process states:
+* Possible process states (see :man1:ps):

include/tst_process_state.h line 35

Quoted 8 lines
include/tst_process_state.h +8 -0
+ *
+ * - **R** Process is running.
+ * - **S** Process is sleeping.
+ * - **D** Process sleeping uninterruptibly.
+ * - **Z** Zombie process.
+ * - **T** Process is traced.
+ * - **t** Tracing stopped.
+ * - **X** Process id dead.

Process state is outdated, man ps(1) lists:

               D    uninterruptible sleep (usually I/O)
               I    idle kernel thread
               R    running or runnable (on run queue)
               S    interruptible sleep (waiting for an

event to complete)
T stopped by job control signal
t stopped by debugger during the tracing
W paging (not valid since Linux 2.6)
X dead (should never be seen)
Z defunct (“zombie”) process, terminated
but not reaped by its parent

We miss:
* I (from kernel 4.2, maybe not relevant when we use it for a child which is userspace)
* W (irrelevant as it is not valid)
* Z

Also, do we want specify the process states in both TST_PROCESS_STATE_WAIT() and TST_THREAD_STATE_WAIT(), or just specify it in one and mention in the other that they specify it? (via :ref: or c:func:).

Otherwise LGTM.

Kind regards,
Petr

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#20 lore raw

Hi!

Quoted 52 lines
Quoted 40 lines
---
 doc/developers/api_c_tests.rst |  5 ++++
 include/tst_process_state.h    | 55 +++++++++++++++++++++-------------
 2 files changed, 40 insertions(+), 20 deletions(-)

New in v2.

doc/developers/api_c_tests.rst +5 -0
index 2ca0f0464..13fc8651b 100644
@@ -43,6 +43,11 @@ Kernel
 .. kernel-doc:: ../../include/tst_kernel.h
 .. kernel-doc:: ../../include/tst_kvercmp.h
 
+Process state
+-------------
+
+.. kernel-doc:: ../../include/tst_process_state.h
+
 NUMA
 ----
 .. kernel-doc:: ../../include/tst_numa.h
include/tst_process_state.h +4 -3
index b1d83e109..3691bba7a 100644
@@ -15,39 +15,54 @@
 
 #ifdef TST_TEST_H__
 
-/*
- * Waits for process state change.
+/**
+ * TST_PROCESS_STATE_WAIT() - Waits for a process state change.
+ *
+ * Polls `/proc/$PID/state` for a process state changes.
  *
- * The state is one of the following:

include/tst_process_state.h line 27

Quoted 10 lines
include/tst_process_state.h +4 -5
+ * @pid: A process pid.
+ * @state: A state to wait for.
+ * @msec_timeout: A timeout for the wait.
  *
- * R - process is running
- * S - process is sleeping
- * D - process sleeping uninterruptibly
- * Z - zombie process
- * T - process is traced
+ * Possible process states:

Maybe: use link to https://man7.org/linux/man-pages/man1/ps.1.html ?

Review

Quoted 2 lines
(quoted diff) +1 -1
-* Possible process states:
+* Possible process states (see :man1:`ps`):

1. We do not have man1 defined in exlinks in conf.py

2. Even if added there exlinks does not seem work from documentation generated from headers

Quoted 23 lines

include/tst_process_state.h line 35

Quoted 8 lines
include/tst_process_state.h +8 -0
+ *
+ * - **R** Process is running.
+ * - **S** Process is sleeping.
+ * - **D** Process sleeping uninterruptibly.
+ * - **Z** Zombie process.
+ * - **T** Process is traced.
+ * - **t** Tracing stopped.
+ * - **X** Process id dead.

Process state is outdated, man ps(1) lists:

               D    uninterruptible sleep (usually I/O)
               I    idle kernel thread
               R    running or runnable (on run queue)
               S    interruptible sleep (waiting for an

event to complete)
T stopped by job control signal
t stopped by debugger during the tracing
W paging (not valid since Linux 2.6)
X dead (should never be seen)
Z defunct (“zombie”) process, terminated
but not reaped by its parent

Quoted 4 lines

We miss:
* I (from kernel 4.2, maybe not relevant when we use it for a child which is userspace)
* W (irrelevant as it is not valid)

Indeed these are not relevent for us.

Quoted 1 line

* Z

Zombie process is described in the list.

Quoted 3 lines

Also, do we want specify the process states in both TST_PROCESS_STATE_WAIT() and TST_THREAD_STATE_WAIT(), or just specify it in one and mention in the other that they specify it? (via :ref: or c:func:).

Again, none of the :ref: or c:func: is working in docs generate from headers.

Signature · 5 lines
Cyril Hrubis
[email protected]

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#21 lore raw

Hi!

Quoted 8 lines
Quoted 8 lines
Quoted 6 lines

- * R - process is running
- * S - process is sleeping
- * D - process sleeping uninterruptibly
- * Z - zombie process
- * T - process is traced
+ * Possible process states:

Maybe: use link to https://man7.org/linux/man-pages/man1/ps.1.html ?

Quoted 7 lines

Review

Quoted 2 lines
(quoted diff) +1 -1
-* Possible process states:
+* Possible process states (see :man1:`ps`):

1. We do not have man1 defined in exlinks in conf.py

2. Even if added there exlinks does not seem work from documentation generated from headers

This actually works, once I fixed typo in the conf.py change.

Quoted 31 lines
Quoted 22 lines
Quoted 7 lines

+ * - **R** Process is running.
+ * - **S** Process is sleeping.
+ * - **D** Process sleeping uninterruptibly.
+ * - **Z** Zombie process.
+ * - **T** Process is traced.
+ * - **t** Tracing stopped.
+ * - **X** Process id dead.

Process state is outdated, man ps(1) lists:

               D    uninterruptible sleep (usually I/O)
               I    idle kernel thread
               R    running or runnable (on run queue)
               S    interruptible sleep (waiting for an

event to complete)
T stopped by job control signal
t stopped by debugger during the tracing
W paging (not valid since Linux 2.6)
X dead (should never be seen)
Z defunct (“zombie”) process, terminated
but not reaped by its parent

Quoted 4 lines

We miss:
* I (from kernel 4.2, maybe not relevant when we use it for a child which is userspace)
* W (irrelevant as it is not valid)

Indeed these are not relevent for us.

Quoted 1 line

* Z

Quoted 8 lines

Zombie process is described in the list.

Quoted 3 lines

Also, do we want specify the process states in both TST_PROCESS_STATE_WAIT() and TST_THREAD_STATE_WAIT(), or just specify it in one and mention in the other that they specify it? (via :ref: or c:func:).

Again, none of the :ref: or c:func: is working in docs generate from headers.

And this one needs to be just TST_PROCESS_STATE_WAIT() to be processed as a link in headers.

Signature · 5 lines
Cyril Hrubis
[email protected]

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#22 lore raw
Quoted 14 lines

Hi!

Quoted 12 lines

Review

Quoted 10 lines
Quoted 6 lines

- * R - process is running
- * S - process is sleeping
- * D - process sleeping uninterruptibly
- * Z - zombie process
- * T - process is traced
+ * Possible process states:

Maybe: use link to https://man7.org/linux/man-pages/man1/ps.1.html ?

(quoted diff) +1 -1
-* Possible process states:
+* Possible process states (see :man1:`ps`):

1. We do not have man1 defined in exlinks in conf.py

Quoted 4 lines
Quoted 2 lines

2. Even if added there exlinks does not seem work from documentation generated from headers

This actually works, once I fixed typo in the conf.py change.

+1

...

Quoted 10 lines
Quoted 10 lines
Quoted 1 line

* Z

Zombie process is described in the list.

Quoted 3 lines

Also, do we want specify the process states in both TST_PROCESS_STATE_WAIT() and TST_THREAD_STATE_WAIT(), or just specify it in one and mention in the other that they specify it? (via :ref: or c:func:).

Again, none of the :ref: or c:func: is working in docs generate from headers.

Maybe c:func: really works only in the headers. I have in my notes :c:func:tst_kvercmp(). We already use in doc/* some :ref: e.g. :ref:struct tst_device or :ref:tst_brk.

Quoted 2 lines

And this one needs to be just TST_PROCESS_STATE_WAIT() to be processed as a link in headers.

Interesting. For me works only :c:func:TST_PROCESS_STATE_WAIT() or :c:func:tst_brk() when adding it into random file (e.g. doc/maintainers/patch_review.rst).

Anyway, thanks for taking care to link it.

Kind regards,
Petr

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#23 lore raw

Hi!

Quoted 6 lines
Quoted 2 lines

And this one needs to be just TST_PROCESS_STATE_WAIT() to be processed as a link in headers.

Interesting. For me works only :c:func:TST_PROCESS_STATE_WAIT() or :c:func:tst_brk() when adding it into random file (e.g. doc/maintainers/patch_review.rst).

I think that the difference is that the headers are translated differently than the rest.

Signature · 5 lines
Cyril Hrubis
[email protected]

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#24 lore raw
Quoted 10 lines

Hi!

Quoted 6 lines
Quoted 2 lines

And this one needs to be just TST_PROCESS_STATE_WAIT() to be processed as a link in headers.

Interesting. For me works only :c:func:TST_PROCESS_STATE_WAIT() or :c:func:tst_brk() when adding it into random file (e.g. doc/maintainers/patch_review.rst).

I think that the difference is that the headers are translated differently than the rest.

Ah, I forget we discuss tst_process_state.h (not api_c_tests.rst), I'm sorry for the noise.

Kind regards,
Petr

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp