[PATCH v12 1/8] xen/riscv: disable unnecessary configs

Oleksii Kurochko posted 8 patches 5 months, 4 weeks ago
[PATCH v12 1/8] xen/riscv: disable unnecessary configs
Posted by Oleksii Kurochko 5 months, 4 weeks ago
Disables unnecessary configs for two cases:
1. By utilizing EXTRA_FIXED_RANDCONFIG for randconfig builds (GitLab CI jobs).
2. By using tiny64_defconfig for non-randconfig builds.

Only configs which lead to compilation issues were disabled.

Remove lines related to disablement of configs which aren't affected
compilation:
 -# CONFIG_SCHED_CREDIT is not set
 -# CONFIG_SCHED_RTDS is not set
 -# CONFIG_SCHED_NULL is not set
 -# CONFIG_SCHED_ARINC653 is not set
 -# CONFIG_TRACEBUFFER is not set
 -# CONFIG_HYPFS is not set
 -# CONFIG_SPECULATIVE_HARDEN_ARRAY is not set

To allow CONFIG_ARGO build happy it was included <asm/p2m.h> to <asm/domain.h>
as ARGO requires p2m_type_t ( p2m_ram_rw ) and declaration of
check_get_page_from_gfn() from xen/p2m-common.h.

Also, it was included <xen/errno.h> to asm/p2m.h as after the latter was
included to <asm/domain.h> the compilation error that EINVAL, EOPNOTSUPP
aren't declared started to occur.

CONFIG_XSM=n as it requires an introduction of:
* boot_module_find_by_kind()
* BOOTMOD_XSM
* struct bootmodule
* copy_from_paddr()
The mentioned things aren't introduced now.

CPU_BOOT_TIME_CPUPOOLS requires an introduction of cpu_physical_id() and
acpi_disabled, so it is disabled for now.

PERF_COUNTERS requires asm/perf.h and asm/perfc-defn.h, so it is
also disabled for now, as RISC-V hasn't introduced this headers yet.

LIVEPATCH isn't ready for RISC-V too and it can be overriden by randconfig,
so to avoid compilation errors for randconfig it is disabled for now.

Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
---
Changes in V10-V12:
 - Nothing changed. Only rebase.
---
Changes in V9:
 - update the commit message: add info about LIVEPATCH and PERF_COUNTERS.
---
Changes in V8:
 - disabled CPU_BOOT_TIME_CPUPOOLS as it requires an introduction of cpu_physical_id() and acpi_disabled.
 - leave XSM disabled, add explanation in the commit message.
 - drop HYPFS as the patch was provided to resolve compilation issue when this condif is enabled for RISC-V.
 - include asm/p2m.h to asm/domain.h, and xen/errno.h to asm/p2m.h to drop ARGO config from
   tiny64_defconfing and build.yaml.
 - update the commit message.
---
Changes in V7:
 - Disable only configs which cause compilation issues.
 - Update the commit message.
---
Changes in V6:
 - Nothing changed. Only rebase.
---
Changes in V5:
 - Rebase and drop duplicated configs in EXTRA_FIXED_RANDCONFIG list
 - Update the commit message
---
Changes in V4:
 - Nothing changed. Only rebase
---
Changes in V3:
 - Remove EXTRA_FIXED_RANDCONFIG for non-randconfig jobs.
   For non-randconfig jobs, it is sufficient to disable configs by using the defconfig.
 - Remove double blank lines in build.yaml file before archlinux-current-gcc-riscv64-debug
---
Changes in V2:
 - update the commit message.
 - remove xen/arch/riscv/Kconfig changes.
---
 automation/gitlab-ci/build.yaml         |  4 ++++
 xen/arch/riscv/configs/tiny64_defconfig | 12 +++++-------
 xen/arch/riscv/include/asm/domain.h     |  2 ++
 xen/arch/riscv/include/asm/p2m.h        |  2 ++
 4 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/automation/gitlab-ci/build.yaml b/automation/gitlab-ci/build.yaml
index 5985be9378..3290a36dca 100644
--- a/automation/gitlab-ci/build.yaml
+++ b/automation/gitlab-ci/build.yaml
@@ -379,10 +379,14 @@ alpine-3.18-gcc-debug-arm64:
 .riscv-fixed-randconfig:
   variables: &riscv-fixed-randconfig
     EXTRA_FIXED_RANDCONFIG: |
+      CONFIG_BOOT_TIME_CPUPOOLS=n
       CONFIG_COVERAGE=n
       CONFIG_EXPERT=y
       CONFIG_GRANT_TABLE=n
       CONFIG_MEM_ACCESS=n
