linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH AUTOSEL 6.1 17/38] powerpc/85xx: Fix unannotated intra-function call warning
       [not found] <20230209111459.1891941-1-sashal@kernel.org>
@ 2023-02-09 11:14 ` Sasha Levin
  2023-02-10 11:25   ` Sathvika Vasireddy
  2023-02-09 11:14 ` [PATCH AUTOSEL 6.1 18/38] powerpc/kvm: " Sasha Levin
  2023-02-09 11:14 ` [PATCH AUTOSEL 6.1 20/38] powerpc/64: Fix perf profiling asynchronous interrupt handlers Sasha Levin
  2 siblings, 1 reply; 6+ messages in thread
From: Sasha Levin @ 2023-02-09 11:14 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Sasha Levin, kernel test robot, Sathvika Vasireddy, npiggin,
	naveen.n.rao, linuxppc-dev

From: Sathvika Vasireddy <sv@linux.ibm.com>

[ Upstream commit 8afffce6aa3bddc940ac1909627ff1e772b6cbf1 ]

objtool throws the following warning:
  arch/powerpc/kernel/head_85xx.o: warning: objtool: .head.text+0x1a6c:
  unannotated intra-function call

Fix the warning by annotating KernelSPE symbol with SYM_FUNC_START_LOCAL
and SYM_FUNC_END macros.

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Sathvika Vasireddy <sv@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20230128124138.1066176-1-sv@linux.ibm.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/powerpc/kernel/head_85xx.S | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/kernel/head_85xx.S b/arch/powerpc/kernel/head_85xx.S
index 52c0ab416326a..d3939849f4550 100644
--- a/arch/powerpc/kernel/head_85xx.S
+++ b/arch/powerpc/kernel/head_85xx.S
@@ -862,7 +862,7 @@ _GLOBAL(load_up_spe)
  * SPE unavailable trap from kernel - print a message, but let
  * the task use SPE in the kernel until it returns to user mode.
  */
-KernelSPE:
+SYM_FUNC_START_LOCAL(KernelSPE)
 	lwz	r3,_MSR(r1)
 	oris	r3,r3,MSR_SPE@h
 	stw	r3,_MSR(r1)	/* enable use of SPE after return */
@@ -879,6 +879,7 @@ KernelSPE:
 #endif
 	.align	4,0
 
