From patchwork Wed May 9 02:20:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 910601 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=kvm-ppc-owner@vger.kernel.org; receiver=) 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="hRJejZ1S"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 40gg7Q1jBNz9s3q for ; Wed, 9 May 2018 12:20:34 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932526AbeEICUd (ORCPT ); Tue, 8 May 2018 22:20:33 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:42753 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932484AbeEICUc (ORCPT ); Tue, 8 May 2018 22:20:32 -0400 Received: by mail-pf0-f195.google.com with SMTP id p14so13471637pfh.9 for ; Tue, 08 May 2018 19:20:32 -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; bh=1gRPKAvkVAaO1AXAmEELOsLK+k+vLErNKU1QyIFasTk=; b=hRJejZ1SJtm9Cj4OUsfGKRqEcqMJUigNe7lYdHyyWizxzMsl7udya0PlTrpfCyzSXJ o2UrEAbcrElClYF1JRSAtTyGlLzLCnHip3Xo8Gfux7rS54eZXdPllpAnO6bi2hvsbFpl gu6X4uvCootoykBHuuRAxAuQlD9C7fnnYjsoD3Zs00FngfBol6n7Q9BGkJOor8zuWYKv I262wZd9vVroY8TdjM0QQ9aMxYg33clp7QL7OH8Ri6novWIhf8W+ZXwOD0/KD4AyksuN ZXIeclPcp+hO0C5QcLM4EJ+8x8yQaEEjJ68VmBBeXPopBWXHE+9yP/shTC1N4QXotuJz vZGg== 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; bh=1gRPKAvkVAaO1AXAmEELOsLK+k+vLErNKU1QyIFasTk=; b=JgVZXMZ20FsYN6Ptj/obFD5cRXARTcbjHZJfi6+8swwNoZAQyz3FSIvgZGyuaRHlrq 69DXpiAFSTUwpWd4fQkDykOh8kj5YVoPNcJ+xJAmAlIkiuB1TbdqltKpS/Rb/vn24Bt6 +IIvcjFvtA3WBtmBwq2IsrFkUrRiZxr8FxIXCSeB57+KnKUL32KoQcp6jIAbVpwHy2tS CWV8bMYebEKxOoNUZUQxO5vs7vcmUbWyxlBhx9vdzawypjX8Z4n+ahA9DriEC7mag5Mn NgX9KRsc03t2Lhvb45EIfQE9faMprLpjKXOvmdj0iS8IrixMaygohO/ttECKU1Vyxera xpiw== X-Gm-Message-State: ALQs6tCiWHQ9iGUxya1qNShQ8/tg1+tTs1Gb78DaKbhdAD5xeZ3OgKWs 1+TItCdIuuvQLjemZBnl9MExog== X-Google-Smtp-Source: AB8JxZqmZGZbDsDz+lnR9RqgL+GEsrQLpmVEa2/EcBk9Xl3FWeW1a3XJbExQRIwCIcflJINiB7LpPQ== X-Received: by 10.98.67.83 with SMTP id q80mr42293815pfa.228.1525832431434; Tue, 08 May 2018 19:20:31 -0700 (PDT) Received: from roar.au.ibm.com (59-102-70-78.tpgi.com.au. [59.102.70.78]) by smtp.gmail.com with ESMTPSA id 23sm90258616pfs.147.2018.05.08.19.20.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 May 2018 19:20:30 -0700 (PDT) From: Nicholas Piggin To: kvm-ppc@vger.kernel.org Cc: Nicholas Piggin Subject: [PATCH v2 0/9] assorted radix fixes and improvemets for page fault and invalidation Date: Wed, 9 May 2018 12:20:13 +1000 Message-Id: <20180509022022.21226-1-npiggin@gmail.com> X-Mailer: git-send-email 2.17.0 Sender: kvm-ppc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm-ppc@vger.kernel.org Here's various patches for radix, a few small bugfixes, tracepoint enablement or partition scope tlbie, and some page fault optimisation. This was tested with the patch to qemu that enables THP for partition scope page tables and things seem to work as expected. Changes since v1: - Feedback from Paul - Improved changelog in the page table umap patch (patch 4). - Changed and commented patch 4 to not expect ptes to be unmapped in the page fault path, because they should already be invalidated. Only unmap and free page tables. This has checks and warnings and some recovery code in case ptes are encountered. This is expensive compared to the page table unmap, but in my measurements this path is pretty rare so I leave it in unconditionally for now to help flush out bugs. We can rip it out or put it under a CONFIG easily it's just a few lines. - Fixed PWC flushing with recursive page table freeing (previous code would free child page tables before the parent was cleared ad PWC flushed, so the MMU may still have been able to reference them). - That fix to patch 4 required patch 5 as well, so those are squashed together. The nature of the code made it pointless to put patch 5 first. - Survived some basic stress testing overnight. Thanks, Nick Nicholas Piggin (9): KVM: PPC: Book3S HV: radix use correct tlbie sequence in kvmppc_radix_tlbie_page KVM: PPC: Book3S HV: radix clear pte when unmapping KVM: PPC: Book3S HV: use a helper to unmap ptes in the radix fault path KVM: PPC: Book3S HV: recursively unmap all page table entries when unmapping powerpc/mm/radix: implement LPID based TLB flushes to be used by KVM KVM: PPC: Book3S HV: radix use the Linux translation flush functions for partition scope KVM: PPC: Book3S HV: radix handle process scoped LPID flush in C, with relocation on KVM: PPC: Book3S HV: radix refine IO region partition scope attributes KVM: PPC: Book3S HV: radix do not clear partition pte when RC or write bits do not match .../include/asm/book3s/64/tlbflush-radix.h | 7 + arch/powerpc/kvm/book3s_64_mmu_radix.c | 349 +++++++++++------- arch/powerpc/kvm/book3s_hv.c | 26 ++ arch/powerpc/kvm/book3s_hv_rmhandlers.S | 13 +- arch/powerpc/mm/tlb-radix.c | 207 +++++++++++ 5 files changed, 467 insertions(+), 135 deletions(-)