All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH -perfbook] autodate.sh: Add graceful fallback of commitid-only mode for shallow clone
@ 2023-02-03 15:23 Akira Yokosawa
  2023-02-03 16:47 ` Paul E. McKenney
  0 siblings, 1 reply; 6+ messages in thread
From: Akira Yokosawa @ 2023-02-03 15:23 UTC (permalink / raw)
  To: Paul E. McKenney; +Cc: Leonardo Bras, perfbook, Akira Yokosawa

Under shallow clone of perfbook repo, "git describe" can't work.
Catch the error and use "git log" to obtain the commit id instead.

Following is the comparison of autodate.tex. 

Before:

    \date{February 3, 2023 \\ Tag: \texttt{} }
    \newcommand{\commityear}{2023}
    \newcommand{\commitid}{}
    \IfQqzBg{}{\setboolean{qqzbg}{false}}
    % tcolorbox version: 5.1
    \tcbsetforeverylayer{autoparskip}

After:

    \date{February 3, 2023 \\ Commit: \texttt{g25bd138c30bf} (shallow clone) }
    \newcommand{\commityear}{2023}
    \newcommand{\commitid}{g25bd138c30bf}
    \IfQqzBg{}{\setboolean{qqzbg}{false}}
    % tcolorbox version: 5.1
    \tcbsetforeverylayer{autoparskip}

Signed-off-by: Akira Yokosawa <akiyks@gmail.com>
Cc: Leonardo Bras <leobras.c@gmail.com>
---
 utilities/autodate.sh | 54 ++++++++++++++++++++++++-------------------
 1 file changed, 30 insertions(+), 24 deletions(-)

diff --git a/utilities/autodate.sh b/utilities/autodate.sh
index e33c254d917f..6d10b5d7d2b4 100644
--- a/utilities/autodate.sh
+++ b/utilities/autodate.sh
@@ -52,27 +52,28 @@ else
 	else
 		modified=""
 	fi
-	description="`git describe --tags HEAD`"
-	case "$description" in
-	*-g*)
-		release=`env printf 'Commit: \\\texttt{%s}' "$description"`
-		commitid="$description"
-		;;
-	v*)
-		release="Release $description"
-		commitid=$description
-		qqzbg="true"
-		;;
-	Edition*)
-		release="Edition"
-		commitid=$description
-		qqzbg="true"
+	if description="`git describe --tags HEAD 2> /dev/null`"
+	then
 		case "$description" in
-		*P*)
-			release="Print $release"
+		*-g*)
+			release=`env printf 'Commit: \\\texttt{%s}' "$description"`
+			commitid="$description"
 			;;
-		esac
-		case "$description" in
+		v*)
+			release="Release $description"
+			commitid=$description
+			qqzbg="true"
+			;;
+		Edition*)
+			release="Edition"
+			commitid=$description
+			qqzbg="true"
+			case "$description" in
+			*P*)
+				release="Print $release"
+				;;
+			esac
+			case "$description" in
 		Edition[.-][0-9]*)
 			ednum="`echo $description | sed -e 's/^Edition[.-]\([0-9]*\).*$/\1/'`"
 			release=`env printf '\\Ordinalstringnum{%s} %s' $ednum "$release"`
@@ -85,11 +86,16 @@ else
 			;;
 		esac
 		;;
-	*)
-		release=`env printf 'Tag: \\\texttt{%s}' "$description"`
-		commitid=`echo $description | sed -e 's/.*-\(g.*\)/\1/'`
-		;;
-	esac
+		*)
+			release=`env printf 'Tag: \\\texttt{%s}' "$description"`
+			commitid=`echo $description | sed -e 's/.*-\(g.*\)/\1/'`
+			;;
+		esac
+	else
+		description=`git log --max-count=1 | head -n 1 | sed -e 's/^commit \([0-9a-f]\{12\}\).*$/g\1/'`
+		release=`env printf 'Commit: \\\texttt{%s} (shallow clone)' "$description"`
+		commitid="$description"
+	fi
 fi
 month=`date --date="$date_str" +%B`
 year=`date --date="$date_str" +%Y`

base-commit: 3bfa0a092334e3a82bf75217b01d500ad78b6dc5
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH -perfbook] autodate.sh: Add graceful fallback of commitid-only mode for shallow clone
  2023-02-03 15:23 [PATCH -perfbook] autodate.sh: Add graceful fallback of commitid-only mode for shallow clone Akira Yokosawa
@ 2023-02-03 16:47 ` Paul E. McKenney
       [not found]   ` <402f2ac0179552e214206fb6adb36240113ddc51.camel@gmail.com>
  0 siblings, 1 reply; 6+ messages in thread
From: Paul E. McKenney @ 2023-02-03 16:47 UTC (permalink / raw)
  To: Akira Yokosawa; +Cc: Leonardo Bras, perfbook

On Sat, Feb 04, 2023 at 12:23:25AM +0900, Akira Yokosawa wrote:
> Under shallow clone of perfbook repo, "git describe" can't work.
> Catch the error and use "git log" to obtain the commit id instead.
> 
> Following is the comparison of autodate.tex. 
> 
> Before:
> 
>     \date{February 3, 2023 \\ Tag: \texttt{} }
>     \newcommand{\commityear}{2023}
>     \newcommand{\commitid}{}
>     \IfQqzBg{}{\setboolean{qqzbg}{false}}
>     % tcolorbox version: 5.1
>     \tcbsetforeverylayer{autoparskip}
> 
> After:
> 
>     \date{February 3, 2023 \\ Commit: \texttt{g25bd138c30bf} (shallow clone) }
>     \newcommand{\commityear}{2023}
>     \newcommand{\commitid}{g25bd138c30bf}
>     \IfQqzBg{}{\setboolean{qqzbg}{false}}
>     % tcolorbox version: 5.1
>     \tcbsetforeverylayer{autoparskip}
> 
> Signed-off-by: Akira Yokosawa <akiyks@gmail.com>
> Cc: Leonardo Bras <leobras.c@gmail.com>

Thank you, Akira, and I have queued this.

Leonardo, could you please check to see whether this works for you in
your particular environment?  If it does, please include something
like this in your reply:

Tested-by: Leonardo Bras <leobras.c@gmail.com>

							Thanx, Paul

> ---
>  utilities/autodate.sh | 54 ++++++++++++++++++++++++-------------------
>  1 file changed, 30 insertions(+), 24 deletions(-)
> 
> diff --git a/utilities/autodate.sh b/utilities/autodate.sh
> index e33c254d917f..6d10b5d7d2b4 100644
> --- a/utilities/autodate.sh
> +++ b/utilities/autodate.sh
> @@ -52,27 +52,28 @@ else
>  	else
>  		modified=""
>  	fi
> -	description="`git describe --tags HEAD`"
> -	case "$description" in
> -	*-g*)
> -		release=`env printf 'Commit: \\\texttt{%s}' "$description"`
> -		commitid="$description"
> -		;;
> -	v*)
> -		release="Release $description"
> -		commitid=$description
> -		qqzbg="true"
> -		;;
> -	Edition*)
> -		release="Edition"
> -		commitid=$description
> -		qqzbg="true"
> +	if description="`git describe --tags HEAD 2> /dev/null`"
> +	then
>  		case "$description" in
> -		*P*)
> -			release="Print $release"
> +		*-g*)
> +			release=`env printf 'Commit: \\\texttt{%s}' "$description"`
> +			commitid="$description"
>  			;;
> -		esac
> -		case "$description" in
> +		v*)
> +			release="Release $description"
> +			commitid=$description
> +			qqzbg="true"
> +			;;
> +		Edition*)
> +			release="Edition"
> +			commitid=$description
> +			qqzbg="true"
> +			case "$description" in
> +			*P*)
> +				release="Print $release"
> +				;;
> +			esac
> +			case "$description" in
>  		Edition[.-][0-9]*)
>  			ednum="`echo $description | sed -e 's/^Edition[.-]\([0-9]*\).*$/\1/'`"
>  			release=`env printf '\\Ordinalstringnum{%s} %s' $ednum "$release"`
> @@ -85,11 +86,16 @@ else
>  			;;
>  		esac
>  		;;
> -	*)
> -		release=`env printf 'Tag: \\\texttt{%s}' "$description"`
> -		commitid=`echo $description | sed -e 's/.*-\(g.*\)/\1/'`
> -		;;
> -	esac
> +		*)
> +			release=`env printf 'Tag: \\\texttt{%s}' "$description"`
> +			commitid=`echo $description | sed -e 's/.*-\(g.*\)/\1/'`
> +			;;
> +		esac
> +	else
> +		description=`git log --max-count=1 | head -n 1 | sed -e 's/^commit \([0-9a-f]\{12\}\).*$/g\1/'`
> +		release=`env printf 'Commit: \\\texttt{%s} (shallow clone)' "$description"`
> +		commitid="$description"
> +	fi
>  fi
>  month=`date --date="$date_str" +%B`
>  year=`date --date="$date_str" +%Y`
> 
> base-commit: 3bfa0a092334e3a82bf75217b01d500ad78b6dc5
> -- 
> 2.25.1
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH -perfbook] autodate.sh: Add graceful fallback of commitid-only mode for shallow clone
       [not found]         ` <20230203185539.GM2948950@paulmck-ThinkPad-P17-Gen-1>