+SYM_FUNC_END(KernelSPE)
 #endif /* CONFIG_SPE */
 
 /*
-- 
2.39.0


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

* [PATCH AUTOSEL 6.1 18/38] powerpc/kvm: Fix unannotated intra-function call warning
       [not found] <20230209111459.1891941-1-sashal@kernel.org>
  2023-02-09 11:14 ` [PATCH AUTOSEL 6.1 17/38] powerpc/85xx: Fix unannotated intra-function call warning Sasha Levin
@ 2023-02-09 11:14 ` Sasha Levin
  2023-02-10 11:26   ` Sathvika Vasireddy
  2023-02-09 11:14 ` [PATCH AUTOSEL 6.1 20/38] powerpc/64: Fix perf profiling asynchronous interrupt handlers Sasha Levin
  2 siblings, 1 reply; 6+ messages in thread
From: Sasha Levin @ 2023-02-09 11:14 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Sasha Levin, kernel test robot, npiggin, Sathvika Vasireddy,
	seanjc, pbonzini, linuxppc-dev

From: Sathvika Vasireddy <sv@linux.ibm.com>

[ Upstream commit fe6de81b610e5d0b9d2231acff2de74a35482e7d ]

objtool throws the following warning:
  arch/powerpc/kvm/booke.o: warning: objtool: kvmppc_fill_pt_regs+0x30:
  unannotated intra-function call

Fix the warning by setting the value of 'nip' using the _THIS_IP_ macro,
without using an assembly bl/mflr sequence to save the instruction
pointer.

Reported-by: kernel test robot <lkp@intel.com>
Suggested-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Sathvika Vasireddy <sv@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20230128124158.1066251-1-sv@linux.ibm.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/powerpc/kvm/booke.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
index 7b4920e9fd263..3852209989f04 100644
--- a/arch/powerpc/kvm/booke.c
+++ b/arch/powerpc/kvm/booke.c
@@ -912,16 +912,15 @@ static int kvmppc_handle_debug(struct kvm_vcpu *vcpu)
 
 static void kvmppc_fill_pt_regs(struct pt_regs *regs)
 {
-	ulong r1, ip, msr, lr;
+	ulong r1, msr, lr;
 
 	asm("mr %0, 1" : "=r"(r1));
 	asm("mflr %0" : "=r"(lr));
 	asm("mfmsr %0" : "=r"(msr));
-	asm("bl 1f; 1: mflr %0" : "=r"(ip));
 
 	memset(regs, 0, sizeof(*regs));
 	regs->gpr[1] = r1;
-	regs->nip = ip;
+	regs->nip = _THIS_IP_;
 	regs->msr = msr;
 	regs->link = lr;
 }
-- 
2.39.0


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

* [PATCH AUTOSEL 6.1 20/38] powerpc/64: Fix perf profiling asynchronous interrupt handlers
       [not found] <20230209111459.1891941-1-sashal@kernel.org>
  2023-02-09 11:14 ` [PATCH AUTOSEL 6.1 17/38] powerpc/85xx: Fix unannotated intra-function call warning Sasha Levin
  2023-02-09 11:14 ` [PATCH AUTOSEL 6.1 18/38] powerpc/kvm: " Sasha Levin
@ 2023-02-09 11:14 ` Sasha Levin
  2 siblings, 0 replies; 6+ messages in thread
From: Sasha Levin @ 2023-02-09 11:14 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Sasha Levin, pmladek, arnd, bigeasy, Julia.Lawall, ganeshgr,
	Nicholas Piggin, linuxppc-dev, heying24, joel

From: Nicholas Piggin <npiggin@gmail.com>

[ Upstream commit c28548012ee2bac55772ef7685138bd1124b80c3 ]

Interrupt entry sets the soft mask to IRQS_ALL_DISABLED to match the
hard irq disabled state. So when should_hard_irq_enable() returns true
because we want PMI interrupts in irq handlers, MSR[EE] is enabled but
PMIs just get soft-masked. Fix this by clearing IRQS_PMI_DISABLED before
enabling MSR[EE].

This also tidies some of the warnings, no need to duplicate them in
both should_hard_irq_enable() and do_hard_irq_enable().

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20230121100156.2824054-1-npiggin@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/powerpc/include/asm/hw_irq.h | 41 ++++++++++++++++++++++---------
 arch/powerpc/kernel/dbell.c       |  2 +-
 arch/powerpc/kernel/irq.c         |  2 +-
 arch/powerpc/kernel/time.c        |  2 +-
 4 files changed, 32 insertions(+), 15 deletions(-)

diff --git a/arch/powerpc/include/asm/hw_irq.h b/arch/powerpc/include/asm/hw_irq.h
index 77fa88c2aed0d..265d0eb7ed796 100644
--- a/arch/powerpc/include/asm/hw_irq.h
+++ b/arch/powerpc/include/asm/hw_irq.h
@@ -173,6 +173,15 @@ static inline notrace unsigned long irq_soft_mask_or_return(unsigned long mask)
 	return flags;
 }
 
+static inline notrace unsigned long irq_soft_mask_andc_return(unsigned long mask)
+{
+	unsigned long flags = irq_soft_mask_return();
+
+	irq_soft_mask_set(flags & ~mask);
+
+	return flags;
+}
+
 static inline unsigned long arch_local_save_flags(void)
 {
 	return irq_soft_mask_return();
@@ -331,10 +340,11 @@ bool power_pmu_wants_prompt_pmi(void);
  * is a different soft-masked interrupt pending that requires hard
  * masking.
  */
