All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] bootconfig: Fix testcase to increase max node
@ 2023-03-13 13:56 ` Masami Hiramatsu (Google)
  0 siblings, 0 replies; 6+ messages in thread
From: Masami Hiramatsu (Google) @ 2023-03-13 13:56 UTC (permalink / raw)
  To: linux-trace-kernel
  Cc: Heinz Wiesinger, andersson, linux-arm-kernel, linux-arm-msm,
	linux-kernel, mhiramat, quic_rjendra, quic_saipraka, quic_sibis

From: Masami Hiramatsu (Google) <mhiramat@kernel.org>

Since commit 6c40624930c5 ("bootconfig: Increase max nodes of bootconfig
from 1024 to 8192 for DCC support") increased the max number of bootconfig
node to 8192, the bootconfig testcase of the max number of nodes fails.
To fix this issue, we can not simply increase the number in the test script
because the test bootconfig file becomes too big (>32KB). To fix that, we
can use a combination of three alphabets (26^3 = 17576). But with that,
we can not express the 8193 (just one exceed from the limitation) because
it also exceeds the max size of bootconfig. So, the first 26 nodes will just
use one alphabet.

With this fix, test-bootconfig.sh passes all tests.

Reported-by: Heinz Wiesinger <pprkut@slackware.com>
Link: https://lore.kernel.org/all/2463802.XAFRqVoOGU@amaterasu.liwjatan.org
Fixes: 6c40624930c5 ("bootconfig: Increase max nodes of bootconfig from 1024 to 8192 for DCC support")
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
---
 tools/bootconfig/test-bootconfig.sh |   17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/tools/bootconfig/test-bootconfig.sh b/tools/bootconfig/test-bootconfig.sh
index f68e2e9eef8b..b1b77d76110d 100755
--- a/tools/bootconfig/test-bootconfig.sh
+++ b/tools/bootconfig/test-bootconfig.sh
@@ -14,10 +14,11 @@ ALIGN=4
 INITRD=`mktemp ${TESTDIR}/initrd-XXXX`
 TEMPCONF=`mktemp ${TESTDIR}/temp-XXXX.bconf`
 OUTFILE=`mktemp ${TESTDIR}/tempout-XXXX`
+AWKFILE=`mktemp ${TESTDIR}/temp-XXXX.awk`
 NG=0
 
 cleanup() {
-  rm -f $INITRD $TEMPCONF $OUTFILE
+  rm -f $INITRD $TEMPCONF $OUTFILE $AWKFILE
   exit $NG
 }
 
@@ -87,10 +88,16 @@ xfail grep -i "error" $OUTFILE
 
 echo "Max node number check"
 
-echo -n > $TEMPCONF
-for i in `seq 1 1024` ; do
-   echo "node$i" >> $TEMPCONF
-done
+cat > $AWKFILE << EOF
+BEGIN {
+  for (i = 0; i < 26; i += 1)
+      printf("%c\n", 65 + i % 26)
+  for (i = 26; i < 8192; i += 1)
+      printf("%c%c%c\n", 65 + i % 26, 65 + (i / 26) % 26, 65 + (i / 26 / 26))
+}
+EOF
+awk -f "$AWKFILE" > $TEMPCONF
+
 xpass $BOOTCONF -a $TEMPCONF $INITRD
 
 echo "badnode" >> $TEMPCONF


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

* [PATCH] bootconfig: Fix testcase to increase max node
@ 2023-03-13 13:56 ` Masami Hiramatsu (Google)
  0 siblings, 0 replies; 6+ messages in thread
From: Masami Hiramatsu (Google) @ 2023-03-13 13:56 UTC (permalink / raw)
  To: linux-trace-kernel
  Cc: Heinz Wiesinger, andersson, linux-arm-kernel, linux-arm-msm,
	linux-kernel, mhiramat, quic_rjendra, quic_saipraka, quic_sibis

From: Masami Hiramatsu (Google) <mhiramat@kernel.org>

