Received: from eggs.gnu.org ([2001:4830:134:3::10]:45953) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bRgRR-0001l9-7N for qemu-devel@nongnu.org; Mon, 25 Jul 2016 10:01:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bRgRM-00059k-9G for qemu-devel@nongnu.org; Mon, 25 Jul 2016 10:01:09 -0400 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]:34935) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bRgRM-00059A-1C for qemu-devel@nongnu.org; Mon, 25 Jul 2016 10:01:04 -0400 Received: by mail-wm0-x243.google.com with SMTP id i5so16887727wmg.2 for ; Mon, 25 Jul 2016 07:01:03 -0700 (PDT) Sender: Richard Henderson References: <1469364141.8568.251.camel@kernel.crashing.org> <1469364697.8568.253.camel@kernel.crashing.org> <1469364745.8568.254.camel@kernel.crashing.org> <5eede4b0-cc3a-c24f-5de4-8473220385f9@twiddle.net> <1469407593.8568.265.camel@kernel.crashing.org> <1469407897.8568.268.camel@kernel.crashing.org> From: Richard Henderson Message-ID: Date: Mon, 25 Jul 2016 19:30:54 +0530 MIME-Version: 1.0 In-Reply-To: <1469407897.8568.268.camel@kernel.crashing.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] TCG problem with cpu_{st,ld}x_data ? List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Benjamin Herrenschmidt , qemu-devel@nongnu.org Cc: Paolo Bonzini , Christian Borntraeger On 07/25/2016 06:21 AM, Benjamin Herrenschmidt wrote: > On Mon, 2016-07-25 at 10:46 +1000, Benjamin Herrenschmidt wrote: >> On Mon, 2016-07-25 at 06:06 +0530, Richard Henderson wrote: >>> >>> These functions would have to be always_inline for this to work. >>> Otherwise you >>> could get the helper's PC, not the TCG caller's PC. >>> >>> But let's try to fix this the other way. >> >> I could use some help there as I don't really understand the PC fixup >> adjustment mechanism in qemu... > > One thing I can do, but I don't know whether that's worthwhile (you > tell me), is change all translation helpers in powerpc to do like > x86, which is to pass the RA along and never use the non_ra() variants. > > But that's quite a bit of churn, so let me know if your plan is better. It is worthwhile, because that allows you to drop some state saving within the translation. With the assumption being, of course, that the exceptional case is rare and so we save on the state saving most of the time. Or, as appears to be the case for e.g. LVEBX, there currently is no such state save, and so any exceptions raised by this insn will point to the wrong insn, and so the conversion fixes a bug. > Are those functions always meant to be called within translation > helpers ? IE, the fault can safely longjmp out and it's just a matter > of finding the proper instruction PC to report ? Correct. > Or can they also be called outside of that context ? No, not without a valid return address. E.g. it's not valid to have one helper call another, and for the second helper use GETPC. For this, typically, one must factor out a common function which accepts a "retaddr" argument, which the callers must fill in with GETPC. r~