From mboxrd@z Thu Jan 1 00:00:00 1970 From: Benjamin Herrenschmidt Subject: Re: [v1][PATCH 1/1] KVM: PPC: disable preemption when using hard_irq_disable() Date: Sun, 14 Jul 2013 14:13:44 +1000 Message-ID: <1373775224.19894.265.camel@pasglop> References: <1373436139-27998-1-git-send-email-tiejun.chen@windriver.com> <62E2724C-EC17-4E36-AC9E-C9FFEDF5C5B7@suse.de> <51DE1CE9.7060406@windriver.com> <1373545684.19894.80.camel@pasglop> <3B36D92F-CD11-49A0-A0F5-CD3E49BD6793@suse.de> <1373547293.19894.99.camel@pasglop> <1373588345.19894.126.camel@pasglop> <51DF6653.7010902@windriver.com> <1373601460.19894.135.camel@pasglop> <51DF8C0A.6070608@windriver.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Cc: Alexander Graf , "" , " list" To: "tiejun.chen" Return-path: In-Reply-To: <51DF8C0A.6070608@windriver.com> Sender: kvm-ppc-owner@vger.kernel.org List-Id: kvm.vger.kernel.org On Fri, 2013-07-12 at 12:54 +0800, tiejun.chen wrote: > Is the following fine? > > powerpc: to access local paca after hard irq disabled > > We can access paca directly after hard interrupt disabled, and > this can avoid accessing wrong paca when using get_paca() in > preempt case. > > Signed-off-by: Tiejun Chen Ack. We still have an unresolved problem where gcc decides to copy r13 to another register and then index from that, or even store and reload it, and this possibly accross preempt sections. It's unclear to me in what circumstances it will do it and whether there's a case of us getting completely screwed over, I need to investigate. This is the reason why we originally made the accesses to soft_enabled be inline asm. We might need to do a bulk conversion of all PACA accesses to either such inline asm or "hide" r13 behind asm (forcing essentially a copy to another register on each use) or a combination of both. IE. inline asm for direct access of things like soft_enabled, and a get_paca/put_paca style interface that copies r13 and includes a preempt_disable/enable for the rest. Cheers, Ben.