From owner-svn-src-projects@FreeBSD.ORG Mon Oct 21 23:46:38 2013 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 46E7926A; Mon, 21 Oct 2013 23:46:38 +0000 (UTC) (envelope-from neel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 34AA82FB5; Mon, 21 Oct 2013 23:46:38 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9LNkcIa042126; Mon, 21 Oct 2013 23:46:38 GMT (envelope-from neel@svn.freebsd.org) Received: (from neel@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9LNkcL7042125; Mon, 21 Oct 2013 23:46:38 GMT (envelope-from neel@svn.freebsd.org) Message-Id: <201310212346.r9LNkcL7042125@svn.freebsd.org> From: Neel Natu Date: Mon, 21 Oct 2013 23:46:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r256867 - projects/bhyve_svm/sys/amd64/vmm/amd X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2013 23:46:38 -0000 Author: neel Date: Mon Oct 21 23:46:37 2013 New Revision: 256867 URL: http://svnweb.freebsd.org/changeset/base/256867 Log: The ASID allocation in SVM is incorrect because it allocates a single ASID for all vcpus belonging to a guest. This means that when different vcpus belonging to the same guest are executing on the same host cpu there may be "leakage" in the mappings created by one vcpu to another. The proper fix for this is being worked on and will be committed shortly. In the meantime workaround this bug by flushing the guest TLB entries on every VM entry. Submitted by: Anish Gupta (akgupt3@gmail.com) Modified: projects/bhyve_svm/sys/amd64/vmm/amd/svm.c Modified: projects/bhyve_svm/sys/amd64/vmm/amd/svm.c ============================================================================== --- projects/bhyve_svm/sys/amd64/vmm/amd/svm.c Mon Oct 21 22:55:56 2013 (r256866) +++ projects/bhyve_svm/sys/amd64/vmm/amd/svm.c Mon Oct 21 23:46:37 2013 (r256867) @@ -955,8 +955,13 @@ svm_vmrun(void *arg, int vcpu, register_ /* Can't use any cached VMCB state by cpu.*/ ctrl->vmcb_clean = VMCB_CACHE_NONE; } else { - /* Don't flush TLB since guest ASID is unchanged. */ - ctrl->tlb_ctrl = VMCB_TLB_FLUSH_NOTHING; + /* + * XXX: Using same ASID for all vcpus of a VM will cause TLB + * corruption. This can easily be produced by muxing two vcpus + * on same core. + * For now, flush guest TLB for every vmrun. + */ + ctrl->tlb_ctrl = VMCB_TLB_FLUSH_GUEST; /* * This is the same cpu on which vcpu last ran so don't