@ 2023-02-04  2:55           ` Leonardo Brás
  2023-02-04  4:36             ` Paul E. McKenney
  0 siblings, 1 reply; 6+ messages in thread
From: Leonardo Brás @ 2023-02-04  2:55 UTC (permalink / raw)
  To: paulmck; +Cc: perfbook

On Fri, 2023-02-03 at 10:55 -0800, Paul E. McKenney wrote:
> On Fri, Feb 03, 2023 at 03:45:05PM -0300, Leonardo Brás wrote:
> > On Fri, 2023-02-03 at 10:19 -0800, Paul E. McKenney wrote:
> > > On Fri, Feb 03, 2023 at 02:32:35PM -0300, Leonardo Brás wrote:
> > > > On Fri, 2023-02-03 at 08:47 -0800, Paul E. McKenney wrote:
> > > > > On Sat, Feb 04, 2023 at 12:23:25AM +0900, Akira Yokosawa wrote:
> > > > > > Under shallow clone of perfbook repo, "git describe" can't work.
> > > > > > Catch the error and use "git log" to obtain the commit id instead.
> > > > > > 
> > > > > > Following is the comparison of autodate.tex. 
> > > > > > 
> > > > > > Before:
> > > > > > 
> > > > > >     \date{February 3, 2023 \\ Tag: \texttt{} }
> > > > > >     \newcommand{\commityear}{2023}
> > > > > >     \newcommand{\commitid}{}
> > > > > >     \IfQqzBg{}{\setboolean{qqzbg}{false}}
> > > > > >     % tcolorbox version: 5.1
> > > > > >     \tcbsetforeverylayer{autoparskip}
> > > > > > 
> > > > > > After:
> > > > > > 
> > > > > >     \date{February 3, 2023 \\ Commit: \texttt{g25bd138c30bf} (shallow clone) }
> > > > > >     \newcommand{\commityear}{2023}
> > > > > >     \newcommand{\commitid}{g25bd138c30bf}
> > > > > >     \IfQqzBg{}{\setboolean{qqzbg}{false}}
> > > > > >     % tcolorbox version: 5.1
> > > > > >     \tcbsetforeverylayer{autoparskip}
> > > > > > 
> > > > > > Signed-off-by: Akira Yokosawa <akiyks@gmail.com>
> > > > > > Cc: Leonardo Bras <leobras.c@gmail.com>
> > > > > 
> > > > > Thank you, Akira, and I have queued this.
> > > > > 
> > > > > Leonardo, could you please check to see whether this works for you in
> > > > > your particular environment?
> > > > > 
> > > > 
> > > > Sure, 
> > > > I reconfigured it as a shallow git clone, and then pushed master + this patch on
> > > > leobras_ci, and it seems to have worked just fine. Please see:
> > > > https://gitlab.com/linux-kernel/perfbook/-/jobs/3712415008/artifacts/file/perfbook.pdf
> > > > 
> > > > 
> > > > >   If it does, please include something
> > > > > like this in your reply:
> > > > > 
> > > > > 
> > > > > 
> > > > 
> > > > So, yeah:
> > > > Tested-by: Leonardo Bras <leobras.c@gmail.com>
> > > 
> > > Applied, thank you very much!
> > > 
> > > > Paul, could you please help me test some other feature?
> > > > It would require you to push master + this patch on a test branch in your
> > > > kernel.org repository.
> > > > 
> > > > If everything works as intended, it should automatically trigger the build +
> > > > testing for that branch.
> > > 
> > > One approach is to go into the CodeSamples/count directory and invoke
> > > all the programs with no arguments.  If they all exit with zero status,
> > > life is good.
> > 
> > I think there was a misunderstanding:
> > I asked help for testing a Gitlab feature, which is buiding any test branches
> > from your kernel.org repository automatically when you push to a new branch.
> > 
> > > 
> > > Would you be interested in adding a "make check" target to the
> > > CodeSamples/count/Makefile to support this?
> > 
> > Sure, I could do that!
> > Just noticed by running `make -C CodeSamples/` it doesn't generate anything in
> > CodeSamples/count:
> > 
> > ### None in count/ can be built on arch: 'unknown'.
> > 
> > I did some hacking, and then tried:
> > make target=x86 -C CodeSamples/
> > 
> > And suddenly I see errors such as:
> > 
> > cc  -g -o lockdeq -DTEST lockdeq.c -lpthread
> > lockdeq.c:78:26: error: expected ‘:’, ‘,’, ‘;’, ‘}’ or ‘__attribute__’ before
> > ‘____cacheline_internodealigned_in_smp’
> >    78 |         spinlock_t rlock ____cacheline_internodealigned_in_smp;
> >       |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > lockdeq.c: In function ‘init_pdeq’:
> > lockdeq.c:100:12: error: ‘struct pdeq’ has no member named ‘ridx’; did you mean
> > ‘lidx’?
> >   100 |         d->ridx = 1;
> >       |            ^~~~
> >       |            lidx
> > 
> > and warnings such as :
> > cc -g -Wall -o xchglock xchglock.c -lpthread
> > xchglock.c: In function ‘main’:
> > xchglock.c:87:9: warning: implicit declaration of function ‘smp_mb’; did you
> > mean ‘cmm_mb’? [-Wimplicit-function-declaration]
> >    87 |         smp_mb();
> >       |         ^~~~~~
> >       |         cmm_mb
> > /usr/bin/ld: /tmp/ccDvA7Yo.o: in function `main':
> > /dev/shm/perfbook/CodeSamples/locking/xchglock.c:87: undefined reference to
> > `smp_mb'
> > /usr/bin/ld: /dev/shm/perfbook/CodeSamples/locking/xchglock.c:91: undefined
> > reference to `smp_mb'
> > /usr/bin/ld: /dev/shm/perfbook/CodeSamples/locking/xchglock.c:93: undefined
> > reference to `smp_mb'
> > /usr/bin/ld: /dev/shm/perfbook/CodeSamples/locking/xchglock.c:95: undefined
> > reference to `smp_mb'
> > collect2: error: ld returned 1 exit status
> > make[1]: *** [Makefile:21: xchglock] Error 1
> > 
> > Is that the correct way of calling the make on CodeSamples?
> 
> Ah, the top-level Makefile has some historical baggage, which is entirely
> my doing.  Something about me not expecting this to be a publicly
> available project when I first set it up.  ;-)
> 
> So I suggest something like this:
> 
> 	cd CodeSamples
> 	make pthreads
> 	cd count
> 	make
> 
> Please let me know how this goes.

No luck:

###
[perfbook]$ cd CodeSamples/
[CodeSamples]$ make pthreads 
echo "#ifndef __PERFBOOK_API_H__" > api.h
echo "#define __PERFBOOK_API_H__" >> api.h
echo "/* MECHANICALLY GENERATED, DO NOT EDIT!!! */" >> api.h
echo "" >> api.h
cat linux/common.h >> api.h
echo "" >> api.h
cat api-pthreads/api-pthreads.h | \
	sed '/begin{snippet}/d' | \
	sed '/end{snippet}/d' >> api.h
echo "" >> api.h
cat api-pthreads/api-gcc.h >> api.h
cat api-pthreads/api-linux.h >> api.h
echo "" >> api.h
if test -f /usr/include/urcu-call-rcu.h -o \
	-f /usr/local/include/urcu-call-rcu.h -o \
	-f /usr/include//urcu-call-rcu.h -o \
	-f /usr/include/urcu-call-rcu.h ; \
then \
	echo "#define _LGPL_SOURCE" >> api.h; \
	echo "#include <urcu/rculist.h>" >> api.h; \
	echo "#include <urcu/rcuhlist.h>" >> api.h; \
	echo "#include <urcu-pointer.h>" >> api.h; \
elif test -d /usr/include/urcu -o -d /usr/local/include/urcu ; \
then \
	echo "#define _LGPL_SOURCE" >> api.h; \
	echo "#include <urcu/rculist.h>" >> api.h; \
	echo "#include <urcu/rcuhlist.h>" >> api.h; \
	echo "#include <urcu-pointer-static.h>" >> api.h; \
else \
	echo "### Missing liburcu package!!!  Install it. ###"; \
	exit 1;  \
fi
echo "#endif /* #ifndef __PERFBOOK_API_H__ */" >> api.h
echo "# MECHANICALLY GENERATED, DO NOT EDIT!!!" > Makefile.arch
echo "" >> Makefile.arch
[CodeSamples]$ cd count/
[count]$ make
### None in count/ can be built on arch: 'unknown'.
###


So, for some reason, it couldn't still get the architecture.

Oh, I noticed depends.mk use `uname -p` for getting the arch, which is non-
portable:

###
uname --help
Usage: uname [OPTION]...
Print certain system information.  With no OPTION, same as -s.
[...]
  -m, --machine            print the machine hardware name
  -p, --processor          print the processor type (non-portable)
###


I heard some distros patch this by doing uname -p the same as uname -m, which
seems to have the correct output. I patched this and then now it works:

###
make
make -C .. Makefile.arch
make[1]: Entering directory '/dev/shm/perfbook/CodeSamples'
make pthreads
make[2]: Entering directory '/dev/shm/perfbook/CodeSamples'
echo "#ifndef __PERFBOOK_API_H__" > api.h
echo "#define __PERFBOOK_API_H__" >> api.h
echo "/* MECHANICALLY GENERATED, DO NOT EDIT!!! */" >> api.h
echo "" >> api.h
cat linux/common.h >> api.h
echo "" >> api.h
cat arch-x86/arch-x86.h >> api.h
echo "" >> api.h
cat api-pthreads/api-pthreads.h | \
	sed '/begin{snippet}/d' | \
	sed '/end{snippet}/d' >> api.h
echo "" >> api.h
cat api-pthreads/api-gcc.h >> api.h
cat api-pthreads/api-linux.h >> api.h
echo "" >> api.h
if test -f /usr/include/urcu-call-rcu.h -o \
	-f /usr/local/include/urcu-call-rcu.h -o \
	-f /usr/include/x86_64-linux-gnu/urcu-call-rcu.h -o \
	-f /usr/include/urcu-call-rcu.h ; \
then \
	echo "#define _LGPL_SOURCE" >> api.h; \
	echo "#include <urcu/rculist.h>" >> api.h; \
	echo "#include <urcu/rcuhlist.h>" >> api.h; \
	echo "#include <urcu-pointer.h>" >> api.h; \
elif test -d /usr/include/urcu -o -d /usr/local/include/urcu ; \
then \
	echo "#define _LGPL_SOURCE" >> api.h; \
	echo "#include <urcu/rculist.h>" >> api.h; \
	echo "#include <urcu/rcuhlist.h>" >> api.h; \
	echo "#include <urcu-pointer-static.h>" >> api.h; \
else \
	echo "### Missing liburcu package!!!  Install it. ###"; \
	exit 1;  \
fi
echo "#endif /* #ifndef __PERFBOOK_API_H__ */" >> api.h
echo "# MECHANICALLY GENERATED, DO NOT EDIT!!!" > Makefile.arch
echo "" >> Makefile.arch
cat arch-x86/Makefile.arch >> Makefile.arch
make[2]: Leaving directory '/dev/shm/perfbook/CodeSamples'
make[1]: Leaving directory '/dev/shm/perfbook/CodeSamples'
cc -g -O3 -Wall  -o count_atomic count_atomic.c -lpthread
cc -g -O3 -Wall  -o count_end count_end.c -lpthread
cc -g -O3 -Wall  -o count_end_rcu count_end_rcu.c -lpthread
cc -g -O3 -Wall  -o count_lim count_lim.c -lpthread
cc -g -O3 -Wall  -o count_lim_app count_lim_app.c -lpthread
cc -g -O3 -Wall  -o count_lim_atomic count_lim_atomic.c -lpthread
cc -g -O3 -Wall  -o count_lim_sig count_lim_sig.c -lpthread
cc -g -O3 -Wall  -o count_limd count_limd.c -lpthread
cc -g -O3 -Wall  -o count_nonatomic count_nonatomic.c -lpthread
cc -g -O3 -Wall  -o count_stack count_stack.c -lpthread
cc -g -O3 -Wall  -o count_stat count_stat.c -lpthread
cc -g -O3 -Wall  -o count_stat_atomic count_stat_atomic.c -lpthread
cc -g -O3 -Wall  -o count_stat_eventual count_stat_eventual.c -lpthread
cc -g -O3 -Wall  -o count_tstat count_tstat.c -lpthread
###

I will send a patch fixing the uname soon :)

> 
> This should probably be documented somewhere, perhaps in howto/howto.tex
> or maybe in BUILD-FAQ.txt.  Thoughts?
> 
> 							Thanx, Paul

Best regards,
Leo


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH -perfbook] autodate.sh: Add graceful fallback of commitid-only mode for shallow clone
  2023-02-04  2:55           ` Leonardo Brás