Since commit 6c40624930c5 ("bootconfig: Increase max nodes of bootconfig
from 1024 to 8192 for DCC support") increased the max number of bootconfig
node to 8192, the bootconfig testcase of the max number of nodes fails.
To fix this issue, we can not simply increase the number in the test script
because the test bootconfig file becomes too big (>32KB). To fix that, we
can use a combination of three alphabets (26^3 = 17576). But with that,
we can not express the 8193 (just one exceed from the limitation) because
it also exceeds the max size of bootconfig. So, the first 26 nodes will just
use one alphabet.

With this fix, test-bootconfig.sh passes all tests.

Reported-by: Heinz Wiesinger <pprkut@slackware.com>
Link: https://lore.kernel.org/all/2463802.XAFRqVoOGU@amaterasu.liwjatan.org
Fixes: 6c40624930c5 ("bootconfig: Increase max nodes of bootconfig from 1024 to 8192 for DCC support")
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
---
 tools/bootconfig/test-bootconfig.sh |   17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/tools/bootconfig/test-bootconfig.sh b/tools/bootconfig/test-bootconfig.sh
index f68e2e9eef8b..b1b77d76110d 100755
--- a/tools/bootconfig/test-bootconfig.sh
+++ b/tools/bootconfig/test-bootconfig.sh
@@ -14,10 +14,11 @@ ALIGN=4
 INITRD=`mktemp ${TESTDIR}/initrd-XXXX`
 TEMPCONF=`mktemp ${TESTDIR}/temp-XXXX.bconf`
 OUTFILE=`mktemp ${TESTDIR}/tempout-XXXX`
+AWKFILE=`mktemp ${TESTDIR}/temp-XXXX.awk`
 NG=0
 
 cleanup() {
-  rm -f $INITRD $TEMPCONF $OUTFILE
+  rm -f $INITRD $TEMPCONF $OUTFILE $AWKFILE
   exit $NG
 }
 
@@ -87,10 +88,16 @@ xfail grep -i "error" $OUTFILE
 
 echo "Max node number check"
 
-echo -n > $TEMPCONF
-for i in `seq 1 1024` ; do
-   echo "node$i" >> $TEMPCONF
-done
+cat > $AWKFILE << EOF
+BEGIN {
+  for (i = 0; i < 26; i += 1)
+      printf("%c\n", 65 + i % 26)
+  for (i = 26; i < 8192; i += 1)
+      printf("%c%c%c\n", 65 + i % 26, 65 + (i / 26) % 26, 65 + (i / 26 / 26))
+}
+EOF
+awk -f "$AWKFILE" > $TEMPCONF
+
 xpass $BOOTCONF -a $TEMPCONF $INITRD
 
 echo "badnode" >> $TEMPCONF


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] bootconfig: Fix testcase to increase max node
  2023-03-13 13:56 ` Masami Hiramatsu (Google)
@ 2023-03-14 15:12   ` Steven Rostedt
  -1 siblings, 0 replies; 6+ messages in thread
From: Steven Rostedt @ 2023-03-14 15:12 UTC (permalink / raw)
  To: Masami Hiramatsu (Google)
  Cc: linux-trace-kernel, Heinz Wiesinger, andersson, linux-arm-kernel,
	linux-arm-msm, linux-kernel, quic_rjendra, quic_saipraka,
	quic_sibis

On Mon, 13 Mar 2023 22:56:09 +0900
"Masami Hiramatsu (Google)" <mhiramat@kernel.org> wrote:

> @@ -87,10 +88,16 @@ xfail grep -i "error" $OUTFILE
>  
>  echo "Max node number check"
>  
> -echo -n > $TEMPCONF
> -for i in `seq 1 1024` ; do
> -   echo "node$i" >> $TEMPCONF

Do you need this extra file?

