Received: by 2002:ac0:8c9a:0:0:0:0:0 with SMTP id r26csp334376ima; Fri, 1 Feb 2019 04:09:57 -0800 (PST) X-Google-Smtp-Source: AHgI3IYh2PpKaouUHWRF7LoZ7V0XYLke7n88gLvqg8CmREvNwoBQayIlo5MvHmEa3KaW0VYc+Tcr X-Received: by 2002:a17:902:20b:: with SMTP id 11mr27372plc.57.1549022997730; Fri, 01 Feb 2019 04:09:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549022997; cv=none; d=google.com; s=arc-20160816; b=zC/vt7aT7Dd52+PB21s6FhtNhJXHs8KbxkZrFgVcxxC/poSrPVGA2d99+4w4akLnb2 lQ+paaTunk9m8IQDcjukJRgmYc9Bc+nFOj70Ky64etSdmicXMIhhe4XS8lkibVht62OW q3XE+VacUZoHGWNChMh+JQort94zk4JrLbg9B63l24hpTd8JPGcILXQubtlu0rTR21x7 t/FlAfnfAcb/yQu/7vDdIVJ7aPE0ID03+Sn4cEIwYEHnBeowFedMaKQZMyMIQHd943bD ML8uRuXajbhLkG3ifCCHENh+FSGepDCgYv2PR7ggltgFcv/Z5bkw0cT5gTLqMMOpL+W6 g/bQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=AQdm0SAN8POWrrhA7gzanUbOnIfWVD05TOtjD1Agyiw=; b=TJhG5q7mycc6HOIPc5lyUpPZrEBzl0x59ccfoFjU7B9hu/pCKDJ6IW9N8r780YCewq zsgKSacU9LkZHul+og99cgPkEzrRSubQtv4uZe3ubVIQGGJm8om1GZySbRbtszqMUvgI iWvVnsluSKa2n/PON8VMO9EY6kqu7KK/JHWlXmfRXluJ0Vns6EOkMMeQ6EC1c8zsyqwC Gk2ckoBa8mO4CfcApBF4MUJj9r9kq2hctTCtsRiAeRppJ753rUTmonrluIoC8nTIlWI6 5jd1UbrZruQphpt1UPvlrHPu9GHpawa4y48we0+m3ObtrwcHvAb+AmMPJ/XhvONDDYUZ vh5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=Vsoa1d71; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p14si7088925pfi.12.2019.02.01.04.09.42; Fri, 01 Feb 2019 04:09:57 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=Vsoa1d71; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728381AbfBALv7 (ORCPT + 99 others); Fri, 1 Feb 2019 06:51:59 -0500 Received: from pegase1.c-s.fr ([93.17.236.30]:50103 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726486AbfBALv6 (ORCPT ); Fri, 1 Feb 2019 06:51:58 -0500 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 43rb6z3401z9vBmk; Fri, 1 Feb 2019 12:51:55 +0100 (CET) Authentication-Results: localhost; dkim=pass reason="1024-bit key; insecure key" header.d=c-s.fr header.i=@c-s.fr header.b=Vsoa1d71; dkim-adsp=pass; dkim-atps=neutral X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id hknQnW1A91Aj; Fri, 1 Feb 2019 12:51:55 +0100 (CET) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 43rb6z1xM6z9vBmj; Fri, 1 Feb 2019 12:51:55 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=c-s.fr; s=mail; t=1549021915; bh=AQdm0SAN8POWrrhA7gzanUbOnIfWVD05TOtjD1Agyiw=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=Vsoa1d714TzPITzTkx4Fu2zTG3OeciFSuZOT5dIZEqTakVfBDcwR0xz42XNvQVlO5 ExVLqBEDcXk1ke40HtgBC8lrsKGUzDMVi3xFS5/Woo5yhsGxPETdBpPWm52eIFRpGf ep7NM4Hd38++6oGNzHqRardYw62BZGt6Nf5nW+nA= Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 7C1F58B84E; Fri, 1 Feb 2019 12:51:56 +0100 (CET) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id 7XAj5VH-DjPq; Fri, 1 Feb 2019 12:51:56 +0100 (CET) Received: from PO15451 (po15451.idsi0.si.c-s.fr [172.25.231.2]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 4527C8B75B; Fri, 1 Feb 2019 12:51:56 +0100 (CET) Subject: Re: [RFC PATCH] powerpc/6xx: Don't set back MSR_RI before reenabling MMU To: Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org References: <9f9dd859d571e324c7412ed9db9da8cfba678257.1548956511.git.christophe.leroy@c-s.fr> <87lg2zojbt.fsf@concordia.ellerman.id.au> From: Christophe Leroy Message-ID: <17b00097-a807-e9b9-3dce-198df4a3153f@c-s.fr> Date: Fri, 1 Feb 2019 12:51:54 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.5.0 MIME-Version: 1.0 In-Reply-To: <87lg2zojbt.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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Le 01/02/2019 à 12:10, Michael Ellerman a écrit : > Christophe Leroy writes: > >> By delaying the setting of MSR_RI, a 1% improvment is optained on >> null_syscall selftest on an mpc8321. >> >> Without this patch: >> >> root@vgoippro:~# ./null_syscall >> 1134.33 ns 378.11 cycles >> >> With this patch: >> >> root@vgoippro:~# ./null_syscall >> 1121.85 ns 373.95 cycles >> >> The drawback is that a machine check during that period >> would be unrecoverable, but as only main memory is accessed >> during that period, it shouldn't be a concern. > > On 64-bit server CPUs accessing main memory can cause a UE > (Uncorrectable Error) which can trigger a machine check. > > So it may still be a concern, it depends how paranoid you are. > >> diff --git a/arch/powerpc/kernel/head_32.S b/arch/powerpc/kernel/head_32.S >> index 146385b1c2da..ea28a6ab56ec 100644 >> --- a/arch/powerpc/kernel/head_32.S >> +++ b/arch/powerpc/kernel/head_32.S >> @@ -282,8 +282,6 @@ __secondary_hold_acknowledge: >> stw r1,GPR1(r11); \ >> stw r1,0(r11); \ >> tovirt(r1,r11); /* set new kernel sp */ \ >> - li r10,MSR_KERNEL & ~(MSR_IR|MSR_DR); /* can take exceptions */ \ >> - MTMSRD(r10); /* (except for mach check in rtas) */ \ >> stw r0,GPR0(r11); \ >> lis r10,STACK_FRAME_REGS_MARKER@ha; /* exception frame marker */ \ >> addi r10,r10,STACK_FRAME_REGS_MARKER@l; \ > > Where does RI get enabled? I don't see it anywhere obvious. MSR_RI is part of MSR_KERNEL, it gets then enabled when reenabling MMU when calling the exception handler. #define EXC_XFER_TEMPLATE(n, hdlr, trap, copyee, tfer, ret) \ li r10,trap; \ stw r10,_TRAP(r11); \ li r10,MSR_KERNEL; \ copyee(r10, r9); \ bl tfer; \ i##n: \ .long hdlr; \ .long ret where tfer = transfer_to_handler. In transfer_to_handler (kernel/entry_32.S) you have: transfer_to_handler_cont: 3: mflr r9 lwz r11,0(r9) /* virtual address of handler */ lwz r9,4(r9) /* where to go when done */ [...] mtspr SPRN_SRR0,r11 mtspr SPRN_SRR1,r10 mtlr r9 SYNC RFI /* jump to handler, enable MMU */ So MSR_RI is restored above as r10 contains MSR_KERNEL [ | MSR_EE ] Christophe > > cheers >