+      CONFIG_PERF_COUNTERS=n
+      CONFIG_LIVEPATCH=n
+      CONFIG_XSM=n
 
 archlinux-current-gcc-riscv64-debug:
   extends: .gcc-riscv64-cross-build-debug
diff --git a/xen/arch/riscv/configs/tiny64_defconfig b/xen/arch/riscv/configs/tiny64_defconfig
index 09defe236b..fc7a04872f 100644
--- a/xen/arch/riscv/configs/tiny64_defconfig
+++ b/xen/arch/riscv/configs/tiny64_defconfig
@@ -1,12 +1,10 @@
-# CONFIG_SCHED_CREDIT is not set
-# CONFIG_SCHED_RTDS is not set
-# CONFIG_SCHED_NULL is not set
-# CONFIG_SCHED_ARINC653 is not set
-# CONFIG_TRACEBUFFER is not set
-# CONFIG_HYPFS is not set
+# CONFIG_BOOT_TIME_CPUPOOLS is not set
 # CONFIG_GRANT_TABLE is not set
-# CONFIG_SPECULATIVE_HARDEN_ARRAY is not set
 # CONFIG_MEM_ACCESS is not set
+# CONFIG_PERF_COUNTERS is not set
+# CONFIG_COVERAGE is not set
+# CONFIG_LIVEPATCH is not set
+# CONFIG_XSM is not set
 
 CONFIG_RISCV_64=y
 CONFIG_DEBUG=y
diff --git a/xen/arch/riscv/include/asm/domain.h b/xen/arch/riscv/include/asm/domain.h
index 027bfa8a93..16a9dd57aa 100644
--- a/xen/arch/riscv/include/asm/domain.h
+++ b/xen/arch/riscv/include/asm/domain.h
@@ -5,6 +5,8 @@
 #include <xen/xmalloc.h>
 #include <public/hvm/params.h>
 
