From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753344AbdHXN6p (ORCPT ); Thu, 24 Aug 2017 09:58:45 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:24875 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752619AbdHXN6m (ORCPT ); Thu, 24 Aug 2017 09:58:42 -0400 Subject: Re: [PATCH 4/4] powerpc/32: remove a NOP from memset() To: Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Scott Wood Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org References: <871so1w86g.fsf@concordia.ellerman.id.au> From: Christophe LEROY Message-ID: <4fcbdc51-b170-d4a2-5344-c55b2ec71cbb@c-s.fr> Date: Thu, 24 Aug 2017 15:58:41 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <871so1w86g.fsf@concordia.ellerman.id.au> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: fr Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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), the ALT_FTR does things too early, while the cache is not enabled yet. Christophe