Received: by 10.213.65.68 with SMTP id h4csp279350imn; Mon, 26 Mar 2018 21:41:20 -0700 (PDT) X-Google-Smtp-Source: AG47ELtzflwKArpoEv0w8jry20yBWhr9YBS3XUpRwdU9i69GLLPH3uvVyLjoe8LjRsQHGlTxmTk7 X-Received: by 2002:a17:902:8685:: with SMTP id g5-v6mr38887661plo.133.1522125680859; Mon, 26 Mar 2018 21:41:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522125680; cv=none; d=google.com; s=arc-20160816; b=eTFUL12Usit2g8OOR7HMKWsJ1PCHfqQrYysibc4Ur1uJiS414GrPINzbCEDJfgHqUe ZVeSYCcx08tLQsvmUyrxNId3S6lX7XjN3/SiEobgFq24sYM8KsRPyPHdcJc38uW31Qlf p/ve8DdLxp1rJZfAnHneivAYnDPk8KZ/HhGEuc6HXN6OD9Bh6bRON2dsUziQ4vcI80o2 4jiMPX+TeZgQqXXiCJqcubYh7+w/3FhbgKMrx2kYmqyQVA15sWv6dxmKlVhMg4P2txil wVFEc9MJyd2iPMJa+GiLd68xt1MALA+U53S4OznNmCrWNosJGA7Tvg3+gtOwX+E6A3SP pWHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:user-agent :in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:dkim-signature:arc-authentication-results; bh=+JsZpcZmdFz+aTbyS/VdyjkHdU/GDzzv5LzmmME6E2o=; b=iqWRaK5+D+SM0wsj+L2lLIrCXCP+wGfqdLa52qB2kqc2gR0A/RGprXmUWUf1OJAAEV kFt0jSUk+1c/6KUzL7BuiqaUEiGNp/pjRrMav0hrcKxO5S45pXzOmSu8SZ4/bTYa7d+0 1Sx1dpjD++PopQfEz3gpHiezwCCuM74HjVj2XAxXk+EE5RG89uco6bkahZOVeiQuGBB2 xjLsJxZvBFC3hIA1O1dsdkh8926qPjaYgc9JoaBTKf5uGNcKeaWcBlQa9cdnccr02Zwx yAp1eYO/4Et7seQqIednvhe+Z2s7mTkX3Yq3x1pabeB9vJAHuDCcB8tleyPD8Clkzx5F +9kg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=AuU38TRe; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f19-v6si422836plr.411.2018.03.26.21.41.06; Mon, 26 Mar 2018 21:41:20 -0700 (PDT) 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; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=AuU38TRe; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751008AbeC0EkA (ORCPT + 99 others); Tue, 27 Mar 2018 00:40:00 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:39514 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750753AbeC0Ej6 (ORCPT ); Tue, 27 Mar 2018 00:39:58 -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 w2R4SP6p106726; Tue, 27 Mar 2018 04:39:44 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to : content-transfer-encoding; s=corp-2017-10-26; bh=+JsZpcZmdFz+aTbyS/VdyjkHdU/GDzzv5LzmmME6E2o=; b=AuU38TRek5mfWVYu8jGgceDI9GK6bdOKY3xN6JSV9bB7oMlbA3zLuiZlJebl6juXGOFp rHa5iZ0zq19y/b3aujD4V+D6kLbY8b8jXST5e36eAQlQ/ofpdVencDc8mKuOW32ngCwZ 9dF6kBB6HADFytrNVJYQCTb2wWbvCrB6Ttar4aSEgtTyDXVmjnwI+U6ka858833928hr 1OEx+awMFMVJvlj+GRmgXW/u16TEu3y/fWPJXPmQxLhDaCWAFYNM9x5XzoEnvXmW3NUA 24Qu8Ng7n3PmPIZZMoABNoJw1wcd/UV/qYEMFvweM8zHDPMQqG4/O5DHs3Ehfn2qObP5 fg== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by aserp2120.oracle.com with ESMTP id 2gyey7r0pu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 27 Mar 2018 04:39:44 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w2R4chag007748 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 27 Mar 2018 04:38:44 GMT Received: from abhmp0015.oracle.com (abhmp0015.oracle.com [141.146.116.21]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w2R4cgpX004616; Tue, 27 Mar 2018 04:38:43 GMT Received: from char.us.oracle.com (/10.137.176.158) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 26 Mar 2018 21:38:42 -0700 Received: by char.us.oracle.com (Postfix, from userid 1000) id 8FDC16A0095; Tue, 27 Mar 2018 00:38:41 -0400 (EDT) Date: Tue, 27 Mar 2018 00:38:41 -0400 From: Konrad Rzeszutek Wilk To: Wanpeng Li Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Paolo Bonzini , Radim =?utf-8?B?S3LEjW3DocWZ?= , Andrew Cooper Subject: Re: [PATCH 1/2] KVM: VMX: Introduce handle_ud() Message-ID: <20180327043841.GA16974@char.us.oracle.com> References: <1522116735-4861-1-git-send-email-wanpengli@tencent.com> <1522116735-4861-2-git-send-email-wanpengli@tencent.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1522116735-4861-2-git-send-email-wanpengli@tencent.com> User-Agent: Mutt/1.8.3 (2017-05-23) Content-Transfer-Encoding: quoted-printable X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8844 signatures=668695 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1803270044 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 26, 2018 at 07:12:14PM -0700, Wanpeng Li wrote: > From: Wanpeng Li >=20 > Introduce handle_ud() to handle invalid opcode, this function will be=20 > used by later patches. >=20 Reviewed-by: Konrad Rzeszutek Wilk Thank you! > Cc: Paolo Bonzini > Cc: Radim Kr=C4=8Dm=C3=A1=C5=99 > Cc: Andrew Cooper > Signed-off-by: Wanpeng Li > --- > arch/x86/kvm/vmx.c | 22 ++++++++++++++-------- > 1 file changed, 14 insertions(+), 8 deletions(-) >=20 > diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c > index 9bc05f5..0f99833 100644 > --- a/arch/x86/kvm/vmx.c > +++ b/arch/x86/kvm/vmx.c > @@ -6215,6 +6215,18 @@ static int handle_machine_check(struct kvm_vcpu = *vcpu) > return 1; > } > =20 > +static int handle_ud(struct kvm_vcpu *vcpu) > +{ > + enum emulation_result er; > + > + er =3D emulate_instruction(vcpu, EMULTYPE_TRAP_UD); > + if (er =3D=3D EMULATE_USER_EXIT) > + return 0; > + if (er !=3D EMULATE_DONE) > + kvm_queue_exception(vcpu, UD_VECTOR); > + return 1; > +} > + > static int handle_exception(struct kvm_vcpu *vcpu) > { > struct vcpu_vmx *vmx =3D to_vmx(vcpu); > @@ -6233,14 +6245,8 @@ static int handle_exception(struct kvm_vcpu *vcp= u) > if (is_nmi(intr_info)) > return 1; /* already handled by vmx_vcpu_run() */ > =20 > - if (is_invalid_opcode(intr_info)) { > - er =3D emulate_instruction(vcpu, EMULTYPE_TRAP_UD); > - if (er =3D=3D EMULATE_USER_EXIT) > - return 0; > - if (er !=3D EMULATE_DONE) > - kvm_queue_exception(vcpu, UD_VECTOR); > - return 1; > - } > + if (is_invalid_opcode(intr_info)) > + return handle_ud(vcpu); > =20 > error_code =3D 0; > if (intr_info & INTR_INFO_DELIVER_CODE_MASK) > --=20 > 2.7.4 >=20