+#include <asm/p2m.h>
+
 struct hvm_domain
 {
     uint64_t              params[HVM_NR_PARAMS];
diff --git a/xen/arch/riscv/include/asm/p2m.h b/xen/arch/riscv/include/asm/p2m.h
index 387f372b5d..26860c0ae7 100644
--- a/xen/arch/riscv/include/asm/p2m.h
+++ b/xen/arch/riscv/include/asm/p2m.h
@@ -2,6 +2,8 @@
 #ifndef __ASM_RISCV_P2M_H__
 #define __ASM_RISCV_P2M_H__
 
+#include <xen/errno.h>
+
 #include <asm/page-bits.h>
 
 #define paddr_bits PADDR_BITS
-- 
2.45.0
Re: [PATCH v12 1/8] xen/riscv: disable unnecessary configs
Posted by Andrew Cooper 5 months, 3 weeks ago
The subject should say "update Kconfig", because you're not (only)
disabling.

I'd suggest "xen/riscv: Update Kconfig in preparation for a full Xen build".

On 29/05/2024 8:55 pm, Oleksii Kurochko wrote:
> Disables unnecessary configs for two cases:
> 1. By utilizing EXTRA_FIXED_RANDCONFIG for randconfig builds (GitLab CI jobs).
> 2. By using tiny64_defconfig for non-randconfig builds.
>
> Only configs which lead to compilation issues were disabled.
>
> Remove lines related to disablement of configs which aren't affected
> compilation:
>  -# CONFIG_SCHED_CREDIT is not set
>  -# CONFIG_SCHED_RTDS is not set
>  -# CONFIG_SCHED_NULL is not set
>  -# CONFIG_SCHED_ARINC653 is not set
>  -# CONFIG_TRACEBUFFER is not set
>  -# CONFIG_HYPFS is not set
>  -# CONFIG_SPECULATIVE_HARDEN_ARRAY is not set
>
> To allow CONFIG_ARGO build happy it was included <asm/p2m.h> to <asm/domain.h>
> as ARGO requires p2m_type_t ( p2m_ram_rw ) and declaration of
> check_get_page_from_gfn() from xen/p2m-common.h.
>
> Also, it was included <xen/errno.h> to asm/p2m.h as after the latter was
> included to <asm/domain.h> the compilation error that EINVAL, EOPNOTSUPP
> aren't declared started to occur.
>
> CONFIG_XSM=n as it requires an introduction of:
> * boot_module_find_by_kind()
> * BOOTMOD_XSM
> * struct bootmodule
> * copy_from_paddr()
> The mentioned things aren't introduced now.
>
> CPU_BOOT_TIME_CPUPOOLS requires an introduction of cpu_physical_id() and
> acpi_disabled, so it is disabled for now.

CONFIG_BOOT_TIME_CPUPOOLS

Also the "depends on DT" isn't good enough as a restriction IMO.  It's
very ARM-dom0less specific.

> PERF_COUNTERS requires asm/perf.h and asm/perfc-defn.h, so it is
> also disabled for now, as RISC-V hasn't introduced this headers yet.
> LIVEPATCH isn't ready for RISC-V too and it can be overriden by randconfig,
> so to avoid compilation errors for randconfig it is disabled for now.

PERF_COUNTERS is x86-only, and both LIVEPATCH really should be guarded
by have HAVE_$FOO selected by ARCH.

However, that's not work to get stuck into now.

It's quite unreasonable how much stuff doesn't work in simple builds...

> Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>

Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>

I'm happy to fix up the two minor issues on commit.

Re: [PATCH v12 1/8] xen/riscv: disable unnecessary configs
Posted by Andrew Cooper 5 months, 3 weeks ago
On 30/05/2024 5:44 pm, Andrew Cooper wrote:
> On 29/05/2024 8:55 pm, Oleksii Kurochko wrote:
>> To allow CONFIG_ARGO build happy it was included <asm/p2m.h> to <asm/domain.h>
>> as ARGO requires p2m_type_t ( p2m_ram_rw ) and declaration of
>> check_get_page_from_gfn() from xen/p2m-common.h.

Actually, this is an ARGO bug not a RISC-V bug.

It only builds in other architectures because of transitive dependencies
through asm/domain.h

I've fixed up argo.c to include the right header, which also prevents
(for now at least) adding to general tangle which is asm/domain.h

~Andrew
Re: [PATCH v12 1/8] xen/riscv: disable unnecessary configs
Posted by Oleksii K. 5 months, 3 weeks ago
On Thu, 2024-05-30 at 17:44 +0100, Andrew Cooper wrote:
> 
> The subject should say "update Kconfig", because you're not (only)
> disabling.
> 
> I'd suggest "xen/riscv: Update Kconfig in preparation for a full Xen
> build".
> 
> On 29/05/2024 8:55 pm, Oleksii Kurochko wrote:
> > Disables unnecessary configs for two cases:
> > 1. By utilizing EXTRA_FIXED_RANDCONFIG for randconfig builds
> > (GitLab CI jobs).
> > 2. By using tiny64_defconfig for non-randconfig builds.
> > 
> > Only configs which lead to compilation issues were disabled.
> > 
> > Remove lines related to disablement of configs which aren't
> > affected
> > compilation:
> >  -# CONFIG_SCHED_CREDIT is not set
> >  -# CONFIG_SCHED_RTDS is not set
> >  -# CONFIG_SCHED_NULL is not set
> >  -# CONFIG_SCHED_ARINC653 is not set
> >  -# CONFIG_TRACEBUFFER is not set
> >  -# CONFIG_HYPFS is not set
> >  -# CONFIG_SPECULATIVE_HARDEN_ARRAY is not set
> > 
> > To allow CONFIG_ARGO build happy it was included <asm/p2m.h> to
> > <asm/domain.h>
> > as ARGO requires p2m_type_t ( p2m_ram_rw ) and declaration of
> > check_get_page_from_gfn() from xen/p2m-common.h.
> > 
> > Also, it was included <xen/errno.h> to asm/p2m.h as after the
> > latter was
> > included to <asm/domain.h> the compilation error that EINVAL,
> > EOPNOTSUPP
> > aren't declared started to occur.
> > 
> > CONFIG_XSM=n as it requires an introduction of:
> > * boot_module_find_by_kind()
> > * BOOTMOD_XSM
> > * struct bootmodule
> > * copy_from_paddr()
> > The mentioned things aren't introduced now.
> > 
> > CPU_BOOT_TIME_CPUPOOLS requires an introduction of
> > cpu_physical_id() and
> > acpi_disabled, so it is disabled for now.
> 
> CONFIG_BOOT_TIME_CPUPOOLS
> 
> Also the "depends on DT" isn't good enough as a restriction IMO. 
> It's
> very ARM-dom0less specific.
> 
> > PERF_COUNTERS requires asm/perf.h and asm/perfc-defn.h, so it is
> > also disabled for now, as RISC-V hasn't introduced this headers
> > yet.
> > LIVEPATCH isn't ready for RISC-V too and it can be overriden by
> > randconfig,
> > so to avoid compilation errors for randconfig it is disabled for
> > now.
> 
> PERF_COUNTERS is x86-only, and both LIVEPATCH really should be
> guarded
> by have HAVE_$FOO selected by ARCH.
> 
> However, that's not work to get stuck into now.
> 
> It's quite unreasonable how much stuff doesn't work in simple
> builds...
> 
> > Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
> 
> Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
> 
> I'm happy to fix up the two minor issues on commit.
Thanks. I Would appreciate that.

~ Oleksii