@ 2023-02-04  4:36             ` Paul E. McKenney
  2023-02-04  6:35               ` Akira Yokosawa
  0 siblings, 1 reply; 6+ messages in thread
From: Paul E. McKenney @ 2023-02-04  4:36 UTC (permalink / raw)
  To: Leonardo Brás; +Cc: perfbook

On Fri, Feb 03, 2023 at 11:55:20PM -0300, Leonardo Brás wrote:
> On Fri, 2023-02-03 at 10:55 -0800, Paul E. McKenney wrote:
> > On Fri, Feb 03, 2023 at 03:45:05PM -0300, Leonardo Brás wrote:
> > > On Fri, 2023-02-03 at 10:19 -0800, Paul E. McKenney wrote:
> > > > On Fri, Feb 03, 2023 at 02:32:35PM -0300, Leonardo Brás wrote:
> > > > > On Fri, 2023-02-03 at 08:47 -0800, Paul E. McKenney wrote:
> > > > > > On Sat, Feb 04, 2023 at 12:23:25AM +0900, Akira Yokosawa wrote:
> > > > > > > Under shallow clone of perfbook repo, "git describe" can't work.
> > > > > > > Catch the error and use "git log" to obtain the commit id instead.
> > > > > > > 
> > > > > > > Following is the comparison of autodate.tex. 
> > > > > > > 
> > > > > > > Before:
> > > > > > > 
> > > > > > >     \date{February 3, 2023 \\ Tag: \texttt{} }
> > > > > > >     \newcommand{\commityear}{2023}
> > > > > > >     \newcommand{\commitid}{}
> > > > > > >     \IfQqzBg{}{\setboolean{qqzbg}{false}}
> > > > > > >     % tcolorbox version: 5.1
> > > > > > >     \tcbsetforeverylayer{autoparskip}
> > > > > > > 
> > > > > > > After:
> > > > > > > 
> > > > > > >     \date{February 3, 2023 \\ Commit: \texttt{g25bd138c30bf} (shallow clone) }
> > > > > > >     \newcommand{\commityear}{2023}
> > > > > > >     \newcommand{\commitid}{g25bd138c30bf}
> > > > > > >     \IfQqzBg{}{\setboolean{qqzbg}{false}}
> > > > > > >     % tcolorbox version: 5.1
> > > > > > >     \tcbsetforeverylayer{autoparskip}
> > > > > > > 
> > > > > > > Signed-off-by: Akira Yokosawa <akiyks@gmail.com>
> > > > > > > Cc: Leonardo Bras <leobras.c@gmail.com>
> > > > > > 
> > > > > > Thank you, Akira, and I have queued this.
> > > > > > 
> > > > > > Leonardo, could you please check to see whether this works for you in
> > > > > > your particular environment?
> > > > > > 
> > > > > 
> > > > > Sure, 
> > > > > I reconfigured it as a shallow git clone, and then pushed master + this patch on
> > > > > leobras_ci, and it seems to have worked just fine. Please see:
> > > > > https://gitlab.com/linux-kernel/perfbook/-/jobs/3712415008/artifacts/file/perfbook.pdf
> > > > > 
> > > > > 
> > > > > >   If it does, please include something
> > > > > > like this in your reply:
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > 
> > > > > So, yeah:
> > > > > Tested-by: Leonardo Bras <leobras.c@gmail.com>
> > > > 
> > > > Applied, thank you very much!
> > > > 
> > > > > Paul, could you please help me test some other feature?
> > > > > It would require you to push master + this patch on a test branch in your
> > > > > kernel.org repository.
> > > > > 
> > > > > If everything works as intended, it should automatically trigger the build +
> > > > > testing for that branch.
> > > > 
> > > > One approach is to go into the CodeSamples/count directory and invoke
> > > > all the programs with no arguments.  If they all exit with zero status,
> > > > life is good.
> > > 
> > > I think there was a misunderstanding:
> > > I asked help for testing a Gitlab feature, which is buiding any test branches
> > > from your kernel.org repository automatically when you push to a new branch.
> > > 
> > > > 
> > > > Would you be interested in adding a "make check" target to the
> > > > CodeSamples/count/Makefile to support this?
> > > 
> > > Sure, I could do that!
> > > Just noticed by running `make -C CodeSamples/` it doesn't generate anything in
> > > CodeSamples/count:
> > > 
> > > ### None in count/ can be built on arch: 'unknown'.
> > > 
> > > I did some hacking, and then tried:
> > > make target=x86 -C CodeSamples/
> > > 
> > > And suddenly I see errors such as:
> > > 
> > > cc  -g -o lockdeq -DTEST lockdeq.c -lpthread
> > > lockdeq.c:78:26: error: expected ‘:’, ‘,’, ‘;’, ‘}’ or ‘__attribute__’ before
> > > ‘____cacheline_internodealigned_in_smp’
> > >    78 |         spinlock_t rlock ____cacheline_internodealigned_in_smp;
> > >       |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > lockdeq.c: In function ‘init_pdeq’:
> > > lockdeq.c:100:12: error: ‘struct pdeq’ has no member named ‘ridx’; did you mean
> > > ‘lidx’?
> > >   100 |         d->ridx = 1;
> > >       |            ^~~~
> > >       |            lidx
> > > 
> > > and warnings such as :
> > > cc -g -Wall -o xchglock xchglock.c -lpthread
> > > xchglock.c: In function ‘main’:
> > > xchglock.c:87:9: warning: implicit declaration of function ‘smp_mb’; did you
> > > mean ‘cmm_mb’? [-Wimplicit-function-declaration]
> > >    87 |         smp_mb();
> > >       |         ^~~~~~
> > >       |         cmm_mb
> > > /usr/bin/ld: /tmp/ccDvA7Yo.o: in function `main':
> > > /dev/shm/perfbook/CodeSamples/locking/xchglock.c:87: undefined reference to
> > > `smp_mb'
> > > /usr/bin/ld: /dev/shm/perfbook/CodeSamples/locking/xchglock.c:91: undefined
> > > reference to `smp_mb'
> > > /usr/bin/ld: /dev/shm/perfbook/CodeSamples/locking/xchglock.c:93: undefined
> > > reference to `smp_mb'
> > > /usr/bin/ld: /dev/shm/perfbook/CodeSamples/locking/xchglock.c:95: undefined
> > > reference to `smp_mb'
> > > collect2: error: ld returned 1 exit status
> > > make[1]: *** [Makefile:21: xchglock] Error 1
> > > 
> > > Is that the correct way of calling the make on CodeSamples?
> > 
> > Ah, the top-level Makefile has some historical baggage, which is entirely
> > my doing.  Something about me not expecting this to be a publicly
> > available project when I first set it up.  ;-)
> > 
> > So I suggest something like this:
> > 
> > 	cd CodeSamples
> > 	make pthreads
> > 	cd count
> > 	make
> > 
> > Please let me know how this goes.
> 
> No luck:
> 
> ###
> [perfbook]$ cd CodeSamples/
> [CodeSamples]$ make pthreads 
> echo "#ifndef __PERFBOOK_API_H__" > api.h
> echo "#define __PERFBOOK_API_H__" >> api.h
> echo "/* MECHANICALLY GENERATED, DO NOT EDIT!!! */" >> api.h
> echo "" >> api.h
> cat linux/common.h >> api.h
> echo "" >> api.h
> cat api-pthreads/api-pthreads.h | \
> 	sed '/begin{snippet}/d' | \
> 	sed '/end{snippet}/d' >> api.h
> echo "" >> api.h
> cat api-pthreads/api-gcc.h >> api.h
> cat api-pthreads/api-linux.h >> api.h
> echo "" >> api.h
> if test -f /usr/include/urcu-call-rcu.h -o \
> 	-f /usr/local/include/urcu-call-rcu.h -o \
> 	-f /usr/include//urcu-call-rcu.h -o \
> 	-f /usr/include/urcu-call-rcu.h ; \
> then \
> 	echo "#define _LGPL_SOURCE" >> api.h; \
> 	echo "#include <urcu/rculist.h>" >> api.h; \
> 	echo "#include <urcu/rcuhlist.h>" >> api.h; \
> 	echo "#include <urcu-pointer.h>" >> api.h; \
> elif test -d /usr/include/urcu -o -d /usr/local/include/urcu ; \
> then \
> 	echo "#define _LGPL_SOURCE" >> api.h; \
> 	echo "#include <urcu/rculist.h>" >> api.h; \
> 	echo "#include <urcu/rcuhlist.h>" >> api.h; \
> 	echo "#include <urcu-pointer-static.h>" >> api.h; \
> else \
> 	echo "### Missing liburcu package!!!  Install it. ###"; \
> 	exit 1;  \
> fi
> echo "#endif /* #ifndef __PERFBOOK_API_H__ */" >> api.h
> echo "# MECHANICALLY GENERATED, DO NOT EDIT!!!" > Makefile.arch
> echo "" >> Makefile.arch
> [CodeSamples]$ cd count/
> [count]$ make
> ### None in count/ can be built on arch: 'unknown'.
> ###
> 
> 
> So, for some reason, it couldn't still get the architecture.
> 
> Oh, I noticed depends.mk use `uname -p` for getting the arch, which is non-
> portable:
> 
> ###
> uname --help
> Usage: uname [OPTION]...
> Print certain system information.  With no OPTION, same as -s.
> [...]
>   -m, --machine            print the machine hardware name
>   -p, --processor          print the processor type (non-portable)
> ###
> 
> 
> I heard some distros patch this by doing uname -p the same as uname -m, which
> seems to have the correct output. I patched this and then now it works:
> 
> ###
> make
> make -C .. Makefile.arch
> make[1]: Entering directory '/dev/shm/perfbook/CodeSamples'
> make pthreads
> make[2]: Entering directory '/dev/shm/perfbook/CodeSamples'
> echo "#ifndef __PERFBOOK_API_H__" > api.h
> echo "#define __PERFBOOK_API_H__" >> api.h
> echo "/* MECHANICALLY GENERATED, DO NOT EDIT!!! */" >> api.h
> echo "" >> api.h
> cat linux/common.h >> api.h
> echo "" >> api.h
> cat arch-x86/arch-x86.h >> api.h
> echo "" >> api.h
> cat api-pthreads/api-pthreads.h | \
> 	sed '/begin{snippet}/d' | \
> 	sed '/end{snippet}/d' >> api.h
> echo "" >> api.h
> cat api-pthreads/api-gcc.h >> api.h
> cat api-pthreads/api-linux.h >> api.h
> echo "" >> api.h
> if test -f /usr/include/urcu-call-rcu.h -o \
> 	-f /usr/local/include/urcu-call-rcu.h -o \
> 	-f /usr/include/x86_64-linux-gnu/urcu-call-rcu.h -o \
> 	-f /usr/include/urcu-call-rcu.h ; \
> then \
> 	echo "#define _LGPL_SOURCE" >> api.h; \
> 	echo "#include <urcu/rculist.h>" >> api.h; \
> 	echo "#include <urcu/rcuhlist.h>" >> api.h; \
> 	echo "#include <urcu-pointer.h>" >> api.h; \
> elif test -d /usr/include/urcu -o -d /usr/local/include/urcu ; \
> then \
> 	echo "#define _LGPL_SOURCE" >> api.h; \
> 	echo "#include <urcu/rculist.h>" >> api.h; \
> 	echo "#include <urcu/rcuhlist.h>" >> api.h; \
> 	echo "#include <urcu-pointer-static.h>" >> api.h; \
> else \
> 	echo "### Missing liburcu package!!!  Install it. ###"; \
> 	exit 1;  \
> fi
> echo "#endif /* #ifndef __PERFBOOK_API_H__ */" >> api.h
> echo "# MECHANICALLY GENERATED, DO NOT EDIT!!!" > Makefile.arch
> echo "" >> Makefile.arch
> cat arch-x86/Makefile.arch >> Makefile.arch
> make[2]: Leaving directory '/dev/shm/perfbook/CodeSamples'
> make[1]: Leaving directory '/dev/shm/perfbook/CodeSamples'
> cc -g -O3 -Wall  -o count_atomic count_atomic.c -lpthread
> cc -g -O3 -Wall  -o count_end count_end.c -lpthread
> cc -g -O3 -Wall  -o count_end_rcu count_end_rcu.c -lpthread
> cc -g -O3 -Wall  -o count_lim count_lim.c -lpthread
> cc -g -O3 -Wall  -o count_lim_app count_lim_app.c -lpthread
> cc -g -O3 -Wall  -o count_lim_atomic count_lim_atomic.c -lpthread
> cc -g -O3 -Wall  -o count_lim_sig count_lim_sig.c -lpthread
> cc -g -O3 -Wall  -o count_limd count_limd.c -lpthread
> cc -g -O3 -Wall  -o count_nonatomic count_nonatomic.c -lpthread
> cc -g -O3 -Wall  -o count_stack count_stack.c -lpthread
> cc -g -O3 -Wall  -o count_stat count_stat.c -lpthread
> cc -g -O3 -Wall  -o count_stat_atomic count_stat_atomic.c -lpthread
> cc -g -O3 -Wall  -o count_stat_eventual count_stat_eventual.c -lpthread
> cc -g -O3 -Wall  -o count_tstat count_tstat.c -lpthread
> ###
> 
> I will send a patch fixing the uname soon :)

Thank you for digging into this!

And yes, portability is easier than it was 40 years ago, but still not
easy.  :-/

							Thanx, Paul

> > This should probably be documented somewhere, perhaps in howto/howto.tex
> > or maybe in BUILD-FAQ.txt.  Thoughts?
> > 
> > 							Thanx, Paul
> 
> Best regards,
> Leo
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH -perfbook] autodate.sh: Add graceful fallback of commitid-only mode for shallow clone
  2023-02-04  4:36             ` Paul E. McKenney
