Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2175026imu; Thu, 29 Nov 2018 00:13:45 -0800 (PST) X-Google-Smtp-Source: AFSGD/UfUm27sdSuO3olMLzz5vRiyDv73LLD1+NX47i7B5Ik+ehzBig5hCta7Sw3EtL0D3n2zesv X-Received: by 2002:a17:902:bd92:: with SMTP id q18mr499754pls.167.1543479225922; Thu, 29 Nov 2018 00:13:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543479225; cv=none; d=google.com; s=arc-20160816; b=CdqfdWnKOFwrOJ5DqRws29xdPH2ZV5Nu3daqH/rLaR9hVBOZ+wOh7gMvBrdeJOJCX1 Lg9ae+4D5lkLhnQYG9Xanafj+EBCr6O2LbPWPSfetOIy81s7k/voAeqlppGbbOC6K/3k ZosrReTly3MjMEY0oFaOQkic4gmTH4a+0LjhBmdfWC86X+p3+BneFmBWcoKjx4gR12Fp YlJcppAbOXpkcn70O8EWhZmiuZgAAhQVFnNGvmSPJBmcmp7uEWczO5cDjQd+lSxb9ti8 rXWSsknDikJTQv9WS67BJ8ZlSXHi4DobPc2RAVONG8oHpE2yMrkzVsJvyOtJY94EA45V b+vg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:cc:to:subject:from:references :in-reply-to:message-id; bh=DEJMJsQeaOzp30TJoSdI5Hw00f1FS/viLNUXHWAXBdM=; b=hAMizKE4ElKFO6h9MD6rrhRy+3abljajMF7m1vnKR5KlCKl2sLaDMredJiqoLKudey ynUefDPE7QoSLq5PFGUJIyj+HzMYHlZgdkl4y4kWaYGFcFvM91+JslJfCOcbMRMSkQRs h+yqnEv/eDDFKgHHpxsiVU+/rO2jXQJfsX55jvrg0bjEUN6O7vBuc9I7Q3o1p97mzJ0G t+Q0p3VRbvlP1ymYIocpJ1F5jFGtl/1BxXz6EOIqrSaH9FJVm/l+swEdTOg1GiG8UKfJ yp+DMu1ge2iFD+guMdJw8+PVg+rIpdiAfn5YsyJY3T9zTdfliINcOK2Oa2lAAq1cOc7p PCsQ== ARC-Authentication-Results: i=1; mx.google.com; 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 y25si1370279pgl.226.2018.11.29.00.13.31; Thu, 29 Nov 2018 00:13:45 -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; 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 S1727573AbeK2TPD (ORCPT + 99 others); Thu, 29 Nov 2018 14:15:03 -0500 Received: from pegase1.c-s.fr ([93.17.236.30]:34593 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728012AbeK2TPD (ORCPT ); Thu, 29 Nov 2018 14:15:03 -0500 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 4359F165gbz9vGpG; Thu, 29 Nov 2018 09:10:29 +0100 (CET) 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 bewVi_vR9Fxp; Thu, 29 Nov 2018 09:10:29 +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 4359F15cXdz9vGnW; Thu, 29 Nov 2018 09:10:29 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 9E1BF8B890; Thu, 29 Nov 2018 09:10:30 +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 0JhyDmMu8E2V; Thu, 29 Nov 2018 09:10:30 +0100 (CET) Received: from po14163vm.idsi0.si.c-s.fr (unknown [192.168.232.3]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 6710C8B762; Thu, 29 Nov 2018 09:10:30 +0100 (CET) Received: by po14163vm.idsi0.si.c-s.fr (Postfix, from userid 0) id 1B90069AEA; Thu, 29 Nov 2018 08:10:30 +0000 (UTC) Message-Id: <842c27a242fba2994a9c1cca37ff1c215bbfb583.1543478200.git.christophe.leroy@c-s.fr> In-Reply-To: References: From: Christophe Leroy Subject: [PATCH v8 13/20] powerpc/8xx: Move SW perf counters in first 32kb of memory To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Date: Thu, 29 Nov 2018 08:10:30 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In order to simplify time critical exceptions handling 8xx specific SW perf counters, this patch moves the counters into the beginning of memory. This is possible because .text is readable and the counters are never modified outside of the handlers. By doing this, we avoid having to set a second register with the upper part of the address of the counters. Signed-off-by: Christophe Leroy --- arch/powerpc/kernel/head_8xx.S | 58 ++++++++++++++++++++---------------------- 1 file changed, 28 insertions(+), 30 deletions(-) diff --git a/arch/powerpc/kernel/head_8xx.S b/arch/powerpc/kernel/head_8xx.S index 3b67b9533c82..c203defe49a4 100644 --- a/arch/powerpc/kernel/head_8xx.S +++ b/arch/powerpc/kernel/head_8xx.S @@ -106,6 +106,23 @@ turn_on_mmu: mtspr SPRN_SRR0,r0 rfi /* enables MMU */ + +#ifdef CONFIG_PERF_EVENTS + .align 4 + + .globl itlb_miss_counter +itlb_miss_counter: + .space 4 + + .globl dtlb_miss_counter +dtlb_miss_counter: + .space 4 + + .globl instruction_counter +instruction_counter: + .space 4 +#endif + /* * Exception entry code. This code runs with address translation * turned off, i.e. using physical addresses. @@ -384,17 +401,16 @@ InstructionTLBMiss: #ifdef CONFIG_PERF_EVENTS patch_site 0f, patch__itlbmiss_perf -0: lis r10, (itlb_miss_counter - PAGE_OFFSET)@ha - lwz r11, (itlb_miss_counter - PAGE_OFFSET)@l(r10) - addi r11, r11, 1 - stw r11, (itlb_miss_counter - PAGE_OFFSET)@l(r10) -#endif +0: lwz r10, (itlb_miss_counter - PAGE_OFFSET)@l(0) + addi r10, r10, 1 + stw r10, (itlb_miss_counter - PAGE_OFFSET)@l(0) mfspr r10, SPRN_SPRG_SCRATCH0 mfspr r11, SPRN_SPRG_SCRATCH1 #if defined(ITLB_MISS_KERNEL) || defined(CONFIG_HUGETLB_PAGE) mfspr r12, SPRN_SPRG_SCRATCH2 #endif rfi +#endif #ifdef CONFIG_HUGETLB_PAGE 10: /* 8M pages */ @@ -509,15 +525,14 @@ DataStoreTLBMiss: #ifdef CONFIG_PERF_EVENTS patch_site 0f, patch__dtlbmiss_perf -0: lis r10, (dtlb_miss_counter - PAGE_OFFSET)@ha - lwz r11, (dtlb_miss_counter - PAGE_OFFSET)@l(r10) - addi r11, r11, 1 - stw r11, (dtlb_miss_counter - PAGE_OFFSET)@l(r10) -#endif +0: lwz r10, (dtlb_miss_counter - PAGE_OFFSET)@l(0) + addi r10, r10, 1 + stw r10, (dtlb_miss_counter - PAGE_OFFSET)@l(0) mfspr r10, SPRN_SPRG_SCRATCH0 mfspr r11, SPRN_SPRG_SCRATCH1 mfspr r12, SPRN_SPRG_SCRATCH2 rfi +#endif #ifdef CONFIG_HUGETLB_PAGE 10: /* 8M pages */ @@ -625,16 +640,13 @@ DataBreakpoint: . = 0x1d00 InstructionBreakpoint: mtspr SPRN_SPRG_SCRATCH0, r10 - mtspr SPRN_SPRG_SCRATCH1, r11 - lis r10, (instruction_counter - PAGE_OFFSET)@ha - lwz r11, (instruction_counter - PAGE_OFFSET)@l(r10) - addi r11, r11, -1 - stw r11, (instruction_counter - PAGE_OFFSET)@l(r10) + lwz r10, (instruction_counter - PAGE_OFFSET)@l(0) + addi r10, r10, -1 + stw r10, (instruction_counter - PAGE_OFFSET)@l(0) lis r10, 0xffff ori r10, r10, 0x01 mtspr SPRN_COUNTA, r10 mfspr r10, SPRN_SPRG_SCRATCH0 - mfspr r11, SPRN_SPRG_SCRATCH1 rfi #else EXCEPTION(0x1d00, Trap_1d, unknown_exception, EXC_XFER_EE) @@ -1065,17 +1077,3 @@ swapper_pg_dir: */ abatron_pteptrs: .space 8 - -#ifdef CONFIG_PERF_EVENTS - .globl itlb_miss_counter -itlb_miss_counter: - .space 4 - - .globl dtlb_miss_counter -dtlb_miss_counter: - .space 4 - - .globl instruction_counter -instruction_counter: - .space 4 -#endif -- 2.13.3