<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-toradex.git/scripts/coccicheck, branch v5.19-rc3</title>
<subtitle>Linux kernel for Apalis and Colibri modules</subtitle>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/'/>
<entry>
<title>scripts: coccicheck: fix troubles on non-English builds</title>
<updated>2021-05-18T09:09:59+00:00</updated>
<author>
<name>Mauro Carvalho Chehab</name>
<email>mchehab+huawei@kernel.org</email>
</author>
<published>2021-05-18T09:05:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=f5b3553b5019f22ac668651ea9cddb9fa675ac41'/>
<id>f5b3553b5019f22ac668651ea9cddb9fa675ac41</id>
<content type='text'>
When LANG is not set to English, the logic which checks the
number of CPUs fail, as the messages can be localized, and
the logic at:

    THREADS_PER_CORE=$(lscpu | grep "Thread(s) per core: " | tr -cd "[:digit:]")

will not get the number of threads per core.

This causes the script to not run properly, as it will produce
a warning:

	$ make coccicheck COCCI=$PWD/scripts/coccinelle/misc/add_namespace.cocci MODE=report drivers/media/
	./scripts/coccicheck: linha 93: [: número excessivo de argumentos

Fix it by forcing LANG=C when calling lscpu.

Signed-off-by: Mauro Carvalho Chehab &lt;mchehab+huawei@kernel.org&gt;
Signed-off-by: Julia Lawall &lt;Julia.Lawall@inria.fr&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When LANG is not set to English, the logic which checks the
number of CPUs fail, as the messages can be localized, and
the logic at:

    THREADS_PER_CORE=$(lscpu | grep "Thread(s) per core: " | tr -cd "[:digit:]")

will not get the number of threads per core.

This causes the script to not run properly, as it will produce
a warning:

	$ make coccicheck COCCI=$PWD/scripts/coccinelle/misc/add_namespace.cocci MODE=report drivers/media/
	./scripts/coccicheck: linha 93: [: número excessivo de argumentos

Fix it by forcing LANG=C when calling lscpu.

Signed-off-by: Mauro Carvalho Chehab &lt;mchehab+huawei@kernel.org&gt;
Signed-off-by: Julia Lawall &lt;Julia.Lawall@inria.fr&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>scripts: coccicheck: Correct usage of make coccicheck</title>
<updated>2020-12-24T11:59:43+00:00</updated>
<author>
<name>Sumera Priyadarsini</name>
<email>sylphrenadin@gmail.com</email>
</author>
<published>2020-11-24T20:32:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=d8f6e5c6c83737cfdad46077e614885a3db9e809'/>
<id>d8f6e5c6c83737cfdad46077e614885a3db9e809</id>
<content type='text'>
The command "make coccicheck C=1 CHECK=scripts/coccicheck" results in the
error:
        ./scripts/coccicheck: line 65: -1: shift count out of range

This happens because every time the C variable is specified,
the shell arguments need to be "shifted" in order to take only
the last argument, which is the C file to test. These shell arguments
mostly comprise flags that have been set in the Makefile. However,
when coccicheck is specified in the make command as a rule, the
number of shell arguments is zero, thus passing the invalid value -1
to the shift command, resulting in an error.

Modify coccicheck to print correct usage of make coccicheck so as to
avoid the error.

Signed-off-by: Sumera Priyadarsini &lt;sylphrenadin@gmail.com&gt;
Signed-off-by: Julia Lawall &lt;Julia.Lawall@inria.fr&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The command "make coccicheck C=1 CHECK=scripts/coccicheck" results in the
error:
        ./scripts/coccicheck: line 65: -1: shift count out of range

This happens because every time the C variable is specified,
the shell arguments need to be "shifted" in order to take only
the last argument, which is the C file to test. These shell arguments
mostly comprise flags that have been set in the Makefile. However,
when coccicheck is specified in the make command as a rule, the
number of shell arguments is zero, thus passing the invalid value -1
to the shift command, resulting in an error.

Modify coccicheck to print correct usage of make coccicheck so as to
avoid the error.

Signed-off-by: Sumera Priyadarsini &lt;sylphrenadin@gmail.com&gt;
Signed-off-by: Julia Lawall &lt;Julia.Lawall@inria.fr&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>kbuild: do not use scripts/ld-version.sh for checking spatch version</title>
<updated>2020-12-12T17:31:29+00:00</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2020-12-12T16:54:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=33114c4359592d5c8a3d840eee9ff40039caf26f'/>
<id>33114c4359592d5c8a3d840eee9ff40039caf26f</id>
<content type='text'>
scripts/ld-version.sh was, as its file name implies, originally intended
for the GNU ld version, but is (ab)used for the spatch version too.

Use 'sort -CV' for the version comparison, then coccicheck does not need
to use scripts/ld-version.sh. Fix nsdeps as well.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
Signed-off-by: Julia Lawall &lt;Julia.Lawall@inria.fr&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
scripts/ld-version.sh was, as its file name implies, originally intended
for the GNU ld version, but is (ab)used for the spatch version too.

Use 'sort -CV' for the version comparison, then coccicheck does not need
to use scripts/ld-version.sh. Fix nsdeps as well.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
Signed-off-by: Julia Lawall &lt;Julia.Lawall@inria.fr&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>scripts: coccicheck: Change default condition for parallelism</title>
<updated>2020-10-12T08:37:56+00:00</updated>
<author>
<name>Sumera Priyadarsini</name>
<email>sylphrenadin@gmail.com</email>
</author>
<published>2020-10-11T10:29:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=c5864560d935db879cafa21feca0156d91eba842'/>
<id>c5864560d935db879cafa21feca0156d91eba842</id>
<content type='text'>
Currently, Coccinelle uses at most one thread per core by default in
machines with more than 2 hyperthreads. However, for systems with only 4
hyperthreads, this does not improve performance.

Modify coccicheck to use all available threads in machines with
upto 4 hyperthreads.

Signed-off-by: Sumera Priyadarsini &lt;sylphrenadin@gmail.com&gt;
Signed-off-by: Julia Lawall &lt;Julia.Lawall@inria.fr&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Currently, Coccinelle uses at most one thread per core by default in
machines with more than 2 hyperthreads. However, for systems with only 4
hyperthreads, this does not improve performance.

Modify coccicheck to use all available threads in machines with
upto 4 hyperthreads.

Signed-off-by: Sumera Priyadarsini &lt;sylphrenadin@gmail.com&gt;
Signed-off-by: Julia Lawall &lt;Julia.Lawall@inria.fr&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>scripts: coccicheck: Add quotes to improve portability</title>
<updated>2020-10-12T08:32:40+00:00</updated>
<author>
<name>Sumera Priyadarsini</name>
<email>sylphrenadin@gmail.com</email>
</author>
<published>2020-10-11T10:28:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=2f324dd8ab2e3d8b097f3eac6d380d1adbdbe6e6'/>
<id>2f324dd8ab2e3d8b097f3eac6d380d1adbdbe6e6</id>
<content type='text'>
While fetching the number of threads per core with lscpu,
the [:digit:] set is used for translation of digits from 0-9.
However, using [:digit:] instead of "[:digit:]" does not seem
to work uniformly for some shell types and configurations
(such as zsh).

Therefore, modify coccicheck to use double quotes around the
[:digit:] set for uniformity and better portability.

Signed-off-by: Sumera Priyadarsini &lt;sylphrenadin@gmail.com&gt;
Signed-off-by: Julia Lawall &lt;Julia.Lawall@inria.fr&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
While fetching the number of threads per core with lscpu,
the [:digit:] set is used for translation of digits from 0-9.
However, using [:digit:] instead of "[:digit:]" does not seem
to work uniformly for some shell types and configurations
(such as zsh).

Therefore, modify coccicheck to use double quotes around the
[:digit:] set for uniformity and better portability.

Signed-off-by: Sumera Priyadarsini &lt;sylphrenadin@gmail.com&gt;
Signed-off-by: Julia Lawall &lt;Julia.Lawall@inria.fr&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>scripts: coccicheck: Change default value for parallelism</title>
<updated>2020-09-27T20:52:59+00:00</updated>
<author>
<name>Sumera Priyadarsini</name>
<email>sylphrenadin@gmail.com</email>
</author>
<published>2020-09-24T11:26:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=e16a7c47d56b4eeee82be662014c145bce2380e5'/>
<id>e16a7c47d56b4eeee82be662014c145bce2380e5</id>
<content type='text'>
By default, coccicheck utilizes all available threads to implement
parallelisation. However, when all available threads are used,
a decrease in performance is noted. The elapsed time is  minimum
when at most one thread per core is used.

For example, on benchmarking the semantic patch kfree.cocci for
usb/serial using hyperfine, the outputs obtained for J=5 and J=2
are 1.32 and 1.90 times faster than those for J=10 and J=9
respectively for two separate runs. For the larger drivers/staging
directory, minimium elapsed time is obtained for J=3 which is 1.86
times faster than that for J=12. The optimal J value does not
exceed 6 in any of the test runs. The benchmarks are run on a machine
with 6 cores, with 2 threads per core, i.e, 12 hyperthreads in all.

To improve performance, modify coccicheck to use at most only
one thread per core by default.

Signed-off-by: Sumera Priyadarsini &lt;sylphrenadin@gmail.com&gt;
Signed-off-by: Julia Lawall &lt;Julia.Lawall@inria.fr&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
By default, coccicheck utilizes all available threads to implement
parallelisation. However, when all available threads are used,
a decrease in performance is noted. The elapsed time is  minimum
when at most one thread per core is used.

For example, on benchmarking the semantic patch kfree.cocci for
usb/serial using hyperfine, the outputs obtained for J=5 and J=2
are 1.32 and 1.90 times faster than those for J=10 and J=9
respectively for two separate runs. For the larger drivers/staging
directory, minimium elapsed time is obtained for J=3 which is 1.86
times faster than that for J=12. The optimal J value does not
exceed 6 in any of the test runs. The benchmarks are run on a machine
with 6 cores, with 2 threads per core, i.e, 12 hyperthreads in all.

To improve performance, modify coccicheck to use at most only
one thread per core by default.

Signed-off-by: Sumera Priyadarsini &lt;sylphrenadin@gmail.com&gt;
Signed-off-by: Julia Lawall &lt;Julia.Lawall@inria.fr&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>scripts: coccicheck: Improve error feedback when coccicheck fails</title>
<updated>2020-09-13T20:13:01+00:00</updated>
<author>
<name>Sumera Priyadarsini</name>
<email>sylphrenadin@gmail.com</email>
</author>
<published>2020-09-13T12:05:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=a19d1358345e040af9164ee7dd0f39ea0a99d565'/>
<id>a19d1358345e040af9164ee7dd0f39ea0a99d565</id>
<content type='text'>
Currently, coccicheck fails with only the message "coccicheck failed"
and the error code for the failure. To obtain the error logs,
one needs to specify a debug file using the DEBUG_FILE option.

Modify coccicheck to display error logs when it crashes unless
DEBUG_FILE is set, in which case, the error logs are stored in
the specified debug file.

Signed-off-by: Sumera Priyadarsini &lt;sylphrenadin@gmail.com&gt;
Signed-off-by: Julia Lawall &lt;Julia.Lawall@inria.fr&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Currently, coccicheck fails with only the message "coccicheck failed"
and the error code for the failure. To obtain the error logs,
one needs to specify a debug file using the DEBUG_FILE option.

Modify coccicheck to display error logs when it crashes unless
DEBUG_FILE is set, in which case, the error logs are stored in
the specified debug file.

Signed-off-by: Sumera Priyadarsini &lt;sylphrenadin@gmail.com&gt;
Signed-off-by: Julia Lawall &lt;Julia.Lawall@inria.fr&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>scripts: coccicheck: Add chain mode to list of modes</title>
<updated>2020-08-21T20:34:49+00:00</updated>
<author>
<name>Sumera Priyadarsini</name>
<email>sylphrenadin@gmail.com</email>
</author>
<published>2020-08-05T08:57:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=4b2bd20c350a66d4f8a7c2da48b115fd4e06d15e'/>
<id>4b2bd20c350a66d4f8a7c2da48b115fd4e06d15e</id>
<content type='text'>
This patch adds chain mode to the list of available modes in coccicheck.

Signed-off-by: Sumera Priyadarsini &lt;sylphrenadin@gmail.com&gt;
Signed-off-by: Julia Lawall &lt;Julia.Lawall@inria.fr&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This patch adds chain mode to the list of available modes in coccicheck.

Signed-off-by: Sumera Priyadarsini &lt;sylphrenadin@gmail.com&gt;
Signed-off-by: Julia Lawall &lt;Julia.Lawall@inria.fr&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>coccicheck: return proper error code on fail</title>
<updated>2018-08-13T23:58:56+00:00</updated>
<author>
<name>Denis Efremov</name>
<email>efremov@linux.com</email>
</author>
<published>2018-08-10T20:25:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=512ddf7d7db056edfed3159ea7cb4e4a5eefddd4'/>
<id>512ddf7d7db056edfed3159ea7cb4e4a5eefddd4</id>
<content type='text'>
If coccicheck fails, it should return an error code distinct from zero
to signal about an internal problem. Current code instead of exiting with
the tool's error code returns the error code of 'echo "coccicheck failed"'
which is almost always equals to zero, thus failing the original intention
of alerting about a problem. This patch fixes the code.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Denis Efremov &lt;efremov@linux.com&gt;
Acked-by: Julia Lawall &lt;julia.lawall@lip6.fr&gt;
Signed-off-by: Masahiro Yamada &lt;yamada.masahiro@socionext.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
If coccicheck fails, it should return an error code distinct from zero
to signal about an internal problem. Current code instead of exiting with
the tool's error code returns the error code of 'echo "coccicheck failed"'
which is almost always equals to zero, thus failing the original intention
of alerting about a problem. This patch fixes the code.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Denis Efremov &lt;efremov@linux.com&gt;
Acked-by: Julia Lawall &lt;julia.lawall@lip6.fr&gt;
Signed-off-by: Masahiro Yamada &lt;yamada.masahiro@socionext.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Coccinelle: coccicheck: fix typo</title>
<updated>2018-02-01T15:21:47+00:00</updated>
<author>
<name>Julia Lawall</name>
<email>Julia.Lawall@lip6.fr</email>
</author>
<published>2018-02-01T09:20:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=1640eea35e8dcf0cb437f03c56868a97d0666df3'/>
<id>1640eea35e8dcf0cb437f03c56868a97d0666df3</id>
<content type='text'>
Correct spelling of "coccinelle".

Signed-off-by: Julia Lawall &lt;Julia.Lawall@lip6.fr&gt;
Signed-off-by: Masahiro Yamada &lt;yamada.masahiro@socionext.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Correct spelling of "coccinelle".

Signed-off-by: Julia Lawall &lt;Julia.Lawall@lip6.fr&gt;
Signed-off-by: Masahiro Yamada &lt;yamada.masahiro@socionext.com&gt;
</pre>
</div>
</content>
</entry>
</feed>