-static inline bool should_hard_irq_enable(void)
+static inline bool should_hard_irq_enable(struct pt_regs *regs)
 {
 	if (IS_ENABLED(CONFIG_PPC_IRQ_SOFT_MASK_DEBUG)) {
-		WARN_ON(irq_soft_mask_return() == IRQS_ENABLED);
+		WARN_ON(irq_soft_mask_return() != IRQS_ALL_DISABLED);
+		WARN_ON(!(get_paca()->irq_happened & PACA_IRQ_HARD_DIS));
 		WARN_ON(mfmsr() & MSR_EE);
 	}
 
@@ -347,8 +357,17 @@ static inline bool should_hard_irq_enable(void)
 	 *
 	 * TODO: Add test for 64e
 	 */
-	if (IS_ENABLED(CONFIG_PPC_BOOK3S_64) && !power_pmu_wants_prompt_pmi())
-		return false;
+	if (IS_ENABLED(CONFIG_PPC_BOOK3S_64)) {
+		if (!power_pmu_wants_prompt_pmi())
+			return false;
+		/*
+		 * If PMIs are disabled then IRQs should be disabled as well,
+		 * so we shouldn't see this condition, check for it just in
+		 * case because we are about to enable PMIs.
+		 */
+		if (WARN_ON_ONCE(regs->softe & IRQS_PMI_DISABLED))
+			return false;
+	}
 
 	if (get_paca()->irq_happened & PACA_IRQ_MUST_HARD_MASK)
 		return false;
@@ -358,18 +377,16 @@ static inline bool should_hard_irq_enable(void)
 
 /*
  * Do the hard enabling, only call this if should_hard_irq_enable is true.
+ * This allows PMI interrupts to profile irq handlers.
  */
 static inline void do_hard_irq_enable(void)
 {
-	if (IS_ENABLED(CONFIG_PPC_IRQ_SOFT_MASK_DEBUG)) {
-		WARN_ON(irq_soft_mask_return() == IRQS_ENABLED);
-		WARN_ON(get_paca()->irq_happened & PACA_IRQ_MUST_HARD_MASK);
-		WARN_ON(mfmsr() & MSR_EE);
-	}
 	/*
-	 * This allows PMI interrupts (and watchdog soft-NMIs) through.
-	 * There is no other reason to enable this way.
+	 * Asynch interrupts come in with IRQS_ALL_DISABLED,
+	 * PACA_IRQ_HARD_DIS, and MSR[EE]=0.
 	 */
+	if (IS_ENABLED(CONFIG_PPC_BOOK3S_64))
+		irq_soft_mask_andc_return(IRQS_PMI_DISABLED);
 	get_paca()->irq_happened &= ~PACA_IRQ_HARD_DIS;
 	__hard_irq_enable();
 }
@@ -452,7 +469,7 @@ static inline bool arch_irq_disabled_regs(struct pt_regs *regs)
 	return !(regs->msr & MSR_EE);
 }
 
-static __always_inline bool should_hard_irq_enable(void)
+static __always_inline bool should_hard_irq_enable(struct pt_regs *regs)
 {
 	return false;
 }
diff --git a/arch/powerpc/kernel/dbell.c b/arch/powerpc/kernel/dbell.c
index f55c6fb34a3a0..5712dd846263c 100644
--- a/arch/powerpc/kernel/dbell.c
+++ b/arch/powerpc/kernel/dbell.c
@@ -27,7 +27,7 @@ DEFINE_INTERRUPT_HANDLER_ASYNC(doorbell_exception)
 
 	ppc_msgsync();
 
-	if (should_hard_irq_enable())
+	if (should_hard_irq_enable(regs))
 		do_hard_irq_enable();
 
 	kvmppc_clear_host_ipi(smp_processor_id());
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
index 9ede61a5a469e..55142ff649f3f 100644
--- a/arch/powerpc/kernel/irq.c
+++ b/arch/powerpc/kernel/irq.c
@@ -238,7 +238,7 @@ static void __do_irq(struct pt_regs *regs, unsigned long oldsp)
 	irq = static_call(ppc_get_irq)();
 
 	/* We can hard enable interrupts now to allow perf interrupts */
-	if (should_hard_irq_enable())
+	if (should_hard_irq_enable(regs))
 		do_hard_irq_enable();
 
 	/* And finally process it */
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index a2ab397065c66..f157552d79b38 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -533,7 +533,7 @@ DEFINE_INTERRUPT_HANDLER_ASYNC(timer_interrupt)
 	}
 
 	/* Conditionally hard-enable interrupts. */
