{"id":831061,"url":"http://patchwork.ozlabs.org/api/1.2/covers/831061/?format=json","web_url":"http://patchwork.ozlabs.org/project/kvm-ppc/cover/1509079594-28977-1-git-send-email-paulus@ozlabs.org/","project":{"id":23,"url":"http://patchwork.ozlabs.org/api/1.2/projects/23/?format=json","name":"KVM PowerPC development","link_name":"kvm-ppc","list_id":"kvm-ppc.vger.kernel.org","list_email":"kvm-ppc@vger.kernel.org","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<1509079594-28977-1-git-send-email-paulus@ozlabs.org>","list_archive_url":null,"date":"2017-10-27T04:46:28","name":"[v2,0/6] KVM: PPC: Book3S HV: Run HPT guests on radix hosts","submitter":{"id":67079,"url":"http://patchwork.ozlabs.org/api/1.2/people/67079/?format=json","name":"Paul Mackerras","email":"paulus@ozlabs.org"},"mbox":"http://patchwork.ozlabs.org/project/kvm-ppc/cover/1509079594-28977-1-git-send-email-paulus@ozlabs.org/mbox/","series":[{"id":10490,"url":"http://patchwork.ozlabs.org/api/1.2/series/10490/?format=json","web_url":"http://patchwork.ozlabs.org/project/kvm-ppc/list/?series=10490","date":"2017-10-27T04:46:28","name":"KVM: PPC: Book3S HV: Run HPT guests on radix hosts","version":2,"mbox":"http://patchwork.ozlabs.org/series/10490/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/covers/831061/comments/","headers":{"Return-Path":"<kvm-ppc-owner@vger.kernel.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=kvm-ppc-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tsecure) header.d=ozlabs.org header.i=@ozlabs.org header.b=\"Rhu/luFN\";\n\tdkim-atps=neutral"],"Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3yNWYf68xpz9t3V\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 27 Oct 2017 15:46:46 +1100 (AEDT)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751584AbdJ0Eqp (ORCPT <rfc822;incoming@patchwork.ozlabs.org>);\n\tFri, 27 Oct 2017 00:46:45 -0400","from ozlabs.org ([103.22.144.67]:39559 \"EHLO ozlabs.org\"\n\trhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP\n\tid S1751158AbdJ0Eqo (ORCPT <rfc822;kvm-ppc@vger.kernel.org>);\n\tFri, 27 Oct 2017 00:46:44 -0400","from authenticated.ozlabs.org (localhost [127.0.0.1])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPSA id 3yNWYb0KTNz9t2d;\n\tFri, 27 Oct 2017 15:46:43 +1100 (AEDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ozlabs.org; s=201707; \n\tt=1509079603; bh=gFLH6DA9jRouHM2BdOFjFxeZUggDTOo06Wu9Q0BMLeI=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=Rhu/luFNNoGp99NsBlqMN/9RcgTCfJkW80+FIY+u3kNg3SEosrl3sVqSUjgcvngSD\n\tmwqRiPriywTRPLrKS/FpSVKHW+u2q7yhd2DcRM3NqdcTGdwsRlubvGMnvYZJRR9wQ5\n\tjv3vh6uA8Gf1AIMSJvukStNldCZYLellFvz9hTmQjot7NudYMkD3eNttvMUCEw9TLi\n\tXCV5oNloLOJ5Bmz5sPhtJyNDGryckYeZSVbgXBAmk2uoli2kY1ClfLqaHahxlL1uvv\n\tx3AZZOmY03zRV/WPv6Xs1TQBO+SVIn+7jhSYy4514knR4KO0H5nCYOaaykZvP5zh7N\n\tcDKGTqMK8lyug==","From":"Paul Mackerras <paulus@ozlabs.org>","To":"kvm@vger.kernel.org, kvm-ppc@vger.kernel.org","Cc":"david@gibson.dropbear.id.au","Subject":"[PATCH v2 0/6] KVM: PPC: Book3S HV: Run HPT guests on radix hosts","Date":"Fri, 27 Oct 2017 15:46:28 +1100","Message-Id":"<1509079594-28977-1-git-send-email-paulus@ozlabs.org>","X-Mailer":"git-send-email 2.7.4","Sender":"kvm-ppc-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<kvm-ppc.vger.kernel.org>","X-Mailing-List":"kvm-ppc@vger.kernel.org"},"content":"Currently, on POWER9 machines using HV KVM, the host kernel will use\none or other of the two MMU modes available, HPT (hashed page table)\nor radix, and all KVM guests must use the same MMU mode.  This is\ninconvenient because it means that a guest on a radix host can't run a\nlegacy OS that doesn't know about POWER9.  On the other hand, if the\nhost is booted in HPT mode so that legacy guest kernels can be run,\nthen neither the host nor any other guest can take advantage of the\nradix MMU mode.\n\nTo further complicate matters, current POWER9 chips have the\nrestriction that all SMT threads in each core must use the same MMU\nmode (HPT or radix), though they can be in different partitions.\n\nThis patch series adds the ability to run HPT guests on a host in\nradix mode.  In order to comply with the restriction of not mixing HPT\nand radix threads on the same core, we take a similar approach to that\nalready used on POWER8, namely, run the host in single-threaded mode\n(only thread 0 of each core online), and have KVM be able to wake up\nthe other threads when a KVM guest is to be run, and use the other\nthreads for running guest VCPUs.\n\nSo that KVM knows whether it should be managing individual threads on\nPOWER9 (as it does currently) or whole cores, we add a new module\nparameter called \"indep_threads_mode\".  This is normally Y on POWER9\nbut must be set to N before any HPT guests can be run on a radix\nhost.  The value of indep_threads_mode is sampled at the time of\ncreation of each guest, and the value at the time of creation is what\napplies to that guest for the whole of its lifetime.  It is preferable\nto change indep_threads_mode only when no guests are running, in\norder to avoid confusion or unnecessarily reduced performance.\n\nIn order to allow HPT guests to run on a radix host, the following\ncommands (or their equivalents) are required first:\n\n# echo N >/sys/module/kvm_hv/parameters/indep_threads_mode\n# ppc64_cpu --smt=off\n\nKVM will run up to four vcpus on each core using the existing dynamic\nmicro-threading code.  This can be controlled using the\ntarget_smt_mode module parameter.\n\nThis patch series is against my kvm-ppc-next branch with the\ntopic/ppc-kvm branch from the powerpc merged in.\n\nIn this version, I have dropped the patch 'Revert \"KVM: PPC: Book3S\nHV: POWER9 does not require secondary thread management\"' since it has\nbeen merged in the powerpc tree, and I have added a patch to unify the\ndirty bit management between HPT and radix, so now the dirty bits do\nnot get lost when switching between HPT and radix modes.\n\nPaul.\n\n arch/powerpc/include/asm/kvm_book3s.h     |   3 +-\n arch/powerpc/include/asm/kvm_book3s_64.h  | 140 +++++++++++--\n arch/powerpc/include/asm/kvm_book3s_asm.h |  13 +-\n arch/powerpc/include/asm/kvm_host.h       |   6 +-\n arch/powerpc/include/asm/kvm_ppc.h        |   3 +\n arch/powerpc/kernel/asm-offsets.c         |   3 +\n arch/powerpc/kvm/book3s_64_mmu_hv.c       | 110 +++++-----\n arch/powerpc/kvm/book3s_64_mmu_radix.c    |  51 +----\n arch/powerpc/kvm/book3s_hv.c              | 321 +++++++++++++++++++-----------\n arch/powerpc/kvm/book3s_hv_builtin.c      |  99 ++++++++-\n arch/powerpc/kvm/book3s_hv_rm_mmu.c       |  65 +++---\n arch/powerpc/kvm/book3s_hv_rmhandlers.S   |  65 +++++-\n arch/powerpc/kvm/powerpc.c                |   3 +-\n 13 files changed, 605 insertions(+), 277 deletions(-)\n\n--\nTo unsubscribe from this list: send the line \"unsubscribe kvm-ppc\" in\nthe body of a message to majordomo@vger.kernel.org\nMore majordomo info at  http://vger.kernel.org/majordomo-info.html"}