From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F1253C05027 for ; Thu, 26 Jan 2023 18:08:42 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4P2pc92Ymjz3fKN for ; Fri, 27 Jan 2023 05:08:41 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=kernel.crashing.org (client-ip=63.228.1.57; helo=gate.crashing.org; envelope-from=segher@kernel.crashing.org; receiver=) Received: from gate.crashing.org (gate.crashing.org [63.228.1.57]) by lists.ozlabs.org (Postfix) with ESMTP id 4P2pbZ3mcPz3cd4 for ; Fri, 27 Jan 2023 05:08:09 +1100 (AEDT) Received: from gate.crashing.org (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id 30QI5rrM030369; Thu, 26 Jan 2023 12:05:53 -0600 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 30QI5qYL030368; Thu, 26 Jan 2023 12:05:52 -0600 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Thu, 26 Jan 2023 12:05:52 -0600 From: Segher Boessenkool To: "Naveen N. Rao" Subject: Re: arch/powerpc/kernel/head_85xx.o: warning: objtool: .head.text+0x1a6c: unannotated intra-function call Message-ID: <20230126180552.GO25951@gate.crashing.org> References: <202301161955.38kK6ksW-lkp@intel.com> <1674631223.9e09lbzzb6.naveen@linux.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1674631223.9e09lbzzb6.naveen@linux.ibm.com> User-Agent: Mutt/1.4.2.3i X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kernel test robot , linux-kernel@vger.kernel.org, npiggin@gmail.com, Sathvika Vasireddy , oe-kbuild-all@lists.linux.dev, linuxppc-dev@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" Hi! On Wed, Jan 25, 2023 at 12:57:35PM +0530, Naveen N. Rao wrote: > Sathvika Vasireddy wrote: > >--- a/arch/powerpc/kvm/booke.c > >+++ b/arch/powerpc/kvm/booke.c > >@@ -917,7 +917,9 @@ static void kvmppc_fill_pt_regs(struct pt_regs *regs) > >         asm("mr %0, 1" : "=r"(r1)); > >         asm("mflr %0" : "=r"(lr)); > >         asm("mfmsr %0" : "=r"(msr)); > >+       asm(".pushsection .discard.intra_function_calls; .long 999f; > >.popsection; 999:"); > >         asm("bl 1f; 1: mflr %0" : "=r"(ip)); > > I don't think you can assume that there won't be anything in between two > asm statements. It would be a false assumption. There is nothing that stops the compiler from moving, duplicating, or even removing these statements (removing only if no outputs from the asm are required of course). > Does it work if you combine both the above asm > statements into a single one? > > Even if that works, I don't think it is good to expand the macro here. > That asm statement looks to be trying to grab the current nip. I don't > know enough about that code, and someone who knows more about KVM may be > able to help, but it looks like we should be able to simply set 'ip' to > the address of kvmppc_fill_pt_regs()? Such things are much better as actual assembler code (like, a .s file). You have to be certain the compiler doesn't transform this in unexpected ways, like, copy and move it to all callers for example. You need the mfmsr to remain somewhat in place for example. A big reason to not want inline asm for things like this is you need so very many operands in a single asm that way; it becomes very hard to write, esp. if you want it to be correct code as well. That is a good hint there are better way to do this ;-) Segher