Received: from eggs.gnu.org ([2001:4830:134:3::10]:44777) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1biDyK-0003rs-DI for qemu-devel@nongnu.org; Fri, 09 Sep 2016 01:03:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1biDyH-00007d-6V for qemu-devel@nongnu.org; Fri, 09 Sep 2016 01:03:28 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:58277 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1biDyH-00006x-1v for qemu-devel@nongnu.org; Fri, 09 Sep 2016 01:03:25 -0400 Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id u8953K16054452 for ; Fri, 9 Sep 2016 01:03:23 -0400 Received: from e23smtp07.au.ibm.com (e23smtp07.au.ibm.com [202.81.31.140]) by mx0b-001b2d01.pphosted.com with ESMTP id 25bc2qesqh-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Fri, 09 Sep 2016 01:03:22 -0400 Received: from localhost by e23smtp07.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 9 Sep 2016 15:03:17 +1000 From: Benjamin Herrenschmidt Reply-To: benh@au1.ibm.com Date: Fri, 09 Sep 2016 15:03:13 +1000 In-Reply-To: <1473397204.8689.154.camel@kernel.crashing.org> References: <1473395018-15288-1-git-send-email-nikunj@linux.vnet.ibm.com> <1473395444.8689.147.camel@kernel.crashing.org> <87h99p7kax.fsf@abhimanyu.i-did-not-set--mail-host-address--so-tickle-me> <1473397204.8689.154.camel@kernel.crashing.org> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Message-Id: <1473397393.8689.156.camel@au1.ibm.com> Subject: Re: [Qemu-devel] [PATCH RFC] target-ppc: tlbie should have global effect List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Nikunj A Dadhania , qemu-ppc@nongnu.org, david@gibson.dropbear.id.au Cc: alex.bennee@linaro.org, qemu-devel@nongnu.org, rth@twiddle.net On Fri, 2016-09-09 at 15:00 +1000, Benjamin Herrenschmidt wrote: > > No it doesn't. > > When a "broadcast TLB" op happens, such as tlbie, you set both flags. > The existing one which just means the current CPU needs flushing, that > logic doesnt' change at all. > > The other one means that *this* CPU needs to broadcast a TLB inval, > thus it's also a local flag ! > > Then you change gen_check_tlb_flush() to take an argument (an immediate > value) which you set to 1 in ptesync on BookS and tlbsync on BookE and > leave 0 on all the others. One subtle thing here: gen_check_tlb_flush now needs to check both flags. Easy enough to OR them before the brcond. Another option is to make the flag a bit mask. Because the "lcoal" need flush might get cleared (by an isync or an interrupt for example) before we hit the ptesync that will do the broadcast. > Finally, gen_check_tlb_flush() does what it does today, then *additionally* > if that argument was 1 *and* the broadcast_flush flag was set, the helper > can then shoot the invalidations to all the other CPUs (and clear the flag). > > CPU_FOREACH(cs) { > > if (cs != this_cpu) { > > tlb_flush(...) > > } > } > > > For MT-TCG, the only change is then in that the above loop does async > procesdure calls to the target CPUs. > > You will need to make sure ptesync/tlbsync (the latter only on BookE, make > it a nop on BookS) also exit the TB which is easy to do so that we get > the synchronization with the pending async works as Paolo mentioned separately > (double check with him and/or Alex ot make sure you get that right). > > > > > > > > > We keep the existing logic to flush locally. We additionally replace > > > the one in ptesync (BookS) or tlbsync (BookE) to test for the broadcast > > > flag, and flush the "other" CPUs if set. > > > > > > That also means you have a nice spot to do the more complex MT-TCG > > > broadcast only when needed in the future. > > > > > > > Regards > > Nikunj