@ 2023-02-04  6:35               ` Akira Yokosawa
  2023-02-06 20:41                 ` Leonardo Brás
  0 siblings, 1 reply; 6+ messages in thread
From: Akira Yokosawa @ 2023-02-04  6:35 UTC (permalink / raw)
  To: paulmck, Leonardo Brás; +Cc: perfbook, Akira Yokosawa

On Fri, 3 Feb 2023 20:36:14 -0800, Paul E. McKenney wrote:
> On Fri, Feb 03, 2023 at 11:55:20PM -0300, Leonardo Brás wrote:
...
>>
>> I will send a patch fixing the uname soon :)
> 
> Thank you for digging into this!
> 
> And yes, portability is easier than it was 40 years ago, but still not
> easy.  :-/

Hi,

You might be interested in this email thread in 2012 at GNU bugreport:

    https://debbugs.gnu.org/cgi/bugreport.cgi?bug=13001

Looks like the behavior of "uname -p" CodeSamples had assumed is common
to Ubuntu and Fedora (as well as RHEL and SUSE).

So, this issue is exposed by Leo's choice of archlinux:latest as the
base image.

Leo, just out of curiosity, what made you pick Arch Linux?

        Thanks, Akira


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH -perfbook] autodate.sh: Add graceful fallback of commitid-only mode for shallow clone
  2023-02-04  6:35               ` Akira Yokosawa
@ 2023-02-06 20:41                 ` Leonardo Brás
  0 siblings, 0 replies; 6+ messages in thread
