From patchwork Mon Aug 20 09:41:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 959551 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41v8Hh2qcSz9s3Z for ; Mon, 20 Aug 2018 19:52:48 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="HrNguRsf"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 41v8Hh1NMPzF0yB for ; Mon, 20 Aug 2018 19:52:48 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="HrNguRsf"; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::442; helo=mail-pf1-x442.google.com; envelope-from=npiggin@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="HrNguRsf"; dkim-atps=neutral Received: from mail-pf1-x442.google.com (mail-pf1-x442.google.com [IPv6:2607:f8b0:4864:20::442]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 41v83f4P4ZzF162 for ; Mon, 20 Aug 2018 19:42:22 +1000 (AEST) Received: by mail-pf1-x442.google.com with SMTP id k21-v6so6479996pff.11 for ; Mon, 20 Aug 2018 02:42:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ZvciuPOIX2Cx4otQ9jaj30UarhYsRC6tKvZMn934L9M=; b=HrNguRsfY3F0BgfFYYqHSgPUiZOGK3WOqMg90Ssh5pRWq6BKPzQlvxRXGlDgMqtoua tmwi+ztGpnGEfis4hYqjRsj3cJ8AN2dcDWM2LJJbBaGa0fTO+5RdDSySUTtL03rED7P/ XOo7QGUfhuabMb2dBi2YRMHC5ssKzyWb2vv3VAXfAU02U6WI/xYJ6jebvTL8saClLRHn H/xD9xc3UcmYiaWAjkg+czjJj7zyZtp3SnsFfqDb5fmHqDT5e6oqsRKUmMnak88G/ezL /K2dG+I1lZCYvof6U9ERaLrAo7hlTQaDkPARET8eQk5cXLA0tUOb3kfYn9oDgdDFItAD jNyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ZvciuPOIX2Cx4otQ9jaj30UarhYsRC6tKvZMn934L9M=; b=pa6P2wqYK1kM3RUlxI1gfPK+YhBoMMUTUigr8oojqYU0e2x0d5BSjzl+XHFvAt/+L+ TC7pNOHhpg0+an5ESlVN60e32u84MVlZKD9ZBqQfP3WPWQ0JOTmx80WvZVPOznErT+fM tF049V3/VMncURiLhFU398HDieW+8I6GyM324aseQg37WwfmpzgYliTIv7o0/6dR9ef0 xsZILMTM2iDqelVEsY5CVdaMOhxgs4m/Wnt6q3ZKgcpqIbSCEB1YLOjGBwuISloGTdUu NHqqPB7MeOWhT6bHH5io+FcHWk1tyyHLc6m/metTAKNAYlF2ZmCQMC6/MuGKdHIDeSlF 4uVw== X-Gm-Message-State: AOUpUlEjL/TCgHZgmueNZaB4g2Gk1O60xipx2hakj7tvkWmYyyHRxCF2 Imu80DXVKvadbmLS+beOOXOE40oc X-Google-Smtp-Source: AA+uWPy+cWPvGEfr8j4cyxqrK9u2IOvBZ+iGhvVsnpy7KO9Xqp7Sa705vtLLrjf+shZ4DQfnCfmfIA== X-Received: by 2002:a62:b604:: with SMTP id j4-v6mr47742831pff.199.1534758140503; Mon, 20 Aug 2018 02:42:20 -0700 (PDT) Received: from roar.ozlabs.ibm.com ([122.99.82.10]) by smtp.gmail.com with ESMTPSA id x87-v6sm14793281pfa.143.2018.08.20.02.42.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 Aug 2018 02:42:20 -0700 (PDT) From: Nicholas Piggin To: linuxppc-dev@lists.ozlabs.org Subject: [RFC PATCH 3/5] powerpc/64s/hash: remove the first vmalloc segment from the bolted SLB Date: Mon, 20 Aug 2018 19:41:58 +1000 Message-Id: <20180820094200.13003-4-npiggin@gmail.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180820094200.13003-1-npiggin@gmail.com> References: <20180820094200.13003-1-npiggin@gmail.com> X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Aneesh Kumar K . V" , Nicholas Piggin Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" Remove the first vmalloc segment from bolted SLBEs. This is not required to be bolted, and seems like it was added to help pre-load the SLB on context switch. However there are now other segments like the vmemmap segment that often take misses after a context switch, so it is better to solve this a different way and save a bolted entry. --- arch/powerpc/include/asm/book3s/64/mmu-hash.h | 2 +- arch/powerpc/mm/slb.c | 16 ++++------------ 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/arch/powerpc/include/asm/book3s/64/mmu-hash.h b/arch/powerpc/include/asm/book3s/64/mmu-hash.h index 39764214aef5..4c8d413ce99a 100644 --- a/arch/powerpc/include/asm/book3s/64/mmu-hash.h +++ b/arch/powerpc/include/asm/book3s/64/mmu-hash.h @@ -30,7 +30,7 @@ * SLB */ -#define SLB_NUM_BOLTED 3 +#define SLB_NUM_BOLTED 2 #define SLB_CACHE_ENTRIES 8 #define SLB_MIN_SIZE 32 diff --git a/arch/powerpc/mm/slb.c b/arch/powerpc/mm/slb.c index 221d94b4f9cf..6e595d75d997 100644 --- a/arch/powerpc/mm/slb.c +++ b/arch/powerpc/mm/slb.c @@ -133,13 +133,11 @@ static void __slb_flush_and_rebolt(void) { /* If you change this make sure you change SLB_NUM_BOLTED * and PR KVM appropriately too. */ - unsigned long linear_llp, vmalloc_llp, lflags, vflags; + unsigned long linear_llp, lflags; unsigned long ksp_esid_data, ksp_vsid_data; linear_llp = mmu_psize_defs[mmu_linear_psize].sllp; - vmalloc_llp = mmu_psize_defs[mmu_vmalloc_psize].sllp; lflags = SLB_VSID_KERNEL | linear_llp; - vflags = SLB_VSID_KERNEL | vmalloc_llp; ksp_esid_data = mk_esid_data(get_paca()->kstack, mmu_kernel_ssize, KSTACK_INDEX); if ((ksp_esid_data & ~0xfffffffUL) <= PAGE_OFFSET) { @@ -157,14 +155,10 @@ static void __slb_flush_and_rebolt(void) * the stack between the slbia and rebolting it. */ asm volatile("isync\n" "slbia\n" - /* Slot 1 - first VMALLOC segment */ + /* Slot 1 - kernel stack */ "slbmte %0,%1\n" - /* Slot 2 - kernel stack */ - "slbmte %2,%3\n" "isync" - :: "r"(mk_vsid_data(VMALLOC_START, mmu_kernel_ssize, vflags)), - "r"(mk_esid_data(VMALLOC_START, mmu_kernel_ssize, VMALLOC_INDEX)), - "r"(ksp_vsid_data), + :: "r"(ksp_vsid_data), "r"(ksp_esid_data) : "memory"); } @@ -321,7 +315,7 @@ void core_flush_all_slbs(struct mm_struct *mm) void slb_initialize(void) { unsigned long linear_llp, vmalloc_llp, io_llp; - unsigned long lflags, vflags; + unsigned long lflags; static int slb_encoding_inited; #ifdef CONFIG_SPARSEMEM_VMEMMAP unsigned long vmemmap_llp; @@ -347,14 +341,12 @@ void slb_initialize(void) get_paca()->stab_rr = SLB_NUM_BOLTED - 1; lflags = SLB_VSID_KERNEL | linear_llp; - vflags = SLB_VSID_KERNEL | vmalloc_llp; /* Invalidate the entire SLB (even entry 0) & all the ERATS */ asm volatile("isync":::"memory"); asm volatile("slbmte %0,%0"::"r" (0) : "memory"); asm volatile("isync; slbia; isync":::"memory"); create_shadowed_slbe(PAGE_OFFSET, mmu_kernel_ssize, lflags, LINEAR_INDEX); - create_shadowed_slbe(VMALLOC_START, mmu_kernel_ssize, vflags, VMALLOC_INDEX); /* For the boot cpu, we're running on the stack in init_thread_union, * which is in the first segment of the linear mapping, and also