-	if (should_hard_irq_enable()) {
+	if (should_hard_irq_enable(regs)) {
 		/*
 		 * Ensure a positive value is written to the decrementer, or
 		 * else some CPUs will continue to take decrementer exceptions.
-- 
2.39.0


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

* Re: [PATCH AUTOSEL 6.1 17/38] powerpc/85xx: Fix unannotated intra-function call warning
  2023-02-09 11:14 ` [PATCH AUTOSEL 6.1 17/38] powerpc/85xx: Fix unannotated intra-function call warning Sasha Levin
@ 2023-02-10 11:25   ` Sathvika Vasireddy
  2023-02-14  0:06     ` Sasha Levin
  0 siblings, 1 reply; 6+ messages in thread
From: Sathvika Vasireddy @ 2023-02-10 11:25 UTC (permalink / raw)
  To: Sasha Levin, linux-kernel, stable
  Cc: kernel test robot, npiggin, Sathvika Vasireddy, naveen.n.rao,
	linuxppc-dev

Hi Sasha,

On 09/02/23 16:44, Sasha Levin wrote:
> From: Sathvika Vasireddy <sv@linux.ibm.com>
>
> [ Upstream commit 8afffce6aa3bddc940ac1909627ff1e772b6cbf1 ]
>
> objtool throws the following warning:
>    arch/powerpc/kernel/head_85xx.o: warning: objtool: .head.text+0x1a6c:
>    unannotated intra-function call
>
> Fix the warning by annotating KernelSPE symbol with SYM_FUNC_START_LOCAL
> and SYM_FUNC_END macros.
>
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Sathvika Vasireddy <sv@linux.ibm.com>
> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
> Link: https://lore.kernel.org/r/20230128124138.1066176-1-sv@linux.ibm.com
> Signed-off-by: Sasha Levin <sashal@kernel.org>
> ---
>   arch/powerpc/kernel/head_85xx.S | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/kernel/head_85xx.S b/arch/powerpc/kernel/head_85xx.S
> index 52c0ab416326a..d3939849f4550 100644
> --- a/arch/powerpc/kernel/head_85xx.S
> +++ b/arch/powerpc/kernel/head_85xx.S
> @@ -862,7 +862,7 @@ _GLOBAL(load_up_spe)
>    * SPE unavailable trap from kernel - print a message, but let
>    * the task use SPE in the kernel until it returns to user mode.
>    */
> -KernelSPE:
> +SYM_FUNC_START_LOCAL(KernelSPE)
>   	lwz	r3,_MSR(r1)
>   	oris	r3,r3,MSR_SPE@h
>   	stw	r3,_MSR(r1)	/* enable use of SPE after return */
> @@ -879,6 +879,7 @@ KernelSPE:
>   #endif
>   	.align	4,0
>   
> +SYM_FUNC_END(KernelSPE)
>   #endif /* CONFIG_SPE */
>   
>   /*

Please drop this patch because objtool enablement patches for powerpc 
are not a part of kernel v6.1.

Thanks,
Sathvika

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

* Re: [PATCH AUTOSEL 6.1 18/38] powerpc/kvm: Fix unannotated intra-function call warning
  2023-02-09 11:14 ` [PATCH AUTOSEL 6.1 18/38] powerpc/kvm: " Sasha Levin
@ 2023-02-10 11:26   ` Sathvika Vasireddy
  0 siblings, 0 replies; 6+ messages in thread
From: Sathvika Vasireddy @ 2023-02-10 11:26 UTC (permalink / raw)
  To: Sasha Levin, linux-kernel, stable
  Cc: kernel test robot, npiggin, Sathvika Vasireddy, seanjc, pbonzini,
	linuxppc-dev

Hi Sasha,

On 09/02/23 16:44, Sasha Levin wrote:
> From: Sathvika Vasireddy <sv@linux.ibm.com>
>
> [ Upstream commit fe6de81b610e5d0b9d2231acff2de74a35482e7d ]
>
> objtool throws the following warning:
>    arch/powerpc/kvm/booke.o: warning: objtool: kvmppc_fill_pt_regs+0x30:
>    unannotated intra-function call
>
> Fix the warning by setting the value of 'nip' using the _THIS_IP_ macro,
> without using an assembly bl/mflr sequence to save the instruction
> pointer.
>
> Reported-by: kernel test robot <lkp@intel.com>
> Suggested-by: Michael Ellerman <mpe@ellerman.id.au>
> Signed-off-by: Sathvika Vasireddy <sv@linux.ibm.com>
> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
> Link: https://lore.kernel.org/r/20230128124158.1066251-1-sv@linux.ibm.com
> Signed-off-by: Sasha Levin <sashal@kernel.org>
> ---
>   arch/powerpc/kvm/booke.c | 5 ++---
>   1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
> index 7b4920e9fd263..3852209989f04 100644
> --- a/arch/powerpc/kvm/booke.c
> +++ b/arch/powerpc/kvm/booke.c
> @@ -912,16 +912,15 @@ static int kvmppc_handle_debug(struct kvm_vcpu *vcpu)
>   
>   static void kvmppc_fill_pt_regs(struct pt_regs *regs)
>   {
> -	ulong r1, ip, msr, lr;
> +	ulong r1, msr, lr;
>   
>   	asm("mr %0, 1" : "=r"(r1));
>   	asm("mflr %0" : "=r"(lr));
>   	asm("mfmsr %0" : "=r"(msr));
> -	asm("bl 1f; 1: mflr %0" : "=r"(ip));
>   
>   	memset(regs, 0, sizeof(*regs));
>   	regs->gpr[1] = r1;
> -	regs->nip = ip;
> +	regs->nip = _THIS_IP_;
>   	regs->msr = msr;
>   	regs->link = lr;
>   }

Please drop this patch because objtool enablement patches for powerpc 
are not a part of kernel v6.1


Thanks,
Sathvika


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

* Re: [PATCH AUTOSEL 6.1 17/38] powerpc/85xx: Fix unannotated intra-function call warning
  2023-02-10 11:25   ` Sathvika Vasireddy
@ 2023-02-14  0:06     ` Sasha Levin
  0 siblings, 0 replies; 6+ messages in thread
From: Sasha Levin @ 2023-02-14  0:06 UTC (permalink / raw)
  To: Sathvika Vasireddy
  Cc: kernel test robot, linux-kernel, npiggin, stable, naveen.n.rao,
	linuxppc-dev

On Fri, Feb 10, 2023 at 04:55:54PM +0530, Sathvika Vasireddy wrote:
>Hi Sasha,
>
>On 09/02/23 16:44, Sasha Levin wrote:
>>From: Sathvika Vasireddy <sv@linux.ibm.com>
>>
>>[ Upstream commit 8afffce6aa3bddc940ac1909627ff1e772b6cbf1 ]
>>
>>objtool throws the following warning:
>>   arch/powerpc/kernel/head_85xx.o: warning: objtool: .head.text+0x1a6c:
>>   unannotated intra-function call
>>
>>Fix the warning by annotating KernelSPE symbol with SYM_FUNC_START_LOCAL
>>and SYM_FUNC_END macros.
>>
>>Reported-by: kernel test robot <lkp@intel.com>
>>Signed-off-by: Sathvika Vasireddy <sv@linux.ibm.com>
>>Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
>>Link: https://lore.kernel.org/r/20230128124138.1066176-1-sv@linux.ibm.com
>>Signed-off-by: Sasha Levin <sashal@kernel.org>
>>---
>>  arch/powerpc/kernel/head_85xx.S | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>>diff --git a/arch/powerpc/kernel/head_85xx.S b/arch/powerpc/kernel/head_85xx.S
>>index 52c0ab416326a..d3939849f4550 100644
>>--- a/arch/powerpc/kernel/head_85xx.S
>>+++ b/arch/powerpc/kernel/head_85xx.S
>>@@ -862,7 +862,7 @@ _GLOBAL(load_up_spe)
>>   * SPE unavailable trap from kernel - print a message, but let
>>   * the task use SPE in the kernel until it returns to user mode.
>>   */
>>-KernelSPE:
>>+SYM_FUNC_START_LOCAL(KernelSPE)
>>  	lwz	r3,_MSR(r1)
>>  	oris	r3,r3,MSR_SPE@h
>>  	stw	r3,_MSR(r1)	/* enable use of SPE after return */
>>@@ -879,6 +879,7 @@ KernelSPE:
>>  #endif
>>  	.align	4,0
>>+SYM_FUNC_END(KernelSPE)
>>  #endif /* CONFIG_SPE */
>>  /*
>
>Please drop this patch because objtool enablement patches for powerpc 
>are not a part of kernel v6.1.

Ack, I'll drop this and the other one you've pointed out. Thanks!

-- 
Thanks,
Sasha

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

end of thread, other threads:[~2023-02-14  0:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20230209111459.1891941-1-sashal@kernel.org>
2023-02-09 11:14 ` [PATCH AUTOSEL 6.1 17/38] powerpc/85xx: Fix unannotated intra-function call warning Sasha Levin
2023-02-10 11:25   ` Sathvika Vasireddy
2023-02-14  0:06     ` Sasha Levin
2023-02-09 11:14 ` [PATCH AUTOSEL 6.1 18/38] powerpc/kvm: " Sasha Levin
2023-02-10 11:26   ` Sathvika Vasireddy
2023-02-09 11:14 ` [PATCH AUTOSEL 6.1 20/38] powerpc/64: Fix perf profiling asynchronous interrupt handlers Sasha Levin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).