* [PATCH] riscv: don't warn for sifive erratas in modules @ 2022-06-08 12:08 ` Heiko Stuebner 0 siblings, 0 replies; 12+ messages in thread From: Heiko Stuebner @ 2022-06-08 12:08 UTC (permalink / raw) To: palmer, paul.walmsley Cc: linux-riscv, linux-kernel, wefu, guoren, cmuellner, philipp.tomsich, hch, Heiko Stuebner, Ron Economos The SiFive errata code contains code checking applicable erratas vs. actually applied erratas to suggest missing erratas to the user when their Kconfig options are not enabled. In the main kernel image one can be quite sure that all available erratas appear at least once, so that check will succeed. On the other hand modules can very well not use any errata-relevant code, so the newly added module-alternative support may also patch the module code, but not touch SiFive-specific erratas at all. So to restore the original behaviour don't warn when patching modules. This will keep the warning if necessary for the main kernel image but prevent spurious warnings for modules. Of course having such a vendor-specific warning may not be needed at all, as CONFIG_ERRATA_SIFIVE is selected by CONFIG_SOC_SIFIVE and the individual erratas are default-y so disabling them requires deliberate action anyway. But for now just restore the old behaviour. Fixes: a8e910168bba ("riscv: implement module alternatives") Reported-by: Ron Economos <re@w6rz.net> Signed-off-by: Heiko Stuebner <heiko@sntech.de> --- arch/riscv/errata/sifive/errata.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/riscv/errata/sifive/errata.c b/arch/riscv/errata/sifive/errata.c index 672f02b21ce0..1031038423e7 100644 --- a/arch/riscv/errata/sifive/errata.c +++ b/arch/riscv/errata/sifive/errata.c @@ -111,6 +111,7 @@ void __init_or_module sifive_errata_patch_func(struct alt_entry *begin, cpu_apply_errata |= tmp; } } - if (cpu_apply_errata != cpu_req_errata) + if (stage != RISCV_ALTERNATIVES_MODULE && + cpu_apply_errata != cpu_req_errata) warn_miss_errata(cpu_req_errata - cpu_apply_errata); } -- 2.35.1 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH] riscv: don't warn for sifive erratas in modules @ 2022-06-08 12:08 ` Heiko Stuebner 0 siblings, 0 replies; 12+ messages in thread From: Heiko Stuebner @ 2022-06-08 12:08 UTC (permalink / raw) To: palmer, paul.walmsley Cc: linux-riscv, linux-kernel, wefu, guoren, cmuellner, philipp.tomsich, hch, Heiko Stuebner, Ron Economos The SiFive errata code contains code checking applicable erratas vs. actually applied erratas to suggest missing erratas to the user when their Kconfig options are not enabled. In the main kernel image one can be quite sure that all available erratas appear at least once, so that check will succeed. On the other hand modules can very well not use any errata-relevant code, so the newly added module-alternative support may also patch the module code, but not touch SiFive-specific erratas at all. So to restore the original behaviour don't warn when patching modules. This will keep the warning if necessary for the main kernel image but prevent spurious warnings for modules. Of course having such a vendor-specific warning may not be needed at all, as CONFIG_ERRATA_SIFIVE is selected by CONFIG_SOC_SIFIVE and the individual erratas are default-y so disabling them requires deliberate action anyway. But for now just restore the old behaviour. Fixes: a8e910168bba ("riscv: implement module alternatives") Reported-by: Ron Economos <re@w6rz.net> Signed-off-by: Heiko Stuebner <heiko@sntech.de> --- arch/riscv/errata/sifive/errata.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/riscv/errata/sifive/errata.c b/arch/riscv/errata/sifive/errata.c index 672f02b21ce0..1031038423e7 100644 --- a/arch/riscv/errata/sifive/errata.c +++ b/arch/riscv/errata/sifive/errata.c @@ -111,6 +111,7 @@ void __init_or_module sifive_errata_patch_func(struct alt_entry *begin, cpu_apply_errata |= tmp; } } - if (cpu_apply_errata != cpu_req_errata) + if (stage != RISCV_ALTERNATIVES_MODULE && + cpu_apply_errata != cpu_req_errata) warn_miss_errata(cpu_req_errata - cpu_apply_errata); } -- 2.35.1 _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH] riscv: don't warn for sifive erratas in modules 2022-06-08 12:08 ` Heiko Stuebner @ 2022-06-09 1:39 ` Guo Ren -1 siblings, 0 replies; 12+ messages in thread From: Guo Ren @ 2022-06-09 1:39 UTC (permalink / raw) To: Heiko Stuebner Cc: Palmer Dabbelt, Paul Walmsley, linux-riscv, Linux Kernel Mailing List, Wei Fu, Christoph Muellner, Philipp Tomsich, Christoph Hellwig, Ron Economos On Wed, Jun 8, 2022 at 8:09 PM Heiko Stuebner <heiko@sntech.de> wrote: > > The SiFive errata code contains code checking applicable erratas > vs. actually applied erratas to suggest missing erratas to the > user when their Kconfig options are not enabled. > > In the main kernel image one can be quite sure that all available > erratas appear at least once, so that check will succeed. > On the other hand modules can very well not use any errata-relevant > code, so the newly added module-alternative support may also patch > the module code, but not touch SiFive-specific erratas at all. > > So to restore the original behaviour don't warn when patching > modules. This will keep the warning if necessary for the main kernel > image but prevent spurious warnings for modules. > > Of course having such a vendor-specific warning may not be needed at > all, as CONFIG_ERRATA_SIFIVE is selected by CONFIG_SOC_SIFIVE and the > individual erratas are default-y so disabling them requires > deliberate action anyway. But for now just restore the old behaviour. > > Fixes: a8e910168bba ("riscv: implement module alternatives") > Reported-by: Ron Economos <re@w6rz.net> > Signed-off-by: Heiko Stuebner <heiko@sntech.de> > --- > arch/riscv/errata/sifive/errata.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/arch/riscv/errata/sifive/errata.c b/arch/riscv/errata/sifive/errata.c > index 672f02b21ce0..1031038423e7 100644 > --- a/arch/riscv/errata/sifive/errata.c > +++ b/arch/riscv/errata/sifive/errata.c > @@ -111,6 +111,7 @@ void __init_or_module sifive_errata_patch_func(struct alt_entry *begin, > cpu_apply_errata |= tmp; > } > } > - if (cpu_apply_errata != cpu_req_errata) > + if (stage != RISCV_ALTERNATIVES_MODULE && > + cpu_apply_errata != cpu_req_errata) if (cpu_apply_errata &= ~cpu_req_errata) Shall we still guarantee the module's must be a subset of the main kernel.'s? > warn_miss_errata(cpu_req_errata - cpu_apply_errata); > } > -- > 2.35.1 > -- Best Regards Guo Ren ML: https://lore.kernel.org/linux-csky/ ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] riscv: don't warn for sifive erratas in modules @ 2022-06-09 1:39 ` Guo Ren 0 siblings, 0 replies; 12+ messages in thread From: Guo Ren @ 2022-06-09 1:39 UTC (permalink / raw) To: Heiko Stuebner Cc: Palmer Dabbelt, Paul Walmsley, linux-riscv, Linux Kernel Mailing List, Wei Fu, Christoph Muellner, Philipp Tomsich, Christoph Hellwig, Ron Economos On Wed, Jun 8, 2022 at 8:09 PM Heiko Stuebner <heiko@sntech.de> wrote: > > The SiFive errata code contains code checking applicable erratas > vs. actually applied erratas to suggest missing erratas to the > user when their Kconfig options are not enabled. > > In the main kernel image one can be quite sure that all available > erratas appear at least once, so that check will succeed. > On the other hand modules can very well not use any errata-relevant > code, so the newly added module-alternative support may also patch > the module code, but not touch SiFive-specific erratas at all. > > So to restore the original behaviour don't warn when patching > modules. This will keep the warning if necessary for the main kernel > image but prevent spurious warnings for modules. > > Of course having such a vendor-specific warning may not be needed at > all, as CONFIG_ERRATA_SIFIVE is selected by CONFIG_SOC_SIFIVE and the > individual erratas are default-y so disabling them requires > deliberate action anyway. But for now just restore the old behaviour. > > Fixes: a8e910168bba ("riscv: implement module alternatives") > Reported-by: Ron Economos <re@w6rz.net> > Signed-off-by: Heiko Stuebner <heiko@sntech.de> > --- > arch/riscv/errata/sifive/errata.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/arch/riscv/errata/sifive/errata.c b/arch/riscv/errata/sifive/errata.c > index 672f02b21ce0..1031038423e7 100644 > --- a/arch/riscv/errata/sifive/errata.c > +++ b/arch/riscv/errata/sifive/errata.c > @@ -111,6 +111,7 @@ void __init_or_module sifive_errata_patch_func(struct alt_entry *begin, > cpu_apply_errata |= tmp; > } > } > - if (cpu_apply_errata != cpu_req_errata) > + if (stage != RISCV_ALTERNATIVES_MODULE && > + cpu_apply_errata != cpu_req_errata) if (cpu_apply_errata &= ~cpu_req_errata) Shall we still guarantee the module's must be a subset of the main kernel.'s? > warn_miss_errata(cpu_req_errata - cpu_apply_errata); > } > -- > 2.35.1 > -- Best Regards Guo Ren ML: https://lore.kernel.org/linux-csky/ _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] riscv: don't warn for sifive erratas in modules 2022-06-09 1:39 ` Guo Ren @ 2022-06-09 9:58 ` Heiko Stübner -1 siblings, 0 replies; 12+ messages in thread From: Heiko Stübner @ 2022-06-09 9:58 UTC (permalink / raw) To: Guo Ren Cc: Palmer Dabbelt, Paul Walmsley, linux-riscv, Linux Kernel Mailing List, Wei Fu, Christoph Muellner, Philipp Tomsich, Christoph Hellwig, Ron Economos Hi Guo, Am Donnerstag, 9. Juni 2022, 03:39:24 CEST schrieb Guo Ren: > On Wed, Jun 8, 2022 at 8:09 PM Heiko Stuebner <heiko@sntech.de> wrote: > > > > The SiFive errata code contains code checking applicable erratas > > vs. actually applied erratas to suggest missing erratas to the > > user when their Kconfig options are not enabled. > > > > In the main kernel image one can be quite sure that all available > > erratas appear at least once, so that check will succeed. > > On the other hand modules can very well not use any errata-relevant > > code, so the newly added module-alternative support may also patch > > the module code, but not touch SiFive-specific erratas at all. > > > > So to restore the original behaviour don't warn when patching > > modules. This will keep the warning if necessary for the main kernel > > image but prevent spurious warnings for modules. > > > > Of course having such a vendor-specific warning may not be needed at > > all, as CONFIG_ERRATA_SIFIVE is selected by CONFIG_SOC_SIFIVE and the > > individual erratas are default-y so disabling them requires > > deliberate action anyway. But for now just restore the old behaviour. > > > > Fixes: a8e910168bba ("riscv: implement module alternatives") > > Reported-by: Ron Economos <re@w6rz.net> > > Signed-off-by: Heiko Stuebner <heiko@sntech.de> > > --- > > arch/riscv/errata/sifive/errata.c | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/arch/riscv/errata/sifive/errata.c b/arch/riscv/errata/sifive/errata.c > > index 672f02b21ce0..1031038423e7 100644 > > --- a/arch/riscv/errata/sifive/errata.c > > +++ b/arch/riscv/errata/sifive/errata.c > > @@ -111,6 +111,7 @@ void __init_or_module sifive_errata_patch_func(struct alt_entry *begin, > > cpu_apply_errata |= tmp; > > } > > } > > - if (cpu_apply_errata != cpu_req_errata) > > + if (stage != RISCV_ALTERNATIVES_MODULE && > > + cpu_apply_errata != cpu_req_errata) > if (cpu_apply_errata &= ~cpu_req_errata) Hmm, I don't see what that changes? > Shall we still guarantee the module's must be a subset of the main kernel.'s? The warning generated there is mainly to warn about some Kconfig options not being enabled and in individual modules even no errata usage may be required. The intent for the patch is to restore how things behaved before module-alternatives were introduced, so I don't really want to introduce functional changes ;-) . But also in the future we could debate if that warning is helpful at all, as the erratas are enabled automatically by CONFIG_SOC_SIFIVE and thus disabling individual erratas requires someone to turn them off manually in their .config . Heiko > > warn_miss_errata(cpu_req_errata - cpu_apply_errata); > > } > > -- > > 2.35.1 > > > > > ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] riscv: don't warn for sifive erratas in modules @ 2022-06-09 9:58 ` Heiko Stübner 0 siblings, 0 replies; 12+ messages in thread From: Heiko Stübner @ 2022-06-09 9:58 UTC (permalink / raw) To: Guo Ren Cc: Palmer Dabbelt, Paul Walmsley, linux-riscv, Linux Kernel Mailing List, Wei Fu, Christoph Muellner, Philipp Tomsich, Christoph Hellwig, Ron Economos Hi Guo, Am Donnerstag, 9. Juni 2022, 03:39:24 CEST schrieb Guo Ren: > On Wed, Jun 8, 2022 at 8:09 PM Heiko Stuebner <heiko@sntech.de> wrote: > > > > The SiFive errata code contains code checking applicable erratas > > vs. actually applied erratas to suggest missing erratas to the > > user when their Kconfig options are not enabled. > > > > In the main kernel image one can be quite sure that all available > > erratas appear at least once, so that check will succeed. > > On the other hand modules can very well not use any errata-relevant > > code, so the newly added module-alternative support may also patch > > the module code, but not touch SiFive-specific erratas at all. > > > > So to restore the original behaviour don't warn when patching > > modules. This will keep the warning if necessary for the main kernel > > image but prevent spurious warnings for modules. > > > > Of course having such a vendor-specific warning may not be needed at > > all, as CONFIG_ERRATA_SIFIVE is selected by CONFIG_SOC_SIFIVE and the > > individual erratas are default-y so disabling them requires > > deliberate action anyway. But for now just restore the old behaviour. > > > > Fixes: a8e910168bba ("riscv: implement module alternatives") > > Reported-by: Ron Economos <re@w6rz.net> > > Signed-off-by: Heiko Stuebner <heiko@sntech.de> > > --- > > arch/riscv/errata/sifive/errata.c | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/arch/riscv/errata/sifive/errata.c b/arch/riscv/errata/sifive/errata.c > > index 672f02b21ce0..1031038423e7 100644 > > --- a/arch/riscv/errata/sifive/errata.c > > +++ b/arch/riscv/errata/sifive/errata.c > > @@ -111,6 +111,7 @@ void __init_or_module sifive_errata_patch_func(struct alt_entry *begin, > > cpu_apply_errata |= tmp; > > } > > } > > - if (cpu_apply_errata != cpu_req_errata) > > + if (stage != RISCV_ALTERNATIVES_MODULE && > > + cpu_apply_errata != cpu_req_errata) > if (cpu_apply_errata &= ~cpu_req_errata) Hmm, I don't see what that changes? > Shall we still guarantee the module's must be a subset of the main kernel.'s? The warning generated there is mainly to warn about some Kconfig options not being enabled and in individual modules even no errata usage may be required. The intent for the patch is to restore how things behaved before module-alternatives were introduced, so I don't really want to introduce functional changes ;-) . But also in the future we could debate if that warning is helpful at all, as the erratas are enabled automatically by CONFIG_SOC_SIFIVE and thus disabling individual erratas requires someone to turn them off manually in their .config . Heiko > > warn_miss_errata(cpu_req_errata - cpu_apply_errata); > > } > > -- > > 2.35.1 > > > > > _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] riscv: don't warn for sifive erratas in modules 2022-06-09 9:58 ` Heiko Stübner @ 2022-06-10 1:12 ` Guo Ren -1 siblings, 0 replies; 12+ messages in thread From: Guo Ren @ 2022-06-10 1:12 UTC (permalink / raw) To: Heiko Stübner Cc: Palmer Dabbelt, Paul Walmsley, linux-riscv, Linux Kernel Mailing List, Wei Fu, Christoph Muellner, Philipp Tomsich, Christoph Hellwig, Ron Economos On Thu, Jun 9, 2022 at 5:58 PM Heiko Stübner <heiko@sntech.de> wrote: > > Hi Guo, > > Am Donnerstag, 9. Juni 2022, 03:39:24 CEST schrieb Guo Ren: > > On Wed, Jun 8, 2022 at 8:09 PM Heiko Stuebner <heiko@sntech.de> wrote: > > > > > > The SiFive errata code contains code checking applicable erratas > > > vs. actually applied erratas to suggest missing erratas to the > > > user when their Kconfig options are not enabled. > > > > > > In the main kernel image one can be quite sure that all available > > > erratas appear at least once, so that check will succeed. > > > On the other hand modules can very well not use any errata-relevant > > > code, so the newly added module-alternative support may also patch > > > the module code, but not touch SiFive-specific erratas at all. > > > > > > So to restore the original behaviour don't warn when patching > > > modules. This will keep the warning if necessary for the main kernel > > > image but prevent spurious warnings for modules. > > > > > > Of course having such a vendor-specific warning may not be needed at > > > all, as CONFIG_ERRATA_SIFIVE is selected by CONFIG_SOC_SIFIVE and the > > > individual erratas are default-y so disabling them requires > > > deliberate action anyway. But for now just restore the old behaviour. > > > > > > Fixes: a8e910168bba ("riscv: implement module alternatives") > > > Reported-by: Ron Economos <re@w6rz.net> > > > Signed-off-by: Heiko Stuebner <heiko@sntech.de> > > > --- > > > arch/riscv/errata/sifive/errata.c | 3 ++- > > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > > > diff --git a/arch/riscv/errata/sifive/errata.c b/arch/riscv/errata/sifive/errata.c > > > index 672f02b21ce0..1031038423e7 100644 > > > --- a/arch/riscv/errata/sifive/errata.c > > > +++ b/arch/riscv/errata/sifive/errata.c > > > @@ -111,6 +111,7 @@ void __init_or_module sifive_errata_patch_func(struct alt_entry *begin, > > > cpu_apply_errata |= tmp; > > > } > > > } > > > - if (cpu_apply_errata != cpu_req_errata) > > > + if (stage != RISCV_ALTERNATIVES_MODULE && > > > + cpu_apply_errata != cpu_req_errata) > > if (cpu_apply_errata &= ~cpu_req_errata) > > Hmm, I don't see what that changes? + if (stage != RISCV_ALTERNATIVES_MODULE && + cpu_apply_errata != cpu_req_errata) warn_miss_errata(cpu_req_errata - cpu_apply_errata); + else if (cpu_apply_errata &= ~cpu_req_errata) warn_miss_errata(cpu_req_errata - cpu_apply_errata); All module's errata should be a subset of the main kernel. Not just skip the check of MODULE. > > > > Shall we still guarantee the module's must be a subset of the main kernel.'s? > > The warning generated there is mainly to warn about some Kconfig options > not being enabled and in individual modules even no errata usage may be > required. > > > The intent for the patch is to restore how things behaved before > module-alternatives were introduced, so I don't really want to > introduce functional changes ;-) . > > But also in the future we could debate if that warning is helpful at all, > as the erratas are enabled automatically by CONFIG_SOC_SIFIVE and > thus disabling individual erratas requires someone to turn them off > manually in their .config . > > > Heiko > > > > warn_miss_errata(cpu_req_errata - cpu_apply_errata); > > > } > > > -- > > > 2.35.1 > > > > > > > > > > > > > -- Best Regards Guo Ren ML: https://lore.kernel.org/linux-csky/ ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] riscv: don't warn for sifive erratas in modules @ 2022-06-10 1:12 ` Guo Ren 0 siblings, 0 replies; 12+ messages in thread From: Guo Ren @ 2022-06-10 1:12 UTC (permalink / raw) To: Heiko Stübner Cc: Palmer Dabbelt, Paul Walmsley, linux-riscv, Linux Kernel Mailing List, Wei Fu, Christoph Muellner, Philipp Tomsich, Christoph Hellwig, Ron Economos On Thu, Jun 9, 2022 at 5:58 PM Heiko Stübner <heiko@sntech.de> wrote: > > Hi Guo, > > Am Donnerstag, 9. Juni 2022, 03:39:24 CEST schrieb Guo Ren: > > On Wed, Jun 8, 2022 at 8:09 PM Heiko Stuebner <heiko@sntech.de> wrote: > > > > > > The SiFive errata code contains code checking applicable erratas > > > vs. actually applied erratas to suggest missing erratas to the > > > user when their Kconfig options are not enabled. > > > > > > In the main kernel image one can be quite sure that all available > > > erratas appear at least once, so that check will succeed. > > > On the other hand modules can very well not use any errata-relevant > > > code, so the newly added module-alternative support may also patch > > > the module code, but not touch SiFive-specific erratas at all. > > > > > > So to restore the original behaviour don't warn when patching > > > modules. This will keep the warning if necessary for the main kernel > > > image but prevent spurious warnings for modules. > > > > > > Of course having such a vendor-specific warning may not be needed at > > > all, as CONFIG_ERRATA_SIFIVE is selected by CONFIG_SOC_SIFIVE and the > > > individual erratas are default-y so disabling them requires > > > deliberate action anyway. But for now just restore the old behaviour. > > > > > > Fixes: a8e910168bba ("riscv: implement module alternatives") > > > Reported-by: Ron Economos <re@w6rz.net> > > > Signed-off-by: Heiko Stuebner <heiko@sntech.de> > > > --- > > > arch/riscv/errata/sifive/errata.c | 3 ++- > > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > > > diff --git a/arch/riscv/errata/sifive/errata.c b/arch/riscv/errata/sifive/errata.c > > > index 672f02b21ce0..1031038423e7 100644 > > > --- a/arch/riscv/errata/sifive/errata.c > > > +++ b/arch/riscv/errata/sifive/errata.c > > > @@ -111,6 +111,7 @@ void __init_or_module sifive_errata_patch_func(struct alt_entry *begin, > > > cpu_apply_errata |= tmp; > > > } > > > } > > > - if (cpu_apply_errata != cpu_req_errata) > > > + if (stage != RISCV_ALTERNATIVES_MODULE && > > > + cpu_apply_errata != cpu_req_errata) > > if (cpu_apply_errata &= ~cpu_req_errata) > > Hmm, I don't see what that changes? + if (stage != RISCV_ALTERNATIVES_MODULE && + cpu_apply_errata != cpu_req_errata) warn_miss_errata(cpu_req_errata - cpu_apply_errata); + else if (cpu_apply_errata &= ~cpu_req_errata) warn_miss_errata(cpu_req_errata - cpu_apply_errata); All module's errata should be a subset of the main kernel. Not just skip the check of MODULE. > > > > Shall we still guarantee the module's must be a subset of the main kernel.'s? > > The warning generated there is mainly to warn about some Kconfig options > not being enabled and in individual modules even no errata usage may be > required. > > > The intent for the patch is to restore how things behaved before > module-alternatives were introduced, so I don't really want to > introduce functional changes ;-) . > > But also in the future we could debate if that warning is helpful at all, > as the erratas are enabled automatically by CONFIG_SOC_SIFIVE and > thus disabling individual erratas requires someone to turn them off > manually in their .config . > > > Heiko > > > > warn_miss_errata(cpu_req_errata - cpu_apply_errata); > > > } > > > -- > > > 2.35.1 > > > > > > > > > > > > > -- Best Regards Guo Ren ML: https://lore.kernel.org/linux-csky/ _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] riscv: don't warn for sifive erratas in modules 2022-06-10 1:12 ` Guo Ren @ 2022-07-08 6:20 ` Palmer Dabbelt -1 siblings, 0 replies; 12+ messages in thread From: Palmer Dabbelt @ 2022-07-08 6:20 UTC (permalink / raw) To: heiko, guoren Cc: heiko, Paul Walmsley, linux-riscv, linux-kernel, wefu, cmuellner, philipp.tomsich, Christoph Hellwig, re On Thu, 09 Jun 2022 18:12:27 PDT (-0700), guoren@kernel.org wrote: > On Thu, Jun 9, 2022 at 5:58 PM Heiko Stübner <heiko@sntech.de> wrote: >> >> Hi Guo, >> >> Am Donnerstag, 9. Juni 2022, 03:39:24 CEST schrieb Guo Ren: >> > On Wed, Jun 8, 2022 at 8:09 PM Heiko Stuebner <heiko@sntech.de> wrote: >> > > >> > > The SiFive errata code contains code checking applicable erratas >> > > vs. actually applied erratas to suggest missing erratas to the >> > > user when their Kconfig options are not enabled. >> > > >> > > In the main kernel image one can be quite sure that all available >> > > erratas appear at least once, so that check will succeed. >> > > On the other hand modules can very well not use any errata-relevant >> > > code, so the newly added module-alternative support may also patch >> > > the module code, but not touch SiFive-specific erratas at all. >> > > >> > > So to restore the original behaviour don't warn when patching >> > > modules. This will keep the warning if necessary for the main kernel >> > > image but prevent spurious warnings for modules. >> > > >> > > Of course having such a vendor-specific warning may not be needed at >> > > all, as CONFIG_ERRATA_SIFIVE is selected by CONFIG_SOC_SIFIVE and the >> > > individual erratas are default-y so disabling them requires >> > > deliberate action anyway. But for now just restore the old behaviour. >> > > >> > > Fixes: a8e910168bba ("riscv: implement module alternatives") >> > > Reported-by: Ron Economos <re@w6rz.net> >> > > Signed-off-by: Heiko Stuebner <heiko@sntech.de> >> > > --- >> > > arch/riscv/errata/sifive/errata.c | 3 ++- >> > > 1 file changed, 2 insertions(+), 1 deletion(-) >> > > >> > > diff --git a/arch/riscv/errata/sifive/errata.c b/arch/riscv/errata/sifive/errata.c >> > > index 672f02b21ce0..1031038423e7 100644 >> > > --- a/arch/riscv/errata/sifive/errata.c >> > > +++ b/arch/riscv/errata/sifive/errata.c >> > > @@ -111,6 +111,7 @@ void __init_or_module sifive_errata_patch_func(struct alt_entry *begin, >> > > cpu_apply_errata |= tmp; >> > > } >> > > } >> > > - if (cpu_apply_errata != cpu_req_errata) >> > > + if (stage != RISCV_ALTERNATIVES_MODULE && >> > > + cpu_apply_errata != cpu_req_errata) >> > if (cpu_apply_errata &= ~cpu_req_errata) >> >> Hmm, I don't see what that changes? > + if (stage != RISCV_ALTERNATIVES_MODULE && > + cpu_apply_errata != cpu_req_errata) > warn_miss_errata(cpu_req_errata - cpu_apply_errata); > + else if (cpu_apply_errata &= ~cpu_req_errata) > warn_miss_errata(cpu_req_errata - cpu_apply_errata); > > All module's errata should be a subset of the main kernel. Not just > skip the check of MODULE. > >> >> >> > Shall we still guarantee the module's must be a subset of the main kernel.'s? >> >> The warning generated there is mainly to warn about some Kconfig options >> not being enabled and in individual modules even no errata usage may be >> required. The problem here is really the mechanism by which that warning is generated: we assume that each alternative stage generates at least one instance of each errata, otherwise we provide the warning. That's OK for the kernel, as we only have the one errata stage for SiFive stuff, but modules might not directly include any behavior that depends on errata so they'll miss the check. Having a mismatch between the kernel and a module could also cause issues, but there's way bigger issues than errata. Unless I missed something there's no checks to make sure the kernel matches modules, but that's not really an arch/riscv thing. >> The intent for the patch is to restore how things behaved before >> module-alternatives were introduced, so I don't really want to >> introduce functional changes ;-) . IMO that's fine for a regression fix. Maybe there's better ways to do this, but this at least gets rid of the spurious warning. >> But also in the future we could debate if that warning is helpful at all, >> as the erratas are enabled automatically by CONFIG_SOC_SIFIVE and >> thus disabling individual erratas requires someone to turn them off >> manually in their .config . I could see arguments either way here: there's a bunch of Kconfigs (drivers and such) where turning them off will result in kernels that don't work and we don't warn for those, but errata are also likely to result in kernels that are subtly broken so being extra careful about checking for them seems reasonable. This is on fixes. Thanks! ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] riscv: don't warn for sifive erratas in modules @ 2022-07-08 6:20 ` Palmer Dabbelt 0 siblings, 0 replies; 12+ messages in thread From: Palmer Dabbelt @ 2022-07-08 6:20 UTC (permalink / raw) To: heiko, guoren Cc: heiko, Paul Walmsley, linux-riscv, linux-kernel, wefu, cmuellner, philipp.tomsich, Christoph Hellwig, re On Thu, 09 Jun 2022 18:12:27 PDT (-0700), guoren@kernel.org wrote: > On Thu, Jun 9, 2022 at 5:58 PM Heiko Stübner <heiko@sntech.de> wrote: >> >> Hi Guo, >> >> Am Donnerstag, 9. Juni 2022, 03:39:24 CEST schrieb Guo Ren: >> > On Wed, Jun 8, 2022 at 8:09 PM Heiko Stuebner <heiko@sntech.de> wrote: >> > > >> > > The SiFive errata code contains code checking applicable erratas >> > > vs. actually applied erratas to suggest missing erratas to the >> > > user when their Kconfig options are not enabled. >> > > >> > > In the main kernel image one can be quite sure that all available >> > > erratas appear at least once, so that check will succeed. >> > > On the other hand modules can very well not use any errata-relevant >> > > code, so the newly added module-alternative support may also patch >> > > the module code, but not touch SiFive-specific erratas at all. >> > > >> > > So to restore the original behaviour don't warn when patching >> > > modules. This will keep the warning if necessary for the main kernel >> > > image but prevent spurious warnings for modules. >> > > >> > > Of course having such a vendor-specific warning may not be needed at >> > > all, as CONFIG_ERRATA_SIFIVE is selected by CONFIG_SOC_SIFIVE and the >> > > individual erratas are default-y so disabling them requires >> > > deliberate action anyway. But for now just restore the old behaviour. >> > > >> > > Fixes: a8e910168bba ("riscv: implement module alternatives") >> > > Reported-by: Ron Economos <re@w6rz.net> >> > > Signed-off-by: Heiko Stuebner <heiko@sntech.de> >> > > --- >> > > arch/riscv/errata/sifive/errata.c | 3 ++- >> > > 1 file changed, 2 insertions(+), 1 deletion(-) >> > > >> > > diff --git a/arch/riscv/errata/sifive/errata.c b/arch/riscv/errata/sifive/errata.c >> > > index 672f02b21ce0..1031038423e7 100644 >> > > --- a/arch/riscv/errata/sifive/errata.c >> > > +++ b/arch/riscv/errata/sifive/errata.c >> > > @@ -111,6 +111,7 @@ void __init_or_module sifive_errata_patch_func(struct alt_entry *begin, >> > > cpu_apply_errata |= tmp; >> > > } >> > > } >> > > - if (cpu_apply_errata != cpu_req_errata) >> > > + if (stage != RISCV_ALTERNATIVES_MODULE && >> > > + cpu_apply_errata != cpu_req_errata) >> > if (cpu_apply_errata &= ~cpu_req_errata) >> >> Hmm, I don't see what that changes? > + if (stage != RISCV_ALTERNATIVES_MODULE && > + cpu_apply_errata != cpu_req_errata) > warn_miss_errata(cpu_req_errata - cpu_apply_errata); > + else if (cpu_apply_errata &= ~cpu_req_errata) > warn_miss_errata(cpu_req_errata - cpu_apply_errata); > > All module's errata should be a subset of the main kernel. Not just > skip the check of MODULE. > >> >> >> > Shall we still guarantee the module's must be a subset of the main kernel.'s? >> >> The warning generated there is mainly to warn about some Kconfig options >> not being enabled and in individual modules even no errata usage may be >> required. The problem here is really the mechanism by which that warning is generated: we assume that each alternative stage generates at least one instance of each errata, otherwise we provide the warning. That's OK for the kernel, as we only have the one errata stage for SiFive stuff, but modules might not directly include any behavior that depends on errata so they'll miss the check. Having a mismatch between the kernel and a module could also cause issues, but there's way bigger issues than errata. Unless I missed something there's no checks to make sure the kernel matches modules, but that's not really an arch/riscv thing. >> The intent for the patch is to restore how things behaved before >> module-alternatives were introduced, so I don't really want to >> introduce functional changes ;-) . IMO that's fine for a regression fix. Maybe there's better ways to do this, but this at least gets rid of the spurious warning. >> But also in the future we could debate if that warning is helpful at all, >> as the erratas are enabled automatically by CONFIG_SOC_SIFIVE and >> thus disabling individual erratas requires someone to turn them off >> manually in their .config . I could see arguments either way here: there's a bunch of Kconfigs (drivers and such) where turning them off will result in kernels that don't work and we don't warn for those, but errata are also likely to result in kernels that are subtly broken so being extra careful about checking for them seems reasonable. This is on fixes. Thanks! _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] riscv: don't warn for sifive erratas in modules 2022-06-08 12:08 ` Heiko Stuebner @ 2022-06-09 4:05 ` Ron Economos -1 siblings, 0 replies; 12+ messages in thread From: Ron Economos @ 2022-06-09 4:05 UTC (permalink / raw) To: Heiko Stuebner, palmer, paul.walmsley Cc: linux-riscv, linux-kernel, wefu, guoren, cmuellner, philipp.tomsich, hch On 6/8/22 5:08 AM, Heiko Stuebner wrote: > The SiFive errata code contains code checking applicable erratas > vs. actually applied erratas to suggest missing erratas to the > user when their Kconfig options are not enabled. > > In the main kernel image one can be quite sure that all available > erratas appear at least once, so that check will succeed. > On the other hand modules can very well not use any errata-relevant > code, so the newly added module-alternative support may also patch > the module code, but not touch SiFive-specific erratas at all. > > So to restore the original behaviour don't warn when patching > modules. This will keep the warning if necessary for the main kernel > image but prevent spurious warnings for modules. > > Of course having such a vendor-specific warning may not be needed at > all, as CONFIG_ERRATA_SIFIVE is selected by CONFIG_SOC_SIFIVE and the > individual erratas are default-y so disabling them requires > deliberate action anyway. But for now just restore the old behaviour. > > Fixes: a8e910168bba ("riscv: implement module alternatives") > Reported-by: Ron Economos <re@w6rz.net> > Signed-off-by: Heiko Stuebner <heiko@sntech.de> > --- > arch/riscv/errata/sifive/errata.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/arch/riscv/errata/sifive/errata.c b/arch/riscv/errata/sifive/errata.c > index 672f02b21ce0..1031038423e7 100644 > --- a/arch/riscv/errata/sifive/errata.c > +++ b/arch/riscv/errata/sifive/errata.c > @@ -111,6 +111,7 @@ void __init_or_module sifive_errata_patch_func(struct alt_entry *begin, > cpu_apply_errata |= tmp; > } > } > - if (cpu_apply_errata != cpu_req_errata) > + if (stage != RISCV_ALTERNATIVES_MODULE && > + cpu_apply_errata != cpu_req_errata) > warn_miss_errata(cpu_req_errata - cpu_apply_errata); > } Tested on HiFive Unmatched. Works good and the spurious warning is suppressed. Tested-by: Ron Economos <re@w6rz.net> ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] riscv: don't warn for sifive erratas in modules @ 2022-06-09 4:05 ` Ron Economos 0 siblings, 0 replies; 12+ messages in thread From: Ron Economos @ 2022-06-09 4:05 UTC (permalink / raw) To: Heiko Stuebner, palmer, paul.walmsley Cc: linux-riscv, linux-kernel, wefu, guoren, cmuellner, philipp.tomsich, hch On 6/8/22 5:08 AM, Heiko Stuebner wrote: > The SiFive errata code contains code checking applicable erratas > vs. actually applied erratas to suggest missing erratas to the > user when their Kconfig options are not enabled. > > In the main kernel image one can be quite sure that all available > erratas appear at least once, so that check will succeed. > On the other hand modules can very well not use any errata-relevant > code, so the newly added module-alternative support may also patch > the module code, but not touch SiFive-specific erratas at all. > > So to restore the original behaviour don't warn when patching > modules. This will keep the warning if necessary for the main kernel > image but prevent spurious warnings for modules. > > Of course having such a vendor-specific warning may not be needed at > all, as CONFIG_ERRATA_SIFIVE is selected by CONFIG_SOC_SIFIVE and the > individual erratas are default-y so disabling them requires > deliberate action anyway. But for now just restore the old behaviour. > > Fixes: a8e910168bba ("riscv: implement module alternatives") > Reported-by: Ron Economos <re@w6rz.net> > Signed-off-by: Heiko Stuebner <heiko@sntech.de> > --- > arch/riscv/errata/sifive/errata.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/arch/riscv/errata/sifive/errata.c b/arch/riscv/errata/sifive/errata.c > index 672f02b21ce0..1031038423e7 100644 > --- a/arch/riscv/errata/sifive/errata.c > +++ b/arch/riscv/errata/sifive/errata.c > @@ -111,6 +111,7 @@ void __init_or_module sifive_errata_patch_func(struct alt_entry *begin, > cpu_apply_errata |= tmp; > } > } > - if (cpu_apply_errata != cpu_req_errata) > + if (stage != RISCV_ALTERNATIVES_MODULE && > + cpu_apply_errata != cpu_req_errata) > warn_miss_errata(cpu_req_errata - cpu_apply_errata); > } Tested on HiFive Unmatched. Works good and the spurious warning is suppressed. Tested-by: Ron Economos <re@w6rz.net> _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv ^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2022-07-08 6:20 UTC | newest] Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2022-06-08 12:08 [PATCH] riscv: don't warn for sifive erratas in modules Heiko Stuebner 2022-06-08 12:08 ` Heiko Stuebner 2022-06-09 1:39 ` Guo Ren 2022-06-09 1:39 ` Guo Ren 2022-06-09 9:58 ` Heiko Stübner 2022-06-09 9:58 ` Heiko Stübner 2022-06-10 1:12 ` Guo Ren 2022-06-10 1:12 ` Guo Ren 2022-07-08 6:20 ` Palmer Dabbelt 2022-07-08 6:20 ` Palmer Dabbelt 2022-06-09 4:05 ` Ron Economos 2022-06-09 4:05 ` Ron Economos
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.