> -done
> +cat > $AWKFILE << EOF
> +BEGIN {
> +  for (i = 0; i < 26; i += 1)
> +      printf("%c\n", 65 + i % 26)
> +  for (i = 26; i < 8192; i += 1)
> +      printf("%c%c%c\n", 65 + i % 26, 65 + (i / 26) % 26, 65 + (i / 26 / 26))
> +}
> +EOF
> +awk -f "$AWKFILE" > $TEMPCONF

Couldn't the above just be:

awk '
	BEGIN {
		for (i = 0; i < 26; i += 1)
			printf("%c\n", 65 + i % 26)
		for (i = 26; i < 8192; i += 1)
			printf("%c%c%c\n", 65 + i % 26, 65 + (i / 26) % 26, 65 + (i / 26 / 26))
	}
' > $TEMPCONF

and not need the extra file?

-- Steve


>  xpass $BOOTCONF -a $TEMPCONF $INITRD
>  
>  echo "badnode" >> $TEMPCONF


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

* Re: [PATCH] bootconfig: Fix testcase to increase max node
@ 2023-03-14 15:12   ` Steven Rostedt
  0 siblings, 0 replies; 6+ messages in thread
From: Steven Rostedt @ 2023-03-14 15:12 UTC (permalink / raw)
  To: Masami Hiramatsu (Google)
  Cc: linux-trace-kernel, Heinz Wiesinger, andersson, linux-arm-kernel,
	linux-arm-msm, linux-kernel, quic_rjendra, quic_saipraka,
	quic_sibis

On Mon, 13 Mar 2023 22:56:09 +0900
"Masami Hiramatsu (Google)" <mhiramat@kernel.org> wrote:

> @@ -87,10 +88,16 @@ xfail grep -i "error" $OUTFILE
>  
>  echo "Max node number check"
>  
> -echo -n > $TEMPCONF
> -for i in `seq 1 1024` ; do
> -   echo "node$i" >> $TEMPCONF

Do you need this extra file?

> -done
> +cat > $AWKFILE << EOF
> +BEGIN {
> +  for (i = 0; i < 26; i += 1)
> +      printf("%c\n", 65 + i % 26)
> +  for (i = 26; i < 8192; i += 1)
> +      printf("%c%c%c\n", 65 + i % 26, 65 + (i / 26) % 26, 65 + (i / 26 / 26))
> +}
> +EOF
> +awk -f "$AWKFILE" > $TEMPCONF

Couldn't the above just be:

awk '
	BEGIN {
		for (i = 0; i < 26; i += 1)
			printf("%c\n", 65 + i % 26)
		for (i = 26; i < 8192; i += 1)
			printf("%c%c%c\n", 65 + i % 26, 65 + (i / 26) % 26, 65 + (i / 26 / 26))
	}
' > $TEMPCONF

and not need the extra file?

-- Steve


>  xpass $BOOTCONF -a $TEMPCONF $INITRD
>  
>  echo "badnode" >> $TEMPCONF


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] bootconfig: Fix testcase to increase max node
  2023-03-14 15:12   ` Steven Rostedt
