From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754018AbdHYAPK convert rfc822-to-8bit (ORCPT ); Thu, 24 Aug 2017 20:15:10 -0400 Received: from ozlabs.org ([103.22.144.67]:49805 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753456AbdHYAPJ (ORCPT ); Thu, 24 Aug 2017 20:15:09 -0400 From: Michael Ellerman To: Christophe LEROY , Benjamin Herrenschmidt , Paul Mackerras , Scott Wood Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: Re: [PATCH 4/4] powerpc/32: remove a NOP from memset() In-Reply-To: <4fcbdc51-b170-d4a2-5344-c55b2ec71cbb@c-s.fr> References: <871so1w86g.fsf@concordia.ellerman.id.au> <4fcbdc51-b170-d4a2-5344-c55b2ec71cbb@c-s.fr> User-Agent: Notmuch/0.21 (https://notmuchmail.org) Date: Fri, 25 Aug 2017 10:15:08 +1000 Message-ID: <87k21sv6yb.fsf@concordia.ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Christophe LEROY writes: > Le 24/08/2017 à 12:51, Michael Ellerman a écrit : >> Christophe Leroy writes: >> >>> memset() is patched after initialisation to activate the >>> optimised part which uses cache instructions. >>> >>> Today we have a 'b 2f' to skip the optimised patch, which then gets >>> replaced by a NOP, implying a useless cycle consumption. >>> As we have a 'bne 2f' just before, we could use that instruction >>> for the live patching, hence removing the need to have a >>> dedicated 'b 2f' to be replaced by a NOP. >>> >>> This patch changes the 'bne 2f' by a 'b 2f'. During init, that >>> 'b 2f' is then replaced by 'bne 2f' >> >> I'm not sure what the sequence is during boot for the 32-bit code, but >> can you use an ALT_FTR section for this? Possibly that doesn't get done >> at the right time though. > > Unfortunately, as we discussed in 2015 > (https://lkml.org/lkml/2015/9/10/608), Haha, you expect me to remember things I said then! ;) > the ALT_FTR does things too early, while the cache is not enabled yet. OK. Ben did do some reworks to the early init since then, but I don't think he changed that. I notice we do setup_feature_keys() in machine_init(), which is the jump label equivalent of apply_feature_fixups(). So I wonder if we could actually move apply_feature_fixups() to there. But it would need some serious review. cheers