From: David Hildenbrand Subject: Re: [PATCH 7/8] kvm: nVMX: Introduce KVM_CAP_VMX_STATE Date: Mon, 12 Dec 2016 15:14:18 +0100 Message-ID: <0aacdfe3-3b37-d977-a377-c6ba127405a2@redhat.com> References: <1480536229-11754-1-git-send-email-jmattson@google.com> <1480536229-11754-8-git-send-email-jmattson@google.com> <555d6a5a-fd6d-e1c2-6a40-3ecfbb09b379@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit To: Paolo Bonzini , Jim Mattson , kvm@vger.kernel.org, David Hildenbrand Return-path: Received: from mx1.redhat.com ([209.132.183.28]:57824 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751640AbcLLOOV (ORCPT ); Mon, 12 Dec 2016 09:14:21 -0500 In-Reply-To: Sender: kvm-owner@vger.kernel.org List-ID: >> >> s390x doesn't have _any_ SIE state in the hardware. All g2 state is in >> g1 memory and therefore migrated. So there is nothing needed at that >> point for migration. It just works :) >> >> shadowed SCBs (SIE control blocks) are simply recreated on the target >> (after every VSIE execution, we write the data back into g1, so >> whenever we leave the interception handler, we act according to the SIE >> architecture). > > If you get a userspace vmexit during vSIE, do you always exit the vSIE? > If not, the SIE operand is a hidden piece of processor state that you > need in order to restart execution of the vCPU. This would be more or > less the same as what's needed for x86 AMD. For s390x, there are no instructions emulated for the vSIE, not even in kernel space. So every time we leave our interception handler, the vSIE has been fully handled and the next step would be to execute our g1 again. Please note that (v)SIE and SIE don't share any code paths. vSIE is really just an interception handler, emulating the SIE instruction (by calling SIE in return). So if we drop to user space (e.g. due to a signal), the vSIE has been fully processed and the g2 SCB block has already been copied back to g1. When re-entering kernel space, g1 is executed (continuing after the SIE instruction), which will in return do a handful of checks and execute g2 again (using SIE - intercept - vSIE). So there is no hidden piece of processor state. Everytime we drop to user space, everything is properly stored in g1 memory and therefore migrated. As these user space exits are really rare, we don't have to optimize for that. And I think if that should ever be needed, this interface should be sufficient to extract/set hidden state. -- David