From: Leonardo Brás @ 2023-02-06 20:41 UTC (permalink / raw)
  To: Akira Yokosawa, paulmck; +Cc: perfbook

On Sat, 2023-02-04 at 15:35 +0900, Akira Yokosawa wrote:
> On Fri, 3 Feb 2023 20:36:14 -0800, Paul E. McKenney wrote:
> > On Fri, Feb 03, 2023 at 11:55:20PM -0300, Leonardo Brás wrote:
> ...
> > > 
> > > I will send a patch fixing the uname soon :)
> > 
> > Thank you for digging into this!
> > 
> > And yes, portability is easier than it was 40 years ago, but still not
> > easy.  :-/
> 
> Hi,
> 
> You might be interested in this email thread in 2012 at GNU bugreport:
> 
>     https://debbugs.gnu.org/cgi/bugreport.cgi?bug=13001
> 
> Looks like the behavior of "uname -p" CodeSamples had assumed is common
> to Ubuntu and Fedora (as well as RHEL and SUSE).


Hello Akira,

Thanks for contributing this documentation!

> 
> So, this issue is exposed by Leo's choice of archlinux:latest as the
> base image.
> 
> Leo, just out of curiosity, what made you pick Arch Linux?

Arch Linux is a rolling release distro, that tries as much as possible to keep
up with the upstream releases.

From previous experiences, I noticed testing your code with upstream libs and
tools is better: it avoids falling into issues that have already been fixed
upstream, and also help keeping up with changes and improvements in fresh
releases.

> 
>         Thanks, Akira
> 

Best regards,
Leo

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-02-06 20:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-03 15:23 [PATCH -perfbook] autodate.sh: Add graceful fallback of commitid-only mode for shallow clone Akira Yokosawa
2023-02-03 16:47 ` Paul E. McKenney
     [not found]   ` <402f2ac0179552e214206fb6adb36240113ddc51.camel@gmail.com>
     [not found]     ` <20230203181950.GL2948950@paulmck-ThinkPad-P17-Gen-1>
     [not found]       ` <72fe4499f87fb861c5fca94b6a8670e4c1100d4c.camel@gmail.com>
     [not found]         ` <20230203185539.GM2948950@paulmck-ThinkPad-P17-Gen-1>
2023-02-04  2:55           ` Leonardo Brás
2023-02-04  4:36             ` Paul E. McKenney
2023-02-04  6:35               ` Akira Yokosawa
2023-02-06 20:41                 ` Leonardo Brás

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.