* [PATCH] powerpc: Mark variable `cpumsr` as unused @ 2018-11-07 20:26 Mathieu Malaterre 2018-11-08 6:09 ` Christophe Leroy 0 siblings, 1 reply; 4+ messages in thread From: Mathieu Malaterre @ 2018-11-07 20:26 UTC (permalink / raw) To: Michael Ellerman Cc: Mathieu Malaterre, Benjamin Herrenschmidt, Paul Mackerras, linuxppc-dev, linux-kernel Add gcc attribute unused for `cpumsr` variable. Fix warnings treated as errors with W=1: arch/powerpc/kernel/process.c:231:16: error: variable ‘cpumsr’ set but not used [-Werror=unused-but-set-variable] arch/powerpc/kernel/process.c:296:16: error: variable ‘cpumsr’ set but not used [-Werror=unused-but-set-variable] Signed-off-by: Mathieu Malaterre <malat@debian.org> --- arch/powerpc/kernel/process.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c index 96f34730010f..b9f1a2408738 100644 --- a/arch/powerpc/kernel/process.c +++ b/arch/powerpc/kernel/process.c @@ -228,7 +228,7 @@ EXPORT_SYMBOL_GPL(flush_fp_to_thread); void enable_kernel_fp(void) { - unsigned long cpumsr; + unsigned long cpumsr __maybe_unused; WARN_ON(preemptible()); @@ -293,7 +293,7 @@ EXPORT_SYMBOL(giveup_altivec); void enable_kernel_altivec(void) { - unsigned long cpumsr; + unsigned long cpumsr __maybe_unused; WARN_ON(preemptible()); -- 2.11.0 ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] powerpc: Mark variable `cpumsr` as unused 2018-11-07 20:26 [PATCH] powerpc: Mark variable `cpumsr` as unused Mathieu Malaterre @ 2018-11-08 6:09 ` Christophe Leroy 2018-11-08 7:25 ` Mathieu Malaterre 0 siblings, 1 reply; 4+ messages in thread From: Christophe Leroy @ 2018-11-08 6:09 UTC (permalink / raw) To: Mathieu Malaterre, Michael Ellerman, Breno Leitao Cc: Paul Mackerras, linuxppc-dev, linux-kernel On 11/07/2018 08:26 PM, Mathieu Malaterre wrote: > Add gcc attribute unused for `cpumsr` variable. > > Fix warnings treated as errors with W=1: > > arch/powerpc/kernel/process.c:231:16: error: variable ‘cpumsr’ set but not used [-Werror=unused-but-set-variable] > arch/powerpc/kernel/process.c:296:16: error: variable ‘cpumsr’ set but not used [-Werror=unused-but-set-variable] > > Signed-off-by: Mathieu Malaterre <malat@debian.org> I don't think this is the good way to fix that. This problem was introduced by commit 5c784c8414fb ("powerpc/tm: Remove msr_tm_active()"). That commit should be reverted and fixed. That commit should have removed the macro and kept the inline function. Christophe > --- > arch/powerpc/kernel/process.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c > index 96f34730010f..b9f1a2408738 100644 > --- a/arch/powerpc/kernel/process.c > +++ b/arch/powerpc/kernel/process.c > @@ -228,7 +228,7 @@ EXPORT_SYMBOL_GPL(flush_fp_to_thread); > > void enable_kernel_fp(void) > { > - unsigned long cpumsr; > + unsigned long cpumsr __maybe_unused; > > WARN_ON(preemptible()); > > @@ -293,7 +293,7 @@ EXPORT_SYMBOL(giveup_altivec); > > void enable_kernel_altivec(void) > { > - unsigned long cpumsr; > + unsigned long cpumsr __maybe_unused; > > WARN_ON(preemptible()); > > ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] powerpc: Mark variable `cpumsr` as unused 2018-11-08 6:09 ` Christophe Leroy @ 2018-11-08 7:25 ` Mathieu Malaterre 2018-11-08 13:59 ` Breno Leitao 0 siblings, 1 reply; 4+ messages in thread From: Mathieu Malaterre @ 2018-11-08 7:25 UTC (permalink / raw) To: Christophe LEROY Cc: Michael Ellerman, Breno Leitao, Paul Mackerras, linuxppc-dev, LKML On Thu, Nov 8, 2018 at 7:09 AM Christophe Leroy <christophe.leroy@c-s.fr> wrote: > > > > On 11/07/2018 08:26 PM, Mathieu Malaterre wrote: > > Add gcc attribute unused for `cpumsr` variable. > > > > Fix warnings treated as errors with W=1: > > > > arch/powerpc/kernel/process.c:231:16: error: variable ‘cpumsr’ set but not used [-Werror=unused-but-set-variable] > > arch/powerpc/kernel/process.c:296:16: error: variable ‘cpumsr’ set but not used [-Werror=unused-but-set-variable] > > > > Signed-off-by: Mathieu Malaterre <malat@debian.org> > > I don't think this is the good way to fix that. This problem was > introduced by commit 5c784c8414fb ("powerpc/tm: Remove > msr_tm_active()"). That commit should be reverted and fixed. I see, it makes sense. > That commit should have removed the macro and kept the inline function. Breno, what do you think ? > Christophe > > > --- > > arch/powerpc/kernel/process.c | 4 ++-- > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c > > index 96f34730010f..b9f1a2408738 100644 > > --- a/arch/powerpc/kernel/process.c > > +++ b/arch/powerpc/kernel/process.c > > @@ -228,7 +228,7 @@ EXPORT_SYMBOL_GPL(flush_fp_to_thread); > > > > void enable_kernel_fp(void) > > { > > - unsigned long cpumsr; > > + unsigned long cpumsr __maybe_unused; > > > > WARN_ON(preemptible()); > > > > @@ -293,7 +293,7 @@ EXPORT_SYMBOL(giveup_altivec); > > > > void enable_kernel_altivec(void) > > { > > - unsigned long cpumsr; > > + unsigned long cpumsr __maybe_unused; > > > > WARN_ON(preemptible()); > > > > ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] powerpc: Mark variable `cpumsr` as unused 2018-11-08 7:25 ` Mathieu Malaterre @ 2018-11-08 13:59 ` Breno Leitao 0 siblings, 0 replies; 4+ messages in thread From: Breno Leitao @ 2018-11-08 13:59 UTC (permalink / raw) To: Mathieu Malaterre, Christophe LEROY Cc: Michael Ellerman, Paul Mackerras, linuxppc-dev, LKML, Michael Neuling Hi Mathieu, Christophe Thanks for spotting and fixing this bug. On 11/08/2018 05:25 AM, Mathieu Malaterre wrote: > On Thu, Nov 8, 2018 at 7:09 AM Christophe Leroy <christophe.leroy@c-s.fr> wrote: >> >> >> >> On 11/07/2018 08:26 PM, Mathieu Malaterre wrote: >>> Add gcc attribute unused for `cpumsr` variable. >>> >>> Fix warnings treated as errors with W=1: >>> >>> arch/powerpc/kernel/process.c:231:16: error: variable ‘cpumsr’ set but not used [-Werror=unused-but-set-variable] >>> arch/powerpc/kernel/process.c:296:16: error: variable ‘cpumsr’ set but not used [-Werror=unused-but-set-variable] >>> >>> Signed-off-by: Mathieu Malaterre <malat@debian.org> >> >> I don't think this is the good way to fix that. This problem was >> introduced by commit 5c784c8414fb ("powerpc/tm: Remove >> msr_tm_active()"). That commit should be reverted and fixed. > > I see, it makes sense. > >> That commit should have removed the macro and kept the inline function. > > Breno, what do you think ? Turning this macro into a function might cause the code to be more confused, since all the other TM states bits are checked using a macro, for example: MSR_TM_SUSPENDED Checks if the MSR has Suspended bits set MSR_TM_TRANSACTIONAL Checks if the MSR has the transactional bits set MSR_TM_RESV Checks if the MSR has the TM reserved bits set That said, I understand that it makes sense to have an uniform way to check for TM bits in MSR, thus having a MSR_TM_ACTIVE macro to check for the active bits. Using a non-uniform function just to fix this warning seems to be an overkill. Reverting the patch seems to bring back the old style, which is having a macro and a function with the same name, where the function just calls the macro. Anyway, I think it might have other ways to fix warning, as I can think now: 1) Avoid setting cpumsr if CONFIG_PPC_TRANSACTIONAL_MEM is not enabled 2) If !CONFIG_PPC_TRANSACTIONAL_MEM, redefine MSR_TM_ACTIVE(x) to something as (x & 0) instead of 0. 3) Avoid double definition of MSR_TM_ACTIVE, i.e, have the same definition independent of PPC_TRANSACTIONAL_MEM being set or not. Anyway, I would like to try option 3), which is the hardest one to implement and validate, but it seems to be the most correct option, once it checks for a MSR bit configuration, and the caller should have the logic. ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-11-08 13:59 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2018-11-07 20:26 [PATCH] powerpc: Mark variable `cpumsr` as unused Mathieu Malaterre 2018-11-08 6:09 ` Christophe Leroy 2018-11-08 7:25 ` Mathieu Malaterre 2018-11-08 13:59 ` Breno Leitao
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®