* [kvm-unit-tests PATCH 0/2] configure: Support CONFIG_* extension @ 2024-09-03 14:39 ` Andrew Jones 0 siblings, 0 replies; 10+ messages in thread From: Andrew Jones @ 2024-09-03 14:39 UTC (permalink / raw) To: kvm-riscv riscv already wants to change NR_CPUS sometimes, so a CONFIG_NR_CPUS, which can be changed at compile time, would be helpful. We could just provide support for that with the configure command line, but other configurations will eventually come along (there are already two more in another riscv branch). Add support for extending config.h with a manually provided config.h-type file and also add support for using it for CONFIG_NR_CPUS for riscv. Andrew Jones (2): configure: Introduce add-config riscv: Make NR_CPUS configurable configure | 17 ++++++++++++++++- lib/riscv/asm/setup.h | 3 ++- 2 files changed, 18 insertions(+), 2 deletions(-) -- 2.46.0 ^ permalink raw reply [flat|nested] 10+ messages in thread
* [kvm-unit-tests PATCH 0/2] configure: Support CONFIG_* extension @ 2024-09-03 14:39 ` Andrew Jones 0 siblings, 0 replies; 10+ messages in thread From: Andrew Jones @ 2024-09-03 14:39 UTC (permalink / raw) To: kvm, kvm-riscv, kvmarm, linuxppc-dev, linux-s390 Cc: pbonzini, thuth, lvivier, frankja, imbrenda, nrb, atishp, cade.richard, jamestiotio riscv already wants to change NR_CPUS sometimes, so a CONFIG_NR_CPUS, which can be changed at compile time, would be helpful. We could just provide support for that with the configure command line, but other configurations will eventually come along (there are already two more in another riscv branch). Add support for extending config.h with a manually provided config.h-type file and also add support for using it for CONFIG_NR_CPUS for riscv. Andrew Jones (2): configure: Introduce add-config riscv: Make NR_CPUS configurable configure | 17 ++++++++++++++++- lib/riscv/asm/setup.h | 3 ++- 2 files changed, 18 insertions(+), 2 deletions(-) -- 2.46.0 ^ permalink raw reply [flat|nested] 10+ messages in thread
* [kvm-unit-tests PATCH 1/2] configure: Introduce add-config 2024-09-03 14:39 ` Andrew Jones @ 2024-09-03 14:39 ` Andrew Jones -1 siblings, 0 replies; 10+ messages in thread From: Andrew Jones @ 2024-09-03 14:39 UTC (permalink / raw) To: kvm-riscv Allow users to add additional CONFIG_* and override defaults by concatenating a given file with #define's and #undef's to lib/config.h Signed-off-by: Andrew Jones <andrew.jones@linux.dev> --- configure | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/configure b/configure index 27ae9cc89657..7a1317d0650d 100755 --- a/configure +++ b/configure @@ -64,6 +64,8 @@ usage() { no environ is provided by the user (enabled by default) --erratatxt=FILE specify a file to use instead of errata.txt. Use '--erratatxt=' to ensure no file is used. + --add-config=FILE specify a file containing configs (CONFIG_*) to add on to the + generated lib/config.h. Use #undef to override default configs. --host-key-document=HOST_KEY_DOCUMENT Specify the machine-specific host-key document for creating a PVM image with 'genprotimg' (s390x only) @@ -153,6 +155,10 @@ while [[ "$1" = -* ]]; do erratatxt= [ "$arg" ] && erratatxt=$(eval realpath "$arg") ;; + --add-config) + add_config= + [ "$arg" ] && add_config=$(eval realpath "$arg") + ;; --host-key-document) host_key_document="$arg" ;; @@ -213,6 +219,10 @@ if [ "$erratatxt" ] && [ ! -f "$erratatxt" ]; then echo "erratatxt: $erratatxt does not exist or is not a regular file" exit 1 fi +if [ "$add_config" ] && [ ! -f "$add_config" ]; then + echo "add-config: $add_config does not exist or is not a regular file" + exit 1 +fi arch_name=$arch [ "$arch" = "aarch64" ] && arch="arm64" @@ -502,4 +512,8 @@ cat <<EOF >> lib/config.h EOF fi +if [ "$add_config" ]; then + echo "/* Additional configs from $add_config */" >> lib/config.h + cat "$add_config" >> lib/config.h +fi echo "#endif" >> lib/config.h -- 2.46.0 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* [kvm-unit-tests PATCH 1/2] configure: Introduce add-config @ 2024-09-03 14:39 ` Andrew Jones 0 siblings, 0 replies; 10+ messages in thread From: Andrew Jones @ 2024-09-03 14:39 UTC (permalink / raw) To: kvm, kvm-riscv, kvmarm, linuxppc-dev, linux-s390 Cc: pbonzini, thuth, lvivier, frankja, imbrenda, nrb, atishp, cade.richard, jamestiotio Allow users to add additional CONFIG_* and override defaults by concatenating a given file with #define's and #undef's to lib/config.h Signed-off-by: Andrew Jones <andrew.jones@linux.dev> --- configure | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/configure b/configure index 27ae9cc89657..7a1317d0650d 100755 --- a/configure +++ b/configure @@ -64,6 +64,8 @@ usage() { no environ is provided by the user (enabled by default) --erratatxt=FILE specify a file to use instead of errata.txt. Use '--erratatxt=' to ensure no file is used. + --add-config=FILE specify a file containing configs (CONFIG_*) to add on to the + generated lib/config.h. Use #undef to override default configs. --host-key-document=HOST_KEY_DOCUMENT Specify the machine-specific host-key document for creating a PVM image with 'genprotimg' (s390x only) @@ -153,6 +155,10 @@ while [[ "$1" = -* ]]; do erratatxt= [ "$arg" ] && erratatxt=$(eval realpath "$arg") ;; + --add-config) + add_config= + [ "$arg" ] && add_config=$(eval realpath "$arg") + ;; --host-key-document) host_key_document="$arg" ;; @@ -213,6 +219,10 @@ if [ "$erratatxt" ] && [ ! -f "$erratatxt" ]; then echo "erratatxt: $erratatxt does not exist or is not a regular file" exit 1 fi +if [ "$add_config" ] && [ ! -f "$add_config" ]; then + echo "add-config: $add_config does not exist or is not a regular file" + exit 1 +fi arch_name=$arch [ "$arch" = "aarch64" ] && arch="arm64" @@ -502,4 +512,8 @@ cat <<EOF >> lib/config.h EOF fi +if [ "$add_config" ]; then + echo "/* Additional configs from $add_config */" >> lib/config.h + cat "$add_config" >> lib/config.h +fi echo "#endif" >> lib/config.h -- 2.46.0 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* [kvm-unit-tests PATCH 1/2] configure: Introduce add-config 2024-09-03 14:39 ` Andrew Jones @ 2024-09-11 0:39 ` Nicholas Piggin -1 siblings, 0 replies; 10+ messages in thread From: Nicholas Piggin @ 2024-09-11 0:39 UTC (permalink / raw) To: kvm-riscv On Wed Sep 4, 2024 at 12:39 AM AEST, Andrew Jones wrote: > Allow users to add additional CONFIG_* and override defaults > by concatenating a given file with #define's and #undef's to > lib/config.h That's a horrible config format lol, but probbaly the simplest way to get something working. What if you included the user config first, then make the generated config test ifndef before defining the default? Is it better to have a config file than to just add more --options to configure? If we had thousands of options maybe, but so far we are getting by with configure options. I think I prefer that for now unless we wholesale moved everything to a .config style. Thanks, Nick > > Signed-off-by: Andrew Jones <andrew.jones@linux.dev> > --- > configure | 14 ++++++++++++++ > 1 file changed, 14 insertions(+) > > diff --git a/configure b/configure > index 27ae9cc89657..7a1317d0650d 100755 > --- a/configure > +++ b/configure > @@ -64,6 +64,8 @@ usage() { > no environ is provided by the user (enabled by default) > --erratatxt=FILE specify a file to use instead of errata.txt. Use > '--erratatxt=' to ensure no file is used. > + --add-config=FILE specify a file containing configs (CONFIG_*) to add on to the > + generated lib/config.h. Use #undef to override default configs. > --host-key-document=HOST_KEY_DOCUMENT > Specify the machine-specific host-key document for creating > a PVM image with 'genprotimg' (s390x only) > @@ -153,6 +155,10 @@ while [[ "$1" = -* ]]; do > erratatxt= > [ "$arg" ] && erratatxt=$(eval realpath "$arg") > ;; > + --add-config) > + add_config= > + [ "$arg" ] && add_config=$(eval realpath "$arg") > + ;; > --host-key-document) > host_key_document="$arg" > ;; > @@ -213,6 +219,10 @@ if [ "$erratatxt" ] && [ ! -f "$erratatxt" ]; then > echo "erratatxt: $erratatxt does not exist or is not a regular file" > exit 1 > fi > +if [ "$add_config" ] && [ ! -f "$add_config" ]; then > + echo "add-config: $add_config does not exist or is not a regular file" > + exit 1 > +fi > > arch_name=$arch > [ "$arch" = "aarch64" ] && arch="arm64" > @@ -502,4 +512,8 @@ cat <<EOF >> lib/config.h > > EOF > fi > +if [ "$add_config" ]; then > + echo "/* Additional configs from $add_config */" >> lib/config.h > + cat "$add_config" >> lib/config.h > +fi > echo "#endif" >> lib/config.h ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [kvm-unit-tests PATCH 1/2] configure: Introduce add-config @ 2024-09-11 0:39 ` Nicholas Piggin 0 siblings, 0 replies; 10+ messages in thread From: Nicholas Piggin @ 2024-09-11 0:39 UTC (permalink / raw) To: Andrew Jones, kvm, kvm-riscv, kvmarm, linuxppc-dev, linux-s390 Cc: pbonzini, thuth, lvivier, frankja, imbrenda, nrb, atishp, cade.richard, jamestiotio On Wed Sep 4, 2024 at 12:39 AM AEST, Andrew Jones wrote: > Allow users to add additional CONFIG_* and override defaults > by concatenating a given file with #define's and #undef's to > lib/config.h That's a horrible config format lol, but probbaly the simplest way to get something working. What if you included the user config first, then make the generated config test ifndef before defining the default? Is it better to have a config file than to just add more --options to configure? If we had thousands of options maybe, but so far we are getting by with configure options. I think I prefer that for now unless we wholesale moved everything to a .config style. Thanks, Nick > > Signed-off-by: Andrew Jones <andrew.jones@linux.dev> > --- > configure | 14 ++++++++++++++ > 1 file changed, 14 insertions(+) > > diff --git a/configure b/configure > index 27ae9cc89657..7a1317d0650d 100755 > --- a/configure > +++ b/configure > @@ -64,6 +64,8 @@ usage() { > no environ is provided by the user (enabled by default) > --erratatxt=FILE specify a file to use instead of errata.txt. Use > '--erratatxt=' to ensure no file is used. > + --add-config=FILE specify a file containing configs (CONFIG_*) to add on to the > + generated lib/config.h. Use #undef to override default configs. > --host-key-document=HOST_KEY_DOCUMENT > Specify the machine-specific host-key document for creating > a PVM image with 'genprotimg' (s390x only) > @@ -153,6 +155,10 @@ while [[ "$1" = -* ]]; do > erratatxt= > [ "$arg" ] && erratatxt=$(eval realpath "$arg") > ;; > + --add-config) > + add_config= > + [ "$arg" ] && add_config=$(eval realpath "$arg") > + ;; > --host-key-document) > host_key_document="$arg" > ;; > @@ -213,6 +219,10 @@ if [ "$erratatxt" ] && [ ! -f "$erratatxt" ]; then > echo "erratatxt: $erratatxt does not exist or is not a regular file" > exit 1 > fi > +if [ "$add_config" ] && [ ! -f "$add_config" ]; then > + echo "add-config: $add_config does not exist or is not a regular file" > + exit 1 > +fi > > arch_name=$arch > [ "$arch" = "aarch64" ] && arch="arm64" > @@ -502,4 +512,8 @@ cat <<EOF >> lib/config.h > > EOF > fi > +if [ "$add_config" ]; then > + echo "/* Additional configs from $add_config */" >> lib/config.h > + cat "$add_config" >> lib/config.h > +fi > echo "#endif" >> lib/config.h ^ permalink raw reply [flat|nested] 10+ messages in thread
* [kvm-unit-tests PATCH 1/2] configure: Introduce add-config 2024-09-11 0:39 ` Nicholas Piggin @ 2024-09-11 8:15 ` Andrew Jones -1 siblings, 0 replies; 10+ messages in thread From: Andrew Jones @ 2024-09-11 8:15 UTC (permalink / raw) To: kvm-riscv On Wed, Sep 11, 2024 at 10:39:03AM GMT, Nicholas Piggin wrote: > On Wed Sep 4, 2024 at 12:39 AM AEST, Andrew Jones wrote: > > Allow users to add additional CONFIG_* and override defaults > > by concatenating a given file with #define's and #undef's to > > lib/config.h > > That's a horrible config format lol, but probbaly the simplest way to > get something working. What if you included the user config first, then > make the generated config test ifndef before defining the default? User config first and then #ifndef would indeed be better. > > Is it better to have a config file than to just add more --options to > configure? If we had thousands of options maybe, but so far we are > getting by with configure options. I have some unposted patches where I introduce two more configs, which is what inspired me to stop adding configure command line options. > I think I prefer that for now > unless we wholesale moved everything to a .config style. Moving to .config would be good, and importing and applying Kconfiglib doesn't look too daunting either. We can put this --add-config idea on hold until we've had a chance to experiment. Thanks, drew ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [kvm-unit-tests PATCH 1/2] configure: Introduce add-config @ 2024-09-11 8:15 ` Andrew Jones 0 siblings, 0 replies; 10+ messages in thread From: Andrew Jones @ 2024-09-11 8:15 UTC (permalink / raw) To: Nicholas Piggin Cc: kvm, kvm-riscv, kvmarm, linuxppc-dev, linux-s390, pbonzini, thuth, lvivier, frankja, imbrenda, nrb, atishp, cade.richard, jamestiotio On Wed, Sep 11, 2024 at 10:39:03AM GMT, Nicholas Piggin wrote: > On Wed Sep 4, 2024 at 12:39 AM AEST, Andrew Jones wrote: > > Allow users to add additional CONFIG_* and override defaults > > by concatenating a given file with #define's and #undef's to > > lib/config.h > > That's a horrible config format lol, but probbaly the simplest way to > get something working. What if you included the user config first, then > make the generated config test ifndef before defining the default? User config first and then #ifndef would indeed be better. > > Is it better to have a config file than to just add more --options to > configure? If we had thousands of options maybe, but so far we are > getting by with configure options. I have some unposted patches where I introduce two more configs, which is what inspired me to stop adding configure command line options. > I think I prefer that for now > unless we wholesale moved everything to a .config style. Moving to .config would be good, and importing and applying Kconfiglib doesn't look too daunting either. We can put this --add-config idea on hold until we've had a chance to experiment. Thanks, drew ^ permalink raw reply [flat|nested] 10+ messages in thread
* [kvm-unit-tests PATCH 2/2] riscv: Make NR_CPUS configurable 2024-09-03 14:39 ` Andrew Jones @ 2024-09-03 14:39 ` Andrew Jones -1 siblings, 0 replies; 10+ messages in thread From: Andrew Jones @ 2024-09-03 14:39 UTC (permalink / raw) To: kvm-riscv Unit tests would like to go nuts with the number of harts in order to help shake out issues with hart number assumptions. Rather than set a huge number that will only be used when a platform supports a huge number or when QEMU is told to exceed the recommended number of vcpus, make the number configurable. However, we do bump the default from 16 to 2*xlen since we would like to always force kvm-unit-tests to use cpumasks with more than one word in order to ensure that code stays maintained. To override the default for NR_CPUS to, e.g. 256, testers should use --add-config. For example, $ cat <<EOF > 256.config #undef CONFIG_NR_CPUS #define CONFIG_NR_CPUS 256 EOF $ ./configure --arch=riscv64 --cross-prefix=riscv64-linux-gnu- --add-config=256.config Signed-off-by: Andrew Jones <andrew.jones@linux.dev> --- configure | 3 ++- lib/riscv/asm/setup.h | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 7a1317d0650d..5ed0c28fcaea 100755 --- a/configure +++ b/configure @@ -508,7 +508,8 @@ EOF elif [ "$arch" = "riscv32" ] || [ "$arch" = "riscv64" ]; then cat <<EOF >> lib/config.h -#define CONFIG_UART_EARLY_BASE 0x10000000 +#define CONFIG_NR_CPUS (__riscv_xlen * 2) +#define CONFIG_UART_EARLY_BASE 0x10000000 EOF fi diff --git a/lib/riscv/asm/setup.h b/lib/riscv/asm/setup.h index a13159bfe395..43b63c56d96f 100644 --- a/lib/riscv/asm/setup.h +++ b/lib/riscv/asm/setup.h @@ -2,9 +2,10 @@ #ifndef _ASMRISCV_SETUP_H_ #define _ASMRISCV_SETUP_H_ #include <libcflat.h> +#include <config.h> #include <asm/processor.h> -#define NR_CPUS 16 +#define NR_CPUS CONFIG_NR_CPUS extern struct thread_info cpus[NR_CPUS]; extern int nr_cpus; extern uint64_t timebase_frequency; -- 2.46.0 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* [kvm-unit-tests PATCH 2/2] riscv: Make NR_CPUS configurable @ 2024-09-03 14:39 ` Andrew Jones 0 siblings, 0 replies; 10+ messages in thread From: Andrew Jones @ 2024-09-03 14:39 UTC (permalink / raw) To: kvm, kvm-riscv, kvmarm, linuxppc-dev, linux-s390 Cc: pbonzini, thuth, lvivier, frankja, imbrenda, nrb, atishp, cade.richard, jamestiotio Unit tests would like to go nuts with the number of harts in order to help shake out issues with hart number assumptions. Rather than set a huge number that will only be used when a platform supports a huge number or when QEMU is told to exceed the recommended number of vcpus, make the number configurable. However, we do bump the default from 16 to 2*xlen since we would like to always force kvm-unit-tests to use cpumasks with more than one word in order to ensure that code stays maintained. To override the default for NR_CPUS to, e.g. 256, testers should use --add-config. For example, $ cat <<EOF > 256.config #undef CONFIG_NR_CPUS #define CONFIG_NR_CPUS 256 EOF $ ./configure --arch=riscv64 --cross-prefix=riscv64-linux-gnu- --add-config=256.config Signed-off-by: Andrew Jones <andrew.jones@linux.dev> --- configure | 3 ++- lib/riscv/asm/setup.h | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 7a1317d0650d..5ed0c28fcaea 100755 --- a/configure +++ b/configure @@ -508,7 +508,8 @@ EOF elif [ "$arch" = "riscv32" ] || [ "$arch" = "riscv64" ]; then cat <<EOF >> lib/config.h -#define CONFIG_UART_EARLY_BASE 0x10000000 +#define CONFIG_NR_CPUS (__riscv_xlen * 2) +#define CONFIG_UART_EARLY_BASE 0x10000000 EOF fi diff --git a/lib/riscv/asm/setup.h b/lib/riscv/asm/setup.h index a13159bfe395..43b63c56d96f 100644 --- a/lib/riscv/asm/setup.h +++ b/lib/riscv/asm/setup.h @@ -2,9 +2,10 @@ #ifndef _ASMRISCV_SETUP_H_ #define _ASMRISCV_SETUP_H_ #include <libcflat.h> +#include <config.h> #include <asm/processor.h> -#define NR_CPUS 16 +#define NR_CPUS CONFIG_NR_CPUS extern struct thread_info cpus[NR_CPUS]; extern int nr_cpus; extern uint64_t timebase_frequency; -- 2.46.0 ^ permalink raw reply related [flat|nested] 10+ messages in thread
end of thread, other threads:[~2024-09-11 8:15 UTC | newest] Thread overview: 10+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2024-09-03 14:39 [kvm-unit-tests PATCH 0/2] configure: Support CONFIG_* extension Andrew Jones 2024-09-03 14:39 ` Andrew Jones 2024-09-03 14:39 ` [kvm-unit-tests PATCH 1/2] configure: Introduce add-config Andrew Jones 2024-09-03 14:39 ` Andrew Jones 2024-09-11 0:39 ` Nicholas Piggin 2024-09-11 0:39 ` Nicholas Piggin 2024-09-11 8:15 ` Andrew Jones 2024-09-11 8:15 ` Andrew Jones 2024-09-03 14:39 ` [kvm-unit-tests PATCH 2/2] riscv: Make NR_CPUS configurable Andrew Jones 2024-09-03 14:39 ` Andrew Jones
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.