From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753016AbbIKPKY (ORCPT ); Fri, 11 Sep 2015 11:10:24 -0400 Received: from pandora.arm.linux.org.uk ([78.32.30.218]:41233 "EHLO pandora.arm.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752396AbbIKPKX (ORCPT ); Fri, 11 Sep 2015 11:10:23 -0400 Date: Fri, 11 Sep 2015 16:10:17 +0100 From: Russell King - ARM Linux To: Robert Jarzmik Cc: Dave Martin , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH 2/2] ARM: domains: add memory dependencies to get_domain/set_domain Message-ID: <20150911151017.GS21084@n2100.arm.linux.org.uk> References: <20150911095438.GL21084@n2100.arm.linux.org.uk> <87si6lt36s.fsf@belgarion.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87si6lt36s.fsf@belgarion.home> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 11, 2015 at 04:56:27PM +0200, Robert Jarzmik wrote: > Russell King writes: > > We need to have memory dependencies on get_domain/set_domain to avoid > > the compiler over-optimising these inline assembly instructions. > > > > Loads/stores must not be reordered across a set_domain(), so introduce > > a compiler barrier for that assembly. > > > > The value of get_domain() must not be cached across a set_domain(), but > > we still want to allow the compiler to optimise it away. Introduce a > > dependency on current_thread_info()->cpu_domain to avoid this; the new > > memory clobber in set_domain() should therefore cause the compiler to > > re-load this. The other advantage of using this is we should have its > > address in the register set already, or very soon after at most call > > sites. > > > > Signed-off-by: Russell King > Tested-by: Robert Jarzmik > > The test is failing without these 2 patches, while with them, an unaligned > access is fixed, and the generated code looks good : > 7ac: ee13cf10 mrc 15, 0, ip, cr3, cr0, {0} > 7b0: e3cc300c bic r3, ip, #12 > 7b4: e58dc014 str ip, [sp, #20] > 7b8: e3833004 orr r3, r3, #4 > 7bc: ee033f10 mcr 15, 0, r3, cr3, cr0, {0} Thanks Robert, I've queued these as fixes now. If you want to put the bug alignment patch in the patch system, I'll get that off to Linus this weekend too. -- FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up according to speedtest.net.