From patchwork Sun Sep 16 12:46:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liran Alon X-Patchwork-Id: 10601693 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2CC66112B for ; Sun, 16 Sep 2018 12:48:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 23E2529DB1 for ; Sun, 16 Sep 2018 12:48:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 130BA29EA1; Sun, 16 Sep 2018 12:48:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1056929DB1 for ; Sun, 16 Sep 2018 12:48:02 +0000 (UTC) Received: from localhost ([::1]:58975 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1WT3-0006pR-He for patchwork-qemu-devel@patchwork.kernel.org; Sun, 16 Sep 2018 08:48:01 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54521) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1WS4-00067Y-2V for qemu-devel@nongnu.org; Sun, 16 Sep 2018 08:47:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g1WS0-0006Ov-UZ for qemu-devel@nongnu.org; Sun, 16 Sep 2018 08:47:00 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:33880) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g1WS0-0006Nx-Kz for qemu-devel@nongnu.org; Sun, 16 Sep 2018 08:46:56 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w8GCeqGA183203; Sun, 16 Sep 2018 12:46:52 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id; s=corp-2018-07-02; bh=qUpkri1E4JWcdr7ns4RKdksomUEFsEw47oZfTK5xMpM=; b=DkhfbT+dp/xoGmaukTAqVaEnfz7U+gIqjiEByKS9RGhW1cOvFTdfzDTetLUPYOlFdyh0 LyQfjoJ3Twj5TrZd5l497cOmIo2l7xw/s7/YGNvD/CzEC1RcNX4jRSg5fSrwpuTgxExO xGdGfUE9GDxPZ7u5vdrscOY+psdOq1B/hBt2ZjQuYdK3Luuh3q8olElZm3pTfGrBUh/K xwjmTI47CdyzOsV5h3b+Ogt2UY2TUURE33zdQU6oEBpFlOZ+a7qHQOPcY/hC2/5VciyK KhdLmBARJlVq1aRE/VE7jS9UQeY1HT2l4bEGCQ9Zgev3w01x97k7EV++JBuXx1kJ2nwo FA== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp2120.oracle.com with ESMTP id 2mgtqqjjrr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 16 Sep 2018 12:46:52 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w8GCkpDR029625 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 16 Sep 2018 12:46:51 GMT Received: from abhmp0013.oracle.com (abhmp0013.oracle.com [141.146.116.19]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w8GCkoe3028304; Sun, 16 Sep 2018 12:46:50 GMT Received: from spark.ravello.local (/213.57.127.2) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sun, 16 Sep 2018 05:46:50 -0700 From: Liran Alon To: qemu-devel@nongnu.org Date: Sun, 16 Sep 2018 15:46:29 +0300 Message-Id: <20180916124631.39016-1-liran.alon@oracle.com> X-Mailer: git-send-email 2.16.1 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9017 signatures=668708 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=1 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=789 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1809160140 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 156.151.31.85 Subject: [Qemu-devel] [QEMU PATCH v2 0/2]: KVM: i386: Add support for save and restore nested state X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: ehabkost@redhat.com, kvm@vger.kernel.org, mtosatti@redhat.com, pbonzini@redhat.com, rth@twiddle.net, jmattson@google.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Hi, This series aims to add support for QEMU to be able to migrate VMs that are running nested hypervisors. In order to do so, it utilizes the new IOCTLs introduced in KVM commit 8fcc4b5923af ("kvm: nVMX: Introduce KVM_CAP_NESTED_STATE") which were created for this purpose. 1st patch is not really related to the goal of the patch series. It just makes CPUX86State->xsave_buf to be compiled only when needed (When compiling with KVM or HVF CPU accelerator). 2nd patch adds the support to migrate VMs that are running nested hypervisors. Regards, -Liran v1->v2 Changes: * Renamed kvm_nested_state_length() to kvm_max_nested_state_length() to better indicate it represents the max nested state size that can be returned from kernel. * Added error_report() calls to nested_state_post_load() to make failures in migration easier to diagnose. * Fixed support of migrating with various nested_state buffer sizes. The following scenarios were tested: (a) src and dest have same nested state size. ==> Migration succeeds. (b) src don't have nested state while dest do. ==> Migration succeed and src don't send it's nested state. (c) src have nested state while dest don't. ==> Migration fails as it cannot restore nested state. (d) dest have bigger max nested state size than src ==> Migration succeeds. (e) dest have smaller max nested state size than src but enough to store it's saved nested state ==> Migration succeeds (f) dest have smaller max nested state size than src but not enough to store it's saved nested state ==> Migration fails