@ 2023-03-15  7:59     ` Masami Hiramatsu
  -1 siblings, 0 replies; 6+ messages in thread
From: Masami Hiramatsu @ 2023-03-15  7:59 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: linux-trace-kernel, Heinz Wiesinger, andersson, linux-arm-kernel,
	linux-arm-msm, linux-kernel, quic_rjendra, quic_saipraka,
	quic_sibis

On Tue, 14 Mar 2023 11:12:13 -0400
Steven Rostedt <rostedt@goodmis.org> wrote:

> On Mon, 13 Mar 2023 22:56:09 +0900
> "Masami Hiramatsu (Google)" <mhiramat@kernel.org> wrote:
> 
> > @@ -87,10 +88,16 @@ xfail grep -i "error" $OUTFILE
> >  
> >  echo "Max node number check"
> >  
> > -echo -n > $TEMPCONF
> > -for i in `seq 1 1024` ; do
> > -   echo "node$i" >> $TEMPCONF
> 
> Do you need this extra file?
> 
> > -done
> > +cat > $AWKFILE << EOF
> > +BEGIN {
> > +  for (i = 0; i < 26; i += 1)
> > +      printf("%c\n", 65 + i % 26)
> > +  for (i = 26; i < 8192; i += 1)
> > +      printf("%c%c%c\n", 65 + i % 26, 65 + (i / 26) % 26, 65 + (i / 26 / 26))
> > +}
> > +EOF
> > +awk -f "$AWKFILE" > $TEMPCONF
> 
> Couldn't the above just be:
> 
> awk '
> 	BEGIN {
> 		for (i = 0; i < 26; i += 1)
> 			printf("%c\n", 65 + i % 26)
> 		for (i = 26; i < 8192; i += 1)
> 			printf("%c%c%c\n", 65 + i % 26, 65 + (i / 26) % 26, 65 + (i / 26 / 26))
> 	}
> ' > $TEMPCONF
> 
> and not need the extra file?

Indeed. Let me update this.

Thank you!

> 
> -- Steve
> 
> 
> >  xpass $BOOTCONF -a $TEMPCONF $INITRD
> >  
> >  echo "badnode" >> $TEMPCONF
> 


-- 
Masami Hiramatsu (Google) <mhiramat@kernel.org>

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

* Re: [PATCH] bootconfig: Fix testcase to increase max node
@ 2023-03-15  7:59     ` Masami Hiramatsu
  0 siblings, 0 replies; 6+ messages in thread
From: Masami Hiramatsu @ 2023-03-15  7:59 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: linux-trace-kernel, Heinz Wiesinger, andersson, linux-arm-kernel,
	linux-arm-msm, linux-kernel, quic_rjendra, quic_saipraka,
	quic_sibis

On Tue, 14 Mar 2023 11:12:13 -0400
Steven Rostedt <rostedt@goodmis.org> wrote:

> On Mon, 13 Mar 2023 22:56:09 +0900
> "Masami Hiramatsu (Google)" <mhiramat@kernel.org> wrote:
> 
> > @@ -87,10 +88,16 @@ xfail grep -i "error" $OUTFILE
> >  
> >  echo "Max node number check"
> >  
> > -echo -n > $TEMPCONF
> > -for i in `seq 1 1024` ; do
> > -   echo "node$i" >> $TEMPCONF
> 
> Do you need this extra file?
> 
> > -done
> > +cat > $AWKFILE << EOF
> > +BEGIN {
> > +  for (i = 0; i < 26; i += 1)
> > +      printf("%c\n", 65 + i % 26)
> > +  for (i = 26; i < 8192; i += 1)
> > +      printf("%c%c%c\n", 65 + i % 26, 65 + (i / 26) % 26, 65 + (i / 26 / 26))
> > +}
> > +EOF
> > +awk -f "$AWKFILE" > $TEMPCONF
> 
> Couldn't the above just be:
> 
> awk '
> 	BEGIN {
> 		for (i = 0; i < 26; i += 1)
> 			printf("%c\n", 65 + i % 26)
> 		for (i = 26; i < 8192; i += 1)
> 			printf("%c%c%c\n", 65 + i % 26, 65 + (i / 26) % 26, 65 + (i / 26 / 26))
> 	}
> ' > $TEMPCONF
> 
> and not need the extra file?

Indeed. Let me update this.

Thank you!

> 
> -- Steve
> 
> 
> >  xpass $BOOTCONF -a $TEMPCONF $INITRD
> >  
> >  echo "badnode" >> $TEMPCONF
> 


-- 
Masami Hiramatsu (Google) <mhiramat@kernel.org>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2023-03-15  8:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-13 13:56 [PATCH] bootconfig: Fix testcase to increase max node Masami Hiramatsu (Google)
2023-03-13 13:56 ` Masami Hiramatsu (Google)
2023-03-14 15:12 ` Steven Rostedt
2023-03-14 15:12   ` Steven Rostedt
2023-03-15  7:59   ` Masami Hiramatsu
2023-03-15  7:59     ` Masami Hiramatsu

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.