From patchwork Fri Dec 21 03:28:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suraj Jitindar Singh X-Patchwork-Id: 1017243 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=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="GfmMSjCu"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 43LYy12fQNz9sMQ for ; Fri, 21 Dec 2018 14:28:57 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388807AbeLUD24 (ORCPT ); Thu, 20 Dec 2018 22:28:56 -0500 Received: from mail-pg1-f193.google.com ([209.85.215.193]:46261 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388804AbeLUD24 (ORCPT ); Thu, 20 Dec 2018 22:28:56 -0500 Received: by mail-pg1-f193.google.com with SMTP id w7so1818230pgp.13; Thu, 20 Dec 2018 19:28:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=u1N1ADHX0O7Ro4nA88bezjnwQN9zVLdjg9FEZ9JJMh0=; b=GfmMSjCuO/hbX19Ie7DN4eHoFqKX5+Cty+x6LX1L8QgZHbZ5EA6i5aE7uiZ6ygpaKa Tlds6z+RiFviKN6WT30XVbW3i5g/lfBA+6L4LpwEplxYPvXiVarpwKYYD1FmUX2n85HX 5rKCGrYCOhx8IeIKQJ9WHc169u/B1VF4UM6Tu1w4uL6m5toqLbTz1l2x3rq6ZsldcQh/ PW/oWuP906G8b7XwsuuaASYQLtOxHuxjz1cjlCYqEuNkWzCdoO8rG3r3fk6jNezY2std rAZJnflCOi/B6Rk2WdGQ5cIcEhVJlBm9HES/Jew9NX7Qey7+Ex4cEIKVFpBduZXACdGH 98GQ== 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=u1N1ADHX0O7Ro4nA88bezjnwQN9zVLdjg9FEZ9JJMh0=; b=MCZYPub0zgNxlwfSbrYOaIuCRx/V9fox87fTOpp5FctlhTfqBOLeSQGZ/sgyiTvtYe Cxx8gN4/BsP7kjEHb6pSpEWCmaaAzoXkpFNF7wCPCcKedcqV/dDEUIxuRpewn8cRu4zP Wsu3achxI3mK73o/4S90XRNpfIgdokwnH+GlhnLJ627YxoVYAugPEW4V++nJ967GnxRz Bxr06cSD945ol/kUxiV7sXSuNXTx6qPeHccSnayBrO5TnvewPP0BDuXp6l9df0Jibico qGyRzHr6Oc8DfIy3n6v3hRc1mwth3Nv5MBnLiIX5Lk4DCmUpseN7ed++2FOJ8EisWkeo uCew== X-Gm-Message-State: AJcUukdyWcZdVePsSDW+ZXRMZbMH2yBYluZo38cKkdHCSga5AogTPi0E chJHNt/mSvMYKVpgbI93wgr9xlzC X-Google-Smtp-Source: ALg8bN61TjkPnsf/TAOQIG0T+XaJ/9NBPm1/XNMr5w3rplUpf2uR0AHhseHGr8HLV4CCBwNMJoQeow== X-Received: by 2002:a63:5d14:: with SMTP id r20mr782300pgb.329.1545362935272; Thu, 20 Dec 2018 19:28:55 -0800 (PST) Received: from surajjs2.ozlabs.ibm.com ([122.99.82.10]) by smtp.gmail.com with ESMTPSA id n68sm33062582pfb.62.2018.12.20.19.28.51 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 20 Dec 2018 19:28:54 -0800 (PST) From: Suraj Jitindar Singh To: kvm-ppc@vger.kernel.org Cc: kvm@vger.kernel.org, paulus@ozlabs.org, david@gibson.dropbear.id.au, mdroth@linux.vnet.ibm.com, Suraj Jitindar Singh Subject: [PATCH 0/5] KVM: PPC: Book3S HV: Fix dirty page logging for a nested guest Date: Fri, 21 Dec 2018 14:28:38 +1100 Message-Id: <20181221032843.13012-1-sjitindarsingh@gmail.com> X-Mailer: git-send-email 2.13.6 Sender: kvm-ppc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm-ppc@vger.kernel.org The following series fixes dirty page logging for when nested guests are being run. The dirty page state of an L1 guest was found to be inaccurate from an L0 point of view when L1 was running guests. Also the dirty page state of an L2 guest from an L1 point of view was inaccurate. Fix this by: - Ensuring nested-rmap entries are inserted correctly so that they can be retrieved. - Ensuring that rc bits in the shadow page table are set correctly at creation time so that L1 is informed when pages are dirtied - Ensuring that rc bits in the shadow page table are cleared when L0 clears them in an L1 pte so that the nested guest cannot continue to write to the page Suraj Jitindar Singh (5): KVM: PPC: Book3S HV: Hold kvm->mmu_lock across updating nested pte rc bits KVM: PPC: Book3S HV: Align gfn to L1 page size when inserting nest-rmap entry KVM: PPC: Book3S HV: Apply combination of host and l1 pte rc for nested guest KVM: PPC: Book3S HV: Introduce kvmhv_update_nest_rmap_rc_list() KVM: PPC: Book3S HV: Keep rc bits in shadow pgtable in sync with host arch/powerpc/include/asm/kvm_book3s.h | 2 + arch/powerpc/include/asm/kvm_book3s_64.h | 3 ++ arch/powerpc/kvm/book3s_64_mmu_radix.c | 30 +++++++++---- arch/powerpc/kvm/book3s_hv_nested.c | 74 +++++++++++++++++++++++++++++--- 4 files changed, 95 insertions(+), 14 deletions(-)