Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp8251139ybl; Tue, 24 Dec 2019 18:22:04 -0800 (PST) X-Google-Smtp-Source: APXvYqwBpAP7sK75pSw1Em9bYhoof0Y7a/7qbeKbX1XMep+34ojLx8SP+jchHiTZqRI698ge7m0w X-Received: by 2002:a05:6830:10d7:: with SMTP id z23mr41755811oto.114.1577240524353; Tue, 24 Dec 2019 18:22:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577240524; cv=none; d=google.com; s=arc-20160816; b=Lh94HldNssSW30NEecUVA98WA28fLWTJndtUfyzpMXy2EpbHhlKa2uOi9fAjnecGHA 2dLBao6bKam7FBo7xLpnMfBT8eALXEDXQzqvHzEwLcrqeY1wBnDdYlDatchCrcvwwxe6 QE2qaLSfYp8H76Gd4wWP9h+5WiP/b3EqGpZM08dMCTq5/tPjen/SUYr9DPSpovBxesQ5 wE/KQQWGSugyer1qpLrhkLpUZLqsbrySFw7CZCScOyfCNip5eoeqiUJFK2YMckNNG+Qz tRf7x7jwmr7AT5YP4TUSgYOIgGc8gEoByhIjMxAIDRSFymnYPgo0Rzxxu9ULdtCLLcQI O4rg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=k+3+/psGKyTyce4a6iSbv9w2k6hDkMuNosbwVK2q2Ks=; b=CffvEDG03DAwL3vSstK/JVm5yNb7C8LBegdm7ay+04ifrj9WvmyJ1Sae4Eodj4R6oE /gBEBEMlNUqnbmk1BPYFfYCDl6xQ7FgNqTdhLaTCyKrzuCXA9CiFvnIFJD9/3hllupG4 0Av6BwDS+HjuqKOT0NToNotewZze2m3nPpMaDKZGoIZCRj6Xn/DvLGYMKImfwIsU68S0 nK2V1leC7FiUIaTgMF6HnLoTV0N7TBzLV4yyq865sBQNX5yZVIVwO+z/py7wTLOGWNm8 1yTfzsH1wqxSm082o8R/ZJy4kI1nIE/Rhr7DXACjJkFrULxtZaFQJEQDynlRrajA6jom 33Vg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s6si13107062otp.126.2019.12.24.18.21.40; Tue, 24 Dec 2019 18:22:04 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726316AbfLYCUH (ORCPT + 99 others); Tue, 24 Dec 2019 21:20:07 -0500 Received: from szxga07-in.huawei.com ([45.249.212.35]:44692 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726259AbfLYCUH (ORCPT ); Tue, 24 Dec 2019 21:20:07 -0500 Received: from DGGEMS406-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id ED51ABED064994ED5F36; Wed, 25 Dec 2019 10:20:01 +0800 (CST) Received: from huawei.com (10.175.105.18) by DGGEMS406-HUB.china.huawei.com (10.3.19.206) with Microsoft SMTP Server id 14.3.439.0; Wed, 25 Dec 2019 10:19:55 +0800 From: linmiaohe To: , , , , , , , , , , CC: , , , Subject: [PATCH] KVM: nvmx: retry writing guest memory after page fault injected Date: Wed, 25 Dec 2019 10:21:41 +0800 Message-ID: <1577240501-763-1-git-send-email-linmiaohe@huawei.com> X-Mailer: git-send-email 1.8.3.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.105.18] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Miaohe Lin We should retry writing guest memory when kvm_write_guest_virt_system() failed and page fault is injected in handle_vmread(). Signed-off-by: Miaohe Lin --- arch/x86/kvm/vmx/nested.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c index 8edefdc9c0cb..c1ec9f25a417 100644 --- a/arch/x86/kvm/vmx/nested.c +++ b/arch/x86/kvm/vmx/nested.c @@ -4799,8 +4799,10 @@ static int handle_vmread(struct kvm_vcpu *vcpu) instr_info, true, len, &gva)) return 1; /* _system ok, nested_vmx_check_permission has verified cpl=0 */ - if (kvm_write_guest_virt_system(vcpu, gva, &value, len, &e)) + if (kvm_write_guest_virt_system(vcpu, gva, &value, len, &e)) { kvm_inject_page_fault(vcpu, &e); + return 1; + } } return nested_vmx_succeed(vcpu); -- 2.19.1