From patchwork Thu Sep 6 13:32:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liran Alon X-Patchwork-Id: 10590629 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 3B3B613BB for ; Thu, 6 Sep 2018 13:33:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 321D82A2DF for ; Thu, 6 Sep 2018 13:33:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 260842A36E; Thu, 6 Sep 2018 13:33: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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 761DA2AB8A for ; Thu, 6 Sep 2018 13:33:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729606AbeIFSId (ORCPT ); Thu, 6 Sep 2018 14:08:33 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:52790 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727708AbeIFSId (ORCPT ); Thu, 6 Sep 2018 14:08:33 -0400 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w86DTYrA099148; Thu, 6 Sep 2018 13:32:51 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=xxV6Gu9dawgWsL9RYzyYmXPoWhgMmwUHlxTvlOBPzlE=; b=nw4f9S6+N7a654eOBIo6e83I7ECA7xTQwQgI110K5DmaaTJ5h9ISjYRTmWtRT7a1XR4q BOrfXcYz2wz28wqKH2Vl8O6sULzZfcA+7Cvw5qgy/jD9i/kbn4LyqSIkIcH3BKpg9hPY JgSWKg19fZbAGPai6ua3xKNm+4hFfbz8yaYmFZgMnKvUP6ndpKN7VM3GDJoqpGXZa/c1 uLoY+7+OH34zuMKjJdRqh6/A5gWRk1GfUbKoJmB7lJVvj6zyMlw4nU3+ZSLQd5Q5OnBD 1KvBYwmtcekm+gux+q5DHsXPXmRj+rQ0xXRSg9cZmKYYhLHxRUawEak4wghfrqWFap7s QA== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by aserp2120.oracle.com with ESMTP id 2m7jqpv5as-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 06 Sep 2018 13:32:51 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w86DWjdR020832 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 6 Sep 2018 13:32:45 GMT Received: from abhmp0009.oracle.com (abhmp0009.oracle.com [141.146.116.15]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w86DWjvi030246; Thu, 6 Sep 2018 13:32:45 GMT Received: from spark.ravello.local (/213.57.127.2) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 06 Sep 2018 06:32:44 -0700 From: Liran Alon To: pbonzini@redhat.com, rkrcmar@redhat.com, kvm@vger.kernel.org Cc: jmattson@google.com, idan.brown@oracle.com Subject: [PATCH 0/4]: KVM: nVMX: Consider TLB are tagged with different EPTP if L1 uses EPT Date: Thu, 6 Sep 2018 16:32:24 +0300 Message-Id: <20180906133228.118282-1-liran.alon@oracle.com> X-Mailer: git-send-email 2.16.1 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9007 signatures=668708 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=528 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1809060137 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi, This patch series aim to enhance L1<->L2 transitions to avoid unnecessary TLB flushes in case L1 uses VPID and EPT. The 1st patch fixes a bug that INVEPT was executed on L1<->L2 transitions to flush TLB but with the wrong EPTP because it hasn't been loaded yet with the destination EPTP. The patch handles this issue easily by just delaying vmx_flush_tlb() to be called after EPTP has been set to destination by using KVM_REQ_TLB_FLUSH. The 2nd patch avoids unnecessary flushing TLB on L2->L1 VMExit if L1 uses VPID and EPT. This is because TLB entries of L1 and L2 are separated by the fact they are tagged with different EPTP. The 3rd patch modifies L1->L2 VMEntry code such that it will set vmcs02->vpid to vmcs12->vpid in case L1 uses EPT. This leverages the fact TLB entries of L1 and L2 are separated by being tagged with different EPTPs and therefore we don't need to use the special vpid02. The 4rd patch then modifies L1->L2 VMEntry code to avoid unnecessary flushing TLB in case L1 uses both VPID and EPT as TLB entries of L1 and L2 are separated by different EPTP tags. Regards, -Liran